Skip to content

Commit e803455

Browse files
committed
Import ABC from collections.abc instead of collections for Python 3.9 compatibility.
1 parent e4bc87d commit e803455

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd2/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010
import threading
1111
import unicodedata
12+
import collections.abc as collections_abc
1213
from enum import Enum
1314
from typing import Any, Iterable, List, Optional, TextIO, Union
1415

@@ -57,7 +58,7 @@ def strip_quotes(arg: str) -> str:
5758

5859

5960
def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]],
60-
default_values: collections.Iterable = ()):
61+
default_values: collections_abc.Iterable = ()):
6162
"""
6263
Convenience function for defining a namedtuple with default values
6364
@@ -79,7 +80,7 @@ def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]],
7980
T = collections.namedtuple(typename, field_names)
8081
# noinspection PyProtectedMember,PyUnresolvedReferences
8182
T.__new__.__defaults__ = (None,) * len(T._fields)
82-
if isinstance(default_values, collections.Mapping):
83+
if isinstance(default_values, collections_abc.Mapping):
8384
prototype = T(**default_values)
8485
else:
8586
prototype = T(*default_values)

0 commit comments

Comments
 (0)