mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-26 13:51:30 +08:00
Add __all__ to most modules beginning with 'n', 'o' and 'p' (#7345)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Optional
|
||||
|
||||
__all__ = ["netrc", "NetrcParseError"]
|
||||
|
||||
class NetrcParseError(Exception):
|
||||
filename: str | None
|
||||
lineno: int | None
|
||||
|
||||
@@ -6,6 +6,18 @@ from _typeshed import Self
|
||||
from typing import IO, Any, Iterable, NamedTuple, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
__all__ = [
|
||||
"NNTP",
|
||||
"NNTPError",
|
||||
"NNTPReplyError",
|
||||
"NNTPTemporaryError",
|
||||
"NNTPPermanentError",
|
||||
"NNTPProtocolError",
|
||||
"NNTPDataError",
|
||||
"decode_header",
|
||||
"NNTP_SSL",
|
||||
]
|
||||
|
||||
_File = Union[IO[bytes], bytes, str, None]
|
||||
|
||||
class NNTPError(Exception):
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, SupportsFloat, overload
|
||||
|
||||
__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]
|
||||
|
||||
class Number(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@@ -2,6 +2,122 @@ import sys
|
||||
|
||||
from _operator import *
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = [
|
||||
"abs",
|
||||
"add",
|
||||
"and_",
|
||||
"attrgetter",
|
||||
"call",
|
||||
"concat",
|
||||
"contains",
|
||||
"countOf",
|
||||
"delitem",
|
||||
"eq",
|
||||
"floordiv",
|
||||
"ge",
|
||||
"getitem",
|
||||
"gt",
|
||||
"iadd",
|
||||
"iand",
|
||||
"iconcat",
|
||||
"ifloordiv",
|
||||
"ilshift",
|
||||
"imatmul",
|
||||
"imod",
|
||||
"imul",
|
||||
"index",
|
||||
"indexOf",
|
||||
"inv",
|
||||
"invert",
|
||||
"ior",
|
||||
"ipow",
|
||||
"irshift",
|
||||
"is_",
|
||||
"is_not",
|
||||
"isub",
|
||||
"itemgetter",
|
||||
"itruediv",
|
||||
"ixor",
|
||||
"le",
|
||||
"length_hint",
|
||||
"lshift",
|
||||
"lt",
|
||||
"matmul",
|
||||
"methodcaller",
|
||||
"mod",
|
||||
"mul",
|
||||
"ne",
|
||||
"neg",
|
||||
"not_",
|
||||
"or_",
|
||||
"pos",
|
||||
"pow",
|
||||
"rshift",
|
||||
"setitem",
|
||||
"sub",
|
||||
"truediv",
|
||||
"truth",
|
||||
"xor",
|
||||
]
|
||||
else:
|
||||
__all__ = [
|
||||
"abs",
|
||||
"add",
|
||||
"and_",
|
||||
"attrgetter",
|
||||
"concat",
|
||||
"contains",
|
||||
"countOf",
|
||||
"delitem",
|
||||
"eq",
|
||||
"floordiv",
|
||||
"ge",
|
||||
"getitem",
|
||||
"gt",
|
||||
"iadd",
|
||||
"iand",
|
||||
"iconcat",
|
||||
"ifloordiv",
|
||||
"ilshift",
|
||||
"imatmul",
|
||||
"imod",
|
||||
"imul",
|
||||
"index",
|
||||
"indexOf",
|
||||
"inv",
|
||||
"invert",
|
||||
"ior",
|
||||
"ipow",
|
||||
"irshift",
|
||||
"is_",
|
||||
"is_not",
|
||||
"isub",
|
||||
"itemgetter",
|
||||
"itruediv",
|
||||
"ixor",
|
||||
"le",
|
||||
"length_hint",
|
||||
"lshift",
|
||||
"lt",
|
||||
"matmul",
|
||||
"methodcaller",
|
||||
"mod",
|
||||
"mul",
|
||||
"ne",
|
||||
"neg",
|
||||
"not_",
|
||||
"or_",
|
||||
"pos",
|
||||
"pow",
|
||||
"rshift",
|
||||
"setitem",
|
||||
"sub",
|
||||
"truediv",
|
||||
"truth",
|
||||
"xor",
|
||||
]
|
||||
|
||||
__lt__ = lt
|
||||
__le__ = le
|
||||
__eq__ = eq
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
from abc import abstractmethod
|
||||
from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, overload
|
||||
|
||||
__all__ = [
|
||||
"Option",
|
||||
"make_option",
|
||||
"SUPPRESS_HELP",
|
||||
"SUPPRESS_USAGE",
|
||||
"Values",
|
||||
"OptionContainer",
|
||||
"OptionGroup",
|
||||
"OptionParser",
|
||||
"HelpFormatter",
|
||||
"IndentedHelpFormatter",
|
||||
"TitledHelpFormatter",
|
||||
"OptParseError",
|
||||
"OptionError",
|
||||
"OptionConflictError",
|
||||
"OptionValueError",
|
||||
"BadOptionError",
|
||||
"check_choice",
|
||||
]
|
||||
|
||||
NO_DEFAULT: tuple[str, ...]
|
||||
SUPPRESS_HELP: str
|
||||
SUPPRESS_USAGE: str
|
||||
|
||||
@@ -2,5 +2,7 @@ import sys
|
||||
|
||||
if sys.platform == "win32":
|
||||
from ntpath import *
|
||||
from ntpath import __all__ as __all__
|
||||
else:
|
||||
from posixpath import *
|
||||
from posixpath import __all__ as __all__
|
||||
|
||||
@@ -17,6 +17,8 @@ from typing_extensions import Literal
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
__all__ = ["PurePath", "PurePosixPath", "PureWindowsPath", "Path", "PosixPath", "WindowsPath"]
|
||||
|
||||
class PurePath(PathLike[str]):
|
||||
parts: tuple[str, ...]
|
||||
drive: str
|
||||
|
||||
@@ -8,6 +8,8 @@ from types import CodeType, FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, ClassVar, Iterable, Mapping, Sequence, TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
__all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", "post_mortem", "help"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import IO, Any, Callable, Iterator, MutableMapping
|
||||
|
||||
__all__ = ["dis", "genops", "optimize"]
|
||||
|
||||
_Reader = Callable[[IO[bytes]], Any]
|
||||
bytes_types: tuple[type[Any], ...]
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
|
||||
__all__ = ["Template"]
|
||||
|
||||
class Template:
|
||||
def __init__(self) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@@ -3,6 +3,21 @@ from _typeshed import SupportsRead
|
||||
from importlib.abc import Loader, MetaPathFinder, PathEntryFinder
|
||||
from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple
|
||||
|
||||
__all__ = [
|
||||
"get_importer",
|
||||
"iter_importers",
|
||||
"get_loader",
|
||||
"find_loader",
|
||||
"walk_packages",
|
||||
"iter_modules",
|
||||
"get_data",
|
||||
"ImpImporter",
|
||||
"ImpLoader",
|
||||
"read_code",
|
||||
"extend_path",
|
||||
"ModuleInfo",
|
||||
]
|
||||
|
||||
class ModuleInfo(NamedTuple):
|
||||
module_finder: MetaPathFinder | PathEntryFinder
|
||||
name: str
|
||||
|
||||
@@ -4,6 +4,57 @@ from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import IO, Any, Mapping, MutableMapping
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"]
|
||||
elif sys.version_info >= (3, 8):
|
||||
__all__ = [
|
||||
"readPlist",
|
||||
"writePlist",
|
||||
"readPlistFromBytes",
|
||||
"writePlistToBytes",
|
||||
"Data",
|
||||
"InvalidFileException",
|
||||
"FMT_XML",
|
||||
"FMT_BINARY",
|
||||
"load",
|
||||
"dump",
|
||||
"loads",
|
||||
"dumps",
|
||||
"UID",
|
||||
]
|
||||
elif sys.version_info >= (3, 7):
|
||||
__all__ = [
|
||||
"readPlist",
|
||||
"writePlist",
|
||||
"readPlistFromBytes",
|
||||
"writePlistToBytes",
|
||||
"Data",
|
||||
"InvalidFileException",
|
||||
"FMT_XML",
|
||||
"FMT_BINARY",
|
||||
"load",
|
||||
"dump",
|
||||
"loads",
|
||||
"dumps",
|
||||
]
|
||||
else:
|
||||
__all__ = [
|
||||
"readPlist",
|
||||
"writePlist",
|
||||
"readPlistFromBytes",
|
||||
"writePlistToBytes",
|
||||
"Plist",
|
||||
"Data",
|
||||
"Dict",
|
||||
"InvalidFileException",
|
||||
"FMT_XML",
|
||||
"FMT_BINARY",
|
||||
"load",
|
||||
"dump",
|
||||
"loads",
|
||||
"dumps",
|
||||
]
|
||||
|
||||
class PlistFormat(Enum):
|
||||
FMT_XML: int
|
||||
FMT_BINARY: int
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import socket
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, BinaryIO, NoReturn, Pattern, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
__all__ = ["POP3", "error_proto", "POP3_SSL"]
|
||||
else:
|
||||
__all__ = ["POP3", "error_proto"]
|
||||
|
||||
_LongResp = tuple[bytes, list[bytes], int]
|
||||
|
||||
class error_proto(Exception): ...
|
||||
|
||||
@@ -16,6 +16,47 @@ from genericpath import (
|
||||
from os import PathLike
|
||||
from typing import AnyStr, Sequence, overload
|
||||
|
||||
__all__ = [
|
||||
"normcase",
|
||||
"isabs",
|
||||
"join",
|
||||
"splitdrive",
|
||||
"split",
|
||||
"splitext",
|
||||
"basename",
|
||||
"dirname",
|
||||
"commonprefix",
|
||||
"getsize",
|
||||
"getmtime",
|
||||
"getatime",
|
||||
"getctime",
|
||||
"islink",
|
||||
"exists",
|
||||
"lexists",
|
||||
"isdir",
|
||||
"isfile",
|
||||
"ismount",
|
||||
"expanduser",
|
||||
"expandvars",
|
||||
"normpath",
|
||||
"abspath",
|
||||
"samefile",
|
||||
"sameopenfile",
|
||||
"samestat",
|
||||
"curdir",
|
||||
"pardir",
|
||||
"sep",
|
||||
"pathsep",
|
||||
"defpath",
|
||||
"altsep",
|
||||
"extsep",
|
||||
"devnull",
|
||||
"realpath",
|
||||
"supports_unicode_filenames",
|
||||
"relpath",
|
||||
"commonpath",
|
||||
]
|
||||
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
curdir: str
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import sys
|
||||
from typing import IO
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
__all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"]
|
||||
else:
|
||||
__all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter"]
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def pformat(
|
||||
object: object,
|
||||
|
||||
@@ -2,6 +2,8 @@ from _typeshed import Self, StrOrBytesPath
|
||||
from typing import Any, Callable, TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
__all__ = ["run", "runctx", "Profile"]
|
||||
|
||||
def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ...
|
||||
def runctx(
|
||||
statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ...
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import sys
|
||||
from typing import AnyStr
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
__all__ = ["compile", "main", "PyCompileError", "PycInvalidationMode"]
|
||||
else:
|
||||
__all__ = ["compile", "main", "PyCompileError"]
|
||||
|
||||
class PyCompileError(Exception):
|
||||
exc_type_name: str
|
||||
exc_value: BaseException
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import sys
|
||||
from collections.abc import Sequence
|
||||
|
||||
__all__ = ["readmodule", "readmodule_ex", "Class", "Function"]
|
||||
|
||||
class Class:
|
||||
module: str
|
||||
name: str
|
||||
|
||||
@@ -4,6 +4,8 @@ from reprlib import Repr
|
||||
from types import MethodType, ModuleType, TracebackType
|
||||
from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, TypeVar
|
||||
|
||||
__all__ = ["help"]
|
||||
|
||||
# the return type of sys.exc_info(), used by ErrorDuringImport.__init__
|
||||
_Exc_Info = tuple[type[BaseException] | None, BaseException | None, TracebackType | None]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user