Allow float for int argument type [pylint plugin] (#114105)

This commit is contained in:
Marc Mueller 2024-03-27 11:51:27 +01:00 committed by GitHub
parent 5c97049f2e
commit 3929273b41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 47 additions and 5 deletions

View file

@ -2968,6 +2968,15 @@ def _is_valid_type(
):
return True
# Special case for int in argument type
if (
expected_type == "int"
and not in_return
and isinstance(node, nodes.Name)
and node.name in ("float", "int")
):
return True
# Name occurs when a namespace is not used, eg. "HomeAssistant"
if isinstance(node, nodes.Name) and node.name == expected_type:
return True