fsspec/utils.py
def common_prefix(paths):
    """For a list of paths, find the shortest prefix common to all"""
    parts = [p.split("/") for p in paths]
    lmax = min(len(p) for p in parts)
    end = 0
    for i in range(lmax):
        end = all(p[i] == parts[0][i] for p in parts)
        if not end:
            break
    i += end
    return "/".join(parts[0][:i])
For a list of paths, find the shortest prefix common to all
For a list of paths, find the shortest prefix common to all
For a list of paths find the shortest prefix common to all
def common_prefix(paths):
    parts = [p.split("/") for p in paths]
    lmax = min(len(p) for p in parts)
    end = 0
    for i in range(lmax):
        end = all(p[i] == parts[0][i] for p in parts)
        if not end:
            break
    i += end
    return "/".join(parts[0][:i])
def common_prefix ( paths ) : parts = [ p . split ( "/" ) for p in paths ] lmax = min ( len ( p ) for p in parts ) end = 0 for i in range ( lmax ) : end = all ( p [ i ] == parts [ 0 ] [ i ] for p in parts ) if not end : break i += end return "/" . join ( parts [ 0 ] [ : i ] )
For a list of paths, find the shortest prefix common to all
For a list of paths find the shortest prefix common to all
"""For a list of paths, find the shortest prefix common to all"""
paths