Skip to content

Fix problem if self has a type hint

Yury Matveyev requested to merge 560-typed-self-fails-typing-declaration into develop

Closes #560 (closed)

First of all, to get rid of NameError I propose that we just directly read the annotation of the function instead of utilizing typing.get_type_hit. In that case, we lose the functionality of defining complicated types, but since pytango by itself does not support complicated types - this does not matter.

The second change is that for the write method of attributes, we pick the type hint from the last argument instead of the first one (since the signatures of write methods are fixed - that should be OK)

For the command, it is a bit more tricky; we should also understand that a command has in arguments, which we can do by counting arguments.

Added test for all possible scenarios - seems to work

Merge request reports