(self, struct, prefix=None)
| 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)): |
no test coverage detected