Make Message.__getattribute__ invisible to type checkers (#359)
This lets linters know that we shouldn't access fields that aren't actually defined
This commit is contained in:
parent
402c21256f
commit
b9b0b22d57
@ -18,6 +18,7 @@ from datetime import (
|
|||||||
timezone,
|
timezone,
|
||||||
)
|
)
|
||||||
from typing import (
|
from typing import (
|
||||||
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
Dict,
|
Dict,
|
||||||
@ -693,6 +694,8 @@ class Message(ABC):
|
|||||||
]
|
]
|
||||||
return f"{self.__class__.__name__}({', '.join(parts)})"
|
return f"{self.__class__.__name__}({', '.join(parts)})"
|
||||||
|
|
||||||
|
if not TYPE_CHECKING:
|
||||||
|
|
||||||
def __getattribute__(self, name: str) -> Any:
|
def __getattribute__(self, name: str) -> Any:
|
||||||
"""
|
"""
|
||||||
Lazily initialize default values to avoid infinite recursion for recursive
|
Lazily initialize default values to avoid infinite recursion for recursive
|
||||||
|
Loading…
x
Reference in New Issue
Block a user