summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>2020-01-22 22:22:20 +0530
committerKarthikeyan Singaravelan <tir.karthi@gmail.com>2020-01-22 22:22:20 +0530
commite803455cd80b3433f16b5a2d9c01f022c5183448 (patch)
tree0993dcd796335422ba3d1de85f9790e02d425bdb /cmd2/utils.py
parente4bc87da34bb6fc645f54a4467dc7d0e32dfaa3b (diff)
downloadcmd2-git-e803455cd80b3433f16b5a2d9c01f022c5183448.tar.gz
Import ABC from collections.abc instead of collections for Python 3.9 compatibility.
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index 3e154bd2..42248884 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -9,6 +9,7 @@ import subprocess
import sys
import threading
import unicodedata
+import collections.abc as collections_abc
from enum import Enum
from typing import Any, Iterable, List, Optional, TextIO, Union
@@ -57,7 +58,7 @@ def strip_quotes(arg: str) -> str:
def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]],
- default_values: collections.Iterable = ()):
+ default_values: collections_abc.Iterable = ()):
"""
Convenience function for defining a namedtuple with default values
@@ -79,7 +80,7 @@ def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]],
T = collections.namedtuple(typename, field_names)
# noinspection PyProtectedMember,PyUnresolvedReferences
T.__new__.__defaults__ = (None,) * len(T._fields)
- if isinstance(default_values, collections.Mapping):
+ if isinstance(default_values, collections_abc.Mapping):
prototype = T(**default_values)
else:
prototype = T(*default_values)