Enable more SIM ruff rules (#113015)

* SIM101 SIM103

* SIM107 SIM109

* SIM110

* SIM112 SIM113

* SIM115

* SIM116

* Fix

* Fix

* Fix
This commit is contained in:
Joost Lekkerkerker
2024-03-11 04:20:37 +01:00
committed by GitHub
parent e96ef4613c
commit cddce0ce0d
17 changed files with 41 additions and 70 deletions

View File

@ -33,10 +33,7 @@ def _has_function(
module: ast.Module, _type: ast.AsyncFunctionDef | ast.FunctionDef, name: str
) -> bool:
"""Test if the module defines a function."""
for item in module.body:
if type(item) == _type and item.name == name:
return True
return False
return any(type(item) == _type and item.name == name for item in module.body)
def _has_import(module: ast.Module, name: str) -> bool: