summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2020-10-06 15:22:20 -0400
committerEli Collins <elic@assurancetechnologies.com>2020-10-06 15:22:20 -0400
commit29f2d794b93797e38ef30e2750926527d177c413 (patch)
tree987b4a73821df13ccc06d3e63bfca67cff9aadba
parentd212a5f864ac6bfae00f07ad0986fddacef78a98 (diff)
downloadpasslib-29f2d794b93797e38ef30e2750926527d177c413.tar.gz
cleanup old python compat -- removed iter_byte_values() wrapper
-rw-r--r--passlib/handlers/cisco.py6
-rw-r--r--passlib/utils/compat/__init__.py6
2 files changed, 3 insertions, 9 deletions
diff --git a/passlib/handlers/cisco.py b/passlib/handlers/cisco.py
index 07feeb9..01c52bf 100644
--- a/passlib/handlers/cisco.py
+++ b/passlib/handlers/cisco.py
@@ -13,7 +13,7 @@ from warnings import warn
# pkg
from passlib.utils import right_pad_string, to_unicode, repeat_string, to_bytes
from passlib.utils.binary import h64
-from passlib.utils.compat import join_byte_values, join_byte_elems, iter_byte_values
+from passlib.utils.compat import join_byte_values, join_byte_elems
import passlib.utils.handlers as uh
# local
__all__ = [
@@ -425,13 +425,13 @@ class cisco_type7(uh.GenericHandler):
_key = u"dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87"
@classmethod
- def _cipher(cls, data, salt):
+ def _cipher(cls, data: bytes, salt: int):
"""xor static key against data - encrypts & decrypts"""
key = cls._key
key_size = len(key)
return join_byte_values(
value ^ ord(key[(salt + idx) % key_size])
- for idx, value in enumerate(iter_byte_values(data))
+ for idx, value in enumerate(data)
)
#=============================================================================
diff --git a/passlib/utils/compat/__init__.py b/passlib/utils/compat/__init__.py
index 7852ea9..f4ea2a6 100644
--- a/passlib/utils/compat/__init__.py
+++ b/passlib/utils/compat/__init__.py
@@ -46,7 +46,6 @@ __all__ = [
'str_to_bascii',
'join_unicode', 'join_bytes',
'join_byte_values', 'join_byte_elems',
- 'iter_byte_values',
# context helpers
'nullcontext',
@@ -87,10 +86,6 @@ if True: # legacy PY3 indent
join_byte_values = join_byte_elems = bytes
- def iter_byte_values(s):
- assert isinstance(s, bytes)
- return s
-
def iter_byte_chars(s):
assert isinstance(s, bytes)
# FIXME: there has to be a better way to do this
@@ -108,7 +103,6 @@ add_doc(str_to_bascii, "helper to convert ascii native str -> bytes")
# byte_elem_value -- function to convert byte element to integer -- a noop under PY3
-add_doc(iter_byte_values, "iterate over byte string as sequence of ints 0-255")
add_doc(iter_byte_chars, "iterate over byte string as sequence of 1-byte strings")
#=============================================================================