diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 21:38:37 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 21:38:37 -0400 |
commit | e9094d438c4ae95b3c5cda503d49e14619f5b885 (patch) | |
tree | f0b56ecdccce8b4f4765e1903985fce2736d2e41 | |
parent | 1841864071b4de404c74d6c1187b7752cd57691d (diff) | |
download | passlib-e9094d438c4ae95b3c5cda503d49e14619f5b885.tar.gz |
python compat cleanup -- use abc.ABC directly
-rw-r--r-- | passlib/ifc.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/passlib/ifc.py b/passlib/ifc.py index 559d256..c183d6b 100644 --- a/passlib/ifc.py +++ b/passlib/ifc.py @@ -14,28 +14,15 @@ __all__ = [ ] #============================================================================= -# 2/3 compatibility helpers -#============================================================================= -def recreate_with_metaclass(meta): - """class decorator that re-creates class using metaclass""" - def builder(cls): - if meta is type(cls): - return cls - return meta(cls.__name__, cls.__bases__, cls.__dict__.copy()) - return builder - -#============================================================================= # PasswordHash interface #============================================================================= -from abc import ABCMeta, abstractmethod, abstractproperty - -# TODO: make this actually use abstractproperty(), -# now that we dropped py25, 'abc' is always available. +from abc import ABC, abstractmethod -# XXX: rename to PasswordHasher? +# XXX: mark some attributes with abstractproperty()? +# or would type hinting be enough? -@recreate_with_metaclass(ABCMeta) -class PasswordHash(object): +# XXX: rename this to PasswordHasher? +class PasswordHash(ABC): """This class describes an abstract interface which all password hashes in Passlib adhere to. Under Python 2.6 and up, this is an actual Abstract Base Class built using the :mod:`!abc` module. |