MCPcopy
hub / github.com/treeverse/dvc / _gen

Method _gen

dvc/testing/cloud.py:53–67  ·  view source on GitHub ↗
(self, struct, prefix=None)

Source from the content-addressed store, hash-verified

51 pass
52
53 def _gen(self, struct, prefix=None):
54 for name, contents in struct.items():
55 path = (prefix or self) / name
56
57 if isinstance(contents, dict):
58 if not contents:
59 path.mkdir(parents=True, exist_ok=True)
60 else:
61 self._gen(contents, prefix=path)
62 else:
63 path.parent.mkdir(parents=True, exist_ok=True)
64 if isinstance(contents, bytes):
65 path.write_bytes(contents)
66 else:
67 path.write_text(contents, encoding="utf-8")
68
69 def gen(self, struct, text=""):
70 if isinstance(struct, (str, bytes, pathlib.PurePath)):

Callers 1

genMethod · 0.95

Calls 4

itemsMethod · 0.80
mkdirMethod · 0.80
write_bytesMethod · 0.80
write_textMethod · 0.80

Tested by

no test coverage detected