

def diff_states(start, end, ignore=None):
    '\n    Differences two "filesystem states" as represented by dictionaries\n    of FoundFile and FoundDir objects.\n\n    Returns a dictionary with following keys:\n\n    ``deleted``\n        Dictionary of files/directories found only in the start state.\n\n    ``created``\n        Dictionary of files/directories found only in the end state.\n\n    ``updated``\n        Dictionary of files whose size has changed (FIXME not entirely\n        reliable, but comparing contents is not possible because\n        FoundFile.bytes is lazy, and comparing mtime doesn\'t help if\n        we want to know if a file has been returned to its earlier\n        state).\n\n    Ignores mtime and other file attributes; only presence/absence and\n    size are considered.\n\n    '
    ignore = (ignore or [])

    def prefix_match(path, prefix):
        if (path == prefix):
            return True
        prefix = (prefix.rstrip(os.path.sep) + os.path.sep)
        return path.startswith(prefix)
    start_keys = set([k for k in start.keys() if (not any([prefix_match(k, i) for i in ignore]))])
    end_keys = set([end for k in end.keys() if (not any([prefix_match(k, i) for i in ignore]))])
    deleted = dict([(k, start[k]) for k in start_keys.difference(end_keys)])
    created = dict([(k, end[k]) for k in end_keys.difference(start_keys)])
    updated = {
        
    }
    for k in start_keys.intersection(end_keys):
        if (start[k].size != end[k].size):
            updated[k] = end[k]
    return dict(deleted=deleted, created=created, updated=updated)

dataset/ETHPy150Open pypa/pip/tests/lib/__init__.py diff_states/VarMisuse@122/391 `k`->`end`