polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
241 stars 115 forks source link

compose_call function doesn't declare a return Type #363

Open tjwilliams-bell-labs opened 10 months ago

tjwilliams-bell-labs commented 10 months ago

Following the example code in the "Quick Usage" section of the README.md to create a call using the "compose_call()" function then passing the result to the "call" parameter for "create_signed_extrinsic()" I get a warning from Pylance (Vs Code IDE) that the "call" parameter is expecting a type "GenericCall" and getting a type. of "ScaleType | Unknown". The "compose_call()" does not have a return type declared for the function, so it is using the "ScaleType | Unknown" which is what it appears to be getting internally from the "call.encode()" in the function.

The docstring for the function says the return for the "compose_call()" is a GenericCall (which I was expecting) but the actual function signature does not specify a return type.

arjanz commented 10 months ago

I see the type hinting is indeed missing for that function, thanks for pointing this out.

The warning is probably because the inferred type hinting is not clear because of the factory method used here. If you would debug there, you would see that the type returned is indeed a sub-class of GenericCall.