Skip to content

Commit

Permalink
Merge pull request e2nIEE#487 from jkupka/develop
Browse files Browse the repository at this point in the history
from_json_string backwards compatibility
  • Loading branch information
jkupka authored Sep 6, 2019
2 parents ae3d605 + 612941b commit 5a6cf58
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pandapower/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,15 @@ def from_json_string(json_string, convert=False):
"""
net = json.loads(json_string, cls=PPJSONDecoder)
restore_jsoned_objects(net)
# this can be removed in the future
# now net is saved with "_module", "_class", "_object"..., so json.load already returns
# pandapowerNet. Older files don't have it yet, and are loaded as dict.
# After some time, this part can be removed.
if not isinstance(net, pandapowerNet):
warn("This net is saved in older format, which will not be supported in future.\r\n"
"Please resave your grid using the current pandapower version.",
DeprecationWarning)
net = from_json_dict(net)

if convert:
convert_format(net)
Expand Down

0 comments on commit 5a6cf58

Please sign in to comment.