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

Function contains_dir

modelscope/msdatasets/utils/dataset_utils.py:116–130  ·  view source on GitHub ↗

To check whether input contains at least one directory. Args: file_map (dict): Structure of data files. e.g., {'train': 'train.zip', 'validation': 'val.zip'} Returns: True if input contains at least one directory, False otherwise.

(file_map)

Source from the content-addressed store, hash-verified

114
115
116def contains_dir(file_map) -> bool:
117 """
118 To check whether input contains at least one directory.
119
120 Args:
121 file_map (dict): Structure of data files. e.g., {'train': 'train.zip', 'validation': 'val.zip'}
122 Returns:
123 True if input contains at least one directory, False otherwise.
124 """
125 res = False
126 for k, v in file_map.items():
127 if isinstance(v, str) and not v.endswith('.zip'):
128 res = True
129 break
130 return res
131
132
133def get_subdir_hash_from_split(split: Union[str, list], version: str) -> str:

Callers 1

get_dataset_filesFunction · 0.85

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…