@@ -146,7 +146,7 @@ example (Python 3.12 syntax):
146
146
from typing import Mapping, Iterator
147
147
148
148
# This is a generic subclass of Mapping
149
- class MyMapp [KT , VT ](Mapping[KT , VT ]):
149
+ class MyMap [KT , VT ](Mapping[KT , VT ]):
150
150
def __getitem__ (self , k : KT ) -> VT : ...
151
151
def __iter__ (self ) -> Iterator[KT ]: ...
152
152
def __len__ (self ) -> int : ...
@@ -641,7 +641,7 @@ infer the most flexible variance for each class type variable. Here
641
641
642
642
.. code-block :: python
643
643
644
- class Box[T]: # this type is implilicitly covariant
644
+ class Box[T]: # this type is implicitly covariant
645
645
def __init__ (self , content : T) -> None :
646
646
self ._content = content
647
647
@@ -663,12 +663,12 @@ the attribute as ``Final``, the class could still be made covariant:
663
663
664
664
from typing import Final
665
665
666
- class Box[T]: # this type is implilicitly covariant
666
+ class Box[T]: # this type is implicitly covariant
667
667
def __init__ (self , content : T) -> None :
668
668
self .content: Final = content
669
669
670
670
def get_content (self ) -> T:
671
- return self ._content
671
+ return self .content
672
672
673
673
When using the legacy syntax, mypy assumes that all user-defined generics
674
674
are invariant by default. To declare a given generic class as covariant or
0 commit comments