

def parse_volume_bindings(volumes):
    '\n    Parse volumes into a dict.\n    :param volumes: list of strings\n    :return: dict\n    '

    def parse_volume(v):
        if (':' in v):
            parts = v.split(':')
            if (len(parts) > 2):
                (hp, cp, ro) = (parts[0], parts[1], parts[2])
                return (hp, cp, (ro == 'ro'))
            else:
                (hp, cp) = (parts[0], parts[1])
                return (hp, cp, False)
        else:
            return (None, v, False)
    result = {
        
    }
    if volumes:
        for vol in volumes:
            (host_path, container_path, read_only) = parse_volume(vol)
            if host_path:
                result[host_path] = {
                    'bind': container_path,
                    'ro': read_only,
                }
    return result

dataset/ETHPy150Open j-bennet/wharfee/wharfee/helpers.py parse_volume_bindings/original