mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 20:45:49 +08:00
[stdlib] Add missing Final (#14613)
This commit is contained in:
@@ -8,7 +8,7 @@ from _asyncio import (
|
||||
_unregister_task as _unregister_task,
|
||||
)
|
||||
from collections.abc import AsyncIterator, Awaitable, Coroutine, Generator, Iterable, Iterator
|
||||
from typing import Any, Literal, Protocol, TypeVar, overload, type_check_only
|
||||
from typing import Any, Final, Literal, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import _CoroutineLike
|
||||
@@ -82,9 +82,9 @@ else:
|
||||
|
||||
_TaskYieldType: TypeAlias = Future[object] | None
|
||||
|
||||
FIRST_COMPLETED = concurrent.futures.FIRST_COMPLETED
|
||||
FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION
|
||||
ALL_COMPLETED = concurrent.futures.ALL_COMPLETED
|
||||
FIRST_COMPLETED: Final = concurrent.futures.FIRST_COMPLETED
|
||||
FIRST_EXCEPTION: Final = concurrent.futures.FIRST_EXCEPTION
|
||||
ALL_COMPLETED: Final = concurrent.futures.ALL_COMPLETED
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@type_check_only
|
||||
|
||||
@@ -9,8 +9,8 @@ if sys.platform == "win32":
|
||||
__all__ = ("pipe", "Popen", "PIPE", "PipeHandle")
|
||||
|
||||
BUFSIZE: Final = 8192
|
||||
PIPE = subprocess.PIPE
|
||||
STDOUT = subprocess.STDOUT
|
||||
PIPE: Final = subprocess.PIPE
|
||||
STDOUT: Final = subprocess.STDOUT
|
||||
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]: ...
|
||||
|
||||
class PipeHandle:
|
||||
|
||||
@@ -15,8 +15,7 @@ RUNNING: Final = "RUNNING"
|
||||
CANCELLED: Final = "CANCELLED"
|
||||
CANCELLED_AND_NOTIFIED: Final = "CANCELLED_AND_NOTIFIED"
|
||||
FINISHED: Final = "FINISHED"
|
||||
_FUTURE_STATES: list[str]
|
||||
_STATE_TO_DESCRIPTION_MAP: dict[str, str]
|
||||
_STATE_TO_DESCRIPTION_MAP: Final[dict[str, str]]
|
||||
LOGGER: Logger
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from multiprocessing.context import BaseContext, Process
|
||||
from multiprocessing.queues import Queue, SimpleQueue
|
||||
from threading import Lock, Semaphore, Thread
|
||||
from types import TracebackType
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing import Any, Final, Generic, TypeVar, overload
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
from weakref import ref
|
||||
|
||||
@@ -28,9 +28,9 @@ class _ThreadWakeup:
|
||||
|
||||
def _python_exit() -> None: ...
|
||||
|
||||
EXTRA_QUEUED_CALLS: int
|
||||
EXTRA_QUEUED_CALLS: Final = 1
|
||||
|
||||
_MAX_WINDOWS_WORKERS: int
|
||||
_MAX_WINDOWS_WORKERS: Final = 61
|
||||
|
||||
class _RemoteTraceback(Exception):
|
||||
tb: str
|
||||
|
||||
@@ -26,7 +26,7 @@ from _ctypes import (
|
||||
from _typeshed import StrPath
|
||||
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Generic, Literal, TypeVar, overload, type_check_only
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -55,7 +55,7 @@ if sys.version_info >= (3, 14):
|
||||
else:
|
||||
from _ctypes import POINTER as POINTER, pointer as pointer
|
||||
|
||||
DEFAULT_MODE: int
|
||||
DEFAULT_MODE: Final[int]
|
||||
|
||||
class ArgumentError(Exception): ...
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from ctypes import (
|
||||
c_wchar,
|
||||
c_wchar_p,
|
||||
)
|
||||
from typing import Any, TypeVar
|
||||
from typing import Any, Final, TypeVar
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
@@ -177,7 +177,7 @@ class MSG(Structure):
|
||||
pt: _CField[POINT, POINT, POINT]
|
||||
|
||||
tagMSG = MSG
|
||||
MAX_PATH: int
|
||||
MAX_PATH: Final = 260
|
||||
|
||||
class WIN32_FIND_DATAA(Structure):
|
||||
dwFileAttributes: _CIntLikeField[DWORD]
|
||||
|
||||
@@ -14,12 +14,12 @@ _T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
# available after calling `curses.initscr()`
|
||||
LINES: int
|
||||
COLS: int
|
||||
LINES: Final[int]
|
||||
COLS: Final[int]
|
||||
|
||||
# available after calling `curses.start_color()`
|
||||
COLORS: int
|
||||
COLOR_PAIRS: int
|
||||
COLORS: Final[int]
|
||||
COLOR_PAIRS: Final[int]
|
||||
|
||||
def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
|
||||
|
||||
|
||||
+38
-38
@@ -1,45 +1,45 @@
|
||||
from typing import TypeVar
|
||||
from typing import Final, TypeVar
|
||||
|
||||
_CharT = TypeVar("_CharT", str, int)
|
||||
|
||||
NUL: int
|
||||
SOH: int
|
||||
STX: int
|
||||
ETX: int
|
||||
EOT: int
|
||||
ENQ: int
|
||||
ACK: int
|
||||
BEL: int
|
||||
BS: int
|
||||
TAB: int
|
||||
HT: int
|
||||
LF: int
|
||||
NL: int
|
||||
VT: int
|
||||
FF: int
|
||||
CR: int
|
||||
SO: int
|
||||
SI: int
|
||||
DLE: int
|
||||
DC1: int
|
||||
DC2: int
|
||||
DC3: int
|
||||
DC4: int
|
||||
NAK: int
|
||||
SYN: int
|
||||
ETB: int
|
||||
CAN: int
|
||||
EM: int
|
||||
SUB: int
|
||||
ESC: int
|
||||
FS: int
|
||||
GS: int
|
||||
RS: int
|
||||
US: int
|
||||
SP: int
|
||||
DEL: int
|
||||
NUL: Final = 0x00
|
||||
SOH: Final = 0x01
|
||||
STX: Final = 0x02
|
||||
ETX: Final = 0x03
|
||||
EOT: Final = 0x04
|
||||
ENQ: Final = 0x05
|
||||
ACK: Final = 0x06
|
||||
BEL: Final = 0x07
|
||||
BS: Final = 0x08
|
||||
TAB: Final = 0x09
|
||||
HT: Final = 0x09
|
||||
LF: Final = 0x0A
|
||||
NL: Final = 0x0A
|
||||
VT: Final = 0x0B
|
||||
FF: Final = 0x0C
|
||||
CR: Final = 0x0D
|
||||
SO: Final = 0x0E
|
||||
SI: Final = 0x0F
|
||||
DLE: Final = 0x10
|
||||
DC1: Final = 0x11
|
||||
DC2: Final = 0x12
|
||||
DC3: Final = 0x13
|
||||
DC4: Final = 0x14
|
||||
NAK: Final = 0x15
|
||||
SYN: Final = 0x16
|
||||
ETB: Final = 0x17
|
||||
CAN: Final = 0x18
|
||||
EM: Final = 0x19
|
||||
SUB: Final = 0x1A
|
||||
ESC: Final = 0x1B
|
||||
FS: Final = 0x1C
|
||||
GS: Final = 0x1D
|
||||
RS: Final = 0x1E
|
||||
US: Final = 0x1F
|
||||
SP: Final = 0x20
|
||||
DEL: Final = 0x7F
|
||||
|
||||
controlnames: list[int]
|
||||
controlnames: Final[list[int]]
|
||||
|
||||
def isalnum(c: str | int) -> bool: ...
|
||||
def isalpha(c: str | int) -> bool: ...
|
||||
|
||||
@@ -25,7 +25,7 @@ SPECIALSNL: Final[set[str]]
|
||||
def make_quoted_pairs(value: Any) -> str: ...
|
||||
def quote_string(value: Any) -> str: ...
|
||||
|
||||
rfc2047_matcher: Pattern[str]
|
||||
rfc2047_matcher: Final[Pattern[str]]
|
||||
|
||||
class TokenList(list[TokenList | Terminal]):
|
||||
token_type: str | None
|
||||
|
||||
@@ -4,9 +4,16 @@ from typing import ClassVar, Final, overload
|
||||
|
||||
__all__ = ["Charset", "add_alias", "add_charset", "add_codec"]
|
||||
|
||||
QP: Final[int] # undocumented
|
||||
BASE64: Final[int] # undocumented
|
||||
SHORTEST: Final[int] # undocumented
|
||||
QP: Final = 1 # undocumented
|
||||
BASE64: Final = 2 # undocumented
|
||||
SHORTEST: Final = 3 # undocumented
|
||||
RFC2047_CHROME_LEN: Final = 7 # undocumented
|
||||
DEFAULT_CHARSET: Final = "us-ascii" # undocumented
|
||||
UNKNOWN8BIT: Final = "unknown-8bit" # undocumented
|
||||
EMPTYSTRING: Final = "" # undocumented
|
||||
CHARSETS: Final[dict[str, tuple[int | None, int | None, str | None]]]
|
||||
ALIASES: Final[dict[str, str]]
|
||||
CODEC_MAP: Final[dict[str, str | None]] # undocumented
|
||||
|
||||
class Charset:
|
||||
input_charset: str
|
||||
|
||||
+14
-14
@@ -1,26 +1,26 @@
|
||||
import sys
|
||||
from collections.abc import Container, Iterable, Sequence
|
||||
from types import ModuleType
|
||||
from typing import Any, Literal
|
||||
from typing import Any, Final
|
||||
|
||||
if sys.platform == "win32":
|
||||
from _msi import *
|
||||
from _msi import _Database
|
||||
|
||||
AMD64: bool
|
||||
Win64: bool
|
||||
AMD64: Final[bool]
|
||||
Win64: Final[bool]
|
||||
|
||||
datasizemask: Literal[0x00FF]
|
||||
type_valid: Literal[0x0100]
|
||||
type_localizable: Literal[0x0200]
|
||||
typemask: Literal[0x0C00]
|
||||
type_long: Literal[0x0000]
|
||||
type_short: Literal[0x0400]
|
||||
type_string: Literal[0x0C00]
|
||||
type_binary: Literal[0x0800]
|
||||
type_nullable: Literal[0x1000]
|
||||
type_key: Literal[0x2000]
|
||||
knownbits: Literal[0x3FFF]
|
||||
datasizemask: Final = 0x00FF
|
||||
type_valid: Final = 0x0100
|
||||
type_localizable: Final = 0x0200
|
||||
typemask: Final = 0x0C00
|
||||
type_long: Final = 0x0000
|
||||
type_short: Final = 0x0400
|
||||
type_string: Final = 0x0C00
|
||||
type_binary: Final = 0x0800
|
||||
type_nullable: Final = 0x1000
|
||||
type_key: Final = 0x2000
|
||||
knownbits: Final = 0x3FFF
|
||||
|
||||
class Table:
|
||||
name: str
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from typing import Final
|
||||
|
||||
if sys.platform == "win32":
|
||||
from . import Table
|
||||
@@ -89,6 +90,6 @@ if sys.platform == "win32":
|
||||
Upgrade: Table
|
||||
Verb: Table
|
||||
|
||||
tables: list[Table]
|
||||
tables: Final[list[Table]]
|
||||
|
||||
_Validation_records: list[tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]]
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import sys
|
||||
from typing import Final
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if sys.platform == "win32":
|
||||
_SequenceType: TypeAlias = list[tuple[str, str | None, int]]
|
||||
|
||||
AdminExecuteSequence: _SequenceType
|
||||
AdminUISequence: _SequenceType
|
||||
AdvtExecuteSequence: _SequenceType
|
||||
InstallExecuteSequence: _SequenceType
|
||||
InstallUISequence: _SequenceType
|
||||
AdminExecuteSequence: Final[_SequenceType]
|
||||
AdminUISequence: Final[_SequenceType]
|
||||
AdvtExecuteSequence: Final[_SequenceType]
|
||||
InstallExecuteSequence: Final[_SequenceType]
|
||||
InstallUISequence: Final[_SequenceType]
|
||||
|
||||
tables: list[str]
|
||||
tables: Final[list[str]]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import sys
|
||||
from typing import Final
|
||||
|
||||
if sys.platform == "win32":
|
||||
ActionText: list[tuple[str, str, str | None]]
|
||||
UIText: list[tuple[str, str | None]]
|
||||
ActionText: Final[list[tuple[str, str, str | None]]]
|
||||
UIText: Final[list[tuple[str, str | None]]]
|
||||
dirname: str
|
||||
tables: list[str]
|
||||
tables: Final[list[str]]
|
||||
|
||||
@@ -52,7 +52,7 @@ def get_logger() -> Logger: ...
|
||||
def log_to_stderr(level: _LoggingLevel | None = None) -> Logger: ...
|
||||
def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ...
|
||||
|
||||
abstract_sockets_supported: bool
|
||||
abstract_sockets_supported: Final[bool]
|
||||
|
||||
def get_temp_dir() -> str: ...
|
||||
def register_after_fork(obj: _T, func: Callable[[_T], object]) -> None: ...
|
||||
|
||||
@@ -11,10 +11,10 @@ from types import CodeType
|
||||
from typing import Any, Final, type_check_only
|
||||
from typing_extensions import deprecated
|
||||
|
||||
DEBUGGER_ID: Final[int]
|
||||
COVERAGE_ID: Final[int]
|
||||
PROFILER_ID: Final[int]
|
||||
OPTIMIZER_ID: Final[int]
|
||||
DEBUGGER_ID: Final = 0
|
||||
COVERAGE_ID: Final = 1
|
||||
PROFILER_ID: Final = 2
|
||||
OPTIMIZER_ID: Final = 5
|
||||
|
||||
def use_tool_id(tool_id: int, name: str, /) -> None: ...
|
||||
def free_tool_id(tool_id: int, /) -> None: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from tkinter.constants import *
|
||||
from tkinter.font import _FontDescription
|
||||
from types import GenericAlias, TracebackType
|
||||
from typing import Any, ClassVar, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@@ -153,11 +153,11 @@ __all__ = [
|
||||
|
||||
TclError = _tkinter.TclError
|
||||
wantobjects: int
|
||||
TkVersion: float
|
||||
TclVersion: float
|
||||
READABLE = _tkinter.READABLE
|
||||
WRITABLE = _tkinter.WRITABLE
|
||||
EXCEPTION = _tkinter.EXCEPTION
|
||||
TkVersion: Final[float]
|
||||
TclVersion: Final[float]
|
||||
READABLE: Final = _tkinter.READABLE
|
||||
WRITABLE: Final = _tkinter.WRITABLE
|
||||
EXCEPTION: Final = _tkinter.EXCEPTION
|
||||
|
||||
# Quick guide for figuring out which widget class to choose:
|
||||
# - Misc: any widget (don't use BaseWidget because Tk doesn't inherit from BaseWidget)
|
||||
@@ -359,8 +359,8 @@ class BooleanVar(Variable):
|
||||
|
||||
def mainloop(n: int = 0) -> None: ...
|
||||
|
||||
getint: Incomplete
|
||||
getdouble: Incomplete
|
||||
getint = int
|
||||
getdouble = float
|
||||
|
||||
def getboolean(s): ...
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ else:
|
||||
"seal",
|
||||
)
|
||||
|
||||
FILTER_DIR: Any
|
||||
FILTER_DIR: bool # controls the way mock objects respond to `dir` function
|
||||
|
||||
class _SentinelObject:
|
||||
name: Any
|
||||
@@ -61,7 +61,7 @@ class _SentinelObject:
|
||||
class _Sentinel:
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
|
||||
sentinel: Any
|
||||
sentinel: _Sentinel
|
||||
DEFAULT: Any
|
||||
|
||||
_ArgsKwargs: TypeAlias = tuple[tuple[Any, ...], Mapping[str, Any]]
|
||||
@@ -428,7 +428,7 @@ class _ANY:
|
||||
def __ne__(self, other: object) -> Literal[False]: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
ANY: Any
|
||||
ANY: _ANY
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def create_autospec(
|
||||
|
||||
@@ -5,12 +5,12 @@ from typing_extensions import TypeAlias
|
||||
_T = TypeVar("_T")
|
||||
_Mismatch: TypeAlias = tuple[_T, _T, int]
|
||||
|
||||
_MAX_LENGTH: Final[int]
|
||||
_PLACEHOLDER_LEN: Final[int]
|
||||
_MIN_BEGIN_LEN: Final[int]
|
||||
_MIN_END_LEN: Final[int]
|
||||
_MIN_COMMON_LEN: Final[int]
|
||||
_MIN_DIFF_LEN: Final[int]
|
||||
_MAX_LENGTH: Final = 80
|
||||
_PLACEHOLDER_LEN: Final = 12
|
||||
_MIN_BEGIN_LEN: Final = 5
|
||||
_MIN_END_LEN: Final = 5
|
||||
_MIN_COMMON_LEN: Final = 5
|
||||
_MIN_DIFF_LEN: Final = 41
|
||||
|
||||
def _shorten(s: str, prefixlen: int, suffixlen: int) -> str: ...
|
||||
def _common_shorten_repr(*args: str) -> tuple[str, ...]: ...
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
from typing import Literal
|
||||
from typing import Final
|
||||
from xml.dom.minidom import Node
|
||||
|
||||
class NodeFilter:
|
||||
FILTER_ACCEPT: Literal[1]
|
||||
FILTER_REJECT: Literal[2]
|
||||
FILTER_SKIP: Literal[3]
|
||||
FILTER_ACCEPT: Final = 1
|
||||
FILTER_REJECT: Final = 2
|
||||
FILTER_SKIP: Final = 3
|
||||
|
||||
SHOW_ALL: int
|
||||
SHOW_ELEMENT: int
|
||||
SHOW_ATTRIBUTE: int
|
||||
SHOW_TEXT: int
|
||||
SHOW_CDATA_SECTION: int
|
||||
SHOW_ENTITY_REFERENCE: int
|
||||
SHOW_ENTITY: int
|
||||
SHOW_PROCESSING_INSTRUCTION: int
|
||||
SHOW_COMMENT: int
|
||||
SHOW_DOCUMENT: int
|
||||
SHOW_DOCUMENT_TYPE: int
|
||||
SHOW_DOCUMENT_FRAGMENT: int
|
||||
SHOW_NOTATION: int
|
||||
SHOW_ALL: Final = 0xFFFFFFFF
|
||||
SHOW_ELEMENT: Final = 0x00000001
|
||||
SHOW_ATTRIBUTE: Final = 0x00000002
|
||||
SHOW_TEXT: Final = 0x00000004
|
||||
SHOW_CDATA_SECTION: Final = 0x00000008
|
||||
SHOW_ENTITY_REFERENCE: Final = 0x00000010
|
||||
SHOW_ENTITY: Final = 0x00000020
|
||||
SHOW_PROCESSING_INSTRUCTION: Final = 0x00000040
|
||||
SHOW_COMMENT: Final = 0x00000080
|
||||
SHOW_DOCUMENT: Final = 0x00000100
|
||||
SHOW_DOCUMENT_TYPE: Final = 0x00000200
|
||||
SHOW_DOCUMENT_FRAGMENT: Final = 0x00000400
|
||||
SHOW_NOTATION: Final = 0x00000800
|
||||
def acceptNode(self, node: Node) -> int: ...
|
||||
|
||||
+16
-16
@@ -3,18 +3,18 @@ from typing import Any, Final, Literal
|
||||
from .domreg import getDOMImplementation as getDOMImplementation, registerDOMImplementation as registerDOMImplementation
|
||||
|
||||
class Node:
|
||||
ELEMENT_NODE: Literal[1]
|
||||
ATTRIBUTE_NODE: Literal[2]
|
||||
TEXT_NODE: Literal[3]
|
||||
CDATA_SECTION_NODE: Literal[4]
|
||||
ENTITY_REFERENCE_NODE: Literal[5]
|
||||
ENTITY_NODE: Literal[6]
|
||||
PROCESSING_INSTRUCTION_NODE: Literal[7]
|
||||
COMMENT_NODE: Literal[8]
|
||||
DOCUMENT_NODE: Literal[9]
|
||||
DOCUMENT_TYPE_NODE: Literal[10]
|
||||
DOCUMENT_FRAGMENT_NODE: Literal[11]
|
||||
NOTATION_NODE: Literal[12]
|
||||
ELEMENT_NODE: Final = 1
|
||||
ATTRIBUTE_NODE: Final = 2
|
||||
TEXT_NODE: Final = 3
|
||||
CDATA_SECTION_NODE: Final = 4
|
||||
ENTITY_REFERENCE_NODE: Final = 5
|
||||
ENTITY_NODE: Final = 6
|
||||
PROCESSING_INSTRUCTION_NODE: Final = 7
|
||||
COMMENT_NODE: Final = 8
|
||||
DOCUMENT_NODE: Final = 9
|
||||
DOCUMENT_TYPE_NODE: Final = 10
|
||||
DOCUMENT_FRAGMENT_NODE: Final = 11
|
||||
NOTATION_NODE: Final = 12
|
||||
|
||||
# ExceptionCode
|
||||
INDEX_SIZE_ERR: Final = 1
|
||||
@@ -88,10 +88,10 @@ class ValidationErr(DOMException):
|
||||
code: Literal[16]
|
||||
|
||||
class UserDataHandler:
|
||||
NODE_CLONED: Literal[1]
|
||||
NODE_IMPORTED: Literal[2]
|
||||
NODE_DELETED: Literal[3]
|
||||
NODE_RENAMED: Literal[4]
|
||||
NODE_CLONED: Final = 1
|
||||
NODE_IMPORTED: Final = 2
|
||||
NODE_DELETED: Final = 3
|
||||
NODE_RENAMED: Final = 4
|
||||
|
||||
XML_NAMESPACE: Final = "http://www.w3.org/XML/1998/namespace"
|
||||
XMLNS_NAMESPACE: Final = "http://www.w3.org/2000/xmlns/"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import ReadableBuffer, SupportsRead
|
||||
from typing import Any, NoReturn
|
||||
from typing import Any, Final, NoReturn
|
||||
from typing_extensions import TypeAlias
|
||||
from xml.dom.minidom import Document, DocumentFragment, DOMImplementation, Element, Node, TypeInfo
|
||||
from xml.dom.xmlbuilder import DOMBuilderFilter, Options
|
||||
@@ -7,13 +7,13 @@ from xml.parsers.expat import XMLParserType
|
||||
|
||||
_Model: TypeAlias = tuple[int, int, str | None, tuple[Any, ...]] # same as in pyexpat
|
||||
|
||||
TEXT_NODE = Node.TEXT_NODE
|
||||
CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE
|
||||
DOCUMENT_NODE = Node.DOCUMENT_NODE
|
||||
FILTER_ACCEPT = DOMBuilderFilter.FILTER_ACCEPT
|
||||
FILTER_REJECT = DOMBuilderFilter.FILTER_REJECT
|
||||
FILTER_SKIP = DOMBuilderFilter.FILTER_SKIP
|
||||
FILTER_INTERRUPT = DOMBuilderFilter.FILTER_INTERRUPT
|
||||
TEXT_NODE: Final = Node.TEXT_NODE
|
||||
CDATA_SECTION_NODE: Final = Node.CDATA_SECTION_NODE
|
||||
DOCUMENT_NODE: Final = Node.DOCUMENT_NODE
|
||||
FILTER_ACCEPT: Final = DOMBuilderFilter.FILTER_ACCEPT
|
||||
FILTER_REJECT: Final = DOMBuilderFilter.FILTER_REJECT
|
||||
FILTER_SKIP: Final = DOMBuilderFilter.FILTER_SKIP
|
||||
FILTER_INTERRUPT: Final = DOMBuilderFilter.FILTER_INTERRUPT
|
||||
theDOMImplementation: DOMImplementation
|
||||
|
||||
class ElementInfo:
|
||||
|
||||
@@ -99,7 +99,7 @@ class SAX2DOM(PullDOM):
|
||||
def ignorableWhitespace(self, chars: str) -> None: ...
|
||||
def characters(self, chars: str) -> None: ...
|
||||
|
||||
default_bufsize: int
|
||||
default_bufsize: Final[int]
|
||||
|
||||
def parse(
|
||||
stream_or_string: str | _SupportsReadClose[bytes] | _SupportsReadClose[str],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import SupportsRead
|
||||
from typing import Any, Literal, NoReturn
|
||||
from typing import Any, Final, Literal, NoReturn
|
||||
from xml.dom.minidom import Document, Node, _DOMErrorHandler
|
||||
|
||||
__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
|
||||
@@ -29,10 +29,10 @@ class DOMBuilder:
|
||||
entityResolver: DOMEntityResolver | None
|
||||
errorHandler: _DOMErrorHandler | None
|
||||
filter: DOMBuilderFilter | None
|
||||
ACTION_REPLACE: Literal[1]
|
||||
ACTION_APPEND_AS_CHILDREN: Literal[2]
|
||||
ACTION_INSERT_AFTER: Literal[3]
|
||||
ACTION_INSERT_BEFORE: Literal[4]
|
||||
ACTION_REPLACE: Final = 1
|
||||
ACTION_APPEND_AS_CHILDREN: Final = 2
|
||||
ACTION_INSERT_AFTER: Final = 3
|
||||
ACTION_INSERT_BEFORE: Final = 4
|
||||
def __init__(self) -> None: ...
|
||||
def setFeature(self, name: str, state: int) -> None: ...
|
||||
def supportsFeature(self, name: str) -> bool: ...
|
||||
@@ -56,10 +56,10 @@ class DOMInputSource:
|
||||
baseURI: str | None
|
||||
|
||||
class DOMBuilderFilter:
|
||||
FILTER_ACCEPT: Literal[1]
|
||||
FILTER_REJECT: Literal[2]
|
||||
FILTER_SKIP: Literal[3]
|
||||
FILTER_INTERRUPT: Literal[4]
|
||||
FILTER_ACCEPT: Final = 1
|
||||
FILTER_REJECT: Final = 2
|
||||
FILTER_SKIP: Final = 3
|
||||
FILTER_INTERRUPT: Final = 4
|
||||
whatToShow: int
|
||||
def acceptNode(self, element: Node) -> Literal[1, 2, 3, 4]: ...
|
||||
def startContainer(self, element: Node) -> Literal[1, 2, 3, 4]: ...
|
||||
@@ -72,8 +72,8 @@ class DocumentLS:
|
||||
def saveXML(self, snode: Node | None) -> str: ...
|
||||
|
||||
class DOMImplementationLS:
|
||||
MODE_SYNCHRONOUS: Literal[1]
|
||||
MODE_ASYNCHRONOUS: Literal[2]
|
||||
MODE_SYNCHRONOUS: Final = 1
|
||||
MODE_ASYNCHRONOUS: Final = 2
|
||||
def createDOMBuilder(self, mode: Literal[1], schemaType: None) -> DOMBuilder: ...
|
||||
def createDOMWriter(self) -> NoReturn: ...
|
||||
def createDOMInputSource(self) -> DOMInputSource: ...
|
||||
|
||||
@@ -9,9 +9,10 @@ class _Loader(Protocol):
|
||||
@overload
|
||||
def __call__(self, href: FileDescriptorOrPath, parse: Literal["text"], encoding: str | None = None) -> str: ...
|
||||
|
||||
XINCLUDE: Final[str]
|
||||
XINCLUDE_INCLUDE: Final[str]
|
||||
XINCLUDE_FALLBACK: Final[str]
|
||||
XINCLUDE: Final = "{http://www.w3.org/2001/XInclude}"
|
||||
|
||||
XINCLUDE_INCLUDE: Final = "{http://www.w3.org/2001/XInclude}include"
|
||||
XINCLUDE_FALLBACK: Final = "{http://www.w3.org/2001/XInclude}fallback"
|
||||
|
||||
DEFAULT_MAX_INCLUSION_DEPTH: Final = 6
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from collections.abc import Callable, Generator, Iterable
|
||||
from re import Pattern
|
||||
from typing import Any, Literal, TypeVar, overload
|
||||
from typing import Any, Final, Literal, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
xpath_tokenizer_re: Pattern[str]
|
||||
xpath_tokenizer_re: Final[Pattern[str]]
|
||||
|
||||
_Token: TypeAlias = tuple[str, str]
|
||||
_Next: TypeAlias = Callable[[], _Token]
|
||||
@@ -20,7 +20,7 @@ def prepare_descendant(next: _Next, token: _Token) -> _Callback | None: ...
|
||||
def prepare_parent(next: _Next, token: _Token) -> _Callback: ...
|
||||
def prepare_predicate(next: _Next, token: _Token) -> _Callback | None: ...
|
||||
|
||||
ops: dict[str, Callable[[_Next, _Token], _Callback | None]]
|
||||
ops: Final[dict[str, Callable[[_Next, _Token], _Callback | None]]]
|
||||
|
||||
class _SelectorContext:
|
||||
parent_map: dict[Element, Element] | None
|
||||
|
||||
@@ -181,7 +181,7 @@ class ElementTree(Generic[_Root]):
|
||||
) -> None: ...
|
||||
def write_c14n(self, file: _FileWriteC14N) -> None: ...
|
||||
|
||||
HTML_EMPTY: set[str]
|
||||
HTML_EMPTY: Final[set[str]]
|
||||
|
||||
def register_namespace(prefix: str, uri: str) -> None: ...
|
||||
@overload
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, StrPath, SupportsRead, _T_co
|
||||
from collections.abc import Iterable
|
||||
from typing import Protocol, type_check_only
|
||||
from typing import Final, Protocol, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
from xml.sax._exceptions import (
|
||||
SAXException as SAXException,
|
||||
@@ -19,7 +19,7 @@ class _SupportsReadClose(SupportsRead[_T_co], Protocol[_T_co]):
|
||||
|
||||
_Source: TypeAlias = StrPath | _SupportsReadClose[bytes] | _SupportsReadClose[str]
|
||||
|
||||
default_parser_list: list[str]
|
||||
default_parser_list: Final[list[str]]
|
||||
|
||||
def make_parser(parser_list: Iterable[str] = ()) -> XMLReader: ...
|
||||
def parse(source: _Source, handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, overload
|
||||
from typing import Any, Final, Literal, overload
|
||||
from typing_extensions import TypeAlias
|
||||
from xml.sax import _Source, xmlreader
|
||||
from xml.sax.handler import _ContentHandlerProtocol
|
||||
@@ -11,7 +11,7 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
_BoolType: TypeAlias = Literal[0, 1] | bool
|
||||
|
||||
version: str
|
||||
version: Final[str]
|
||||
AttributesImpl = xmlreader.AttributesImpl
|
||||
AttributesNSImpl = xmlreader.AttributesNSImpl
|
||||
|
||||
|
||||
+16
-16
@@ -1,8 +1,8 @@
|
||||
import sys
|
||||
from typing import Literal, NoReturn, Protocol, type_check_only
|
||||
from typing import Final, NoReturn, Protocol, type_check_only
|
||||
from xml.sax import xmlreader
|
||||
|
||||
version: str
|
||||
version: Final[str]
|
||||
|
||||
@type_check_only
|
||||
class _ErrorHandlerProtocol(Protocol): # noqa: Y046 # Protocol is not used
|
||||
@@ -62,20 +62,20 @@ class _EntityResolverProtocol(Protocol): # noqa: Y046 # Protocol is not used
|
||||
class EntityResolver:
|
||||
def resolveEntity(self, publicId: str | None, systemId: str) -> str: ...
|
||||
|
||||
feature_namespaces: str
|
||||
feature_namespace_prefixes: str
|
||||
feature_string_interning: str
|
||||
feature_validation: str
|
||||
feature_external_ges: str
|
||||
feature_external_pes: str
|
||||
all_features: list[str]
|
||||
property_lexical_handler: Literal["http://xml.org/sax/properties/lexical-handler"]
|
||||
property_declaration_handler: Literal["http://xml.org/sax/properties/declaration-handler"]
|
||||
property_dom_node: Literal["http://xml.org/sax/properties/dom-node"]
|
||||
property_xml_string: Literal["http://xml.org/sax/properties/xml-string"]
|
||||
property_encoding: Literal["http://www.python.org/sax/properties/encoding"]
|
||||
property_interning_dict: Literal["http://www.python.org/sax/properties/interning-dict"]
|
||||
all_properties: list[str]
|
||||
feature_namespaces: Final = "http://xml.org/sax/features/namespaces"
|
||||
feature_namespace_prefixes: Final = "http://xml.org/sax/features/namespace-prefixes"
|
||||
feature_string_interning: Final = "http://xml.org/sax/features/string-interning"
|
||||
feature_validation: Final = "http://xml.org/sax/features/validation"
|
||||
feature_external_ges: Final[str] # too long string
|
||||
feature_external_pes: Final[str] # too long string
|
||||
all_features: Final[list[str]]
|
||||
property_lexical_handler: Final = "http://xml.org/sax/properties/lexical-handler"
|
||||
property_declaration_handler: Final = "http://xml.org/sax/properties/declaration-handler"
|
||||
property_dom_node: Final = "http://xml.org/sax/properties/dom-node"
|
||||
property_xml_string: Final = "http://xml.org/sax/properties/xml-string"
|
||||
property_encoding: Final = "http://www.python.org/sax/properties/encoding"
|
||||
property_interning_dict: Final[str] # too long string
|
||||
all_properties: Final[list[str]]
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
class LexicalHandler:
|
||||
|
||||
Reference in New Issue
Block a user