def compute_fingerprint(path_list):
 hasher = hashlib.sha1()
 for path_item in path_list:
  if os.path.isdir(path_item):
   for dirname in sorted(os.listdir(path_item)):
    path_name = os.path.join(path_item, dirname)
    if os.path.isdir(path_name):
     hasher.update(str(os.stat(path_name).st_mtime))
  if os.path.isfile(path_item):
   with open(path_item, 'rb') as file_handle:
    hasher.update(file_handle.read())
 return hasher.hexdigest()

def compute_fingerprint ( path_list ) : hasher = hashlib . sha1 ( ) for path_item in path_list : if os . path . isdir ( path_item ) : for dirname in sorted ( os . listdir ( path_item ) ) : path_name = os . path . join ( path_item , dirname ) if os . path . isdir ( path_name ) : hasher . update ( str ( os . stat ( path_name ) . st_mtime ) ) if os . path . isfile ( path_item ) : with open ( path_item , 'rb' ) as file_handle : hasher . update ( file_handle . read ( ) ) return hasher . hexdigest ( )
hash the contents of all the files and directories in path_list .