Skip to content

Commit e1e579b

Browse files
authored
draft compileall.pyi fix for python#3475
1 parent 8df632b commit e1e579b

1 file changed

Lines changed: 63 additions & 22 deletions

File tree

‎stdlib/3/compileall.pyi‎

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,66 @@ else:
1111
_Path = Union[str, bytes, os.PathLike]
1212
_SuccessType = int
1313

14-
# rx can be any object with a 'search' method; once we have Protocols we can change the type
15-
def compile_dir(
16-
dir: _Path,
17-
maxlevels: int = ...,
18-
ddir: Optional[_Path] = ...,
19-
force: bool = ...,
20-
rx: Optional[Pattern[Any]] = ...,
21-
quiet: int = ...,
22-
legacy: bool = ...,
23-
optimize: int = ...,
24-
workers: int = ...,
25-
) -> _SuccessType: ...
26-
def compile_file(
27-
fullname: _Path,
28-
ddir: Optional[_Path] = ...,
29-
force: bool = ...,
30-
rx: Optional[Pattern[Any]] = ...,
31-
quiet: int = ...,
32-
legacy: bool = ...,
33-
optimize: int = ...,
34-
) -> _SuccessType: ...
35-
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> _SuccessType: ...
14+
if sys.version_info >= (3, 7):
15+
from py_compile import PycInvalidationMode
16+
def compile_dir(
17+
dir: _Path,
18+
maxlevels: int = ...,
19+
ddir: Optional[_Path] = ...,
20+
force: bool = ...,
21+
rx: Optional[Pattern[Any]] = ...,
22+
quiet: int = ...,
23+
legacy: bool = ...,
24+
optimize: int = ...,
25+
workers: int = ...,
26+
invalidation_mode: PycInvalidationMode = ...,
27+
) -> _SuccessType: ...
28+
def compile_file(
29+
fullname: _Path,
30+
ddir: Optional[_Path] = ...,
31+
force: bool = ...,
32+
rx: Optional[Pattern[Any]] = ...,
33+
quiet: int = ...,
34+
legacy: bool = ...,
35+
optimize: int = ...,
36+
invalidation_mode: PycInvalidationMode = ...,
37+
) -> _SuccessType: ...
38+
def compile_path(
39+
skip_curdir: bool = ...,
40+
maxlevels: int = ...,
41+
force: bool = ...,
42+
quiet: int = ...,
43+
legacy: bool = ...,
44+
optimize: int = ...,
45+
invalidation_mode: PycInvalidationMode = ...,
46+
) -> _SuccessType: ...
47+
else:
48+
# rx can be any object with a 'search' method; once we have Protocols we can change the type
49+
def compile_dir(
50+
dir: _Path,
51+
maxlevels: int = ...,
52+
ddir: Optional[_Path] = ...,
53+
force: bool = ...,
54+
rx: Optional[Pattern[Any]] = ...,
55+
quiet: int = ...,
56+
legacy: bool = ...,
57+
optimize: int = ...,
58+
workers: int = ...,
59+
) -> _SuccessType: ...
60+
def compile_file(
61+
fullname: _Path,
62+
ddir: Optional[_Path] = ...,
63+
force: bool = ...,
64+
rx: Optional[Pattern[Any]] = ...,
65+
quiet: int = ...,
66+
legacy: bool = ...,
67+
optimize: int = ...,
68+
) -> _SuccessType: ...
69+
def compile_path(
70+
skip_curdir: bool = ...,
71+
maxlevels: int = ...,
72+
force: bool = ...,
73+
quiet: int = ...,
74+
legacy: bool = ...,
75+
optimize: int = ...
76+
) -> _SuccessType: ...

0 commit comments

Comments
 (0)