MCPcopy Create free account
hub / github.com/ad12/DOSMA / _save_dir

Method _save_dir

dosma/cli.py:212–238  ·  view source on GitHub ↗

Returns directory path specific to this scan. Formatted as '`base_load_dirpath`/`scan.NAME`'. Args: dir_path (str): Directory path where all data is stored. create_dir (`bool`, optional): If `True`, creates directory if it doesn't exist. Returns:

(self, dir_path: str, create_dir: bool = True)

Source from the content-addressed store, hash-verified

210 return scan_type.load(file_path, num_workers)
211
212 def _save_dir(self, dir_path: str, create_dir: bool = True):
213 """Returns directory path specific to this scan.
214
215 Formatted as '`base_load_dirpath`/`scan.NAME`'.
216
217 Args:
218 dir_path (str): Directory path where all data is stored.
219 create_dir (`bool`, optional): If `True`, creates directory if it doesn't exist.
220
221 Returns:
222 str: Data directory path for this scan.
223 """
224 scan_type = self.scan_type
225 folder_id = scan_type.NAME
226
227 name_len = len(folder_id) + 2 # buffer
228 if scan_type.NAME not in dir_path[-name_len:]:
229 scan_dirpath = os.path.join(dir_path, folder_id)
230 else:
231 scan_dirpath = dir_path
232
233 # scan_dirpath = os.path.join(scan_dirpath, folder_id)
234
235 if create_dir:
236 os.makedirs(scan_dirpath, exist_ok=True)
237
238 return scan_dirpath
239
240 def save(
241 self,

Callers 2

loadMethod · 0.95
saveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected