Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nx10 committed Jul 17, 2024
1 parent e6b0617 commit b875ba7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/styx/model/from_boutiques.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def _input_argument_from_boutiques(bt_input: dict) -> InputArgument:
# Note: Boutiques 0.5 does not require value-key and I don't know why.
if "value-key" not in bt_input:
raise ValueError(f"value-key is missing for input '{bt_input['id']}'")
if len(bt_input["value-key"]) == 0:
raise ValueError(f"value-key is empty for input '{bt_input['id']}'")

type_ = _input_type_from_boutiques(bt_input)
has_default_value, default_value = _default_value_from_boutiques(bt_input)
Expand Down
4 changes: 2 additions & 2 deletions src/styx/pycodegen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def ensure_python_symbol(name: str, alt_prefix: str = "v_") -> str:
"""
# Remove invalid characters
name = re.sub(r"[^a-zA-Z0-9_]", "_", name)
# Prefix if name starts with a digit
if re.match(r"^\d", name):
# Prefix if name starts with a digit or underscore
if re.match(r"^[0-9_]", name):
name = f"{alt_prefix}{name}"
return name

Expand Down

0 comments on commit b875ba7

Please sign in to comment.