mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
use _typeshed's Path aliases (#4214)
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
# Stubs for compileall (Python 3)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Optional, Union, Pattern
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Optional, Pattern
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
_Path = Union[str, bytes]
|
||||
_SuccessType = bool
|
||||
else:
|
||||
_Path = Union[str, bytes, os.PathLike]
|
||||
_SuccessType = int
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -16,9 +12,9 @@ if sys.version_info >= (3, 7):
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
dir: AnyPath,
|
||||
maxlevels: Optional[int] = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -27,13 +23,13 @@ if sys.version_info >= (3, 9):
|
||||
workers: int = ...,
|
||||
invalidation_mode: Optional[PycInvalidationMode] = ...,
|
||||
*,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[_Path] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[_Path] = ...,
|
||||
limit_sl_dest: Optional[_Path] = ...,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[AnyPath] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[AnyPath] = ...,
|
||||
limit_sl_dest: Optional[AnyPath] = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
fullname: AnyPath,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -41,15 +37,15 @@ if sys.version_info >= (3, 9):
|
||||
optimize: int = ...,
|
||||
invalidation_mode: Optional[PycInvalidationMode] = ...,
|
||||
*,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[_Path] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[_Path] = ...,
|
||||
limit_sl_dest: Optional[_Path] = ...,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[AnyPath] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[AnyPath] = ...,
|
||||
limit_sl_dest: Optional[AnyPath] = ...,
|
||||
) -> _SuccessType: ...
|
||||
elif sys.version_info >= (3, 7):
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
dir: AnyPath,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -59,8 +55,8 @@ elif sys.version_info >= (3, 7):
|
||||
invalidation_mode: Optional[PycInvalidationMode] = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
fullname: AnyPath,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -72,9 +68,9 @@ elif sys.version_info >= (3, 7):
|
||||
else:
|
||||
# rx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
dir: AnyPath,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -83,8 +79,8 @@ else:
|
||||
workers: int = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
fullname: AnyPath,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
|
||||
Reference in New Issue
Block a user