mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix flake8 and style-check violations
This commit is contained in:
parent
314831d332
commit
47c869c89a
@ -25,7 +25,7 @@ universal = 1
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 95
|
max-line-length = 95
|
||||||
ignore = E116,E241,E251
|
ignore = E116,E241,E251,E741
|
||||||
exclude = .git,.tox,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
|
exclude = .git,.tox,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
|
@ -4258,7 +4258,7 @@ class DefinitionParser(object):
|
|||||||
pos = self.pos
|
pos = self.pos
|
||||||
try:
|
try:
|
||||||
concept = self._parse_nested_name()
|
concept = self._parse_nested_name()
|
||||||
except:
|
except Exception:
|
||||||
self.pos = pos
|
self.pos = pos
|
||||||
return None
|
return None
|
||||||
self.skip_ws()
|
self.skip_ws()
|
||||||
|
@ -171,7 +171,7 @@ class _TranslationProxy(UserString, object):
|
|||||||
# type: () -> str
|
# type: () -> str
|
||||||
try:
|
try:
|
||||||
return 'i' + repr(text_type(self.data))
|
return 'i' + repr(text_type(self.data))
|
||||||
except:
|
except Exception:
|
||||||
return '<%s broken>' % self.__class__.__name__
|
return '<%s broken>' % self.__class__.__name__
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class SphinxTestApp(application.Sphinx):
|
|||||||
application.Sphinx.__init__(self, srcdir, confdir, outdir, doctreedir,
|
application.Sphinx.__init__(self, srcdir, confdir, outdir, doctreedir,
|
||||||
buildername, confoverrides, status, warning,
|
buildername, confoverrides, status, warning,
|
||||||
freshenv, warningiserror, tags)
|
freshenv, warningiserror, tags)
|
||||||
except:
|
except Exception:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ def is_archived_theme(filename):
|
|||||||
try:
|
try:
|
||||||
with ZipFile(filename) as f: # type: ignore
|
with ZipFile(filename) as f: # type: ignore
|
||||||
return THEMECONF in f.namelist()
|
return THEMECONF in f.namelist()
|
||||||
except:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ def get_image_size(filename):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
return size
|
return size
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ def educateQuotes(text, language='en'):
|
|||||||
smart = smartquotes.smartchars(language)
|
smart = smartquotes.smartchars(language)
|
||||||
try:
|
try:
|
||||||
apostrophe = smart.apostrophe
|
apostrophe = smart.apostrophe
|
||||||
except:
|
except Exception:
|
||||||
apostrophe = u'’'
|
apostrophe = u'’'
|
||||||
|
|
||||||
# oldtext = text
|
# oldtext = text
|
||||||
|
@ -1036,6 +1036,6 @@ def test_latex_image_in_parsed_literal(app, status, warning):
|
|||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
|
||||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||||
assert ('{\\sphinxunactivateextrasandspace \\raisebox{-0.5\height}'
|
assert ('{\\sphinxunactivateextrasandspace \\raisebox{-0.5\\height}'
|
||||||
'{\\scalebox{2.000000}{\\sphinxincludegraphics[height=1cm]{{pic}.png}}}'
|
'{\\scalebox{2.000000}{\\sphinxincludegraphics[height=1cm]{{pic}.png}}}'
|
||||||
'}AFTER') in result
|
'}AFTER') in result
|
||||||
|
@ -197,28 +197,28 @@ def test_text_inconsistency_warnings(app, warning):
|
|||||||
expected_warning_expr = (
|
expected_warning_expr = (
|
||||||
warning_fmt % {
|
warning_fmt % {
|
||||||
u'reftype': u'footnote references',
|
u'reftype': u'footnote references',
|
||||||
u'original': u"\[u?'\[#\]_'\]",
|
u'original': u"\\[u?'\\[#\\]_'\\]",
|
||||||
u'translated': u"\[\]"
|
u'translated': u"\\[\\]"
|
||||||
} +
|
} +
|
||||||
warning_fmt % {
|
warning_fmt % {
|
||||||
u'reftype': u'footnote references',
|
u'reftype': u'footnote references',
|
||||||
u'original': u"\[u?'\[100\]_'\]",
|
u'original': u"\\[u?'\\[100\\]_'\\]",
|
||||||
u'translated': u"\[\]"
|
u'translated': u"\\[\\]"
|
||||||
} +
|
} +
|
||||||
warning_fmt % {
|
warning_fmt % {
|
||||||
u'reftype': u'references',
|
u'reftype': u'references',
|
||||||
u'original': u"\[u?'reference_'\]",
|
u'original': u"\\[u?'reference_'\\]",
|
||||||
u'translated': u"\[u?'reference_', u?'reference_'\]"
|
u'translated': u"\\[u?'reference_', u?'reference_'\\]"
|
||||||
} +
|
} +
|
||||||
warning_fmt % {
|
warning_fmt % {
|
||||||
u'reftype': u'references',
|
u'reftype': u'references',
|
||||||
u'original': u"\[\]",
|
u'original': u"\\[\\]",
|
||||||
u'translated': u"\[u?'`I18N WITH REFS INCONSISTENCY`_'\]"
|
u'translated': u"\\[u?'`I18N WITH REFS INCONSISTENCY`_'\\]"
|
||||||
})
|
})
|
||||||
assert_re_search(expected_warning_expr, warnings)
|
assert_re_search(expected_warning_expr, warnings)
|
||||||
|
|
||||||
expected_citation_warning_expr = (
|
expected_citation_warning_expr = (
|
||||||
u'.*/refs_inconsistency.txt:\\d+: WARNING: Citation \[ref2\] is not referenced.\n' +
|
u'.*/refs_inconsistency.txt:\\d+: WARNING: Citation \\[ref2\\] is not referenced.\n' +
|
||||||
u'.*/refs_inconsistency.txt:\\d+: WARNING: citation not found: ref3')
|
u'.*/refs_inconsistency.txt:\\d+: WARNING: citation not found: ref3')
|
||||||
assert_re_search(expected_citation_warning_expr, warnings)
|
assert_re_search(expected_citation_warning_expr, warnings)
|
||||||
|
|
||||||
@ -300,8 +300,8 @@ def test_text_glossary_term_inconsistencies(app, warning):
|
|||||||
expected_warning_expr = (
|
expected_warning_expr = (
|
||||||
u'.*/glossary_terms_inconsistency.txt:\\d+: '
|
u'.*/glossary_terms_inconsistency.txt:\\d+: '
|
||||||
u'WARNING: inconsistent term references in translated message.'
|
u'WARNING: inconsistent term references in translated message.'
|
||||||
u" original: \[u?':term:`Some term`', u?':term:`Some other term`'\],"
|
u" original: \\[u?':term:`Some term`', u?':term:`Some other term`'\\],"
|
||||||
u" translated: \[u?':term:`SOME NEW TERM`'\]\n")
|
u" translated: \\[u?':term:`SOME NEW TERM`'\\]\n")
|
||||||
assert_re_search(expected_warning_expr, warnings)
|
assert_re_search(expected_warning_expr, warnings)
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ def processing(message):
|
|||||||
yield
|
yield
|
||||||
except Skip as exc:
|
except Skip as exc:
|
||||||
print('skip: %s' % exc)
|
print('skip: %s' % exc)
|
||||||
except:
|
except Exception:
|
||||||
print('error')
|
print('error')
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user