mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Mypy config cleanups (#25475)
* Move file specific config to inline comments * Disallow untyped defs by default everywhere
This commit is contained in:
parent
a50f1ae614
commit
b230562c76
@ -14,6 +14,9 @@ from homeassistant.exceptions import HomeAssistantError, ConfigEntryNotReady
|
|||||||
from homeassistant.setup import async_setup_component, async_process_deps_reqs
|
from homeassistant.setup import async_setup_component, async_process_deps_reqs
|
||||||
from homeassistant.util.decorator import Registry
|
from homeassistant.util.decorator import Registry
|
||||||
|
|
||||||
|
|
||||||
|
# mypy: allow-untyped-defs
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_UNDEF = object()
|
_UNDEF = object()
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import yaml
|
|||||||
from .objects import NodeListClass
|
from .objects import NodeListClass
|
||||||
|
|
||||||
|
|
||||||
|
# mypy: allow-untyped-calls, no-warn-return-any
|
||||||
|
|
||||||
def dump(_dict: dict) -> str:
|
def dump(_dict: dict) -> str:
|
||||||
"""Dump YAML to a string and remove null."""
|
"""Dump YAML to a string and remove null."""
|
||||||
return yaml.safe_dump(
|
return yaml.safe_dump(
|
||||||
|
@ -24,6 +24,8 @@ from .const import _SECRET_NAMESPACE, SECRET_YAML
|
|||||||
from .objects import NodeListClass, NodeStrClass
|
from .objects import NodeListClass, NodeStrClass
|
||||||
|
|
||||||
|
|
||||||
|
# mypy: allow-untyped-calls, no-warn-return-any
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
__SECRET_CACHE = {} # type: Dict[str, JSON_TYPE]
|
__SECRET_CACHE = {} # type: Dict[str, JSON_TYPE]
|
||||||
|
|
||||||
|
16
mypy.ini
16
mypy.ini
@ -3,6 +3,7 @@ python_version = 3.5
|
|||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
|
disallow_untyped_defs = true
|
||||||
follow_imports = silent
|
follow_imports = silent
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
no_implicit_optional = true
|
no_implicit_optional = true
|
||||||
@ -13,18 +14,3 @@ warn_return_any = true
|
|||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
warn_unused_configs = true
|
warn_unused_configs = true
|
||||||
warn_unused_ignores = true
|
warn_unused_ignores = true
|
||||||
|
|
||||||
[mypy-homeassistant.*]
|
|
||||||
disallow_untyped_defs = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.config_entries]
|
|
||||||
disallow_untyped_defs = false
|
|
||||||
|
|
||||||
[mypy-homeassistant.util.yaml.dumper]
|
|
||||||
warn_return_any = false
|
|
||||||
disallow_untyped_calls = false
|
|
||||||
|
|
||||||
[mypy-homeassistant.util.yaml.loader]
|
|
||||||
warn_return_any = false
|
|
||||||
disallow_untyped_calls = false
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user