mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-18 06:18:42 +00:00
[ty] Sync vendored typeshed stubs (#20876)
Close and reopen this PR to trigger CI --------- Co-authored-by: typeshedbot <> Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
parent
651f7963a7
commit
cafb96aa7a
27 changed files with 487 additions and 288 deletions
|
@ -1842,13 +1842,13 @@ C.<CURSOR>
|
||||||
__name__ :: str
|
__name__ :: str
|
||||||
__ne__ :: def __ne__(self, value: object, /) -> bool
|
__ne__ :: def __ne__(self, value: object, /) -> bool
|
||||||
__new__ :: def __new__(cls) -> Self@__new__
|
__new__ :: def __new__(cls) -> Self@__new__
|
||||||
__or__ :: bound method <class 'C'>.__or__(value: Any, /) -> UnionType
|
__or__ :: bound method <class 'C'>.__or__[Self](value: Any, /) -> UnionType | Self@__or__
|
||||||
__prepare__ :: bound method <class 'Meta'>.__prepare__(name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
|
__prepare__ :: bound method <class 'Meta'>.__prepare__(name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
|
||||||
__qualname__ :: str
|
__qualname__ :: str
|
||||||
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
||||||
__reduce_ex__ :: def __reduce_ex__(self, protocol: SupportsIndex, /) -> str | tuple[Any, ...]
|
__reduce_ex__ :: def __reduce_ex__(self, protocol: SupportsIndex, /) -> str | tuple[Any, ...]
|
||||||
__repr__ :: def __repr__(self) -> str
|
__repr__ :: def __repr__(self) -> str
|
||||||
__ror__ :: bound method <class 'C'>.__ror__(value: Any, /) -> UnionType
|
__ror__ :: bound method <class 'C'>.__ror__[Self](value: Any, /) -> UnionType | Self@__ror__
|
||||||
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
||||||
__sizeof__ :: def __sizeof__(self) -> int
|
__sizeof__ :: def __sizeof__(self) -> int
|
||||||
__str__ :: def __str__(self) -> str
|
__str__ :: def __str__(self) -> str
|
||||||
|
@ -1910,13 +1910,13 @@ Meta.<CURSOR>
|
||||||
__mro__ :: tuple[<class 'Meta'>, <class 'type'>, <class 'object'>]
|
__mro__ :: tuple[<class 'Meta'>, <class 'type'>, <class 'object'>]
|
||||||
__name__ :: str
|
__name__ :: str
|
||||||
__ne__ :: def __ne__(self, value: object, /) -> bool
|
__ne__ :: def __ne__(self, value: object, /) -> bool
|
||||||
__or__ :: def __or__(self, value: Any, /) -> UnionType
|
__or__ :: def __or__[Self](self: Self@__or__, value: Any, /) -> UnionType | Self@__or__
|
||||||
__prepare__ :: bound method <class 'Meta'>.__prepare__(name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
|
__prepare__ :: bound method <class 'Meta'>.__prepare__(name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
|
||||||
__qualname__ :: str
|
__qualname__ :: str
|
||||||
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
||||||
__reduce_ex__ :: def __reduce_ex__(self, protocol: SupportsIndex, /) -> str | tuple[Any, ...]
|
__reduce_ex__ :: def __reduce_ex__(self, protocol: SupportsIndex, /) -> str | tuple[Any, ...]
|
||||||
__repr__ :: def __repr__(self) -> str
|
__repr__ :: def __repr__(self) -> str
|
||||||
__ror__ :: def __ror__(self, value: Any, /) -> UnionType
|
__ror__ :: def __ror__[Self](self: Self@__ror__, value: Any, /) -> UnionType | Self@__ror__
|
||||||
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
||||||
__sizeof__ :: def __sizeof__(self) -> int
|
__sizeof__ :: def __sizeof__(self) -> int
|
||||||
__str__ :: def __str__(self) -> str
|
__str__ :: def __str__(self) -> str
|
||||||
|
@ -2019,13 +2019,13 @@ Quux.<CURSOR>
|
||||||
__name__ :: str
|
__name__ :: str
|
||||||
__ne__ :: def __ne__(self, value: object, /) -> bool
|
__ne__ :: def __ne__(self, value: object, /) -> bool
|
||||||
__new__ :: def __new__(cls) -> Self@__new__
|
__new__ :: def __new__(cls) -> Self@__new__
|
||||||
__or__ :: bound method <class 'Quux'>.__or__(value: Any, /) -> UnionType
|
__or__ :: bound method <class 'Quux'>.__or__[Self](value: Any, /) -> UnionType | Self@__or__
|
||||||
__prepare__ :: bound method <class 'type'>.__prepare__(name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
|
__prepare__ :: bound method <class 'type'>.__prepare__(name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
|
||||||
__qualname__ :: str
|
__qualname__ :: str
|
||||||
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
||||||
__reduce_ex__ :: def __reduce_ex__(self, protocol: SupportsIndex, /) -> str | tuple[Any, ...]
|
__reduce_ex__ :: def __reduce_ex__(self, protocol: SupportsIndex, /) -> str | tuple[Any, ...]
|
||||||
__repr__ :: def __repr__(self) -> str
|
__repr__ :: def __repr__(self) -> str
|
||||||
__ror__ :: bound method <class 'Quux'>.__ror__(value: Any, /) -> UnionType
|
__ror__ :: bound method <class 'Quux'>.__ror__[Self](value: Any, /) -> UnionType | Self@__ror__
|
||||||
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
||||||
__sizeof__ :: def __sizeof__(self) -> int
|
__sizeof__ :: def __sizeof__(self) -> int
|
||||||
__str__ :: def __str__(self) -> str
|
__str__ :: def __str__(self) -> str
|
||||||
|
@ -2096,14 +2096,14 @@ Answer.<CURSOR>
|
||||||
__name__ :: str
|
__name__ :: str
|
||||||
__ne__ :: def __ne__(self, value: object, /) -> bool
|
__ne__ :: def __ne__(self, value: object, /) -> bool
|
||||||
__new__ :: def __new__(cls, value: object) -> Self@__new__
|
__new__ :: def __new__(cls, value: object) -> Self@__new__
|
||||||
__or__ :: bound method <class 'Answer'>.__or__(value: Any, /) -> UnionType
|
__or__ :: bound method <class 'Answer'>.__or__[Self](value: Any, /) -> UnionType | Self@__or__
|
||||||
__order__ :: str
|
__order__ :: str
|
||||||
__prepare__ :: bound method <class 'EnumMeta'>.__prepare__(cls: str, bases: tuple[type, ...], **kwds: Any) -> _EnumDict
|
__prepare__ :: bound method <class 'EnumMeta'>.__prepare__(cls: str, bases: tuple[type, ...], **kwds: Any) -> _EnumDict
|
||||||
__qualname__ :: str
|
__qualname__ :: str
|
||||||
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
__reduce__ :: def __reduce__(self) -> str | tuple[Any, ...]
|
||||||
__repr__ :: def __repr__(self) -> str
|
__repr__ :: def __repr__(self) -> str
|
||||||
__reversed__ :: bound method <class 'Answer'>.__reversed__[_EnumMemberT]() -> Iterator[_EnumMemberT@__reversed__]
|
__reversed__ :: bound method <class 'Answer'>.__reversed__[_EnumMemberT]() -> Iterator[_EnumMemberT@__reversed__]
|
||||||
__ror__ :: bound method <class 'Answer'>.__ror__(value: Any, /) -> UnionType
|
__ror__ :: bound method <class 'Answer'>.__ror__[Self](value: Any, /) -> UnionType | Self@__ror__
|
||||||
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
__setattr__ :: def __setattr__(self, name: str, value: Any, /) -> None
|
||||||
__sizeof__ :: def __sizeof__(self) -> int
|
__sizeof__ :: def __sizeof__(self) -> int
|
||||||
__str__ :: def __str__(self) -> str
|
__str__ :: def __str__(self) -> str
|
||||||
|
|
|
@ -199,13 +199,13 @@ mod tests {
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:911:7
|
--> stdlib/builtins.pyi:913:7
|
||||||
|
|
|
|
||||||
910 | @disjoint_base
|
912 | @disjoint_base
|
||||||
911 | class str(Sequence[str]):
|
913 | class str(Sequence[str]):
|
||||||
| ^^^
|
| ^^^
|
||||||
912 | """str(object='') -> str
|
914 | """str(object='') -> str
|
||||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
915 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:4:1
|
--> main.py:4:1
|
||||||
|
@ -227,13 +227,13 @@ mod tests {
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:911:7
|
--> stdlib/builtins.pyi:913:7
|
||||||
|
|
|
|
||||||
910 | @disjoint_base
|
912 | @disjoint_base
|
||||||
911 | class str(Sequence[str]):
|
913 | class str(Sequence[str]):
|
||||||
| ^^^
|
| ^^^
|
||||||
912 | """str(object='') -> str
|
914 | """str(object='') -> str
|
||||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
915 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:2:10
|
--> main.py:2:10
|
||||||
|
@ -324,13 +324,13 @@ mod tests {
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:911:7
|
--> stdlib/builtins.pyi:913:7
|
||||||
|
|
|
|
||||||
910 | @disjoint_base
|
912 | @disjoint_base
|
||||||
911 | class str(Sequence[str]):
|
913 | class str(Sequence[str]):
|
||||||
| ^^^
|
| ^^^
|
||||||
912 | """str(object='') -> str
|
914 | """str(object='') -> str
|
||||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
915 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:4:6
|
--> main.py:4:6
|
||||||
|
@ -358,13 +358,13 @@ mod tests {
|
||||||
// is an int. Navigating to `str` would match pyright's behavior.
|
// is an int. Navigating to `str` would match pyright's behavior.
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:344:7
|
--> stdlib/builtins.pyi:346:7
|
||||||
|
|
|
|
||||||
343 | @disjoint_base
|
345 | @disjoint_base
|
||||||
344 | class int:
|
346 | class int:
|
||||||
| ^^^
|
| ^^^
|
||||||
345 | """int([x]) -> integer
|
347 | """int([x]) -> integer
|
||||||
346 | int(x, base=10) -> integer
|
348 | int(x, base=10) -> integer
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:4:6
|
--> main.py:4:6
|
||||||
|
@ -391,13 +391,13 @@ f(**kwargs<CURSOR>)
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:2916:7
|
--> stdlib/builtins.pyi:2918:7
|
||||||
|
|
|
|
||||||
2915 | @disjoint_base
|
2917 | @disjoint_base
|
||||||
2916 | class dict(MutableMapping[_KT, _VT]):
|
2918 | class dict(MutableMapping[_KT, _VT]):
|
||||||
| ^^^^
|
| ^^^^
|
||||||
2917 | """dict() -> new empty dictionary
|
2919 | """dict() -> new empty dictionary
|
||||||
2918 | dict(mapping) -> new dictionary initialized from a mapping object's
|
2920 | dict(mapping) -> new dictionary initialized from a mapping object's
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:6:5
|
--> main.py:6:5
|
||||||
|
@ -421,13 +421,13 @@ f(**kwargs<CURSOR>)
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:911:7
|
--> stdlib/builtins.pyi:913:7
|
||||||
|
|
|
|
||||||
910 | @disjoint_base
|
912 | @disjoint_base
|
||||||
911 | class str(Sequence[str]):
|
913 | class str(Sequence[str]):
|
||||||
| ^^^
|
| ^^^
|
||||||
912 | """str(object='') -> str
|
914 | """str(object='') -> str
|
||||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
915 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:3:5
|
--> main.py:3:5
|
||||||
|
@ -513,13 +513,13 @@ f(**kwargs<CURSOR>)
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:911:7
|
--> stdlib/builtins.pyi:913:7
|
||||||
|
|
|
|
||||||
910 | @disjoint_base
|
912 | @disjoint_base
|
||||||
911 | class str(Sequence[str]):
|
913 | class str(Sequence[str]):
|
||||||
| ^^^
|
| ^^^
|
||||||
912 | """str(object='') -> str
|
914 | """str(object='') -> str
|
||||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
915 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:4:15
|
--> main.py:4:15
|
||||||
|
@ -560,13 +560,13 @@ f(**kwargs<CURSOR>)
|
||||||
|
|
|
|
||||||
|
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/builtins.pyi:911:7
|
--> stdlib/builtins.pyi:913:7
|
||||||
|
|
|
|
||||||
910 | @disjoint_base
|
912 | @disjoint_base
|
||||||
911 | class str(Sequence[str]):
|
913 | class str(Sequence[str]):
|
||||||
| ^^^
|
| ^^^
|
||||||
912 | """str(object='') -> str
|
914 | """str(object='') -> str
|
||||||
913 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
915 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:3:5
|
--> main.py:3:5
|
||||||
|
|
|
@ -2189,7 +2189,7 @@ All attribute access on literal `bytes` types is currently delegated to `builtin
|
||||||
```py
|
```py
|
||||||
# revealed: bound method Literal[b"foo"].join(iterable_of_bytes: Iterable[@Todo(Support for `typing.TypeAlias`)], /) -> bytes
|
# revealed: bound method Literal[b"foo"].join(iterable_of_bytes: Iterable[@Todo(Support for `typing.TypeAlias`)], /) -> bytes
|
||||||
reveal_type(b"foo".join)
|
reveal_type(b"foo".join)
|
||||||
# revealed: bound method Literal[b"foo"].endswith(suffix: @Todo(Support for `typing.TypeAlias`) | tuple[@Todo(Support for `typing.TypeAlias`), ...], start: SupportsIndex | None = EllipsisType, end: SupportsIndex | None = EllipsisType, /) -> bool
|
# revealed: bound method Literal[b"foo"].endswith(suffix: @Todo(Support for `typing.TypeAlias`) | tuple[@Todo(Support for `typing.TypeAlias`), ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> bool
|
||||||
reveal_type(b"foo".endswith)
|
reveal_type(b"foo".endswith)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,27 @@ class B: ...
|
||||||
# error: "Operator `|` is unsupported between objects of type `<class 'A'>` and `<class 'B'>`"
|
# error: "Operator `|` is unsupported between objects of type `<class 'A'>` and `<class 'B'>`"
|
||||||
reveal_type(A | B) # revealed: Unknown
|
reveal_type(A | B) # revealed: Unknown
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Other binary operations resulting in `UnionType`
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[environment]
|
||||||
|
python-version = "3.12"
|
||||||
|
```
|
||||||
|
|
||||||
|
```py
|
||||||
|
class A: ...
|
||||||
|
class B: ...
|
||||||
|
|
||||||
|
def _(sub_a: type[A], sub_b: type[B]):
|
||||||
|
reveal_type(A | sub_b) # revealed: UnionType
|
||||||
|
reveal_type(sub_a | B) # revealed: UnionType
|
||||||
|
reveal_type(sub_a | sub_b) # revealed: UnionType
|
||||||
|
|
||||||
|
class C[T]: ...
|
||||||
|
class D[T]: ...
|
||||||
|
|
||||||
|
reveal_type(C | D) # revealed: UnionType
|
||||||
|
|
||||||
|
reveal_type(C[int] | D[str]) # revealed: UnionType
|
||||||
|
```
|
||||||
|
|
|
@ -651,7 +651,7 @@ static_assert(is_assignable_to(TypeOf[property.__set__], Callable))
|
||||||
reveal_type(MyClass.my_property.__set__)
|
reveal_type(MyClass.my_property.__set__)
|
||||||
static_assert(is_assignable_to(TypeOf[MyClass.my_property.__set__], Callable))
|
static_assert(is_assignable_to(TypeOf[MyClass.my_property.__set__], Callable))
|
||||||
|
|
||||||
# revealed: def startswith(self, prefix: str | tuple[str, ...], start: SupportsIndex | None = EllipsisType, end: SupportsIndex | None = EllipsisType, /) -> bool
|
# revealed: def startswith(self, prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> bool
|
||||||
reveal_type(str.startswith)
|
reveal_type(str.startswith)
|
||||||
static_assert(is_assignable_to(TypeOf[str.startswith], Callable))
|
static_assert(is_assignable_to(TypeOf[str.startswith], Callable))
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ def _(
|
||||||
# revealed: (obj: type) -> None
|
# revealed: (obj: type) -> None
|
||||||
reveal_type(e)
|
reveal_type(e)
|
||||||
|
|
||||||
# revealed: (fget: ((Any, /) -> Any) | None = EllipsisType, fset: ((Any, Any, /) -> None) | None = EllipsisType, fdel: ((Any, /) -> None) | None = EllipsisType, doc: str | None = EllipsisType) -> property
|
# revealed: (fget: ((Any, /) -> Any) | None = None, fset: ((Any, Any, /) -> None) | None = None, fdel: ((Any, /) -> None) | None = None, doc: str | None = None) -> property
|
||||||
reveal_type(f)
|
reveal_type(f)
|
||||||
|
|
||||||
# revealed: Overload[(self: property, instance: None, owner: type, /) -> Unknown, (self: property, instance: object, owner: type | None = None, /) -> Unknown]
|
# revealed: Overload[(self: property, instance: None, owner: type, /) -> Unknown, (self: property, instance: object, owner: type | None = None, /) -> Unknown]
|
||||||
|
@ -707,7 +707,7 @@ def _(
|
||||||
# revealed: (instance: object, value: object, /) -> Unknown
|
# revealed: (instance: object, value: object, /) -> Unknown
|
||||||
reveal_type(j)
|
reveal_type(j)
|
||||||
|
|
||||||
# revealed: (self, prefix: str | tuple[str, ...], start: SupportsIndex | None = EllipsisType, end: SupportsIndex | None = EllipsisType, /) -> bool
|
# revealed: (self, prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> bool
|
||||||
reveal_type(k)
|
reveal_type(k)
|
||||||
|
|
||||||
# revealed: (prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> bool
|
# revealed: (prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> bool
|
||||||
|
|
|
@ -26,13 +26,13 @@ error[invalid-await]: `Literal[1]` is not awaitable
|
||||||
2 | await 1 # error: [invalid-await]
|
2 | await 1 # error: [invalid-await]
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
::: stdlib/builtins.pyi:344:7
|
::: stdlib/builtins.pyi:346:7
|
||||||
|
|
|
|
||||||
343 | @disjoint_base
|
345 | @disjoint_base
|
||||||
344 | class int:
|
346 | class int:
|
||||||
| --- type defined here
|
| --- type defined here
|
||||||
345 | """int([x]) -> integer
|
347 | """int([x]) -> integer
|
||||||
346 | int(x, base=10) -> integer
|
348 | int(x, base=10) -> integer
|
||||||
|
|
|
|
||||||
info: `__await__` is missing
|
info: `__await__` is missing
|
||||||
info: rule `invalid-await` is enabled by default
|
info: rule `invalid-await` is enabled by default
|
||||||
|
|
|
@ -7957,6 +7957,21 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special-case `X | Y` with `X` and `Y` instances of `type` to produce a `types.UnionType` instance, in order to
|
||||||
|
// overwrite the typeshed return type for `type.__or__`, which would result in `types.UnionType | X`. We currently
|
||||||
|
// do this to avoid false positives when a legacy type alias like `IntOrStr = int | str` is later used in a type
|
||||||
|
// expression, because `types.UnionType` will result in a `@Todo` type, while `types.UnionType | <class 'int'>` does
|
||||||
|
// not.
|
||||||
|
//
|
||||||
|
// TODO: Remove this special case once we add support for legacy type aliases.
|
||||||
|
(
|
||||||
|
Type::ClassLiteral(..) | Type::SubclassOf(..) | Type::GenericAlias(..),
|
||||||
|
Type::ClassLiteral(..) | Type::SubclassOf(..) | Type::GenericAlias(..),
|
||||||
|
ast::Operator::BitOr,
|
||||||
|
) if Program::get(self.db()).python_version(self.db()) >= PythonVersion::PY310 => {
|
||||||
|
Some(KnownClass::UnionType.to_instance(self.db()))
|
||||||
|
}
|
||||||
|
|
||||||
// We've handled all of the special cases that we support for literals, so we need to
|
// We've handled all of the special cases that we support for literals, so we need to
|
||||||
// fall back on looking for dunder methods on one of the operand types.
|
// fall back on looking for dunder methods on one of the operand types.
|
||||||
(
|
(
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
91055c730ffcda6311654cf32d663858ece69bad
|
d6f4a0f7102b1400a21742cf9b7ea93614e2b6ec
|
||||||
|
|
|
@ -136,7 +136,7 @@ else:
|
||||||
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
||||||
|
|
||||||
def writer(
|
def writer(
|
||||||
csvfile: SupportsWrite[str],
|
fileobj: SupportsWrite[str],
|
||||||
/,
|
/,
|
||||||
dialect: _DialectLike = "excel",
|
dialect: _DialectLike = "excel",
|
||||||
*,
|
*,
|
||||||
|
@ -164,7 +164,7 @@ def writer(
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def reader(
|
def reader(
|
||||||
csvfile: Iterable[str],
|
iterable: Iterable[str],
|
||||||
/,
|
/,
|
||||||
dialect: _DialectLike = "excel",
|
dialect: _DialectLike = "excel",
|
||||||
*,
|
*,
|
||||||
|
@ -194,7 +194,8 @@ def reader(
|
||||||
|
|
||||||
def register_dialect(
|
def register_dialect(
|
||||||
name: str,
|
name: str,
|
||||||
dialect: type[Dialect | csv.Dialect] = ...,
|
/,
|
||||||
|
dialect: type[Dialect | csv.Dialect] | str = "excel",
|
||||||
*,
|
*,
|
||||||
delimiter: str = ",",
|
delimiter: str = ",",
|
||||||
quotechar: str | None = '"',
|
quotechar: str | None = '"',
|
||||||
|
|
|
@ -251,7 +251,7 @@ class SourceLoader(_LoaderBasics):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def source_to_code(
|
def source_to_code(
|
||||||
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath
|
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath
|
||||||
) -> types.CodeType:
|
) -> types.CodeType:
|
||||||
"""Return the code object compiled from source.
|
"""Return the code object compiled from source.
|
||||||
|
|
||||||
|
@ -281,10 +281,10 @@ class FileLoader:
|
||||||
def get_data(self, path: str) -> bytes:
|
def get_data(self, path: str) -> bytes:
|
||||||
"""Return the data from path as raw bytes."""
|
"""Return the data from path as raw bytes."""
|
||||||
|
|
||||||
def get_filename(self, name: str | None = None) -> str:
|
def get_filename(self, fullname: str | None = None) -> str:
|
||||||
"""Return the path to the source file as found by the finder."""
|
"""Return the path to the source file as found by the finder."""
|
||||||
|
|
||||||
def load_module(self, name: str | None = None) -> types.ModuleType:
|
def load_module(self, fullname: str | None = None) -> types.ModuleType:
|
||||||
"""Load a module from a file.
|
"""Load a module from a file.
|
||||||
|
|
||||||
This method is deprecated. Use exec_module() instead.
|
This method is deprecated. Use exec_module() instead.
|
||||||
|
@ -311,7 +311,7 @@ class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.Sourc
|
||||||
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
|
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
|
||||||
self,
|
self,
|
||||||
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
|
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||||
path: ReadableBuffer | StrPath,
|
path: bytes | StrPath,
|
||||||
*,
|
*,
|
||||||
_optimize: int = -1,
|
_optimize: int = -1,
|
||||||
) -> types.CodeType:
|
) -> types.CodeType:
|
||||||
|
@ -335,7 +335,7 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics, importlib.abc.ExecutionLoad
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name: str, path: str) -> None: ...
|
def __init__(self, name: str, path: str) -> None: ...
|
||||||
def get_filename(self, name: str | None = None) -> str:
|
def get_filename(self, fullname: str | None = None) -> str:
|
||||||
"""Return the path to the source file as found by the finder."""
|
"""Return the path to the source file as found by the finder."""
|
||||||
|
|
||||||
def get_source(self, fullname: str) -> None:
|
def get_source(self, fullname: str) -> None:
|
||||||
|
|
|
@ -142,6 +142,9 @@ class SupportsIter(Protocol[_T_co]):
|
||||||
class SupportsAiter(Protocol[_T_co]):
|
class SupportsAiter(Protocol[_T_co]):
|
||||||
def __aiter__(self) -> _T_co: ...
|
def __aiter__(self) -> _T_co: ...
|
||||||
|
|
||||||
|
class SupportsLen(Protocol):
|
||||||
|
def __len__(self) -> int: ...
|
||||||
|
|
||||||
class SupportsLenAndGetItem(Protocol[_T_co]):
|
class SupportsLenAndGetItem(Protocol[_T_co]):
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
def __getitem__(self, k: int, /) -> _T_co: ...
|
def __getitem__(self, k: int, /) -> _T_co: ...
|
||||||
|
|
|
@ -2179,14 +2179,14 @@ _T = _TypeVar("_T", bound=AST)
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: _T,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||||
mode: Literal["exec"] = "exec",
|
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
feature_version: None | int | tuple[int, int] = None,
|
feature_version: None | int | tuple[int, int] = None,
|
||||||
optimize: Literal[-1, 0, 1, 2] = -1,
|
optimize: Literal[-1, 0, 1, 2] = -1,
|
||||||
) -> Module:
|
) -> _T:
|
||||||
"""
|
"""
|
||||||
Parse the source into an AST node.
|
Parse the source into an AST node.
|
||||||
Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
|
Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
|
||||||
|
@ -2196,7 +2196,17 @@ if sys.version_info >= (3, 13):
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||||
|
mode: Literal["exec"] = "exec",
|
||||||
|
*,
|
||||||
|
type_comments: bool = False,
|
||||||
|
feature_version: None | int | tuple[int, int] = None,
|
||||||
|
optimize: Literal[-1, 0, 1, 2] = -1,
|
||||||
|
) -> Module: ...
|
||||||
|
@overload
|
||||||
|
def parse(
|
||||||
|
source: str | ReadableBuffer,
|
||||||
|
filename: str | bytes | os.PathLike[Any],
|
||||||
mode: Literal["eval"],
|
mode: Literal["eval"],
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2206,7 +2216,7 @@ if sys.version_info >= (3, 13):
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
filename: str | bytes | os.PathLike[Any],
|
||||||
mode: Literal["func_type"],
|
mode: Literal["func_type"],
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2216,7 +2226,7 @@ if sys.version_info >= (3, 13):
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
filename: str | bytes | os.PathLike[Any],
|
||||||
mode: Literal["single"],
|
mode: Literal["single"],
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2253,7 +2263,7 @@ if sys.version_info >= (3, 13):
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||||
mode: str = "exec",
|
mode: str = "exec",
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2264,13 +2274,13 @@ if sys.version_info >= (3, 13):
|
||||||
else:
|
else:
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: _T,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||||
mode: Literal["exec"] = "exec",
|
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
feature_version: None | int | tuple[int, int] = None,
|
feature_version: None | int | tuple[int, int] = None,
|
||||||
) -> Module:
|
) -> _T:
|
||||||
"""
|
"""
|
||||||
Parse the source into an AST node.
|
Parse the source into an AST node.
|
||||||
Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
|
Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
|
||||||
|
@ -2280,7 +2290,16 @@ else:
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||||
|
mode: Literal["exec"] = "exec",
|
||||||
|
*,
|
||||||
|
type_comments: bool = False,
|
||||||
|
feature_version: None | int | tuple[int, int] = None,
|
||||||
|
) -> Module: ...
|
||||||
|
@overload
|
||||||
|
def parse(
|
||||||
|
source: str | ReadableBuffer,
|
||||||
|
filename: str | bytes | os.PathLike[Any],
|
||||||
mode: Literal["eval"],
|
mode: Literal["eval"],
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2289,7 +2308,7 @@ else:
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
filename: str | bytes | os.PathLike[Any],
|
||||||
mode: Literal["func_type"],
|
mode: Literal["func_type"],
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2298,7 +2317,7 @@ else:
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
filename: str | bytes | os.PathLike[Any],
|
||||||
mode: Literal["single"],
|
mode: Literal["single"],
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
@ -2331,7 +2350,7 @@ else:
|
||||||
@overload
|
@overload
|
||||||
def parse(
|
def parse(
|
||||||
source: str | ReadableBuffer,
|
source: str | ReadableBuffer,
|
||||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||||
mode: str = "exec",
|
mode: str = "exec",
|
||||||
*,
|
*,
|
||||||
type_comments: bool = False,
|
type_comments: bool = False,
|
||||||
|
|
|
@ -301,10 +301,12 @@ class type:
|
||||||
def __prepare__(metacls, name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]:
|
def __prepare__(metacls, name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]:
|
||||||
"""Create the namespace for the class statement"""
|
"""Create the namespace for the class statement"""
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
def __or__(self, value: Any, /) -> types.UnionType:
|
# `int | str` produces an instance of `UnionType`, but `int | int` produces an instance of `type`,
|
||||||
|
# and `abc.ABC | abc.ABC` produces an instance of `abc.ABCMeta`.
|
||||||
|
def __or__(self: _typeshed.Self, value: Any, /) -> types.UnionType | _typeshed.Self:
|
||||||
"""Return self|value."""
|
"""Return self|value."""
|
||||||
|
|
||||||
def __ror__(self, value: Any, /) -> types.UnionType:
|
def __ror__(self: _typeshed.Self, value: Any, /) -> types.UnionType | _typeshed.Self:
|
||||||
"""Return value|self."""
|
"""Return value|self."""
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
|
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
|
||||||
|
@ -359,7 +361,7 @@ class int:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
|
def __new__(cls, x: ConvertibleToInt = 0, /) -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, x: str | bytes | bytearray, /, base: SupportsIndex) -> Self: ...
|
def __new__(cls, x: str | bytes | bytearray, /, base: SupportsIndex) -> Self: ...
|
||||||
def as_integer_ratio(self) -> tuple[int, Literal[1]]:
|
def as_integer_ratio(self) -> tuple[int, Literal[1]]:
|
||||||
|
@ -657,7 +659,7 @@ class int:
|
||||||
class float:
|
class float:
|
||||||
"""Convert a string or number to a floating-point number, if possible."""
|
"""Convert a string or number to a floating-point number, if possible."""
|
||||||
|
|
||||||
def __new__(cls, x: ConvertibleToFloat = ..., /) -> Self: ...
|
def __new__(cls, x: ConvertibleToFloat = 0, /) -> Self: ...
|
||||||
def as_integer_ratio(self) -> tuple[int, int]:
|
def as_integer_ratio(self) -> tuple[int, int]:
|
||||||
"""Return a pair of integers, whose ratio is exactly equal to the original float.
|
"""Return a pair of integers, whose ratio is exactly equal to the original float.
|
||||||
|
|
||||||
|
@ -828,8 +830,8 @@ class complex:
|
||||||
@overload
|
@overload
|
||||||
def __new__(
|
def __new__(
|
||||||
cls,
|
cls,
|
||||||
real: complex | SupportsComplex | SupportsFloat | SupportsIndex = ...,
|
real: complex | SupportsComplex | SupportsFloat | SupportsIndex = 0,
|
||||||
imag: complex | SupportsFloat | SupportsIndex = ...,
|
imag: complex | SupportsFloat | SupportsIndex = 0,
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ...
|
def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ...
|
||||||
|
@ -922,9 +924,9 @@ class str(Sequence[str]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, object: object = ...) -> Self: ...
|
def __new__(cls, object: object = "") -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
|
def __new__(cls, object: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def capitalize(self: LiteralString) -> LiteralString:
|
def capitalize(self: LiteralString) -> LiteralString:
|
||||||
"""Return a capitalized version of the string.
|
"""Return a capitalized version of the string.
|
||||||
|
@ -950,7 +952,7 @@ class str(Sequence[str]):
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
|
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
|
||||||
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int:
|
def count(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int:
|
||||||
"""Return the number of non-overlapping occurrences of substring sub in string S[start:end].
|
"""Return the number of non-overlapping occurrences of substring sub in string S[start:end].
|
||||||
|
|
||||||
Optional arguments start and end are interpreted as in slice notation.
|
Optional arguments start and end are interpreted as in slice notation.
|
||||||
|
@ -970,7 +972,7 @@ class str(Sequence[str]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def endswith(
|
def endswith(
|
||||||
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return True if the string ends with the specified suffix, False otherwise.
|
"""Return True if the string ends with the specified suffix, False otherwise.
|
||||||
|
|
||||||
|
@ -991,7 +993,7 @@ class str(Sequence[str]):
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
|
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
|
||||||
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int:
|
def find(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int:
|
||||||
"""Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
|
"""Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||||
|
|
||||||
Optional arguments start and end are interpreted as in slice notation.
|
Optional arguments start and end are interpreted as in slice notation.
|
||||||
|
@ -1011,7 +1013,7 @@ class str(Sequence[str]):
|
||||||
The substitutions are identified by braces ('{' and '}').
|
The substitutions are identified by braces ('{' and '}').
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int:
|
def index(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int:
|
||||||
"""Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
|
"""Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||||
|
|
||||||
Optional arguments start and end are interpreted as in slice notation.
|
Optional arguments start and end are interpreted as in slice notation.
|
||||||
|
@ -1203,14 +1205,14 @@ class str(Sequence[str]):
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
|
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
|
||||||
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int:
|
def rfind(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int:
|
||||||
"""Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
|
"""Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||||
|
|
||||||
Optional arguments start and end are interpreted as in slice notation.
|
Optional arguments start and end are interpreted as in slice notation.
|
||||||
Return -1 on failure.
|
Return -1 on failure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int:
|
def rindex(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int:
|
||||||
"""Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
|
"""Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||||
|
|
||||||
Optional arguments start and end are interpreted as in slice notation.
|
Optional arguments start and end are interpreted as in slice notation.
|
||||||
|
@ -1302,7 +1304,7 @@ class str(Sequence[str]):
|
||||||
@overload
|
@overload
|
||||||
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
|
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
|
||||||
def startswith(
|
def startswith(
|
||||||
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return True if the string starts with the specified prefix, False otherwise.
|
"""Return True if the string starts with the specified prefix, False otherwise.
|
||||||
|
|
||||||
|
@ -1458,7 +1460,7 @@ class bytes(Sequence[int]):
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer, /) -> Self: ...
|
def __new__(cls, o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer, /) -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, string: str, /, encoding: str, errors: str = ...) -> Self: ...
|
def __new__(cls, string: str, /, encoding: str, errors: str = "strict") -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls) -> Self: ...
|
def __new__(cls) -> Self: ...
|
||||||
def capitalize(self) -> bytes:
|
def capitalize(self) -> bytes:
|
||||||
|
@ -1475,7 +1477,7 @@ class bytes(Sequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def count(
|
def count(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the number of non-overlapping occurrences of subsection 'sub' in bytes B[start:end].
|
"""Return the number of non-overlapping occurrences of subsection 'sub' in bytes B[start:end].
|
||||||
|
|
||||||
|
@ -1501,8 +1503,8 @@ class bytes(Sequence[int]):
|
||||||
def endswith(
|
def endswith(
|
||||||
self,
|
self,
|
||||||
suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||||
start: SupportsIndex | None = ...,
|
start: SupportsIndex | None = None,
|
||||||
end: SupportsIndex | None = ...,
|
end: SupportsIndex | None = None,
|
||||||
/,
|
/,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return True if the bytes ends with the specified suffix, False otherwise.
|
"""Return True if the bytes ends with the specified suffix, False otherwise.
|
||||||
|
@ -1522,7 +1524,7 @@ class bytes(Sequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def find(
|
def find(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
||||||
|
|
||||||
|
@ -1534,7 +1536,7 @@ class bytes(Sequence[int]):
|
||||||
Return -1 on failure.
|
Return -1 on failure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str:
|
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = 1) -> str:
|
||||||
"""Create a string of hexadecimal numbers from a bytes object.
|
"""Create a string of hexadecimal numbers from a bytes object.
|
||||||
|
|
||||||
sep
|
sep
|
||||||
|
@ -1556,7 +1558,7 @@ class bytes(Sequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def index(
|
def index(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
||||||
|
|
||||||
|
@ -1692,7 +1694,7 @@ class bytes(Sequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rfind(
|
def rfind(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
||||||
|
|
||||||
|
@ -1705,7 +1707,7 @@ class bytes(Sequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rindex(
|
def rindex(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].
|
||||||
|
|
||||||
|
@ -1776,8 +1778,8 @@ class bytes(Sequence[int]):
|
||||||
def startswith(
|
def startswith(
|
||||||
self,
|
self,
|
||||||
prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||||
start: SupportsIndex | None = ...,
|
start: SupportsIndex | None = None,
|
||||||
end: SupportsIndex | None = ...,
|
end: SupportsIndex | None = None,
|
||||||
/,
|
/,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return True if the bytes starts with the specified prefix, False otherwise.
|
"""Return True if the bytes starts with the specified prefix, False otherwise.
|
||||||
|
@ -1913,7 +1915,7 @@ class bytearray(MutableSequence[int]):
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer, /) -> None: ...
|
def __init__(self, ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer, /) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, string: str, /, encoding: str, errors: str = ...) -> None: ...
|
def __init__(self, string: str, /, encoding: str, errors: str = "strict") -> None: ...
|
||||||
def append(self, item: SupportsIndex, /) -> None:
|
def append(self, item: SupportsIndex, /) -> None:
|
||||||
"""Append a single item to the end of the bytearray.
|
"""Append a single item to the end of the bytearray.
|
||||||
|
|
||||||
|
@ -1935,7 +1937,7 @@ class bytearray(MutableSequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def count(
|
def count(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the number of non-overlapping occurrences of subsection 'sub' in bytes B[start:end].
|
"""Return the number of non-overlapping occurrences of subsection 'sub' in bytes B[start:end].
|
||||||
|
|
||||||
|
@ -1964,8 +1966,8 @@ class bytearray(MutableSequence[int]):
|
||||||
def endswith(
|
def endswith(
|
||||||
self,
|
self,
|
||||||
suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||||
start: SupportsIndex | None = ...,
|
start: SupportsIndex | None = None,
|
||||||
end: SupportsIndex | None = ...,
|
end: SupportsIndex | None = None,
|
||||||
/,
|
/,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return True if the bytearray ends with the specified suffix, False otherwise.
|
"""Return True if the bytearray ends with the specified suffix, False otherwise.
|
||||||
|
@ -1992,7 +1994,7 @@ class bytearray(MutableSequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def find(
|
def find(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
||||||
|
|
||||||
|
@ -2004,7 +2006,7 @@ class bytearray(MutableSequence[int]):
|
||||||
Return -1 on failure.
|
Return -1 on failure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str:
|
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = 1) -> str:
|
||||||
"""Create a string of hexadecimal numbers from a bytearray object.
|
"""Create a string of hexadecimal numbers from a bytearray object.
|
||||||
|
|
||||||
sep
|
sep
|
||||||
|
@ -2026,7 +2028,7 @@ class bytearray(MutableSequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def index(
|
def index(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
"""Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
||||||
|
|
||||||
|
@ -2187,7 +2189,7 @@ class bytearray(MutableSequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rfind(
|
def rfind(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
||||||
|
|
||||||
|
@ -2200,7 +2202,7 @@ class bytearray(MutableSequence[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rindex(
|
def rindex(
|
||||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
"""Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end].
|
||||||
|
|
||||||
|
@ -2272,8 +2274,8 @@ class bytearray(MutableSequence[int]):
|
||||||
def startswith(
|
def startswith(
|
||||||
self,
|
self,
|
||||||
prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||||
start: SupportsIndex | None = ...,
|
start: SupportsIndex | None = None,
|
||||||
end: SupportsIndex | None = ...,
|
end: SupportsIndex | None = None,
|
||||||
/,
|
/,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return True if the bytearray starts with the specified prefix, False otherwise.
|
"""Return True if the bytearray starts with the specified prefix, False otherwise.
|
||||||
|
@ -2549,7 +2551,7 @@ class memoryview(Sequence[_I]):
|
||||||
def release(self) -> None:
|
def release(self) -> None:
|
||||||
"""Release the underlying buffer exposed by the memoryview object."""
|
"""Release the underlying buffer exposed by the memoryview object."""
|
||||||
|
|
||||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str:
|
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = 1) -> str:
|
||||||
"""Return the data in the buffer as a str of hexadecimal numbers.
|
"""Return the data in the buffer as a str of hexadecimal numbers.
|
||||||
|
|
||||||
sep
|
sep
|
||||||
|
@ -2590,7 +2592,7 @@ class bool(int):
|
||||||
The class bool is a subclass of the class int, and cannot be subclassed.
|
The class bool is a subclass of the class int, and cannot be subclassed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, o: object = ..., /) -> Self: ...
|
def __new__(cls, o: object = False, /) -> Self: ...
|
||||||
# The following overloads could be represented more elegantly with a TypeVar("_B", bool, int),
|
# The following overloads could be represented more elegantly with a TypeVar("_B", bool, int),
|
||||||
# however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).
|
# however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).
|
||||||
@overload
|
@overload
|
||||||
|
@ -2697,7 +2699,7 @@ class tuple(Sequence[_T_co]):
|
||||||
If the argument is a tuple, the return value is the same object.
|
If the argument is a tuple, the return value is the same object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, iterable: Iterable[_T_co] = ..., /) -> Self: ...
|
def __new__(cls, iterable: Iterable[_T_co] = (), /) -> Self: ...
|
||||||
def __len__(self) -> int:
|
def __len__(self) -> int:
|
||||||
"""Return len(self)."""
|
"""Return len(self)."""
|
||||||
|
|
||||||
|
@ -3254,7 +3256,7 @@ class range(Sequence[int]):
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, stop: SupportsIndex, /) -> Self: ...
|
def __new__(cls, stop: SupportsIndex, /) -> Self: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = ..., /) -> Self: ...
|
def __new__(cls, start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = 1, /) -> Self: ...
|
||||||
def count(self, value: int, /) -> int:
|
def count(self, value: int, /) -> int:
|
||||||
"""rangeobject.count(value) -> integer -- return number of occurrences of value"""
|
"""rangeobject.count(value) -> integer -- return number of occurrences of value"""
|
||||||
|
|
||||||
|
@ -3328,10 +3330,10 @@ class property:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
fget: Callable[[Any], Any] | None = ...,
|
fget: Callable[[Any], Any] | None = None,
|
||||||
fset: Callable[[Any, Any], None] | None = ...,
|
fset: Callable[[Any, Any], None] | None = None,
|
||||||
fdel: Callable[[Any], None] | None = ...,
|
fdel: Callable[[Any], None] | None = None,
|
||||||
doc: str | None = ...,
|
doc: str | None = None,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def getter(self, fget: Callable[[Any], Any], /) -> property:
|
def getter(self, fget: Callable[[Any], Any], /) -> property:
|
||||||
"""Descriptor to obtain a copy of the property with a different getter."""
|
"""Descriptor to obtain a copy of the property with a different getter."""
|
||||||
|
@ -3437,7 +3439,7 @@ if sys.version_info >= (3, 10):
|
||||||
@overload
|
@overload
|
||||||
def compile(
|
def compile(
|
||||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||||
filename: str | ReadableBuffer | PathLike[Any],
|
filename: str | bytes | PathLike[Any],
|
||||||
mode: str,
|
mode: str,
|
||||||
flags: Literal[0],
|
flags: Literal[0],
|
||||||
dont_inherit: bool = False,
|
dont_inherit: bool = False,
|
||||||
|
@ -3462,7 +3464,7 @@ def compile(
|
||||||
@overload
|
@overload
|
||||||
def compile(
|
def compile(
|
||||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||||
filename: str | ReadableBuffer | PathLike[Any],
|
filename: str | bytes | PathLike[Any],
|
||||||
mode: str,
|
mode: str,
|
||||||
*,
|
*,
|
||||||
dont_inherit: bool = False,
|
dont_inherit: bool = False,
|
||||||
|
@ -3472,7 +3474,7 @@ def compile(
|
||||||
@overload
|
@overload
|
||||||
def compile(
|
def compile(
|
||||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||||
filename: str | ReadableBuffer | PathLike[Any],
|
filename: str | bytes | PathLike[Any],
|
||||||
mode: str,
|
mode: str,
|
||||||
flags: Literal[1024],
|
flags: Literal[1024],
|
||||||
dont_inherit: bool = False,
|
dont_inherit: bool = False,
|
||||||
|
@ -3483,7 +3485,7 @@ def compile(
|
||||||
@overload
|
@overload
|
||||||
def compile(
|
def compile(
|
||||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||||
filename: str | ReadableBuffer | PathLike[Any],
|
filename: str | bytes | PathLike[Any],
|
||||||
mode: str,
|
mode: str,
|
||||||
flags: int,
|
flags: int,
|
||||||
dont_inherit: bool = False,
|
dont_inherit: bool = False,
|
||||||
|
@ -4378,18 +4380,25 @@ class zip(Generic[_T_co]):
|
||||||
|
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, *, strict: bool = ...) -> zip[Any]: ...
|
def __new__(cls, *, strict: bool = False) -> zip[Any]: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, iter1: Iterable[_T1], /, *, strict: bool = ...) -> zip[tuple[_T1]]: ...
|
def __new__(cls, iter1: Iterable[_T1], /, *, strict: bool = False) -> zip[tuple[_T1]]: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(cls, iter1: Iterable[_T1], iter2: Iterable[_T2], /, *, strict: bool = ...) -> zip[tuple[_T1, _T2]]: ...
|
def __new__(cls, iter1: Iterable[_T1], iter2: Iterable[_T2], /, *, strict: bool = False) -> zip[tuple[_T1, _T2]]: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(
|
def __new__(
|
||||||
cls, iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /, *, strict: bool = ...
|
cls, iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /, *, strict: bool = False
|
||||||
) -> zip[tuple[_T1, _T2, _T3]]: ...
|
) -> zip[tuple[_T1, _T2, _T3]]: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(
|
def __new__(
|
||||||
cls, iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], /, *, strict: bool = ...
|
cls,
|
||||||
|
iter1: Iterable[_T1],
|
||||||
|
iter2: Iterable[_T2],
|
||||||
|
iter3: Iterable[_T3],
|
||||||
|
iter4: Iterable[_T4],
|
||||||
|
/,
|
||||||
|
*,
|
||||||
|
strict: bool = False,
|
||||||
) -> zip[tuple[_T1, _T2, _T3, _T4]]: ...
|
) -> zip[tuple[_T1, _T2, _T3, _T4]]: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(
|
def __new__(
|
||||||
|
@ -4401,7 +4410,7 @@ class zip(Generic[_T_co]):
|
||||||
iter5: Iterable[_T5],
|
iter5: Iterable[_T5],
|
||||||
/,
|
/,
|
||||||
*,
|
*,
|
||||||
strict: bool = ...,
|
strict: bool = False,
|
||||||
) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||||
@overload
|
@overload
|
||||||
def __new__(
|
def __new__(
|
||||||
|
@ -4414,7 +4423,7 @@ class zip(Generic[_T_co]):
|
||||||
iter6: Iterable[Any],
|
iter6: Iterable[Any],
|
||||||
/,
|
/,
|
||||||
*iterables: Iterable[Any],
|
*iterables: Iterable[Any],
|
||||||
strict: bool = ...,
|
strict: bool = False,
|
||||||
) -> zip[tuple[Any, ...]]: ...
|
) -> zip[tuple[Any, ...]]: ...
|
||||||
else:
|
else:
|
||||||
@overload
|
@overload
|
||||||
|
@ -4571,8 +4580,8 @@ if sys.version_info >= (3, 10):
|
||||||
class AttributeError(Exception):
|
class AttributeError(Exception):
|
||||||
"""Attribute not found."""
|
"""Attribute not found."""
|
||||||
|
|
||||||
def __init__(self, *args: object, name: str | None = ..., obj: object = ...) -> None: ...
|
def __init__(self, *args: object, name: str | None = None, obj: object = None) -> None: ...
|
||||||
name: str
|
name: str | None
|
||||||
obj: object
|
obj: object
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -4589,7 +4598,7 @@ class EOFError(Exception):
|
||||||
class ImportError(Exception):
|
class ImportError(Exception):
|
||||||
"""Import can't find module, or can't find name in module."""
|
"""Import can't find module, or can't find name in module."""
|
||||||
|
|
||||||
def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None: ...
|
def __init__(self, *args: object, name: str | None = None, path: str | None = None) -> None: ...
|
||||||
name: str | None
|
name: str | None
|
||||||
path: str | None
|
path: str | None
|
||||||
msg: str # undocumented
|
msg: str # undocumented
|
||||||
|
@ -4607,8 +4616,8 @@ if sys.version_info >= (3, 10):
|
||||||
class NameError(Exception):
|
class NameError(Exception):
|
||||||
"""Name not found globally."""
|
"""Name not found globally."""
|
||||||
|
|
||||||
def __init__(self, *args: object, name: str | None = ...) -> None: ...
|
def __init__(self, *args: object, name: str | None = None) -> None: ...
|
||||||
name: str
|
name: str | None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
class NameError(Exception):
|
class NameError(Exception):
|
||||||
|
|
|
@ -25,7 +25,7 @@ from _ctypes import (
|
||||||
set_errno as set_errno,
|
set_errno as set_errno,
|
||||||
sizeof as sizeof,
|
sizeof as sizeof,
|
||||||
)
|
)
|
||||||
from _typeshed import StrPath
|
from _typeshed import StrPath, SupportsBool, SupportsLen
|
||||||
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
|
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
|
||||||
from types import GenericAlias
|
from types import GenericAlias
|
||||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
|
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
|
||||||
|
@ -301,7 +301,7 @@ class py_object(_CanCastTo, _SimpleCData[_T]):
|
||||||
|
|
||||||
class c_bool(_SimpleCData[bool]):
|
class c_bool(_SimpleCData[bool]):
|
||||||
_type_: ClassVar[Literal["?"]]
|
_type_: ClassVar[Literal["?"]]
|
||||||
def __init__(self, value: bool = ...) -> None: ...
|
def __init__(self, value: SupportsBool | SupportsLen | None = ...) -> None: ...
|
||||||
|
|
||||||
class c_byte(_SimpleCData[int]):
|
class c_byte(_SimpleCData[int]):
|
||||||
_type_: ClassVar[Literal["b"]]
|
_type_: ClassVar[Literal["b"]]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""A parser for HTML and XHTML."""
|
"""A parser for HTML and XHTML."""
|
||||||
|
|
||||||
import sys
|
|
||||||
from _markupbase import ParserBase
|
from _markupbase import ParserBase
|
||||||
from re import Pattern
|
from re import Pattern
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
@ -30,9 +29,8 @@ class HTMLParser(ParserBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
CDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
||||||
if sys.version_info >= (3, 13):
|
# Added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.6
|
||||||
# Added in 3.13.6
|
RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
||||||
RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
|
||||||
|
|
||||||
def __init__(self, *, convert_charrefs: bool = True) -> None:
|
def __init__(self, *, convert_charrefs: bool = True) -> None:
|
||||||
"""Initialize and reset this instance.
|
"""Initialize and reset this instance.
|
||||||
|
@ -71,11 +69,8 @@ class HTMLParser(ParserBase):
|
||||||
def parse_html_declaration(self, i: int) -> int: ... # undocumented
|
def parse_html_declaration(self, i: int) -> int: ... # undocumented
|
||||||
def parse_pi(self, i: int) -> int: ... # undocumented
|
def parse_pi(self, i: int) -> int: ... # undocumented
|
||||||
def parse_starttag(self, i: int) -> int: ... # undocumented
|
def parse_starttag(self, i: int) -> int: ... # undocumented
|
||||||
if sys.version_info >= (3, 13):
|
# `escapable` parameter added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.6
|
||||||
# `escapable` parameter added in 3.13.6
|
def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented
|
||||||
def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented
|
|
||||||
else:
|
|
||||||
def set_cdata_mode(self, elem: str) -> None: ... # undocumented
|
|
||||||
rawdata: str # undocumented
|
rawdata: str # undocumented
|
||||||
cdata_elem: str | None # undocumented
|
cdata_elem: str | None # undocumented
|
||||||
convert_charrefs: bool # undocumented
|
convert_charrefs: bool # undocumented
|
||||||
|
|
|
@ -136,7 +136,7 @@ class InspectLoader(Loader):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def source_to_code(
|
def source_to_code(
|
||||||
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath = "<string>"
|
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath = "<string>"
|
||||||
) -> types.CodeType:
|
) -> types.CodeType:
|
||||||
"""Compile 'data' into a code object.
|
"""Compile 'data' into a code object.
|
||||||
|
|
||||||
|
@ -342,10 +342,10 @@ class FileLoader(_bootstrap_external.FileLoader, ResourceLoader, ExecutionLoader
|
||||||
def get_data(self, path: str) -> bytes:
|
def get_data(self, path: str) -> bytes:
|
||||||
"""Return the data from path as raw bytes."""
|
"""Return the data from path as raw bytes."""
|
||||||
|
|
||||||
def get_filename(self, name: str | None = None) -> str:
|
def get_filename(self, fullname: str | None = None) -> str:
|
||||||
"""Return the path to the source file as found by the finder."""
|
"""Return the path to the source file as found by the finder."""
|
||||||
|
|
||||||
def load_module(self, name: str | None = None) -> types.ModuleType:
|
def load_module(self, fullname: str | None = None) -> types.ModuleType:
|
||||||
"""Load a module from a file.
|
"""Load a module from a file.
|
||||||
|
|
||||||
This method is deprecated. Use exec_module() instead.
|
This method is deprecated. Use exec_module() instead.
|
||||||
|
|
|
@ -14,7 +14,7 @@ from contextlib import AbstractContextManager
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Any, BinaryIO, Literal, TextIO
|
from typing import Any, BinaryIO, Literal, TextIO
|
||||||
from typing_extensions import TypeAlias
|
from typing_extensions import TypeAlias, deprecated
|
||||||
|
|
||||||
if sys.version_info >= (3, 11):
|
if sys.version_info >= (3, 11):
|
||||||
from importlib.resources.abc import Traversable
|
from importlib.resources.abc import Traversable
|
||||||
|
@ -98,14 +98,23 @@ else:
|
||||||
|
|
||||||
Directories are *not* resources.
|
Directories are *not* resources.
|
||||||
"""
|
"""
|
||||||
|
if sys.version_info >= (3, 11):
|
||||||
|
@deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.")
|
||||||
|
def contents(package: Package) -> Iterator[str]:
|
||||||
|
"""Return an iterable of entries in `package`.
|
||||||
|
|
||||||
def contents(package: Package) -> Iterator[str]:
|
Note that not all entries are resources. Specifically, directories are
|
||||||
"""Return an iterable of entries in `package`.
|
not considered resources. Use `is_resource()` on each entry returned here
|
||||||
|
to check if it is a resource or not.
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
def contents(package: Package) -> Iterator[str]:
|
||||||
|
"""Return an iterable of entries in 'package'.
|
||||||
|
|
||||||
Note that not all entries are resources. Specifically, directories are
|
Note that not all entries are resources. Specifically, directories are
|
||||||
not considered resources. Use `is_resource()` on each entry returned here
|
not considered resources. Use `is_resource()` on each entry returned here
|
||||||
to check if it is a resource or not.
|
to check if it is a resource or not.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 11):
|
if sys.version_info >= (3, 11):
|
||||||
from importlib.resources._common import as_file as as_file
|
from importlib.resources._common import as_file as as_file
|
||||||
|
|
|
@ -11,7 +11,7 @@ if sys.version_info >= (3, 13):
|
||||||
from io import TextIOWrapper
|
from io import TextIOWrapper
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import BinaryIO, Literal, overload
|
from typing import BinaryIO, Literal, overload
|
||||||
from typing_extensions import Unpack
|
from typing_extensions import Unpack, deprecated
|
||||||
|
|
||||||
def open_binary(anchor: Anchor, *path_names: StrPath) -> BinaryIO:
|
def open_binary(anchor: Anchor, *path_names: StrPath) -> BinaryIO:
|
||||||
"""Open for binary reading the *resource* within *package*."""
|
"""Open for binary reading the *resource* within *package*."""
|
||||||
|
@ -44,6 +44,7 @@ if sys.version_info >= (3, 13):
|
||||||
Otherwise returns ``False``.
|
Otherwise returns ``False``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.")
|
||||||
def contents(anchor: Anchor, *path_names: StrPath) -> Iterator[str]:
|
def contents(anchor: Anchor, *path_names: StrPath) -> Iterator[str]:
|
||||||
"""Return an iterable over the named resources within the package.
|
"""Return an iterable over the named resources within the package.
|
||||||
|
|
||||||
|
|
|
@ -227,8 +227,10 @@ class itemgetter(Generic[_T_co]):
|
||||||
# "tuple[int, int]" is incompatible with protocol "SupportsIndex"
|
# "tuple[int, int]" is incompatible with protocol "SupportsIndex"
|
||||||
# preventing [_T_co, ...] instead of [Any, ...]
|
# preventing [_T_co, ...] instead of [Any, ...]
|
||||||
#
|
#
|
||||||
# A suspected mypy issue prevents using [..., _T] instead of [..., Any] here.
|
# If we can't infer a literal key from __new__ (ie: `itemgetter[Literal[0]]` for `itemgetter(0)`),
|
||||||
# https://github.com/python/mypy/issues/14032
|
# then we can't annotate __call__'s return type or it'll break on tuples
|
||||||
|
#
|
||||||
|
# These issues are best demonstrated by the `itertools.check_itertools_recipes.unique_justseen` test.
|
||||||
def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any:
|
def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any:
|
||||||
"""Call self as a function."""
|
"""Call self as a function."""
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,7 @@ from cmd import Cmd
|
||||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||||
from inspect import _SourceObjectType
|
from inspect import _SourceObjectType
|
||||||
from linecache import _ModuleGlobals
|
from linecache import _ModuleGlobals
|
||||||
|
from rlcompleter import Completer
|
||||||
from types import CodeType, FrameType, TracebackType
|
from types import CodeType, FrameType, TracebackType
|
||||||
from typing import IO, Any, ClassVar, Final, Literal, TypeVar
|
from typing import IO, Any, ClassVar, Final, Literal, TypeVar
|
||||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||||
|
@ -943,6 +944,17 @@ class Pdb(Bdb, Cmd):
|
||||||
def completenames(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... # type: ignore[override]
|
def completenames(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... # type: ignore[override]
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
def set_convenience_variable(self, frame: FrameType, name: str, value: Any) -> None: ...
|
def set_convenience_variable(self, frame: FrameType, name: str, value: Any) -> None: ...
|
||||||
|
if sys.version_info >= (3, 13) and sys.version_info < (3, 14):
|
||||||
|
# Added in 3.13.8.
|
||||||
|
@property
|
||||||
|
def rlcompleter(self) -> type[Completer]:
|
||||||
|
"""Return the `Completer` class from `rlcompleter`, while avoiding the
|
||||||
|
side effects of changing the completer from `import rlcompleter`.
|
||||||
|
|
||||||
|
This is a compromise between GH-138860 and GH-139289. If GH-139289 is
|
||||||
|
fixed, then we don't need this and we can just `import rlcompleter` in
|
||||||
|
`Pdb.__init__`.
|
||||||
|
"""
|
||||||
|
|
||||||
def _select_frame(self, number: int) -> None: ...
|
def _select_frame(self, number: int) -> None: ...
|
||||||
def _getval_except(self, arg: str, frame: FrameType | None = None) -> object: ...
|
def _getval_except(self, arg: str, frame: FrameType | None = None) -> object: ...
|
||||||
|
|
|
@ -77,17 +77,22 @@ def get_platform() -> str:
|
||||||
isn't particularly important.
|
isn't particularly important.
|
||||||
|
|
||||||
Examples of returned values:
|
Examples of returned values:
|
||||||
linux-i586
|
|
||||||
linux-alpha (?)
|
|
||||||
solaris-2.6-sun4u
|
|
||||||
|
|
||||||
Windows will return one of:
|
|
||||||
win-amd64 (64-bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
|
|
||||||
win-arm64 (64-bit Windows on ARM64 (aka AArch64)
|
|
||||||
win32 (all others - specifically, sys.platform is returned)
|
|
||||||
|
|
||||||
For other non-POSIX platforms, currently just returns 'sys.platform'.
|
Windows:
|
||||||
|
|
||||||
|
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
|
||||||
|
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
|
||||||
|
- win32 (all others - specifically, sys.platform is returned)
|
||||||
|
|
||||||
|
POSIX based OS:
|
||||||
|
|
||||||
|
- linux-x86_64
|
||||||
|
- macosx-15.5-arm64
|
||||||
|
- macosx-26.0-universal2 (macOS on Apple Silicon or Intel)
|
||||||
|
- android-24-arm64_v8a
|
||||||
|
|
||||||
|
For other non-POSIX platforms, currently just returns :data:`sys.platform`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 11):
|
if sys.version_info >= (3, 11):
|
||||||
|
|
|
@ -5210,7 +5210,6 @@ class Scrollbar(Widget):
|
||||||
lower ends as value between 0 and 1).
|
lower ends as value between 0 and 1).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_TextIndex: TypeAlias = _tkinter.Tcl_Obj | str | float | Misc
|
|
||||||
_WhatToCount: TypeAlias = Literal[
|
_WhatToCount: TypeAlias = Literal[
|
||||||
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"
|
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"
|
||||||
]
|
]
|
||||||
|
@ -5358,18 +5357,29 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||||
config = configure
|
config = configure
|
||||||
def bbox(self, index: _TextIndex) -> tuple[int, int, int, int] | None: # type: ignore[override]
|
def bbox(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> tuple[int, int, int, int] | None: # type: ignore[override]
|
||||||
"""Return a tuple of (x,y,width,height) which gives the bounding
|
"""Return a tuple of (x,y,width,height) which gives the bounding
|
||||||
box of the visible part of the character at the given index.
|
box of the visible part of the character at the given index.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool:
|
def compare(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
op: Literal["<", "<=", "==", ">=", ">", "!="],
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
) -> bool:
|
||||||
"""Return whether between index INDEX1 and index INDEX2 the
|
"""Return whether between index INDEX1 and index INDEX2 the
|
||||||
relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.
|
relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.
|
||||||
"""
|
"""
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
@overload
|
@overload
|
||||||
def count(self, index1: _TextIndex, index2: _TextIndex, *, return_ints: Literal[True]) -> int:
|
def count(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
*,
|
||||||
|
return_ints: Literal[True],
|
||||||
|
) -> int:
|
||||||
"""Counts the number of relevant things between the two indices.
|
"""Counts the number of relevant things between the two indices.
|
||||||
|
|
||||||
If INDEX1 is after INDEX2, the result will be a negative number
|
If INDEX1 is after INDEX2, the result will be a negative number
|
||||||
|
@ -5389,13 +5399,19 @@ class Text(Widget, XView, YView):
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /, *, return_ints: Literal[True]
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
arg: _WhatToCount | Literal["update"],
|
||||||
|
/,
|
||||||
|
*,
|
||||||
|
return_ints: Literal[True],
|
||||||
) -> int: ...
|
) -> int: ...
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: Literal["update"],
|
arg1: Literal["update"],
|
||||||
arg2: _WhatToCount,
|
arg2: _WhatToCount,
|
||||||
/,
|
/,
|
||||||
|
@ -5405,8 +5421,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: _WhatToCount,
|
arg1: _WhatToCount,
|
||||||
arg2: Literal["update"],
|
arg2: Literal["update"],
|
||||||
/,
|
/,
|
||||||
|
@ -5415,13 +5431,20 @@ class Text(Widget, XView, YView):
|
||||||
) -> int: ...
|
) -> int: ...
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /, *, return_ints: Literal[True]
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
arg1: _WhatToCount,
|
||||||
|
arg2: _WhatToCount,
|
||||||
|
/,
|
||||||
|
*,
|
||||||
|
return_ints: Literal[True],
|
||||||
) -> tuple[int, int]: ...
|
) -> tuple[int, int]: ...
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: _WhatToCount | Literal["update"],
|
arg1: _WhatToCount | Literal["update"],
|
||||||
arg2: _WhatToCount | Literal["update"],
|
arg2: _WhatToCount | Literal["update"],
|
||||||
arg3: _WhatToCount | Literal["update"],
|
arg3: _WhatToCount | Literal["update"],
|
||||||
|
@ -5430,12 +5453,18 @@ class Text(Widget, XView, YView):
|
||||||
return_ints: Literal[True],
|
return_ints: Literal[True],
|
||||||
) -> tuple[int, ...]: ...
|
) -> tuple[int, ...]: ...
|
||||||
@overload
|
@overload
|
||||||
def count(self, index1: _TextIndex, index2: _TextIndex, *, return_ints: Literal[False] = False) -> tuple[int] | None: ...
|
def count(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
*,
|
||||||
|
return_ints: Literal[False] = False,
|
||||||
|
) -> tuple[int] | None: ...
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg: _WhatToCount | Literal["update"],
|
arg: _WhatToCount | Literal["update"],
|
||||||
/,
|
/,
|
||||||
*,
|
*,
|
||||||
|
@ -5444,8 +5473,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: Literal["update"],
|
arg1: Literal["update"],
|
||||||
arg2: _WhatToCount,
|
arg2: _WhatToCount,
|
||||||
/,
|
/,
|
||||||
|
@ -5455,8 +5484,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: _WhatToCount,
|
arg1: _WhatToCount,
|
||||||
arg2: Literal["update"],
|
arg2: Literal["update"],
|
||||||
/,
|
/,
|
||||||
|
@ -5466,8 +5495,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: _WhatToCount,
|
arg1: _WhatToCount,
|
||||||
arg2: _WhatToCount,
|
arg2: _WhatToCount,
|
||||||
/,
|
/,
|
||||||
|
@ -5477,8 +5506,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: _WhatToCount | Literal["update"],
|
arg1: _WhatToCount | Literal["update"],
|
||||||
arg2: _WhatToCount | Literal["update"],
|
arg2: _WhatToCount | Literal["update"],
|
||||||
arg3: _WhatToCount | Literal["update"],
|
arg3: _WhatToCount | Literal["update"],
|
||||||
|
@ -5488,7 +5517,9 @@ class Text(Widget, XView, YView):
|
||||||
) -> tuple[int, ...]: ...
|
) -> tuple[int, ...]: ...
|
||||||
else:
|
else:
|
||||||
@overload
|
@overload
|
||||||
def count(self, index1: _TextIndex, index2: _TextIndex) -> tuple[int] | None:
|
def count(
|
||||||
|
self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget
|
||||||
|
) -> tuple[int] | None:
|
||||||
"""Counts the number of relevant things between the two indices.
|
"""Counts the number of relevant things between the two indices.
|
||||||
If index1 is after index2, the result will be a negative number
|
If index1 is after index2, the result will be a negative number
|
||||||
(and this holds for each of the possible options).
|
(and this holds for each of the possible options).
|
||||||
|
@ -5504,19 +5535,44 @@ class Text(Widget, XView, YView):
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def count(
|
def count(
|
||||||
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
arg: _WhatToCount | Literal["update"],
|
||||||
|
/,
|
||||||
) -> tuple[int] | None: ...
|
) -> tuple[int] | None: ...
|
||||||
@overload
|
@overload
|
||||||
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: Literal["update"], arg2: _WhatToCount, /) -> int | None: ...
|
|
||||||
@overload
|
|
||||||
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: Literal["update"], /) -> int | None: ...
|
|
||||||
@overload
|
|
||||||
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /) -> tuple[int, int]: ...
|
|
||||||
@overload
|
|
||||||
def count(
|
def count(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex,
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
arg1: Literal["update"],
|
||||||
|
arg2: _WhatToCount,
|
||||||
|
/,
|
||||||
|
) -> int | None: ...
|
||||||
|
@overload
|
||||||
|
def count(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
arg1: _WhatToCount,
|
||||||
|
arg2: Literal["update"],
|
||||||
|
/,
|
||||||
|
) -> int | None: ...
|
||||||
|
@overload
|
||||||
|
def count(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
arg1: _WhatToCount,
|
||||||
|
arg2: _WhatToCount,
|
||||||
|
/,
|
||||||
|
) -> tuple[int, int]: ...
|
||||||
|
@overload
|
||||||
|
def count(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
arg1: _WhatToCount | Literal["update"],
|
arg1: _WhatToCount | Literal["update"],
|
||||||
arg2: _WhatToCount | Literal["update"],
|
arg2: _WhatToCount | Literal["update"],
|
||||||
arg3: _WhatToCount | Literal["update"],
|
arg3: _WhatToCount | Literal["update"],
|
||||||
|
@ -5532,10 +5588,12 @@ class Text(Widget, XView, YView):
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def debug(self, boolean: bool) -> None: ...
|
def debug(self, boolean: bool) -> None: ...
|
||||||
def delete(self, index1: _TextIndex, index2: _TextIndex | None = None) -> None:
|
def delete(
|
||||||
|
self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None
|
||||||
|
) -> None:
|
||||||
"""Delete the characters between INDEX1 and INDEX2 (not included)."""
|
"""Delete the characters between INDEX1 and INDEX2 (not included)."""
|
||||||
|
|
||||||
def dlineinfo(self, index: _TextIndex) -> tuple[int, int, int, int, int] | None:
|
def dlineinfo(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> tuple[int, int, int, int, int] | None:
|
||||||
"""Return tuple (x,y,width,height,baseline) giving the bounding box
|
"""Return tuple (x,y,width,height,baseline) giving the bounding box
|
||||||
and baseline position of the visible part of the line containing
|
and baseline position of the visible part of the line containing
|
||||||
the character at INDEX.
|
the character at INDEX.
|
||||||
|
@ -5544,8 +5602,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def dump(
|
def dump(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex | None = None,
|
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||||
command: None = None,
|
command: None = None,
|
||||||
*,
|
*,
|
||||||
all: bool = ...,
|
all: bool = ...,
|
||||||
|
@ -5571,8 +5629,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def dump(
|
def dump(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex | None,
|
index2: str | float | _tkinter.Tcl_Obj | Widget | None,
|
||||||
command: Callable[[str, str, str], object] | str,
|
command: Callable[[str, str, str], object] | str,
|
||||||
*,
|
*,
|
||||||
all: bool = ...,
|
all: bool = ...,
|
||||||
|
@ -5585,8 +5643,8 @@ class Text(Widget, XView, YView):
|
||||||
@overload
|
@overload
|
||||||
def dump(
|
def dump(
|
||||||
self,
|
self,
|
||||||
index1: _TextIndex,
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
index2: _TextIndex | None = None,
|
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||||
*,
|
*,
|
||||||
command: Callable[[str, str, str], object] | str,
|
command: Callable[[str, str, str], object] | str,
|
||||||
all: bool = ...,
|
all: bool = ...,
|
||||||
|
@ -5651,27 +5709,31 @@ class Text(Widget, XView, YView):
|
||||||
when the undo option is false
|
when the undo option is false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get(self, index1: _TextIndex, index2: _TextIndex | None = None) -> str:
|
def get(
|
||||||
|
self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None
|
||||||
|
) -> str:
|
||||||
"""Return the text from INDEX1 to INDEX2 (not included)."""
|
"""Return the text from INDEX1 to INDEX2 (not included)."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def image_cget(self, index: _TextIndex, option: Literal["image", "name"]) -> str:
|
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["image", "name"]) -> str:
|
||||||
"""Return the value of OPTION of an embedded image at INDEX."""
|
"""Return the value of OPTION of an embedded image at INDEX."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def image_cget(self, index: _TextIndex, option: Literal["padx", "pady"]) -> int: ...
|
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["padx", "pady"]) -> int: ...
|
||||||
@overload
|
@overload
|
||||||
def image_cget(self, index: _TextIndex, option: Literal["align"]) -> Literal["baseline", "bottom", "center", "top"]: ...
|
def image_cget(
|
||||||
|
self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["align"]
|
||||||
|
) -> Literal["baseline", "bottom", "center", "top"]: ...
|
||||||
@overload
|
@overload
|
||||||
def image_cget(self, index: _TextIndex, option: str) -> Any: ...
|
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ...
|
||||||
@overload
|
@overload
|
||||||
def image_configure(self, index: _TextIndex, cnf: str) -> tuple[str, str, str, str, str | int]:
|
def image_configure(self, index: str | float | _tkinter.Tcl_Obj | Widget, cnf: str) -> tuple[str, str, str, str, str | int]:
|
||||||
"""Configure an embedded image at INDEX."""
|
"""Configure an embedded image at INDEX."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def image_configure(
|
def image_configure(
|
||||||
self,
|
self,
|
||||||
index: _TextIndex,
|
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
cnf: dict[str, Any] | None = None,
|
cnf: dict[str, Any] | None = None,
|
||||||
*,
|
*,
|
||||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||||
|
@ -5682,7 +5744,7 @@ class Text(Widget, XView, YView):
|
||||||
) -> dict[str, tuple[str, str, str, str, str | int]] | None: ...
|
) -> dict[str, tuple[str, str, str, str, str | int]] | None: ...
|
||||||
def image_create(
|
def image_create(
|
||||||
self,
|
self,
|
||||||
index: _TextIndex,
|
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
cnf: dict[str, Any] | None = {},
|
cnf: dict[str, Any] | None = {},
|
||||||
*,
|
*,
|
||||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||||
|
@ -5696,10 +5758,12 @@ class Text(Widget, XView, YView):
|
||||||
def image_names(self) -> tuple[str, ...]:
|
def image_names(self) -> tuple[str, ...]:
|
||||||
"""Return all names of embedded images in this widget."""
|
"""Return all names of embedded images in this widget."""
|
||||||
|
|
||||||
def index(self, index: _TextIndex) -> str:
|
def index(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> str:
|
||||||
"""Return the index in the form line.char for INDEX."""
|
"""Return the index in the form line.char for INDEX."""
|
||||||
|
|
||||||
def insert(self, index: _TextIndex, chars: str, *args: str | list[str] | tuple[str, ...]) -> None:
|
def insert(
|
||||||
|
self, index: str | float | _tkinter.Tcl_Obj | Widget, chars: str, *args: str | list[str] | tuple[str, ...]
|
||||||
|
) -> None:
|
||||||
"""Insert CHARS before the characters at INDEX. An additional
|
"""Insert CHARS before the characters at INDEX. An additional
|
||||||
tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.
|
tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.
|
||||||
"""
|
"""
|
||||||
|
@ -5715,16 +5779,16 @@ class Text(Widget, XView, YView):
|
||||||
def mark_names(self) -> tuple[str, ...]:
|
def mark_names(self) -> tuple[str, ...]:
|
||||||
"""Return all mark names."""
|
"""Return all mark names."""
|
||||||
|
|
||||||
def mark_set(self, markName: str, index: _TextIndex) -> None:
|
def mark_set(self, markName: str, index: str | float | _tkinter.Tcl_Obj | Widget) -> None:
|
||||||
"""Set mark MARKNAME before the character at INDEX."""
|
"""Set mark MARKNAME before the character at INDEX."""
|
||||||
|
|
||||||
def mark_unset(self, *markNames: str) -> None:
|
def mark_unset(self, *markNames: str) -> None:
|
||||||
"""Delete all marks in MARKNAMES."""
|
"""Delete all marks in MARKNAMES."""
|
||||||
|
|
||||||
def mark_next(self, index: _TextIndex) -> str | None:
|
def mark_next(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> str | None:
|
||||||
"""Return the name of the next mark after INDEX."""
|
"""Return the name of the next mark after INDEX."""
|
||||||
|
|
||||||
def mark_previous(self, index: _TextIndex) -> str | None:
|
def mark_previous(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> str | None:
|
||||||
"""Return the name of the previous mark before INDEX."""
|
"""Return the name of the previous mark before INDEX."""
|
||||||
# **kw of peer_create is same as the kwargs of Text.__init__
|
# **kw of peer_create is same as the kwargs of Text.__init__
|
||||||
def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = {}, **kw) -> None:
|
def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = {}, **kw) -> None:
|
||||||
|
@ -5739,7 +5803,13 @@ class Text(Widget, XView, YView):
|
||||||
the widget itself).
|
the widget itself).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: str | list[str] | tuple[str, ...]) -> None:
|
def replace(
|
||||||
|
self,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
chars: str,
|
||||||
|
*args: str | list[str] | tuple[str, ...],
|
||||||
|
) -> None:
|
||||||
"""Replaces the range of characters between index1 and index2 with
|
"""Replaces the range of characters between index1 and index2 with
|
||||||
the given characters and tags specified by args.
|
the given characters and tags specified by args.
|
||||||
|
|
||||||
|
@ -5759,8 +5829,8 @@ class Text(Widget, XView, YView):
|
||||||
def search(
|
def search(
|
||||||
self,
|
self,
|
||||||
pattern: str,
|
pattern: str,
|
||||||
index: _TextIndex,
|
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
stopindex: _TextIndex | None = None,
|
stopindex: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||||
forwards: bool | None = None,
|
forwards: bool | None = None,
|
||||||
backwards: bool | None = None,
|
backwards: bool | None = None,
|
||||||
exact: bool | None = None,
|
exact: bool | None = None,
|
||||||
|
@ -5774,10 +5844,12 @@ class Text(Widget, XView, YView):
|
||||||
empty string.
|
empty string.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def see(self, index: _TextIndex) -> None:
|
def see(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> None:
|
||||||
"""Scroll such that the character at INDEX is visible."""
|
"""Scroll such that the character at INDEX is visible."""
|
||||||
|
|
||||||
def tag_add(self, tagName: str, index1: _TextIndex, *args: _TextIndex) -> None:
|
def tag_add(
|
||||||
|
self, tagName: str, index1: str | float | _tkinter.Tcl_Obj | Widget, *args: str | float | _tkinter.Tcl_Obj | Widget
|
||||||
|
) -> None:
|
||||||
"""Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
|
"""Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
|
||||||
Additional pairs of indices may follow in ARGS.
|
Additional pairs of indices may follow in ARGS.
|
||||||
"""
|
"""
|
||||||
|
@ -5855,16 +5927,26 @@ class Text(Widget, XView, YView):
|
||||||
than the priority of BELOWTHIS.
|
than the priority of BELOWTHIS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def tag_names(self, index: _TextIndex | None = None) -> tuple[str, ...]:
|
def tag_names(self, index: str | float | _tkinter.Tcl_Obj | Widget | None = None) -> tuple[str, ...]:
|
||||||
"""Return a list of all tag names."""
|
"""Return a list of all tag names."""
|
||||||
|
|
||||||
def tag_nextrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = None) -> tuple[str, str] | tuple[()]:
|
def tag_nextrange(
|
||||||
|
self,
|
||||||
|
tagName: str,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||||
|
) -> tuple[str, str] | tuple[()]:
|
||||||
"""Return a list of start and end index for the first sequence of
|
"""Return a list of start and end index for the first sequence of
|
||||||
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
|
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
|
||||||
The text is searched forward from INDEX1.
|
The text is searched forward from INDEX1.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def tag_prevrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = None) -> tuple[str, str] | tuple[()]:
|
def tag_prevrange(
|
||||||
|
self,
|
||||||
|
tagName: str,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||||
|
) -> tuple[str, str] | tuple[()]:
|
||||||
"""Return a list of start and end index for the first sequence of
|
"""Return a list of start and end index for the first sequence of
|
||||||
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
|
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
|
||||||
The text is searched backwards from INDEX1.
|
The text is searched backwards from INDEX1.
|
||||||
|
@ -5878,29 +5960,38 @@ class Text(Widget, XView, YView):
|
||||||
def tag_ranges(self, tagName: str) -> tuple[_tkinter.Tcl_Obj, ...]:
|
def tag_ranges(self, tagName: str) -> tuple[_tkinter.Tcl_Obj, ...]:
|
||||||
"""Return a list of ranges of text which have tag TAGNAME."""
|
"""Return a list of ranges of text which have tag TAGNAME."""
|
||||||
# tag_remove and tag_delete are different
|
# tag_remove and tag_delete are different
|
||||||
def tag_remove(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = None) -> None:
|
def tag_remove(
|
||||||
|
self,
|
||||||
|
tagName: str,
|
||||||
|
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
|
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||||
|
) -> None:
|
||||||
"""Remove tag TAGNAME from all characters between INDEX1 and INDEX2."""
|
"""Remove tag TAGNAME from all characters between INDEX1 and INDEX2."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def window_cget(self, index: _TextIndex, option: Literal["padx", "pady"]) -> int:
|
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["padx", "pady"]) -> int:
|
||||||
"""Return the value of OPTION of an embedded window at INDEX."""
|
"""Return the value of OPTION of an embedded window at INDEX."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def window_cget(self, index: _TextIndex, option: Literal["stretch"]) -> bool: ... # actually returns Literal[0, 1]
|
def window_cget(
|
||||||
|
self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["stretch"]
|
||||||
|
) -> bool: ... # actually returns Literal[0, 1]
|
||||||
@overload
|
@overload
|
||||||
def window_cget(self, index: _TextIndex, option: Literal["align"]) -> Literal["baseline", "bottom", "center", "top"]: ...
|
def window_cget(
|
||||||
|
self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["align"]
|
||||||
|
) -> Literal["baseline", "bottom", "center", "top"]: ...
|
||||||
@overload # window is set to a widget, but read as the string name.
|
@overload # window is set to a widget, but read as the string name.
|
||||||
def window_cget(self, index: _TextIndex, option: Literal["create", "window"]) -> str: ...
|
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["create", "window"]) -> str: ...
|
||||||
@overload
|
@overload
|
||||||
def window_cget(self, index: _TextIndex, option: str) -> Any: ...
|
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ...
|
||||||
@overload
|
@overload
|
||||||
def window_configure(self, index: _TextIndex, cnf: str) -> tuple[str, str, str, str, str | int]:
|
def window_configure(self, index: str | float | _tkinter.Tcl_Obj | Widget, cnf: str) -> tuple[str, str, str, str, str | int]:
|
||||||
"""Configure an embedded window at INDEX."""
|
"""Configure an embedded window at INDEX."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def window_configure(
|
def window_configure(
|
||||||
self,
|
self,
|
||||||
index: _TextIndex,
|
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
cnf: dict[str, Any] | None = None,
|
cnf: dict[str, Any] | None = None,
|
||||||
*,
|
*,
|
||||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||||
|
@ -5913,7 +6004,7 @@ class Text(Widget, XView, YView):
|
||||||
window_config = window_configure
|
window_config = window_configure
|
||||||
def window_create(
|
def window_create(
|
||||||
self,
|
self,
|
||||||
index: _TextIndex,
|
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||||
cnf: dict[str, Any] | None = {},
|
cnf: dict[str, Any] | None = {},
|
||||||
*,
|
*,
|
||||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||||
|
|
|
@ -399,7 +399,9 @@ class Shape:
|
||||||
an image or a list constructed using the addcomponent method.
|
an image or a list constructed using the addcomponent method.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, type_: str, data: _PolygonCoords | PhotoImage | None = None) -> None: ...
|
def __init__(
|
||||||
|
self, type_: Literal["polygon", "image", "compound"], data: _PolygonCoords | PhotoImage | None = None
|
||||||
|
) -> None: ...
|
||||||
def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: _Color | None = None) -> None:
|
def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: _Color | None = None) -> None:
|
||||||
"""Add component to a shape of type compound.
|
"""Add component to a shape of type compound.
|
||||||
|
|
||||||
|
@ -425,7 +427,9 @@ class TurtleScreen(TurtleScreenBase):
|
||||||
which is Tkinter in this case.
|
which is Tkinter in this case.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, cv: Canvas, mode: str = "standard", colormode: float = 1.0, delay: int = 10) -> None: ...
|
def __init__(
|
||||||
|
self, cv: Canvas, mode: Literal["standard", "logo", "world"] = "standard", colormode: float = 1.0, delay: int = 10
|
||||||
|
) -> None: ...
|
||||||
def clear(self) -> None:
|
def clear(self) -> None:
|
||||||
"""Delete all drawings and all turtles from the TurtleScreen.
|
"""Delete all drawings and all turtles from the TurtleScreen.
|
||||||
|
|
||||||
|
@ -465,7 +469,7 @@ class TurtleScreen(TurtleScreenBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def mode(self, mode: str) -> None: ...
|
def mode(self, mode: Literal["standard", "logo", "world"]) -> None: ...
|
||||||
def setworldcoordinates(self, llx: float, lly: float, urx: float, ury: float) -> None:
|
def setworldcoordinates(self, llx: float, lly: float, urx: float, ury: float) -> None:
|
||||||
"""Set up a user defined coordinate-system.
|
"""Set up a user defined coordinate-system.
|
||||||
|
|
||||||
|
@ -832,7 +836,7 @@ class TNavigator:
|
||||||
DEFAULT_MODE: str
|
DEFAULT_MODE: str
|
||||||
DEFAULT_ANGLEOFFSET: int
|
DEFAULT_ANGLEOFFSET: int
|
||||||
DEFAULT_ANGLEORIENT: int
|
DEFAULT_ANGLEORIENT: int
|
||||||
def __init__(self, mode: str = "standard") -> None: ...
|
def __init__(self, mode: Literal["standard", "logo", "world"] = "standard") -> None: ...
|
||||||
def reset(self) -> None:
|
def reset(self) -> None:
|
||||||
"""reset turtle to its initial values
|
"""reset turtle to its initial values
|
||||||
|
|
||||||
|
@ -1214,7 +1218,7 @@ class TPen:
|
||||||
Implements drawing properties.
|
Implements drawing properties.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, resizemode: str = "noresize") -> None: ...
|
def __init__(self, resizemode: Literal["auto", "user", "noresize"] = "noresize") -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def resizemode(self, rmode: None = None) -> str:
|
def resizemode(self, rmode: None = None) -> str:
|
||||||
"""Set resizemode to one of the values: "auto", "user", "noresize".
|
"""Set resizemode to one of the values: "auto", "user", "noresize".
|
||||||
|
@ -1240,7 +1244,7 @@ class TPen:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def resizemode(self, rmode: str) -> None: ...
|
def resizemode(self, rmode: Literal["auto", "user", "noresize"]) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def pensize(self, width: None = None) -> int:
|
def pensize(self, width: None = None) -> int:
|
||||||
"""Set or return the line thickness.
|
"""Set or return the line thickness.
|
||||||
|
@ -1543,7 +1547,7 @@ class TPen:
|
||||||
fillcolor: _Color = ...,
|
fillcolor: _Color = ...,
|
||||||
pensize: int = ...,
|
pensize: int = ...,
|
||||||
speed: int = ...,
|
speed: int = ...,
|
||||||
resizemode: str = ...,
|
resizemode: Literal["auto", "user", "noresize"] = ...,
|
||||||
stretchfactor: tuple[float, float] = ...,
|
stretchfactor: tuple[float, float] = ...,
|
||||||
outline: int = ...,
|
outline: int = ...,
|
||||||
tilt: float = ...,
|
tilt: float = ...,
|
||||||
|
@ -2324,7 +2328,7 @@ def mode(mode: None = None) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def mode(mode: str) -> None: ...
|
def mode(mode: Literal["standard", "logo", "world"]) -> None: ...
|
||||||
def setworldcoordinates(llx: float, lly: float, urx: float, ury: float) -> None:
|
def setworldcoordinates(llx: float, lly: float, urx: float, ury: float) -> None:
|
||||||
"""Set up a user defined coordinate-system.
|
"""Set up a user defined coordinate-system.
|
||||||
|
|
||||||
|
@ -3166,7 +3170,7 @@ def resizemode(rmode: None = None) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def resizemode(rmode: str) -> None: ...
|
def resizemode(rmode: Literal["auto", "user", "noresize"]) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def pensize(width: None = None) -> int:
|
def pensize(width: None = None) -> int:
|
||||||
"""Set or return the line thickness.
|
"""Set or return the line thickness.
|
||||||
|
@ -3463,7 +3467,7 @@ def pen(
|
||||||
fillcolor: _Color = ...,
|
fillcolor: _Color = ...,
|
||||||
pensize: int = ...,
|
pensize: int = ...,
|
||||||
speed: int = ...,
|
speed: int = ...,
|
||||||
resizemode: str = ...,
|
resizemode: Literal["auto", "user", "noresize"] = ...,
|
||||||
stretchfactor: tuple[float, float] = ...,
|
stretchfactor: tuple[float, float] = ...,
|
||||||
outline: int = ...,
|
outline: int = ...,
|
||||||
tilt: float = ...,
|
tilt: float = ...,
|
||||||
|
|
|
@ -69,7 +69,7 @@ if sys.version_info >= (3, 13):
|
||||||
|
|
||||||
_T1 = TypeVar("_T1")
|
_T1 = TypeVar("_T1")
|
||||||
_T2 = TypeVar("_T2")
|
_T2 = TypeVar("_T2")
|
||||||
_KT = TypeVar("_KT")
|
_KT_co = TypeVar("_KT_co", covariant=True)
|
||||||
_VT_co = TypeVar("_VT_co", covariant=True)
|
_VT_co = TypeVar("_VT_co", covariant=True)
|
||||||
|
|
||||||
# Make sure this class definition stays roughly in line with `builtins.function`
|
# Make sure this class definition stays roughly in line with `builtins.function`
|
||||||
|
@ -337,51 +337,51 @@ class CodeType:
|
||||||
__replace__ = replace
|
__replace__ = replace
|
||||||
|
|
||||||
@final
|
@final
|
||||||
class MappingProxyType(Mapping[_KT, _VT_co]):
|
class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
|
||||||
"""Read-only proxy of a mapping."""
|
"""Read-only proxy of a mapping."""
|
||||||
|
|
||||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||||
def __new__(cls, mapping: SupportsKeysAndGetItem[_KT, _VT_co]) -> Self: ...
|
def __new__(cls, mapping: SupportsKeysAndGetItem[_KT_co, _VT_co]) -> Self: ...
|
||||||
def __getitem__(self, key: _KT, /) -> _VT_co:
|
def __getitem__(self, key: _KT_co, /) -> _VT_co: # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||||
"""Return self[key]."""
|
"""Return self[key]."""
|
||||||
|
|
||||||
def __iter__(self) -> Iterator[_KT]:
|
def __iter__(self) -> Iterator[_KT_co]:
|
||||||
"""Implement iter(self)."""
|
"""Implement iter(self)."""
|
||||||
|
|
||||||
def __len__(self) -> int:
|
def __len__(self) -> int:
|
||||||
"""Return len(self)."""
|
"""Return len(self)."""
|
||||||
|
|
||||||
def __eq__(self, value: object, /) -> bool: ...
|
def __eq__(self, value: object, /) -> bool: ...
|
||||||
def copy(self) -> dict[_KT, _VT_co]:
|
def copy(self) -> dict[_KT_co, _VT_co]:
|
||||||
"""D.copy() -> a shallow copy of D"""
|
"""D.copy() -> a shallow copy of D"""
|
||||||
|
|
||||||
def keys(self) -> KeysView[_KT]:
|
def keys(self) -> KeysView[_KT_co]:
|
||||||
"""D.keys() -> a set-like object providing a view on D's keys"""
|
"""D.keys() -> a set-like object providing a view on D's keys"""
|
||||||
|
|
||||||
def values(self) -> ValuesView[_VT_co]:
|
def values(self) -> ValuesView[_VT_co]:
|
||||||
"""D.values() -> an object providing a view on D's values"""
|
"""D.values() -> an object providing a view on D's values"""
|
||||||
|
|
||||||
def items(self) -> ItemsView[_KT, _VT_co]:
|
def items(self) -> ItemsView[_KT_co, _VT_co]:
|
||||||
"""D.items() -> a set-like object providing a view on D's items"""
|
"""D.items() -> a set-like object providing a view on D's items"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def get(self, key: _KT, /) -> _VT_co | None:
|
def get(self, key: _KT_co, /) -> _VT_co | None: # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||||
"""Return the value for key if key is in the mapping, else default."""
|
"""Return the value for key if key is in the mapping, else default."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
def get(self, key: _KT_co, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||||
@overload
|
@overload
|
||||||
def get(self, key: _KT, default: _T2, /) -> _VT_co | _T2: ...
|
def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
||||||
"""See PEP 585"""
|
"""See PEP 585"""
|
||||||
|
|
||||||
def __reversed__(self) -> Iterator[_KT]:
|
def __reversed__(self) -> Iterator[_KT_co]:
|
||||||
"""D.__reversed__() -> reverse iterator"""
|
"""D.__reversed__() -> reverse iterator"""
|
||||||
|
|
||||||
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]:
|
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]:
|
||||||
"""Return self|value."""
|
"""Return self|value."""
|
||||||
|
|
||||||
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]:
|
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]:
|
||||||
"""Return value|self."""
|
"""Return value|self."""
|
||||||
|
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
|
|
|
@ -1963,6 +1963,15 @@ def _type_repr(obj: object) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
|
_TypeParameter: typing_extensions.TypeAlias = (
|
||||||
|
TypeVar
|
||||||
|
| typing_extensions.TypeVar
|
||||||
|
| ParamSpec
|
||||||
|
| typing_extensions.ParamSpec
|
||||||
|
| TypeVarTuple
|
||||||
|
| typing_extensions.TypeVarTuple
|
||||||
|
)
|
||||||
|
|
||||||
def override(method: _F, /) -> _F:
|
def override(method: _F, /) -> _F:
|
||||||
"""Indicate that a method is intended to override a method in a base class.
|
"""Indicate that a method is intended to override a method in a base class.
|
||||||
|
|
||||||
|
@ -2015,11 +2024,11 @@ if sys.version_info >= (3, 12):
|
||||||
See PEP 695 for more information.
|
See PEP 695 for more information.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()) -> Self: ...
|
def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ...
|
||||||
@property
|
@property
|
||||||
def __value__(self) -> Any: ... # AnnotationForm
|
def __value__(self) -> Any: ... # AnnotationForm
|
||||||
@property
|
@property
|
||||||
def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ...
|
def __type_params__(self) -> tuple[_TypeParameter, ...]: ...
|
||||||
@property
|
@property
|
||||||
def __parameters__(self) -> tuple[Any, ...]: ... # AnnotationForm
|
def __parameters__(self) -> tuple[Any, ...]: ... # AnnotationForm
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -303,7 +303,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||||
__readonly_keys__: ClassVar[frozenset[str]]
|
__readonly_keys__: ClassVar[frozenset[str]]
|
||||||
__mutable_keys__: ClassVar[frozenset[str]]
|
__mutable_keys__: ClassVar[frozenset[str]]
|
||||||
# PEP 728
|
# PEP 728
|
||||||
__closed__: ClassVar[bool]
|
__closed__: ClassVar[bool | None]
|
||||||
__extra_items__: ClassVar[AnnotationForm]
|
__extra_items__: ClassVar[AnnotationForm]
|
||||||
def copy(self) -> Self: ...
|
def copy(self) -> Self: ...
|
||||||
# Using Never so that only calls using mypy plugin hook that specialize the signature
|
# Using Never so that only calls using mypy plugin hook that specialize the signature
|
||||||
|
|
|
@ -143,7 +143,7 @@ class Element(Generic[_Tag]):
|
||||||
def __init__(self, tag: _Tag, attrib: dict[str, str] = {}, **extra: str) -> None: ...
|
def __init__(self, tag: _Tag, attrib: dict[str, str] = {}, **extra: str) -> None: ...
|
||||||
def append(self, subelement: Element[Any], /) -> None: ...
|
def append(self, subelement: Element[Any], /) -> None: ...
|
||||||
def clear(self) -> None: ...
|
def clear(self) -> None: ...
|
||||||
def extend(self, elements: Iterable[Element], /) -> None: ...
|
def extend(self, elements: Iterable[Element[Any]], /) -> None: ...
|
||||||
def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ...
|
def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ...
|
||||||
def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ...
|
def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ...
|
||||||
@overload
|
@overload
|
||||||
|
@ -154,7 +154,7 @@ class Element(Generic[_Tag]):
|
||||||
def get(self, key: str, default: None = None) -> str | None: ...
|
def get(self, key: str, default: None = None) -> str | None: ...
|
||||||
@overload
|
@overload
|
||||||
def get(self, key: str, default: _T) -> str | _T: ...
|
def get(self, key: str, default: _T) -> str | _T: ...
|
||||||
def insert(self, index: int, subelement: Element, /) -> None: ...
|
def insert(self, index: int, subelement: Element[Any], /) -> None: ...
|
||||||
def items(self) -> ItemsView[str, str]: ...
|
def items(self) -> ItemsView[str, str]: ...
|
||||||
def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ...
|
def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ...
|
||||||
@overload
|
@overload
|
||||||
|
@ -165,7 +165,7 @@ class Element(Generic[_Tag]):
|
||||||
def keys(self) -> dict_keys[str, str]: ...
|
def keys(self) -> dict_keys[str, str]: ...
|
||||||
# makeelement returns the type of self in Python impl, but not in C impl
|
# makeelement returns the type of self in Python impl, but not in C impl
|
||||||
def makeelement(self, tag: _OtherTag, attrib: dict[str, str], /) -> Element[_OtherTag]: ...
|
def makeelement(self, tag: _OtherTag, attrib: dict[str, str], /) -> Element[_OtherTag]: ...
|
||||||
def remove(self, subelement: Element, /) -> None: ...
|
def remove(self, subelement: Element[Any], /) -> None: ...
|
||||||
def set(self, key: str, value: str, /) -> None: ...
|
def set(self, key: str, value: str, /) -> None: ...
|
||||||
def __copy__(self) -> Element[_Tag]: ... # returns the type of self in Python impl, but not in C impl
|
def __copy__(self) -> Element[_Tag]: ... # returns the type of self in Python impl, but not in C impl
|
||||||
def __deepcopy__(self, memo: Any, /) -> Element: ... # Only exists in C impl
|
def __deepcopy__(self, memo: Any, /) -> Element: ... # Only exists in C impl
|
||||||
|
@ -183,18 +183,18 @@ class Element(Generic[_Tag]):
|
||||||
# Doesn't actually exist at runtime, but instance of the class are indeed iterable due to __getitem__.
|
# Doesn't actually exist at runtime, but instance of the class are indeed iterable due to __getitem__.
|
||||||
def __iter__(self) -> Iterator[Element]: ...
|
def __iter__(self) -> Iterator[Element]: ...
|
||||||
@overload
|
@overload
|
||||||
def __setitem__(self, key: SupportsIndex, value: Element, /) -> None:
|
def __setitem__(self, key: SupportsIndex, value: Element[Any], /) -> None:
|
||||||
"""Set self[key] to value."""
|
"""Set self[key] to value."""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __setitem__(self, key: slice, value: Iterable[Element], /) -> None: ...
|
def __setitem__(self, key: slice, value: Iterable[Element[Any]], /) -> None: ...
|
||||||
|
|
||||||
# Doesn't really exist in earlier versions, where __len__ is called implicitly instead
|
# Doesn't really exist in earlier versions, where __len__ is called implicitly instead
|
||||||
@deprecated("Testing an element's truth value is deprecated.")
|
@deprecated("Testing an element's truth value is deprecated.")
|
||||||
def __bool__(self) -> bool:
|
def __bool__(self) -> bool:
|
||||||
"""True if self else False"""
|
"""True if self else False"""
|
||||||
|
|
||||||
def SubElement(parent: Element, tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ...
|
def SubElement(parent: Element[Any], tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ...
|
||||||
def Comment(text: str | None = None) -> Element[_ElementCallable]:
|
def Comment(text: str | None = None) -> Element[_ElementCallable]:
|
||||||
"""Comment element factory.
|
"""Comment element factory.
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ class ElementTree(Generic[_Root]):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, element: Element | None = None, file: _FileRead | None = None) -> None: ...
|
def __init__(self, element: Element[Any] | None = None, file: _FileRead | None = None) -> None: ...
|
||||||
def getroot(self) -> _Root:
|
def getroot(self) -> _Root:
|
||||||
"""Return root element of this tree."""
|
"""Return root element of this tree."""
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ def register_namespace(prefix: str, uri: str) -> None:
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def tostring(
|
def tostring(
|
||||||
element: Element,
|
element: Element[Any],
|
||||||
encoding: None = None,
|
encoding: None = None,
|
||||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||||
*,
|
*,
|
||||||
|
@ -413,7 +413,7 @@ def tostring(
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def tostring(
|
def tostring(
|
||||||
element: Element,
|
element: Element[Any],
|
||||||
encoding: Literal["unicode"],
|
encoding: Literal["unicode"],
|
||||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||||
*,
|
*,
|
||||||
|
@ -423,7 +423,7 @@ def tostring(
|
||||||
) -> str: ...
|
) -> str: ...
|
||||||
@overload
|
@overload
|
||||||
def tostring(
|
def tostring(
|
||||||
element: Element,
|
element: Element[Any],
|
||||||
encoding: str,
|
encoding: str,
|
||||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||||
*,
|
*,
|
||||||
|
@ -433,7 +433,7 @@ def tostring(
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
@overload
|
@overload
|
||||||
def tostringlist(
|
def tostringlist(
|
||||||
element: Element,
|
element: Element[Any],
|
||||||
encoding: None = None,
|
encoding: None = None,
|
||||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||||
*,
|
*,
|
||||||
|
@ -443,7 +443,7 @@ def tostringlist(
|
||||||
) -> list[bytes]: ...
|
) -> list[bytes]: ...
|
||||||
@overload
|
@overload
|
||||||
def tostringlist(
|
def tostringlist(
|
||||||
element: Element,
|
element: Element[Any],
|
||||||
encoding: Literal["unicode"],
|
encoding: Literal["unicode"],
|
||||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||||
*,
|
*,
|
||||||
|
@ -453,7 +453,7 @@ def tostringlist(
|
||||||
) -> list[str]: ...
|
) -> list[str]: ...
|
||||||
@overload
|
@overload
|
||||||
def tostringlist(
|
def tostringlist(
|
||||||
element: Element,
|
element: Element[Any],
|
||||||
encoding: str,
|
encoding: str,
|
||||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||||
*,
|
*,
|
||||||
|
@ -461,7 +461,7 @@ def tostringlist(
|
||||||
default_namespace: str | None = None,
|
default_namespace: str | None = None,
|
||||||
short_empty_elements: bool = True,
|
short_empty_elements: bool = True,
|
||||||
) -> list[Any]: ...
|
) -> list[Any]: ...
|
||||||
def dump(elem: Element | ElementTree[Any]) -> None:
|
def dump(elem: Element[Any] | ElementTree[Any]) -> None:
|
||||||
"""Write element tree or element structure to sys.stdout.
|
"""Write element tree or element structure to sys.stdout.
|
||||||
|
|
||||||
This function should be used for debugging only.
|
This function should be used for debugging only.
|
||||||
|
@ -472,7 +472,7 @@ def dump(elem: Element | ElementTree[Any]) -> None:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def indent(tree: Element | ElementTree[Any], space: str = " ", level: int = 0) -> None:
|
def indent(tree: Element[Any] | ElementTree[Any], space: str = " ", level: int = 0) -> None:
|
||||||
"""Indent an XML document by inserting newlines and indentation space
|
"""Indent an XML document by inserting newlines and indentation space
|
||||||
after elements.
|
after elements.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue