Clean control
Showing 3 of 4 files from the diff.
pandapipes/io/file_io.py
changed.
pandapipes/properties/fluids.py
changed.
pandapipes/io/io_utils.py
changed.
Other files ignored by Codecov
pandapipes/test/properties/test_fluid_specials.py
has changed.
@@ -135,8 +135,7 @@
Loading
135 | 135 | >>> net = pandapipes.from_json_string(json_str) |
|
136 | 136 | ||
137 | 137 | """ |
|
138 | - | net = create_empty_network() |
|
139 | - | net = json.loads(json_string, cls=PPJSONDecoder, object_hook=partial(pp_hook, net=net, |
|
138 | + | net = json.loads(json_string, cls=PPJSONDecoder, object_hook=partial(pp_hook, |
|
140 | 139 | registry_class=FromSerializableRegistryPpipe)) |
|
141 | 140 | ||
142 | 141 | if convert: |
@@ -7,9 +7,8 @@
Loading
7 | 7 | from functools import partial |
|
8 | 8 | from inspect import isclass |
|
9 | 9 | ||
10 | - | import pandapower as pp |
|
11 | 10 | from pandapipes.component_models.abstract_models import Component |
|
12 | - | from pandapipes.create import create_empty_network as create_fluid_network |
|
11 | + | from pandapipes.create import create_empty_network |
|
13 | 12 | from pandapipes.pandapipes_net import pandapipesNet |
|
14 | 13 | from pandapower.io_utils import pp_hook |
|
15 | 14 | from pandapower.io_utils import with_signature, to_serializable, JSONSerializableClass, \ |
@@ -35,18 +34,8 @@
Loading
35 | 34 | class_name = '' |
|
36 | 35 | module_name = '' |
|
37 | 36 | ||
38 | - | def __init__(self, obj, d, net, ppipes_hook): |
|
39 | - | super().__init__(obj, d, net, ppipes_hook) |
|
40 | - | ||
41 | - | @from_serializable.register(class_name='pandapowerNet', module_name='pandapower.auxiliary') |
|
42 | - | def pandapowerNet(self): |
|
43 | - | if isinstance(self.obj, str): # backwards compatibility |
|
44 | - | from pandapower import from_json_string |
|
45 | - | return from_json_string(self.obj) |
|
46 | - | else: |
|
47 | - | net = pp.create_empty_network() |
|
48 | - | net.update(self.obj) |
|
49 | - | return net |
|
37 | + | def __init__(self, obj, d, ppipes_hook): |
|
38 | + | super().__init__(obj, d, ppipes_hook) |
|
50 | 39 | ||
51 | 40 | @from_serializable.register(class_name="method") |
|
52 | 41 | def method(self): |
@@ -62,8 +51,9 @@
Loading
62 | 51 | from pandapipes import from_json_string |
|
63 | 52 | return from_json_string(self.obj) |
|
64 | 53 | else: |
|
65 | - | self.net.update(self.obj) |
|
66 | - | return self.net |
|
54 | + | net = create_empty_network() |
|
55 | + | net.update(self.obj) |
|
56 | + | return net |
|
67 | 57 | ||
68 | 58 | @from_serializable.register() |
|
69 | 59 | def rest(self): |
@@ -72,10 +62,12 @@
Loading
72 | 62 | if isclass(class_) and issubclass(class_, JSONSerializableClass): |
|
73 | 63 | if isinstance(self.obj, str): |
|
74 | 64 | self.obj = json.loads(self.obj, cls=PPJSONDecoder, |
|
75 | - | object_hook=partial(pp_hook, net=self.net, |
|
65 | + | object_hook=partial(pp_hook, |
|
76 | 66 | registry_class=FromSerializableRegistryPpipe)) |
|
77 | 67 | # backwards compatibility |
|
78 | - | return class_.from_dict(self.obj, self.net) |
|
68 | + | if "net" in self.obj: |
|
69 | + | del self.obj["net"] |
|
70 | + | return class_.from_dict(self.obj) |
|
79 | 71 | if isclass(class_) and issubclass(class_, Component): |
|
80 | 72 | return class_ |
|
81 | 73 | else: |
Files | Coverage |
---|---|
pandapipes | 91.51% |
Project Totals (62 files) | 91.51% |
397.1
TRAVIS_PYTHON_VERSION=3.6 TRAVIS_OS_NAME=linux
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.