3232from ansys .dpf .core .collection_base import CollectionBase
3333from ansys .dpf .core .common import create_dpf_instance
3434
35- TYPE = TypeVar ("TYPE" )
35+ T = TypeVar ("T" )
36+ S = TypeVar ("S" )
3637
3738
38- # Explicit Generic[TYPE] helps some type checkers Collection as a generic.
39- class Collection (CollectionBase [TYPE ], Generic [TYPE ]):
39+ class Collection (CollectionBase [T ]):
4040 """Represents a collection of dpf objects organised by label spaces.
4141
4242 Parameters
@@ -94,7 +94,7 @@ def get_entries(self, label_space):
9494 """
9595 return super ()._get_entries (label_space )
9696
97- def get_entry (self , label_space_or_index ) -> TYPE :
97+ def get_entry (self , label_space_or_index ) -> T :
9898 """Retrieve the entry at a requested index or label space.
9999
100100 Raises an exception if the request returns more than one entry.
@@ -126,7 +126,7 @@ def add_entry(self, label_space, entry):
126126 return super ()._add_entry (label_space , Any .new_from (entry , server = self ._server ))
127127
128128 @classmethod
129- def collection_factory (cls , subtype : TYPE ) -> Type [Collection [TYPE ]]:
129+ def collection_factory (cls , subtype : Type [ S ] ) -> Type [Collection [S ]]:
130130 """Create classes deriving from Collection at runtime for a given subtype.
131131
132132 This factory method dynamically creates a new class that inherits from Collection
@@ -141,7 +141,7 @@ def collection_factory(cls, subtype: TYPE) -> Type[Collection[TYPE]]:
141141
142142 Returns
143143 -------
144- Type[Collection[TYPE ]]
144+ Type[Collection[S ]]
145145 A new class that inherits from Collection and is specialized for the given
146146 subtype. The class name will be "{subtype.__name__}sCollection".
147147
0 commit comments