Page MenuHomeVyOS Platform

op-mode scripts with type hints in `return` do not work
Closed, ResolvedPublicBUG


If we define the return type in a function:

def do_something(input_data: str) -> str:

this will break its execution using the new

The problem is in typing.get_type_hints() function - it will return return as one of type hints:

>> typing.get_type_hints(do_something)
{'input_data': <class 'str'>, 'return': <class 'str'>}

What will be wrongly interpreted by as a required argument for operation:

We need to add an exception to the return hint to skip it.


Difficulty level
Easy (less than an hour)
Why the issue appeared?
Implementation mistake
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav changed the task status from In progress to Needs testing.Sep 27 2022, 12:05 PM
dmbaturin changed Why the issue appeared? from Will be filled on close to Implementation mistake.