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

View File

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