From 236ed3f73187ef59a051dbe6c8dfd00ca538cdad Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 2 Jul 2018 21:13:38 +0100 Subject: [PATCH] Add genericpath stub (#2300) To backport `os.path.commonpath` in mypy I needed to use genericpath. It seems unchanged since 3.4, and the `same*` functions were added in 3.4. (checked via comparing the `__all__`s of the source in 2.7, 3.4, and 3.7.) --- stdlib/2and3/genericpath.pyi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 stdlib/2and3/genericpath.pyi diff --git a/stdlib/2and3/genericpath.pyi b/stdlib/2and3/genericpath.pyi new file mode 100644 index 000000000..a9a72f89a --- /dev/null +++ b/stdlib/2and3/genericpath.pyi @@ -0,0 +1,16 @@ +from typing import List +import sys + +def exists(path: str) -> bool: ... +def isfile(path: str) -> bool: ... +def isdir(s: str) -> bool: ... +def getsize(filename: str) -> int: ... +def getmtime(filename: str) -> float: ... +def getatime(filename: str) -> float: ... +def getctime(filename: str) -> float: ... +def commonprefix(m: List[str]) -> str: ... + +if sys.version_info >= (3, 4): + def samestat(s1: str, s2: str) -> int: ... + def samefile(f1: str, f2: str) -> int: ... + def sameopenfile(fp1: str, fp2: str) -> int: ...