Fix Ruff errors

This commit is contained in:
Adam Turner 2023-12-26 03:48:22 +00:00
parent b2afe12eb7
commit 3385ce10a1
3 changed files with 6 additions and 3 deletions

View File

@ -583,12 +583,15 @@ select = [
# whitelist ``print`` for stdout messages
"sphinx/testing/fixtures.py" = ["T201"]
# allow returning ``open()``
"sphinx/testing/path.py" = ["SIM115"]
# Ruff bug: https://github.com/astral-sh/ruff/issues/6540
"sphinx/transforms/i18n.py" = ["PGH004"]
"tests/*" = [
"E501",
"T201" # whitelist ``print`` for tests
"T201", # whitelist ``print`` for tests
]
# these tests need old ``typing`` generic aliases

View File

@ -1233,7 +1233,7 @@ class NumpyDocstring(GoogleDocstring):
line1, line2 = self._lines.get(0), self._lines.get(1)
return (not self._lines or
self._is_section_header() or
['', ''] == [line1, line2] or
(line1 == line2 == '') or
(self._is_in_section and
line1 and
not self._is_indented(line1, self._section_indent)))

View File

@ -202,7 +202,7 @@ def parselinenos(spec: str, total: int) -> list[int]:
for part in parts:
try:
begend = part.strip().split('-')
if ['', ''] == begend:
if begend == ['', '']:
raise ValueError
if len(begend) == 1:
items.append(int(begend[0]) - 1)