compile builtin accept PathLike (#2200)

This commit is contained in:
Froger David
2018-06-05 23:02:46 +02:00
committed by Jelle Zijlstra
parent ae91695fb7
commit ffba2ea87a

View File

@@ -805,7 +805,15 @@ if sys.version_info >= (3, 7):
def breakpoint(*args: Any, **kws: Any) -> None: ...
def callable(o: object) -> bool: ...
def chr(code: int) -> str: ...
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ...) -> CodeType: ...
if sys.version_info >= (3, 6):
# This class is to be exported as PathLike from os,
# but we define it here as _PathLike to avoid import cycle issues.
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
class _PathLike(Generic[AnyStr]):
def __fspath__(self) -> AnyStr: ...
def compile(source: Any, filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ...) -> CodeType: ...
else:
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ...) -> CodeType: ...
def copyright() -> None: ...
def credits() -> None: ...
def delattr(o: Any, name: str) -> None: ...
@@ -884,12 +892,6 @@ def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(i: int) -> str: ... # TODO __index__
if sys.version_info >= (3, 6):
# This class is to be exported as PathLike from os,
# but we define it here as _PathLike to avoid import cycle issues.
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
class _PathLike(Generic[AnyStr]):
def __fspath__(self) -> AnyStr: ...
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ...
else: