Adjust pylint for IMPERIAL_SYSTEM deprecation (#80874)

* Adjust pylint for IMPERIAL_SYSTEM deprecation

* Use correct location

* Adjust components
This commit is contained in:
epenet 2022-10-24 15:25:00 +02:00 committed by GitHub
parent ec4b8c49fe
commit 0c79a9a33d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -8,7 +8,7 @@ from homeassistant.const import CONF_API_KEY, CONF_MODE, CONF_NAME
from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResult
import homeassistant.helpers.config_validation as cv
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
from .const import (
ALL_LANGUAGES,
@ -46,7 +46,7 @@ def default_options(hass: HomeAssistant) -> dict[str, str | None]:
return {
CONF_MODE: "driving",
CONF_UNITS: (
UNITS_IMPERIAL if hass.config.units is IMPERIAL_SYSTEM else UNITS_METRIC
UNITS_IMPERIAL if hass.config.units is US_CUSTOMARY_SYSTEM else UNITS_METRIC
),
}

View File

@ -8,7 +8,7 @@ from homeassistant.const import CONF_NAME, CONF_REGION
from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResult
import homeassistant.helpers.config_validation as cv
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
from .const import (
CONF_AVOID_FERRIES,
@ -35,7 +35,7 @@ from .helpers import is_valid_config_entry
def default_options(hass: HomeAssistant) -> dict[str, str | bool]:
"""Get the default options."""
defaults = DEFAULT_OPTIONS.copy()
if hass.config.units is IMPERIAL_SYSTEM:
if hass.config.units is US_CUSTOMARY_SYSTEM:
defaults[CONF_UNITS] = IMPERIAL_UNITS
return defaults

View File

@ -296,6 +296,12 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
constant=re.compile(r"^(distance|pressure|speed|temperature|volume)$"),
),
],
"homeassistant.util.unit_system": [
ObsoleteImportMatch(
reason="replaced by US_CUSTOMARY_SYSTEM",
constant=re.compile(r"^IMPERIAL_SYSTEM$"),
),
],
}