Review, reduce, and sort per-file ignores in Ruff

This commit is contained in:
Adam Turner 2025-01-13 23:59:11 +00:00
parent fd8ce84582
commit b52ac5c71b
4 changed files with 18 additions and 24 deletions

View File

@ -270,12 +270,16 @@ logger-objects = [
"ANN", # documentation doesn't need annotations
"TC001", # documentation doesn't need type-checking blocks
]
"doc/conf.py" = ["INP001", "W605"]
"doc/development/tutorials/examples/*" = ["I002", "INP001"]
# allow print() in the tutorial
"doc/conf.py" = [
"INP001", # doc/ is not a namespace package
]
"doc/development/tutorials/examples/*" = [
"I002", # we don't need the annotations future
"INP001", # examples/ is not a namespace package
]
"doc/development/tutorials/examples/recipe.py" = [
"FURB118",
"T201"
"FURB118", # keep the tutorial simple: no itemgetter
"T201" # allow print() in the tutorial
]
"doc/usage/extensions/example_{google,numpy}.py" = [
"D416", # Section name should end with a colon ("{name}")
@ -284,9 +288,6 @@ logger-objects = [
"PLW3201", # Dunder method {name} has no special meaning in Python 3
]
# from .flake8
"sphinx/*" = ["E241"]
# whitelist ``print`` for stdout messages
"sphinx/_cli/__init__.py" = ["T201"]
@ -310,18 +311,11 @@ logger-objects = [
# whitelist ``token`` in docstring parsing
"sphinx/ext/napoleon/docstring.py" = ["S105"]
"sphinx/search/*" = ["RUF001"]
# whitelist ``print`` for stdout messages
"sphinx/testing/fixtures.py" = ["T201"]
# Ruff bug: https://github.com/astral-sh/ruff/issues/6540
"sphinx/transforms/i18n.py" = ["PGH004"]
# Function wrappers
"sphinx/ext/autodoc/importer.py" = ["D402"]
"sphinx/util/requests.py" = ["D402"]
"sphinx/search/*" = ["E501", "RUF001"]
# whitelist ``token`` in date format parsing
"sphinx/util/i18n.py" = ["S105"]

View File

@ -407,12 +407,12 @@ class IndexBuilder:
def get_terms(
self, fn2index: dict[str, int]
) -> tuple[dict[str, list[int] | int], dict[str, list[int] | int]]:
"""
Return a mapping of document and title terms to their corresponding sorted document IDs.
"""Return a mapping of document and title terms to sorted document IDs.
When a term is only found within a single document, then the value for that term will be
an integer value. When a term is found within multiple documents, the value will be a list
of integers.
When a term is only found within a single document,
then the value for that term will be an integer value.
When a term is found within multiple documents,
the value will be a list of integers.
"""
rvs: tuple[dict[str, list[int] | int], dict[str, list[int] | int]] = ({}, {})
for rv, mapping in zip(rvs, (self._mapping, self._title_mapping), strict=True):

View File

@ -95,7 +95,7 @@ kun | when
niin | so
nyt | now
itse | self
""")
""") # NoQA: E501
class SearchFinnish(SearchLanguage):

View File

@ -109,7 +109,7 @@ uw | your
iemand | somebody
geweest | been; past participle of 'be'
andere | other
""")
""") # NoQA: E501
class SearchDutch(SearchLanguage):