8000 Function compatibility rewrite by sixolet · Pull Request #2521 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Function compatibility rewrite #2521

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 18 commits into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
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
Stop checking argument names for multiple base classes
  • Loading branch information
sixolet committed Dec 21, 2016
commit 8bf9c533921cfb25a4b9aa69ced338d8270c7e07
2 changes: 1 addition & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ def check_compatibility(self, name: str, base1: TypeInfo,
# Method override
first_sig = bind_self(first_type)
second_sig = bind_self(second_type)
ok = is_subtype(first_sig, second_sig)
ok = is_subtype(first_sig, second_sig, ignore_pos_arg_names=True)
elif first_type and second_type:
ok = is_equivalent(first_type, second_type)
else:
Expand Down
7 changes: 5 additions & 2 deletions mypy/subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ def ignore_tvars(s: Type, t: Type, v: int) -> bool:


def is_equivalent(a: Type, b: Type,
type_parameter_checker: TypeParameterChecker = check_type_parameter) -> bool:
return is_subtype(a, b, type_parameter_checker) and is_subtype(b, a, type_parameter_checker)
type_parameter_checker: TypeParameterChecker = check_type_parameter,
*, ignore_pos_arg_names=False) -> bool:
return (
is_subtype(a, b, type_parameter_checker, ignore_pos_arg_names=ignore_pos_arg_names)
and is_subtype(b, a, type_parameter_checker, ignore_pos_arg_names=ignore_pos_arg_names))


def satisfies_upper_bound(a: Type, upper_bound: Type) -> bool:
Expand Down
0