Skip to content

Add is_explicit_override flag to common.add_method for plugins #17418

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

Closed
wants to merge 3 commits into from
Closed
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
Add is_explicit_override flag to common.add_method for plugins
  • Loading branch information
sobolevn committed Jun 21, 2024
commit 381870edd8f8cb6d6b1634e168b87381a2522dae
3 changes: 3 additions & 0 deletions mypy/plugins/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ def add_overloaded_method_to_class(
items: list[MethodSpec],
is_classmethod: bool = False,
is_staticmethod: bool = False,
*,
is_explicit_override: bool = True,
) -> OverloadedFuncDef:
"""Adds a new overloaded method to a class definition."""
assert len(items) >= 2, "Overloads must contain at least two cases"
Expand All @@ -283,6 +285,7 @@ def add_overloaded_method_to_class(
spec=item,
is_classmethod=is_classmethod,
is_staticmethod=is_staticmethod,
is_explicit_override=is_explicit_override,
)
if isinstance(func, FuncDef):
var = Var(func.name, func.type)
Expand Down
Loading