|
6 | 6 | from os.path import abspath |
7 | 7 | from os.path import join as pjoin |
8 | 8 | from subprocess import STDOUT, check_call, check_output |
9 | | -from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional |
| 9 | +from typing import Any, Dict, Iterator, List, Optional, Protocol |
10 | 10 |
|
11 | 11 | from ._in_process import _in_proc_script_path |
12 | 12 |
|
13 | | -if TYPE_CHECKING: |
14 | | - from typing import Protocol |
15 | | - |
16 | | - class SubprocessRunner(Protocol): |
17 | | - """A protocol for the subprocess runner.""" |
18 | | - |
19 | | - def __call__( |
20 | | - self, |
21 | | - cmd: List[str], |
22 | | - cwd: Optional[str] = None, |
23 | | - extra_environ: Optional[Dict[str, str]] = None, |
24 | | - ) -> None: |
25 | | - ... |
26 | | - |
27 | 13 |
|
28 | 14 | def write_json(obj: Dict[str, Any], path: str, **kwargs) -> None: |
29 | 15 | with open(path, "w", encoding="utf-8") as f: |
@@ -71,6 +57,18 @@ def __init__(self, traceback: str) -> None: |
71 | 57 | self.traceback = traceback |
72 | 58 |
|
73 | 59 |
|
| 60 | +class SubprocessRunner(Protocol): |
| 61 | + """A protocol for the subprocess runner.""" |
| 62 | + |
| 63 | + def __call__( |
| 64 | + self, |
| 65 | + cmd: List[str], |
| 66 | + cwd: Optional[str] = None, |
| 67 | + extra_environ: Optional[Dict[str, str]] = None, |
| 68 | + ) -> None: |
| 69 | + ... |
| 70 | + |
| 71 | + |
74 | 72 | def default_subprocess_runner( |
75 | 73 | cmd: List[str], |
76 | 74 | cwd: Optional[str] = None, |
|
0 commit comments