diff --git a/stdlib/2/os/path.pyi b/stdlib/2/os/path.pyi index 1f57575af..b776cbe2a 100644 --- a/stdlib/2/os/path.pyi +++ b/stdlib/2/os/path.pyi @@ -1,3 +1,4 @@ +# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! # Stubs for os.path # Ron Murawski diff --git a/stdlib/3/os/path.pyi b/stdlib/3/os/path.pyi index b93318bb4..b776cbe2a 100644 --- a/stdlib/3/os/path.pyi +++ b/stdlib/3/os/path.pyi @@ -1,3 +1,4 @@ +# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! # Stubs for os.path # Ron Murawski @@ -123,13 +124,13 @@ if sys.version_info < (3, 0): @overload def join(__p1: bytes, *p: bytes) -> bytes: ... @overload - def join(__p1: Text, *p: _PathType) -> Text: ... - @overload - def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... + def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: _PathType) -> Text: ... @overload def join(__p1: bytes, __p2: bytes, __p3: Text, *p: _PathType) -> Text: ... @overload - def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: _PathType) -> Text: ... + def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... + @overload + def join(__p1: Text, *p: _PathType) -> Text: ... elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload diff --git a/tests/check_consistent.py b/tests/check_consistent.py index bf6b15419..f01b5b25f 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -5,7 +5,6 @@ import os import filecmp -from os import path consistent_files = [ {'stdlib/2/builtins.pyi', 'stdlib/2/__builtin__.pyi'}, @@ -13,18 +12,20 @@ consistent_files = [ {'stdlib/2/os2emxpath.pyi', 'stdlib/2/posixpath.pyi', 'stdlib/2/ntpath.pyi', 'stdlib/2/macpath.pyi'}, {'stdlib/3/ntpath.pyi', 'stdlib/3/posixpath.pyi', 'stdlib/3/macpath.pyi', 'stdlib/3/posixpath.pyi'}, {'stdlib/3.4/enum.pyi', 'third_party/3/enum.pyi'}, + {'stdlib/2/os/path.pyi', 'stdlib/3/os/path.pyi'}, ] def main(): - files = [path.join(root, file) for root, dir, files in os.walk('.') for file in files] - no_symlink = 'You cannot use symlinks in typeshed, please copy the file to its link.' + files = [os.path.join(root, file) for root, dir, files in os.walk('.') for file in files] + no_symlink = 'You cannot use symlinks in typeshed, please copy {} to its link.' for file in files: - if path.islink(file): + _, ext = os.path.splitext(file) + if ext == '.pyi' and os.path.islink(file): raise ValueError(no_symlink.format(file)) for file1, *others in consistent_files: - f1 = path.join(os.getcwd(), file1) + f1 = os.path.join(os.getcwd(), file1) for file2 in others: - f2 = path.join(os.getcwd(), file2) + f2 = os.path.join(os.getcwd(), file2) if not filecmp.cmp(f1, f2): raise ValueError('File {f1} does not match file {f2}. Please copy it to {f2}'.format(f1=file1, f2=file2))