-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
add compileall stubs to 3 and add types to the ones in 2 #1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Didn't merge the stubs because all functions have additional parameters since 3.2, so there would be no shared code between 2 and 3.
Good call! |
if sys.version_info < (3, 5): | ||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> None: ... | ||
else: | ||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ..., workers: int = ...) -> None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://docs.python.org/3/library/compileall.html, ddir
is Optional
.
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> None: ... | ||
else: | ||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ..., workers: int = ...) -> None: ... | ||
def compile_file(fullname: _Path, ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, ddir
is optional (probably everywhere in this module).
_Path = Union[str, bytes] | ||
|
||
# fx can be any object with a 'search' method; once we have Protocols we can change the type | ||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like ddir
should be Optional
.
Opening a new PR to address Jukka's comments. |
…ersion (python#1024) As pointed out in python#1023, there is no risk of incompatibility, since the requires-python field will prevent installation on older Python versions.
Didn't merge the stubs because all functions have additional parameters since 3.2,
so there would be no shared code between 2 and 3.