Move unit system to util (#2763)

This commit is contained in:
Paulus Schoutsen
2016-08-08 20:42:25 -07:00
committed by GitHub
parent 640a8b5a7f
commit 0b7b0e54ba
18 changed files with 35 additions and 56 deletions

View File

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