Type hints issue of Tools

I updated a tool script but constantly got the following error:

There are no more messages. After some tests, I found that this seems related with type hints of the tool methods.

The following definition is the only one that works: Exactly one type for each argument.

def method(self, param1:int, param2:str):

All of the following will throw the error:

  • No type hints: def method(self, param1, param2)
  • Multiple types using the pipe symbol: def method(self, param1:int|float, param2:str)
  • Multiple types using the typing package: def method(self, param1:Union[int, float], param2:str)

It would be better to

  • allow multiple types for arguments
  • provide detailed and meaningful error messages
  • provide clearer instructions for developing Tools if there are strict restrictions

Thanks

@Haodong @banghuazhao

I don’t think that’s possible to allow multiple type. You don’t have to allow int|float. You can just specify one.