mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Mark Event and HassJob with @final (#142055)
This commit is contained in:
parent
93ea88f3de
commit
93162f6b65
@ -38,6 +38,7 @@ from typing import (
|
|||||||
TypedDict,
|
TypedDict,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
cast,
|
cast,
|
||||||
|
final,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -324,6 +325,7 @@ class HassJobType(enum.Enum):
|
|||||||
Executor = 3
|
Executor = 3
|
||||||
|
|
||||||
|
|
||||||
|
@final # Final to allow direct checking of the type instead of using isinstance
|
||||||
class HassJob[**_P, _R_co]:
|
class HassJob[**_P, _R_co]:
|
||||||
"""Represent a job to be run later.
|
"""Represent a job to be run later.
|
||||||
|
|
||||||
@ -1317,6 +1319,7 @@ class EventOrigin(enum.Enum):
|
|||||||
return next((idx for idx, origin in enumerate(EventOrigin) if origin is self))
|
return next((idx for idx, origin in enumerate(EventOrigin) if origin is self))
|
||||||
|
|
||||||
|
|
||||||
|
@final # Final to allow direct checking of the type instead of using isinstance
|
||||||
class Event(Generic[_DataT]):
|
class Event(Generic[_DataT]):
|
||||||
"""Representation of an event within the bus."""
|
"""Representation of an event within the bus."""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user