Open thisismygitrepo opened 7 months ago
Are you referring to GUI hints in an IDE? I tried making this change but it doesn't make any difference in pycharm. Can you give me a way to test this?
Yes, I am referring to IDE.
It is weird that Pycharm makes no difference.
I use VS-Code with official pylance
, mypy
linter and type checker and I set them on hashest mode, so they yell at me for all tiny mistakes.
As can be seen in the image, becaues of non-standard type hinting, they fail to parse it and they think the type is Unknown
, therefore they are unable to yell at me no matter what I pass as argument, because they don't know what should be passed to begin with.
You mentioned that it makes no diffrence, but you should get squiggly underline hiting from the editor saying you violated the types. At the moment, the callable
argument is not even type-hintend, so, no matter what function you pass, the IDE is happy, until you run the code and you get error, but we want to get all the errors while we type, not at runtime (too late, too slow). In my example, the type-hint declares what signature the callable should have, so if you passed anything else, the IDE will underline it and declares it as error (in a static way before you run the code).
Ah, I can see a similar prompt when hovering over the function name and it is more detailed when using typing
. Will investigate implementing this
My linters and type checkers are failing to provide any help due to non-standard way of type hinting used in the library, For instance, in the file:
unified_trading
:The proper way of enshrining the logic that
symbol
can be eitherstr
ORlist[str]
is:Once fixed, type checker will be able to statically check all the code (including the library itself) for any inconsistency. Can you guys please use the standards?
Thank you,