Use assignment expressions 03 (#57710)

This commit is contained in:
Marc Mueller 2021-10-17 20:08:11 +02:00 committed by GitHub
parent 2a8eaf0e0f
commit 238b488642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 49 additions and 102 deletions

View file

@ -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