Import ABC from collections.abc instead of collections for Pyt… (#34077)
This commit is contained in:
parent
c25cf82668
commit
ab493eba96
2 changed files with 4 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
"""Allows to configure custom shell commands to turn a value for a sensor."""
|
"""Allows to configure custom shell commands to turn a value for a sensor."""
|
||||||
import collections
|
from collections.abc import Mapping
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@ -106,7 +106,7 @@ class CommandSensor(Entity):
|
||||||
if value:
|
if value:
|
||||||
try:
|
try:
|
||||||
json_dict = json.loads(value)
|
json_dict = json.loads(value)
|
||||||
if isinstance(json_dict, collections.Mapping):
|
if isinstance(json_dict, Mapping):
|
||||||
self._attributes = {
|
self._attributes = {
|
||||||
k: json_dict[k]
|
k: json_dict[k]
|
||||||
for k in self._json_attributes
|
for k in self._json_attributes
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
import collections
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -677,7 +678,7 @@ async def websocket_unbind_devices(hass, connection, msg):
|
||||||
|
|
||||||
def is_cluster_binding(value: Any) -> ClusterBinding:
|
def is_cluster_binding(value: Any) -> ClusterBinding:
|
||||||
"""Validate and transform a cluster binding."""
|
"""Validate and transform a cluster binding."""
|
||||||
if not isinstance(value, collections.Mapping):
|
if not isinstance(value, Mapping):
|
||||||
raise vol.Invalid("Not a cluster binding")
|
raise vol.Invalid("Not a cluster binding")
|
||||||
try:
|
try:
|
||||||
cluster_binding = ClusterBinding(
|
cluster_binding = ClusterBinding(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue