You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Home Assistant dropped Python 3.9 this week. While upgrading all runtime annotations to the new union syntax, I discovered some issues with pylint. It seems astroid doesn't know how to handle these.
# pylint: disable=missing-docstring,too-few-public-methods,line-too-long,useless-suppressionfrom __future__ importannotationsfromtypingimportGeneric, TypeVarT=TypeVar("T")
classCoordinator(Generic[T]):
def__init__(self, update_interval=None) ->None:
self.update_interval=update_intervalclassChild(Coordinator[int|str]): # <-- 'int | str' here seems to be the issuedef__init__(self) ->None:
Coordinator.__init__(self, update_interval=2) # non-parent-init-calleddef_async_update_data(self):
assertself.update_interval# access-member-before-definitionself.update_interval=1# attribute-defined-outside-init
test.py:16:8: W0233: __init__ method from a non direct base class 'Coordinator' is called (non-parent-init-called)
test.py:19:15: E0203: Access to member 'update_interval' before its definition line 20 (access-member-before-definition)
test.py:20:8: W0201: Attribute 'update_interval' defined outside __init__ (attribute-defined-outside-init)
Expected behavior
No errors
Pylint version
pylint 2.16.0b1
astroid 2.14.0-dev0
Python 3.11.1
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered:
Bug description
Home Assistant dropped Python 3.9 this week. While upgrading all runtime annotations to the new union syntax, I discovered some issues with pylint. It seems astroid doesn't know how to handle these.
Configuration
Command used
Pylint output
Expected behavior
No errors
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: