From 2195e8e589878a8b1679da6849718e3e17310cf6 Mon Sep 17 00:00:00 2001 From: daklauss Date: Fri, 6 Dec 2024 12:06:36 +0100 Subject: [PATCH] fixup! Add type annotations --- CADETProcess/processModel/componentSystem.py | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CADETProcess/processModel/componentSystem.py b/CADETProcess/processModel/componentSystem.py index 6d989e38..4625c05c 100644 --- a/CADETProcess/processModel/componentSystem.py +++ b/CADETProcess/processModel/componentSystem.py @@ -42,11 +42,11 @@ class Component(Structure): ---------- name : str | None Name of the component. - species : list + species : list[Species] List of Subspecies. n_species : int Number of Subspecies. - label : list + label : list[str] Name of component (including species). charge : int | list[int | None] Charge of component (including species). @@ -68,7 +68,7 @@ def __init__( name: str | None = None, species: str | list[str | None] = None, charge: int | list[int | None] = None, - molecular_weight: float| list[float | None] = None, + molecular_weight: float | list[float | None] = None, density: float | list[float | None] = None ) -> NoReturn: """ @@ -106,7 +106,7 @@ def __init__( @property def species(self) -> list[Species]: - """list: The subspecies of the component.""" + """list[Species]: The subspecies of the component.""" return self._species @wraps(Species.__init__) @@ -223,7 +223,7 @@ def __init__( components : int | list[str | Component | None] The number of components or the list of components to be added. If None, no components are added. - name : str, None + name : str | None The name of the ComponentSystem. charges : list[int | None] The charges of each component. @@ -270,12 +270,12 @@ def __init__( @property def components(self) -> list[Component]: - """list: List of components in the system.""" + """list[Component]: List of components in the system.""" return self._components @property def components_dict(self) -> dict[str, Component]: - """dict: Components indexed by name.""" + """dict[str, Component]: Components indexed by name.""" return { name: comp for name, comp in zip(self.names, self.components) @@ -308,8 +308,8 @@ def add_component( Parameters ---------- - component : {str, Component} - The class of the component to be added. + component : str | Component + The class or name of the component to be added. *args : list The positional arguments to be passed to the component class's constructor. **kwargs : dict @@ -332,7 +332,7 @@ def remove_component(self, component: str | Component) -> NoReturn: Parameters ---------- - component : {str, Component} + component : str | Component The name of the component or the component instance to be removed. Raises @@ -354,7 +354,7 @@ def remove_component(self, component: str | Component) -> NoReturn: @property def indices(self) -> dict[str, list[int]]: - """dict: List of species indices for each component name.""" + """dict[str, list[int]]: List of species indices for each component name.""" indices = defaultdict(list) index = 0 @@ -367,7 +367,7 @@ def indices(self) -> dict[str, list[int]]: @property def species_indices(self) -> dict[str, int]: - """dict: Indices for each species.""" + """dict[str, int]: Indices for each species.""" indices = Dict() index = 0