Skip to content

Commit d6ed49f

Browse files
committed
Allows for loading custom contexts
1 parent 24d0a20 commit d6ed49f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ngcsimlib/_src/context/context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ def save_to_json(self, directory: str, model_name: Union[str, None] = None,
305305
with open(f"{path}/connections.json", "w") as fp:
306306
json.dump(connections, fp, indent=4)
307307

308-
@staticmethod
309-
def load(directory: str, module_name: str) -> "Context":
308+
@classmethod
309+
def load(cls, directory: str, module_name: str) -> "Context":
310310
if gcm.exists(gcm.append_path(module_name)):
311311
warn("Trying to load a context that already exists, returning "
312312
"existing context")
@@ -316,7 +316,7 @@ def load(directory: str, module_name: str) -> "Context":
316316
with open(f"{path}/contextData.json", "r") as f:
317317
metaData = json.load(f)
318318

319-
with Context(metaData.get("path", module_name)) as ctx:
319+
with cls(metaData.get("path", module_name)) as ctx:
320320
delayed_load = []
321321

322322
for _type in metaData["types"]:

0 commit comments

Comments
 (0)