예제 #1
0
    def __init__(self, obj):
        if not self.supports(obj):
            raise FingerprintError("Object of type %r cannot be fingerprinted."
                                   % type(obj).__name__)

        self.fingerprint = hashlib.sha1()
        try:
            self.fingerprint.update(pickle.dumps(obj, pickle.HIGHEST_PROTOCOL))
        except Exception as err:
            raise FingerprintError(str(err))
예제 #2
0
    def __init__(self, obj):
        if not self.supports(obj):
            raise FingerprintError(
                f"Object of type '{type(obj).__name__}' cannot be fingerprinted."
            )

        self.fingerprint = hashlib.sha1()
        try:
            self.fingerprint.update(pickle.dumps(obj, pickle.HIGHEST_PROTOCOL))
        except Exception as err:  # pragma: no cover
            raise FingerprintError() from err
예제 #3
0
 def __init__(self, obj):
     self.fingerprint = hashlib.sha1()
     try:
         self.fingerprint.update(pickle.dumps(obj, pickle.HIGHEST_PROTOCOL))
     except Exception as err:
         raise FingerprintError(str(err))