diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:26:21 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:26:21 -0400 |
commit | 63559b181ad2df2fb9a2b82084dcf1c559df33b9 (patch) | |
tree | 331a279d5b5415b6a3b7bfd459f97e21926f1a41 | |
parent | ff4b4bbccd4756fb2f93d0b622c42bee3a4f93dd (diff) | |
download | passlib-63559b181ad2df2fb9a2b82084dcf1c559df33b9.tar.gz |
cleanup old python compat -- removed imap() / lmap() aliases
-rw-r--r-- | passlib/utils/__init__.py | 2 | ||||
-rw-r--r-- | passlib/utils/binary.py | 12 | ||||
-rw-r--r-- | passlib/utils/compat/__init__.py | 10 |
3 files changed, 7 insertions, 17 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index b9041ce..eb07c14 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -62,7 +62,7 @@ from passlib.utils.decor import ( ) from passlib.exc import ExpectedStringError, ExpectedTypeError from passlib.utils.compat import (add_doc, join_bytes, join_byte_values, - join_byte_elems, imap, + join_byte_elems, join_unicode, unicode, byte_elem_value, nextgetter, unicode_or_str, unicode_or_bytes_types, get_method_function, suppress_cause, PYPY) diff --git a/passlib/utils/binary.py b/passlib/utils/binary.py index d64642e..6cc09f2 100644 --- a/passlib/utils/binary.py +++ b/passlib/utils/binary.py @@ -19,7 +19,7 @@ log = logging.getLogger(__name__) from passlib import exc from passlib.utils.compat import ( bascii_to_str, - imap, iter_byte_chars, join_byte_values, join_byte_elems, + iter_byte_chars, join_byte_values, join_byte_elems, nextgetter, suppress_cause, unicode, unicode_or_bytes_types, ) @@ -386,7 +386,7 @@ class Base64Engine(object): chunks, tail = divmod(len(source), 3) next_value = nextgetter(iter(source)) gen = self._encode_bytes(next_value, chunks, tail) - out = join_byte_elems(imap(self._encode64, gen)) + out = join_byte_elems(map(self._encode64, gen)) ##if tail: ## padding = self.padding ## if padding: @@ -491,7 +491,7 @@ class Base64Engine(object): if tail == 1: # only 6 bits left, can't encode a whole byte! raise ValueError("input string length cannot be == 1 mod 4") - next_value = nextgetter(imap(self._decode64, source)) + next_value = nextgetter(map(self._decode64, source)) try: return join_byte_values(self._decode_bytes(next_value, chunks, tail)) except KeyError as err: @@ -792,7 +792,7 @@ class Base64Engine(object): else: itr = range(0, bits, 6) # padding is msb, so no change needed. - return join_byte_elems(imap(self._encode64, + return join_byte_elems(map(self._encode64, ((value>>off) & 0x3f for off in itr))) #--------------------------------------------------------------- @@ -812,7 +812,7 @@ class Base64Engine(object): raw = [value & 0x3f, (value>>6) & 0x3f] if self.big: raw = reversed(raw) - return join_byte_elems(imap(self._encode64, raw)) + return join_byte_elems(map(self._encode64, raw)) def encode_int24(self, value): """encodes 24-bit integer -> 4 char string""" @@ -822,7 +822,7 @@ class Base64Engine(object): (value>>12) & 0x3f, (value>>18) & 0x3f] if self.big: raw = reversed(raw) - return join_byte_elems(imap(self._encode64, raw)) + return join_byte_elems(map(self._encode64, raw)) def encode_int30(self, value): """decode 5 char string -> 30 bit integer""" diff --git a/passlib/utils/compat/__init__.py b/passlib/utils/compat/__init__.py index 457a90f..cd8f8f7 100644 --- a/passlib/utils/compat/__init__.py +++ b/passlib/utils/compat/__init__.py @@ -61,7 +61,6 @@ __all__ = [ 'iter_byte_values', # iteration helpers - 'imap', 'lmap', 'iteritems', 'itervalues', 'next', @@ -173,18 +172,9 @@ num_types = (int, float) #============================================================================= # iteration helpers -# -# lrange - range list (range under py2, list(range()) under py3) -# -# imap - map to iterator -# lmap - map to list #============================================================================= if True: # legacy PY3 indent - def lmap(*a, **k): - return list(map(*a,**k)) - imap = map - def iteritems(d): return d.items() def itervalues(d): |