mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:24:57 +00:00
[ty] Sync vendored typeshed stubs (#20083)
Co-authored-by: typeshedbot <> Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
parent
db423ee978
commit
ba47010150
84 changed files with 1733 additions and 846 deletions
|
@ -199,14 +199,13 @@ mod tests {
|
|||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:901:7
|
||||
--> stdlib/builtins.pyi:911:7
|
||||
|
|
||||
899 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
900 |
|
||||
901 | class str(Sequence[str]):
|
||||
910 | @disjoint_base
|
||||
911 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
902 | """str(object='') -> str
|
||||
903 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
912 | """str(object='') -> str
|
||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:1
|
||||
|
@ -228,14 +227,13 @@ mod tests {
|
|||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:901:7
|
||||
--> stdlib/builtins.pyi:911:7
|
||||
|
|
||||
899 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
900 |
|
||||
901 | class str(Sequence[str]):
|
||||
910 | @disjoint_base
|
||||
911 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
902 | """str(object='') -> str
|
||||
903 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
912 | """str(object='') -> str
|
||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
|
||||
info: Source
|
||||
--> main.py:2:10
|
||||
|
@ -344,14 +342,13 @@ mod tests {
|
|||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:901:7
|
||||
--> stdlib/builtins.pyi:911:7
|
||||
|
|
||||
899 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
900 |
|
||||
901 | class str(Sequence[str]):
|
||||
910 | @disjoint_base
|
||||
911 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
902 | """str(object='') -> str
|
||||
903 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
912 | """str(object='') -> str
|
||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:6
|
||||
|
@ -379,14 +376,13 @@ mod tests {
|
|||
// is an int. Navigating to `str` would match pyright's behavior.
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:337:7
|
||||
--> stdlib/builtins.pyi:344:7
|
||||
|
|
||||
335 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
||||
336 |
|
||||
337 | class int:
|
||||
343 | @disjoint_base
|
||||
344 | class int:
|
||||
| ^^^
|
||||
338 | """int([x]) -> integer
|
||||
339 | int(x, base=10) -> integer
|
||||
345 | """int([x]) -> integer
|
||||
346 | int(x, base=10) -> integer
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:6
|
||||
|
@ -411,16 +407,15 @@ f(**kwargs<CURSOR>)
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:2901:7
|
||||
--> stdlib/builtins.pyi:2917:7
|
||||
|
|
||||
2899 | """See PEP 585"""
|
||||
2900 |
|
||||
2901 | class dict(MutableMapping[_KT, _VT]):
|
||||
2916 | @disjoint_base
|
||||
2917 | class dict(MutableMapping[_KT, _VT]):
|
||||
| ^^^^
|
||||
2902 | """dict() -> new empty dictionary
|
||||
2903 | dict(mapping) -> new dictionary initialized from a mapping object's
|
||||
2918 | """dict() -> new empty dictionary
|
||||
2919 | dict(mapping) -> new dictionary initialized from a mapping object's
|
||||
|
|
||||
info: Source
|
||||
--> main.py:6:5
|
||||
|
@ -430,7 +425,7 @@ f(**kwargs<CURSOR>)
|
|||
6 | f(**kwargs)
|
||||
| ^^^^^^
|
||||
|
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -444,14 +439,13 @@ f(**kwargs<CURSOR>)
|
|||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:901:7
|
||||
--> stdlib/builtins.pyi:911:7
|
||||
|
|
||||
899 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
900 |
|
||||
901 | class str(Sequence[str]):
|
||||
910 | @disjoint_base
|
||||
911 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
902 | """str(object='') -> str
|
||||
903 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
912 | """str(object='') -> str
|
||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
|
||||
info: Source
|
||||
--> main.py:3:5
|
||||
|
@ -537,14 +531,13 @@ f(**kwargs<CURSOR>)
|
|||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:901:7
|
||||
--> stdlib/builtins.pyi:911:7
|
||||
|
|
||||
899 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
900 |
|
||||
901 | class str(Sequence[str]):
|
||||
910 | @disjoint_base
|
||||
911 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
902 | """str(object='') -> str
|
||||
903 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
912 | """str(object='') -> str
|
||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:15
|
||||
|
@ -568,13 +561,13 @@ f(**kwargs<CURSOR>)
|
|||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/types.pyi:922:11
|
||||
--> stdlib/types.pyi:941:11
|
||||
|
|
||||
920 | if sys.version_info >= (3, 10):
|
||||
921 | @final
|
||||
922 | class NoneType:
|
||||
939 | if sys.version_info >= (3, 10):
|
||||
940 | @final
|
||||
941 | class NoneType:
|
||||
| ^^^^^^^^
|
||||
923 | """The type of the None singleton."""
|
||||
942 | """The type of the None singleton."""
|
||||
|
|
||||
info: Source
|
||||
--> main.py:3:5
|
||||
|
@ -585,14 +578,13 @@ f(**kwargs<CURSOR>)
|
|||
|
|
||||
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:901:7
|
||||
--> stdlib/builtins.pyi:911:7
|
||||
|
|
||||
899 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
900 |
|
||||
901 | class str(Sequence[str]):
|
||||
910 | @disjoint_base
|
||||
911 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
902 | """str(object='') -> str
|
||||
903 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
912 | """str(object='') -> str
|
||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
|
||||
info: Source
|
||||
--> main.py:3:5
|
||||
|
|
|
@ -91,14 +91,14 @@ error[missing-argument]: No argument provided for required parameter `arg` of bo
|
|||
7 | from typing_extensions import deprecated
|
||||
|
|
||||
info: Parameter declared here
|
||||
--> stdlib/typing_extensions.pyi:973:28
|
||||
--> stdlib/typing_extensions.pyi:1000:28
|
||||
|
|
||||
971 | stacklevel: int
|
||||
972 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
|
||||
973 | def __call__(self, arg: _T, /) -> _T: ...
|
||||
998 | stacklevel: int
|
||||
999 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
|
||||
1000 | def __call__(self, arg: _T, /) -> _T: ...
|
||||
| ^^^^^^^
|
||||
974 |
|
||||
975 | @final
|
||||
1001 |
|
||||
1002 | @final
|
||||
|
|
||||
info: rule `missing-argument` is enabled by default
|
||||
|
||||
|
|
|
@ -26,14 +26,13 @@ error[invalid-await]: `Literal[1]` is not awaitable
|
|||
2 | await 1 # error: [invalid-await]
|
||||
| ^
|
||||
|
|
||||
::: stdlib/builtins.pyi:337:7
|
||||
::: stdlib/builtins.pyi:344:7
|
||||
|
|
||||
335 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
||||
336 |
|
||||
337 | class int:
|
||||
343 | @disjoint_base
|
||||
344 | class int:
|
||||
| --- type defined here
|
||||
338 | """int([x]) -> integer
|
||||
339 | int(x, base=10) -> integer
|
||||
345 | """int([x]) -> integer
|
||||
346 | int(x, base=10) -> integer
|
||||
|
|
||||
info: `__await__` is missing
|
||||
info: rule `invalid-await` is enabled by default
|
||||
|
|
|
@ -1409,7 +1409,12 @@ mod implicit_globals {
|
|||
/// Conceptually this function could be a `Set` rather than a list,
|
||||
/// but the number of symbols declared in this scope is likely to be very small,
|
||||
/// so the cost of hashing the names is likely to be more expensive than it's worth.
|
||||
#[salsa::tracked(returns(deref), heap_size=ruff_memory_usage::heap_size)]
|
||||
#[salsa::tracked(
|
||||
returns(deref),
|
||||
cycle_initial=module_type_symbols_initial,
|
||||
cycle_fn=module_type_symbols_cycle_recover,
|
||||
heap_size=ruff_memory_usage::heap_size
|
||||
)]
|
||||
fn module_type_symbols<'db>(db: &'db dyn Db) -> smallvec::SmallVec<[ast::name::Name; 8]> {
|
||||
let Some(module_type) = KnownClass::ModuleType
|
||||
.to_class_literal(db)
|
||||
|
@ -1437,6 +1442,18 @@ mod implicit_globals {
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn module_type_symbols_initial(_db: &dyn Db) -> smallvec::SmallVec<[ast::name::Name; 8]> {
|
||||
smallvec::SmallVec::default()
|
||||
}
|
||||
|
||||
fn module_type_symbols_cycle_recover(
|
||||
_db: &dyn Db,
|
||||
_value: &smallvec::SmallVec<[ast::name::Name; 8]>,
|
||||
_count: u32,
|
||||
) -> salsa::CycleRecoveryAction<smallvec::SmallVec<[ast::name::Name; 8]>> {
|
||||
salsa::CycleRecoveryAction::Iterate
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
@ -11726,6 +11726,14 @@ mod tests {
|
|||
fn unbound_symbol_no_reachability_constraint_check() {
|
||||
let mut db = setup_db();
|
||||
|
||||
// First, type-check a random other file so that we cache a result for the `module_type_symbols`
|
||||
// query (which often encounters cycles due to `types.pyi` importing `typing_extensions` and
|
||||
// `typing_extensions.pyi` importing `types`). Clear the events afterwards so that unrelated
|
||||
// cycles from that query don't interfere with our test.
|
||||
db.write_dedented("src/wherever.py", "print(x)").unwrap();
|
||||
assert_file_diagnostics(&db, "src/wherever.py", &["Name `x` used when not defined"]);
|
||||
db.clear_salsa_events();
|
||||
|
||||
// If the bug we are testing for is not fixed, what happens is that when inferring the
|
||||
// `flag: bool = True` definitions, we look up `bool` as a deferred name (thus from end of
|
||||
// scope), and because of the early return its "unbound" binding has a reachability
|
||||
|
|
|
@ -1 +1 @@
|
|||
f32d9f08bde8e42a3a35c050839d0275979eb3af
|
||||
91e2ed0953592795fd8c29e3005a1315bf652ffc
|
||||
|
|
|
@ -6,12 +6,13 @@ from collections.abc import Awaitable, Callable, Coroutine, Generator
|
|||
from contextvars import Context
|
||||
from types import FrameType, GenericAlias
|
||||
from typing import Any, Literal, TextIO, TypeVar
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_TaskYieldType: TypeAlias = Future[object] | None
|
||||
|
||||
@disjoint_base
|
||||
class Future(Awaitable[_T]):
|
||||
"""This class is *almost* compatible with concurrent.futures.Future.
|
||||
|
||||
|
@ -36,7 +37,7 @@ class Future(Awaitable[_T]):
|
|||
@_log_traceback.setter
|
||||
def _log_traceback(self, val: Literal[False]) -> None: ...
|
||||
_asyncio_future_blocking: bool # is a part of duck-typing contract for `Future`
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
def __del__(self) -> None:
|
||||
"""Called when the instance is about to be destroyed."""
|
||||
|
||||
|
@ -128,6 +129,7 @@ else:
|
|||
# While this is true in general, here it's sort-of okay to have a covariant subclass,
|
||||
# since the only reason why `asyncio.Future` is invariant is the `set_result()` method,
|
||||
# and `asyncio.Task.set_result()` always raises.
|
||||
@disjoint_base
|
||||
class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
|
||||
"""A coroutine wrapped in a Future."""
|
||||
|
||||
|
@ -137,7 +139,7 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
|
|||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
name: str | None = ...,
|
||||
name: str | None = None,
|
||||
context: Context | None = None,
|
||||
eager_start: bool = False,
|
||||
) -> None: ...
|
||||
|
@ -147,12 +149,12 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
|
|||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
name: str | None = ...,
|
||||
name: str | None = None,
|
||||
context: Context | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ...
|
||||
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = None
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""_blake2b provides BLAKE2b for hashlib"""
|
||||
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from typing import ClassVar, Final, final
|
||||
from typing_extensions import Self
|
||||
|
@ -24,6 +25,26 @@ class blake2b:
|
|||
block_size: int
|
||||
digest_size: int
|
||||
name: str
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
*,
|
||||
digest_size: int = 64,
|
||||
key: ReadableBuffer = b"",
|
||||
salt: ReadableBuffer = b"",
|
||||
person: ReadableBuffer = b"",
|
||||
fanout: int = 1,
|
||||
depth: int = 1,
|
||||
leaf_size: int = 0,
|
||||
node_offset: int = 0,
|
||||
node_depth: int = 0,
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
string: ReadableBuffer | None = None,
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
|
@ -42,6 +63,7 @@ class blake2b:
|
|||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
) -> Self: ...
|
||||
|
||||
def copy(self) -> Self:
|
||||
"""Return a copy of the hash object."""
|
||||
|
||||
|
@ -65,6 +87,26 @@ class blake2s:
|
|||
block_size: int
|
||||
digest_size: int
|
||||
name: str
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
*,
|
||||
digest_size: int = 32,
|
||||
key: ReadableBuffer = b"",
|
||||
salt: ReadableBuffer = b"",
|
||||
person: ReadableBuffer = b"",
|
||||
fanout: int = 1,
|
||||
depth: int = 1,
|
||||
leaf_size: int = 0,
|
||||
node_offset: int = 0,
|
||||
node_depth: int = 0,
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
string: ReadableBuffer | None = None,
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
|
@ -83,6 +125,7 @@ class blake2s:
|
|||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
) -> Self: ...
|
||||
|
||||
def copy(self) -> Self:
|
||||
"""Return a copy of the hash object."""
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
|||
from _typeshed import SupportsWrite
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Final, Literal, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
__version__: Final[str]
|
||||
|
||||
|
@ -26,6 +26,7 @@ class Error(Exception): ...
|
|||
|
||||
_DialectLike: TypeAlias = str | Dialect | csv.Dialect | type[Dialect | csv.Dialect]
|
||||
|
||||
@disjoint_base
|
||||
class Dialect:
|
||||
"""CSV dialect
|
||||
|
||||
|
@ -42,7 +43,7 @@ class Dialect:
|
|||
strict: bool
|
||||
def __new__(
|
||||
cls,
|
||||
dialect: _DialectLike | None = ...,
|
||||
dialect: _DialectLike | None = None,
|
||||
delimiter: str = ",",
|
||||
doublequote: bool = True,
|
||||
escapechar: str | None = None,
|
||||
|
@ -55,6 +56,7 @@ class Dialect:
|
|||
|
||||
if sys.version_info >= (3, 10):
|
||||
# This class calls itself _csv.reader.
|
||||
@disjoint_base
|
||||
class Reader:
|
||||
"""CSV reader
|
||||
|
||||
|
@ -72,6 +74,7 @@ if sys.version_info >= (3, 10):
|
|||
"""Implement next(self)."""
|
||||
|
||||
# This class calls itself _csv.writer.
|
||||
@disjoint_base
|
||||
class Writer:
|
||||
"""CSV writer
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ def newpad(nlines: int, ncols: int, /) -> window:
|
|||
Width.
|
||||
"""
|
||||
|
||||
def newwin(nlines: int, ncols: int, begin_y: int = ..., begin_x: int = ..., /) -> window:
|
||||
def newwin(nlines: int, ncols: int, begin_y: int = 0, begin_x: int = 0, /) -> window:
|
||||
"""newwin(nlines, ncols, [begin_y=0, begin_x=0])
|
||||
Return a new window.
|
||||
|
||||
|
@ -1016,7 +1016,7 @@ class window: # undocumented
|
|||
"""
|
||||
|
||||
@overload
|
||||
def box(self, vertch: _ChType = ..., horch: _ChType = ...) -> None: ...
|
||||
def box(self, vertch: _ChType = 0, horch: _ChType = 0) -> None: ...
|
||||
@overload
|
||||
def chgat(self, attr: int) -> None:
|
||||
"""chgat([y, x,] [n=-1,] attr)
|
||||
|
@ -1289,7 +1289,7 @@ class window: # undocumented
|
|||
@overload
|
||||
def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...
|
||||
@overload
|
||||
def instr(self, n: int = ...) -> bytes:
|
||||
def instr(self, n: int = 2047) -> bytes:
|
||||
"""instr([y, x,] n=2047)
|
||||
Return a string of characters, extracted from the window.
|
||||
|
||||
|
@ -1307,7 +1307,7 @@ class window: # undocumented
|
|||
"""
|
||||
|
||||
@overload
|
||||
def instr(self, y: int, x: int, n: int = ...) -> bytes: ...
|
||||
def instr(self, y: int, x: int, n: int = 2047) -> bytes: ...
|
||||
def is_linetouched(self, line: int, /) -> bool:
|
||||
"""Return True if the specified line was modified, otherwise return False.
|
||||
|
||||
|
@ -1415,7 +1415,7 @@ class window: # undocumented
|
|||
@overload
|
||||
def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ...
|
||||
def resize(self, nlines: int, ncols: int) -> None: ...
|
||||
def scroll(self, lines: int = ...) -> None:
|
||||
def scroll(self, lines: int = 1) -> None:
|
||||
"""scroll([lines=1])
|
||||
Scroll the screen or scrolling region.
|
||||
|
||||
|
@ -1483,7 +1483,7 @@ class window: # undocumented
|
|||
def syncok(self, flag: bool) -> None: ...
|
||||
def syncup(self) -> None: ...
|
||||
def timeout(self, delay: int) -> None: ...
|
||||
def touchline(self, start: int, count: int, changed: bool = ...) -> None:
|
||||
def touchline(self, start: int, count: int, changed: bool = True) -> None:
|
||||
"""touchline(start, count, [changed=True])
|
||||
Pretend count lines have been changed, starting with line start.
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ if sys.platform != "win32":
|
|||
@overload
|
||||
def get(self, k: _KeyType, default: _T, /) -> bytes | _T: ...
|
||||
def keys(self) -> list[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ..., /) -> bytes: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = b"", /) -> bytes: ...
|
||||
# This isn't true, but the class can't be instantiated. See #13024
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
|
|
|
@ -56,14 +56,14 @@ if sys.version_info >= (3, 11):
|
|||
def localcontext(
|
||||
ctx: Context | None = None,
|
||||
*,
|
||||
prec: int | None = ...,
|
||||
rounding: str | None = ...,
|
||||
Emin: int | None = ...,
|
||||
Emax: int | None = ...,
|
||||
capitals: int | None = ...,
|
||||
clamp: int | None = ...,
|
||||
traps: dict[_TrapType, bool] | None = ...,
|
||||
flags: dict[_TrapType, bool] | None = ...,
|
||||
prec: int | None = None,
|
||||
rounding: str | None = None,
|
||||
Emin: int | None = None,
|
||||
Emax: int | None = None,
|
||||
capitals: int | None = None,
|
||||
clamp: int | None = None,
|
||||
traps: dict[_TrapType, bool] | None = None,
|
||||
flags: dict[_TrapType, bool] | None = None,
|
||||
) -> _ContextManager:
|
||||
"""Return a context manager that will set the default context to a copy of ctx
|
||||
on entry to the with-statement and restore the previous default context when
|
||||
|
|
|
@ -5,7 +5,7 @@ from _typeshed import ReadableBuffer
|
|||
from collections.abc import Callable
|
||||
from types import ModuleType
|
||||
from typing import AnyStr, Protocol, final, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
_DigestMod: TypeAlias = str | Callable[[], _HashObject] | ModuleType | None
|
||||
|
||||
|
@ -24,6 +24,7 @@ class _HashObject(Protocol):
|
|||
def hexdigest(self) -> str: ...
|
||||
def update(self, obj: ReadableBuffer, /) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class HASH:
|
||||
"""A hash is an object used to calculate a checksum of a string of information.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ The 'interpreters' module provides a more convenient interface.
|
|||
import types
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Final, Literal, SupportsIndex, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, disjoint_base
|
||||
|
||||
_R = TypeVar("_R")
|
||||
|
||||
|
@ -20,6 +20,7 @@ class InterpreterNotFoundError(InterpreterError):
|
|||
|
||||
class NotShareableError(ValueError): ...
|
||||
|
||||
@disjoint_base
|
||||
class CrossInterpreterBufferView:
|
||||
def __buffer__(self, flags: int, /) -> memoryview:
|
||||
"""Return a buffer object that exposes the underlying memory of the object."""
|
||||
|
|
176
crates/ty_vendored/vendor/typeshed/stdlib/_io.pyi
vendored
176
crates/ty_vendored/vendor/typeshed/stdlib/_io.pyi
vendored
|
@ -41,10 +41,13 @@ from io import BufferedIOBase, RawIOBase, TextIOBase, UnsupportedOperation as Un
|
|||
from os import _Opener
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Final, Generic, Literal, Protocol, TextIO, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, disjoint_base
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
DEFAULT_BUFFER_SIZE: Final = 131072
|
||||
else:
|
||||
DEFAULT_BUFFER_SIZE: Final = 8192
|
||||
|
||||
open = builtins.open
|
||||
|
@ -58,6 +61,8 @@ def open_code(path: str) -> IO[bytes]:
|
|||
|
||||
BlockingIOError = builtins.BlockingIOError
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
@disjoint_base
|
||||
class _IOBase:
|
||||
"""The abstract base class for all I/O classes.
|
||||
|
||||
|
@ -203,6 +208,150 @@ class _IOBase:
|
|||
def closed(self) -> bool: ...
|
||||
def _checkClosed(self) -> None: ... # undocumented
|
||||
|
||||
else:
|
||||
class _IOBase:
|
||||
"""The abstract base class for all I/O classes.
|
||||
|
||||
This class provides dummy implementations for many methods that
|
||||
derived classes can override selectively; the default implementations
|
||||
represent a file that cannot be read, written or seeked.
|
||||
|
||||
Even though IOBase does not declare read, readinto, or write because
|
||||
their signatures will vary, implementations and clients should
|
||||
consider those methods part of the interface. Also, implementations
|
||||
may raise UnsupportedOperation when operations they do not support are
|
||||
called.
|
||||
|
||||
The basic type used for binary data read from or written to a file is
|
||||
bytes. Other bytes-like objects are accepted as method arguments too.
|
||||
In some cases (such as readinto), a writable object is required. Text
|
||||
I/O classes work with str data.
|
||||
|
||||
Note that calling any method (except additional calls to close(),
|
||||
which are ignored) on a closed stream should raise a ValueError.
|
||||
|
||||
IOBase (and its subclasses) support the iterator protocol, meaning
|
||||
that an IOBase object can be iterated over yielding the lines in a
|
||||
stream.
|
||||
|
||||
IOBase also supports the :keyword:`with` statement. In this example,
|
||||
fp is closed after the suite of the with statement is complete:
|
||||
|
||||
with open('spam.txt', 'r') as fp:
|
||||
fp.write('Spam and eggs!')
|
||||
"""
|
||||
|
||||
def __iter__(self) -> Iterator[bytes]:
|
||||
"""Implement iter(self)."""
|
||||
|
||||
def __next__(self) -> bytes:
|
||||
"""Implement next(self)."""
|
||||
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def close(self) -> None:
|
||||
"""Flush and close the IO object.
|
||||
|
||||
This method has no effect if the file is already closed.
|
||||
"""
|
||||
|
||||
def fileno(self) -> int:
|
||||
"""Returns underlying file descriptor if one exists.
|
||||
|
||||
OSError is raised if the IO object does not use a file descriptor.
|
||||
"""
|
||||
|
||||
def flush(self) -> None:
|
||||
"""Flush write buffers, if applicable.
|
||||
|
||||
This is not implemented for read-only and non-blocking streams.
|
||||
"""
|
||||
|
||||
def isatty(self) -> bool:
|
||||
"""Return whether this is an 'interactive' stream.
|
||||
|
||||
Return False if it can't be determined.
|
||||
"""
|
||||
|
||||
def readable(self) -> bool:
|
||||
"""Return whether object was opened for reading.
|
||||
|
||||
If False, read() will raise OSError.
|
||||
"""
|
||||
read: Callable[..., Any]
|
||||
def readlines(self, hint: int = -1, /) -> list[bytes]:
|
||||
"""Return a list of lines from the stream.
|
||||
|
||||
hint can be specified to control the number of lines read: no more
|
||||
lines will be read if the total size (in bytes/characters) of all
|
||||
lines so far exceeds hint.
|
||||
"""
|
||||
|
||||
def seek(self, offset: int, whence: int = 0, /) -> int:
|
||||
"""Change the stream position to the given byte offset.
|
||||
|
||||
offset
|
||||
The stream position, relative to 'whence'.
|
||||
whence
|
||||
The relative position to seek from.
|
||||
|
||||
The offset is interpreted relative to the position indicated by whence.
|
||||
Values for whence are:
|
||||
|
||||
* os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
|
||||
* os.SEEK_CUR or 1 -- current stream position; offset may be negative
|
||||
* os.SEEK_END or 2 -- end of stream; offset is usually negative
|
||||
|
||||
Return the new absolute position.
|
||||
"""
|
||||
|
||||
def seekable(self) -> bool:
|
||||
"""Return whether object supports random access.
|
||||
|
||||
If False, seek(), tell() and truncate() will raise OSError.
|
||||
This method may need to do a test seek().
|
||||
"""
|
||||
|
||||
def tell(self) -> int:
|
||||
"""Return current stream position."""
|
||||
|
||||
def truncate(self, size: int | None = None, /) -> int:
|
||||
"""Truncate file to size bytes.
|
||||
|
||||
File pointer is left unchanged. Size defaults to the current IO
|
||||
position as reported by tell(). Returns the new size.
|
||||
"""
|
||||
|
||||
def writable(self) -> bool:
|
||||
"""Return whether object was opened for writing.
|
||||
|
||||
If False, write() will raise OSError.
|
||||
"""
|
||||
write: Callable[..., Any]
|
||||
def writelines(self, lines: Iterable[ReadableBuffer], /) -> None:
|
||||
"""Write a list of lines to stream.
|
||||
|
||||
Line separators are not added, so it is usual for each of the
|
||||
lines provided to have a line separator at the end.
|
||||
"""
|
||||
|
||||
def readline(self, size: int | None = -1, /) -> bytes:
|
||||
"""Read and return a line from the stream.
|
||||
|
||||
If size is specified, at most size bytes will be read.
|
||||
|
||||
The line terminator is always b'\\n' for binary files; for text
|
||||
files, the newlines argument to open can be used to select the line
|
||||
terminator(s) recognized.
|
||||
"""
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def _checkClosed(self) -> None: ... # undocumented
|
||||
|
||||
class _RawIOBase(_IOBase):
|
||||
"""Base class for raw binary I/O."""
|
||||
|
||||
|
@ -275,6 +424,7 @@ class _BufferedIOBase(_IOBase):
|
|||
A short result does not imply that EOF is imminent.
|
||||
"""
|
||||
|
||||
@disjoint_base
|
||||
class FileIO(RawIOBase, _RawIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes
|
||||
"""Open a file.
|
||||
|
||||
|
@ -328,6 +478,7 @@ class FileIO(RawIOBase, _RawIOBase, BinaryIO): # type: ignore[misc] # incompat
|
|||
bytes object at EOF.
|
||||
"""
|
||||
|
||||
@disjoint_base
|
||||
class BytesIO(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
||||
"""Buffered I/O implementation using an in-memory bytes buffer."""
|
||||
|
||||
|
@ -395,15 +546,21 @@ class _BufferedReaderStream(Protocol):
|
|||
|
||||
_BufferedReaderStreamT = TypeVar("_BufferedReaderStreamT", bound=_BufferedReaderStream, default=_BufferedReaderStream)
|
||||
|
||||
@disjoint_base
|
||||
class BufferedReader(BufferedIOBase, _BufferedIOBase, BinaryIO, Generic[_BufferedReaderStreamT]): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
||||
"""Create a new buffered reader using the given readable raw IO object."""
|
||||
|
||||
raw: _BufferedReaderStreamT
|
||||
if sys.version_info >= (3, 14):
|
||||
def __init__(self, raw: _BufferedReaderStreamT, buffer_size: int = 131072) -> None: ...
|
||||
else:
|
||||
def __init__(self, raw: _BufferedReaderStreamT, buffer_size: int = 8192) -> None: ...
|
||||
|
||||
def peek(self, size: int = 0, /) -> bytes: ...
|
||||
def seek(self, target: int, whence: int = 0, /) -> int: ...
|
||||
def truncate(self, pos: int | None = None, /) -> int: ...
|
||||
|
||||
@disjoint_base
|
||||
class BufferedWriter(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes
|
||||
"""A buffer for a writeable sequential RawIO object.
|
||||
|
||||
|
@ -413,11 +570,16 @@ class BufferedWriter(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore
|
|||
"""
|
||||
|
||||
raw: RawIOBase
|
||||
if sys.version_info >= (3, 14):
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = 131072) -> None: ...
|
||||
else:
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = 8192) -> None: ...
|
||||
|
||||
def write(self, buffer: ReadableBuffer, /) -> int: ...
|
||||
def seek(self, target: int, whence: int = 0, /) -> int: ...
|
||||
def truncate(self, pos: int | None = None, /) -> int: ...
|
||||
|
||||
@disjoint_base
|
||||
class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
||||
"""A buffered interface to random access streams.
|
||||
|
||||
|
@ -429,11 +591,16 @@ class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore
|
|||
mode: str
|
||||
name: Any
|
||||
raw: RawIOBase
|
||||
if sys.version_info >= (3, 14):
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = 131072) -> None: ...
|
||||
else:
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = 8192) -> None: ...
|
||||
|
||||
def seek(self, target: int, whence: int = 0, /) -> int: ... # stubtest needs this
|
||||
def peek(self, size: int = 0, /) -> bytes: ...
|
||||
def truncate(self, pos: int | None = None, /) -> int: ...
|
||||
|
||||
@disjoint_base
|
||||
class BufferedRWPair(BufferedIOBase, _BufferedIOBase, Generic[_BufferedReaderStreamT]):
|
||||
"""A buffered reader and writer object together.
|
||||
|
||||
|
@ -446,7 +613,11 @@ class BufferedRWPair(BufferedIOBase, _BufferedIOBase, Generic[_BufferedReaderStr
|
|||
DEFAULT_BUFFER_SIZE.
|
||||
"""
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __init__(self, reader: _BufferedReaderStreamT, writer: RawIOBase, buffer_size: int = 131072, /) -> None: ...
|
||||
else:
|
||||
def __init__(self, reader: _BufferedReaderStreamT, writer: RawIOBase, buffer_size: int = 8192, /) -> None: ...
|
||||
|
||||
def peek(self, size: int = 0, /) -> bytes: ...
|
||||
|
||||
class _TextIOBase(_IOBase):
|
||||
|
@ -533,6 +704,7 @@ class _WrappedBuffer(Protocol):
|
|||
|
||||
_BufferT_co = TypeVar("_BufferT_co", bound=_WrappedBuffer, default=_WrappedBuffer, covariant=True)
|
||||
|
||||
@disjoint_base
|
||||
class TextIOWrapper(TextIOBase, _TextIOBase, TextIO, Generic[_BufferT_co]): # type: ignore[misc] # incompatible definitions of write in the base classes
|
||||
"""Character and line based layer over a BufferedIOBase object, buffer.
|
||||
|
||||
|
@ -622,6 +794,7 @@ class TextIOWrapper(TextIOBase, _TextIOBase, TextIO, Generic[_BufferT_co]): # t
|
|||
|
||||
def truncate(self, pos: int | None = None, /) -> int: ...
|
||||
|
||||
@disjoint_base
|
||||
class StringIO(TextIOBase, _TextIOBase, TextIO): # type: ignore[misc] # incompatible definitions of write in the base classes
|
||||
"""Text I/O implementation using an in-memory buffer.
|
||||
|
||||
|
@ -657,6 +830,7 @@ class StringIO(TextIOBase, _TextIOBase, TextIO): # type: ignore[misc] # incomp
|
|||
Returns the new absolute position.
|
||||
"""
|
||||
|
||||
@disjoint_base
|
||||
class IncrementalNewlineDecoder:
|
||||
"""Codec used when reading a file in universal newlines mode.
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ from _typeshed import structseq
|
|||
from collections.abc import Callable
|
||||
from types import CodeType
|
||||
from typing import Any, Final, final
|
||||
from typing_extensions import disjoint_base
|
||||
|
||||
@disjoint_base
|
||||
class Profiler:
|
||||
"""Build a profiler object using the specified timer function.
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ class LZMADecompressor:
|
|||
"""
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> Self: ...
|
||||
def __new__(cls, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None) -> Self: ...
|
||||
else:
|
||||
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
|
||||
def __init__(self, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None) -> None: ...
|
||||
|
||||
def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes:
|
||||
"""Decompress *data*, returning uncompressed data as bytes.
|
||||
|
@ -127,11 +127,11 @@ class LZMACompressor:
|
|||
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(
|
||||
cls, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
cls, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
self, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None
|
||||
) -> None: ...
|
||||
|
||||
def compress(self, data: ReadableBuffer, /) -> bytes:
|
||||
|
|
|
@ -2,6 +2,7 @@ from _typeshed import ReadableBuffer
|
|||
from codecs import _ReadableStream, _WritableStream
|
||||
from collections.abc import Iterable
|
||||
from typing import final, type_check_only
|
||||
from typing_extensions import disjoint_base
|
||||
|
||||
# This class is not exposed. It calls itself _multibytecodec.MultibyteCodec.
|
||||
@final
|
||||
|
@ -10,6 +11,7 @@ class _MultibyteCodec:
|
|||
def decode(self, input: ReadableBuffer, errors: str | None = None) -> str: ...
|
||||
def encode(self, input: str, errors: str | None = None) -> bytes: ...
|
||||
|
||||
@disjoint_base
|
||||
class MultibyteIncrementalDecoder:
|
||||
errors: str
|
||||
def __init__(self, errors: str = "strict") -> None: ...
|
||||
|
@ -18,6 +20,7 @@ class MultibyteIncrementalDecoder:
|
|||
def reset(self) -> None: ...
|
||||
def setstate(self, state: tuple[bytes, int], /) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class MultibyteIncrementalEncoder:
|
||||
errors: str
|
||||
def __init__(self, errors: str = "strict") -> None: ...
|
||||
|
@ -26,6 +29,7 @@ class MultibyteIncrementalEncoder:
|
|||
def reset(self) -> None: ...
|
||||
def setstate(self, state: int, /) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class MultibyteStreamReader:
|
||||
errors: str
|
||||
stream: _ReadableStream
|
||||
|
@ -35,6 +39,7 @@ class MultibyteStreamReader:
|
|||
def readlines(self, sizehintobj: int | None = None, /) -> list[str]: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class MultibyteStreamWriter:
|
||||
errors: str
|
||||
stream: _WritableStream
|
||||
|
|
|
@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer, SupportsWrite
|
|||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from pickle import PickleBuffer as PickleBuffer
|
||||
from typing import Any, Protocol, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, disjoint_base
|
||||
|
||||
@type_check_only
|
||||
class _ReadableFileobj(Protocol):
|
||||
|
@ -145,6 +145,7 @@ class PicklerMemoProxy:
|
|||
def clear(self, /) -> None: ...
|
||||
def copy(self, /) -> dict[int, tuple[int, Any]]: ...
|
||||
|
||||
@disjoint_base
|
||||
class Pickler:
|
||||
"""This takes a binary file for writing a pickle data stream.
|
||||
|
||||
|
@ -212,6 +213,7 @@ class UnpicklerMemoProxy:
|
|||
def clear(self, /) -> None: ...
|
||||
def copy(self, /) -> dict[int, tuple[int, Any]]: ...
|
||||
|
||||
@disjoint_base
|
||||
class Unpickler:
|
||||
"""This takes a binary file for reading a pickle data stream.
|
||||
|
||||
|
|
|
@ -4,12 +4,14 @@ This module is an implementation detail, please do not use it directly.
|
|||
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar
|
||||
from typing_extensions import disjoint_base
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class Empty(Exception):
|
||||
"""Exception raised by Queue.get(block=0)/get_nowait()."""
|
||||
|
||||
@disjoint_base
|
||||
class SimpleQueue(Generic[_T]):
|
||||
"""Simple, unbounded, reentrant FIFO queue."""
|
||||
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
"""Module implements the Mersenne Twister random number generator."""
|
||||
|
||||
from typing_extensions import TypeAlias
|
||||
import sys
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
# Actually Tuple[(int,) * 625]
|
||||
_State: TypeAlias = tuple[int, ...]
|
||||
|
||||
@disjoint_base
|
||||
class Random:
|
||||
"""Random() -> create a random number generator with its own internal state."""
|
||||
|
||||
def __init__(self, seed: object = ...) -> None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, seed: object = ..., /) -> None: ...
|
||||
else:
|
||||
def __new__(self, seed: object = ..., /) -> Self: ...
|
||||
|
||||
def seed(self, n: object = None, /) -> None:
|
||||
"""seed([n]) -> None.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from _typeshed import ReadableBuffer, WriteableBuffer
|
|||
from collections.abc import Iterable
|
||||
from socket import error as error, gaierror as gaierror, herror as herror, timeout as timeout
|
||||
from typing import Any, Final, SupportsIndex, overload
|
||||
from typing_extensions import CapsuleType, TypeAlias
|
||||
from typing_extensions import CapsuleType, TypeAlias, disjoint_base
|
||||
|
||||
_CMSG: TypeAlias = tuple[int, int, bytes]
|
||||
_CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
|
||||
|
@ -736,6 +736,7 @@ if sys.platform != "win32" and sys.platform != "darwin":
|
|||
|
||||
# ===== Classes =====
|
||||
|
||||
@disjoint_base
|
||||
class socket:
|
||||
"""socket(family=AF_INET, type=SOCK_STREAM, proto=0) -> socket object
|
||||
socket(family=-1, type=-1, proto=-1, fileno=None) -> socket object
|
||||
|
|
|
@ -17,7 +17,7 @@ from ssl import (
|
|||
SSLZeroReturnError as SSLZeroReturnError,
|
||||
)
|
||||
from typing import Any, ClassVar, Final, Literal, TypedDict, final, overload, type_check_only
|
||||
from typing_extensions import NotRequired, Self, TypeAlias, deprecated
|
||||
from typing_extensions import NotRequired, Self, TypeAlias, deprecated, disjoint_base
|
||||
|
||||
_PasswordType: TypeAlias = Callable[[], str | bytes | bytearray] | str | bytes | bytearray
|
||||
_PCTRTT: TypeAlias = tuple[tuple[str, str], ...]
|
||||
|
@ -117,6 +117,7 @@ def txt2obj(txt: str, name: bool = False) -> tuple[int, str, str, str]:
|
|||
def nid2obj(nid: int, /) -> tuple[int, str, str, str]:
|
||||
"""Lookup NID, short name, long name and OID of an ASN1_OBJECT by NID."""
|
||||
|
||||
@disjoint_base
|
||||
class _SSLContext:
|
||||
check_hostname: bool
|
||||
keylog_filename: str | None
|
||||
|
|
|
@ -31,6 +31,7 @@ The variable struct.error is an exception raised on errors.
|
|||
from _typeshed import ReadableBuffer, WriteableBuffer
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from typing_extensions import disjoint_base
|
||||
|
||||
def pack(fmt: str | bytes, /, *v: Any) -> bytes:
|
||||
"""pack(format, v1, v2, ...) -> bytes
|
||||
|
@ -76,6 +77,7 @@ def iter_unpack(format: str | bytes, buffer: ReadableBuffer, /) -> Iterator[tupl
|
|||
def calcsize(format: str | bytes, /) -> int:
|
||||
"""Return size in bytes of the struct described by the format string."""
|
||||
|
||||
@disjoint_base
|
||||
class Struct:
|
||||
"""Struct(fmt) --> compiled struct object"""
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from collections.abc import Callable
|
|||
from threading import Thread
|
||||
from types import TracebackType
|
||||
from typing import Any, Final, NoReturn, final, overload
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
from typing_extensions import TypeVarTuple, Unpack, disjoint_base
|
||||
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
|
@ -361,6 +361,7 @@ if sys.version_info >= (3, 14):
|
|||
def set_name(name: str) -> None:
|
||||
"""Set the name of the current thread."""
|
||||
|
||||
@disjoint_base
|
||||
class _local:
|
||||
"""Thread-local data"""
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ Unused: TypeAlias = object # stable
|
|||
|
||||
# Marker for return types that include None, but where forcing the user to
|
||||
# check for None can be detrimental. Sometimes called "the Any trick". See
|
||||
# CONTRIBUTING.md for more information.
|
||||
# https://typing.python.org/en/latest/guides/writing_stubs.html#the-any-trick
|
||||
# for more information.
|
||||
MaybeNone: TypeAlias = Any # stable
|
||||
|
||||
# Used to mark arguments that default to a sentinel value. This prevents
|
||||
|
|
|
@ -60,9 +60,9 @@ def warn_explicit(
|
|||
filename: str,
|
||||
lineno: int,
|
||||
module: str | None = ...,
|
||||
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
|
||||
module_globals: dict[str, Any] | None = ...,
|
||||
source: Any | None = ...,
|
||||
registry: dict[str | tuple[str, type[Warning], int], int] | None = None,
|
||||
module_globals: dict[str, Any] | None = None,
|
||||
source: Any | None = None,
|
||||
) -> None:
|
||||
"""Issue a warning, or maybe ignore it or raise an exception."""
|
||||
|
||||
|
@ -72,8 +72,8 @@ def warn_explicit(
|
|||
category: Any,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
module: str | None = ...,
|
||||
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
|
||||
module_globals: dict[str, Any] | None = ...,
|
||||
source: Any | None = ...,
|
||||
module: str | None = None,
|
||||
registry: dict[str | tuple[str, type[Warning], int], int] | None = None,
|
||||
module_globals: dict[str, Any] | None = None,
|
||||
source: Any | None = None,
|
||||
) -> None: ...
|
||||
|
|
|
@ -60,9 +60,9 @@ class ZstdCompressor:
|
|||
CONTINUE: Final = 0
|
||||
FLUSH_BLOCK: Final = 1
|
||||
FLUSH_FRAME: Final = 2
|
||||
def __init__(
|
||||
self, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
|
||||
) -> None: ...
|
||||
def __new__(
|
||||
cls, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
|
||||
) -> Self: ...
|
||||
def compress(
|
||||
self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
|
||||
) -> bytes:
|
||||
|
@ -126,7 +126,7 @@ class ZstdDecompressor:
|
|||
function instead.
|
||||
"""
|
||||
|
||||
def __init__(self, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> None: ...
|
||||
def __new__(cls, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> Self: ...
|
||||
def decompress(self, /, data: ReadableBuffer, max_length: int = -1) -> bytes:
|
||||
"""Decompress *data*, returning uncompressed bytes if possible, or b'' otherwise.
|
||||
|
||||
|
@ -188,7 +188,7 @@ class ZstdDict:
|
|||
by multiple ZstdCompressor or ZstdDecompressor objects.
|
||||
"""
|
||||
|
||||
def __init__(self, dict_content: bytes, /, *, is_raw: bool = False) -> None: ...
|
||||
def __new__(cls, dict_content: bytes, /, *, is_raw: bool = False) -> Self: ...
|
||||
def __len__(self, /) -> int:
|
||||
"""Return len(self)."""
|
||||
|
||||
|
|
|
@ -42,6 +42,20 @@ if sys.version_info >= (3, 14):
|
|||
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
"__forward_is_argument__",
|
||||
"__forward_is_class__",
|
||||
"__forward_module__",
|
||||
"__weakref__",
|
||||
"__arg__",
|
||||
"__globals__",
|
||||
"__extra_names__",
|
||||
"__code__",
|
||||
"__ast_node__",
|
||||
"__cell__",
|
||||
"__owner__",
|
||||
"__stringifier_dict__",
|
||||
)
|
||||
__forward_is_argument__: bool
|
||||
__forward_is_class__: bool
|
||||
__forward_module__: str | None
|
||||
|
|
|
@ -260,7 +260,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||
exit_on_error: bool = True,
|
||||
*,
|
||||
suggest_on_error: bool = False,
|
||||
color: bool = False,
|
||||
color: bool = True,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
|
|
|
@ -9,7 +9,7 @@ from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite
|
|||
from collections.abc import Iterable, MutableSequence
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Literal, SupportsIndex, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
from typing_extensions import Self, TypeAlias, deprecated, disjoint_base
|
||||
|
||||
_IntTypeCode: TypeAlias = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
|
||||
_FloatTypeCode: TypeAlias = Literal["f", "d"]
|
||||
|
@ -23,6 +23,7 @@ _T = TypeVar("_T", int, float, str)
|
|||
|
||||
typecodes: str
|
||||
|
||||
@disjoint_base
|
||||
class array(MutableSequence[_T]):
|
||||
"""array(typecode [, initializer]) -> array
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ from _ast import (
|
|||
from _typeshed import ReadableBuffer, Unused
|
||||
from collections.abc import Iterable, Iterator, Sequence
|
||||
from typing import Any, ClassVar, Generic, Literal, TypedDict, TypeVar as _TypeVar, overload, type_check_only
|
||||
from typing_extensions import Self, Unpack, deprecated
|
||||
from typing_extensions import Self, Unpack, deprecated, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
from _ast import PyCF_OPTIMIZED_AST as PyCF_OPTIMIZED_AST
|
||||
|
@ -53,8 +53,9 @@ class _Attributes(TypedDict, Generic[_EndPositionT], total=False):
|
|||
# The various AST classes are implemented in C, and imported from _ast at runtime,
|
||||
# but they consider themselves to live in the ast module,
|
||||
# so we'll define the stubs in this file.
|
||||
if sys.version_info >= (3, 12):
|
||||
@disjoint_base
|
||||
class AST:
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ()
|
||||
_attributes: ClassVar[tuple[str, ...]]
|
||||
_fields: ClassVar[tuple[str, ...]]
|
||||
|
@ -65,6 +66,13 @@ class AST:
|
|||
def __replace__(self) -> Self:
|
||||
"""Return a copy of the AST node with new values for the specified fields."""
|
||||
|
||||
else:
|
||||
class AST:
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ()
|
||||
_attributes: ClassVar[tuple[str, ...]]
|
||||
_fields: ClassVar[tuple[str, ...]]
|
||||
|
||||
class mod(AST):
|
||||
"""mod = Module(stmt* body, type_ignore* type_ignores)
|
||||
| Interactive(stmt* body)
|
||||
|
|
|
@ -25,7 +25,7 @@ from asyncio.transports import BaseTransport, DatagramTransport, ReadTransport,
|
|||
from collections.abc import Callable, Iterable, Sequence
|
||||
from concurrent.futures import Executor, ThreadPoolExecutor
|
||||
from contextvars import Context
|
||||
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Literal, TypeVar, overload
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
|
||||
|
||||
|
@ -392,8 +392,8 @@ class BaseEventLoop(AbstractEventLoop):
|
|||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = 0,
|
||||
flags: int = 1,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -427,8 +427,8 @@ class BaseEventLoop(AbstractEventLoop):
|
|||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = 0,
|
||||
flags: int = 1,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -447,8 +447,8 @@ class BaseEventLoop(AbstractEventLoop):
|
|||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -481,8 +481,8 @@ class BaseEventLoop(AbstractEventLoop):
|
|||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -500,8 +500,8 @@ class BaseEventLoop(AbstractEventLoop):
|
|||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -533,8 +533,8 @@ class BaseEventLoop(AbstractEventLoop):
|
|||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
|
|
@ -13,7 +13,7 @@ from abc import ABCMeta, abstractmethod
|
|||
from collections.abc import Callable, Sequence
|
||||
from concurrent.futures import Executor
|
||||
from contextvars import Context
|
||||
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Literal, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias, TypeVarTuple, Unpack, deprecated
|
||||
|
||||
|
@ -352,8 +352,8 @@ class AbstractEventLoop:
|
|||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -424,8 +424,8 @@ class AbstractEventLoop:
|
|||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -445,8 +445,8 @@ class AbstractEventLoop:
|
|||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -513,8 +513,8 @@ class AbstractEventLoop:
|
|||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -533,8 +533,8 @@ class AbstractEventLoop:
|
|||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -596,8 +596,8 @@ class AbstractEventLoop:
|
|||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
family: int = AddressFamily.AF_UNSPEC,
|
||||
flags: int = AddressInfo.AI_PASSIVE,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
|
@ -872,7 +872,7 @@ class AbstractEventLoop:
|
|||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = ...,
|
||||
text: Literal[False] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> tuple[SubprocessTransport, _ProtocolT]: ...
|
||||
@abstractmethod
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
"""Introspection utils for tasks call graphs."""
|
||||
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from asyncio import Future
|
||||
from dataclasses import dataclass
|
||||
from types import FrameType
|
||||
from typing import Any, overload
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = ("capture_call_graph", "format_call_graph", "print_call_graph", "FrameCallGraphEntry", "FutureCallGraph")
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class FrameCallGraphEntry:
|
||||
"""FrameCallGraphEntry(frame: frame)"""
|
||||
|
||||
frame: FrameType
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class FutureCallGraph:
|
||||
"""FutureCallGraph(future: _asyncio.Future, call_stack: tuple['FrameCallGraphEntry', ...], awaited_by: tuple['FutureCallGraph', ...])"""
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ if sys.version_info >= (3, 10):
|
|||
port: int | str | None = None,
|
||||
*,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
**kwds: Any,
|
||||
) -> tuple[StreamReader, StreamWriter]:
|
||||
"""A wrapper for create_connection() returning a (reader, writer) pair.
|
||||
|
@ -61,7 +61,7 @@ if sys.version_info >= (3, 10):
|
|||
port: int | str | None = None,
|
||||
*,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
**kwds: Any,
|
||||
) -> Server:
|
||||
"""Start a socket server, call back for each client connected.
|
||||
|
@ -92,7 +92,7 @@ else:
|
|||
*,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
**kwds: Any,
|
||||
) -> tuple[StreamReader, StreamWriter]:
|
||||
"""A wrapper for create_connection() returning a (reader, writer) pair.
|
||||
|
@ -120,7 +120,7 @@ else:
|
|||
*,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
**kwds: Any,
|
||||
) -> Server:
|
||||
"""Start a socket server, call back for each client connected.
|
||||
|
|
|
@ -64,7 +64,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
|
@ -96,7 +96,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
|
@ -130,7 +130,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
|
@ -161,7 +161,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
|
@ -195,7 +195,7 @@ else: # >= 3.9
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
|
@ -226,7 +226,7 @@ else: # >= 3.9
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
|
|
|
@ -70,7 +70,7 @@ class TransportSocket:
|
|||
@deprecated("Removed in Python 3.11")
|
||||
def makefile(self) -> BinaryIO: ...
|
||||
@deprecated("Rmoved in Python 3.11")
|
||||
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
|
||||
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def close(self) -> None: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
|
@ -78,17 +78,22 @@ class TransportSocket:
|
|||
if sys.platform == "linux":
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def sendmsg_afalg(
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = 0
|
||||
) -> int: ...
|
||||
else:
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendmsg_afalg(
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = 0
|
||||
) -> NoReturn: ...
|
||||
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendmsg(
|
||||
self, buffers: Iterable[ReadableBuffer], ancdata: Iterable[_CMSG] = ..., flags: int = ..., address: _Address = ..., /
|
||||
self,
|
||||
buffers: Iterable[ReadableBuffer],
|
||||
ancdata: Iterable[_CMSG] = ...,
|
||||
flags: int = 0,
|
||||
address: _Address | None = None,
|
||||
/,
|
||||
) -> int: ...
|
||||
@overload
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
|
@ -97,9 +102,9 @@ class TransportSocket:
|
|||
@deprecated("Removed in Python 3.11.")
|
||||
def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def send(self, data: ReadableBuffer, flags: int = ...) -> int: ...
|
||||
def send(self, data: ReadableBuffer, flags: int = 0) -> int: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ...
|
||||
def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def set_inheritable(self, inheritable: bool) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
|
@ -110,19 +115,19 @@ class TransportSocket:
|
|||
def share(self, process_id: int) -> NoReturn: ...
|
||||
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
|
||||
def recv_into(self, buffer: _WriteBuffer, nbytes: int = 0, flags: int = 0) -> int: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
|
||||
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = 0, flags: int = 0) -> tuple[int, _RetAddress]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvmsg_into(
|
||||
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = ..., flags: int = ..., /
|
||||
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = 0, flags: int = 0, /
|
||||
) -> tuple[int, list[_CMSG], int, Any]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]: ...
|
||||
def recvmsg(self, bufsize: int, ancbufsize: int = 0, flags: int = 0, /) -> tuple[bytes, list[_CMSG], int, Any]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ...
|
||||
def recvfrom(self, bufsize: int, flags: int = 0) -> tuple[bytes, _RetAddress]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
def recv(self, bufsize: int, flags: int = 0) -> bytes: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def __enter__(self) -> socket.socket: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
|
|
|
@ -140,6 +140,6 @@ if sys.platform == "win32":
|
|||
if sys.version_info >= (3, 14):
|
||||
_DefaultEventLoopPolicy = _WindowsProactorEventLoopPolicy
|
||||
else:
|
||||
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
|
||||
DefaultEventLoopPolicy = WindowsProactorEventLoopPolicy
|
||||
if sys.version_info >= (3, 13):
|
||||
EventLoop = ProactorEventLoop
|
||||
|
|
|
@ -47,9 +47,9 @@ if sys.platform == "win32":
|
|||
def __new__(
|
||||
cls,
|
||||
args: subprocess._CMD,
|
||||
stdin: subprocess._FILE | None = ...,
|
||||
stdout: subprocess._FILE | None = ...,
|
||||
stderr: subprocess._FILE | None = ...,
|
||||
stdin: subprocess._FILE | None = None,
|
||||
stdout: subprocess._FILE | None = None,
|
||||
stderr: subprocess._FILE | None = None,
|
||||
**kwds: Any,
|
||||
) -> Self: ...
|
||||
def __init__(
|
||||
|
|
|
@ -64,7 +64,7 @@ def crc_hqx(data: ReadableBuffer, crc: int, /) -> int:
|
|||
def crc32(data: ReadableBuffer, crc: int = 0, /) -> int:
|
||||
"""Compute CRC-32 incrementally."""
|
||||
|
||||
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes:
|
||||
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = 1) -> bytes:
|
||||
"""Hexadecimal representation of binary data.
|
||||
|
||||
sep
|
||||
|
@ -85,7 +85,7 @@ def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = .
|
|||
b'b9_01ef'
|
||||
"""
|
||||
|
||||
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes:
|
||||
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = 1) -> bytes:
|
||||
"""Hexadecimal representation of binary data.
|
||||
|
||||
sep
|
||||
|
|
|
@ -83,6 +83,7 @@ from typing_extensions import ( # noqa: Y023
|
|||
TypeIs,
|
||||
TypeVarTuple,
|
||||
deprecated,
|
||||
disjoint_base,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
|
@ -115,6 +116,7 @@ _StopT_co = TypeVar("_StopT_co", covariant=True, default=_StartT_co) # slice[A
|
|||
# FIXME: https://github.com/python/typing/issues/213 (replace step=start|stop with step=start&stop)
|
||||
_StepT_co = TypeVar("_StepT_co", covariant=True, default=_StartT_co | _StopT_co) # slice[A,B] -> slice[A, B, A|B]
|
||||
|
||||
@disjoint_base
|
||||
class object:
|
||||
"""The base class of the class hierarchy.
|
||||
|
||||
|
@ -156,6 +158,7 @@ class object:
|
|||
@classmethod
|
||||
def __subclasshook__(cls, subclass: type, /) -> bool: ...
|
||||
|
||||
@disjoint_base
|
||||
class staticmethod(Generic[_P, _R_co]):
|
||||
"""Convert a function to be a static method.
|
||||
|
||||
|
@ -197,6 +200,7 @@ class staticmethod(Generic[_P, _R_co]):
|
|||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
__annotate__: AnnotateFunc | None
|
||||
|
||||
@disjoint_base
|
||||
class classmethod(Generic[_T, _P, _R_co]):
|
||||
"""Convert a function to be a class method.
|
||||
|
||||
|
@ -238,6 +242,7 @@ class classmethod(Generic[_T, _P, _R_co]):
|
|||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
__annotate__: AnnotateFunc | None
|
||||
|
||||
@disjoint_base
|
||||
class type:
|
||||
"""type(object) -> the object's type
|
||||
type(name, bases, dict, **kwds) -> a new type
|
||||
|
@ -307,6 +312,7 @@ class type:
|
|||
if sys.version_info >= (3, 14):
|
||||
__annotate__: AnnotateFunc | None
|
||||
|
||||
@disjoint_base
|
||||
class super:
|
||||
"""super() -> same as super(__class__, <first argument>)
|
||||
super(type) -> unbound super object
|
||||
|
@ -334,6 +340,7 @@ _PositiveInteger: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
|||
_NegativeInteger: TypeAlias = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]
|
||||
_LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
||||
|
||||
@disjoint_base
|
||||
class int:
|
||||
"""int([x]) -> integer
|
||||
int(x, base=10) -> integer
|
||||
|
@ -646,6 +653,7 @@ class int:
|
|||
def __format__(self, format_spec: str, /) -> str:
|
||||
"""Convert to a string according to format_spec."""
|
||||
|
||||
@disjoint_base
|
||||
class float:
|
||||
"""Convert a string or number to a floating-point number, if possible."""
|
||||
|
||||
|
@ -806,6 +814,7 @@ class float:
|
|||
def from_number(cls, number: float | SupportsIndex | SupportsFloat, /) -> Self:
|
||||
"""Convert real number to a floating-point number."""
|
||||
|
||||
@disjoint_base
|
||||
class complex:
|
||||
"""Create a complex number from a string or numbers.
|
||||
|
||||
|
@ -898,6 +907,7 @@ class _FormatMapMapping(Protocol):
|
|||
class _TranslateTable(Protocol):
|
||||
def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
||||
@disjoint_base
|
||||
class str(Sequence[str]):
|
||||
"""str(object='') -> str
|
||||
str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||
|
@ -1430,6 +1440,7 @@ class str(Sequence[str]):
|
|||
def __format__(self, format_spec: str, /) -> str:
|
||||
"""Return a formatted version of the string as described by format_spec."""
|
||||
|
||||
@disjoint_base
|
||||
class bytes(Sequence[int]):
|
||||
"""bytes(iterable_of_ints) -> bytes
|
||||
bytes(string, encoding[, errors]) -> bytes
|
||||
|
@ -1881,6 +1892,7 @@ class bytes(Sequence[int]):
|
|||
def __buffer__(self, flags: int, /) -> memoryview:
|
||||
"""Return a buffer object that exposes the underlying memory of the object."""
|
||||
|
||||
@disjoint_base
|
||||
class bytearray(MutableSequence[int]):
|
||||
"""bytearray(iterable_of_ints) -> bytearray
|
||||
bytearray(string, encoding[, errors]) -> bytearray
|
||||
|
@ -2675,6 +2687,8 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]):
|
|||
handling of normal slices.
|
||||
"""
|
||||
|
||||
# Making this a disjoint_base upsets pyright
|
||||
# @disjoint_base
|
||||
class tuple(Sequence[_T_co]):
|
||||
"""Built-in immutable sequence.
|
||||
|
||||
|
@ -2781,6 +2795,7 @@ class function:
|
|||
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
|
||||
def __get__(self, instance: object, owner: type | None = None, /) -> Any: ...
|
||||
|
||||
@disjoint_base
|
||||
class list(MutableSequence[_T]):
|
||||
"""Built-in mutable sequence.
|
||||
|
||||
|
@ -2898,6 +2913,7 @@ class list(MutableSequence[_T]):
|
|||
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
||||
"""See PEP 585"""
|
||||
|
||||
@disjoint_base
|
||||
class dict(MutableMapping[_KT, _VT]):
|
||||
"""dict() -> new empty dictionary
|
||||
dict(mapping) -> new dictionary initialized from a mapping object's
|
||||
|
@ -3027,6 +3043,7 @@ class dict(MutableMapping[_KT, _VT]):
|
|||
@overload
|
||||
def __ior__(self, value: Iterable[tuple[_KT, _VT]], /) -> Self: ...
|
||||
|
||||
@disjoint_base
|
||||
class set(MutableSet[_T]):
|
||||
"""Build an unordered collection of unique elements."""
|
||||
|
||||
|
@ -3131,6 +3148,7 @@ class set(MutableSet[_T]):
|
|||
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
||||
"""See PEP 585"""
|
||||
|
||||
@disjoint_base
|
||||
class frozenset(AbstractSet[_T_co]):
|
||||
"""Build an immutable unordered collection of unique elements."""
|
||||
|
||||
|
@ -3192,6 +3210,7 @@ class frozenset(AbstractSet[_T_co]):
|
|||
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
||||
"""See PEP 585"""
|
||||
|
||||
@disjoint_base
|
||||
class enumerate(Generic[_T]):
|
||||
"""Return an enumerate object.
|
||||
|
||||
|
@ -3265,6 +3284,7 @@ class range(Sequence[int]):
|
|||
def __reversed__(self) -> Iterator[int]:
|
||||
"""Return a reverse iterator."""
|
||||
|
||||
@disjoint_base
|
||||
class property:
|
||||
"""Property attribute.
|
||||
|
||||
|
@ -3599,6 +3619,7 @@ else:
|
|||
|
||||
exit: _sitebuiltins.Quitter
|
||||
|
||||
@disjoint_base
|
||||
class filter(Generic[_T]):
|
||||
"""Return an iterator yielding those items of iterable for which function(item)
|
||||
is true. If function is None, return the items that are true.
|
||||
|
@ -3752,6 +3773,7 @@ def locals() -> dict[str, Any]:
|
|||
covered by any backwards compatibility guarantees.
|
||||
"""
|
||||
|
||||
@disjoint_base
|
||||
class map(Generic[_S]):
|
||||
"""Make an iterator that computes the function using arguments from
|
||||
each of the iterables. Stops when the shortest iterable is exhausted.
|
||||
|
@ -4231,6 +4253,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
|
|||
|
||||
quit: _sitebuiltins.Quitter
|
||||
|
||||
@disjoint_base
|
||||
class reversed(Generic[_T]):
|
||||
"""Return a reverse iterator over the values of the given sequence."""
|
||||
|
||||
|
@ -4335,7 +4358,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]:
|
|||
|
||||
@overload
|
||||
def vars(object: Any = ..., /) -> dict[str, Any]: ...
|
||||
|
||||
@disjoint_base
|
||||
class zip(Generic[_T_co]):
|
||||
"""The zip object yields n-length tuples, where n is the number of iterables
|
||||
passed as positional arguments to zip(). The i-th element in every tuple
|
||||
|
@ -4475,6 +4498,7 @@ else:
|
|||
|
||||
Ellipsis: ellipsis
|
||||
|
||||
@disjoint_base
|
||||
class BaseException:
|
||||
"""Common base class for all exceptions"""
|
||||
|
||||
|
@ -4500,6 +4524,7 @@ class GeneratorExit(BaseException):
|
|||
class KeyboardInterrupt(BaseException):
|
||||
"""Program interrupted by user."""
|
||||
|
||||
@disjoint_base
|
||||
class SystemExit(BaseException):
|
||||
"""Request to exit from the interpreter."""
|
||||
|
||||
|
@ -4508,11 +4533,13 @@ class SystemExit(BaseException):
|
|||
class Exception(BaseException):
|
||||
"""Common base class for all non-exit exceptions."""
|
||||
|
||||
@disjoint_base
|
||||
class StopIteration(Exception):
|
||||
"""Signal the end from iterator.__next__()."""
|
||||
|
||||
value: Any
|
||||
|
||||
@disjoint_base
|
||||
class OSError(Exception):
|
||||
"""Base class for I/O related errors."""
|
||||
|
||||
|
@ -4535,20 +4562,26 @@ class ArithmeticError(Exception):
|
|||
class AssertionError(Exception):
|
||||
"""Assertion failed."""
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@disjoint_base
|
||||
class AttributeError(Exception):
|
||||
"""Attribute not found."""
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, *args: object, name: str | None = ..., obj: object = ...) -> None: ...
|
||||
name: str
|
||||
obj: object
|
||||
|
||||
else:
|
||||
class AttributeError(Exception):
|
||||
"""Attribute not found."""
|
||||
|
||||
class BufferError(Exception):
|
||||
"""Buffer error."""
|
||||
|
||||
class EOFError(Exception):
|
||||
"""Read beyond end of file."""
|
||||
|
||||
@disjoint_base
|
||||
class ImportError(Exception):
|
||||
"""Import can't find module, or can't find name in module."""
|
||||
|
||||
|
@ -4565,13 +4598,18 @@ class LookupError(Exception):
|
|||
class MemoryError(Exception):
|
||||
"""Out of memory."""
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@disjoint_base
|
||||
class NameError(Exception):
|
||||
"""Name not found globally."""
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, *args: object, name: str | None = ...) -> None: ...
|
||||
name: str
|
||||
|
||||
else:
|
||||
class NameError(Exception):
|
||||
"""Name not found globally."""
|
||||
|
||||
class ReferenceError(Exception):
|
||||
"""Weak ref proxy used after referent went away."""
|
||||
|
||||
|
@ -4581,6 +4619,7 @@ class RuntimeError(Exception):
|
|||
class StopAsyncIteration(Exception):
|
||||
"""Signal the end from iterator.__anext__()."""
|
||||
|
||||
@disjoint_base
|
||||
class SyntaxError(Exception):
|
||||
"""Invalid syntax."""
|
||||
|
||||
|
@ -4708,6 +4747,7 @@ class TabError(IndentationError):
|
|||
class UnicodeError(ValueError):
|
||||
"""Unicode related error."""
|
||||
|
||||
@disjoint_base
|
||||
class UnicodeDecodeError(UnicodeError):
|
||||
"""Unicode decoding error."""
|
||||
|
||||
|
@ -4718,6 +4758,7 @@ class UnicodeDecodeError(UnicodeError):
|
|||
reason: str
|
||||
def __init__(self, encoding: str, object: ReadableBuffer, start: int, end: int, reason: str, /) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class UnicodeEncodeError(UnicodeError):
|
||||
"""Unicode encoding error."""
|
||||
|
||||
|
@ -4728,6 +4769,7 @@ class UnicodeEncodeError(UnicodeError):
|
|||
reason: str
|
||||
def __init__(self, encoding: str, object: str, start: int, end: int, reason: str, /) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class UnicodeTranslateError(UnicodeError):
|
||||
"""Unicode translation error."""
|
||||
|
||||
|
@ -4790,6 +4832,7 @@ if sys.version_info >= (3, 11):
|
|||
_ExceptionT = TypeVar("_ExceptionT", bound=Exception)
|
||||
|
||||
# See `check_exception_group.py` for use-cases and comments.
|
||||
@disjoint_base
|
||||
class BaseExceptionGroup(BaseException, Generic[_BaseExceptionT_co]):
|
||||
"""A combination of multiple unrelated exceptions."""
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ ValueError being raised during parsing. The default value of this variable is 0,
|
|||
meaning the request size is unlimited.
|
||||
"""
|
||||
|
||||
import os
|
||||
from _typeshed import SupportsContainsAndGetItem, SupportsGetItem, SupportsItemAccess, Unused
|
||||
from builtins import list as _list, type as _type
|
||||
from collections.abc import Iterable, Iterator, Mapping
|
||||
|
@ -34,7 +35,7 @@ __all__ = [
|
|||
|
||||
def parse(
|
||||
fp: IO[Any] | None = None,
|
||||
environ: SupportsItemAccess[str, str] = ...,
|
||||
environ: SupportsItemAccess[str, str] = os.environ,
|
||||
keep_blank_values: bool = ...,
|
||||
strict_parsing: bool = ...,
|
||||
separator: str = "&",
|
||||
|
@ -90,7 +91,7 @@ def parse_header(line: str) -> tuple[str, dict[str, str]]:
|
|||
|
||||
"""
|
||||
|
||||
def test(environ: _Environ = ...) -> None:
|
||||
def test(environ: _Environ = os.environ) -> None:
|
||||
"""Robust test CGI script, usable as main program.
|
||||
|
||||
Write minimal HTTP headers and dump all information provided to
|
||||
|
@ -98,7 +99,7 @@ def test(environ: _Environ = ...) -> None:
|
|||
|
||||
"""
|
||||
|
||||
def print_environ(environ: _Environ = ...) -> None:
|
||||
def print_environ(environ: _Environ = os.environ) -> None:
|
||||
"""Dump the shell environment as HTML."""
|
||||
|
||||
def print_form(form: dict[str, Any]) -> None:
|
||||
|
@ -197,7 +198,7 @@ class FieldStorage:
|
|||
fp: IO[Any] | None = None,
|
||||
headers: Mapping[str, str] | Message | None = None,
|
||||
outerboundary: bytes = b"",
|
||||
environ: SupportsContainsAndGetItem[str, str] = ...,
|
||||
environ: SupportsContainsAndGetItem[str, str] = os.environ,
|
||||
keep_blank_values: int = 0,
|
||||
strict_parsing: int = 0,
|
||||
limit: int | None = None,
|
||||
|
|
|
@ -7,13 +7,14 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
|
|||
|
||||
"""
|
||||
|
||||
import sys
|
||||
import types
|
||||
from _codecs import *
|
||||
from _typeshed import ReadableBuffer
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Generator, Iterable
|
||||
from typing import Any, BinaryIO, ClassVar, Final, Literal, Protocol, TextIO, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
__all__ = [
|
||||
"register",
|
||||
|
@ -131,6 +132,39 @@ class _IncrementalDecoder(Protocol):
|
|||
class _BufferedIncrementalDecoder(Protocol):
|
||||
def __call__(self, errors: str = ...) -> BufferedIncrementalDecoder: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
"""Codec details when looking up the codec registry"""
|
||||
|
||||
_is_text_encoding: bool
|
||||
@property
|
||||
def encode(self) -> _Encoder: ...
|
||||
@property
|
||||
def decode(self) -> _Decoder: ...
|
||||
@property
|
||||
def streamreader(self) -> _StreamReader: ...
|
||||
@property
|
||||
def streamwriter(self) -> _StreamWriter: ...
|
||||
@property
|
||||
def incrementalencoder(self) -> _IncrementalEncoder: ...
|
||||
@property
|
||||
def incrementaldecoder(self) -> _IncrementalDecoder: ...
|
||||
name: str
|
||||
def __new__(
|
||||
cls,
|
||||
encode: _Encoder,
|
||||
decode: _Decoder,
|
||||
streamreader: _StreamReader | None = None,
|
||||
streamwriter: _StreamWriter | None = None,
|
||||
incrementalencoder: _IncrementalEncoder | None = None,
|
||||
incrementaldecoder: _IncrementalDecoder | None = None,
|
||||
name: str | None = None,
|
||||
*,
|
||||
_is_text_encoding: bool | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
"""Codec details when looking up the codec registry"""
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from _collections_abc import dict_items, dict_keys, dict_values
|
|||
from _typeshed import SupportsItems, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Generic, NoReturn, SupportsIndex, TypeVar, final, overload, type_check_only
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from collections.abc import (
|
||||
|
@ -271,6 +271,7 @@ class UserString(Sequence[UserString]):
|
|||
def upper(self) -> Self: ...
|
||||
def zfill(self, width: int) -> Self: ...
|
||||
|
||||
@disjoint_base
|
||||
class deque(MutableSequence[_T]):
|
||||
"""A list-like sequence optimized for data accesses near its endpoints."""
|
||||
|
||||
|
@ -645,6 +646,7 @@ class _odict_items(dict_items[_KT_co, _VT_co]): # type: ignore[misc] # pyright
|
|||
class _odict_values(dict_values[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||
def __reversed__(self) -> Iterator[_VT_co]: ...
|
||||
|
||||
@disjoint_base
|
||||
class OrderedDict(dict[_KT, _VT]):
|
||||
"""Dictionary that remembers insertion order"""
|
||||
|
||||
|
@ -717,6 +719,7 @@ class OrderedDict(dict[_KT, _VT]):
|
|||
@overload
|
||||
def __ror__(self, value: dict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc]
|
||||
|
||||
@disjoint_base
|
||||
class defaultdict(dict[_KT, _VT]):
|
||||
"""defaultdict(default_factory=None, /, [...]) --> dict with default factory
|
||||
|
||||
|
@ -852,15 +855,23 @@ class ChainMap(MutableMapping[_KT, _VT]):
|
|||
__copy__ = copy
|
||||
# All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime,
|
||||
# so the signature should be kept in line with `dict.fromkeys`.
|
||||
if sys.version_info >= (3, 13):
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T], /) -> ChainMap[_T, Any | None]:
|
||||
"""Create a new ChainMap with keys from iterable and values set to value."""
|
||||
else:
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T]) -> ChainMap[_T, Any | None]:
|
||||
"""Create a new ChainMap with keys from iterable and values set to value."""
|
||||
"""Create a ChainMap with a single dict created from the iterable."""
|
||||
|
||||
@classmethod
|
||||
@overload
|
||||
# Special-case None: the user probably wants to add non-None values later.
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: None, /) -> ChainMap[_T, Any | None]: ...
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: None, /) -> ChainMap[_T, Any | None]:
|
||||
"""Create a new ChainMap with keys from iterable and values set to value."""
|
||||
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> ChainMap[_T, _S]: ...
|
||||
|
|
|
@ -39,6 +39,7 @@ COMPRESSION_LEVEL_DEFAULT: Final = _zstd.ZSTD_CLEVEL_DEFAULT
|
|||
class FrameInfo:
|
||||
"""Information about a Zstandard frame."""
|
||||
|
||||
__slots__ = ("decompressed_size", "dictionary_id")
|
||||
decompressed_size: int
|
||||
dictionary_id: int
|
||||
def __init__(self, decompressed_size: int, dictionary_id: int) -> None: ...
|
||||
|
|
|
@ -22,6 +22,7 @@ if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <
|
|||
cross-interpreter container is destroyed.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
def __new__(cls) -> Never: ...
|
||||
@classonly
|
||||
def singleton(cls, kind: str, module: str, name: str = "UNBOUND") -> Self:
|
||||
|
|
|
@ -77,7 +77,7 @@ if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <
|
|||
timeout: SupportsIndex | None = None,
|
||||
*,
|
||||
unbounditems: _AnyUnbound | None = None,
|
||||
_delay: float = ...,
|
||||
_delay: float = 0.01,
|
||||
) -> None:
|
||||
"""Add the object to the queue.
|
||||
|
||||
|
@ -116,7 +116,7 @@ if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <
|
|||
"""
|
||||
|
||||
def put_nowait(self, obj: object, *, unbounditems: _AnyUnbound | None = None) -> None: ...
|
||||
def get(self, timeout: SupportsIndex | None = None, *, _delay: float = ...) -> object:
|
||||
def get(self, timeout: SupportsIndex | None = None, *, _delay: float = 0.01) -> object:
|
||||
"""Return the next object from the queue.
|
||||
|
||||
This blocks while the queue is empty.
|
||||
|
|
|
@ -784,10 +784,13 @@ class ParsingError(Error):
|
|||
def __init__(self, source: str) -> None: ...
|
||||
else:
|
||||
@overload
|
||||
def __init__(self, source: str, filename: None = None) -> None: ...
|
||||
def __init__(self, source: str) -> None: ...
|
||||
@overload
|
||||
@deprecated("The `filename` parameter removed in Python 3.12. Use `source` instead.")
|
||||
def __init__(self, source: None = None, filename: str = ...) -> None: ...
|
||||
def __init__(self, source: None, filename: str | None) -> None: ...
|
||||
@overload
|
||||
@deprecated("The `filename` parameter removed in Python 3.12. Use `source` instead.")
|
||||
def __init__(self, source: None = None, *, filename: str | None) -> None: ...
|
||||
|
||||
def append(self, lineno: int, line: str) -> None: ...
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import sys
|
||||
from typing import Final, NamedTuple, type_check_only
|
||||
from typing_extensions import disjoint_base
|
||||
|
||||
if sys.platform != "win32":
|
||||
@type_check_only
|
||||
|
@ -11,6 +12,14 @@ if sys.platform != "win32":
|
|||
salt_chars: int
|
||||
total_size: int
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class _Method(_MethodBase):
|
||||
"""Class representing a salt method per the Modular Crypt Format or the
|
||||
legacy 2-character crypt method.
|
||||
"""
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class _Method(_MethodBase):
|
||||
"""Class representing a salt method per the Modular Crypt Format or the
|
||||
legacy 2-character crypt method.
|
||||
|
|
|
@ -8,7 +8,7 @@ import sys
|
|||
from abc import abstractmethod
|
||||
from time import struct_time
|
||||
from typing import ClassVar, Final, NoReturn, SupportsIndex, final, overload, type_check_only
|
||||
from typing_extensions import CapsuleType, Self, TypeAlias, deprecated
|
||||
from typing_extensions import CapsuleType, Self, TypeAlias, deprecated, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC")
|
||||
|
@ -74,6 +74,7 @@ class _IsoCalendarDate(tuple[int, int, int]):
|
|||
@property
|
||||
def weekday(self) -> int: ...
|
||||
|
||||
@disjoint_base
|
||||
class date:
|
||||
"""date(year, month, day) --> date object"""
|
||||
|
||||
|
@ -181,6 +182,7 @@ class date:
|
|||
def isocalendar(self) -> _IsoCalendarDate:
|
||||
"""Return a named tuple containing ISO year, week number, and weekday."""
|
||||
|
||||
@disjoint_base
|
||||
class time:
|
||||
"""time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object
|
||||
|
||||
|
@ -284,6 +286,7 @@ class time:
|
|||
_Date: TypeAlias = date
|
||||
_Time: TypeAlias = time
|
||||
|
||||
@disjoint_base
|
||||
class timedelta:
|
||||
"""Difference between two datetime values.
|
||||
|
||||
|
@ -376,6 +379,7 @@ class timedelta:
|
|||
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@disjoint_base
|
||||
class datetime(date):
|
||||
"""datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ from _decimal import (
|
|||
from collections.abc import Container, Sequence
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Literal, NamedTuple, final, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
from _decimal import IEEE_CONTEXT_MAX_BITS as IEEE_CONTEXT_MAX_BITS, IEEEContext as IEEEContext
|
||||
|
@ -170,6 +170,7 @@ class Overflow(Inexact, Rounded): ...
|
|||
class Underflow(Inexact, Rounded, Subnormal): ...
|
||||
class FloatOperation(DecimalException, TypeError): ...
|
||||
|
||||
@disjoint_base
|
||||
class Decimal:
|
||||
"""Construct a new Decimal object. 'value' can be an integer, string, tuple,
|
||||
or another Decimal object. If no value is given, return Decimal('0'). The
|
||||
|
@ -693,6 +694,7 @@ class Decimal:
|
|||
def __deepcopy__(self, memo: Any, /) -> Self: ...
|
||||
def __format__(self, specifier: str, context: Context | None = None, /) -> str: ...
|
||||
|
||||
@disjoint_base
|
||||
class Context:
|
||||
"""The context affects almost all operations and controls rounding,
|
||||
Over/Underflow, raising of exceptions and much more. A new context
|
||||
|
|
|
@ -5,7 +5,7 @@ import types
|
|||
from collections.abc import Callable, Iterator
|
||||
from opcode import * # `dis` re-exports it as a part of public API
|
||||
from typing import IO, Any, Final, NamedTuple
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
__all__ = [
|
||||
"code_info",
|
||||
|
@ -98,6 +98,7 @@ else:
|
|||
starts_line: int | None
|
||||
is_jump_target: bool
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class Instruction(_Instruction):
|
||||
"""Details for a bytecode operation.
|
||||
|
||||
|
@ -180,6 +181,32 @@ class Instruction(_Instruction):
|
|||
cache_info: list[tuple[str, int, Any]] | None = None,
|
||||
) -> Instruction: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class Instruction(_Instruction):
|
||||
"""Details for a bytecode operation
|
||||
|
||||
Defined fields:
|
||||
opname - human readable name for operation
|
||||
opcode - numeric code for operation
|
||||
arg - numeric argument to operation (if any), otherwise None
|
||||
argval - resolved arg value (if known), otherwise same as arg
|
||||
argrepr - human readable description of operation argument
|
||||
offset - start index of operation within bytecode sequence
|
||||
starts_line - line started by this opcode (if any), otherwise None
|
||||
is_jump_target - True if other code jumps to here, otherwise False
|
||||
positions - Optional dis.Positions object holding the span of source code
|
||||
covered by this instruction
|
||||
"""
|
||||
|
||||
def _disassemble(self, lineno_width: int = 3, mark_as_current: bool = False, offset_width: int = 4) -> str:
|
||||
"""Format instruction details for inclusion in disassembly output
|
||||
|
||||
*lineno_width* sets the width of the line number field (0 omits it)
|
||||
*mark_as_current* inserts a '-->' marker arrow as part of the line
|
||||
*offset_width* sets the width of the instruction offset field
|
||||
"""
|
||||
|
||||
class Bytecode:
|
||||
"""The bytecode operations of a piece of code
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ def copy_file(
|
|||
) -> tuple[_BytesPathT | bytes, bool]: ...
|
||||
@overload
|
||||
def move_file(
|
||||
src: StrPath, dst: _StrPathT, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0
|
||||
src: StrPath, dst: _StrPathT, verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0
|
||||
) -> _StrPathT | str:
|
||||
"""Move a file 'src' to 'dst'. If 'dst' is a directory, the file will
|
||||
be moved into it with the same name; otherwise, 'src' is just renamed
|
||||
|
@ -71,7 +71,7 @@ def move_file(
|
|||
|
||||
@overload
|
||||
def move_file(
|
||||
src: BytesPath, dst: _BytesPathT, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0
|
||||
src: BytesPath, dst: _BytesPathT, verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0
|
||||
) -> _BytesPathT | bytes: ...
|
||||
def write_file(filename: StrOrBytesPath, contents: Iterable[str]) -> None:
|
||||
"""Create a file with the specified name and write 'contents' (a
|
||||
|
|
|
@ -5,7 +5,7 @@ from _typeshed import SupportsKeysAndGetItem, Unused
|
|||
from builtins import property as _builtins_property
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from typing import Any, Final, Generic, Literal, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
__all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"]
|
||||
|
||||
|
@ -464,11 +464,26 @@ if sys.version_info >= (3, 11):
|
|||
Only changes the repr(), leaving str() and format() to the mixed-in type.
|
||||
"""
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class IntEnum(int, ReprEnum):
|
||||
"""
|
||||
Enum where members are also (and must be) ints
|
||||
"""
|
||||
|
||||
_value_: int
|
||||
@_magic_enum_attr
|
||||
def value(self) -> int:
|
||||
"""The value of the Enum member."""
|
||||
|
||||
def __new__(cls, value: int) -> Self: ...
|
||||
|
||||
else:
|
||||
if sys.version_info >= (3, 11):
|
||||
_IntEnumBase = ReprEnum
|
||||
else:
|
||||
_IntEnumBase = Enum
|
||||
|
||||
@disjoint_base
|
||||
class IntEnum(int, _IntEnumBase):
|
||||
"""
|
||||
Enum where members are also (and must be) ints
|
||||
|
@ -608,7 +623,7 @@ if sys.version_info >= (3, 11):
|
|||
the module is the last module in case of a multi-module name
|
||||
"""
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
if sys.version_info >= (3, 12):
|
||||
# The body of the class is the same, but the base classes are different.
|
||||
class IntFlag(int, ReprEnum, Flag, boundary=KEEP): # type: ignore[misc] # complaints about incompatible bases
|
||||
"""
|
||||
|
@ -624,7 +639,25 @@ if sys.version_info >= (3, 11):
|
|||
__rand__ = __and__
|
||||
__rxor__ = __xor__
|
||||
|
||||
elif sys.version_info >= (3, 11):
|
||||
# The body of the class is the same, but the base classes are different.
|
||||
@disjoint_base
|
||||
class IntFlag(int, ReprEnum, Flag, boundary=KEEP): # type: ignore[misc] # complaints about incompatible bases
|
||||
"""
|
||||
Support for integer-based Flags
|
||||
"""
|
||||
|
||||
def __new__(cls, value: int) -> Self: ...
|
||||
def __or__(self, other: int) -> Self: ...
|
||||
def __and__(self, other: int) -> Self: ...
|
||||
def __xor__(self, other: int) -> Self: ...
|
||||
def __invert__(self) -> Self: ...
|
||||
__ror__ = __or__
|
||||
__rand__ = __and__
|
||||
__rxor__ = __xor__
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class IntFlag(int, Flag): # type: ignore[misc] # complaints about incompatible bases
|
||||
"""
|
||||
Support for integer-based Flags
|
||||
|
|
|
@ -6,7 +6,7 @@ from _typeshed import SupportsAllComparisons, SupportsItems
|
|||
from collections.abc import Callable, Hashable, Iterable, Sized
|
||||
from types import GenericAlias
|
||||
from typing import Any, Final, Generic, Literal, NamedTuple, TypedDict, TypeVar, final, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, disjoint_base
|
||||
|
||||
__all__ = [
|
||||
"update_wrapper",
|
||||
|
@ -292,6 +292,7 @@ def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComp
|
|||
Function that compares two objects.
|
||||
"""
|
||||
|
||||
@disjoint_base
|
||||
class partial(Generic[_T]):
|
||||
"""Create a new function with partial application of the given arguments
|
||||
and keywords.
|
||||
|
@ -330,10 +331,17 @@ class partialmethod(Generic[_T]):
|
|||
func: Callable[..., _T] | _Descriptor
|
||||
args: tuple[Any, ...]
|
||||
keywords: dict[str, Any]
|
||||
if sys.version_info >= (3, 14):
|
||||
@overload
|
||||
def __new__(self, func: Callable[..., _T], /, *args: Any, **keywords: Any) -> Self: ...
|
||||
@overload
|
||||
def __new__(self, func: _Descriptor, /, *args: Any, **keywords: Any) -> Self: ...
|
||||
else:
|
||||
@overload
|
||||
def __init__(self, func: Callable[..., _T], /, *args: Any, **keywords: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, func: _Descriptor, /, *args: Any, **keywords: Any) -> None: ...
|
||||
|
||||
def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ...
|
||||
@property
|
||||
def __isabstractmethod__(self) -> bool: ...
|
||||
|
|
|
@ -132,7 +132,7 @@ else:
|
|||
languages: Iterable[str] | None = None,
|
||||
class_: None = None,
|
||||
fallback: Literal[False] = False,
|
||||
codeset: str | None = None,
|
||||
codeset: str | None = ...,
|
||||
) -> GNUTranslations: ...
|
||||
@overload
|
||||
def translation(
|
||||
|
@ -142,7 +142,7 @@ else:
|
|||
*,
|
||||
class_: Callable[[io.BufferedReader], _NullTranslationsT],
|
||||
fallback: Literal[False] = False,
|
||||
codeset: str | None = None,
|
||||
codeset: str | None = ...,
|
||||
) -> _NullTranslationsT: ...
|
||||
@overload
|
||||
def translation(
|
||||
|
@ -151,7 +151,7 @@ else:
|
|||
languages: Iterable[str] | None,
|
||||
class_: Callable[[io.BufferedReader], _NullTranslationsT],
|
||||
fallback: Literal[False] = False,
|
||||
codeset: str | None = None,
|
||||
codeset: str | None = ...,
|
||||
) -> _NullTranslationsT: ...
|
||||
@overload
|
||||
def translation(
|
||||
|
@ -160,18 +160,18 @@ else:
|
|||
languages: Iterable[str] | None = None,
|
||||
class_: Callable[[io.BufferedReader], NullTranslations] | None = None,
|
||||
fallback: bool = False,
|
||||
codeset: str | None = None,
|
||||
codeset: str | None = ...,
|
||||
) -> NullTranslations: ...
|
||||
@overload
|
||||
def install(domain: str, localedir: StrPath | None = None, names: Container[str] | None = None) -> None: ...
|
||||
@overload
|
||||
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
|
||||
def install(domain: str, localedir: StrPath | None, codeset: str | None, /, names: Container[str] | None = None) -> None: ...
|
||||
@overload
|
||||
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
|
||||
def install(
|
||||
domain: str, localedir: StrPath | None = None, codeset: None = None, names: Container[str] | None = None
|
||||
domain: str, localedir: StrPath | None = None, *, codeset: str | None, names: Container[str] | None = None
|
||||
) -> None: ...
|
||||
@overload
|
||||
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
|
||||
def install(domain: str, localedir: StrPath | None, codeset: str, /, names: Container[str] | None = None) -> None: ...
|
||||
@overload
|
||||
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
|
||||
def install(domain: str, localedir: StrPath | None = None, *, codeset: str, names: Container[str] | None = None) -> None: ...
|
||||
|
||||
def textdomain(domain: str | None = None) -> str: ...
|
||||
def bindtextdomain(domain: str, localedir: StrPath | None = None) -> str: ...
|
||||
|
|
|
@ -11,7 +11,7 @@ from os import PathLike
|
|||
from pathlib import Path
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar, Generic, NamedTuple, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
from typing_extensions import Self, TypeAlias, deprecated, disjoint_base
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KT = TypeVar("_KT")
|
||||
|
@ -83,6 +83,7 @@ else:
|
|||
value: str
|
||||
group: str
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class EntryPoint(_EntryPointBase):
|
||||
"""An entry point as defined by Python packaging conventions.
|
||||
|
||||
|
@ -101,12 +102,83 @@ class EntryPoint(_EntryPointBase):
|
|||
"""
|
||||
|
||||
pattern: ClassVar[Pattern[str]]
|
||||
if sys.version_info >= (3, 11):
|
||||
name: str
|
||||
value: str
|
||||
group: str
|
||||
|
||||
def __init__(self, name: str, value: str, group: str) -> None: ...
|
||||
def load(self) -> Any: # Callable[[], Any] or an importable module
|
||||
"""Load the entry point from its definition. If only a module
|
||||
is indicated by the value, return that module. Otherwise,
|
||||
return the named object.
|
||||
"""
|
||||
|
||||
@property
|
||||
def extras(self) -> list[str]: ...
|
||||
@property
|
||||
def module(self) -> str: ...
|
||||
@property
|
||||
def attr(self) -> str: ...
|
||||
dist: ClassVar[Distribution | None]
|
||||
def matches(
|
||||
self,
|
||||
*,
|
||||
name: str = ...,
|
||||
value: str = ...,
|
||||
group: str = ...,
|
||||
module: str = ...,
|
||||
attr: str = ...,
|
||||
extras: list[str] = ...,
|
||||
) -> bool: # undocumented
|
||||
"""
|
||||
EntryPoint matches the given parameters.
|
||||
|
||||
>>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
|
||||
>>> ep.matches(group='foo')
|
||||
True
|
||||
>>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
|
||||
True
|
||||
>>> ep.matches(group='foo', name='other')
|
||||
False
|
||||
>>> ep.matches()
|
||||
True
|
||||
>>> ep.matches(extras=['extra1', 'extra2'])
|
||||
True
|
||||
>>> ep.matches(module='bing')
|
||||
True
|
||||
>>> ep.matches(attr='bong')
|
||||
True
|
||||
"""
|
||||
|
||||
def __hash__(self) -> int: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self, other: object) -> bool: ...
|
||||
if sys.version_info < (3, 12):
|
||||
def __iter__(self) -> Iterator[Any]: # result of iter((str, Self)), really
|
||||
"""
|
||||
Supply iter so one may construct dicts of EntryPoints by name.
|
||||
"""
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class EntryPoint(_EntryPointBase):
|
||||
"""An entry point as defined by Python packaging conventions.
|
||||
|
||||
See `the packaging docs on entry points
|
||||
<https://packaging.python.org/specifications/entry-points/>`_
|
||||
for more information.
|
||||
|
||||
>>> ep = EntryPoint(
|
||||
... name=None, group=None, value='package.module:attr [extra1, extra2]')
|
||||
>>> ep.module
|
||||
'package.module'
|
||||
>>> ep.attr
|
||||
'attr'
|
||||
>>> ep.extras
|
||||
['extra1', 'extra2']
|
||||
"""
|
||||
|
||||
pattern: ClassVar[Pattern[str]]
|
||||
|
||||
def load(self) -> Any: # Callable[[], Any] or an importable module
|
||||
"""Load the entry point from its definition. If only a module
|
||||
|
@ -153,10 +225,6 @@ class EntryPoint(_EntryPointBase):
|
|||
"""
|
||||
|
||||
def __hash__(self) -> int: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self, other: object) -> bool: ...
|
||||
if sys.version_info < (3, 12):
|
||||
def __iter__(self) -> Iterator[Any]: # result of iter((str, Self)), really
|
||||
"""
|
||||
Supply iter so one may construct dicts of EntryPoints by name.
|
||||
|
@ -234,12 +302,15 @@ elif sys.version_info >= (3, 10):
|
|||
1
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
class EntryPoints(DeprecatedList[EntryPoint]): # use as list is deprecated since 3.10
|
||||
"""
|
||||
An immutable collection of selectable EntryPoint objects.
|
||||
"""
|
||||
|
||||
# int argument is deprecated since 3.10
|
||||
__slots__ = ()
|
||||
def __getitem__(self, name: int | str) -> EntryPoint: # type: ignore[override]
|
||||
"""
|
||||
Get the EntryPoint in self matching name.
|
||||
|
|
|
@ -54,7 +54,7 @@ from types import (
|
|||
WrapperDescriptorType,
|
||||
)
|
||||
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs, deprecated
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs, deprecated, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
from annotationlib import Format
|
||||
|
@ -1143,6 +1143,17 @@ if sys.version_info >= (3, 11):
|
|||
code_context: list[str] | None
|
||||
index: int | None # type: ignore[assignment]
|
||||
|
||||
class _FrameInfo(NamedTuple):
|
||||
"""_FrameInfo(frame, filename, lineno, function, code_context, index)"""
|
||||
|
||||
frame: FrameType
|
||||
filename: str
|
||||
lineno: int
|
||||
function: str
|
||||
code_context: list[str] | None
|
||||
index: int | None # type: ignore[assignment]
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class Traceback(_Traceback):
|
||||
positions: dis.Positions | None
|
||||
def __new__(
|
||||
|
@ -1156,16 +1167,36 @@ if sys.version_info >= (3, 11):
|
|||
positions: dis.Positions | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
class _FrameInfo(NamedTuple):
|
||||
"""_FrameInfo(frame, filename, lineno, function, code_context, index)"""
|
||||
class FrameInfo(_FrameInfo):
|
||||
positions: dis.Positions | None
|
||||
def __new__(
|
||||
cls,
|
||||
frame: FrameType,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
function: str,
|
||||
code_context: list[str] | None,
|
||||
index: int | None,
|
||||
*,
|
||||
positions: dis.Positions | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
frame: FrameType
|
||||
filename: str
|
||||
lineno: int
|
||||
function: str
|
||||
code_context: list[str] | None
|
||||
index: int | None # type: ignore[assignment]
|
||||
else:
|
||||
@disjoint_base
|
||||
class Traceback(_Traceback):
|
||||
positions: dis.Positions | None
|
||||
def __new__(
|
||||
cls,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
function: str,
|
||||
code_context: list[str] | None,
|
||||
index: int | None,
|
||||
*,
|
||||
positions: dis.Positions | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
@disjoint_base
|
||||
class FrameInfo(_FrameInfo):
|
||||
positions: dis.Positions | None
|
||||
def __new__(
|
||||
|
|
|
@ -162,6 +162,7 @@ if sys.version_info >= (3, 14):
|
|||
This protocol only supports blocking I/O.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
def read(self, size: int = ..., /) -> _T_co:
|
||||
"""Read data from the input stream and return it.
|
||||
|
||||
|
@ -175,5 +176,6 @@ if sys.version_info >= (3, 14):
|
|||
This protocol only supports blocking I/O.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
def write(self, data: _T_contra, /) -> int:
|
||||
"""Write *data* to the output stream and return the number of items written."""
|
||||
|
|
|
@ -34,7 +34,7 @@ from _typeshed import MaybeNone
|
|||
from collections.abc import Callable, Iterable, Iterator
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, Literal, SupportsComplex, SupportsFloat, SupportsIndex, SupportsInt, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S")
|
||||
|
@ -58,6 +58,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
|
|||
|
||||
# Technically count can take anything that implements a number protocol and has an add method
|
||||
# but we can't enforce the add method
|
||||
@disjoint_base
|
||||
class count(Generic[_N]):
|
||||
"""Return a count object whose .__next__() method returns consecutive values.
|
||||
|
||||
|
@ -81,6 +82,7 @@ class count(Generic[_N]):
|
|||
def __iter__(self) -> Self:
|
||||
"""Implement iter(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class cycle(Generic[_T]):
|
||||
"""Return elements from the iterable until it is exhausted. Then repeat the sequence indefinitely."""
|
||||
|
||||
|
@ -91,6 +93,7 @@ class cycle(Generic[_T]):
|
|||
def __iter__(self) -> Self:
|
||||
"""Implement iter(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class repeat(Generic[_T]):
|
||||
"""repeat(object [,times]) -> create an iterator which returns the object
|
||||
for the specified number of times. If not specified, returns the object
|
||||
|
@ -110,6 +113,7 @@ class repeat(Generic[_T]):
|
|||
def __length_hint__(self) -> int:
|
||||
"""Private method returning an estimate of len(list(it))."""
|
||||
|
||||
@disjoint_base
|
||||
class accumulate(Generic[_T]):
|
||||
"""Return series of accumulated sums (or other binary function results)."""
|
||||
|
||||
|
@ -123,6 +127,7 @@ class accumulate(Generic[_T]):
|
|||
def __next__(self) -> _T:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class chain(Generic[_T]):
|
||||
"""Return a chain object whose .__next__() method returns elements from the
|
||||
first iterable until it is exhausted, then elements from the next
|
||||
|
@ -144,6 +149,7 @@ class chain(Generic[_T]):
|
|||
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
||||
"""See PEP 585"""
|
||||
|
||||
@disjoint_base
|
||||
class compress(Generic[_T]):
|
||||
"""Return data elements corresponding to true selector elements.
|
||||
|
||||
|
@ -158,6 +164,7 @@ class compress(Generic[_T]):
|
|||
def __next__(self) -> _T:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class dropwhile(Generic[_T]):
|
||||
"""Drop items from the iterable while predicate(item) is true.
|
||||
|
||||
|
@ -171,6 +178,7 @@ class dropwhile(Generic[_T]):
|
|||
def __next__(self) -> _T:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class filterfalse(Generic[_T]):
|
||||
"""Return those items of iterable for which function(item) is false.
|
||||
|
||||
|
@ -184,6 +192,7 @@ class filterfalse(Generic[_T]):
|
|||
def __next__(self) -> _T:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class groupby(Generic[_T_co, _S_co]):
|
||||
"""make an iterator that returns consecutive keys and groups from the iterable
|
||||
|
||||
|
@ -205,6 +214,7 @@ class groupby(Generic[_T_co, _S_co]):
|
|||
def __next__(self) -> tuple[_T_co, Iterator[_S_co]]:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class islice(Generic[_T]):
|
||||
"""islice(iterable, stop) --> islice object
|
||||
islice(iterable, start, stop[, step]) --> islice object
|
||||
|
@ -227,6 +237,7 @@ class islice(Generic[_T]):
|
|||
def __next__(self) -> _T:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class starmap(Generic[_T_co]):
|
||||
"""Return an iterator whose values are returned from the function evaluated with an argument tuple taken from the given sequence."""
|
||||
|
||||
|
@ -237,6 +248,7 @@ class starmap(Generic[_T_co]):
|
|||
def __next__(self) -> _T_co:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class takewhile(Generic[_T]):
|
||||
"""Return successive entries from an iterable as long as the predicate evaluates to true for each entry."""
|
||||
|
||||
|
@ -250,6 +262,7 @@ class takewhile(Generic[_T]):
|
|||
def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]:
|
||||
"""Returns a tuple of n independent iterators."""
|
||||
|
||||
@disjoint_base
|
||||
class zip_longest(Generic[_T_co]):
|
||||
"""Return a zip_longest object whose .__next__() method returns a tuple where
|
||||
the i-th element comes from the i-th iterable argument. The .__next__()
|
||||
|
@ -339,6 +352,7 @@ class zip_longest(Generic[_T_co]):
|
|||
def __next__(self) -> _T_co:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class product(Generic[_T_co]):
|
||||
"""Cartesian product of input iterables. Equivalent to nested for-loops.
|
||||
|
||||
|
@ -442,6 +456,7 @@ class product(Generic[_T_co]):
|
|||
def __next__(self) -> _T_co:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class permutations(Generic[_T_co]):
|
||||
"""Return successive r-length permutations of elements in the iterable.
|
||||
|
||||
|
@ -464,6 +479,7 @@ class permutations(Generic[_T_co]):
|
|||
def __next__(self) -> _T_co:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class combinations(Generic[_T_co]):
|
||||
"""Return successive r-length combinations of elements in the iterable.
|
||||
|
||||
|
@ -486,6 +502,7 @@ class combinations(Generic[_T_co]):
|
|||
def __next__(self) -> _T_co:
|
||||
"""Implement next(self)."""
|
||||
|
||||
@disjoint_base
|
||||
class combinations_with_replacement(Generic[_T_co]):
|
||||
"""Return successive r-length combinations of elements in the iterable allowing individual elements to have successive repeats.
|
||||
|
||||
|
@ -509,6 +526,7 @@ class combinations_with_replacement(Generic[_T_co]):
|
|||
"""Implement next(self)."""
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@disjoint_base
|
||||
class pairwise(Generic[_T_co]):
|
||||
"""Return an iterator of overlapping pairs taken from the input iterator.
|
||||
|
||||
|
@ -523,6 +541,7 @@ if sys.version_info >= (3, 10):
|
|||
"""Implement next(self)."""
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
@disjoint_base
|
||||
class batched(Generic[_T_co]):
|
||||
"""Batch data into tuples of length n. The last batch may be shorter than n.
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ It will also support lambdas:
|
|||
lambda (x): x + y -> lambda x: x + y
|
||||
"""
|
||||
|
||||
from _typeshed import Incomplete
|
||||
from typing import ClassVar, Literal
|
||||
|
||||
from .. import fixer_base
|
||||
|
@ -32,5 +31,5 @@ class FixTupleParams(fixer_base.BaseFix):
|
|||
|
||||
def simplify_args(node): ...
|
||||
def find_params(node): ...
|
||||
def map_to_index(param_list, prefix=..., d: Incomplete | None = ...): ...
|
||||
def map_to_index(param_list, prefix=[], d=None): ...
|
||||
def tuple_name(param_list): ...
|
||||
|
|
|
@ -15,7 +15,7 @@ from configparser import RawConfigParser
|
|||
from re import Pattern
|
||||
from threading import Thread
|
||||
from typing import IO, Any, Final, Literal, SupportsIndex, TypedDict, overload, type_check_only
|
||||
from typing_extensions import Required, TypeAlias
|
||||
from typing_extensions import Required, TypeAlias, disjoint_base
|
||||
|
||||
from . import Filter, Filterer, Formatter, Handler, Logger, _FilterType, _FormatStyle, _Level
|
||||
|
||||
|
@ -155,6 +155,17 @@ class ConvertingList(list[Any], ConvertingMixin): # undocumented
|
|||
def __getitem__(self, key: slice) -> Any: ...
|
||||
def pop(self, idx: SupportsIndex = -1) -> Any: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class ConvertingTuple(tuple[Any, ...], ConvertingMixin): # undocumented
|
||||
"""A converting tuple wrapper."""
|
||||
|
||||
@overload
|
||||
def __getitem__(self, key: SupportsIndex) -> Any: ...
|
||||
@overload
|
||||
def __getitem__(self, key: slice) -> Any: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class ConvertingTuple(tuple[Any, ...], ConvertingMixin): # undocumented
|
||||
"""A converting tuple wrapper."""
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import sys
|
|||
from _typeshed import ReadableBuffer, Unused
|
||||
from collections.abc import Iterator
|
||||
from typing import Final, Literal, NoReturn, overload
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, disjoint_base
|
||||
|
||||
ACCESS_DEFAULT: Final = 0
|
||||
ACCESS_READ: Final = 1
|
||||
|
@ -31,6 +31,7 @@ if sys.platform != "win32":
|
|||
|
||||
PAGESIZE: Final[int]
|
||||
|
||||
@disjoint_base
|
||||
class mmap:
|
||||
"""Windows: mmap(fileno, length[, tagname[, access[, offset]]])
|
||||
|
||||
|
@ -56,7 +57,7 @@ class mmap:
|
|||
"""
|
||||
|
||||
if sys.platform == "win32":
|
||||
def __init__(self, fileno: int, length: int, tagname: str | None = None, access: int = 0, offset: int = 0) -> None: ...
|
||||
def __new__(self, fileno: int, length: int, tagname: str | None = None, access: int = 0, offset: int = 0) -> Self: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
|
|
|
@ -1746,7 +1746,7 @@ def getcwd() -> str:
|
|||
def getcwdb() -> bytes:
|
||||
"""Return a bytes string representing the current working directory."""
|
||||
|
||||
def chmod(path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, follow_symlinks: bool = ...) -> None:
|
||||
def chmod(path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None:
|
||||
"""Change the access permissions of a file.
|
||||
|
||||
path
|
||||
|
|
|
@ -292,6 +292,7 @@ class Path(PurePath):
|
|||
__slots__ = ()
|
||||
else:
|
||||
__slots__ = ("_accessor",)
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, *args: StrPath, **kwargs: Unused) -> Self: ... # pyright: ignore[reportInconsistentConstructor]
|
||||
else:
|
||||
|
|
|
@ -606,8 +606,25 @@ class Pdb(Bdb, Cmd):
|
|||
print anything, you will see no sign that the breakpoint was
|
||||
reached.
|
||||
"""
|
||||
if sys.version_info >= (3, 14):
|
||||
def do_break(self, arg: str, temporary: bool = False) -> bool | None:
|
||||
"""b(reak) [ ([filename:]lineno | function) [, condition] ]
|
||||
|
||||
def do_break(self, arg: str, temporary: bool = ...) -> bool | None:
|
||||
Without argument, list all breaks.
|
||||
|
||||
With a line number argument, set a break at this line in the
|
||||
current file. With a function name, set a break at the first
|
||||
executable line of that function. If a second argument is
|
||||
present, it is a string specifying an expression which must
|
||||
evaluate to true before the breakpoint is honored.
|
||||
|
||||
The line number may be prefixed with a filename and a colon,
|
||||
to specify a breakpoint in another file (probably one that
|
||||
hasn't been loaded yet). The file is searched for on
|
||||
sys.path; the .py suffix may be omitted.
|
||||
"""
|
||||
else:
|
||||
def do_break(self, arg: str, temporary: bool | Literal[0, 1] = 0) -> bool | None:
|
||||
"""b(reak) [ ([filename:]lineno | function) [, condition] ]
|
||||
|
||||
Without argument, list all breaks.
|
||||
|
|
|
@ -9,7 +9,7 @@ format is usable as part of a filename.
|
|||
|
||||
import sys
|
||||
from typing import NamedTuple, type_check_only
|
||||
from typing_extensions import Self, deprecated
|
||||
from typing_extensions import Self, deprecated, disjoint_base
|
||||
|
||||
def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]:
|
||||
"""Tries to determine the libc version that the file executable
|
||||
|
@ -123,6 +123,25 @@ class _uname_result_base(NamedTuple):
|
|||
|
||||
# uname_result emulates a 6-field named tuple, but the processor field
|
||||
# is lazily evaluated rather than being passed in to the constructor.
|
||||
if sys.version_info >= (3, 12):
|
||||
class uname_result(_uname_result_base):
|
||||
"""
|
||||
A uname_result that's largely compatible with a
|
||||
simple namedtuple except that 'processor' is
|
||||
resolved late and cached to avoid calling "uname"
|
||||
except when needed.
|
||||
"""
|
||||
|
||||
__match_args__ = ("system", "node", "release", "version", "machine") # pyright: ignore[reportAssignmentType]
|
||||
|
||||
def __new__(_cls, system: str, node: str, release: str, version: str, machine: str) -> Self:
|
||||
"""Create new instance of uname_result_base(system, node, release, version, machine)"""
|
||||
|
||||
@property
|
||||
def processor(self) -> str: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class uname_result(_uname_result_base):
|
||||
"""
|
||||
A uname_result that's largely compatible with a
|
||||
|
|
|
@ -52,6 +52,7 @@ from _typeshed import SupportsLenAndGetItem
|
|||
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet
|
||||
from fractions import Fraction
|
||||
from typing import Any, ClassVar, NoReturn, TypeVar
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = [
|
||||
"Random",
|
||||
|
@ -109,6 +110,10 @@ class Random(_random.Random):
|
|||
# Using other `seed` types is deprecated since 3.9 and removed in 3.11
|
||||
# Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit
|
||||
# int better documents conventional usage of random.seed.
|
||||
if sys.version_info < (3, 10):
|
||||
# this is a workaround for pyright correctly flagging an inconsistent inherited constructor, see #14624
|
||||
def __new__(cls, x: int | float | str | bytes | bytearray | None = None) -> Self: ... # noqa: Y041
|
||||
|
||||
def seed(self, a: int | float | str | bytes | bytearray | None = None, version: int = 2) -> None: # type: ignore[override] # noqa: Y041
|
||||
"""Initialize internal state from a seed.
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ if sys.platform == "linux":
|
|||
the maximum number of monitored events.
|
||||
"""
|
||||
|
||||
def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
|
||||
def __new__(self, sizehint: int = ..., flags: int = ...) -> Self: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self,
|
||||
|
|
|
@ -97,7 +97,7 @@ from sqlite3.dbapi2 import (
|
|||
)
|
||||
from types import TracebackType
|
||||
from typing import Any, Literal, Protocol, SupportsIndex, TypeVar, final, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, disjoint_base
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
from sqlite3.dbapi2 import version_info as version_info
|
||||
|
@ -302,6 +302,7 @@ class OperationalError(DatabaseError): ...
|
|||
class ProgrammingError(DatabaseError): ...
|
||||
class Warning(Exception): ...
|
||||
|
||||
@disjoint_base
|
||||
class Connection:
|
||||
"""SQLite database connection object."""
|
||||
|
||||
|
@ -610,6 +611,7 @@ class Connection:
|
|||
If there was any exception, a rollback takes place; otherwise we commit.
|
||||
"""
|
||||
|
||||
@disjoint_base
|
||||
class Cursor:
|
||||
"""SQLite database cursor class."""
|
||||
|
||||
|
@ -669,6 +671,7 @@ class PrepareProtocol:
|
|||
|
||||
def __init__(self, *args: object, **kwargs: object) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class Row(Sequence[Any]):
|
||||
def __new__(cls, cursor: Cursor, data: tuple[Any, ...], /) -> Self: ...
|
||||
def keys(self) -> list[str]:
|
||||
|
|
|
@ -3,12 +3,19 @@
|
|||
import sys
|
||||
from re import error as error
|
||||
from typing import Final
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, disjoint_base
|
||||
|
||||
MAXGROUPS: Final[int]
|
||||
|
||||
MAGIC: Final[int]
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class _NamedIntConstant(int):
|
||||
name: str
|
||||
def __new__(cls, value: int, name: str) -> Self: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class _NamedIntConstant(int):
|
||||
name: str
|
||||
def __new__(cls, value: int, name: str) -> Self: ...
|
||||
|
|
|
@ -157,7 +157,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -220,7 +220,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -254,7 +254,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -289,7 +289,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
# where the *real* keyword only args start
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -323,7 +323,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -357,7 +357,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -394,7 +394,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -456,7 +456,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -489,7 +489,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -523,7 +523,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
# where the *real* keyword only args start
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -556,7 +556,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -589,7 +589,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -625,7 +625,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -685,7 +685,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -717,7 +717,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -750,7 +750,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
# where the *real* keyword only args start
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -782,7 +782,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -814,7 +814,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
capture_output: bool = False,
|
||||
check: bool = False,
|
||||
|
@ -849,7 +849,7 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
encoding: str | None = None,
|
||||
timeout: float | None = None,
|
||||
|
@ -888,7 +888,7 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
encoding: str | None = None,
|
||||
timeout: float | None = None,
|
||||
|
@ -925,7 +925,7 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
encoding: str | None = None,
|
||||
timeout: float | None = None,
|
||||
|
@ -963,8 +963,8 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
timeout: float | None = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
timeout: float | None = None,
|
||||
*,
|
||||
encoding: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1004,8 +1004,8 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
timeout: float | None = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
timeout: float | None = None,
|
||||
*,
|
||||
encoding: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1043,8 +1043,8 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
timeout: float | None = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
timeout: float | None = None,
|
||||
*,
|
||||
encoding: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1082,10 +1082,10 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: Literal[True],
|
||||
|
@ -1148,10 +1148,10 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1179,10 +1179,10 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str,
|
||||
text: bool | None = None,
|
||||
|
@ -1211,10 +1211,10 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
# where the real keyword only ones start
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1242,10 +1242,10 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
|
@ -1273,10 +1273,10 @@ if sys.version_info >= (3, 11):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1307,10 +1307,10 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: Literal[True],
|
||||
|
@ -1372,10 +1372,10 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1402,10 +1402,10 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str,
|
||||
text: bool | None = None,
|
||||
|
@ -1433,10 +1433,10 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
# where the real keyword only ones start
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1463,10 +1463,10 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
|
@ -1493,10 +1493,10 @@ elif sys.version_info >= (3, 10):
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1525,10 +1525,10 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: Literal[True],
|
||||
|
@ -1589,10 +1589,10 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1618,10 +1618,10 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str,
|
||||
text: bool | None = None,
|
||||
|
@ -1648,10 +1648,10 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
# where the real keyword only ones start
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
@ -1677,10 +1677,10 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
|
@ -1706,10 +1706,10 @@ else:
|
|||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
pass_fds: Collection[int] = (),
|
||||
*,
|
||||
timeout: float | None = None,
|
||||
input: _InputString | None = ...,
|
||||
input: _InputString | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
text: bool | None = None,
|
||||
|
|
|
@ -1053,6 +1053,28 @@ class TarInfo:
|
|||
usually created internally.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
"name",
|
||||
"mode",
|
||||
"uid",
|
||||
"gid",
|
||||
"size",
|
||||
"mtime",
|
||||
"chksum",
|
||||
"type",
|
||||
"linkname",
|
||||
"uname",
|
||||
"gname",
|
||||
"devmajor",
|
||||
"devminor",
|
||||
"offset",
|
||||
"offset_data",
|
||||
"pax_headers",
|
||||
"sparse",
|
||||
"_tarfile",
|
||||
"_sparse_structs",
|
||||
"_link_target",
|
||||
)
|
||||
name: str
|
||||
path: str
|
||||
size: int
|
||||
|
|
|
@ -38,7 +38,7 @@ from tkinter.constants import *
|
|||
from tkinter.font import _FontDescription
|
||||
from types import GenericAlias, TracebackType
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from enum import StrEnum
|
||||
|
@ -230,6 +230,10 @@ if sys.version_info >= (3, 11):
|
|||
releaselevel: str
|
||||
serial: int
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class _VersionInfoType(_VersionInfoTypeBase): ...
|
||||
else:
|
||||
@disjoint_base
|
||||
class _VersionInfoType(_VersionInfoTypeBase): ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
|
@ -5683,7 +5687,7 @@ class Text(Widget, XView, YView):
|
|||
def image_configure(
|
||||
self,
|
||||
index: _TextIndex,
|
||||
cnf: dict[str, Any] | None = {},
|
||||
cnf: dict[str, Any] | None = None,
|
||||
*,
|
||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||
image: _ImageSpec = ...,
|
||||
|
|
|
@ -26,7 +26,7 @@ from collections.abc import Callable, Generator, Iterable, Sequence
|
|||
from re import Pattern
|
||||
from token import *
|
||||
from typing import Any, Final, NamedTuple, TextIO, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, disjoint_base
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
# Avoid double assignment to Final name by imports, which pyright objects to.
|
||||
|
@ -137,6 +137,13 @@ class _TokenInfo(NamedTuple):
|
|||
end: _Position
|
||||
line: str
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class TokenInfo(_TokenInfo):
|
||||
@property
|
||||
def exact_type(self) -> int: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class TokenInfo(_TokenInfo):
|
||||
@property
|
||||
def exact_type(self) -> int: ...
|
||||
|
|
|
@ -81,7 +81,7 @@ from collections.abc import Callable, Generator, Sequence
|
|||
from contextlib import contextmanager
|
||||
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
|
||||
from typing import Any, ClassVar, Literal, TypedDict, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
from typing_extensions import Self, TypeAlias, deprecated, disjoint_base
|
||||
|
||||
__all__ = [
|
||||
"ScrolledCanvas",
|
||||
|
@ -240,6 +240,37 @@ class _PenState(TypedDict):
|
|||
_Speed: TypeAlias = str | float
|
||||
_PolygonCoords: TypeAlias = Sequence[tuple[float, float]]
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class Vec2D(tuple[float, float]):
|
||||
"""A 2 dimensional vector class, used as a helper class
|
||||
for implementing turtle graphics.
|
||||
May be useful for turtle graphics programs also.
|
||||
Derived from tuple, so a vector is a tuple!
|
||||
|
||||
Provides (for a, b vectors, k number):
|
||||
a+b vector addition
|
||||
a-b vector subtraction
|
||||
a*b inner product
|
||||
k*a and a*k multiplication with scalar
|
||||
|a| absolute value of a
|
||||
a.rotate(angle) rotation
|
||||
"""
|
||||
|
||||
def __new__(cls, x: float, y: float) -> Self: ...
|
||||
def __add__(self, other: tuple[float, float]) -> Vec2D: ... # type: ignore[override]
|
||||
@overload # type: ignore[override]
|
||||
def __mul__(self, other: Vec2D) -> float: ...
|
||||
@overload
|
||||
def __mul__(self, other: float) -> Vec2D: ...
|
||||
def __rmul__(self, other: float) -> Vec2D: ... # type: ignore[override]
|
||||
def __sub__(self, other: tuple[float, float]) -> Vec2D: ...
|
||||
def __neg__(self) -> Vec2D: ...
|
||||
def __abs__(self) -> float: ...
|
||||
def rotate(self, angle: float) -> Vec2D:
|
||||
"""rotate self counterclockwise by angle"""
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class Vec2D(tuple[float, float]):
|
||||
"""A 2 dimensional vector class, used as a helper class
|
||||
for implementing turtle graphics.
|
||||
|
|
|
@ -21,7 +21,7 @@ from collections.abc import (
|
|||
)
|
||||
from importlib.machinery import ModuleSpec
|
||||
from typing import Any, ClassVar, Literal, TypeVar, final, overload
|
||||
from typing_extensions import ParamSpec, Self, TypeAliasType, TypeVarTuple, deprecated
|
||||
from typing_extensions import ParamSpec, Self, TypeAliasType, TypeVarTuple, deprecated, disjoint_base
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
from _typeshed import AnnotateFunc
|
||||
|
@ -384,12 +384,16 @@ class MappingProxyType(Mapping[_KT, _VT_co]):
|
|||
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]:
|
||||
"""Return value|self."""
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
@disjoint_base
|
||||
class SimpleNamespace:
|
||||
"""A simple attribute-based namespace."""
|
||||
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 13):
|
||||
def __init__(self, mapping_or_iterable: Mapping[str, Any] | Iterable[tuple[str, Any]] = (), /, **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self, mapping_or_iterable: Mapping[str, Any] | Iterable[tuple[str, Any]] = (), /, **kwargs: Any
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
|
||||
|
@ -401,6 +405,21 @@ class SimpleNamespace:
|
|||
def __replace__(self, **kwargs: Any) -> Self:
|
||||
"""Return a copy of the namespace object with new values for the specified attributes."""
|
||||
|
||||
else:
|
||||
class SimpleNamespace:
|
||||
"""A simple attribute-based namespace.
|
||||
|
||||
SimpleNamespace(**kwargs)
|
||||
"""
|
||||
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __getattribute__(self, name: str, /) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any, /) -> None: ...
|
||||
def __delattr__(self, name: str, /) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class ModuleType:
|
||||
"""Create a module object.
|
||||
|
||||
|
@ -881,7 +900,7 @@ def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Await
|
|||
|
||||
@overload
|
||||
def coroutine(func: _Fn) -> _Fn: ...
|
||||
|
||||
@disjoint_base
|
||||
class GenericAlias:
|
||||
"""Represent a PEP 585 generic type
|
||||
|
||||
|
|
|
@ -1204,6 +1204,7 @@ class MutableSet(AbstractSet[_T]):
|
|||
def __isub__(self, it: AbstractSet[Any]) -> typing_extensions.Self: ...
|
||||
|
||||
class MappingView(Sized):
|
||||
__slots__ = ("_mapping",)
|
||||
def __init__(self, mapping: Sized) -> None: ... # undocumented
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
|
|
|
@ -265,7 +265,27 @@ def final(f: _F) -> _F:
|
|||
object to allow runtime introspection.
|
||||
"""
|
||||
|
||||
def disjoint_base(cls: _TC) -> _TC: ...
|
||||
def disjoint_base(cls: _TC) -> _TC:
|
||||
"""This decorator marks a class as a disjoint base.
|
||||
|
||||
Child classes of a disjoint base cannot inherit from other disjoint bases that are
|
||||
not parent classes of the disjoint base.
|
||||
|
||||
For example:
|
||||
|
||||
@disjoint_base
|
||||
class Disjoint1: pass
|
||||
|
||||
@disjoint_base
|
||||
class Disjoint2: pass
|
||||
|
||||
class Disjoint3(Disjoint1, Disjoint2): pass # Type checker error
|
||||
|
||||
Type checkers can use knowledge of disjoint bases to detect unreachable code
|
||||
and determine when two types can overlap.
|
||||
|
||||
See PEP 800.
|
||||
"""
|
||||
|
||||
Literal: _SpecialForm
|
||||
|
||||
|
@ -780,6 +800,7 @@ else:
|
|||
class SupportsInt(Protocol, metaclass=abc.ABCMeta):
|
||||
"""An ABC with one abstract method __int__."""
|
||||
|
||||
__slots__ = ()
|
||||
@abc.abstractmethod
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
|
@ -787,6 +808,7 @@ else:
|
|||
class SupportsFloat(Protocol, metaclass=abc.ABCMeta):
|
||||
"""An ABC with one abstract method __float__."""
|
||||
|
||||
__slots__ = ()
|
||||
@abc.abstractmethod
|
||||
def __float__(self) -> float: ...
|
||||
|
||||
|
@ -794,6 +816,7 @@ else:
|
|||
class SupportsComplex(Protocol, metaclass=abc.ABCMeta):
|
||||
"""An ABC with one abstract method __complex__."""
|
||||
|
||||
__slots__ = ()
|
||||
@abc.abstractmethod
|
||||
def __complex__(self) -> complex: ...
|
||||
|
||||
|
@ -801,11 +824,13 @@ else:
|
|||
class SupportsBytes(Protocol, metaclass=abc.ABCMeta):
|
||||
"""An ABC with one abstract method __bytes__."""
|
||||
|
||||
__slots__ = ()
|
||||
@abc.abstractmethod
|
||||
def __bytes__(self) -> bytes: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
|
||||
__slots__ = ()
|
||||
@abc.abstractmethod
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
|
@ -815,6 +840,7 @@ else:
|
|||
An ABC with one abstract method __abs__ that is covariant in its return type.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
@abc.abstractmethod
|
||||
def __abs__(self) -> _T_co: ...
|
||||
|
||||
|
@ -824,6 +850,7 @@ else:
|
|||
An ABC with one abstract method __round__ that is covariant in its return type.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
@overload
|
||||
@abc.abstractmethod
|
||||
def __round__(self) -> int: ...
|
||||
|
@ -1298,7 +1325,14 @@ else:
|
|||
format: Format | None = None,
|
||||
_recursive_guard: Container[str] = ...,
|
||||
) -> AnnotationForm: ...
|
||||
def type_repr(value: object) -> str: ...
|
||||
def type_repr(value: object) -> str:
|
||||
"""Convert a Python value to a format suitable for use with the STRING format.
|
||||
|
||||
This is intended as a helper for tools that support the STRING format but do
|
||||
not have access to the code that originally produced the annotations. It uses
|
||||
repr() for most objects.
|
||||
|
||||
"""
|
||||
|
||||
# PEP 661
|
||||
class Sentinel:
|
||||
|
|
|
@ -4,7 +4,7 @@ from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, S
|
|||
from contextlib import _GeneratorContextManager
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, disjoint_base
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_TT = TypeVar("_TT", bound=type[Any])
|
||||
|
@ -72,6 +72,7 @@ _ArgsKwargs: TypeAlias = tuple[tuple[Any, ...], Mapping[str, Any]]
|
|||
_NameArgsKwargs: TypeAlias = tuple[str, tuple[Any, ...], Mapping[str, Any]]
|
||||
_CallValue: TypeAlias = str | tuple[Any, ...] | Mapping[str, Any] | _ArgsKwargs | _NameArgsKwargs
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class _Call(tuple[Any, ...]):
|
||||
"""
|
||||
A tuple for holding the results of a call to a mock, either in the form
|
||||
|
@ -93,7 +94,66 @@ class _Call(tuple[Any, ...]):
|
|||
"""
|
||||
|
||||
def __new__(
|
||||
cls, value: _CallValue = (), name: str | None = "", parent: _Call | None = None, two: bool = False, from_kall: bool = True
|
||||
cls,
|
||||
value: _CallValue = (),
|
||||
name: str | None = "",
|
||||
parent: _Call | None = None,
|
||||
two: bool = False,
|
||||
from_kall: bool = True,
|
||||
) -> Self: ...
|
||||
def __init__(
|
||||
self,
|
||||
value: _CallValue = (),
|
||||
name: str | None = None,
|
||||
parent: _Call | None = None,
|
||||
two: bool = False,
|
||||
from_kall: bool = True,
|
||||
) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, value: object, /) -> bool: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
def __getattribute__(self, attr: str) -> Any: ...
|
||||
@property
|
||||
def args(self) -> tuple[Any, ...]: ...
|
||||
@property
|
||||
def kwargs(self) -> Mapping[str, Any]: ...
|
||||
def call_list(self) -> Any:
|
||||
"""For a call object that represents multiple calls, `call_list`
|
||||
returns a list of all the intermediate calls as well as the
|
||||
final call.
|
||||
"""
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class _Call(tuple[Any, ...]):
|
||||
"""
|
||||
A tuple for holding the results of a call to a mock, either in the form
|
||||
`(args, kwargs)` or `(name, args, kwargs)`.
|
||||
|
||||
If args or kwargs are empty then a call tuple will compare equal to
|
||||
a tuple without those values. This makes comparisons less verbose::
|
||||
|
||||
_Call(('name', (), {})) == ('name',)
|
||||
_Call(('name', (1,), {})) == ('name', (1,))
|
||||
_Call(((), {'a': 'b'})) == ({'a': 'b'},)
|
||||
|
||||
The `_Call` object provides a useful shortcut for comparing with call::
|
||||
|
||||
_Call(((1, 2), {'a': 3})) == call(1, 2, a=3)
|
||||
_Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3)
|
||||
|
||||
If the _Call has no name then it will match any name.
|
||||
"""
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
value: _CallValue = (),
|
||||
name: str | None = "",
|
||||
parent: _Call | None = None,
|
||||
two: bool = False,
|
||||
from_kall: bool = True,
|
||||
) -> Self: ...
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -523,27 +583,32 @@ class _patcher:
|
|||
# Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock],
|
||||
# but that's impossible with the current type system.
|
||||
@overload
|
||||
def __call__(
|
||||
def __call__( # type: ignore[overload-overlap]
|
||||
self,
|
||||
target: str,
|
||||
new: _T,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
new_callable: Callable[..., Any] | None = ...,
|
||||
**kwargs: Any,
|
||||
spec: Literal[False] | None = None,
|
||||
create: bool = False,
|
||||
spec_set: Literal[False] | None = None,
|
||||
autospec: Literal[False] | None = None,
|
||||
new_callable: None = None,
|
||||
*,
|
||||
unsafe: bool = False,
|
||||
) -> _patch[_T]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
target: str,
|
||||
*,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec: Any | Literal[False] | None = None,
|
||||
create: bool = False,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec_set: Any | Literal[False] | None = None,
|
||||
autospec: Literal[False] | None = None,
|
||||
new_callable: Callable[..., _T],
|
||||
unsafe: bool = False,
|
||||
# kwargs are passed to new_callable
|
||||
**kwargs: Any,
|
||||
) -> _patch_pass_arg[_T]: ...
|
||||
@overload
|
||||
|
@ -551,25 +616,31 @@ class _patcher:
|
|||
self,
|
||||
target: str,
|
||||
*,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
spec: Any | bool | None = None,
|
||||
create: bool = False,
|
||||
spec_set: Any | bool | None = None,
|
||||
autospec: Any | bool | None = None,
|
||||
new_callable: None = None,
|
||||
unsafe: bool = False,
|
||||
# kwargs are passed to the MagicMock/AsyncMock constructor
|
||||
**kwargs: Any,
|
||||
) -> _patch_pass_arg[MagicMock | AsyncMock]: ...
|
||||
# This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any].
|
||||
# Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock],
|
||||
# but that's impossible with the current type system.
|
||||
@overload
|
||||
@staticmethod
|
||||
def object(
|
||||
target: Any,
|
||||
attribute: str,
|
||||
new: _T,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
new_callable: Callable[..., Any] | None = ...,
|
||||
**kwargs: Any,
|
||||
spec: Literal[False] | None = None,
|
||||
create: bool = False,
|
||||
spec_set: Literal[False] | None = None,
|
||||
autospec: Literal[False] | None = None,
|
||||
new_callable: None = None,
|
||||
*,
|
||||
unsafe: bool = False,
|
||||
) -> _patch[_T]: ...
|
||||
@overload
|
||||
@staticmethod
|
||||
|
@ -577,11 +648,15 @@ class _patcher:
|
|||
target: Any,
|
||||
attribute: str,
|
||||
*,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec: Any | Literal[False] | None = None,
|
||||
create: bool = False,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec_set: Any | Literal[False] | None = None,
|
||||
autospec: Literal[False] | None = None,
|
||||
new_callable: Callable[..., _T],
|
||||
unsafe: bool = False,
|
||||
# kwargs are passed to new_callable
|
||||
**kwargs: Any,
|
||||
) -> _patch_pass_arg[_T]: ...
|
||||
@overload
|
||||
|
@ -590,21 +665,54 @@ class _patcher:
|
|||
target: Any,
|
||||
attribute: str,
|
||||
*,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
spec: Any | bool | None = None,
|
||||
create: bool = False,
|
||||
spec_set: Any | bool | None = None,
|
||||
autospec: Any | bool | None = None,
|
||||
new_callable: None = None,
|
||||
unsafe: bool = False,
|
||||
# kwargs are passed to the MagicMock/AsyncMock constructor
|
||||
**kwargs: Any,
|
||||
) -> _patch_pass_arg[MagicMock | AsyncMock]: ...
|
||||
@overload
|
||||
@staticmethod
|
||||
def multiple(
|
||||
target: Any,
|
||||
spec: Any | None = ...,
|
||||
create: bool = ...,
|
||||
spec_set: Any | None = ...,
|
||||
autospec: Any | None = ...,
|
||||
new_callable: Any | None = ...,
|
||||
target: Any | str,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec: Any | Literal[False] | None = None,
|
||||
create: bool = False,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec_set: Any | Literal[False] | None = None,
|
||||
autospec: Literal[False] | None = None,
|
||||
*,
|
||||
new_callable: Callable[..., _T],
|
||||
# The kwargs must be DEFAULT
|
||||
**kwargs: Any,
|
||||
) -> _patch_pass_arg[_T]: ...
|
||||
@overload
|
||||
@staticmethod
|
||||
def multiple(
|
||||
target: Any | str,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec: Any | Literal[False] | None,
|
||||
create: bool,
|
||||
# If not False or None, this is passed to new_callable
|
||||
spec_set: Any | Literal[False] | None,
|
||||
autospec: Literal[False] | None,
|
||||
new_callable: Callable[..., _T],
|
||||
# The kwargs must be DEFAULT
|
||||
**kwargs: Any,
|
||||
) -> _patch_pass_arg[_T]: ...
|
||||
@overload
|
||||
@staticmethod
|
||||
def multiple(
|
||||
target: Any | str,
|
||||
spec: Any | bool | None = None,
|
||||
create: bool = False,
|
||||
spec_set: Any | bool | None = None,
|
||||
autospec: Any | bool | None = None,
|
||||
new_callable: None = None,
|
||||
# The kwargs are the mock objects or DEFAULT
|
||||
**kwargs: Any,
|
||||
) -> _patch[Any]: ...
|
||||
@staticmethod
|
||||
|
|
|
@ -11,7 +11,7 @@ from _weakrefset import WeakSet as WeakSet
|
|||
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Generic, TypeVar, final, overload
|
||||
from typing_extensions import ParamSpec, Self
|
||||
from typing_extensions import ParamSpec, Self, disjoint_base
|
||||
|
||||
__all__ = [
|
||||
"ref",
|
||||
|
@ -59,6 +59,7 @@ class ProxyType(Generic[_T]): # "weakproxy"
|
|||
def __getattr__(self, attr: str) -> Any: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
@disjoint_base
|
||||
class ReferenceType(Generic[_T]): # "weakref"
|
||||
__callback__: Callable[[Self], Any]
|
||||
def __new__(cls, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> Self: ...
|
||||
|
|
|
@ -38,7 +38,7 @@ from _collections_abc import dict_keys
|
|||
from _typeshed import FileDescriptorOrPath, ReadableBuffer, SupportsRead, SupportsWrite
|
||||
from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, Mapping, Sequence
|
||||
from typing import Any, Final, Generic, Literal, Protocol, SupportsIndex, TypeVar, overload, type_check_only
|
||||
from typing_extensions import TypeAlias, TypeGuard, deprecated
|
||||
from typing_extensions import TypeAlias, TypeGuard, deprecated, disjoint_base
|
||||
from xml.parsers.expat import XMLParserType
|
||||
|
||||
__all__ = [
|
||||
|
@ -134,6 +134,7 @@ _ElementCallable: TypeAlias = Callable[..., Element[_ElementCallable]]
|
|||
_Tag = TypeVar("_Tag", default=str, bound=str | _ElementCallable)
|
||||
_OtherTag = TypeVar("_OtherTag", default=str, bound=str | _ElementCallable)
|
||||
|
||||
@disjoint_base
|
||||
class Element(Generic[_Tag]):
|
||||
tag: _Tag
|
||||
attrib: dict[str, str]
|
||||
|
@ -592,6 +593,7 @@ def fromstringlist(sequence: Sequence[str | ReadableBuffer], parser: XMLParser |
|
|||
# elementfactories.
|
||||
_ElementFactory: TypeAlias = Callable[[Any, dict[Any, Any]], Element]
|
||||
|
||||
@disjoint_base
|
||||
class TreeBuilder:
|
||||
# comment_factory can take None because passing None to Comment is not an error
|
||||
def __init__(
|
||||
|
@ -679,6 +681,7 @@ _E = TypeVar("_E", default=Element)
|
|||
# The default target is TreeBuilder, which returns Element.
|
||||
# C14NWriterTarget does not implement a close method, so using it results
|
||||
# in a type of XMLParser[None].
|
||||
@disjoint_base
|
||||
class XMLParser(Generic[_E]):
|
||||
parser: XMLParserType
|
||||
target: _Target
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import sys
|
||||
from collections.abc import Iterable
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, disjoint_base
|
||||
from zoneinfo._common import ZoneInfoNotFoundError as ZoneInfoNotFoundError, _IOBytes
|
||||
from zoneinfo._tzpath import (
|
||||
TZPATH as TZPATH,
|
||||
|
@ -12,6 +12,7 @@ from zoneinfo._tzpath import (
|
|||
|
||||
__all__ = ["ZoneInfo", "reset_tzpath", "available_timezones", "TZPATH", "ZoneInfoNotFoundError", "InvalidTZPathWarning"]
|
||||
|
||||
@disjoint_base
|
||||
class ZoneInfo(tzinfo):
|
||||
@property
|
||||
def key(self) -> str: ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue