Add checks for lock

This commit is contained in:
epenet
2022-06-15 07:30:13 +00:00
parent a2e68f8424
commit 8db2225878

View File

@@ -443,9 +443,9 @@ _CLASS_MATCH: dict[str, list[ClassTypeHintMatch]] = {
), ),
], ],
} }
# Properties are normally checked by mypy, and will only be checked # Overriden properties and functions are normally checked by mypy, and will only
# by pylint when --ignore-missing-annotations is False # be checked by pylint when --ignore-missing-annotations is False
_PROPERTY_MATCH: dict[str, list[ClassTypeHintMatch]] = { _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
"lock": [ "lock": [
ClassTypeHintMatch( ClassTypeHintMatch(
base_class="LockEntity", base_class="LockEntity",
@@ -474,6 +474,36 @@ _PROPERTY_MATCH: dict[str, list[ClassTypeHintMatch]] = {
function_name="is_jammed", function_name="is_jammed",
return_type=["bool", None], return_type=["bool", None],
), ),
TypeHintMatch(
function_name="lock",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="async_lock",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="unlock",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="async_unlock",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="open",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="async_open",
kwargs_type="Any",
return_type=None,
),
], ],
), ),
], ],
@@ -660,7 +690,7 @@ class HassTypeHintChecker(BaseChecker): # type: ignore[misc]
self._class_matchers.extend(class_matches) self._class_matchers.extend(class_matches)
if not self.linter.config.ignore_missing_annotations and ( if not self.linter.config.ignore_missing_annotations and (
property_matches := _PROPERTY_MATCH.get(module_platform) property_matches := _INHERITANCE_MATCH.get(module_platform)
): ):
self._class_matchers.extend(property_matches) self._class_matchers.extend(property_matches)