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))
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
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))