| 42 | pyproject_toml_path: Path |
| 43 | |
| 44 | def __init__(self, tool_script: str): |
| 45 | self.source_root = Path(tool_script).parent.parent |
| 46 | self.pyproject_toml_path = self.source_root / Path("pyproject.toml") |
| 47 | assert self.pyproject_toml_path.exists() |
| 48 | |
| 49 | self.parser = ArgumentParser() |
| 50 | self.parser.add_argument( |
| 51 | "--stdout", |
| 52 | action="store_true", |
| 53 | help="Write to stdout instead of saving to file", |
| 54 | ) |
| 55 | self.parser.add_argument( |
| 56 | "-c", |
| 57 | "--check", |
| 58 | help="Don't write the files back, just return the " |
| 59 | "status. Return code 0 means nothing would change. " |
| 60 | "Return code 1 means some files would be reformatted", |
| 61 | action="store_true", |
| 62 | ) |
| 63 | |
| 64 | def run_zimports(self, tempfile: str) -> None: |
| 65 | self._run_console_script( |