power-grid-model-ds 1.2.0__py3-none-any.whl → 1.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- power_grid_model_ds/_core/model/graphs/container.py +6 -4
- power_grid_model_ds/_core/model/graphs/models/base.py +5 -3
- {power_grid_model_ds-1.2.0.dist-info → power_grid_model_ds-1.2.2.dist-info}/METADATA +3 -2
- {power_grid_model_ds-1.2.0.dist-info → power_grid_model_ds-1.2.2.dist-info}/RECORD +7 -8
- {power_grid_model_ds-1.2.0.dist-info → power_grid_model_ds-1.2.2.dist-info}/WHEEL +1 -1
- power_grid_model_ds/_core/model/containers/grid_protocol.py +0 -22
- {power_grid_model_ds-1.2.0.dist-info → power_grid_model_ds-1.2.2.dist-info/licenses}/LICENSE +0 -0
- {power_grid_model_ds-1.2.0.dist-info → power_grid_model_ds-1.2.2.dist-info}/top_level.txt +0 -0
@@ -6,17 +6,19 @@
|
|
6
6
|
|
7
7
|
import dataclasses
|
8
8
|
from dataclasses import dataclass
|
9
|
-
from typing import Generator
|
9
|
+
from typing import TYPE_CHECKING, Generator
|
10
10
|
|
11
11
|
import numpy as np
|
12
12
|
|
13
13
|
from power_grid_model_ds._core.model.arrays import Branch3Array, BranchArray, NodeArray
|
14
14
|
from power_grid_model_ds._core.model.arrays.base.array import FancyArray
|
15
15
|
from power_grid_model_ds._core.model.arrays.base.errors import RecordDoesNotExist
|
16
|
-
from power_grid_model_ds._core.model.containers.grid_protocol import MinimalGridArrays
|
17
16
|
from power_grid_model_ds._core.model.graphs.models import RustworkxGraphModel
|
18
17
|
from power_grid_model_ds._core.model.graphs.models.base import BaseGraphModel
|
19
18
|
|
19
|
+
if TYPE_CHECKING: # pragma: no cover
|
20
|
+
from power_grid_model_ds._core.model.grids.base import Grid
|
21
|
+
|
20
22
|
|
21
23
|
@dataclass
|
22
24
|
class GraphContainer:
|
@@ -119,7 +121,7 @@ class GraphContainer:
|
|
119
121
|
setattr(self, field.name, graph)
|
120
122
|
|
121
123
|
@classmethod
|
122
|
-
def from_arrays(cls, arrays:
|
124
|
+
def from_arrays(cls, arrays: "Grid") -> "GraphContainer":
|
123
125
|
"""Build from arrays"""
|
124
126
|
cls._validate_branches(arrays=arrays)
|
125
127
|
|
@@ -132,7 +134,7 @@ class GraphContainer:
|
|
132
134
|
return new_container
|
133
135
|
|
134
136
|
@staticmethod
|
135
|
-
def _validate_branches(arrays:
|
137
|
+
def _validate_branches(arrays: "Grid") -> None:
|
136
138
|
for array in arrays.branch_arrays:
|
137
139
|
if any(~np.isin(array.from_node, arrays.node.id)):
|
138
140
|
raise RecordDoesNotExist(f"Found invalid .from_node values in {array.__class__.__name__}")
|
@@ -4,13 +4,12 @@
|
|
4
4
|
|
5
5
|
from abc import ABC, abstractmethod
|
6
6
|
from contextlib import contextmanager
|
7
|
-
from typing import Generator
|
7
|
+
from typing import TYPE_CHECKING, Generator
|
8
8
|
|
9
9
|
import numpy as np
|
10
10
|
from numpy._typing import NDArray
|
11
11
|
|
12
12
|
from power_grid_model_ds._core.model.arrays.pgm_arrays import Branch3Array, BranchArray, NodeArray
|
13
|
-
from power_grid_model_ds._core.model.containers.grid_protocol import MinimalGridArrays
|
14
13
|
from power_grid_model_ds._core.model.graphs.errors import (
|
15
14
|
GraphError,
|
16
15
|
MissingBranchError,
|
@@ -18,6 +17,9 @@ from power_grid_model_ds._core.model.graphs.errors import (
|
|
18
17
|
NoPathBetweenNodes,
|
19
18
|
)
|
20
19
|
|
20
|
+
if TYPE_CHECKING: # pragma: no cover
|
21
|
+
from power_grid_model_ds._core.model.grids.base import Grid
|
22
|
+
|
21
23
|
|
22
24
|
# pylint: disable=too-many-public-methods
|
23
25
|
class BaseGraphModel(ABC):
|
@@ -327,7 +329,7 @@ class BaseGraphModel(ABC):
|
|
327
329
|
return [self._internals_to_externals(nodes) for nodes in internal_cycles]
|
328
330
|
|
329
331
|
@classmethod
|
330
|
-
def from_arrays(cls, arrays:
|
332
|
+
def from_arrays(cls, arrays: "Grid", active_only=False) -> "BaseGraphModel":
|
331
333
|
"""Build from arrays"""
|
332
334
|
new_graph = cls(active_only=active_only)
|
333
335
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: power-grid-model-ds
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.2
|
4
4
|
Summary: Power Grid Model extension which provides a grid data structure for simulation and analysis
|
5
5
|
Author-email: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
6
6
|
License: MPL-2.0
|
@@ -42,6 +42,7 @@ Requires-Dist: sphinx_rtd_theme; extra == "doc"
|
|
42
42
|
Requires-Dist: readthedocs-sphinx-search; extra == "doc"
|
43
43
|
Requires-Dist: sphinx-hoverxref; extra == "doc"
|
44
44
|
Requires-Dist: numpydoc; extra == "doc"
|
45
|
+
Dynamic: license-file
|
45
46
|
|
46
47
|
<!--
|
47
48
|
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
@@ -32,7 +32,6 @@ power_grid_model_ds/_core/model/arrays/base/array.py,sha256=F2o5Oc2AFfJ_aBpdSzQd
|
|
32
32
|
power_grid_model_ds/_core/model/arrays/base/errors.py,sha256=M62aA2pv9AlSJSvniU1IJTtRC0jvBlMYRxv2SchTdDA,475
|
33
33
|
power_grid_model_ds/_core/model/containers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
power_grid_model_ds/_core/model/containers/base.py,sha256=O-GoE2oN-WJl5wKXCl3fUHbvW5qc0oZ2-oY-zUWBGbs,9037
|
35
|
-
power_grid_model_ds/_core/model/containers/grid_protocol.py,sha256=-t1fSNAO0Gb_tIxnYT2Ehx52xuOUI6oAYqlGTYZXCRA,692
|
36
35
|
power_grid_model_ds/_core/model/dtypes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
36
|
power_grid_model_ds/_core/model/dtypes/appliances.py,sha256=ZfubZm0e7057gv78EQXMeUWefES0icyqFgIgRDnyV5c,1002
|
38
37
|
power_grid_model_ds/_core/model/dtypes/branches.py,sha256=Pb65bRmaxCIJf1d2zF1D0r1zIYee1kEifkvgdP8OvTo,3811
|
@@ -43,11 +42,11 @@ power_grid_model_ds/_core/model/dtypes/sensors.py,sha256=U8HqvyH3fV348m4QjWy8IEY
|
|
43
42
|
power_grid_model_ds/_core/model/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
43
|
power_grid_model_ds/_core/model/enums/nodes.py,sha256=UuJsWFasKREhVGbsUwGg5A-LvHnGTc4j636A_B4N9A4,356
|
45
44
|
power_grid_model_ds/_core/model/graphs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
46
|
-
power_grid_model_ds/_core/model/graphs/container.py,sha256=
|
45
|
+
power_grid_model_ds/_core/model/graphs/container.py,sha256=9hQLkrUMYnCIFj1gb2aLNXt0XhjGn_tlRv83RmJ9nxE,5830
|
47
46
|
power_grid_model_ds/_core/model/graphs/errors.py,sha256=-9fAsCqpKM0-lCM-tO2fVot9hqZBJa8WCxxqWEH_z6k,479
|
48
47
|
power_grid_model_ds/_core/model/graphs/models/__init__.py,sha256=xwhMajQKIAfL1R3cq2sMNXMWtqfI5WGBi6-P4clyTes,262
|
49
48
|
power_grid_model_ds/_core/model/graphs/models/_rustworkx_search.py,sha256=TqRR22TPx8XjRLukQxK8R8FjZvJ60CttDFctbISSbOM,2979
|
50
|
-
power_grid_model_ds/_core/model/graphs/models/base.py,sha256=
|
49
|
+
power_grid_model_ds/_core/model/graphs/models/base.py,sha256=GJ1ZExVBhpcezzWZqYAOeDSn9ePWvhniGFjR-qL5aBY,16730
|
51
50
|
power_grid_model_ds/_core/model/graphs/models/rustworkx.py,sha256=a7PrDgge2KzMbeTQhQTE-KRPdKNj5TJvfYkzYNT8FtM,5730
|
52
51
|
power_grid_model_ds/_core/model/grids/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
52
|
power_grid_model_ds/_core/model/grids/_text_sources.py,sha256=3CWn0zjaUkFhrnSEIqAas52xeW0EX3EWXIXyo8XSQgw,4229
|
@@ -57,8 +56,8 @@ power_grid_model_ds/_core/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
57
56
|
power_grid_model_ds/_core/utils/misc.py,sha256=aAdlXjyKN6_T4b_CQZ879TbkbDZW4TwBUsxTpkwvymU,1228
|
58
57
|
power_grid_model_ds/_core/utils/pickle.py,sha256=LGeTc7nu9RY1noOzLJzYaSHSWIgqzHy2xhmueKGuipc,1445
|
59
58
|
power_grid_model_ds/_core/utils/zip.py,sha256=9RtJYhjlgNZOtxr4iI-CpsjT1axw5kCCqprfTjaIsiI,2197
|
60
|
-
power_grid_model_ds-1.2.
|
61
|
-
power_grid_model_ds-1.2.
|
62
|
-
power_grid_model_ds-1.2.
|
63
|
-
power_grid_model_ds-1.2.
|
64
|
-
power_grid_model_ds-1.2.
|
59
|
+
power_grid_model_ds-1.2.2.dist-info/licenses/LICENSE,sha256=GpbnG1pNl-ORtSP6dmHeiZvwy36UFli6MEZy1XlmBqo,14906
|
60
|
+
power_grid_model_ds-1.2.2.dist-info/METADATA,sha256=5m0N8JP7FgL8NsDSXpsNovI6HGqPGoY1EOCvQgY9DYA,8844
|
61
|
+
power_grid_model_ds-1.2.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
62
|
+
power_grid_model_ds-1.2.2.dist-info/top_level.txt,sha256=nJa103Eqvm5TESYEKPFVImfLg_ugGOBznikrM-rZQZg,20
|
63
|
+
power_grid_model_ds-1.2.2.dist-info/RECORD,,
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
2
|
-
#
|
3
|
-
# SPDX-License-Identifier: MPL-2.0
|
4
|
-
"""This file contains the Grid protocol defining the minimal arrays contained in a grid"""
|
5
|
-
|
6
|
-
from typing import Protocol
|
7
|
-
|
8
|
-
from power_grid_model_ds._core.model.arrays import (
|
9
|
-
BranchArray,
|
10
|
-
NodeArray,
|
11
|
-
ThreeWindingTransformerArray,
|
12
|
-
)
|
13
|
-
|
14
|
-
|
15
|
-
class MinimalGridArrays(Protocol):
|
16
|
-
"""Protocol for the minimal arrays contained in a grid,
|
17
|
-
they may be implemented using properties or added as attributes"""
|
18
|
-
|
19
|
-
node: NodeArray
|
20
|
-
three_winding_transformer: ThreeWindingTransformerArray
|
21
|
-
branches: BranchArray
|
22
|
-
branch_arrays: list[BranchArray]
|
{power_grid_model_ds-1.2.0.dist-info → power_grid_model_ds-1.2.2.dist-info/licenses}/LICENSE
RENAMED
File without changes
|
File without changes
|