|
7 | 7 | from typing import List, Optional, Tuple |
8 | 8 |
|
9 | 9 |
|
10 | | -MPY_CROSS_PATH = ( |
| 10 | +MPY_CROSS_PATH = str( |
11 | 11 | (pathlib.Path(__file__).parent / "mpy-cross") |
12 | 12 | .with_suffix(".exe" if platform.system() == "Windows" else "") |
13 | 13 | .absolute() |
@@ -42,7 +42,7 @@ def mpy_cross_compile( |
42 | 42 | emit: Optional[Emitter] = None, |
43 | 43 | heap_size: Optional[int] = None, |
44 | 44 | extra_args: Optional[List[str]] = None, |
45 | | -) -> Tuple[subprocess.CompletedProcess, Optional[bytes]]: |
| 45 | +) -> Tuple[subprocess.CompletedProcess[bytes], Optional[bytes]]: |
46 | 46 | """ |
47 | 47 | Compiles a file using mpy-cross. |
48 | 48 |
|
@@ -75,13 +75,13 @@ def mpy_cross_compile( |
75 | 75 | ... |
76 | 76 |
|
77 | 77 | """ |
78 | | - with tempfile.TemporaryDirectory() as tmp_dir: |
79 | | - tmp_dir = pathlib.Path(tmp_dir) |
| 78 | + with tempfile.TemporaryDirectory() as tmp_dir_name: |
| 79 | + tmp_dir = pathlib.Path(tmp_dir_name) |
80 | 80 |
|
81 | 81 | with open(tmp_dir / "tmp.py", "w") as in_file: |
82 | 82 | in_file.write(file_contents) |
83 | 83 |
|
84 | | - args = [MPY_CROSS_PATH, in_file.name, "-s", file_name] |
| 84 | + args: list[str] = [MPY_CROSS_PATH, in_file.name, "-s", file_name] |
85 | 85 |
|
86 | 86 | if optimization_level is not None: |
87 | 87 | if optimization_level not in range(4): |
@@ -124,7 +124,7 @@ def mpy_cross_version() -> str: |
124 | 124 | return proc.stdout.decode().strip() |
125 | 125 |
|
126 | 126 |
|
127 | | -def _run(): |
| 127 | +def run() -> None: |
128 | 128 | """ |
129 | 129 | Run mpy-cross directly. |
130 | 130 | """ |
|
0 commit comments