Merge pull request #5801 from jdufresne/modanalyzer-bytes

Remove unnecessary bytes type check in ModuleAnalyzer.for_string()
This commit is contained in:
Takeshi KOMIYA 2018-12-16 20:10:51 +09:00 committed by GitHub
commit d160adb811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@
"""
import re
from io import BytesIO, StringIO
from io import StringIO
from zipfile import ZipFile
from sphinx.errors import PycodeError
@ -29,8 +29,6 @@ class ModuleAnalyzer:
@classmethod
def for_string(cls, string, modname, srcname='<string>'):
# type: (str, str, str) -> ModuleAnalyzer
if isinstance(string, bytes):
return cls(BytesIO(string), modname, srcname)
return cls(StringIO(string), modname, srcname, decoded=True)
@classmethod