8000 Fix/attrs init overload by uko3211 · Pull Request #19104 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix/attrs init overload #19104

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

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0ecd910
Fix handling of overloaded __init__ methods in attrs plugin
uko3211 May 18, 2025
f6c8dfd
Fix: handle CallableType resolution for attrs __init__
uko3211 May 18, 2025
989c9f3
Fix: Add exception handling and resolve issues caused by AnyType
uko3211 May 19, 2025
c375805
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2025
58a1d3d
Fix: Add exception handling and resolve issues caused by AnyType and …
uko3211 May 19, 2025
22c8dfd
Fix: return Anytype
uko3211 May 19, 2025
166776b
Fix: return Anytype on _get_expanded_attr_types
uko3211 May 19, 2025
04766f7
Add unit tests to verify fix for #19003 involving overloaded __init__…
uko3211 May 21, 2025
3b725e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 21, 2025
34e831b
Add unit tests to verify fix for #19003 involving overloaded __init__…
uko3211 May 21, 2025
9065f79
Added error test case for overloaded custom __init__
uko3211 May 21, 2025
bd929fb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 21, 2025
ad415cb
Added error test case for overloaded custom __init__
uko3211 May 21, 2025
93db908
add plugin_generated check
uko3211 May 23, 2025
c4716de
fix test case
uko3211 May 23, 2025
0d0e8d3
fix/check-plugin-attrs.test&attrs.py_2\
uko3211 May 23, 2025
83feade
add attrs.py function
uko3211 May 23, 2025
6382550
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 23, 2025
b82db50
change getattr -> .plugin_generated && fix nodes.py
uko3211 May 24, 2025
b6c0b1a
edit check-plugin-attrs.test checking error
uko3211 May 24, 2025
e1821c6
edit check-plugin-attrs.test error fix
uko3211 May 24, 2025
20c8ab5
Changes have been made based on the feedback
uko3211 May 29, 2025
ae37831
Changes have been made based on the feedback and fixed mistake
uko3211 May 29, 2025
6a45089
Merge branch 'master' into fix/attrs-init-overload
uko3211 May 30, 2025
7f8d33c
Fixed an issue where overly permissive Any return types were masking …
uko3211 Jun 7, 2025
2946878
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 7, 2025
eba288b
Fixed an issue where overly permissive Any return types were masking …
uko3211 Jun 7, 2025
2bb782c
Update check-plugin-attrs.test file
uko3211 Jun 7, 2025
423e526
Revised version of attrs.py based on the feedback
uko3211 Jun 7, 2025
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
Fix: Add exception handling and resolve issues caused by AnyType and …
…Add return type
  • Loading branch information
uko3211 committed May 19, 2025
commit 58a1d3df879f1a1677e989e7850ec601677cc58d
3 changes: 1 addition & 2 deletions mypy/plugins/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def add_method(
)


def _get_attrs_init_type(typ: Instance) -> CallableType | None:
def _get_attrs_init_type(typ: Instance) -> CallableType | None | AnyType:
"""
If `typ` refers to an attrs class, get the type of its initializer method.
"""
Expand All @@ -1032,7 +1032,6 @@ def _get_attrs_init_type(typ: Instance) -> CallableType | None:
init_method = typ.type.get_method("__init__") or typ.type.get_method(ATTRS_INIT_NAME)
if init_method is None:
return None

# case 1: normal FuncDef
if isinstance(init_method, FuncDef) and isinstance(init_method.type, CallableType):
return init_method.type
Expand Down
Loading
0