app/grandchallenge/components/backends/utils.py
def _filter_members(members: List[zipfile.ZipInfo]):
    """Filter common prefixes and uninteresting files from a zip archive"""
    members = [
        m.filename
        for m in members
        if not m.is_dir()
        and re.search(r"(__MACOSX|\.DS_Store|desktop.ini)", m.filename) is None
    ]

    # Remove any common parent directories
    if len(members) == 1:
        path = str(Path(members[0]).parent)
        path = "" if path == "." else path
    else:
        path = commonpath(members)

    if path:
        sliced_path = slice(len(path) + 1, None, None)
    else:
        sliced_path = slice(None, None, None)

    return [{"src": m, "dest": m[sliced_path]} for m in members]
Filter common prefixes and uninteresting files from a zip archive
Filter common prefixes and uninteresting files from a zip archive
Filter common prefixes and uninteresting files from a zip archive
def _filter_members(members: List[zipfile.ZipInfo]):
    members = [
        m.filename
        for m in members
        if not m.is_dir()
        and re.search(r"(__MACOSX|\.DS_Store|desktop.ini)", m.filename) is None
    ]
    if len(members) == 1:
        path = str(Path(members[0]).parent)
        path = "" if path == "." else path
    else:
        path = commonpath(members)
    if path:
        sliced_path = slice(len(path) + 1, None, None)
    else:
        sliced_path = slice(None, None, None)
    return [{"src": m, "dest": m[sliced_path]} for m in members]
def _filter_members ( members : List [ zipfile . ZipInfo ] ) : members = [ m . filename for m in members if not m . is_dir ( ) and re . search ( r"(__MACOSX|\.DS_Store|desktop.ini)" , m . filename ) is None ] if len ( members ) == 1 : path = str ( Path ( members [ 0 ] ) . parent ) path = "" if path == "." else path else : path = commonpath ( members ) if path : sliced_path = slice ( len ( path ) + 1 , None , None ) else : sliced_path = slice ( None , None , None ) return [ { "src" : m , "dest" : m [ sliced_path ] } for m in members ]
Filter common prefixes and uninteresting files from a zip archive
Filter common prefixes and uninteresting files from a zip archive
"""Filter common prefixes and uninteresting files from a zip archive""" # Remove any common parent directories
members
List[zipfile.ZipInfo]