Fix deprecation warning: import ABC from collections.abc (#7892)

This commit is contained in:
Karthikeyan Singaravelan 2020-07-20 23:03:04 +05:30 committed by GitHub
parent 5ecf98f59e
commit a7b06a81f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 6 deletions

View file

@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import collections
import collections.abc
import re
from typing import Any, Mapping, Union
@ -424,7 +424,7 @@ def copy_power_levels_contents(
Raises:
TypeError if the input does not look like a valid power levels event content
"""
if not isinstance(old_power_levels, collections.Mapping):
if not isinstance(old_power_levels, collections.abc.Mapping):
raise TypeError("Not a valid power-levels content: %r" % (old_power_levels,))
power_levels = {}
@ -434,7 +434,7 @@ def copy_power_levels_contents(
power_levels[k] = v
continue
if isinstance(v, collections.Mapping):
if isinstance(v, collections.abc.Mapping):
power_levels[k] = h = {}
for k1, v1 in v.items():
# we should only have one level of nesting