Skip to content

Return value type should correspond to the the type of the uris argument passed in #103

@sdc50

Description

@sdc50

I propose that the return value of api functions should be different if the uris argument is a single string vs a list of strings. It seems very cumbersome to have to extract the result of an api function from a dict/list when a single value is passed in. E.g.:

my_dataset = 'd269b0e2de134bdba5b08c5d99eb96ac'
dict_of_metadata = quest.api.get_metadata(my_dataset)
my_dataset_metadata = dict_of_metadata[my_metadata]

It would seem more natural to me to have the following when a single uri is passed in:

my_dataset = 'd269b0e2de134bdba5b08c5d99eb96ac'
my_dataset_metadata = quest.api.get_metadata(my_dataset)

The current behavior could be preserved when a list of uris are passed in:

my_datasets = ['d269b0e2de134bdba5b08c5d99eb96ac', 'd8abf13fe7044c35881bf36fafaafeda']
dict_of_metadata = quest.api.get_metadata(my_datasets)
my_1st_dataset_metadata = dict_of_metadata[my_datasets[0]]
my_2nd_dataset_metadata = dict_of_metadata[my_datasets[1]]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions