mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-23 14:07:47 +01:00
Enable RUF021 (#135832)
This commit is contained in:
committed by
GitHub
parent
85b4be2f16
commit
b4f4b06f29
@@ -239,20 +239,13 @@ def execute(
|
||||
if name.startswith("async_"):
|
||||
raise ScriptError("Not allowed to access async methods")
|
||||
if (
|
||||
obj is hass
|
||||
and name not in ALLOWED_HASS
|
||||
or obj is hass.bus
|
||||
and name not in ALLOWED_EVENTBUS
|
||||
or obj is hass.states
|
||||
and name not in ALLOWED_STATEMACHINE
|
||||
or obj is hass.services
|
||||
and name not in ALLOWED_SERVICEREGISTRY
|
||||
or obj is dt_util
|
||||
and name not in ALLOWED_DT_UTIL
|
||||
or obj is datetime
|
||||
and name not in ALLOWED_DATETIME
|
||||
or isinstance(obj, TimeWrapper)
|
||||
and name not in ALLOWED_TIME
|
||||
(obj is hass and name not in ALLOWED_HASS)
|
||||
or (obj is hass.bus and name not in ALLOWED_EVENTBUS)
|
||||
or (obj is hass.states and name not in ALLOWED_STATEMACHINE)
|
||||
or (obj is hass.services and name not in ALLOWED_SERVICEREGISTRY)
|
||||
or (obj is dt_util and name not in ALLOWED_DT_UTIL)
|
||||
or (obj is datetime and name not in ALLOWED_DATETIME)
|
||||
or (isinstance(obj, TimeWrapper) and name not in ALLOWED_TIME)
|
||||
):
|
||||
raise ScriptError(f"Not allowed to access {obj.__class__.__name__}.{name}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user