Skip to content
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

Need help annotating class with dynamic inheritance #17379

Open
actionless opened this issue Jun 13, 2024 · 0 comments
Open

Need help annotating class with dynamic inheritance #17379

actionless opened this issue Jun 13, 2024 · 0 comments
Labels
bug mypy got something wrong

Comments

@actionless
Copy link

To Reproduce

Gist URL: https://gist.github.com/mypy-play/d139ee55a5729d2ec5b63d4ceaeb5a33
Playground URL: https://mypy-play.net/?mypy=latest&python=3.12&gist=d139ee55a5729d2ec5b63d4ceaeb5a33

$ python test_mypy.py
header
1
header
2

$ mypy test_mypy.py
Warning: --strict-concatenate is deprecated; use --extra-checks instead
test_mypy.py:27: error: "__new__" must return a class instance (got "BaseClassT")  [misc]
test_mypy.py:36: error: Unsupported argument 1 for "super"  [misc]
test_mypy.py:38: error: Returning Any from function declared to return "BaseClassT"  [no-any-return]
test_mypy.py:41: error: Non-overlapping identity check (left operand type: "type[BaseClassT]", right operand type: "type[Type1]")  [comparison-overlap]
test_mypy.py:42: error: Returning Any from function declared to return "None"  [no-any-return]
test_mypy.py:42: error: "Example[BaseClassT]" has no attribute "method1"; maybe "method"?  [attr-defined]
test_mypy.py:43: error: Non-overlapping identity check (left operand type: "type[BaseClassT]", right operand type: "type[Type2]")  [comparison-overlap]
test_mypy.py:44: error: Returning Any from function declared to return "None"  [no-any-return]
test_mypy.py:44: error: "Example[BaseClassT]" has no attribute "method2"; maybe "method"?  [attr-defined]
test_mypy.py:48: error: Missing type parameters for generic type "Example"  [type-arg]
test_mypy.py:54: error: Cannot instantiate abstract class "ExampleSubclass" with abstract attribute "base_class"  [abstract]
test_mypy.py:55: error: Cannot instantiate abstract class "ExampleSubclass" with abstract attribute "base_class"  [abstract]
Found 12 errors in 1 file (checked 1 source file)
@actionless actionless added the bug mypy got something wrong label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant