diff --git a/gridappsd-python-lib/gridappsd/json_extension.py b/gridappsd-python-lib/gridappsd/json_extension.py index 81d7343..692d0c6 100644 --- a/gridappsd-python-lib/gridappsd/json_extension.py +++ b/gridappsd-python-lib/gridappsd/json_extension.py @@ -34,20 +34,90 @@ def default(self, obj: Any) -> Any: return rv -def dump(data: Any, fo: TextIO): - rv = _json.dump(data, fo, cls=JsonEncoderExtension) +def dump(data: Any, + fo: TextIO, + *, + skipkeys=False, + ensure_ascii=True, + check_circular=True, + allow_nan=True, + indent=None, + separators=None, + default=None, + sort_keys=False, + **kw): + rv = _json.dump(data, + fo, + skipkeys=skipkeys, + ensure_ascii=ensure_ascii, + check_circular=check_circular, + allow_nan=allow_nan, + cls=JsonEncoderExtension, + indent=indent, + separators=separators, + default=default, + sort_keys=sort_keys, + **kw) -def dumps(data: Any) -> str: - rv = _json.dumps(data, cls=JsonEncoderExtension) +def dumps(data: Any, + *, + skipkeys=False, + ensure_ascii=True, + check_circular=True, + allow_nan=True, + indent=None, + separators=None, + default=None, + sort_keys=False, + **kw) -> str: + rv = _json.dumps(data, + skipkeys=skipkeys, + ensure_ascii=ensure_ascii, + check_circular=check_circular, + allow_nan=allow_nan, + cls=JsonEncoderExtension, + indent=indent, + separators=separators, + default=default, + sort_keys=sort_keys, + **kw) return rv -def load(fo: TextIO) -> Any: - rv = _json.load(fo, object_hook=jsonDecoderExtension) +def load(fo: TextIO, + *, + cls=None, + parse_float=None, + parse_int=None, + parse_constant=None, + object_pairs_hook=None, + **kw) -> Any: + rv = _json.load(fo, + cls=cls, + object_hook=jsonDecoderExtension, + parse_float=parse_float, + parse_int=parse_int, + parse_constant=parse_constant, + object_pairs_hook=object_pairs_hook, + **kw) return rv -def loads(data: str) -> Any: - rv = _json.loads(data, object_hook=jsonDecoderExtension) +def loads(data: str, + *, + cls=None, + parse_float=None, + parse_int=None, + parse_constant=None, + object_pairs_hook=None, + **kw) -> Any: + rv = _json.loads(data, + cls=cls, + object_hook=jsonDecoderExtension, + parse_float=parse_float, + parse_int=parse_int, + parse_constant=parse_constant, + object_pairs_hook=object_pairs_hook, + **kw) return rv diff --git a/gridappsd-python-lib/gridappsd/simulation.py b/gridappsd-python-lib/gridappsd/simulation.py index 8ff94b0..2c074ad 100644 --- a/gridappsd-python-lib/gridappsd/simulation.py +++ b/gridappsd-python-lib/gridappsd/simulation.py @@ -122,8 +122,12 @@ class Simulation: def __init__(self, gapps: 'GridAPPSD', run_config: Union[Dict, SimulationConfig]): assert type(gapps).__name__ == 'GridAPPSD', "Must be an instance of GridAPPSD" - - self._run_config = run_config + if isinstance(run_config, SimulationConfig): + self._run_config = run_config.asdict() + elif isinstance(run_config, dict): + self._run_config = run_config + else: + raise TypeError("run_config must be a dictionary or a SimulationConfig") # if isinstance(run_config, SimulationConfig): # self._run_config = run_config # else: