Skip to content

Commit 54a4061

Browse files
authored
Add type hints to GraphModel properties and fix documentation (#111)
Signed-off-by: svenvdvoort <[email protected]>
1 parent a03329a commit 54a4061

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/power_grid_model_ds/_core/model/graphs/models/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ def __init__(self, active_only=False) -> None:
2929

3030
@property
3131
@abstractmethod
32-
def nr_nodes(self):
32+
def nr_nodes(self) -> int:
3333
"""Returns the number of nodes in the graph"""
3434

3535
@property
3636
@abstractmethod
37-
def nr_branches(self):
37+
def nr_branches(self) -> int:
3838
"""Returns the number of branches in the graph"""
3939

4040
@property
@@ -251,7 +251,7 @@ def get_all_paths(self, ext_start_node_id: int, ext_end_node_id: int) -> list[li
251251
return [self._internals_to_externals(path) for path in internal_paths]
252252

253253
def get_components(self) -> list[list[int]]:
254-
"""Returns all separate components when the substation_nodes are removed of the graph as lists
254+
"""Returns all separate components of the graph as lists
255255
256256
If you want to get the components of the graph without certain nodes,
257257
use the `tmp_remove_nodes` context manager.

src/power_grid_model_ds/_core/model/graphs/models/rustworkx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def __init__(self, active_only=False) -> None:
2626
self._external_to_internal: dict[int, int] = {}
2727

2828
@property
29-
def nr_nodes(self):
29+
def nr_nodes(self) -> int:
3030
return self._graph.num_nodes()
3131

3232
@property
33-
def nr_branches(self):
33+
def nr_branches(self) -> int:
3434
return self._graph.num_edges()
3535

3636
@property

0 commit comments

Comments
 (0)