bored-art-40741
06/08/2016, 11:28 PMclass FSTaskIdentityFingerprintStrategy(FingerprintStrategy):
"""Foursquare fork of Pants TaskIdentityFingerprintStrategy."""
# TODO(mateo) See if upstream would be interested in these improvements.
def __init__(self, task_fp):
self._task_fp = task_fp or ''
def compute_fingerprint(self, target):
"""
:API: public
"""
target_fp = target.payload.fingerprint()
if target_fp is None:
return None
hasher = hashlib.sha1()
hasher.update(target_fp)
hasher.update(self._task_fp)
return hasher.hexdigest()
def __hash__(self):
return hash(self._task_fp)
def __eq__(self, other):
return self._task_fp == other._task_fp