mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
Add __all__ for most modules beginning with 't' (#7373)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Iterable
|
||||
|
||||
__all__ = ["check", "NannyNag", "process_tokens"]
|
||||
|
||||
verbose: int
|
||||
filename_only: int
|
||||
|
||||
|
||||
@@ -9,6 +9,24 @@ from types import TracebackType
|
||||
from typing import IO, Protocol, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
__all__ = [
|
||||
"TarFile",
|
||||
"TarInfo",
|
||||
"is_tarfile",
|
||||
"TarError",
|
||||
"ReadError",
|
||||
"CompressionError",
|
||||
"StreamError",
|
||||
"ExtractError",
|
||||
"HeaderError",
|
||||
"ENCODING",
|
||||
"USTAR_FORMAT",
|
||||
"GNU_FORMAT",
|
||||
"PAX_FORMAT",
|
||||
"DEFAULT_FORMAT",
|
||||
"open",
|
||||
]
|
||||
|
||||
class _Fileobj(Protocol):
|
||||
def read(self, __size: int) -> bytes: ...
|
||||
def write(self, __b: bytes) -> object: ...
|
||||
|
||||
@@ -2,6 +2,8 @@ import socket
|
||||
from _typeshed import Self
|
||||
from typing import Any, Callable, Match, Pattern, Sequence
|
||||
|
||||
__all__ = ["Telnet"]
|
||||
|
||||
DEBUGLEVEL: int
|
||||
TELNET_PORT: int
|
||||
|
||||
|
||||
@@ -8,6 +8,22 @@ from typing_extensions import Literal
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
__all__ = [
|
||||
"NamedTemporaryFile",
|
||||
"TemporaryFile",
|
||||
"SpooledTemporaryFile",
|
||||
"TemporaryDirectory",
|
||||
"mkstemp",
|
||||
"mkdtemp",
|
||||
"mktemp",
|
||||
"TMP_MAX",
|
||||
"gettempprefix",
|
||||
"tempdir",
|
||||
"gettempdir",
|
||||
"gettempprefixb",
|
||||
"gettempdirb",
|
||||
]
|
||||
|
||||
# global variables
|
||||
TMP_MAX: int
|
||||
tempdir: str | None
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import Callable, Pattern
|
||||
|
||||
__all__ = ["TextWrapper", "wrap", "fill", "dedent", "indent", "shorten"]
|
||||
|
||||
class TextWrapper:
|
||||
width: int
|
||||
initial_indent: str
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import IO, Any, Callable, Sequence, Union
|
||||
|
||||
__all__ = ["Timer", "timeit", "repeat", "default_timer"]
|
||||
|
||||
_Timer = Callable[[], float]
|
||||
_Stmt = Union[str, Callable[[], Any]]
|
||||
|
||||
|
||||
@@ -8,6 +8,141 @@ from types import TracebackType
|
||||
from typing import Any, Callable, Generic, Mapping, Optional, Protocol, Sequence, TypeVar, Union, overload
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = [
|
||||
"TclError",
|
||||
"NO",
|
||||
"FALSE",
|
||||
"OFF",
|
||||
"YES",
|
||||
"TRUE",
|
||||
"ON",
|
||||
"N",
|
||||
"S",
|
||||
"W",
|
||||
"E",
|
||||
"NW",
|
||||
"SW",
|
||||
"NE",
|
||||
"SE",
|
||||
"NS",
|
||||
"EW",
|
||||
"NSEW",
|
||||
"CENTER",
|
||||
"NONE",
|
||||
"X",
|
||||
"Y",
|
||||
"BOTH",
|
||||
"LEFT",
|
||||
"TOP",
|
||||
"RIGHT",
|
||||
"BOTTOM",
|
||||
"RAISED",
|
||||
"SUNKEN",
|
||||
"FLAT",
|
||||
"RIDGE",
|
||||
"GROOVE",
|
||||
"SOLID",
|
||||
"HORIZONTAL",
|
||||
"VERTICAL",
|
||||
"NUMERIC",
|
||||
"CHAR",
|
||||
"WORD",
|
||||
"BASELINE",
|
||||
"INSIDE",
|
||||
"OUTSIDE",
|
||||
"SEL",
|
||||
"SEL_FIRST",
|
||||
"SEL_LAST",
|
||||
"END",
|
||||
"INSERT",
|
||||
"CURRENT",
|
||||
"ANCHOR",
|
||||
"ALL",
|
||||
"NORMAL",
|
||||
"DISABLED",
|
||||
"ACTIVE",
|
||||
"HIDDEN",
|
||||
"CASCADE",
|
||||
"CHECKBUTTON",
|
||||
"COMMAND",
|
||||
"RADIOBUTTON",
|
||||
"SEPARATOR",
|
||||
"SINGLE",
|
||||
"BROWSE",
|
||||
"MULTIPLE",
|
||||
"EXTENDED",
|
||||
"DOTBOX",
|
||||
"UNDERLINE",
|
||||
"PIESLICE",
|
||||
"CHORD",
|
||||
"ARC",
|
||||
"FIRST",
|
||||
"LAST",
|
||||
"BUTT",
|
||||
"PROJECTING",
|
||||
"ROUND",
|
||||
"BEVEL",
|
||||
"MITER",
|
||||
"MOVETO",
|
||||
"SCROLL",
|
||||
"UNITS",
|
||||
"PAGES",
|
||||
"TkVersion",
|
||||
"TclVersion",
|
||||
"READABLE",
|
||||
"WRITABLE",
|
||||
"EXCEPTION",
|
||||
"EventType",
|
||||
"Event",
|
||||
"NoDefaultRoot",
|
||||
"Variable",
|
||||
"StringVar",
|
||||
"IntVar",
|
||||
"DoubleVar",
|
||||
"BooleanVar",
|
||||
"mainloop",
|
||||
"getint",
|
||||
"getdouble",
|
||||
"getboolean",
|
||||
"Misc",
|
||||
"CallWrapper",
|
||||
"XView",
|
||||
"YView",
|
||||
"Wm",
|
||||
"Tk",
|
||||
"Tcl",
|
||||
"Pack",
|
||||
"Place",
|
||||
"Grid",
|
||||
"BaseWidget",
|
||||
"Widget",
|
||||
"Toplevel",
|
||||
"Button",
|
||||
"Canvas",
|
||||
"Checkbutton",
|
||||
"Entry",
|
||||
"Frame",
|
||||
"Label",
|
||||
"Listbox",
|
||||
"Menu",
|
||||
"Menubutton",
|
||||
"Message",
|
||||
"Radiobutton",
|
||||
"Scale",
|
||||
"Scrollbar",
|
||||
"Text",
|
||||
"OptionMenu",
|
||||
"Image",
|
||||
"PhotoImage",
|
||||
"BitmapImage",
|
||||
"image_names",
|
||||
"image_types",
|
||||
"Spinbox",
|
||||
"LabelFrame",
|
||||
"PanedWindow",
|
||||
]
|
||||
|
||||
# Using anything from tkinter.font in this file means that 'import tkinter'
|
||||
# seems to also load tkinter.font. That's not how it actually works, but
|
||||
# unfortunately not much can be done about it. https://github.com/python/typeshed/pull/4346
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import sys
|
||||
from tkinter.commondialog import Dialog
|
||||
from typing import Any, ClassVar
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["Chooser", "askcolor"]
|
||||
|
||||
class Chooser(Dialog):
|
||||
command: ClassVar[str]
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import sys
|
||||
from typing import Any, ClassVar, Mapping
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["Dialog"]
|
||||
|
||||
class Dialog:
|
||||
command: ClassVar[str | None]
|
||||
master: Any | None
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import sys
|
||||
from tkinter import Widget
|
||||
from typing import Any, Mapping
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["Dialog"]
|
||||
|
||||
DIALOG_ICON: str
|
||||
|
||||
class Dialog(Widget):
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import sys
|
||||
from tkinter import Event, Misc, Tk, Widget
|
||||
from typing import ClassVar, Protocol
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["dnd_start", "DndHandler"]
|
||||
|
||||
class _DndSource(Protocol):
|
||||
def dnd_end(self, target: Widget | None, event: Event[Misc] | None) -> None: ...
|
||||
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
|
||||
from typing import IO, Any, ClassVar, Iterable
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = [
|
||||
"FileDialog",
|
||||
"LoadFileDialog",
|
||||
"SaveFileDialog",
|
||||
"Open",
|
||||
"SaveAs",
|
||||
"Directory",
|
||||
"askopenfilename",
|
||||
"asksaveasfilename",
|
||||
"askopenfilenames",
|
||||
"askopenfile",
|
||||
"askopenfiles",
|
||||
"asksaveasfile",
|
||||
"askdirectory",
|
||||
]
|
||||
|
||||
dialogstates: dict[Any, tuple[Any, Any]]
|
||||
|
||||
class FileDialog:
|
||||
|
||||
@@ -4,6 +4,9 @@ import tkinter
|
||||
from typing import Any, Union, overload
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["NORMAL", "ROMAN", "BOLD", "ITALIC", "nametofont", "Font", "families", "names"]
|
||||
|
||||
NORMAL: Literal["normal"]
|
||||
ROMAN: Literal["roman"]
|
||||
BOLD: Literal["bold"]
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
import sys
|
||||
from tkinter.commondialog import Dialog
|
||||
from typing import Any, ClassVar
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = [
|
||||
"showinfo",
|
||||
"showwarning",
|
||||
"showerror",
|
||||
"askquestion",
|
||||
"askokcancel",
|
||||
"askyesno",
|
||||
"askyesnocancel",
|
||||
"askretrycancel",
|
||||
]
|
||||
|
||||
ERROR: str
|
||||
INFO: str
|
||||
QUESTION: str
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from tkinter import Frame, Misc, Scrollbar, Text
|
||||
from typing import Any
|
||||
|
||||
__all__ = ["ScrolledText"]
|
||||
|
||||
# The methods from Pack, Place, and Grid are dynamically added over the parent's impls
|
||||
class ScrolledText(Text):
|
||||
frame: Frame
|
||||
|
||||
@@ -5,6 +5,62 @@ from tkinter.font import _FontDescription
|
||||
from typing import Any, Callable, Union, overload
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
__all__ = [
|
||||
"Button",
|
||||
"Checkbutton",
|
||||
"Combobox",
|
||||
"Entry",
|
||||
"Frame",
|
||||
"Label",
|
||||
"Labelframe",
|
||||
"LabelFrame",
|
||||
"Menubutton",
|
||||
"Notebook",
|
||||
"Panedwindow",
|
||||
"PanedWindow",
|
||||
"Progressbar",
|
||||
"Radiobutton",
|
||||
"Scale",
|
||||
"Scrollbar",
|
||||
"Separator",
|
||||
"Sizegrip",
|
||||
"Spinbox",
|
||||
"Style",
|
||||
"Treeview",
|
||||
"LabeledScale",
|
||||
"OptionMenu",
|
||||
"tclobjs_to_py",
|
||||
"setup_master",
|
||||
]
|
||||
else:
|
||||
__all__ = [
|
||||
"Button",
|
||||
"Checkbutton",
|
||||
"Combobox",
|
||||
"Entry",
|
||||
"Frame",
|
||||
"Label",
|
||||
"Labelframe",
|
||||
"LabelFrame",
|
||||
"Menubutton",
|
||||
"Notebook",
|
||||
"Panedwindow",
|
||||
"PanedWindow",
|
||||
"Progressbar",
|
||||
"Radiobutton",
|
||||
"Scale",
|
||||
"Scrollbar",
|
||||
"Separator",
|
||||
"Sizegrip",
|
||||
"Style",
|
||||
"Treeview",
|
||||
"LabeledScale",
|
||||
"OptionMenu",
|
||||
"tclobjs_to_py",
|
||||
"setup_master",
|
||||
]
|
||||
|
||||
def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ...
|
||||
def setup_master(master: Any | None = ...): ...
|
||||
|
||||
|
||||
279
stdlib/token.pyi
279
stdlib/token.pyi
@@ -1,5 +1,284 @@
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
__all__ = [
|
||||
"tok_name",
|
||||
"ISTERMINAL",
|
||||
"ISNONTERMINAL",
|
||||
"ISEOF",
|
||||
"ENDMARKER",
|
||||
"NAME",
|
||||
"NUMBER",
|
||||
"STRING",
|
||||
"NEWLINE",
|
||||
"INDENT",
|
||||
"DEDENT",
|
||||
"LPAR",
|
||||
"RPAR",
|
||||
"LSQB",
|
||||
"RSQB",
|
||||
"COLON",
|
||||
"COMMA",
|
||||
"SEMI",
|
||||
"PLUS",
|
||||
"MINUS",
|
||||
"STAR",
|
||||
"SLASH",
|
||||
"VBAR",
|
||||
"AMPER",
|
||||
"LESS",
|
||||
"GREATER",
|
||||
"EQUAL",
|
||||
"DOT",
|
||||
"PERCENT",
|
||||
"LBRACE",
|
||||
"RBRACE",
|
||||
"EQEQUAL",
|
||||
"NOTEQUAL",
|
||||
"LESSEQUAL",
|
||||
"GREATEREQUAL",
|
||||
"TILDE",
|
||||
"CIRCUMFLEX",
|
||||
"LEFTSHIFT",
|
||||
"RIGHTSHIFT",
|
||||
"DOUBLESTAR",
|
||||
"PLUSEQUAL",
|
||||
"MINEQUAL",
|
||||
"STAREQUAL",
|
||||
"SLASHEQUAL",
|
||||
"PERCENTEQUAL",
|
||||
"AMPEREQUAL",
|
||||
"VBAREQUAL",
|
||||
"CIRCUMFLEXEQUAL",
|
||||
"LEFTSHIFTEQUAL",
|
||||
"RIGHTSHIFTEQUAL",
|
||||
"DOUBLESTAREQUAL",
|
||||
"DOUBLESLASH",
|
||||
"DOUBLESLASHEQUAL",
|
||||
"AT",
|
||||
"ATEQUAL",
|
||||
"RARROW",
|
||||
"ELLIPSIS",
|
||||
"COLONEQUAL",
|
||||
"OP",
|
||||
"AWAIT",
|
||||
"ASYNC",
|
||||
"TYPE_IGNORE",
|
||||
"TYPE_COMMENT",
|
||||
"SOFT_KEYWORD",
|
||||
"ERRORTOKEN",
|
||||
"COMMENT",
|
||||
"NL",
|
||||
"ENCODING",
|
||||
"N_TOKENS",
|
||||
"NT_OFFSET",
|
||||
]
|
||||
elif sys.version_info >= (3, 8):
|
||||
__all__ = [
|
||||
"tok_name",
|
||||
"ISTERMINAL",
|
||||
"ISNONTERMINAL",
|
||||
"ISEOF",
|
||||
"ENDMARKER",
|
||||
"NAME",
|
||||
"NUMBER",
|
||||
"STRING",
|
||||
"NEWLINE",
|
||||
"INDENT",
|
||||
"DEDENT",
|
||||
"LPAR",
|
||||
"RPAR",
|
||||
"LSQB",
|
||||
"RSQB",
|
||||
"COLON",
|
||||
"COMMA",
|
||||
"SEMI",
|
||||
"PLUS",
|
||||
"MINUS",
|
||||
"STAR",
|
||||
"SLASH",
|
||||
"VBAR",
|
||||
"AMPER",
|
||||
"LESS",
|
||||
"GREATER",
|
||||
"EQUAL",
|
||||
"DOT",
|
||||
"PERCENT",
|
||||
"LBRACE",
|
||||
"RBRACE",
|
||||
"EQEQUAL",
|
||||
"NOTEQUAL",
|
||||
"LESSEQUAL",
|
||||
"GREATEREQUAL",
|
||||
"TILDE",
|
||||
"CIRCUMFLEX",
|
||||
"LEFTSHIFT",
|
||||
"RIGHTSHIFT",
|
||||
"DOUBLESTAR",
|
||||
"PLUSEQUAL",
|
||||
"MINEQUAL",
|
||||
"STAREQUAL",
|
||||
"SLASHEQUAL",
|
||||
"PERCENTEQUAL",
|
||||
"AMPEREQUAL",
|
||||
"VBAREQUAL",
|
||||
"CIRCUMFLEXEQUAL",
|
||||
"LEFTSHIFTEQUAL",
|
||||
"RIGHTSHIFTEQUAL",
|
||||
"DOUBLESTAREQUAL",
|
||||
"DOUBLESLASH",
|
||||
"DOUBLESLASHEQUAL",
|
||||
"AT",
|
||||
"ATEQUAL",
|
||||
"RARROW",
|
||||
"ELLIPSIS",
|
||||
"COLONEQUAL",
|
||||
"OP",
|
||||
"AWAIT",
|
||||
"ASYNC",
|
||||
"TYPE_IGNORE",
|
||||
"TYPE_COMMENT",
|
||||
"ERRORTOKEN",
|
||||
"COMMENT",
|
||||
"NL",
|
||||
"ENCODING",
|
||||
"N_TOKENS",
|
||||
"NT_OFFSET",
|
||||
]
|
||||
elif sys.version_info >= (3, 7):
|
||||
__all__ = [
|
||||
"tok_name",
|
||||
"ISTERMINAL",
|
||||
"ISNONTERMINAL",
|
||||
"ISEOF",
|
||||
"ENDMARKER",
|
||||
"NAME",
|
||||
"NUMBER",
|
||||
"STRING",
|
||||
"NEWLINE",
|
||||
"INDENT",
|
||||
"DEDENT",
|
||||
"LPAR",
|
||||
"RPAR",
|
||||
"LSQB",
|
||||
"RSQB",
|
||||
"COLON",
|
||||
"COMMA",
|
||||
"SEMI",
|
||||
"PLUS",
|
||||
"MINUS",
|
||||
"STAR",
|
||||
"SLASH",
|
||||
"VBAR",
|
||||
"AMPER",
|
||||
"LESS",
|
||||
"GREATER",
|
||||
"EQUAL",
|
||||
"DOT",
|
||||
"PERCENT",
|
||||
"LBRACE",
|
||||
"RBRACE",
|
||||
"EQEQUAL",
|
||||
"NOTEQUAL",
|
||||
"LESSEQUAL",
|
||||
"GREATEREQUAL",
|
||||
"TILDE",
|
||||
"CIRCUMFLEX",
|
||||
"LEFTSHIFT",
|
||||
"RIGHTSHIFT",
|
||||
"DOUBLESTAR",
|
||||
"PLUSEQUAL",
|
||||
"MINEQUAL",
|
||||
"STAREQUAL",
|
||||
"SLASHEQUAL",
|
||||
"PERCENTEQUAL",
|
||||
"AMPEREQUAL",
|
||||
"VBAREQUAL",
|
||||
"CIRCUMFLEXEQUAL",
|
||||
"LEFTSHIFTEQUAL",
|
||||
"RIGHTSHIFTEQUAL",
|
||||
"DOUBLESTAREQUAL",
|
||||
"DOUBLESLASH",
|
||||
"DOUBLESLASHEQUAL",
|
||||
"AT",
|
||||
"ATEQUAL",
|
||||
"RARROW",
|
||||
"ELLIPSIS",
|
||||
"OP",
|
||||
"ERRORTOKEN",
|
||||
"COMMENT",
|
||||
"NL",
|
||||
"ENCODING",
|
||||
"N_TOKENS",
|
||||
"NT_OFFSET",
|
||||
]
|
||||
else:
|
||||
__all__ = [
|
||||
"tok_name",
|
||||
"ISTERMINAL",
|
||||
"ISNONTERMINAL",
|
||||
"ISEOF",
|
||||
"ENDMARKER",
|
||||
"NAME",
|
||||
"NUMBER",
|
||||
"STRING",
|
||||
"NEWLINE",
|
||||
"INDENT",
|
||||
"DEDENT",
|
||||
"LPAR",
|
||||
"RPAR",
|
||||
"LSQB",
|
||||
"RSQB",
|
||||
"COLON",
|
||||
"COMMA",
|
||||
"SEMI",
|
||||
"PLUS",
|
||||
"MINUS",
|
||||
"STAR",
|
||||
"SLASH",
|
||||
"VBAR",
|
||||
"AMPER",
|
||||
"LESS",
|
||||
"GREATER",
|
||||
"EQUAL",
|
||||
"DOT",
|
||||
"PERCENT",
|
||||
"LBRACE",
|
||||
"RBRACE",
|
||||
"EQEQUAL",
|
||||
"NOTEQUAL",
|
||||
"LESSEQUAL",
|
||||
"GREATEREQUAL",
|
||||
"TILDE",
|
||||
"CIRCUMFLEX",
|
||||
"LEFTSHIFT",
|
||||
"RIGHTSHIFT",
|
||||
"DOUBLESTAR",
|
||||
"PLUSEQUAL",
|
||||
"MINEQUAL",
|
||||
"STAREQUAL",
|
||||
"SLASHEQUAL",
|
||||
"PERCENTEQUAL",
|
||||
"AMPEREQUAL",
|
||||
"VBAREQUAL",
|
||||
"CIRCUMFLEXEQUAL",
|
||||
"LEFTSHIFTEQUAL",
|
||||
"RIGHTSHIFTEQUAL",
|
||||
"DOUBLESTAREQUAL",
|
||||
"DOUBLESLASH",
|
||||
"DOUBLESLASHEQUAL",
|
||||
"AT",
|
||||
"ATEQUAL",
|
||||
"RARROW",
|
||||
"ELLIPSIS",
|
||||
"OP",
|
||||
"AWAIT",
|
||||
"ASYNC",
|
||||
"ERRORTOKEN",
|
||||
"N_TOKENS",
|
||||
"NT_OFFSET",
|
||||
]
|
||||
|
||||
ENDMARKER: int
|
||||
NAME: int
|
||||
NUMBER: int
|
||||
|
||||
@@ -4,6 +4,11 @@ from builtins import open as _builtin_open
|
||||
from token import *
|
||||
from typing import Any, Callable, Generator, Iterable, NamedTuple, Pattern, Sequence, TextIO, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES
|
||||
else:
|
||||
EXACT_TOKEN_TYPES: dict[str, int]
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
COMMENT: int
|
||||
NL: int
|
||||
|
||||
@@ -4,6 +4,8 @@ from _typeshed import StrPath
|
||||
from typing import Any, Callable, Mapping, Optional, Sequence, TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
__all__ = ["Trace", "CoverageResults"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
_localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]]
|
||||
|
||||
@@ -4,6 +4,28 @@ from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Generator, Iterable, Iterator, Mapping, Optional, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
__all__ = [
|
||||
"extract_stack",
|
||||
"extract_tb",
|
||||
"format_exception",
|
||||
"format_exception_only",
|
||||
"format_list",
|
||||
"format_stack",
|
||||
"format_tb",
|
||||
"print_exc",
|
||||
"format_exc",
|
||||
"print_exception",
|
||||
"print_last",
|
||||
"print_stack",
|
||||
"print_tb",
|
||||
"clear_frames",
|
||||
"FrameSummary",
|
||||
"StackSummary",
|
||||
"TracebackException",
|
||||
"walk_stack",
|
||||
"walk_tb",
|
||||
]
|
||||
|
||||
_PT = tuple[str, int, str, Optional[str]]
|
||||
|
||||
def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ...
|
||||
|
||||
146
stdlib/types.pyi
146
stdlib/types.pyi
@@ -22,6 +22,152 @@ from typing import (
|
||||
)
|
||||
from typing_extensions import Literal, ParamSpec, final
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
__all__ = [
|
||||
"FunctionType",
|
||||
"LambdaType",
|
||||
"CodeType",
|
||||
"MappingProxyType",
|
||||
"SimpleNamespace",
|
||||
"CellType",
|
||||
"GeneratorType",
|
||||
"CoroutineType",
|
||||
"AsyncGeneratorType",
|
||||
"MethodType",
|
||||
"BuiltinFunctionType",
|
||||
"BuiltinMethodType",
|
||||
"WrapperDescriptorType",
|
||||
"MethodWrapperType",
|
||||
"MethodDescriptorType",
|
||||
"ClassMethodDescriptorType",
|
||||
"ModuleType",
|
||||
"TracebackType",
|
||||
"FrameType",
|
||||
"GetSetDescriptorType",
|
||||
"MemberDescriptorType",
|
||||
"new_class",
|
||||
"resolve_bases",
|
||||
"prepare_class",
|
||||
"DynamicClassAttribute",
|
||||
"coroutine",
|
||||
"GenericAlias",
|
||||
"UnionType",
|
||||
"EllipsisType",
|
||||
"NoneType",
|
||||
"NotImplementedType",
|
||||
]
|
||||
elif sys.version_info >= (3, 9):
|
||||
__all__ = [
|
||||
"FunctionType",
|
||||
"LambdaType",
|
||||
"CodeType",
|
||||
"MappingProxyType",
|
||||
"SimpleNamespace",
|
||||
"CellType",
|
||||
"GeneratorType",
|
||||
"CoroutineType",
|
||||
"AsyncGeneratorType",
|
||||
"MethodType",
|
||||
"BuiltinFunctionType",
|
||||
"BuiltinMethodType",
|
||||
"WrapperDescriptorType",
|
||||
"MethodWrapperType",
|
||||
"MethodDescriptorType",
|
||||
"ClassMethodDescriptorType",
|
||||
"ModuleType",
|
||||
"TracebackType",
|
||||
"FrameType",
|
||||
"GetSetDescriptorType",
|
||||
"MemberDescriptorType",
|
||||
"new_class",
|
||||
"resolve_bases",
|
||||
"prepare_class",
|
||||
"DynamicClassAttribute",
|
||||
"coroutine",
|
||||
"GenericAlias",
|
||||
]
|
||||
elif sys.version_info >= (3, 8):
|
||||
__all__ = [
|
||||
"FunctionType",
|
||||
"LambdaType",
|
||||
"CodeType",
|
||||
"MappingProxyType",
|
||||
"SimpleNamespace",
|
||||
"CellType",
|
||||
"GeneratorType",
|
||||
"CoroutineType",
|
||||
"AsyncGeneratorType",
|
||||
"MethodType",
|
||||
"BuiltinFunctionType",
|
||||
"BuiltinMethodType",
|
||||
"WrapperDescriptorType",
|
||||
"MethodWrapperType",
|
||||
"MethodDescriptorType",
|
||||
"ClassMethodDescriptorType",
|
||||
"ModuleType",
|
||||
"TracebackType",
|
||||
"FrameType",
|
||||
"GetSetDescriptorType",
|
||||
"MemberDescriptorType",
|
||||
"new_class",
|
||||
"resolve_bases",
|
||||
"prepare_class",
|
||||
"DynamicClassAttribute",
|
||||
"coroutine",
|
||||
]
|
||||
elif sys.version_info >= (3, 7):
|
||||
__all__ = [
|
||||
"FunctionType",
|
||||
"LambdaType",
|
||||
"CodeType",
|
||||
"MappingProxyType",
|
||||
"SimpleNamespace",
|
||||
"GeneratorType",
|
||||
"CoroutineType",
|
||||
"AsyncGeneratorType",
|
||||
"MethodType",
|
||||
"BuiltinFunctionType",
|
||||
"BuiltinMethodType",
|
||||
"WrapperDescriptorType",
|
||||
"MethodWrapperType",
|
||||
"MethodDescriptorType",
|
||||
"ClassMethodDescriptorType",
|
||||
"ModuleType",
|
||||
"TracebackType",
|
||||
"FrameType",
|
||||
"GetSetDescriptorType",
|
||||
"MemberDescriptorType",
|
||||
"new_class",
|
||||
"resolve_bases",
|
||||
"prepare_class",
|
||||
"DynamicClassAttribute",
|
||||
"coroutine",
|
||||
]
|
||||
else:
|
||||
__all__ = [
|
||||
"FunctionType",
|
||||
"LambdaType",
|
||||
"CodeType",
|
||||
"MappingProxyType",
|
||||
"SimpleNamespace",
|
||||
"GeneratorType",
|
||||
"CoroutineType",
|
||||
"AsyncGeneratorType",
|
||||
"MethodType",
|
||||
"BuiltinFunctionType",
|
||||
"ClassMethodDescriptorType",
|
||||
"ModuleType",
|
||||
"TracebackType",
|
||||
"FrameType",
|
||||
"GetSetDescriptorType",
|
||||
"MemberDescriptorType",
|
||||
"new_class",
|
||||
"resolve_bases",
|
||||
"prepare_class",
|
||||
"DynamicClassAttribute",
|
||||
"coroutine",
|
||||
]
|
||||
|
||||
# Note, all classes "defined" here require special handling.
|
||||
|
||||
_T1 = TypeVar("_T1")
|
||||
|
||||
@@ -11,6 +11,459 @@ if sys.version_info >= (3, 7):
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = [
|
||||
"Annotated",
|
||||
"Any",
|
||||
"Callable",
|
||||
"ClassVar",
|
||||
"Concatenate",
|
||||
"Final",
|
||||
"ForwardRef",
|
||||
"Generic",
|
||||
"Literal",
|
||||
"Optional",
|
||||
"ParamSpec",
|
||||
"Protocol",
|
||||
"Tuple",
|
||||
"Type",
|
||||
"TypeVar",
|
||||
"Union",
|
||||
"AbstractSet",
|
||||
"ByteString",
|
||||
"Container",
|
||||
"ContextManager",
|
||||
"Hashable",
|
||||
"ItemsView",
|
||||
"Iterable",
|
||||
"Iterator",
|
||||
"KeysView",
|
||||
"Mapping",
|
||||
"MappingView",
|
||||
"MutableMapping",
|
||||
"MutableSequence",
|
||||
"MutableSet",
|
||||
"Sequence",
|
||||
"Sized",
|
||||
"ValuesView",
|
||||
"Awaitable",
|
||||
"AsyncIterator",
|
||||
"AsyncIterable",
|
||||
"Coroutine",
|
||||
"Collection",
|
||||
"AsyncGenerator",
|
||||
"AsyncContextManager",
|
||||
"Reversible",
|
||||
"SupportsAbs",
|
||||
"SupportsBytes",
|
||||
"SupportsComplex",
|
||||
"SupportsFloat",
|
||||
"SupportsIndex",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"ChainMap",
|
||||
"Counter",
|
||||
"Deque",
|
||||
"Dict",
|
||||
"DefaultDict",
|
||||
"List",
|
||||
"OrderedDict",
|
||||
"Set",
|
||||
"FrozenSet",
|
||||
"NamedTuple",
|
||||
"TypedDict",
|
||||
"Generator",
|
||||
"BinaryIO",
|
||||
"IO",
|
||||
"Match",
|
||||
"Pattern",
|
||||
"TextIO",
|
||||
"AnyStr",
|
||||
"assert_never",
|
||||
"cast",
|
||||
"final",
|
||||
"get_args",
|
||||
"get_origin",
|
||||
"get_type_hints",
|
||||
"is_typeddict",
|
||||
"Never",
|
||||
"NewType",
|
||||
"no_type_check",
|
||||
"no_type_check_decorator",
|
||||
"NoReturn",
|
||||
"overload",
|
||||
"ParamSpecArgs",
|
||||
"ParamSpecKwargs",
|
||||
"reveal_type",
|
||||
"runtime_checkable",
|
||||
"Self",
|
||||
"Text",
|
||||
"TYPE_CHECKING",
|
||||
"TypeAlias",
|
||||
"TypeGuard",
|
||||
]
|
||||
elif sys.version_info >= (3, 10):
|
||||
__all__ = [
|
||||
"Annotated",
|
||||
"Any",
|
||||
"Callable",
|
||||
"ClassVar",
|
||||
"Concatenate",
|
||||
"Final",
|
||||
"ForwardRef",
|
||||
"Generic",
|
||||
"Literal",
|
||||
"Optional",
|
||||
"ParamSpec",
|
||||
"Protocol",
|
||||
"Tuple",
|
||||
"Type",
|
||||
"TypeVar",
|
||||
"Union",
|
||||
"AbstractSet",
|
||||
"ByteString",
|
||||
"Container",
|
||||
"ContextManager",
|
||||
"Hashable",
|
||||
"ItemsView",
|
||||
"Iterable",
|
||||
"Iterator",
|
||||
"KeysView",
|
||||
"Mapping",
|
||||
"MappingView",
|
||||
"MutableMapping",
|
||||
"MutableSequence",
|
||||
"MutableSet",
|
||||
"Sequence",
|
||||
"Sized",
|
||||
"ValuesView",
|
||||
"Awaitable",
|
||||
"AsyncIterator",
|
||||
"AsyncIterable",
|
||||
"Coroutine",
|
||||
"Collection",
|
||||
"AsyncGenerator",
|
||||
"AsyncContextManager",
|
||||
"Reversible",
|
||||
"SupportsAbs",
|
||||
"SupportsBytes",
|
||||
"SupportsComplex",
|
||||
"SupportsFloat",
|
||||
"SupportsIndex",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"ChainMap",
|
||||
"Counter",
|
||||
"Deque",
|
||||
"Dict",
|
||||
"DefaultDict",
|
||||
"List",
|
||||
"OrderedDict",
|
||||
"Set",
|
||||
"FrozenSet",
|
||||
"NamedTuple",
|
||||
"TypedDict",
|
||||
"Generator",
|
||||
"BinaryIO",
|
||||
"IO",
|
||||
"Match",
|
||||
"Pattern",
|
||||
"TextIO",
|
||||
"AnyStr",
|
||||
"cast",
|
||||
"final",
|
||||
"get_args",
|
||||
"get_origin",
|
||||
"get_type_hints",
|
||||
"is_typeddict",
|
||||
"NewType",
|
||||
"no_type_check",
|
||||
"no_type_check_decorator",
|
||||
"NoReturn",
|
||||
"overload",
|
||||
"ParamSpecArgs",
|
||||
"ParamSpecKwargs",
|
||||
"runtime_checkable",
|
||||
"Text",
|
||||
"TYPE_CHECKING",
|
||||
"TypeAlias",
|
||||
"TypeGuard",
|
||||
]
|
||||
elif sys.version_info >= (3, 9):
|
||||
__all__ = [
|
||||
"Annotated",
|
||||
"Any",
|
||||
"Callable",
|
||||
"ClassVar",
|
||||
"Final",
|
||||
"ForwardRef",
|
||||
"Generic",
|
||||
"Literal",
|
||||
"Optional",
|
||||
"Protocol",
|
||||
"Tuple",
|
||||
"Type",
|
||||
"TypeVar",
|
||||
"Union",
|
||||
"AbstractSet",
|
||||
"ByteString",
|
||||
"Container",
|
||||
"ContextManager",
|
||||
"Hashable",
|
||||
"ItemsView",
|
||||
"Iterable",
|
||||
"Iterator",
|
||||
"KeysView",
|
||||
"Mapping",
|
||||
"MappingView",
|
||||
"MutableMapping",
|
||||
"MutableSequence",
|
||||
"MutableSet",
|
||||
"Sequence",
|
||||
"Sized",
|
||||
"ValuesView",
|
||||
"Awaitable",
|
||||
"AsyncIterator",
|
||||
"AsyncIterable",
|
||||
"Coroutine",
|
||||
"Collection",
|
||||
"AsyncGenerator",
|
||||
"AsyncContextManager",
|
||||
"Reversible",
|
||||
"SupportsAbs",
|
||||
"SupportsBytes",
|
||||
"SupportsComplex",
|
||||
"SupportsFloat",
|
||||
"SupportsIndex",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"ChainMap",
|
||||
"Counter",
|
||||
"Deque",
|
||||
"Dict",
|
||||
"DefaultDict",
|
||||
"List",
|
||||
"OrderedDict",
|
||||
"Set",
|
||||
"FrozenSet",
|
||||
"NamedTuple",
|
||||
"TypedDict",
|
||||
"Generator",
|
||||
"BinaryIO",
|
||||
"IO",
|
||||
"Match",
|
||||
"Pattern",
|
||||
"TextIO",
|
||||
"AnyStr",
|
||||
"cast",
|
||||
"final",
|
||||
"get_args",
|
||||
"get_origin",
|
||||
"get_type_hints",
|
||||
"NewType",
|
||||
"no_type_check",
|
||||
"no_type_check_decorator",
|
||||
"NoReturn",
|
||||
"overload",
|
||||
"runtime_checkable",
|
||||
"Text",
|
||||
"TYPE_CHECKING",
|
||||
]
|
||||
elif sys.version_info >= (3, 8):
|
||||
__all__ = [
|
||||
"Any",
|
||||
"Callable",
|
||||
"ClassVar",
|
||||
"Final",
|
||||
"ForwardRef",
|
||||
"Generic",
|
||||
"Literal",
|
||||
"Optional",
|
||||
"Protocol",
|
||||
"Tuple",
|
||||
"Type",
|
||||
"TypeVar",
|
||||
"Union",
|
||||
"AbstractSet",
|
||||
"ByteString",
|
||||
"Container",
|
||||
"ContextManager",
|
||||
"Hashable",
|
||||
"ItemsView",
|
||||
"Iterable",
|
||||
"Iterator",
|
||||
"KeysView",
|
||||
"Mapping",
|
||||
"MappingView",
|
||||
"MutableMapping",
|
||||
"MutableSequence",
|
||||
"MutableSet",
|
||||
"Sequence",
|
||||
"Sized",
|
||||
"ValuesView",
|
||||
"Awaitable",
|
||||
"AsyncIterator",
|
||||
"AsyncIterable",
|
||||
"Coroutine",
|
||||
"Collection",
|
||||
"AsyncGenerator",
|
||||
"AsyncContextManager",
|
||||
"Reversible",
|
||||
"SupportsAbs",
|
||||
"SupportsBytes",
|
||||
"SupportsComplex",
|
||||
"SupportsFloat",
|
||||
"SupportsIndex",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"ChainMap",
|
||||
"Counter",
|
||||
"Deque",
|
||||
"Dict",
|
||||
"DefaultDict",
|
||||
"List",
|
||||
"OrderedDict",
|
||||
"Set",
|
||||
"FrozenSet",
|
||||
"NamedTuple",
|
||||
"TypedDict",
|
||||
"Generator",
|
||||
"AnyStr",
|
||||
"cast",
|
||||
"final",
|
||||
"get_args",
|
||||
"get_origin",
|
||||
"get_type_hints",
|
||||
"NewType",
|
||||
"no_type_check",
|
||||
"no_type_check_decorator",
|
||||
"NoReturn",
|
||||
"overload",
|
||||
"runtime_checkable",
|
||||
"Text",
|
||||
"TYPE_CHECKING",
|
||||
]
|
||||
elif sys.version_info >= (3, 7):
|
||||
__all__ = [
|
||||
"Any",
|
||||
"Callable",
|
||||
"ClassVar",
|
||||
"ForwardRef",
|
||||
"Generic",
|
||||
"Optional",
|
||||
"Tuple",
|
||||
"Type",
|
||||
"TypeVar",
|
||||
"Union",
|
||||
"AbstractSet",
|
||||
"ByteString",
|
||||
"Container",
|
||||
"ContextManager",
|
||||
"Hashable",
|
||||
"ItemsView",
|
||||
"Iterable",
|
||||
"Iterator",
|
||||
"KeysView",
|
||||
"Mapping",
|
||||
"MappingView",
|
||||
"MutableMapping",
|
||||
"MutableSequence",
|
||||
"MutableSet",
|
||||
"Sequence",
|
||||
"Sized",
|
||||
"ValuesView",
|
||||
"Awaitable",
|
||||
"AsyncIterator",
|
||||
"AsyncIterable",
|
||||
"Coroutine",
|
||||
"Collection",
|
||||
"AsyncGenerator",
|
||||
"AsyncContextManager",
|
||||
"Reversible",
|
||||
"SupportsAbs",
|
||||
"SupportsBytes",
|
||||
"SupportsComplex",
|
||||
"SupportsFloat",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"ChainMap",
|
||||
"Counter",
|
||||
"Deque",
|
||||
"Dict",
|
||||
"DefaultDict",
|
||||
"List",
|
||||
"OrderedDict",
|
||||
"Set",
|
||||
"FrozenSet",
|
||||
"NamedTuple",
|
||||
"Generator",
|
||||
"AnyStr",
|
||||
"cast",
|
||||
"get_type_hints",
|
||||
"NewType",
|
||||
"no_type_check",
|
||||
"no_type_check_decorator",
|
||||
"NoReturn",
|
||||
"overload",
|
||||
"Text",
|
||||
"TYPE_CHECKING",
|
||||
]
|
||||
else:
|
||||
__all__ = [
|
||||
"Any",
|
||||
"Callable",
|
||||
"ClassVar",
|
||||
"Generic",
|
||||
"Optional",
|
||||
"Tuple",
|
||||
"Type",
|
||||
"TypeVar",
|
||||
"Union",
|
||||
"AbstractSet",
|
||||
"GenericMeta",
|
||||
"ByteString",
|
||||
"Container",
|
||||
"ContextManager",
|
||||
"Hashable",
|
||||
"ItemsView",
|
||||
"Iterable",
|
||||
"Iterator",
|
||||
"KeysView",
|
||||
"Mapping",
|
||||
"MappingView",
|
||||
"MutableMapping",
|
||||
"MutableSequence",
|
||||
"MutableSet",
|
||||
"Sequence",
|
||||
"Sized",
|
||||
"ValuesView",
|
||||
"Reversible",
|
||||
"SupportsAbs",
|
||||
"SupportsBytes",
|
||||
"SupportsComplex",
|
||||
"SupportsFloat",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"Counter",
|
||||
"Deque",
|
||||
"Dict",
|
||||
"DefaultDict",
|
||||
"List",
|
||||
"Set",
|
||||
"FrozenSet",
|
||||
"NamedTuple",
|
||||
"Generator",
|
||||
"AnyStr",
|
||||
"cast",
|
||||
"get_type_hints",
|
||||
"NewType",
|
||||
"no_type_check",
|
||||
"no_type_check_decorator",
|
||||
"overload",
|
||||
"Text",
|
||||
"TYPE_CHECKING",
|
||||
]
|
||||
|
||||
Any = object()
|
||||
|
||||
@_final
|
||||
|
||||
Reference in New Issue
Block a user