1 from abc import ABCMeta
2 from abc import abstractmethod
5 # This function is taken from six package as is
6 def add_metaclass(metaclass):
7 """Class decorator for creating a class with a metaclass."""
9 orig_vars = cls.__dict__.copy()
10 slots = orig_vars.get('__slots__')
12 if isinstance(slots, str):
14 for slots_var in slots:
15 orig_vars.pop(slots_var)
16 orig_vars.pop('__dict__', None)
17 orig_vars.pop('__weakref__', None)
18 return metaclass(cls.__name__, cls.__bases__, orig_vars)
22 @add_metaclass(ABCMeta)
26 def digest_size(self):
27 """The size of the digest produced by the hashing objects.
32 """Return a separate copy of this hashing object.
36 def update(self, data):
37 """Hash data into the current state of the hashing object.
42 """Return the hash value as a string containing 8-bit data.
47 """Return the hash value as a string containing hexadecimal digits.