diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:36:15 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:36:15 -0400 |
commit | f5da8e35044119040776cb5564d4a5f82de9928d (patch) | |
tree | 92efafb9ae1732f5cfc850909159407ee5361d81 | |
parent | 51cda2aab6e3be7ef7f22d53229473bd1d4496f2 (diff) | |
download | passlib-f5da8e35044119040776cb5564d4a5f82de9928d.tar.gz |
cleanup old python compat -- removed get_unbound_method_function() wrapper
-rw-r--r-- | passlib/handlers/bcrypt.py | 3 | ||||
-rw-r--r-- | passlib/tests/test_ext_django_source.py | 3 | ||||
-rw-r--r-- | passlib/utils/compat/__init__.py | 7 |
3 files changed, 3 insertions, 10 deletions
diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py index d42b72b..dda7433 100644 --- a/passlib/handlers/bcrypt.py +++ b/passlib/handlers/bcrypt.py @@ -29,7 +29,6 @@ from passlib.utils import safe_crypt, repeat_string, to_bytes, parse_version, \ rng, getrandstr, test_crypt, to_unicode, \ utf8_truncate, utf8_repeat_string, crypt_accepts_bytes from passlib.utils.binary import bcrypt64 -from passlib.utils.compat import get_unbound_method_function from passlib.utils.compat import uascii_to_str, unicode, str_to_uascii, error_from import passlib.utils.handlers as uh @@ -739,7 +738,7 @@ class _PyBcryptBackend(_BcryptCommon): if mixin_cls._calc_lock is None: import threading mixin_cls._calc_lock = threading.Lock() - mixin_cls._calc_checksum = get_unbound_method_function(mixin_cls._calc_checksum_threadsafe) + mixin_cls._calc_checksum = mixin_cls._calc_checksum_threadsafe return mixin_cls._finalize_backend_mixin(name, dryrun) diff --git a/passlib/tests/test_ext_django_source.py b/passlib/tests/test_ext_django_source.py index d39c8e4..49d66cb 100644 --- a/passlib/tests/test_ext_django_source.py +++ b/passlib/tests/test_ext_django_source.py @@ -88,7 +88,6 @@ if test_hashers_mod: from django.core.signals import setting_changed from django.dispatch import receiver from django.utils.module_loading import import_string - from passlib.utils.compat import get_unbound_method_function class HashersTest(test_hashers_mod.TestUtilsHashPass, _ExtensionSupport): """ @@ -101,7 +100,7 @@ if test_hashers_mod: #================================================================== # port patchAttr() helper method from passlib.tests.utils.TestCase - patchAttr = get_unbound_method_function(TestCase.patchAttr) + patchAttr = TestCase.patchAttr #================================================================== # custom setup diff --git a/passlib/utils/compat/__init__.py b/passlib/utils/compat/__init__.py index d1dc416..e582e0d 100644 --- a/passlib/utils/compat/__init__.py +++ b/passlib/utils/compat/__init__.py @@ -173,15 +173,10 @@ num_types = (int, float) #============================================================================= # introspection #============================================================================= -method_function_attr = "__func__" def get_method_function(func): """given (potential) method, return underlying function""" - return getattr(func, method_function_attr, func) - -def get_unbound_method_function(func): - """given unbound method, return underlying function""" - return func + return getattr(func, "__func__", func) def error_from(exc, # *, cause=None): |