Closed
Description
Bug description
"""test_lint.py"""
# pylint: disable=R0903
class CoreSys:
"""CoreSys object."""
def __init__(self) -> None:
"""Initialize CoreSys."""
self._host: "Host" | None = None
@property
def host(self) -> "Host":
"""Get host."""
if not self._host:
raise RuntimeError("Host not set!")
return self._host
@host.setter
def host(self, value: "Host") -> None:
"""Set Host."""
self._host = value
@property
def timezone(self) -> str:
"""Get timezone."""
if self.host.info.timezone:
return self.host.info.timezone
return "UTC"
class CoreSysAttributes:
"""CoreSysAttributes object."""
coresys: CoreSys
@property
def sys_host(self) -> "Host":
"""Get host."""
return self.coresys.host
class Info(CoreSysAttributes):
"""Info object."""
def __init__(self, coresys: CoreSys) -> None:
"""Initialize info."""
self.coresys = coresys
self._timezone: str | None = None
@property
def timezone(self) -> str | None:
"""Get timezone."""
return self._timezone
@timezone.setter
def timezone(self, value: str | None) -> None:
"""Set timezone."""
self._timezone = value
class Host(CoreSysAttributes):
"""Host object."""
def __init__(self, coresys: CoreSys) -> None:
"""Initialize host object."""
self.coresys = coresys
self._info = Info(coresys)
@property
def info(self) -> Info:
"""Get info."""
return self._info
Configuration
No response
Command used
pylint test_lint.py
Pylint output
************* Module test_lint
test_lint.py:28:11: E1101: Instance of 'CoreSys' has no 'info' member (no-member)
test_lint.py:29:19: E1101: Instance of 'CoreSys' has no 'info' member (no-member)
Expected behavior
This should not show an error, all members referenced are defined. Notably it does not show an error in 3.12.3, appears to be a regression with 3.12.4
Pylint version
pylint 3.2.5
astroid 3.2.3
Python 3.12.4 (main, Jul 17 2024, 10:41:37) [Clang 15.0.0 (clang-1500.3.9.4)]
OS / Environment
MacOS 14.4.1
We also are seeing it in ubuntu containers running in github actions, like this run: https://github.com/home-assistant/supervisor/actions/runs/9904839873/job/27515699355 (same issue, appeared on upgrade to 3.12.4).
Additional dependencies
No response