| 15 | |
| 16 | @dataclass |
| 17 | class Solution: |
| 18 | problem: ProblemInfo |
| 19 | path: Path |
| 20 | |
| 21 | @classmethod |
| 22 | def create(cls, problem: ProblemInfo, path: Path): |
| 23 | solution = Solution(problem, path) |
| 24 | solution._create_dirs() |
| 25 | return solution |
| 26 | |
| 27 | def _create_dirs(self): |
| 28 | self.animation_path().mkdir() |
| 29 | self.article_path().mkdir() |
| 30 | self.code_path().mkdir() |
| 31 | (self.animation_path() / 'Animation.m4v').touch() |
| 32 | (self.animation_path() / 'Animation.gif').touch() |
| 33 | |
| 34 | def _path_to(self, s: str) -> Path: |
| 35 | return self.path / s |
| 36 | |
| 37 | def animation_path(self) -> Path: |
| 38 | return self.path / 'Animation' |
| 39 | |
| 40 | def article_path(self) -> Path: |
| 41 | return self.path / 'Article' |
| 42 | |
| 43 | def doc_path(self) -> Path: |
| 44 | return self.article_path() / (self.problem.title_slug() + '.md') |
| 45 | |
| 46 | def code_path(self) -> Path: |
| 47 | return self.path / 'Code' |