Skip to content

Commit 6b6b184

Browse files
author
Sunil Thaha
committed
feat(model/config): allow comments using #
Signed-off-by: Sunil Thaha <[email protected]>
1 parent 3b7ddad commit 6b6b184

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/kepler_model/util/config.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,16 @@ def set_env_from_model_config():
126126
return
127127

128128
for line in model_config.splitlines():
129-
splits = line.split("=")
129+
line = line.strip()
130+
# ignore comments and blanks
131+
if not line or line.startswith("#"):
132+
continue
133+
134+
# pick only the first part until # and ignore the rest
135+
splits = line.split("#")[0].strip().split("=")
130136
if len(splits) > 1:
131137
os.environ[splits[0].strip()] = splits[1].strip()
132-
logging.info(f"set {splits[0]} to {splits[1]}.")
138+
logging.info(f"set env {splits[0]} to '{splits[1]}'.")
133139

134140

135141
def is_estimator_enable(prefix):

0 commit comments

Comments
 (0)