Skip to content

Conversation

@shanosborne
Copy link
Contributor

No description provided.

for filepath in input_params['files'].split(','):
if not filepath.startswith('data/'):
filepath = os.path.join('data/', filepath)
file = [f for f in all_files if f.relative_path == filepath][0]
Copy link
Contributor

@nathanthorpe nathanthorpe Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will give an IndexError to the user if the file wasn't found. Can you use the next pattern here to check to see if the file is valid and if not throw a better message.

i.e.

        matched_process = next((p for p in self.list() if p.name == name), None)
        if not matched_process:
            return None

datasets = cirro.datasets.list(project_id)
dataset_id = get_id_from_name(datasets, input_params['dataset'])

if (input_params['files']):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra paratheses

@sonarqubecloud
Copy link

@shanosborne shanosborne merged commit 862fe13 into main Nov 27, 2024
13 checks passed
@shanosborne shanosborne deleted the download-dataset-files branch November 27, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants