3232from ansys .dpf .core .collection_base import CollectionBase
3333from ansys .dpf .core .common import create_dpf_instance
3434
35- TYPE = TypeVar ("TYPE " )
36- SKYE = TypeVar ("SKYE " )
35+ T = TypeVar ("T " )
36+ S = TypeVar ("S " )
3737
3838
39- # Explicit Generic[TYPE] helps some type checkers Collection as a generic.
40- class Collection (CollectionBase [TYPE ]):
39+ class Collection (CollectionBase [T ]):
4140 """Represents a collection of dpf objects organised by label spaces.
4241
4342 Parameters
@@ -95,7 +94,7 @@ def get_entries(self, label_space):
9594 """
9695 return super ()._get_entries (label_space )
9796
98- def get_entry (self , label_space_or_index ) -> TYPE :
97+ def get_entry (self , label_space_or_index ) -> T :
9998 """Retrieve the entry at a requested index or label space.
10099
101100 Raises an exception if the request returns more than one entry.
@@ -127,7 +126,7 @@ def add_entry(self, label_space, entry):
127126 return super ()._add_entry (label_space , Any .new_from (entry , server = self ._server ))
128127
129128 @classmethod
130- def collection_factory (cls , subtype : Type [SKYE ]) -> Type [Collection [SKYE ]]:
129+ def collection_factory (cls , subtype : Type [S ]) -> Type [Collection [S ]]:
131130 """Create classes deriving from Collection at runtime for a given subtype.
132131
133132 This factory method dynamically creates a new class that inherits from Collection
@@ -142,7 +141,7 @@ def collection_factory(cls, subtype: Type[SKYE]) -> Type[Collection[SKYE]]:
142141
143142 Returns
144143 -------
145- Type[Collection[TYPE ]]
144+ Type[Collection[S ]]
146145 A new class that inherits from Collection and is specialized for the given
147146 subtype. The class name will be "{subtype.__name__}sCollection".
148147
0 commit comments