mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 19:25:12 +02:00
Move unit system to util (#2763)
This commit is contained in:
@@ -8,22 +8,9 @@ try:
|
||||
except ImportError:
|
||||
NewType = None
|
||||
|
||||
# HACK: mypy/pytype will import, other interpreters will not; this is to avoid
|
||||
# circular dependencies where the type is needed.
|
||||
# All homeassistant types should be imported this way.
|
||||
# Documentation
|
||||
# http://mypy.readthedocs.io/en/latest/common_issues.html#import-cycles
|
||||
# pylint: disable=using-constant-test,unused-import
|
||||
if False:
|
||||
from homeassistant.core import HomeAssistant # NOQA
|
||||
from homeassistant.helpers.unit_system import UnitSystem # NOQA
|
||||
# ENDHACK
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
if NewType:
|
||||
ConfigType = NewType('ConfigType', Dict[str, Any])
|
||||
HomeAssistantType = NewType('HomeAssistantType', 'HomeAssistant')
|
||||
UnitSystemType = NewType('UnitSystemType', 'UnitSystem')
|
||||
|
||||
# Custom type for recorder Queries
|
||||
QueryType = NewType('QueryType', Any)
|
||||
@@ -32,8 +19,6 @@ if NewType:
|
||||
# pylint: disable=invalid-name
|
||||
else:
|
||||
ConfigType = Dict[str, Any] # type: ignore
|
||||
HomeAssistantType = 'HomeAssistant' # type: ignore
|
||||
UnitSystemType = 'UnitSystemType' # type: ignore
|
||||
|
||||
# Custom type for recorder Queries
|
||||
QueryType = Any # type: ignore
|
||||
|
Reference in New Issue
Block a user