Skip to content

Commit

Permalink
Minor typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nx10 committed Jul 12, 2024
1 parent 28bc3a9 commit e6b0617
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/styx/compiler/compile/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _generate_run_function(

# Function arguments
func.args.extend(build_input_arguments(inputs, sub_aliases))
func.args.append(PyArg(name="runner", type="Runner", default="None", docstring="Command runner"))
func.args.append(PyArg(name="runner", type="Runner | None", default="None", docstring="Command runner"))

# Function body: Runner instantiation
func.body.extend([
Expand Down
7 changes: 4 additions & 3 deletions src/styx/compiler/compile/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ def _base() -> str:
case _:
assert False

type_ = _base()
if arg.type.primitive != InputTypePrimitive.Flag:
if arg.type.is_list:
return f"list[{_base()}]"
type_ = f"list[{type_}]"
if arg.type.is_optional:
return f"{_base()} | None"
return _base()
type_ = f"{type_} | None"
return type_


def build_input_arguments(
Expand Down

0 comments on commit e6b0617

Please sign in to comment.