Need help annotating class with dynamic inheritance
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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)
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il gist o playground collegato, quindi esegui i comandi mostrati python test_mypy.py e mypy test_mypy.py per riprodurre le diagnostiche in test_mypy.py. Segui gli errori segnalati relativi alla classe ereditata dinamicamente e confrontali con l’output a runtime. Il lavoro è completato quando sono stati stabiliti il comportamento di tipizzazione previsto e una riproduzione minima e chiara per qualsiasi approfondimento successivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100