-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
acceptedReady for implementationReady for implementationruleImplementing or modifying a lint ruleImplementing or modifying a lint ruletype-inferenceRequires more advanced type inference.Requires more advanced type inference.
Description
If a parent class defines a return type hint for a method, then it makes sense to keep the return None explicit.
This is similar to #3704/#3705, but it involves looking also at the parent classes.
class BaseClass:
def get_value(self) -> str | None:
return "a value"
class Class(BaseClass):
def get_value(self) -> None:
return None
# RET501 [*] Do not explicitly `return None` in function if it is the only possible return valueBased on home-assistant/core#115031
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
acceptedReady for implementationReady for implementationruleImplementing or modifying a lint ruleImplementing or modifying a lint ruletype-inferenceRequires more advanced type inference.Requires more advanced type inference.