mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Mark ReadOnlyDict with @final (#142059)
This commit is contained in:
parent
8200c234dd
commit
6fbee5c2e3
@ -1,7 +1,7 @@
|
||||
"""Read only dictionary."""
|
||||
|
||||
from copy import deepcopy
|
||||
from typing import Any
|
||||
from typing import Any, final
|
||||
|
||||
|
||||
def _readonly(*args: Any, **kwargs: Any) -> Any:
|
||||
@ -9,6 +9,7 @@ def _readonly(*args: Any, **kwargs: Any) -> Any:
|
||||
raise RuntimeError("Cannot modify ReadOnlyDict")
|
||||
|
||||
|
||||
@final # Final to allow direct checking of the type instead of using isinstance
|
||||
class ReadOnlyDict[_KT, _VT](dict[_KT, _VT]):
|
||||
"""Read only version of dict that is compatible with dict types."""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user