Skip to content

Commit 765a78f

Browse files
authored
Inline a trivial function in checkmember.py (#18819)
This is a pure refactoring so I am not waiting for a review.
1 parent 34e8c7c commit 765a78f

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

mypy/checkmember.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ def analyze_member_var_access(
496496
original_type is the type of E in the expression E.var
497497
"""
498498
# It was not a method. Try looking up a variable.
499-
v = lookup_member_var_or_accessor(info, name, mx.is_lvalue)
499+
node = info.get(name)
500+
v = node.node if node else None
500501

501502
mx.chk.warn_deprecated(v, mx.context)
502503

@@ -898,16 +899,6 @@ def visit_callable_type(self, t: CallableType) -> None:
898899
super().visit_callable_type(t)
899900

900901

901-
def lookup_member_var_or_accessor(info: TypeInfo, name: str, is_lvalue: bool) -> SymbolNode | None:
902-
"""Find the attribute/accessor node that refers to a member of a type."""
903-
# TODO handle lvalues
904-
node = info.get(name)
905-
if node:
906-
return node.node
907-
else:
908-
return None
909-
910-
911902
def check_self_arg(
912903
functype: FunctionLike,
913904
dispatched_arg_type: Type,

0 commit comments

Comments
 (0)