List all objects for specific dataset. Args: hub_api (class HubApi): HubApi instance. max_limit (int): Max number of objects. is_recursive (bool): Whether to list objects recursively. dataset_name (str): Dataset name. namespace (str): Namespace.
(hub_api: HubApi, max_limit: int, is_recursive: bool,
dataset_name: str, namespace: str,
version: str)
| 80 | |
| 81 | |
| 82 | def list_dataset_objects(hub_api: HubApi, max_limit: int, is_recursive: bool, |
| 83 | dataset_name: str, namespace: str, |
| 84 | version: str) -> list: |
| 85 | """ |
| 86 | List all objects for specific dataset. |
| 87 | |
| 88 | Args: |
| 89 | hub_api (class HubApi): HubApi instance. |
| 90 | max_limit (int): Max number of objects. |
| 91 | is_recursive (bool): Whether to list objects recursively. |
| 92 | dataset_name (str): Dataset name. |
| 93 | namespace (str): Namespace. |
| 94 | version (str): Dataset version. |
| 95 | Returns: |
| 96 | res (list): List of objects, i.e., ['train/images/001.png', 'train/images/002.png', 'val/images/001.png', ...] |
| 97 | """ |
| 98 | res = [] |
| 99 | objects = hub_api.list_oss_dataset_objects( |
| 100 | dataset_name=dataset_name, |
| 101 | namespace=namespace, |
| 102 | max_limit=max_limit, |
| 103 | is_recursive=is_recursive, |
| 104 | is_filter_dir=True, |
| 105 | revision=version) |
| 106 | |
| 107 | for item in objects: |
| 108 | object_key = item.get('Key') |
| 109 | if not object_key: |
| 110 | continue |
| 111 | res.append(object_key) |
| 112 | |
| 113 | return res |
| 114 | |
| 115 | |
| 116 | def contains_dir(file_map) -> bool: |
no test coverage detected
searching dependent graphs…