8000 Fix callable instance variable support (take 2) by ilevkivskyi · Pull Request #13400 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix callable instance variable support (take 2) #13400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Re-apply black
  • Loading branch information
ilevkivskyi committed Aug 12, 2022
commit 61557b0be2d6670dc63c5206e3ce8cdeb84fbbac
18 changes: 11 additions & 7 deletions mypy/checkmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,19 +663,23 @@ def is_instance_var(var: Var, info: TypeInfo) -> bool:
"""Return if var is an instance variable according to PEP 526."""
return (
# check the type_info node is the var (not a decorated function, etc.)
var.name in info.names and info.names[var.name].node is var
var.name in info.names
and info.names[var.name].node is var
and not var.is_classvar
# variables without annotations are treated as classvar
and not var.is_inferred
)


def analyze_var(name: str,
var: Var,
itype: Instance,
info: TypeInfo,
mx: MemberContext, *,
implicit: bool = False) -> Type:
def analyze_var(
name: str,
var: Var,
itype: Instance,
info: TypeInfo,
mx: MemberContext,
*,
implicit: bool = False,
) -> Type:
"""Analyze access to an attribute via a Var node.

This is conceptually part of analyze_member_access and the arguments are similar.
Expand Down
0