Resolve lint errors from Ruff 0.0.257

This commit is contained in:
Adam Turner 2023-03-18 14:53:23 +00:00
parent 17d4dfa7fb
commit 2ee7d0f678
2 changed files with 18 additions and 17 deletions

View File

@ -140,18 +140,18 @@ remove_redundant_aliases = true
target-version = "py38" # Pin Ruff to Python 3.8
line-length = 95
exclude = [
'.git',
'.tox',
'.venv',
'tests/roots/*',
'build/*',
'doc/_build/*',
'sphinx/search/*',
'doc/usage/extensions/example*.py',
".git",
".tox",
".venv",
"tests/roots/*",
"build/*",
"doc/_build/*",
"sphinx/search/*",
"doc/usage/extensions/example*.py",
]
ignore = [
# pycodestyle
'E741',
"E741",
# flake8-builtins
"A001", # variable is shadowing a python builtin
"A002", # argument is shadowing a python builtin
@ -164,11 +164,12 @@ ignore = [
"ARG003", # unused class method argument
"ARG005", # unused lambda argument
# flake8-bugbear
'B006', # do not use mutable data structures for argument default
'B023', # function definition does not bind loop variable
"B006", # do not use mutable data structures for argument default
"B023", # function definition does not bind loop variable
"B026", # keyword argument ... must come after starred arguments
"B028", # no explicit `stacklevel` keyword argument found
# flake8-bugbear opinionated (disabled by default in flake8)
'B904', # within an except clause, raise exceptions with `raise ... from ...`
"B904", # within an except clause, raise exceptions with `raise ... from ...`
# flake8-blind-except
"BLE001", # do not catch blind exception
# mccabe

View File

@ -4501,7 +4501,7 @@ class Symbol:
nestedName: ASTNestedName,
templateDecls: list[Any],
onMissingQualifiedSymbol: Callable[
[Symbol, ASTIdentifier | ASTOperator, Any, ASTTemplateArgs], Symbol,
[Symbol, ASTIdentifier | ASTOperator, Any, ASTTemplateArgs], Symbol | None,
],
strictTemplateParamArgLists: bool, ancestorLookupType: str,
templateShorthand: bool, matchSelf: bool,
@ -4648,7 +4648,7 @@ class Symbol:
def onMissingQualifiedSymbol(parentSymbol: Symbol,
identOrOp: ASTIdentifier | ASTOperator,
templateParams: Any, templateArgs: ASTTemplateArgs,
) -> Symbol:
) -> Symbol | None:
if Symbol.debug_lookup:
Symbol.debug_indent += 1
Symbol.debug_print("_add_symbols, onMissingQualifiedSymbol:")
@ -5053,7 +5053,7 @@ class Symbol:
def onMissingQualifiedSymbol(parentSymbol: Symbol,
identOrOp: ASTIdentifier | ASTOperator,
templateParams: Any,
templateArgs: ASTTemplateArgs) -> Symbol:
templateArgs: ASTTemplateArgs) -> Symbol | None:
# TODO: Maybe search without template args?
# Though, the correctPrimaryTemplateArgs does
# that for primary templates.
@ -5061,7 +5061,7 @@ class Symbol:
if parentSymbol.declaration is not None:
if parentSymbol.declaration.objectType == 'templateParam':
raise QualifiedSymbolIsTemplateParam()
return # type: ignore[return-value]
return None # NoQA: RET501,PLR1711
try:
lookupResult = self._symbol_lookup(nestedName, templateDecls,
@ -5119,7 +5119,7 @@ class Symbol:
def onMissingQualifiedSymbol(parentSymbol: Symbol,
identOrOp: ASTIdentifier | ASTOperator,
templateParams: Any,
templateArgs: ASTTemplateArgs) -> Symbol:
templateArgs: ASTTemplateArgs) -> Symbol | None:
return None
lookupResult = self._symbol_lookup(nestedName, templateDecls,