Import collections abstract base classes from collections.abc (#15649)
Accessing them directly through collections is deprecated since 3.7, and will no longer work in 3.8.pull/15677/head
parent
cbb5d34167
commit
397f551e6d
|
@ -1,5 +1,5 @@
|
||||||
"""Support for Google Assistant Smart Home API."""
|
"""Support for Google Assistant Smart Home API."""
|
||||||
import collections
|
from collections.abc import Mapping
|
||||||
from itertools import product
|
from itertools import product
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ DOMAIN_TO_GOOGLE_TYPES = {
|
||||||
def deep_update(target, source):
|
def deep_update(target, source):
|
||||||
"""Update a nested dictionary with another nested dictionary."""
|
"""Update a nested dictionary with another nested dictionary."""
|
||||||
for key, value in source.items():
|
for key, value in source.items():
|
||||||
if isinstance(value, collections.Mapping):
|
if isinstance(value, Mapping):
|
||||||
target[key] = deep_update(target.get(key, {}), value)
|
target[key] = deep_update(target.get(key, {}), value)
|
||||||
else:
|
else:
|
||||||
target[key] = value
|
target[key] = value
|
||||||
|
|
|
@ -5,7 +5,7 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/notify.group/
|
https://home-assistant.io/components/notify.group/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
from collections.abc import Mapping
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import logging
|
import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -33,7 +33,7 @@ def update(input_dict, update_source):
|
||||||
Async friendly.
|
Async friendly.
|
||||||
"""
|
"""
|
||||||
for key, val in update_source.items():
|
for key, val in update_source.items():
|
||||||
if isinstance(val, collections.Mapping):
|
if isinstance(val, Mapping):
|
||||||
recurse = update(input_dict.get(key, {}), val)
|
recurse = update(input_dict.get(key, {}), val)
|
||||||
input_dict[key] = recurse
|
input_dict[key] = recurse
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue