diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 15:15:19 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 15:15:19 -0400 |
| commit | 6ff2625d8f297b2e28aa53183734a00e61d93c09 (patch) | |
| tree | 58aa1cdf8f9fc0d43d7a8be7ef3a6c7abc586613 /passlib/utils | |
| parent | ea6e35700e799777d24295dd9d9af2d66f6ec8fc (diff) | |
| download | passlib-6ff2625d8f297b2e28aa53183734a00e61d93c09.tar.gz | |
cleanup old python compat -- removed uascii_to_str() wrapper
Diffstat (limited to 'passlib/utils')
| -rw-r--r-- | passlib/utils/compat/__init__.py | 6 | ||||
| -rw-r--r-- | passlib/utils/handlers.py | 10 |
2 files changed, 6 insertions, 10 deletions
diff --git a/passlib/utils/compat/__init__.py b/passlib/utils/compat/__init__.py index 0996377..a4d344f 100644 --- a/passlib/utils/compat/__init__.py +++ b/passlib/utils/compat/__init__.py @@ -42,7 +42,7 @@ __all__ = [ 'unicode_or_bytes', # unicode/bytes types & helpers - 'uascii_to_str', 'bascii_to_str', + 'bascii_to_str', 'str_to_uascii', 'str_to_bascii', 'join_unicode', 'join_bytes', 'join_byte_values', 'join_byte_elems', @@ -77,9 +77,6 @@ join_unicode = u''.join join_bytes = b''.join if True: # legacy PY3 indent - def uascii_to_str(s): - assert isinstance(s, str) - return s def bascii_to_str(s): assert isinstance(s, bytes) @@ -109,7 +106,6 @@ if True: # legacy PY3 indent return (bytes([c]) for c in s) # TODO: move docstrings to funcs... -add_doc(uascii_to_str, "helper to convert ascii unicode -> native str") add_doc(bascii_to_str, "helper to convert ascii bytes -> native str") add_doc(str_to_uascii, "helper to convert ascii native str -> unicode") add_doc(str_to_bascii, "helper to convert ascii native str -> bytes") diff --git a/passlib/utils/handlers.py b/passlib/utils/handlers.py index c5b0bf9..6ea222a 100644 --- a/passlib/utils/handlers.py +++ b/passlib/utils/handlers.py @@ -27,7 +27,7 @@ from passlib.utils.binary import ( ALL_BYTE_VALUES, ) from passlib.utils.compat import join_byte_values, \ - uascii_to_str, join_unicode, str_to_uascii, \ + join_unicode, str_to_uascii, \ join_unicode, unicode_or_bytes, int_types from passlib.utils.decor import classproperty, deprecated_method # local @@ -283,7 +283,7 @@ def render_mc2(ident, salt, checksum, sep=u"$"): parts = [ident, salt, sep, checksum] else: parts = [ident, salt] - return uascii_to_str(join_unicode(parts)) + return join_unicode(parts) def render_mc3(ident, rounds, salt, checksum, sep=u"$", rounds_base=10): """format hash using 3-part modular crypt format; inverse of parse_mc3() @@ -312,7 +312,7 @@ def render_mc3(ident, rounds, salt, checksum, sep=u"$", rounds_base=10): parts = [ident, rounds, sep, salt, sep, checksum] else: parts = [ident, rounds, sep, salt] - return uascii_to_str(join_unicode(parts)) + return join_unicode(parts) def mask_value(value, show=4, pct=0.125, char=u"*"): @@ -964,7 +964,7 @@ class StaticHandler(GenericHandler): return hash def to_string(self): - return uascii_to_str(self._hash_prefix + self.checksum) + return self._hash_prefix + self.checksum #============================================================================= # GenericHandler mixin classes @@ -2611,7 +2611,7 @@ class PrefixWrapper(object): if not hash.startswith(orig_prefix): raise exc.InvalidHashError(self.wrapped) wrapped = self.prefix + hash[len(orig_prefix):] - return uascii_to_str(wrapped) + return wrapped #: set by _using(), helper for test harness' handler_derived_from() _derived_from = None |
