mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix flake8 violations
This commit is contained in:
parent
8ca1bf9aa6
commit
69d67e7050
@ -17,7 +17,7 @@ from importlib import import_module
|
|||||||
|
|
||||||
from sphinx.errors import PycodeError
|
from sphinx.errors import PycodeError
|
||||||
from sphinx.pycode.parser import Parser
|
from sphinx.pycode.parser import Parser
|
||||||
from sphinx.util import get_module_source, detect_encoding
|
from sphinx.util import detect_encoding
|
||||||
|
|
||||||
|
|
||||||
class ModuleAnalyzer:
|
class ModuleAnalyzer:
|
||||||
@ -44,7 +44,7 @@ class ModuleAnalyzer:
|
|||||||
if source:
|
if source:
|
||||||
# no exception and not None - it must be module source
|
# no exception and not None - it must be module source
|
||||||
return filename, source
|
return filename, source
|
||||||
except ImportError as err:
|
except ImportError:
|
||||||
pass # Try other "source-mining" methods
|
pass # Try other "source-mining" methods
|
||||||
if filename is None and loader and getattr(loader, 'get_filename', None):
|
if filename is None and loader and getattr(loader, 'get_filename', None):
|
||||||
# have loader, but no filename
|
# have loader, but no filename
|
||||||
@ -63,8 +63,8 @@ class ModuleAnalyzer:
|
|||||||
filename += 'w'
|
filename += 'w'
|
||||||
elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')):
|
elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')):
|
||||||
raise PycodeError('source is not a .py file: %r' % filename)
|
raise PycodeError('source is not a .py file: %r' % filename)
|
||||||
elif ('.egg' + os.path.sep) in filename:
|
elif ('.egg' + path.sep) in filename:
|
||||||
pat = '(?<=\\.egg)' + re.escape(os.path.sep)
|
pat = '(?<=\\.egg)' + re.escape(path.sep)
|
||||||
eggpath, _ = re.split(pat, filename, 1)
|
eggpath, _ = re.split(pat, filename, 1)
|
||||||
if path.isfile(eggpath):
|
if path.isfile(eggpath):
|
||||||
return filename, None
|
return filename, None
|
||||||
|
Loading…
Reference in New Issue
Block a user