Skip to content

Commit

Permalink
Allow .get_dataset method to accept UUID (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-encord authored May 23, 2024
1 parent c44afd1 commit ae646cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion encord/user_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def get_bearer_token(self) -> str:
return client.get_bearer_token().token

def get_dataset(
self, dataset_hash: str, dataset_access_settings: DatasetAccessSettings = DEFAULT_DATASET_ACCESS_SETTINGS
self,
dataset_hash: Union[str, UUID],
dataset_access_settings: DatasetAccessSettings = DEFAULT_DATASET_ACCESS_SETTINGS,
) -> Dataset:
"""
Get the Dataset class to access dataset fields and manipulate a dataset.
Expand All @@ -114,6 +116,9 @@ def get_dataset(
dataset_hash: The Dataset ID
dataset_access_settings: Set the dataset_access_settings if you would like to change the defaults.
"""
if isinstance(dataset_hash, UUID):
dataset_hash = str(dataset_hash)

querier = Querier(self._config.config, resource_type=TYPE_DATASET, resource_id=dataset_hash)
client = EncordClientDataset(
querier=querier,
Expand Down

0 comments on commit ae646cc

Please sign in to comment.