mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 15:27:08 +00:00
Adjust pylint for IMPERIAL_SYSTEM deprecation (#80874)
* Adjust pylint for IMPERIAL_SYSTEM deprecation * Use correct location * Adjust components
This commit is contained in:
parent
ec4b8c49fe
commit
0c79a9a33d
@ -8,7 +8,7 @@ from homeassistant.const import CONF_API_KEY, CONF_MODE, CONF_NAME
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
import homeassistant.helpers.config_validation as cv
|
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 (
|
from .const import (
|
||||||
ALL_LANGUAGES,
|
ALL_LANGUAGES,
|
||||||
@ -46,7 +46,7 @@ def default_options(hass: HomeAssistant) -> dict[str, str | None]:
|
|||||||
return {
|
return {
|
||||||
CONF_MODE: "driving",
|
CONF_MODE: "driving",
|
||||||
CONF_UNITS: (
|
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
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.const import CONF_NAME, CONF_REGION
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
import homeassistant.helpers.config_validation as cv
|
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 (
|
from .const import (
|
||||||
CONF_AVOID_FERRIES,
|
CONF_AVOID_FERRIES,
|
||||||
@ -35,7 +35,7 @@ from .helpers import is_valid_config_entry
|
|||||||
def default_options(hass: HomeAssistant) -> dict[str, str | bool]:
|
def default_options(hass: HomeAssistant) -> dict[str, str | bool]:
|
||||||
"""Get the default options."""
|
"""Get the default options."""
|
||||||
defaults = DEFAULT_OPTIONS.copy()
|
defaults = DEFAULT_OPTIONS.copy()
|
||||||
if hass.config.units is IMPERIAL_SYSTEM:
|
if hass.config.units is US_CUSTOMARY_SYSTEM:
|
||||||
defaults[CONF_UNITS] = IMPERIAL_UNITS
|
defaults[CONF_UNITS] = IMPERIAL_UNITS
|
||||||
return defaults
|
return defaults
|
||||||
|
|
||||||
|
@ -296,6 +296,12 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
|
|||||||
constant=re.compile(r"^(distance|pressure|speed|temperature|volume)$"),
|
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$"),
|
||||||
|
),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user