Skip to content

Commit 1b2f8e8

Browse files
committed
Removal of --modules
removed the modules flag in favor of the config flag.
1 parent 94d24af commit 1b2f8e8

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

ngcsimlib/__init__.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,25 @@
44
from . import commands
55
from . import logger
66

7-
import argparse, os, warnings, json, logging
7+
import argparse, os, warnings, json
88
from types import SimpleNamespace
99
from pathlib import Path
1010
from sys import argv
1111
from importlib import import_module
12-
from ngcsimlib.configManager import GlobalConfig
12+
from ngcsimlib.configManager import init_config, get_config
1313

1414
from pkg_resources import get_distribution
1515

1616
__version__ = get_distribution('ngcsimlib').version ## set software version
1717

1818

1919
###### Preload Modules
20-
def preload():
21-
parser = argparse.ArgumentParser(description='Build and run a model using ngclearn')
22-
parser.add_argument("--modules", type=str, help='location of modules.json file')
23-
24-
## ngc-sim-lib only cares about --modules argument
25-
args, unknown = parser.parse_known_args() # args = parser.parse_args()
26-
try:
27-
module_path = args.modules
28-
except:
29-
module_path = None
30-
31-
if module_path is None:
32-
module_config = GlobalConfig.get_config("modules")
33-
if module_config is None:
34-
module_path = "json_files/modules.json"
35-
else:
36-
module_path = module_config.get("module_path", "json_files/modules.json")
20+
def preload_modules():
21+
module_config = get_config("modules")
22+
if module_config is None:
23+
module_path = "json_files/modules.json"
24+
else:
25+
module_path = module_config.get("module_path", "json_files/modules.json")
3726

3827
if not os.path.isfile(module_path):
3928
warnings.warn("\nMissing file to preload modules from. Attempted to locate file at \"" + str(module_path) +
@@ -79,7 +68,7 @@ def configure():
7968
"\nSee PUT LINK HERE for additional information")
8069
return
8170

82-
GlobalConfig.init_config(config_path)
71+
init_config(config_path)
8372

8473

8574

@@ -88,6 +77,5 @@ def configure():
8877
if "readthedocs" not in argv[0]: ## prevent readthedocs execution of preload
8978
configure()
9079
logger.init_logging()
91-
92-
preload()
80+
preload_modules()
9381

0 commit comments

Comments
 (0)