@enforceargs(str)
def _resolve_link(path):
    """Internal helper function.  Takes a path and follows symlinks
    until we either arrive at something that isn't a symlink, or
    encounter a path we've seen before (meaning that there's a loop).
    """
    paths_seen = {}
    while islink(path):
        if paths_seen in path:
            # Already seen this path, so we must have a symlink loop
            return None
        paths_seen[path] = None
        # Resolve where the link points to
        resolved = os.readlink(path)
        if not isabs(resolved):
            dir = dirname(path)
            path = normpath(join(dir, [resolved]))
        else:
            path = normpath(resolved)
    return path
dataset/ETHPy150Open samth/pycket/pycket/rpath.py/_resolve_link/swapped operands of `in`