Use multi-return variant of should_include

This commit is contained in:
Dominik Jain committed 2025-03-31 21:01:12 +02:00
1 parent 9c3bd1bf0d
commit e86f59507a
2 files changed
+8 -5

No files matched your search

+1
View File
@@ -255,6 +255,7 @@ ignore = [
"W291",
"W293",
"B009",
"SIM103", # forbids multiple returns
]
unfixable = [
"F841",
+7 -5
View File
@@ -98,11 +98,13 @@ class Symbol(ToStringMixin):
result = []
def should_include(s: "Symbol") -> bool:
name_match = (substring_matching and name in s.name) or name == s.name
kind_include_match = include_kinds is None or s.symbol_kind in include_kinds
kind_exclude_match = exclude_kinds is None or s.symbol_kind not in exclude_kinds
return name_match and kind_include_match and kind_exclude_match
if not ((substring_matching and name in s.name) or name == s.name):
return False
if include_kinds is not None and s.symbol_kind not in include_kinds:
return False
if exclude_kinds is not None and s.symbol_kind in exclude_kinds:
return False
return True
def traverse(s: "Symbol") -> None:
if should_include(s):