Skip to content

Commit

Permalink
fixup! Add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
daklauss committed Dec 6, 2024
1 parent 1004351 commit 2195e8e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions CADETProcess/processModel/componentSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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:
"""
Expand Down Expand Up @@ -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__)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2195e8e

Please sign in to comment.