Skip to content

Commit

Permalink
Remove invalid prefixes after dictionary iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
nanglo123 committed Sep 12, 2024
1 parent b0c026b commit d453a43
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/pyobo/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@
VERSION_PINS = {}
else:
VERSION_PINS = json.loads(VERSION_PINS_STR)
for k, v in VERSION_PINS.items():
if not isinstance(k, str) or not isinstance(v, str):
invalid_prefixes = []
for prefix, version in VERSION_PINS.items():
if not isinstance(prefix, str) or not isinstance(version, str):
logger.error(
f"The prefix: {k} and version: {v} name must both be strings")
VERSION_PINS.pop(k)
f"The prefix:{prefix} and version:{version} name must both be strings")
invalid_prefixes.append(prefix)
for prefix in invalid_prefixes:
VERSION_PINS.pop(prefix)
except ValueError as e:
logger.error(
"The value for the environment variable VERSION_PINS must be a valid JSON string: %s" % e
Expand Down

0 comments on commit d453a43

Please sign in to comment.