(self, *, scm=False, dvc=False, subdir=False)
| 85 | return self |
| 86 | |
| 87 | def init(self, *, scm=False, dvc=False, subdir=False): |
| 88 | from dvc.repo import Repo |
| 89 | from dvc.scm import Git |
| 90 | |
| 91 | assert not scm or not hasattr(self, "scm") |
| 92 | assert not dvc or not hasattr(self, "dvc") |
| 93 | |
| 94 | if scm: |
| 95 | Git.init(self.fs_path).close() |
| 96 | if dvc: |
| 97 | self.dvc = Repo.init( |
| 98 | self.fs_path, |
| 99 | no_scm=not scm and not hasattr(self, "scm"), |
| 100 | subdir=subdir, |
| 101 | ) |
| 102 | if scm: |
| 103 | self.scm = self.dvc.scm if hasattr(self, "dvc") else Git(self.fs_path) |
| 104 | if dvc and hasattr(self, "scm"): |
| 105 | self.scm.commit("init dvc") |
| 106 | |
| 107 | def close(self): |
| 108 | if hasattr(self, "scm"): |
no test coverage detected