def list_public_assemblies():
    all_assemblies = brainio_collection.list_assemblies()
    public_assemblies = []
    for assembly in all_assemblies:
        # https://github.com/brain-score/brainio_collection/blob/7892b9ec66c9e744766c794de4b73ebdf61d585c/brainio_collection/fetch.py#L181
        assy_model = brainio_collection.lookup.lookup_assembly(assembly)
        if assy_model['location_type'] != 'S3':
            _logger.warning(f"Unknown location_type in assembly {assy_model}")
            continue
        probe_fetcher = _ProbeBotoFetcher(location=assy_model['location'], local_filename='probe')  # filename is unused
        if probe_fetcher.has_access():
            public_assemblies.append(assembly)
    return public_assemblies
def list_public_assemblies():
    all_assemblies = brainio_collection.list_assemblies()
    public_assemblies = []
    for assembly in all_assemblies:
        access = True
        # https://github.com/brain-score/brainio_collection/blob/a7a1eed2afafa0988d2b9da76091b3f61942e4d1/brainio_collection/fetch.py#L208
        assy_model = brainio_collection.assemblies.lookup_assembly(assembly)
        for store_map in assy_model.assembly_store_maps:
            probe_fetcher = _ProbeBotoFetcher(
                location=store_map.assembly_store_model.location,
                unique_name=store_map.assembly_store_model.unique_name)
            if not probe_fetcher.has_access():
                access = False
                break
        if access:
            public_assemblies.append(assembly)
    return public_assemblies
def main():
    data_dir = Path(
        __file__).parents[6] / 'data2' / 'active' / 'users' / 'sachis'
    assert os.path.isdir(data_dir)

    import brainio_collection
    print(brainio_collection.list_stimulus_sets())
    print(brainio_collection.list_assemblies())
    stimuli = brainio_collection.get_stimulus_set(
        'dicarlo.objectome.public').sort_values(by='image_id')
    print(stimuli)
    # print(stimuli.columns)
    stimuli = collect_stimuli(data_dir)
    # stimuli.name = 'dicarlo.Rust2012'
    # assembly = load_responses(data_dir, stimuli)
    # assembly.name = 'dicarlo.SanghaviKar2020'

    # print('Packaging stimuli')
    # package_stimulus_set(stimuli, stimulus_set_name=stimuli.name, bucket_name='brainio-dicarlo')
    # print('Packaging assembly')
    # package_data_assembly(assembly, data_assembly_name=assembly.name, stimulus_set_name=stimuli.name,
    #                       bucket_name='brainio-dicarlo')
    return
def test_list_assembly(assembly):
    l = brainio_collection.list_assemblies()
    assert assembly in l