diff --git a/setup.cfg b/setup.cfg index 091b59bbd..5b4753c5d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ directory = sphinx/locale/ [flake8] max-line-length = 95 -ignore = E116,E241,E251,E741,I101 +ignore = E116,E241,E251,E741,W504,I101 exclude = .git,.tox,.venv,tests/*,build/*,doc/_build/*,sphinx/search/*,doc/ext/example*.py application-import-names = sphinx import-order-style = smarkets diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 8a10a4f2c..312a26252 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -158,7 +158,7 @@ class CheckExternalLinksBuilder(Builder): # the server and the network response = requests.head(req_url, config=self.app.config, **kwargs) response.raise_for_status() - except HTTPError as err: + except HTTPError: # retry with GET request if that fails, some servers # don't like HEAD requests. response = requests.get(req_url, stream=True, config=self.app.config, diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index e9a3864ab..014bcc2d8 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -29,7 +29,7 @@ if False: from sphinx.application import Sphinx # NOQA -glob_re = re.compile('.*[*?\[].*') +glob_re = re.compile(r'.*[*?\[].*') def int_or_nothing(argument): diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 0c83a4e25..dbf43d4c8 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -263,7 +263,7 @@ def find_autosummary_in_docstring(name, module=None, filename=None): pass except ImportError as e: print("Failed to import '%s': %s" % (name, e)) - except SystemExit as e: + except SystemExit: print("Failed to import '%s'; the module executes module level " "statement and it might call sys.exit()." % name) return [] diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index f10b918bd..22304ded4 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -235,7 +235,7 @@ class ExtBabel(Babel): def get_mainlanguage_options(self): # type: () -> unicode - """Return options for polyglossia's ``\setmainlanguage``.""" + """Return options for polyglossia's ``\\setmainlanguage``.""" language = super(ExtBabel, self).get_language() if self.use_polyglossia is False: return None