From 10860386d8db00072332529dde41b398051a8ab0 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Mon, 13 Mar 2017 18:34:18 +0300 Subject: [PATCH] Update stubs for `os.path`, `os.fsencode` and `os.fsdecode` functions due to PEP-519. --- stdlib/3/os/__init__.pyi | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index ecf894e14..b19359561 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -182,8 +182,24 @@ class statvfs_result: # Unix only f_namemax = 0 # ----- os function stubs ----- -def fsencode(filename: str) -> bytes: ... -def fsdecode(filename: bytes) -> str: ... +if sys.version_info >= (3, 6): + def fsencode(filename: Union[str, PathLike]) -> bytes: ... +else: + def fsencode(filename: str) -> bytes: ... + +if sys.version_info >= (3, 6): + def fsdecode(filename: Union[bytes, PathLike]) -> str: ... +else: + def fsdecode(filename: bytes) -> str: ... + +if sys.version_info >= (3, 6): + @overload + def fspath(path: str) -> str: ... + @overload + def fspath(path: bytes) -> bytes: ... + @overload + def fspath(path: PathLike) -> Union[str, bytes]: ... + def get_exec_path(env: Optional[Mapping[str, str]] = ...) -> List[str]: ... # NOTE: get_exec_path(): returns List[bytes] when env not None def ctermid() -> str: ... # Unix only