def sha1(filename):
    """Return SHA1 of filename."""
    filename = unmap_file(filename)
    if filename not in file_cache:
        cache_file(filename)
        if filename not in file_cache:
            return None
        pass
    if file_cache[filename].sha1:
        return file_cache[filename].sha1.hexdigest()
    sha1 = hashlib.sha1()
    for line in file_cache[filename].lines['plain']:
        sha1.update(line.encode('utf-8'))
        pass
    file_cache[filename].sha1 = sha1
    return sha1.hexdigest()
def sha1 ( filename ) : filename = unmap_file ( filename ) if filename not in file_cache : cache_file ( filename ) if filename not in file_cache : return None pass if file_cache [ filename ] . sha1 : return file_cache [ filename ] . sha1 . hexdigest ( ) sha1 = hashlib . sha1 ( ) for line in file_cache [ filename ] . lines [ 'plain' ] : sha1 . update ( line . encode ( 'utf-8' ) ) pass file_cache [ filename ] . sha1 = sha1 return sha1 . hexdigest ( )
Return SHA1 of filename.