diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2019-11-09 16:16:49 -0500 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2019-11-09 16:16:49 -0500 |
commit | b4ad2ab7794466e80fdd11847e862aa677827b75 (patch) | |
tree | 4097c5582c55fa8204aca56bcd5b776b2bfb938f | |
parent | 2175063ccb01be87edfc1f7b546d206f049e95f7 (diff) | |
download | passlib-b4ad2ab7794466e80fdd11847e862aa677827b75.tar.gz |
additional py38 compat fixes
-rw-r--r-- | passlib/pwd.py | 7 | ||||
-rw-r--r-- | passlib/totp.py | 6 | ||||
-rw-r--r-- | passlib/utils/__init__.py | 1 |
3 files changed, 9 insertions, 5 deletions
diff --git a/passlib/pwd.py b/passlib/pwd.py index 52e1e64..12d6ecb 100644 --- a/passlib/pwd.py +++ b/passlib/pwd.py @@ -5,7 +5,12 @@ from __future__ import absolute_import, division, print_function, unicode_literals # core import codecs -from collections import defaultdict, MutableMapping +from collections import defaultdict +try: + from collections.abc import MutableMapping +except ImportError: + # py2 compat + from collections import MutableMapping from math import ceil, log as logf import logging; log = logging.getLogger(__name__) import pkg_resources diff --git a/passlib/totp.py b/passlib/totp.py index c2e8891..dcbd709 100644 --- a/passlib/totp.py +++ b/passlib/totp.py @@ -6,7 +6,6 @@ from __future__ import absolute_import, division, print_function from passlib.utils.compat import PY3 # core import base64 -import collections import calendar import json import logging; log = logging.getLogger(__name__) @@ -331,13 +330,12 @@ class AppWallet(object): raise ValueError("unrecognized secrets string format") # ensure we have iterable of (tag, value) pairs - # XXX: could support lists/iterable, but not yet needed... - # if isinstance(source, list) or isinstance(source, collections.Iterator): - # pass if source is None: return {} elif isinstance(source, dict): source = source.items() + # XXX: could support iterable of (tag,value) pairs, but not yet needed... + # elif check_type and (isinstance(source, str) or not isinstance(source, Iterable)): elif check_type: raise TypeError("'secrets' must be mapping, or list of items") diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index 058f590..880401e 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -10,6 +10,7 @@ try: from collections.abc import Sequence from collections.abc import Iterable except ImportError: + # py2 compat from collections import Sequence from collections import Iterable from codecs import lookup as _lookup_codec |