Use assignment expressions 03 (#57710)
This commit is contained in:
parent
2a8eaf0e0f
commit
238b488642
18 changed files with 49 additions and 102 deletions
|
@ -727,8 +727,7 @@ current_platform: ContextVar[EntityPlatform | None] = ContextVar(
|
|||
@callback
|
||||
def async_get_current_platform() -> EntityPlatform:
|
||||
"""Get the current platform from context."""
|
||||
platform = current_platform.get()
|
||||
if platform is None:
|
||||
if (platform := current_platform.get()) is None:
|
||||
raise RuntimeError("Cannot get non-set current platform")
|
||||
return platform
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue