Add __all__ to most modules beginning with 'n', 'o' and 'p' (#7345)

This commit is contained in:
Alex Waygood
2022-02-22 01:57:03 +00:00
committed by GitHub
parent 09c945b32b
commit d6ce3abd68
20 changed files with 377 additions and 2 deletions

View File

@@ -44,10 +44,94 @@ from posixpath import (
)
from typing import AnyStr, overload
altsep: str
if sys.version_info < (3, 7) and sys.platform == "win32":
if sys.version_info >= (3, 7) or sys.platform != "win32":
__all__ = [
"normcase",
"isabs",
"join",
"splitdrive",
"split",
"splitext",
"basename",
"dirname",
"commonprefix",
"getsize",
"getmtime",
"getatime",
"getctime",
"islink",
"exists",
"lexists",
"isdir",
"isfile",
"ismount",
"expanduser",
"expandvars",
"normpath",
"abspath",
"curdir",
"pardir",
"sep",
"pathsep",
"defpath",
"altsep",
"extsep",
"devnull",
"realpath",
"supports_unicode_filenames",
"relpath",
"samefile",
"sameopenfile",
"samestat",
"commonpath",
]
else:
__all__ = [
"normcase",
"isabs",
"join",
"splitdrive",
"split",
"splitext",
"basename",
"dirname",
"commonprefix",
"getsize",
"getmtime",
"getatime",
"getctime",
"islink",
"exists",
"lexists",
"isdir",
"isfile",
"ismount",
"expanduser",
"expandvars",
"normpath",
"abspath",
"splitunc",
"curdir",
"pardir",
"sep",
"pathsep",
"defpath",
"altsep",
"extsep",
"devnull",
"realpath",
"supports_unicode_filenames",
"relpath",
"samefile",
"sameopenfile",
"samestat",
"commonpath",
]
def splitunc(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... # deprecated
altsep: str
# First parameter is not actually pos-only,
# but must be defined as pos-only in the stub or cross-platform code doesn't type-check,
# as the parameter name is different in posixpath.join()