-
Notifications
You must be signed in to change notification settings - Fork 19
Description
What's needed?
Type annotations in some cases are limited and thus it would be good to enhance them with what the typing-extensions package has to offer.
One example of this would be @classmethod, which always uses cls argument as the first argument. Ideally, we would annotate it with the Self type from the typing-extensions package.
Proposed solution
Use typing-extensions package to enhance type annotations.
Use cases
This can be applied to @classmethods and perhaps other functions used as decorators. One apparent case where we could use better type checking is the @actor decorator, which decorates classes at runtime making it impossible for pylint to verify if attributes / methods are defined on the decorated class.
Alternatives and workarounds
In case of @classmethod, we an omit the type annotation for the cls argument and it still passes type checking.
Otherwise, we have to explicitly tell type checkers pylint and/or mypy that a particular line should be ignored, because there is no correct type annotation available.
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status