Closed
Description
compileall.compile_dir
is missing an annotation for its argument invalidation_mode
, which should be py_compile.PycInvalidationMode
.
#!/usr/bin/env bash
mypy --version # mypy 0.740
python --version # python 3.7.5
python/cpython#5200, the PR that introduced the new argument
link to cpython Lib/compileall.py for reference.
Reproduction
#!/usr/bin/env python3
import sys
assert int(sys.version.split(".")[1]) >= 7 "requres python >= 7"
from compileall import compile_dir
from py_compile import PycInvalidationMode
compile_dir('path/to/real/dir', invalidation_mode=PycInvalidationMode.CHECKED_HASH)
# error: Unexpected keyword argument "invalidation_mode" for "compile_dir"
reveal_type(compile_dir)
# def(
# dir: Union[builtins.str, builtins.bytes, builtins._PathLike[Any]],
# maxlevels: builtins.int = None,
# # -- snip --
# workers: builtins.int =,
# # MISSING: invalidation_mode: py_compile.PycInvalidationMode
# ) -> builtins.int
help(compile_all)
# compile_dir(dir, maxlevels=10, ..., workers=1, invalidation_mode=None)
# # --snip--
# workers: maximum number of parallel workers
# invalidation_mode: how the up-to-dateness of the pyc will be checked
Metadata
Metadata
Assignees
Labels
No labels