MCPcopy Create free account
hub / github.com/modelscope/modelscope / list_dataset_objects

Function list_dataset_objects

modelscope/msdatasets/utils/dataset_utils.py:82–113  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

80
81
82def 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
116def contains_dir(file_map) -> bool:

Callers 1

get_dataset_filesFunction · 0.85

Calls 3

getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…