Optional and Union simplifications (#25365)
parent
5e29d4d098
commit
17d754dbbf
|
@ -1,7 +1,7 @@
|
|||
"""Helpers to deal with permissions."""
|
||||
from functools import wraps
|
||||
|
||||
from typing import Callable, Dict, List, Optional, Union, cast # noqa: F401
|
||||
from typing import Callable, Dict, List, Optional, cast # noqa: F401
|
||||
|
||||
from .const import SUBCAT_ALL
|
||||
from .models import PermissionLookup
|
||||
|
@ -44,7 +44,7 @@ def compile_policy(
|
|||
|
||||
assert isinstance(policy, dict)
|
||||
|
||||
funcs = [] # type: List[Callable[[str, str], Union[None, bool]]]
|
||||
funcs = [] # type: List[Callable[[str, str], Optional[bool]]]
|
||||
|
||||
for key, lookup_func in subcategories.items():
|
||||
lookup_value = policy.get(key)
|
||||
|
|
|
@ -70,7 +70,7 @@ class Store:
|
|||
"""Return the config path."""
|
||||
return self.hass.config.path(STORAGE_DIR, self.key)
|
||||
|
||||
async def async_load(self) -> Optional[Union[Dict, List]]:
|
||||
async def async_load(self) -> Union[Dict, List, None]:
|
||||
"""Load data.
|
||||
|
||||
If the expected version does not match the given version, the migrate
|
||||
|
|
|
@ -236,7 +236,7 @@ async def async_get_integration(hass: 'HomeAssistant', domain: str)\
|
|||
cache = hass.data[DATA_INTEGRATIONS] = {}
|
||||
|
||||
int_or_evt = cache.get(
|
||||
domain, _UNDEF) # type: Optional[Union[Integration, asyncio.Event]]
|
||||
domain, _UNDEF) # type: Union[Integration, asyncio.Event, None]
|
||||
|
||||
if isinstance(int_or_evt, asyncio.Event):
|
||||
await int_or_evt.wait()
|
||||
|
|
Loading…
Reference in New Issue