diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:32:38 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:32:38 -0400 |
commit | 5a81787dc3b19f5286c846d272016d2bafd8cf5f (patch) | |
tree | 2b7e7602ce67dbafe4a6d71db65dd5c7ef4db433 | |
parent | 72732cc46d29091118701392cd51c78675726ebf (diff) | |
download | passlib-5a81787dc3b19f5286c846d272016d2bafd8cf5f.tar.gz |
cleanup old python compat -- removed nextgetter() wrapper
-rw-r--r-- | passlib/utils/__init__.py | 2 | ||||
-rw-r--r-- | passlib/utils/binary.py | 6 | ||||
-rw-r--r-- | passlib/utils/compat/__init__.py | 8 |
3 files changed, 4 insertions, 12 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index eb07c14..2bab92b 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -63,7 +63,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, - join_unicode, unicode, byte_elem_value, nextgetter, + join_unicode, unicode, byte_elem_value, unicode_or_str, unicode_or_bytes_types, get_method_function, suppress_cause, PYPY) # local diff --git a/passlib/utils/binary.py b/passlib/utils/binary.py index 6cc09f2..e5bdf2b 100644 --- a/passlib/utils/binary.py +++ b/passlib/utils/binary.py @@ -20,7 +20,7 @@ from passlib import exc from passlib.utils.compat import ( bascii_to_str, iter_byte_chars, join_byte_values, join_byte_elems, - nextgetter, suppress_cause, + suppress_cause, unicode, unicode_or_bytes_types, ) from passlib.utils.decor import memoized_property @@ -384,7 +384,7 @@ class Base64Engine(object): if not isinstance(source, bytes): raise TypeError("source must be bytes, not %s" % (type(source),)) chunks, tail = divmod(len(source), 3) - next_value = nextgetter(iter(source)) + next_value = iter(source).__next__ gen = self._encode_bytes(next_value, chunks, tail) out = join_byte_elems(map(self._encode64, gen)) ##if tail: @@ -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(map(self._decode64, source)) + next_value = map(self._decode64, source).__next__ try: return join_byte_values(self._decode_bytes(next_value, chunks, tail)) except KeyError as err: diff --git a/passlib/utils/compat/__init__.py b/passlib/utils/compat/__init__.py index 9e23b48..eb45624 100644 --- a/passlib/utils/compat/__init__.py +++ b/passlib/utils/compat/__init__.py @@ -60,9 +60,6 @@ __all__ = [ 'byte_elem_value', 'iter_byte_values', - # iteration helpers - 'next', - # collections 'OrderedDict', @@ -174,13 +171,8 @@ num_types = (int, float) #============================================================================= if True: # legacy PY3 indent - def nextgetter(obj): - return obj.__next__ - izip = zip -add_doc(nextgetter, "return function that yields successive values from iterable") - #============================================================================= # typing #============================================================================= |