mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5801 from jdufresne/modanalyzer-bytes
Remove unnecessary bytes type check in ModuleAnalyzer.for_string()
This commit is contained in:
commit
d160adb811
@ -10,7 +10,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from io import BytesIO, StringIO
|
from io import StringIO
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from sphinx.errors import PycodeError
|
from sphinx.errors import PycodeError
|
||||||
@ -29,8 +29,6 @@ class ModuleAnalyzer:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def for_string(cls, string, modname, srcname='<string>'):
|
def for_string(cls, string, modname, srcname='<string>'):
|
||||||
# type: (str, str, str) -> ModuleAnalyzer
|
# type: (str, str, str) -> ModuleAnalyzer
|
||||||
if isinstance(string, bytes):
|
|
||||||
return cls(BytesIO(string), modname, srcname)
|
|
||||||
return cls(StringIO(string), modname, srcname, decoded=True)
|
return cls(StringIO(string), modname, srcname, decoded=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user