MCPcopy Create free account
hub / github.com/TJU-DRL-LAB/AI-Optimizer / copy_source_tree

Function copy_source_tree

modelbased-rl/PlaNet/planet/scripts/sync.py:29–42  ·  view source on GitHub ↗
(source_dir, target_dir)

Source from the content-addressed store, hash-verified

27
28
29def copy_source_tree(source_dir, target_dir):
30 for source in find_source_files(source_dir):
31 target = os.path.join(target_dir, os.path.relpath(source, source_dir))
32 os.makedirs(os.path.dirname(target), exist_ok=True)
33 if os.path.exists(target):
34 print('Override', os.path.relpath(target, target_dir))
35 else:
36 print('Add', os.path.relpath(target, target_dir))
37 shutil.copy(source, target)
38 for target in find_source_files(target_dir):
39 source = os.path.join(source_dir, os.path.relpath(target, target_dir))
40 if not os.path.exists(source):
41 print('Remove', os.path.relpath(target, target_dir))
42 os.remove(target)
43
44
45def infer_headers(directory):

Callers 1

mainFunction · 0.85

Calls 2

find_source_filesFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected