MCPcopy Create free account
hub / github.com/BeastyZ/ConvSearch-R1 / check_dir_exist_or_build

Function check_dir_exist_or_build

index/dense/utils.py:16–28  ·  view source on GitHub ↗
(dir_list, force_emptying:bool = False)

Source from the content-addressed store, hash-verified

14
15
16def check_dir_exist_or_build(dir_list, force_emptying:bool = False):
17 for x in dir_list:
18 if not os.path.exists(x):
19 os.makedirs(x)
20 elif len(os.listdir(x)) > 0: # not empty
21 if force_emptying:
22 print("Forcing to erase all contens of {}".format(x))
23 shutil.rmtree(x)
24 os.makedirs(x)
25 else:
26 raise FileExistsError
27 else:
28 continue
29
30def json_dumps_arguments(output_path, args):
31 with open(output_path, "w") as f:

Callers 1

get_argsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected