mirror of https://github.com/astral-sh/ruff
[ty] Sync vendored typeshed stubs (#22091)
Co-authored-by: typeshedbot <> Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
parent
77de3df150
commit
df1552b9a4
|
|
@ -28,4 +28,4 @@ scope-simple-long-identifier,main.py,0,1
|
|||
tstring-completions,main.py,0,1
|
||||
ty-extensions-lower-stdlib,main.py,0,9
|
||||
type-var-typing-over-ast,main.py,0,3
|
||||
type-var-typing-over-ast,main.py,1,251
|
||||
type-var-typing-over-ast,main.py,1,253
|
||||
|
|
|
|||
|
|
|
@ -1339,13 +1339,13 @@ f(**kwargs<CURSOR>)
|
|||
| ^^^^^^ Clicking here
|
||||
|
|
||||
info: Found 1 type definition
|
||||
--> stdlib/builtins.pyi:2920:7
|
||||
--> stdlib/builtins.pyi:2947:7
|
||||
|
|
||||
2919 | @disjoint_base
|
||||
2920 | class dict(MutableMapping[_KT, _VT]):
|
||||
2946 | @disjoint_base
|
||||
2947 | class dict(MutableMapping[_KT, _VT]):
|
||||
| ----
|
||||
2921 | """dict() -> new empty dictionary
|
||||
2922 | dict(mapping) -> new dictionary initialized from a mapping object's
|
||||
2948 | """dict() -> new empty dictionary
|
||||
2949 | dict(mapping) -> new dictionary initialized from a mapping object's
|
||||
|
|
||||
"#);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1241,12 +1241,12 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2695:7
|
||||
--> stdlib/builtins.pyi:2722:7
|
||||
|
|
||||
2694 | @disjoint_base
|
||||
2695 | class tuple(Sequence[_T_co]):
|
||||
2721 | @disjoint_base
|
||||
2722 | class tuple(Sequence[_T_co]):
|
||||
| ^^^^^
|
||||
2696 | """Built-in immutable sequence.
|
||||
2723 | """Built-in immutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:8:5
|
||||
|
|
@ -1335,12 +1335,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2695:7
|
||||
--> stdlib/builtins.pyi:2722:7
|
||||
|
|
||||
2694 | @disjoint_base
|
||||
2695 | class tuple(Sequence[_T_co]):
|
||||
2721 | @disjoint_base
|
||||
2722 | class tuple(Sequence[_T_co]):
|
||||
| ^^^^^
|
||||
2696 | """Built-in immutable sequence.
|
||||
2723 | """Built-in immutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:9:5
|
||||
|
|
@ -1391,12 +1391,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2695:7
|
||||
--> stdlib/builtins.pyi:2722:7
|
||||
|
|
||||
2694 | @disjoint_base
|
||||
2695 | class tuple(Sequence[_T_co]):
|
||||
2721 | @disjoint_base
|
||||
2722 | class tuple(Sequence[_T_co]):
|
||||
| ^^^^^
|
||||
2696 | """Built-in immutable sequence.
|
||||
2723 | """Built-in immutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:10:5
|
||||
|
|
@ -2217,12 +2217,12 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:2:5
|
||||
|
|
@ -2270,12 +2270,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:3:5
|
||||
|
|
@ -2325,12 +2325,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:4:5
|
||||
|
|
@ -2364,13 +2364,13 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2591:7
|
||||
--> stdlib/builtins.pyi:2618:7
|
||||
|
|
||||
2590 | @final
|
||||
2591 | class bool(int):
|
||||
2617 | @final
|
||||
2618 | class bool(int):
|
||||
| ^^^^
|
||||
2592 | """Returns True when the argument is true, False otherwise.
|
||||
2593 | The builtins True and False are the only two instances of the class bool.
|
||||
2619 | """Returns True when the argument is true, False otherwise.
|
||||
2620 | The builtins True and False are the only two instances of the class bool.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:4:20
|
||||
|
|
@ -2384,12 +2384,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:5:5
|
||||
|
|
@ -2443,12 +2443,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:6:5
|
||||
|
|
@ -2502,12 +2502,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:7:5
|
||||
|
|
@ -2561,12 +2561,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:8:5
|
||||
|
|
@ -2620,12 +2620,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:9:5
|
||||
|
|
@ -2678,12 +2678,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:10:5
|
||||
|
|
@ -2737,12 +2737,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:11:5
|
||||
|
|
@ -2811,12 +2811,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:12:5
|
||||
|
|
@ -2925,12 +2925,12 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2695:7
|
||||
--> stdlib/builtins.pyi:2722:7
|
||||
|
|
||||
2694 | @disjoint_base
|
||||
2695 | class tuple(Sequence[_T_co]):
|
||||
2721 | @disjoint_base
|
||||
2722 | class tuple(Sequence[_T_co]):
|
||||
| ^^^^^
|
||||
2696 | """Built-in immutable sequence.
|
||||
2723 | """Built-in immutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:7:5
|
||||
|
|
@ -3092,12 +3092,12 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:4:18
|
||||
|
|
@ -3110,12 +3110,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2695:7
|
||||
--> stdlib/builtins.pyi:2722:7
|
||||
|
|
||||
2694 | @disjoint_base
|
||||
2695 | class tuple(Sequence[_T_co]):
|
||||
2721 | @disjoint_base
|
||||
2722 | class tuple(Sequence[_T_co]):
|
||||
| ^^^^^
|
||||
2696 | """Built-in immutable sequence.
|
||||
2723 | """Built-in immutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:5:18
|
||||
|
|
@ -3248,12 +3248,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2695:7
|
||||
--> stdlib/builtins.pyi:2722:7
|
||||
|
|
||||
2694 | @disjoint_base
|
||||
2695 | class tuple(Sequence[_T_co]):
|
||||
2721 | @disjoint_base
|
||||
2722 | class tuple(Sequence[_T_co]):
|
||||
| ^^^^^
|
||||
2696 | """Built-in immutable sequence.
|
||||
2723 | """Built-in immutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:8:5
|
||||
|
|
@ -4250,12 +4250,12 @@ mod tests {
|
|||
foo([x=]y[0])
|
||||
---------------------------------------------
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:3:5
|
||||
|
|
@ -4303,12 +4303,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:4:5
|
||||
|
|
@ -5609,12 +5609,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:3:14
|
||||
|
|
@ -6046,13 +6046,13 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2591:7
|
||||
--> stdlib/builtins.pyi:2618:7
|
||||
|
|
||||
2590 | @final
|
||||
2591 | class bool(int):
|
||||
2617 | @final
|
||||
2618 | class bool(int):
|
||||
| ^^^^
|
||||
2592 | """Returns True when the argument is true, False otherwise.
|
||||
2593 | The builtins True and False are the only two instances of the class bool.
|
||||
2619 | """Returns True when the argument is true, False otherwise.
|
||||
2620 | The builtins True and False are the only two instances of the class bool.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:4:25
|
||||
|
|
@ -6100,12 +6100,12 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/builtins.pyi:2802:7
|
||||
--> stdlib/builtins.pyi:2829:7
|
||||
|
|
||||
2801 | @disjoint_base
|
||||
2802 | class list(MutableSequence[_T]):
|
||||
2828 | @disjoint_base
|
||||
2829 | class list(MutableSequence[_T]):
|
||||
| ^^^^
|
||||
2803 | """Built-in mutable sequence.
|
||||
2830 | """Built-in mutable sequence.
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:4:49
|
||||
|
|
@ -6739,14 +6739,14 @@ mod tests {
|
|||
A = TypeAliasType([name=]'A', [value=]str)
|
||||
---------------------------------------------
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/typing.pyi:2032:26
|
||||
--> stdlib/typing.pyi:2037:26
|
||||
|
|
||||
2030 | """
|
||||
2031 |
|
||||
2032 | def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ...
|
||||
2035 | """
|
||||
2036 |
|
||||
2037 | def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ...
|
||||
| ^^^^
|
||||
2033 | @property
|
||||
2034 | def __value__(self) -> Any: ... # AnnotationForm
|
||||
2038 | @property
|
||||
2039 | def __value__(self) -> Any: ... # AnnotationForm
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:3:20
|
||||
|
|
@ -6757,14 +6757,14 @@ mod tests {
|
|||
|
|
||||
|
||||
info[inlay-hint-location]: Inlay Hint Target
|
||||
--> stdlib/typing.pyi:2032:37
|
||||
--> stdlib/typing.pyi:2037:37
|
||||
|
|
||||
2030 | """
|
||||
2031 |
|
||||
2032 | def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ...
|
||||
2035 | """
|
||||
2036 |
|
||||
2037 | def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ...
|
||||
| ^^^^^
|
||||
2033 | @property
|
||||
2034 | def __value__(self) -> Any: ... # AnnotationForm
|
||||
2038 | @property
|
||||
2039 | def __value__(self) -> Any: ... # AnnotationForm
|
||||
|
|
||||
info: Source
|
||||
--> main2.py:3:32
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ error[invalid-argument-type]: Argument to function `loads` is incorrect
|
|||
| ^ Expected `str | bytes | bytearray`, found `Literal[5]`
|
||||
|
|
||||
info: Function defined here
|
||||
--> stdlib/json/__init__.pyi:220:5
|
||||
--> stdlib/json/__init__.pyi:224:5
|
||||
|
|
||||
218 | """
|
||||
219 |
|
||||
220 | def loads(
|
||||
222 | """
|
||||
223 |
|
||||
224 | def loads(
|
||||
| ^^^^^
|
||||
221 | s: str | bytes | bytearray,
|
||||
225 | s: str | bytes | bytearray,
|
||||
| -------------------------- Parameter declared here
|
||||
222 | *,
|
||||
223 | cls: type[JSONDecoder] | None = None,
|
||||
226 | *,
|
||||
227 | cls: type[JSONDecoder] | None = None,
|
||||
|
|
||||
info: rule `invalid-argument-type` is enabled by default
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
ef2b90c67e5c668b91b3ae121baf00ee5165c30b
|
||||
3c2dbb1fde8e8d1d59b10161c8bf5fd06c0011cd
|
||||
|
|
|
|||
|
|
@ -86,17 +86,15 @@ if sys.version_info >= (3, 10):
|
|||
def dialect(self) -> Dialect: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def writerow(self, row: Iterable[Any], /) -> Any:
|
||||
"""writerow(iterable)
|
||||
"""Construct and write a CSV record from an iterable of fields.
|
||||
|
||||
Construct and write a CSV record from an iterable of fields. Non-string
|
||||
elements will be converted to string.
|
||||
Non-string elements will be converted to string.
|
||||
"""
|
||||
|
||||
def writerows(self, rows: Iterable[Iterable[Any]], /) -> None:
|
||||
"""writerows(iterable of iterables)
|
||||
"""Construct and write a series of iterables to a csv file.
|
||||
|
||||
Construct and write a series of iterables to a csv file. Non-string
|
||||
elements will be converted to string.
|
||||
Non-string elements will be converted to string.
|
||||
"""
|
||||
else:
|
||||
def writerow(self, row: Iterable[Any]) -> Any:
|
||||
|
|
@ -149,18 +147,12 @@ def writer(
|
|||
quoting: _QuotingType = 0,
|
||||
strict: bool = False,
|
||||
) -> _writer:
|
||||
"""csv_writer = csv.writer(fileobj [, dialect='excel']
|
||||
[optional keyword args])
|
||||
for row in sequence:
|
||||
csv_writer.writerow(row)
|
||||
|
||||
[or]
|
||||
|
||||
csv_writer = csv.writer(fileobj [, dialect='excel']
|
||||
[optional keyword args])
|
||||
csv_writer.writerows(rows)
|
||||
"""Return a writer object that will write user data on the given file object.
|
||||
|
||||
The "fileobj" argument can be any object that supports the file API.
|
||||
The optional "dialect" argument defines a CSV dialect. The function
|
||||
also accepts optional keyword arguments which override settings
|
||||
provided by the dialect.
|
||||
"""
|
||||
|
||||
def reader(
|
||||
|
|
@ -177,14 +169,11 @@ def reader(
|
|||
quoting: _QuotingType = 0,
|
||||
strict: bool = False,
|
||||
) -> _reader:
|
||||
"""csv_reader = reader(iterable [, dialect='excel']
|
||||
[optional keyword args])
|
||||
for row in csv_reader:
|
||||
process(row)
|
||||
"""Return a reader object that will process lines from the given iterable.
|
||||
|
||||
The "iterable" argument can be any object that returns a line
|
||||
of input for each iteration, such as a file object or a list. The
|
||||
optional "dialect" parameter is discussed below. The function
|
||||
optional "dialect" argument defines a CSV dialect. The function
|
||||
also accepts optional keyword arguments which override settings
|
||||
provided by the dialect.
|
||||
|
||||
|
|
@ -206,33 +195,26 @@ def register_dialect(
|
|||
quoting: _QuotingType = 0,
|
||||
strict: bool = False,
|
||||
) -> None:
|
||||
"""Create a mapping from a string name to a dialect class.
|
||||
dialect = csv.register_dialect(name[, dialect[, **fmtparams]])
|
||||
"""Create a mapping from a string name to a CVS dialect.
|
||||
|
||||
The optional "dialect" argument specifies the base dialect instance
|
||||
or the name of the registered dialect. The function also accepts
|
||||
optional keyword arguments which override settings provided by the
|
||||
dialect.
|
||||
"""
|
||||
|
||||
def unregister_dialect(name: str) -> None:
|
||||
"""Delete the name/dialect mapping associated with a string name.
|
||||
|
||||
csv.unregister_dialect(name)
|
||||
"""
|
||||
"""Delete the name/dialect mapping associated with a string name."""
|
||||
|
||||
def get_dialect(name: str) -> Dialect:
|
||||
"""Return the dialect instance associated with name.
|
||||
|
||||
dialect = csv.get_dialect(name)
|
||||
"""
|
||||
"""Return the dialect instance associated with name."""
|
||||
|
||||
def list_dialects() -> list[str]:
|
||||
"""Return a list of all known dialect names.
|
||||
|
||||
names = csv.list_dialects()
|
||||
"""
|
||||
"""Return a list of all known dialect names."""
|
||||
|
||||
def field_size_limit(new_limit: int = ...) -> int:
|
||||
"""Sets an upper limit on parsed fields.
|
||||
|
||||
csv.field_size_limit([limit])
|
||||
|
||||
Returns old limit. If limit is not given, no new limit is set and
|
||||
the old limit is returned
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from abc import abstractmethod
|
|||
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
|
||||
from ctypes import CDLL, ArgumentError as ArgumentError, c_void_p
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Final, Generic, TypeVar, final, overload, type_check_only
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, final, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
|
@ -326,6 +326,10 @@ class Structure(_CData, metaclass=_PyCStructType):
|
|||
if sys.version_info >= (3, 13):
|
||||
_align_: ClassVar[int]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
# _layout_ can be defined by the user, but is not always present.
|
||||
_layout_: ClassVar[Literal["ms", "gcc-sysv"]]
|
||||
|
||||
def __init__(self, *args: Any, **kw: Any) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@ class window: # undocumented
|
|||
"""Remove attribute attr from the "background" set."""
|
||||
|
||||
def attron(self, attr: int, /) -> None:
|
||||
"""Add attribute attr from the "background" set."""
|
||||
"""Add attribute attr to the "background" set."""
|
||||
|
||||
def attrset(self, attr: int, /) -> None:
|
||||
"""Set the "background" set of attributes."""
|
||||
|
|
|
|||
|
|
@ -194,6 +194,9 @@ if sys.platform == "win32":
|
|||
template_file: int,
|
||||
/,
|
||||
) -> int: ...
|
||||
def CreateFileMapping(
|
||||
file_handle: int, security_attributes: int, protect: int, max_size_high: int, max_size_low: int, name: str, /
|
||||
) -> int: ...
|
||||
def CreateJunction(src_path: str, dst_path: str, /) -> None: ...
|
||||
def CreateNamedPipe(
|
||||
name: str,
|
||||
|
|
@ -291,6 +294,9 @@ if sys.platform == "win32":
|
|||
def GetVersion() -> int:
|
||||
"""Return the version number of the current operating system."""
|
||||
|
||||
def MapViewOfFile(
|
||||
file_map: int, desired_access: int, file_offset_high: int, file_offset_low: int, number_bytes: int, /
|
||||
) -> int: ...
|
||||
def OpenProcess(desired_access: int, inherit_handle: bool, process_id: int, /) -> int: ...
|
||||
def PeekNamedPipe(handle: int, size: int = 0, /) -> tuple[int, int] | tuple[bytes, int, int]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
|
|
@ -309,6 +315,7 @@ if sys.platform == "win32":
|
|||
def TerminateProcess(handle: int, exit_code: int, /) -> None:
|
||||
"""Terminate the specified process and all of its threads."""
|
||||
|
||||
def VirtualQuerySize(address: int, /) -> int: ...
|
||||
def WaitForMultipleObjects(handle_seq: Sequence[int], wait_flag: bool, milliseconds: int = 0xFFFFFFFF, /) -> int: ...
|
||||
def WaitForSingleObject(handle: int, milliseconds: int, /) -> int:
|
||||
"""Wait for a single object.
|
||||
|
|
@ -378,6 +385,8 @@ if sys.platform == "win32":
|
|||
def ResetEvent(event: int) -> None: ...
|
||||
def SetEvent(event: int) -> None: ...
|
||||
|
||||
def OpenFileMapping(desired_access: int, inherit_handle: bool, name: str, /) -> int: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
def CopyFile2(existing_file_name: str, new_file_name: str, flags: int, progress_routine: int | None = None) -> int:
|
||||
"""Copies a file from one name to a new name.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,10 @@ class ZstdCompressor:
|
|||
FLUSH_BLOCK: Final = 1
|
||||
FLUSH_FRAME: Final = 2
|
||||
def __new__(
|
||||
cls, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
|
||||
cls,
|
||||
level: int | None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> Self: ...
|
||||
def compress(
|
||||
self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
|
||||
|
|
@ -126,7 +129,9 @@ class ZstdDecompressor:
|
|||
function instead.
|
||||
"""
|
||||
|
||||
def __new__(cls, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> Self: ...
|
||||
def __new__(
|
||||
cls, zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None, options: Mapping[int, int] | None = None
|
||||
) -> Self: ...
|
||||
def decompress(self, /, data: ReadableBuffer, max_length: int = -1) -> bytes:
|
||||
"""Decompress *data*, returning uncompressed bytes if possible, or b'' otherwise.
|
||||
|
||||
|
|
|
|||
|
|
@ -364,7 +364,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||
def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ...
|
||||
def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ...
|
||||
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ...
|
||||
def _parse_optional(self, arg_string: str) -> tuple[Action | None, str, str | None] | None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def _parse_optional(self, arg_string: str) -> list[tuple[Action | None, str, str | None, str | None]] | None: ...
|
||||
else:
|
||||
def _parse_optional(self, arg_string: str) -> tuple[Action | None, str, str | None] | None: ...
|
||||
|
||||
def _get_option_tuples(self, option_string: str) -> list[tuple[Action, str, str | None]]: ...
|
||||
def _get_nargs_pattern(self, action: Action) -> str: ...
|
||||
def _get_values(self, action: Action, arg_strings: list[str]) -> Any: ...
|
||||
|
|
|
|||
|
|
@ -123,9 +123,6 @@ class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
|
|||
been processed (meaning that a task_done() call was received for every
|
||||
item that had been put() into the queue).
|
||||
|
||||
shutdown(immediate=True) calls task_done() for each remaining item in
|
||||
the queue.
|
||||
|
||||
Raises ValueError if called more times than there were items placed in
|
||||
the queue.
|
||||
"""
|
||||
|
|
@ -142,9 +139,11 @@ class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
|
|||
By default, gets will only raise once the queue is empty. Set
|
||||
'immediate' to True to make gets raise immediately instead.
|
||||
|
||||
All blocked callers of put() and get() will be unblocked. If
|
||||
'immediate', a task is marked as done for each item remaining in
|
||||
the queue, which may unblock callers of join().
|
||||
All blocked callers of put() and get() will be unblocked.
|
||||
|
||||
If 'immediate', the queue is drained and unfinished tasks
|
||||
is reduced by the number of drained tasks. If unfinished tasks
|
||||
is reduced to zero, callers of Queue.join are unblocked.
|
||||
"""
|
||||
|
||||
class PriorityQueue(Queue[SupportsRichComparisonT]):
|
||||
|
|
|
|||
|
|
@ -1835,14 +1835,22 @@ class bytes(Sequence[int]):
|
|||
|
||||
The original string is never truncated.
|
||||
"""
|
||||
if sys.version_info >= (3, 14):
|
||||
@classmethod
|
||||
def fromhex(cls, string: str | ReadableBuffer, /) -> Self:
|
||||
"""Create a bytes object from a string of hexadecimal numbers.
|
||||
|
||||
@classmethod
|
||||
def fromhex(cls, string: str, /) -> Self:
|
||||
"""Create a bytes object from a string of hexadecimal numbers.
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'.
|
||||
"""
|
||||
else:
|
||||
@classmethod
|
||||
def fromhex(cls, string: str, /) -> Self:
|
||||
"""Create a bytes object from a string of hexadecimal numbers.
|
||||
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'.
|
||||
"""
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def maketrans(frm: ReadableBuffer, to: ReadableBuffer, /) -> bytes:
|
||||
|
|
@ -2331,14 +2339,22 @@ class bytearray(MutableSequence[int]):
|
|||
|
||||
The original string is never truncated.
|
||||
"""
|
||||
if sys.version_info >= (3, 14):
|
||||
@classmethod
|
||||
def fromhex(cls, string: str | ReadableBuffer, /) -> Self:
|
||||
"""Create a bytearray object from a string of hexadecimal numbers.
|
||||
|
||||
@classmethod
|
||||
def fromhex(cls, string: str, /) -> Self:
|
||||
"""Create a bytearray object from a string of hexadecimal numbers.
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\\\xb9\\\\x01\\\\xef')
|
||||
"""
|
||||
else:
|
||||
@classmethod
|
||||
def fromhex(cls, string: str, /) -> Self:
|
||||
"""Create a bytearray object from a string of hexadecimal numbers.
|
||||
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\\\xb9\\\\x01\\\\xef')
|
||||
"""
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\\\xb9\\\\x01\\\\xef')
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def maketrans(frm: ReadableBuffer, to: ReadableBuffer, /) -> bytes:
|
||||
|
|
@ -2414,7 +2430,7 @@ class bytearray(MutableSequence[int]):
|
|||
"""Resize the internal buffer of bytearray to len.
|
||||
|
||||
size
|
||||
New size to resize to..
|
||||
New size to resize to.
|
||||
"""
|
||||
|
||||
_IntegerFormats: TypeAlias = Literal[
|
||||
|
|
@ -2579,10 +2595,21 @@ class memoryview(Sequence[_I]):
|
|||
|
||||
def __release_buffer__(self, buffer: memoryview, /) -> None:
|
||||
"""Release the buffer object that exposes the underlying memory of the object."""
|
||||
# These are inherited from the Sequence ABC, but don't actually exist on memoryview.
|
||||
# See https://github.com/python/cpython/issues/125420
|
||||
index: ClassVar[None] # type: ignore[assignment]
|
||||
count: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 14):
|
||||
def index(self, value: object, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int:
|
||||
"""Return the index of the first occurrence of a value.
|
||||
|
||||
Raises ValueError if the value is not present.
|
||||
"""
|
||||
|
||||
def count(self, value: object, /) -> int:
|
||||
"""Count the number of occurrences of a value."""
|
||||
else:
|
||||
# These are inherited from the Sequence ABC, but don't actually exist on memoryview.
|
||||
# See https://github.com/python/cpython/issues/125420
|
||||
index: ClassVar[None] # type: ignore[assignment]
|
||||
count: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
||||
"""See PEP 585"""
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ class OrderedDict(dict[_KT, _VT]):
|
|||
"""
|
||||
|
||||
def copy(self) -> Self:
|
||||
"""od.copy() -> a shallow copy of od"""
|
||||
"""A shallow copy of ordered dict."""
|
||||
|
||||
def __reversed__(self) -> Iterator[_KT]:
|
||||
"""od.__reversed__() <==> reversed(od)"""
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ def finalize_dict(zstd_dict: ZstdDict, /, samples: Iterable[ReadableBuffer], dic
|
|||
"""
|
||||
|
||||
def compress(
|
||||
data: ReadableBuffer, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
|
||||
data: ReadableBuffer,
|
||||
level: int | None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> bytes:
|
||||
"""Return Zstandard compressed *data* as bytes.
|
||||
|
||||
|
|
@ -102,7 +105,9 @@ def compress(
|
|||
For incremental compression, use a ZstdCompressor instead.
|
||||
"""
|
||||
|
||||
def decompress(data: ReadableBuffer, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> bytes:
|
||||
def decompress(
|
||||
data: ReadableBuffer, zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None, options: Mapping[int, int] | None = None
|
||||
) -> bytes:
|
||||
"""Decompress one or more frames of Zstandard compressed *data*.
|
||||
|
||||
*zstd_dict* is a ZstdDict object, a pre-trained Zstandard dictionary. See
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class ZstdFile(_streams.BaseStream):
|
|||
*,
|
||||
level: None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> None:
|
||||
"""Open a Zstandard compressed file in binary mode.
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ class ZstdFile(_streams.BaseStream):
|
|||
*,
|
||||
level: int | None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> None: ...
|
||||
def write(self, data: ReadableBuffer, /) -> int:
|
||||
"""Write a bytes-like object *data* to the file.
|
||||
|
|
@ -170,7 +170,7 @@ def open(
|
|||
*,
|
||||
level: None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
|
|
@ -211,7 +211,7 @@ def open(
|
|||
*,
|
||||
level: int | None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
|
|
@ -224,7 +224,7 @@ def open(
|
|||
*,
|
||||
level: None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
|
|
@ -237,7 +237,7 @@ def open(
|
|||
*,
|
||||
level: int | None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
|
|
|
|||
|
|
@ -590,16 +590,32 @@ class Decimal:
|
|||
"""
|
||||
|
||||
def logical_and(self, other: _Decimal, context: Context | None = None) -> Decimal:
|
||||
"""Return the digit-wise 'and' of the two (logical) operands."""
|
||||
"""Applies an 'and' operation between self and other's digits.
|
||||
|
||||
Both self and other must be logical numbers.
|
||||
|
||||
"""
|
||||
|
||||
def logical_invert(self, context: Context | None = None) -> Decimal:
|
||||
"""Return the digit-wise inversion of the (logical) operand."""
|
||||
"""Invert all its digits.
|
||||
|
||||
The self must be logical number.
|
||||
|
||||
"""
|
||||
|
||||
def logical_or(self, other: _Decimal, context: Context | None = None) -> Decimal:
|
||||
"""Return the digit-wise 'or' of the two (logical) operands."""
|
||||
"""Applies an 'or' operation between self and other's digits.
|
||||
|
||||
Both self and other must be logical numbers.
|
||||
|
||||
"""
|
||||
|
||||
def logical_xor(self, other: _Decimal, context: Context | None = None) -> Decimal:
|
||||
"""Return the digit-wise 'exclusive or' of the two (logical) operands."""
|
||||
"""Applies an 'xor' operation between self and other's digits.
|
||||
|
||||
Both self and other must be logical numbers.
|
||||
|
||||
"""
|
||||
|
||||
def max_mag(self, other: _Decimal, context: Context | None = None) -> Decimal:
|
||||
"""Similar to the max() method, but the comparison is done using the absolute
|
||||
|
|
@ -859,16 +875,100 @@ class Context:
|
|||
"""Return the exponent of the magnitude of the operand's MSD."""
|
||||
|
||||
def logical_and(self, x: _Decimal, y: _Decimal, /) -> Decimal:
|
||||
"""Digit-wise and of x and y."""
|
||||
"""Applies the logical operation 'and' between each operand's digits.
|
||||
|
||||
The operands must be both logical numbers.
|
||||
|
||||
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
|
||||
Decimal('1')
|
||||
>>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
|
||||
Decimal('1000')
|
||||
>>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
|
||||
Decimal('10')
|
||||
>>> ExtendedContext.logical_and(110, 1101)
|
||||
Decimal('100')
|
||||
>>> ExtendedContext.logical_and(Decimal(110), 1101)
|
||||
Decimal('100')
|
||||
>>> ExtendedContext.logical_and(110, Decimal(1101))
|
||||
Decimal('100')
|
||||
|
||||
"""
|
||||
|
||||
def logical_invert(self, x: _Decimal, /) -> Decimal:
|
||||
"""Invert all digits of x."""
|
||||
"""Invert all the digits in the operand.
|
||||
|
||||
The operand must be a logical number.
|
||||
|
||||
>>> ExtendedContext.logical_invert(Decimal('0'))
|
||||
Decimal('111111111')
|
||||
>>> ExtendedContext.logical_invert(Decimal('1'))
|
||||
Decimal('111111110')
|
||||
>>> ExtendedContext.logical_invert(Decimal('111111111'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_invert(Decimal('101010101'))
|
||||
Decimal('10101010')
|
||||
>>> ExtendedContext.logical_invert(1101)
|
||||
Decimal('111110010')
|
||||
|
||||
"""
|
||||
|
||||
def logical_or(self, x: _Decimal, y: _Decimal, /) -> Decimal:
|
||||
"""Digit-wise or of x and y."""
|
||||
"""Applies the logical operation 'or' between each operand's digits.
|
||||
|
||||
The operands must be both logical numbers.
|
||||
|
||||
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
|
||||
Decimal('1')
|
||||
>>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
|
||||
Decimal('1')
|
||||
>>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
|
||||
Decimal('1')
|
||||
>>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
|
||||
Decimal('1110')
|
||||
>>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
|
||||
Decimal('1110')
|
||||
>>> ExtendedContext.logical_or(110, 1101)
|
||||
Decimal('1111')
|
||||
>>> ExtendedContext.logical_or(Decimal(110), 1101)
|
||||
Decimal('1111')
|
||||
>>> ExtendedContext.logical_or(110, Decimal(1101))
|
||||
Decimal('1111')
|
||||
|
||||
"""
|
||||
|
||||
def logical_xor(self, x: _Decimal, y: _Decimal, /) -> Decimal:
|
||||
"""Digit-wise xor of x and y."""
|
||||
"""Applies the logical operation 'xor' between each operand's digits.
|
||||
|
||||
The operands must be both logical numbers.
|
||||
|
||||
>>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
|
||||
Decimal('1')
|
||||
>>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
|
||||
Decimal('1')
|
||||
>>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
|
||||
Decimal('0')
|
||||
>>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
|
||||
Decimal('110')
|
||||
>>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
|
||||
Decimal('1101')
|
||||
>>> ExtendedContext.logical_xor(110, 1101)
|
||||
Decimal('1011')
|
||||
>>> ExtendedContext.logical_xor(Decimal(110), 1101)
|
||||
Decimal('1011')
|
||||
>>> ExtendedContext.logical_xor(110, Decimal(1101))
|
||||
Decimal('1011')
|
||||
|
||||
"""
|
||||
|
||||
def max(self, x: _Decimal, y: _Decimal, /) -> Decimal:
|
||||
"""Compare the values numerically and return the maximum."""
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class Generator(Generic[_MessageT]):
|
|||
expanded to 8 spaces) than maxheaderlen, the header will split as
|
||||
defined in the Header class. Set maxheaderlen to zero to disable
|
||||
header wrapping. The default is 78, as recommended (but not required)
|
||||
by RFC 2822.
|
||||
by RFC 5322 section 2.1.1.
|
||||
|
||||
The policy keyword specifies a policy object that controls a number of
|
||||
aspects of the generator's operation. If no policy is specified,
|
||||
|
|
@ -119,7 +119,7 @@ class BytesGenerator(Generator[_MessageT]):
|
|||
expanded to 8 spaces) than maxheaderlen, the header will split as
|
||||
defined in the Header class. Set maxheaderlen to zero to disable
|
||||
header wrapping. The default is 78, as recommended (but not required)
|
||||
by RFC 2822.
|
||||
by RFC 5322 section 2.1.1.
|
||||
|
||||
The policy keyword specifies a policy object that controls a number of
|
||||
aspects of the generator's operation. If no policy is specified,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class _SupportsDecodeToPayload(Protocol):
|
|||
class Message(Generic[_HeaderT_co, _HeaderParamT_contra]):
|
||||
"""Basic message object.
|
||||
|
||||
A message object is defined as something that has a bunch of RFC 2822
|
||||
A message object is defined as something that has a bunch of RFC 5322
|
||||
headers and a payload. It may optionally have an envelope header
|
||||
(a.k.a. Unix-From or From_ header). If the message is a container (i.e. a
|
||||
multipart or a message/rfc822), then the payload is a list of Message
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""A parser of RFC 2822 and MIME email messages."""
|
||||
"""A parser of RFC 5322 and MIME email messages."""
|
||||
|
||||
from _typeshed import SupportsRead
|
||||
from collections.abc import Callable
|
||||
|
|
@ -14,13 +14,13 @@ __all__ = ["Parser", "HeaderParser", "BytesParser", "BytesHeaderParser", "FeedPa
|
|||
class Parser(Generic[_MessageT]):
|
||||
@overload
|
||||
def __init__(self: Parser[Message[str, str]], _class: None = None) -> None:
|
||||
"""Parser of RFC 2822 and MIME email messages.
|
||||
"""Parser of RFC 5322 and MIME email messages.
|
||||
|
||||
Creates an in-memory object tree representing the email message, which
|
||||
can then be manipulated and turned over to a Generator to return the
|
||||
textual representation of the message.
|
||||
|
||||
The string must be formatted as a block of RFC 2822 headers and header
|
||||
The string must be formatted as a block of RFC 5322 headers and header
|
||||
continuation lines, optionally preceded by a 'Unix-from' header. The
|
||||
header block is terminated either by the end of the string or by a
|
||||
blank line.
|
||||
|
|
@ -65,13 +65,13 @@ class BytesParser(Generic[_MessageT]):
|
|||
parser: Parser[_MessageT]
|
||||
@overload
|
||||
def __init__(self: BytesParser[Message[str, str]], _class: None = None) -> None:
|
||||
"""Parser of binary RFC 2822 and MIME email messages.
|
||||
"""Parser of binary RFC 5322 and MIME email messages.
|
||||
|
||||
Creates an in-memory object tree representing the email message, which
|
||||
can then be manipulated and turned over to a Generator to return the
|
||||
textual representation of the message.
|
||||
|
||||
The input must be formatted as a block of RFC 2822 headers and header
|
||||
The input must be formatted as a block of RFC 5322 headers and header
|
||||
continuation lines, optionally preceded by a 'Unix-from' header. The
|
||||
header block is terminated either by the end of the input or by a
|
||||
blank line.
|
||||
|
|
|
|||
|
|
@ -144,17 +144,23 @@ if sys.platform != "win32":
|
|||
|
||||
@overload
|
||||
def fcntl(fd: FileDescriptorLike, cmd: int, arg: int = 0, /) -> int:
|
||||
"""Perform the operation `cmd` on file descriptor fd.
|
||||
"""Perform the operation cmd on file descriptor fd.
|
||||
|
||||
The values used for `cmd` are operating system dependent, and are available
|
||||
as constants in the fcntl module, using the same names as used in
|
||||
the relevant C header files. The argument arg is optional, and
|
||||
defaults to 0; it may be an int or a string. If arg is given as a string,
|
||||
the return value of fcntl is a string of that length, containing the
|
||||
resulting value put in the arg buffer by the operating system. The length
|
||||
of the arg string is not allowed to exceed 1024 bytes. If the arg given
|
||||
is an integer or if none is specified, the result value is an integer
|
||||
corresponding to the return value of the fcntl call in the C code.
|
||||
The values used for cmd are operating system dependent, and are
|
||||
available as constants in the fcntl module, using the same names as used
|
||||
in the relevant C header files. The argument arg is optional, and
|
||||
defaults to 0; it may be an integer, a bytes-like object or a string.
|
||||
If arg is given as a string, it will be encoded to binary using the
|
||||
UTF-8 encoding.
|
||||
|
||||
If the arg given is an integer or if none is specified, the result value
|
||||
is an integer corresponding to the return value of the fcntl() call in
|
||||
the C code.
|
||||
|
||||
If arg is given as a bytes-like object, the return value of fcntl() is a
|
||||
bytes object of that length, containing the resulting value put in the
|
||||
arg buffer by the operating system. The length of the arg buffer is not
|
||||
allowed to exceed 1024 bytes.
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -162,34 +168,34 @@ if sys.platform != "win32":
|
|||
# If arg is an int, return int
|
||||
@overload
|
||||
def ioctl(fd: FileDescriptorLike, request: int, arg: int = 0, mutate_flag: bool = True, /) -> int:
|
||||
"""Perform the operation `request` on file descriptor `fd`.
|
||||
"""Perform the operation request on file descriptor fd.
|
||||
|
||||
The values used for `request` are operating system dependent, and are available
|
||||
as constants in the fcntl or termios library modules, using the same names as
|
||||
used in the relevant C header files.
|
||||
The values used for request are operating system dependent, and are
|
||||
available as constants in the fcntl or termios library modules, using
|
||||
the same names as used in the relevant C header files.
|
||||
|
||||
The argument `arg` is optional, and defaults to 0; it may be an int or a
|
||||
buffer containing character data (most likely a string or an array).
|
||||
The argument arg is optional, and defaults to 0; it may be an integer, a
|
||||
bytes-like object or a string. If arg is given as a string, it will be
|
||||
encoded to binary using the UTF-8 encoding.
|
||||
|
||||
If the argument is a mutable buffer (such as an array) and if the
|
||||
mutate_flag argument (which is only allowed in this case) is true then the
|
||||
buffer is (in effect) passed to the operating system and changes made by
|
||||
the OS will be reflected in the contents of the buffer after the call has
|
||||
returned. The return value is the integer returned by the ioctl system
|
||||
call.
|
||||
If the arg given is an integer or if none is specified, the result value
|
||||
is an integer corresponding to the return value of the ioctl() call in
|
||||
the C code.
|
||||
|
||||
If the argument is a mutable buffer and the mutable_flag argument is false,
|
||||
the behavior is as if a string had been passed.
|
||||
If the argument is a mutable buffer (such as a bytearray) and the
|
||||
mutate_flag argument is true (default) then the buffer is (in effect)
|
||||
passed to the operating system and changes made by the OS will be
|
||||
reflected in the contents of the buffer after the call has returned.
|
||||
The return value is the integer returned by the ioctl() system call.
|
||||
|
||||
If the argument is an immutable buffer (most likely a string) then a copy
|
||||
of the buffer is passed to the operating system and the return value is a
|
||||
string of the same length containing whatever the operating system put in
|
||||
the buffer. The length of the arg buffer in this case is not allowed to
|
||||
If the argument is a mutable buffer and the mutable_flag argument is
|
||||
false, the behavior is as if an immutable buffer had been passed.
|
||||
|
||||
If the argument is an immutable buffer then a copy of the buffer is
|
||||
passed to the operating system and the return value is a bytes object of
|
||||
the same length containing whatever the operating system put in the
|
||||
buffer. The length of the arg buffer in this case is not allowed to
|
||||
exceed 1024 bytes.
|
||||
|
||||
If the arg given is an integer or if none is specified, the result value is
|
||||
an integer corresponding to the return value of the ioctl call in the C
|
||||
code.
|
||||
"""
|
||||
# The return type works as follows:
|
||||
# - If arg is a read-write buffer, return int if mutate_flag is True, otherwise bytes
|
||||
|
|
@ -203,7 +209,7 @@ if sys.platform != "win32":
|
|||
@overload
|
||||
def ioctl(fd: FileDescriptorLike, request: int, arg: Buffer, mutate_flag: bool = True, /) -> Any: ...
|
||||
def flock(fd: FileDescriptorLike, operation: int, /) -> None:
|
||||
"""Perform the lock operation `operation` on file descriptor `fd`.
|
||||
"""Perform the lock operation on file descriptor fd.
|
||||
|
||||
See the Unix manual page for flock(2) for details (On some systems, this
|
||||
function is emulated using fcntl()).
|
||||
|
|
@ -212,22 +218,22 @@ if sys.platform != "win32":
|
|||
def lockf(fd: FileDescriptorLike, cmd: int, len: int = 0, start: int = 0, whence: int = 0, /) -> Any:
|
||||
"""A wrapper around the fcntl() locking calls.
|
||||
|
||||
`fd` is the file descriptor of the file to lock or unlock, and operation is one
|
||||
of the following values:
|
||||
fd is the file descriptor of the file to lock or unlock, and operation
|
||||
is one of the following values:
|
||||
|
||||
LOCK_UN - unlock
|
||||
LOCK_SH - acquire a shared lock
|
||||
LOCK_EX - acquire an exclusive lock
|
||||
|
||||
When operation is LOCK_SH or LOCK_EX, it can also be bitwise ORed with
|
||||
LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and the
|
||||
lock cannot be acquired, an OSError will be raised and the exception will
|
||||
have an errno attribute set to EACCES or EAGAIN (depending on the operating
|
||||
system -- for portability, check for either value).
|
||||
LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and
|
||||
the lock cannot be acquired, an OSError will be raised and the exception
|
||||
will have an errno attribute set to EACCES or EAGAIN (depending on the
|
||||
operating system -- for portability, check for either value).
|
||||
|
||||
`len` is the number of bytes to lock, with the default meaning to lock to
|
||||
EOF. `start` is the byte offset, relative to `whence`, to that the lock
|
||||
starts. `whence` is as with fileobj.seek(), specifically:
|
||||
len is the number of bytes to lock, with the default meaning to lock to
|
||||
EOF. start is the byte offset, relative to whence, to that the lock
|
||||
starts. whence is as with fileobj.seek(), specifically:
|
||||
|
||||
0 - relative to the start of the file (SEEK_SET)
|
||||
1 - relative to the current buffer position (SEEK_CUR)
|
||||
|
|
|
|||
|
|
@ -387,8 +387,7 @@ def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]:
|
|||
class singledispatchmethod(Generic[_T]):
|
||||
"""Single-dispatch generic method descriptor.
|
||||
|
||||
Supports wrapping existing descriptors and handles non-descriptor
|
||||
callables as instance methods.
|
||||
Supports wrapping existing descriptors.
|
||||
"""
|
||||
|
||||
dispatcher: _SingleDispatchCallable[_T]
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ if sys.version_info >= (3, 11):
|
|||
dot are special cases that are not matched by '*' and '?'
|
||||
patterns by default.
|
||||
|
||||
The order of the returned list is undefined. Sort it if you need a
|
||||
particular order.
|
||||
|
||||
If `include_hidden` is true, the patterns '*', '?', '**' will match hidden
|
||||
directories.
|
||||
|
||||
|
|
@ -63,6 +66,9 @@ if sys.version_info >= (3, 11):
|
|||
dot are special cases that are not matched by '*' and '?'
|
||||
patterns.
|
||||
|
||||
The order of the returned paths is undefined. Sort them if you need a
|
||||
particular order.
|
||||
|
||||
If recursive is true, the pattern '**' will match any files and
|
||||
zero or more directories and subdirectories.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ without surprises: heap[0] is the smallest item, and heap.sort()
|
|||
maintains the heap invariant!
|
||||
"""
|
||||
|
||||
import sys
|
||||
from _heapq import *
|
||||
from _typeshed import SupportsRichComparison
|
||||
from collections.abc import Callable, Generator, Iterable
|
||||
|
|
@ -37,6 +38,10 @@ from typing import Any, Final, TypeVar
|
|||
|
||||
__all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", "nsmallest", "heappushpop"]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
# Added to __all__ in 3.14.1
|
||||
__all__ += ["heapify_max", "heappop_max", "heappush_max", "heappushpop_max", "heapreplace_max"]
|
||||
|
||||
_S = TypeVar("_S")
|
||||
|
||||
__about__: Final[str]
|
||||
|
|
|
|||
|
|
@ -36,8 +36,12 @@ class HTMLParser(ParserBase):
|
|||
def __init__(self, *, convert_charrefs: bool = True, scripting: bool = False) -> None:
|
||||
"""Initialize and reset this instance.
|
||||
|
||||
If convert_charrefs is True (the default), all character references
|
||||
If convert_charrefs is true (the default), all character references
|
||||
are automatically converted to the corresponding Unicode characters.
|
||||
|
||||
If *scripting* is false (the default), the content of the
|
||||
``noscript`` element is parsed normally; if it's true,
|
||||
it's returned as is without being parsed.
|
||||
"""
|
||||
|
||||
def feed(self, data: str) -> None:
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class HTTPMessage(email.message.Message[str, str]):
|
|||
|
||||
@overload
|
||||
def parse_headers(fp: SupportsReadline[bytes], _class: Callable[[], _MessageT]) -> _MessageT:
|
||||
"""Parses only RFC2822 headers from a file pointer."""
|
||||
"""Parses only RFC 5322 headers from a file pointer."""
|
||||
|
||||
@overload
|
||||
def parse_headers(fp: SupportsReadline[bytes]) -> HTTPMessage: ...
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ if sys.version_info >= (3, 10):
|
|||
def is_file(self) -> Literal[False]: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
def joinpath(self, *descendants: str) -> abc.Traversable: ...
|
||||
def joinpath(self, *descendants: StrPath) -> abc.Traversable: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
def joinpath(self, child: str) -> abc.Traversable: ... # type: ignore[override]
|
||||
def joinpath(self, child: StrPath) -> abc.Traversable: ... # type: ignore[override]
|
||||
else:
|
||||
def joinpath(self, child: str) -> abc.Traversable: ...
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import sys
|
||||
from _typeshed import StrPath
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import Iterator
|
||||
from io import BufferedReader
|
||||
|
|
@ -65,7 +66,7 @@ if sys.version_info >= (3, 11):
|
|||
"""
|
||||
|
||||
@abstractmethod
|
||||
def joinpath(self, *descendants: str) -> Traversable:
|
||||
def joinpath(self, *descendants: StrPath) -> Traversable:
|
||||
"""
|
||||
Return Traversable resolved with any descendants applied.
|
||||
|
||||
|
|
@ -97,7 +98,7 @@ if sys.version_info >= (3, 11):
|
|||
The base name of this object without any parent references.
|
||||
"""
|
||||
|
||||
def __truediv__(self, child: str, /) -> Traversable:
|
||||
def __truediv__(self, child: StrPath, /) -> Traversable:
|
||||
"""
|
||||
Return Traversable child in self
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Interface adapters for low-level readers.
|
|||
|
||||
import abc
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from collections.abc import Iterator
|
||||
from io import TextIOWrapper
|
||||
from typing import IO, Any, BinaryIO, Literal, NoReturn, overload
|
||||
|
|
@ -84,7 +85,7 @@ if sys.version_info >= (3, 11):
|
|||
def iterdir(self) -> Iterator[ResourceHandle | ResourceContainer]: ...
|
||||
def open(self, *args: Never, **kwargs: Never) -> NoReturn: ... # type: ignore[override]
|
||||
if sys.version_info < (3, 12):
|
||||
def joinpath(self, *descendants: str) -> Traversable: ...
|
||||
def joinpath(self, *descendants: StrPath) -> Traversable: ...
|
||||
|
||||
class TraversableReader(TraversableResources, SimpleReader, metaclass=abc.ABCMeta):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -125,9 +125,10 @@ def dumps(
|
|||
(``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
|
||||
instead of raising a ``TypeError``.
|
||||
|
||||
If ``ensure_ascii`` is false, then the return value can contain non-ASCII
|
||||
characters if they appear in strings contained in ``obj``. Otherwise, all
|
||||
such characters are escaped in JSON strings.
|
||||
If ``ensure_ascii`` is false, then the return value can contain
|
||||
non-ASCII and non-printable characters if they appear in strings
|
||||
contained in ``obj``. Otherwise, all such characters are escaped in
|
||||
JSON strings.
|
||||
|
||||
If ``check_circular`` is false, then the circular reference check
|
||||
for container types will be skipped and a circular reference will
|
||||
|
|
@ -143,10 +144,11 @@ def dumps(
|
|||
level of 0 will only insert newlines. ``None`` is the most compact
|
||||
representation.
|
||||
|
||||
If specified, ``separators`` should be an ``(item_separator, key_separator)``
|
||||
tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and
|
||||
``(',', ': ')`` otherwise. To get the most compact JSON representation,
|
||||
you should specify ``(',', ':')`` to eliminate whitespace.
|
||||
If specified, ``separators`` should be an ``(item_separator,
|
||||
key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is
|
||||
``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON
|
||||
representation, you should specify ``(',', ':')`` to eliminate
|
||||
whitespace.
|
||||
|
||||
``default(obj)`` is a function that should return a serializable version
|
||||
of obj or raise TypeError. The default simply raises TypeError.
|
||||
|
|
@ -183,8 +185,9 @@ def dump(
|
|||
instead of raising a ``TypeError``.
|
||||
|
||||
If ``ensure_ascii`` is false, then the strings written to ``fp`` can
|
||||
contain non-ASCII characters if they appear in strings contained in
|
||||
``obj``. Otherwise, all such characters are escaped in JSON strings.
|
||||
contain non-ASCII and non-printable characters if they appear in strings
|
||||
contained in ``obj``. Otherwise, all such characters are escaped in JSON
|
||||
strings.
|
||||
|
||||
If ``check_circular`` is false, then the circular reference check
|
||||
for container types will be skipped and a circular reference will
|
||||
|
|
@ -200,10 +203,11 @@ def dump(
|
|||
level of 0 will only insert newlines. ``None`` is the most compact
|
||||
representation.
|
||||
|
||||
If specified, ``separators`` should be an ``(item_separator, key_separator)``
|
||||
tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and
|
||||
``(',', ': ')`` otherwise. To get the most compact JSON representation,
|
||||
you should specify ``(',', ':')`` to eliminate whitespace.
|
||||
If specified, ``separators`` should be an ``(item_separator,
|
||||
key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is
|
||||
``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON
|
||||
representation, you should specify ``(',', ':')`` to eliminate
|
||||
whitespace.
|
||||
|
||||
``default(obj)`` is a function that should return a serializable version
|
||||
of obj or raise TypeError. The default simply raises TypeError.
|
||||
|
|
@ -236,11 +240,12 @@ def loads(
|
|||
``object_hook`` will be used instead of the ``dict``. This feature
|
||||
can be used to implement custom decoders (e.g. JSON-RPC class hinting).
|
||||
|
||||
``object_pairs_hook`` is an optional function that will be called with the
|
||||
result of any object literal decoded with an ordered list of pairs. The
|
||||
return value of ``object_pairs_hook`` will be used instead of the ``dict``.
|
||||
This feature can be used to implement custom decoders. If ``object_hook``
|
||||
is also defined, the ``object_pairs_hook`` takes priority.
|
||||
``object_pairs_hook`` is an optional function that will be called with
|
||||
the result of any object literal decoded with an ordered list of pairs.
|
||||
The return value of ``object_pairs_hook`` will be used instead of the
|
||||
``dict``. This feature can be used to implement custom decoders. If
|
||||
``object_hook`` is also defined, the ``object_pairs_hook`` takes
|
||||
priority.
|
||||
|
||||
``parse_float``, if specified, will be called with the string
|
||||
of every JSON float to be decoded. By default this is equivalent to
|
||||
|
|
@ -280,11 +285,12 @@ def load(
|
|||
``object_hook`` will be used instead of the ``dict``. This feature
|
||||
can be used to implement custom decoders (e.g. JSON-RPC class hinting).
|
||||
|
||||
``object_pairs_hook`` is an optional function that will be called with the
|
||||
result of any object literal decoded with an ordered list of pairs. The
|
||||
return value of ``object_pairs_hook`` will be used instead of the ``dict``.
|
||||
This feature can be used to implement custom decoders. If ``object_hook``
|
||||
is also defined, the ``object_pairs_hook`` takes priority.
|
||||
``object_pairs_hook`` is an optional function that will be called with
|
||||
the result of any object literal decoded with an ordered list of pairs.
|
||||
The return value of ``object_pairs_hook`` will be used instead of the
|
||||
``dict``. This feature can be used to implement custom decoders. If
|
||||
``object_hook`` is also defined, the ``object_pairs_hook`` takes
|
||||
priority.
|
||||
|
||||
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
|
||||
kwarg; otherwise ``JSONDecoder`` is used.
|
||||
|
|
|
|||
|
|
@ -74,10 +74,10 @@ class JSONDecoder:
|
|||
place of the given ``dict``. This can be used to provide custom
|
||||
deserializations (e.g. to support JSON-RPC class hinting).
|
||||
|
||||
``object_pairs_hook``, if specified will be called with the result of
|
||||
every JSON object decoded with an ordered list of pairs. The return
|
||||
value of ``object_pairs_hook`` will be used instead of the ``dict``.
|
||||
This feature can be used to implement custom decoders.
|
||||
``object_pairs_hook``, if specified will be called with the result
|
||||
of every JSON object decoded with an ordered list of pairs. The
|
||||
return value of ``object_pairs_hook`` will be used instead of the
|
||||
``dict``. This feature can be used to implement custom decoders.
|
||||
If ``object_hook`` is also defined, the ``object_pairs_hook`` takes
|
||||
priority.
|
||||
|
||||
|
|
|
|||
|
|
@ -85,9 +85,10 @@ class JSONEncoder:
|
|||
encoding of keys that are not str, int, float, bool or None.
|
||||
If skipkeys is True, such items are simply skipped.
|
||||
|
||||
If ensure_ascii is true, the output is guaranteed to be str
|
||||
objects with all incoming non-ASCII characters escaped. If
|
||||
ensure_ascii is false, the output can contain non-ASCII characters.
|
||||
If ensure_ascii is true, the output is guaranteed to be str objects
|
||||
with all incoming non-ASCII and non-printable characters escaped.
|
||||
If ensure_ascii is false, the output can contain non-ASCII and
|
||||
non-printable characters.
|
||||
|
||||
If check_circular is true, then lists, dicts, and custom encoded
|
||||
objects will be checked for circular references during encoding to
|
||||
|
|
@ -108,14 +109,15 @@ class JSONEncoder:
|
|||
indent level. An indent level of 0 will only insert newlines.
|
||||
None is the most compact representation.
|
||||
|
||||
If specified, separators should be an (item_separator, key_separator)
|
||||
tuple. The default is (', ', ': ') if *indent* is ``None`` and
|
||||
(',', ': ') otherwise. To get the most compact JSON representation,
|
||||
you should specify (',', ':') to eliminate whitespace.
|
||||
If specified, separators should be an (item_separator,
|
||||
key_separator) tuple. The default is (', ', ': ') if *indent* is
|
||||
``None`` and (',', ': ') otherwise. To get the most compact JSON
|
||||
representation, you should specify (',', ':') to eliminate
|
||||
whitespace.
|
||||
|
||||
If specified, default is a function that gets called for objects
|
||||
that can't otherwise be serialized. It should return a JSON encodable
|
||||
version of the object or raise a ``TypeError``.
|
||||
that can't otherwise be serialized. It should return a JSON
|
||||
encodable version of the object or raise a ``TypeError``.
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -901,9 +901,9 @@ class LoggerAdapter(Generic[_L]):
|
|||
if sys.version_info >= (3, 13):
|
||||
def __init__(self, logger: _L, extra: Mapping[str, object] | None = None, merge_extra: bool = False) -> None:
|
||||
"""
|
||||
Initialize the adapter with a logger and a dict-like object which
|
||||
provides contextual information. This constructor signature allows
|
||||
easy stacking of LoggerAdapters, if so desired.
|
||||
Initialize the adapter with a logger and an optional dict-like object
|
||||
which provides contextual information. This constructor signature
|
||||
allows easy stacking of LoggerAdapters, if so desired.
|
||||
|
||||
You can effectively pass keyword arguments as shown in the
|
||||
following example:
|
||||
|
|
|
|||
|
|
@ -77,29 +77,29 @@ class mmap:
|
|||
) -> Self: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
def flush(self, offset: int = 0, size: int = ...) -> None: ...
|
||||
def move(self, dest: int, src: int, count: int) -> None: ...
|
||||
def flush(self, offset: int = 0, size: int = ..., /) -> None: ...
|
||||
def move(self, dest: int, src: int, count: int, /) -> None: ...
|
||||
def read_byte(self) -> int: ...
|
||||
def readline(self) -> bytes: ...
|
||||
def resize(self, newsize: int) -> None: ...
|
||||
def resize(self, newsize: int, /) -> None: ...
|
||||
if sys.platform != "win32":
|
||||
def seek(self, pos: int, whence: Literal[0, 1, 2, 3, 4] = os.SEEK_SET) -> None: ...
|
||||
def seek(self, pos: int, whence: Literal[0, 1, 2, 3, 4] = os.SEEK_SET, /) -> None: ...
|
||||
else:
|
||||
def seek(self, pos: int, whence: Literal[0, 1, 2] = os.SEEK_SET) -> None: ...
|
||||
def seek(self, pos: int, whence: Literal[0, 1, 2] = os.SEEK_SET, /) -> None: ...
|
||||
|
||||
def size(self) -> int: ...
|
||||
def tell(self) -> int: ...
|
||||
def write_byte(self, byte: int) -> None: ...
|
||||
def write_byte(self, byte: int, /) -> None: ...
|
||||
def __len__(self) -> int:
|
||||
"""Return len(self)."""
|
||||
closed: bool
|
||||
if sys.platform != "win32":
|
||||
def madvise(self, option: int, start: int = 0, length: int = ...) -> None: ...
|
||||
def madvise(self, option: int, start: int = 0, length: int = ..., /) -> None: ...
|
||||
|
||||
def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
|
||||
def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
|
||||
def read(self, n: int | None = None) -> bytes: ...
|
||||
def write(self, bytes: ReadableBuffer) -> int: ...
|
||||
def find(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ...
|
||||
def rfind(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ...
|
||||
def read(self, n: int | None = None, /) -> bytes: ...
|
||||
def write(self, bytes: ReadableBuffer, /) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, key: int, /) -> int:
|
||||
"""Return self[key]."""
|
||||
|
|
@ -122,7 +122,7 @@ class mmap:
|
|||
# so we claim that there is also an __iter__ to help type checkers.
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, *args: Unused) -> None: ...
|
||||
def __exit__(self, exc_type: Unused, exc_value: Unused, traceback: Unused, /) -> None: ...
|
||||
def __buffer__(self, flags: int, /) -> memoryview:
|
||||
"""Return a buffer object that exposes the underlying memory of the object."""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import array
|
||||
import sys
|
||||
import threading
|
||||
import weakref
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
|
|
@ -44,14 +45,25 @@ class DummyProcess(threading.Thread):
|
|||
_start_called: int
|
||||
@property
|
||||
def exitcode(self) -> Literal[0] | None: ...
|
||||
def __init__(
|
||||
self,
|
||||
group: Any = None,
|
||||
target: Callable[..., object] | None = None,
|
||||
name: str | None = None,
|
||||
args: Iterable[Any] = (),
|
||||
kwargs: Mapping[str, Any] = {},
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
# Default changed in Python 3.14.1
|
||||
def __init__(
|
||||
self,
|
||||
group: Any = None,
|
||||
target: Callable[..., object] | None = None,
|
||||
name: str | None = None,
|
||||
args: Iterable[Any] = (),
|
||||
kwargs: Mapping[str, Any] | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
group: Any = None,
|
||||
target: Callable[..., object] | None = None,
|
||||
name: str | None = None,
|
||||
args: Iterable[Any] = (),
|
||||
kwargs: Mapping[str, Any] | None = {},
|
||||
) -> None: ...
|
||||
|
||||
Process = DummyProcess
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,12 @@ class RLock(SemLock):
|
|||
|
||||
class Semaphore(SemLock):
|
||||
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...
|
||||
def get_value(self) -> int: ...
|
||||
def get_value(self) -> int:
|
||||
"""Returns current value of Semaphore.
|
||||
|
||||
Raises NotImplementedError on Mac OSX
|
||||
because of broken sem_getvalue().
|
||||
"""
|
||||
|
||||
class BoundedSemaphore(Semaphore):
|
||||
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...
|
||||
|
|
|
|||
|
|
@ -291,7 +291,11 @@ class Real(Complex, _RealLike):
|
|||
# See comment at the top of the file
|
||||
# for why some of these return types are purposefully vague
|
||||
class Rational(Real):
|
||||
""".numerator and .denominator should be in lowest terms."""
|
||||
"""To Real, Rational adds numerator and denominator properties.
|
||||
|
||||
The numerator and denominator values should be in lowest terms,
|
||||
with a positive denominator.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -197,7 +197,8 @@ __all__ = [
|
|||
"write",
|
||||
]
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ += ["readinto"]
|
||||
# reload_environ was added to __all__ in Python 3.14.1
|
||||
__all__ += ["readinto", "reload_environ"]
|
||||
if sys.platform == "darwin" and sys.version_info >= (3, 12):
|
||||
__all__ += ["PRIO_DARWIN_BG", "PRIO_DARWIN_NONUI", "PRIO_DARWIN_PROCESS", "PRIO_DARWIN_THREAD"]
|
||||
if sys.platform == "darwin" and sys.version_info >= (3, 10):
|
||||
|
|
@ -2745,82 +2746,158 @@ else:
|
|||
|
||||
def WTERMSIG(status: int) -> int:
|
||||
"""Return the signal that terminated the process that provided the status value."""
|
||||
if sys.version_info >= (3, 13):
|
||||
def posix_spawn(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv | None, # None allowed starting in 3.13
|
||||
/,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
resetids: bool = ...,
|
||||
setsid: bool = ...,
|
||||
setsigmask: Iterable[int] = ...,
|
||||
setsigdef: Iterable[int] = ...,
|
||||
scheduler: tuple[Any, sched_param] | None = ...,
|
||||
) -> int:
|
||||
"""Execute the program specified by path in a new process.
|
||||
|
||||
def posix_spawn(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv,
|
||||
/,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
resetids: bool = ...,
|
||||
setsid: bool = ...,
|
||||
setsigmask: Iterable[int] = ...,
|
||||
setsigdef: Iterable[int] = ...,
|
||||
scheduler: tuple[Any, sched_param] | None = ...,
|
||||
) -> int:
|
||||
"""Execute the program specified by path in a new process.
|
||||
path
|
||||
Path of executable file.
|
||||
argv
|
||||
Tuple or list of strings.
|
||||
env
|
||||
Dictionary of strings mapping to strings.
|
||||
file_actions
|
||||
A sequence of file action tuples.
|
||||
setpgroup
|
||||
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
||||
resetids
|
||||
If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
|
||||
setsid
|
||||
If the value is `true` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
||||
setsigmask
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
||||
setsigdef
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
||||
scheduler
|
||||
A tuple with the scheduler policy (optional) and parameters.
|
||||
"""
|
||||
|
||||
path
|
||||
Path of executable file.
|
||||
argv
|
||||
Tuple or list of strings.
|
||||
env
|
||||
Dictionary of strings mapping to strings.
|
||||
file_actions
|
||||
A sequence of file action tuples.
|
||||
setpgroup
|
||||
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
||||
resetids
|
||||
If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
|
||||
setsid
|
||||
If the value is `true` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
||||
setsigmask
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
||||
setsigdef
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
||||
scheduler
|
||||
A tuple with the scheduler policy (optional) and parameters.
|
||||
"""
|
||||
def posix_spawnp(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv | None, # None allowed starting in 3.13
|
||||
/,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
resetids: bool = ...,
|
||||
setsid: bool = ...,
|
||||
setsigmask: Iterable[int] = ...,
|
||||
setsigdef: Iterable[int] = ...,
|
||||
scheduler: tuple[Any, sched_param] | None = ...,
|
||||
) -> int:
|
||||
"""Execute the program specified by path in a new process.
|
||||
|
||||
def posix_spawnp(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv,
|
||||
/,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
resetids: bool = ...,
|
||||
setsid: bool = ...,
|
||||
setsigmask: Iterable[int] = ...,
|
||||
setsigdef: Iterable[int] = ...,
|
||||
scheduler: tuple[Any, sched_param] | None = ...,
|
||||
) -> int:
|
||||
"""Execute the program specified by path in a new process.
|
||||
path
|
||||
Path of executable file.
|
||||
argv
|
||||
Tuple or list of strings.
|
||||
env
|
||||
Dictionary of strings mapping to strings.
|
||||
file_actions
|
||||
A sequence of file action tuples.
|
||||
setpgroup
|
||||
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
||||
resetids
|
||||
If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
|
||||
setsid
|
||||
If the value is `True` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
||||
setsigmask
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
||||
setsigdef
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
||||
scheduler
|
||||
A tuple with the scheduler policy (optional) and parameters.
|
||||
"""
|
||||
else:
|
||||
def posix_spawn(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv,
|
||||
/,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
resetids: bool = ...,
|
||||
setsid: bool = ...,
|
||||
setsigmask: Iterable[int] = ...,
|
||||
setsigdef: Iterable[int] = ...,
|
||||
scheduler: tuple[Any, sched_param] | None = ...,
|
||||
) -> int:
|
||||
"""Execute the program specified by path in a new process.
|
||||
|
||||
path
|
||||
Path of executable file.
|
||||
argv
|
||||
Tuple or list of strings.
|
||||
env
|
||||
Dictionary of strings mapping to strings.
|
||||
file_actions
|
||||
A sequence of file action tuples.
|
||||
setpgroup
|
||||
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
||||
resetids
|
||||
If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
|
||||
setsid
|
||||
If the value is `True` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
||||
setsigmask
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
||||
setsigdef
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
||||
scheduler
|
||||
A tuple with the scheduler policy (optional) and parameters.
|
||||
"""
|
||||
path
|
||||
Path of executable file.
|
||||
argv
|
||||
Tuple or list of strings.
|
||||
env
|
||||
Dictionary of strings mapping to strings.
|
||||
file_actions
|
||||
A sequence of file action tuples.
|
||||
setpgroup
|
||||
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
||||
resetids
|
||||
If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
|
||||
setsid
|
||||
If the value is `true` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
||||
setsigmask
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
||||
setsigdef
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
||||
scheduler
|
||||
A tuple with the scheduler policy (optional) and parameters.
|
||||
"""
|
||||
|
||||
def posix_spawnp(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv,
|
||||
/,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
resetids: bool = ...,
|
||||
setsid: bool = ...,
|
||||
setsigmask: Iterable[int] = ...,
|
||||
setsigdef: Iterable[int] = ...,
|
||||
scheduler: tuple[Any, sched_param] | None = ...,
|
||||
) -> int:
|
||||
"""Execute the program specified by path in a new process.
|
||||
|
||||
path
|
||||
Path of executable file.
|
||||
argv
|
||||
Tuple or list of strings.
|
||||
env
|
||||
Dictionary of strings mapping to strings.
|
||||
file_actions
|
||||
A sequence of file action tuples.
|
||||
setpgroup
|
||||
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
||||
resetids
|
||||
If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
|
||||
setsid
|
||||
If the value is `True` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
||||
setsigmask
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
||||
setsigdef
|
||||
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
||||
scheduler
|
||||
A tuple with the scheduler policy (optional) and parameters.
|
||||
"""
|
||||
POSIX_SPAWN_OPEN: Final = 0
|
||||
POSIX_SPAWN_CLOSE: Final = 1
|
||||
POSIX_SPAWN_DUP2: Final = 2
|
||||
|
|
|
|||
|
|
@ -944,8 +944,8 @@ class Pdb(Bdb, Cmd):
|
|||
def completenames(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... # type: ignore[override]
|
||||
if sys.version_info >= (3, 12):
|
||||
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.
|
||||
if sys.version_info >= (3, 13):
|
||||
# Added in 3.13.8 and 3.14.1
|
||||
@property
|
||||
def rlcompleter(self) -> type[Completer]:
|
||||
"""Return the `Completer` class from `rlcompleter`, while avoiding the
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
"""Python wrapper for Expat parser."""
|
||||
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, SupportsRead
|
||||
from collections.abc import Callable
|
||||
from pyexpat import errors as errors, model as model
|
||||
|
|
@ -70,6 +71,29 @@ class XMLParserType:
|
|||
|
||||
def SetReparseDeferralEnabled(self, enabled: bool, /) -> None:
|
||||
"""Enable/Disable reparse deferral; enabled by default with Expat >=2.6.0."""
|
||||
if sys.version_info >= (3, 10):
|
||||
# Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1
|
||||
def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None:
|
||||
"""Sets the number of allocated bytes of dynamic memory needed to activate protection against disproportionate use of RAM.
|
||||
|
||||
By default, parser objects have an allocation activation threshold of 64 MiB.
|
||||
"""
|
||||
|
||||
def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None:
|
||||
"""Sets the maximum amplification factor between direct input and bytes of dynamic memory allocated.
|
||||
|
||||
The amplification factor is calculated as "allocated / direct" while parsing,
|
||||
where "direct" is the number of bytes read from the primary document in parsing
|
||||
and "allocated" is the number of bytes of dynamic memory allocated in the parser
|
||||
hierarchy.
|
||||
|
||||
The 'max_factor' value must be a non-NaN floating point value greater than
|
||||
or equal to 1.0. Amplification factors greater than 100.0 can be observed
|
||||
near the start of parsing even with benign files in practice. In particular,
|
||||
the activation threshold should be carefully chosen to avoid false positives.
|
||||
|
||||
By default, parser objects have a maximum amplification factor of 100.0.
|
||||
"""
|
||||
|
||||
@property
|
||||
def intern(self) -> dict[str, str]: ...
|
||||
|
|
|
|||
|
|
@ -89,9 +89,11 @@ class Queue(Generic[_T]):
|
|||
By default, gets will only raise once the queue is empty. Set
|
||||
'immediate' to True to make gets raise immediately instead.
|
||||
|
||||
All blocked callers of put() and get() will be unblocked. If
|
||||
'immediate', a task is marked as done for each item remaining in
|
||||
the queue, which may unblock callers of join().
|
||||
All blocked callers of put() and get() will be unblocked.
|
||||
|
||||
If 'immediate', the queue is drained and unfinished tasks
|
||||
is reduced by the number of drained tasks. If unfinished tasks
|
||||
is reduced to zero, callers of Queue.join are unblocked.
|
||||
"""
|
||||
|
||||
def _get(self) -> _T: ...
|
||||
|
|
@ -142,9 +144,6 @@ class Queue(Generic[_T]):
|
|||
have been processed (meaning that a task_done() call was received
|
||||
for every item that had been put() into the queue).
|
||||
|
||||
shutdown(immediate=True) calls task_done() for each remaining item in
|
||||
the queue.
|
||||
|
||||
Raises a ValueError if called more times than there were items
|
||||
placed in the queue.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ empty dictionary.
|
|||
The arguments are as for sendmail, except that msg is an
|
||||
email.message.Message object. If from_addr is None or to_addrs is
|
||||
None, these arguments are taken from the headers of the Message as
|
||||
described in RFC 2822 (a ValueError is raised if there is more than
|
||||
described in RFC 5322 (a ValueError is raised if there is more than
|
||||
one set of 'Resent-' headers). Regardless of the values of from_addr and
|
||||
to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
|
||||
resent) of the Message object won't be transmitted. The Message
|
||||
|
|
|
|||
|
|
@ -1016,6 +1016,21 @@ if sys.platform != "linux":
|
|||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
__all__ += ["AF_BLUETOOTH"]
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
|
||||
from _socket import BTPROTO_HCI as BTPROTO_HCI, BTPROTO_L2CAP as BTPROTO_L2CAP, BTPROTO_SCO as BTPROTO_SCO
|
||||
|
||||
__all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"]
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
|
||||
from _socket import HCI_DATA_DIR as HCI_DATA_DIR, HCI_FILTER as HCI_FILTER, HCI_TIME_STAMP as HCI_TIME_STAMP
|
||||
|
||||
__all__ += ["HCI_FILTER", "HCI_TIME_STAMP", "HCI_DATA_DIR"]
|
||||
|
||||
if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
|
||||
from _socket import LOCAL_CREDS as LOCAL_CREDS, LOCAL_CREDS_PERSISTENT as LOCAL_CREDS_PERSISTENT, SCM_CREDS2 as SCM_CREDS2
|
||||
|
||||
__all__ += ["SCM_CREDS2", "LOCAL_CREDS", "LOCAL_CREDS_PERSISTENT"]
|
||||
|
||||
if sys.platform == "win32" and sys.version_info >= (3, 12):
|
||||
__all__ += ["AF_HYPERV"]
|
||||
|
||||
|
|
|
|||
|
|
@ -378,8 +378,8 @@ class Connection:
|
|||
Table name.
|
||||
column
|
||||
Column name.
|
||||
row
|
||||
Row index.
|
||||
rowid
|
||||
Row id.
|
||||
readonly
|
||||
Open the BLOB without write permissions.
|
||||
name
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ class TarFile:
|
|||
errorlevel: int | None = ...,
|
||||
level: None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> Self:
|
||||
"""Open a tar archive for reading, writing or appending. Return
|
||||
an appropriate TarFile class.
|
||||
|
|
@ -457,7 +457,7 @@ class TarFile:
|
|||
debug: int | None = ...,
|
||||
errorlevel: int | None = ...,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> Self:
|
||||
"""Open a tar archive for reading, writing or appending. Return
|
||||
an appropriate TarFile class.
|
||||
|
|
@ -519,7 +519,7 @@ class TarFile:
|
|||
debug: int | None = ...,
|
||||
errorlevel: int | None = ...,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
@overload
|
||||
|
|
@ -767,7 +767,7 @@ class TarFile:
|
|||
fileobj: IO[bytes] | None = None,
|
||||
level: None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
|
|
@ -791,7 +791,7 @@ class TarFile:
|
|||
fileobj: IO[bytes] | None = None,
|
||||
level: int | None = None,
|
||||
options: Mapping[int, int] | None = None,
|
||||
zstd_dict: ZstdDict | None = None,
|
||||
zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
|
|
|
|||
|
|
@ -646,7 +646,8 @@ class Event:
|
|||
(or fractions thereof).
|
||||
|
||||
This method returns the internal flag on exit, so it will always return
|
||||
True except if a timeout is given and the operation times out.
|
||||
``True`` except if a timeout is given and the operation times out, when
|
||||
it will return ``False``.
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -7,25 +7,25 @@ Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
|
|||
LabelFrame and PanedWindow.
|
||||
|
||||
Properties of the widgets are specified with keyword arguments.
|
||||
Keyword arguments have the same name as the corresponding resource
|
||||
Keyword arguments have the same name as the corresponding options
|
||||
under Tk.
|
||||
|
||||
Widgets are positioned with one of the geometry managers Place, Pack
|
||||
or Grid. These managers can be called with methods place, pack, grid
|
||||
available in every Widget.
|
||||
|
||||
Actions are bound to events by resources (e.g. keyword argument
|
||||
command) or with the method bind.
|
||||
Actions are bound to events by options (e.g. the command
|
||||
keyword argument) or with the bind() method.
|
||||
|
||||
Example (Hello, World):
|
||||
import tkinter
|
||||
from tkinter.constants import *
|
||||
tk = tkinter.Tk()
|
||||
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
|
||||
frame.pack(fill=BOTH,expand=1)
|
||||
frame.pack(fill=BOTH, expand=1)
|
||||
label = tkinter.Label(frame, text="Hello, World")
|
||||
label.pack(fill=X, expand=1)
|
||||
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
|
||||
button = tkinter.Button(frame, text="Exit", command=tk.destroy)
|
||||
button.pack(side=BOTTOM)
|
||||
tk.mainloop()
|
||||
"""
|
||||
|
|
@ -759,7 +759,7 @@ class Misc:
|
|||
The focus order first goes to the next child, then to
|
||||
the children of the child recursively and then to the
|
||||
next sibling which is higher in the stacking order. A
|
||||
widget is omitted if it has the takefocus resource set
|
||||
widget is omitted if it has the takefocus option set
|
||||
to 0.
|
||||
"""
|
||||
|
||||
|
|
@ -1361,7 +1361,7 @@ class Misc:
|
|||
"""
|
||||
|
||||
def keys(self) -> list[str]:
|
||||
"""Return a list of all resource names of this widget."""
|
||||
"""Return a list of all option names of this widget."""
|
||||
|
||||
@overload
|
||||
def pack_propagate(self, flag: bool) -> bool | None:
|
||||
|
|
@ -1415,7 +1415,7 @@ class Misc:
|
|||
) -> _GridIndexInfo | MaybeNone: # can be None but annoying to check
|
||||
"""Configure column INDEX of a grid.
|
||||
|
||||
Valid resources are minsize (minimum size of the column),
|
||||
Valid options are minsize (minimum size of the column),
|
||||
weight (how much does additional space propagate to this column)
|
||||
and pad (how much space to let additionally).
|
||||
"""
|
||||
|
|
@ -1432,7 +1432,7 @@ class Misc:
|
|||
) -> _GridIndexInfo | MaybeNone: # can be None but annoying to check
|
||||
"""Configure row INDEX of a grid.
|
||||
|
||||
Valid resources are minsize (minimum size of the row),
|
||||
Valid options are minsize (minimum size of the row),
|
||||
weight (how much does additional space propagate to this row)
|
||||
and pad (how much space to let additionally).
|
||||
"""
|
||||
|
|
@ -1533,17 +1533,23 @@ class Misc:
|
|||
# See #4363 and #4891
|
||||
def __setitem__(self, key: str, value: Any) -> None: ...
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
"""Return the resource value for a KEY given as string."""
|
||||
"""Return the current value of the configuration option."""
|
||||
|
||||
def cget(self, key: str) -> Any:
|
||||
"""Return the resource value for a KEY given as string."""
|
||||
"""Return the current value of the configuration option."""
|
||||
|
||||
def configure(self, cnf: Any = None) -> Any:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
# TODO: config is an alias of configure, but adding that here creates
|
||||
# conflict with the type of config in the subclasses. See #13149
|
||||
|
|
@ -2261,11 +2267,17 @@ class Tk(Misc, Wm):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -2632,7 +2644,7 @@ class Toplevel(BaseWidget, Wm):
|
|||
) -> None:
|
||||
"""Construct a toplevel widget with the parent MASTER.
|
||||
|
||||
Valid resource names: background, bd, bg, borderwidth, class,
|
||||
Valid option names: background, bd, bg, borderwidth, class,
|
||||
colormap, container, cursor, height, highlightbackground,
|
||||
highlightcolor, highlightthickness, menu, relief, screen, takefocus,
|
||||
use, visual, width.
|
||||
|
|
@ -2660,11 +2672,17 @@ class Toplevel(BaseWidget, Wm):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -2783,11 +2801,17 @@ class Button(Widget):
|
|||
width: float | str = ...,
|
||||
wraplength: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -2858,7 +2882,7 @@ class Canvas(Widget, XView, YView):
|
|||
) -> None:
|
||||
"""Construct a canvas widget with the parent MASTER.
|
||||
|
||||
Valid resource names: background, bd, bg, borderwidth, closeenough,
|
||||
Valid option names: background, bd, bg, borderwidth, closeenough,
|
||||
confine, cursor, height, highlightbackground, highlightcolor,
|
||||
highlightthickness, insertbackground, insertborderwidth,
|
||||
insertofftime, insertontime, insertwidth, offset, relief,
|
||||
|
|
@ -2903,11 +2927,17 @@ class Canvas(Widget, XView, YView):
|
|||
yscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
yscrollincrement: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -3572,16 +3602,14 @@ class Canvas(Widget, XView, YView):
|
|||
"""
|
||||
|
||||
def itemcget(self, tagOrId, option):
|
||||
"""Return the resource value for an OPTION for item TAGORID."""
|
||||
"""Return the value of OPTION for item TAGORID."""
|
||||
# itemconfigure kwargs depend on item type, which is not known when type checking
|
||||
def itemconfigure(
|
||||
self, tagOrId: str | int, cnf: dict[str, Any] | None = None, **kw: Any
|
||||
) -> dict[str, tuple[str, str, str, str, str]] | None:
|
||||
"""Configure resources of an item TAGORID.
|
||||
"""Query or modify the configuration options of an item TAGORID.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method without arguments.
|
||||
Similar to configure() except that it applies to the specified item.
|
||||
"""
|
||||
itemconfig = itemconfigure
|
||||
def move(self, *args) -> None:
|
||||
|
|
@ -3726,7 +3754,7 @@ class Checkbutton(Widget):
|
|||
) -> None:
|
||||
"""Construct a checkbutton widget with the parent MASTER.
|
||||
|
||||
Valid resource names: activebackground, activeforeground, anchor,
|
||||
Valid option names: activebackground, activeforeground, anchor,
|
||||
background, bd, bg, bitmap, borderwidth, command, cursor,
|
||||
disabledforeground, fg, font, foreground, height,
|
||||
highlightbackground, highlightcolor, highlightthickness, image,
|
||||
|
|
@ -3783,11 +3811,17 @@ class Checkbutton(Widget):
|
|||
width: float | str = ...,
|
||||
wraplength: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -3800,7 +3834,7 @@ class Checkbutton(Widget):
|
|||
"""Flash the button."""
|
||||
|
||||
def invoke(self) -> Any:
|
||||
"""Toggle the button and invoke a command if given as resource."""
|
||||
"""Toggle the button and invoke a command if given as option."""
|
||||
|
||||
def select(self) -> None:
|
||||
"""Put the button in on-state."""
|
||||
|
|
@ -3857,7 +3891,7 @@ class Entry(Widget, XView):
|
|||
) -> None:
|
||||
"""Construct an entry widget with the parent MASTER.
|
||||
|
||||
Valid resource names: background, bd, bg, borderwidth, cursor,
|
||||
Valid option names: background, bd, bg, borderwidth, cursor,
|
||||
exportselection, fg, font, foreground, highlightbackground,
|
||||
highlightcolor, highlightthickness, insertbackground,
|
||||
insertborderwidth, insertofftime, insertontime, insertwidth,
|
||||
|
|
@ -3910,11 +3944,17 @@ class Entry(Widget, XView):
|
|||
width: int = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4001,7 +4041,7 @@ class Frame(Widget):
|
|||
) -> None:
|
||||
"""Construct a frame widget with the parent MASTER.
|
||||
|
||||
Valid resource names: background, bd, bg, borderwidth, class,
|
||||
Valid option names: background, bd, bg, borderwidth, class,
|
||||
colormap, container, cursor, height, highlightbackground,
|
||||
highlightcolor, highlightthickness, relief, takefocus, visual, width.
|
||||
"""
|
||||
|
|
@ -4027,11 +4067,17 @@ class Frame(Widget):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4134,11 +4180,17 @@ class Label(Widget):
|
|||
width: float | str = ...,
|
||||
wraplength: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4201,7 +4253,7 @@ class Listbox(Widget, XView, YView):
|
|||
) -> None:
|
||||
"""Construct a listbox widget with the parent MASTER.
|
||||
|
||||
Valid resource names: background, bd, bg, borderwidth, cursor,
|
||||
Valid option names: background, bd, bg, borderwidth, cursor,
|
||||
exportselection, fg, font, foreground, height, highlightbackground,
|
||||
highlightcolor, highlightthickness, relief, selectbackground,
|
||||
selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
|
||||
|
|
@ -4243,11 +4295,17 @@ class Listbox(Widget, XView, YView):
|
|||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
yscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4309,16 +4367,12 @@ class Listbox(Widget, XView, YView):
|
|||
"""Return the number of elements in the listbox."""
|
||||
|
||||
def itemcget(self, index: str | int, option):
|
||||
"""Return the resource value for an ITEM and an OPTION."""
|
||||
"""Return the value of OPTION for item at INDEX."""
|
||||
|
||||
def itemconfigure(self, index: str | int, cnf=None, **kw):
|
||||
"""Configure resources of an ITEM.
|
||||
"""Query or modify the configuration options of an item at INDEX.
|
||||
|
||||
The values for resources are specified as keyword arguments.
|
||||
To get an overview about the allowed keyword arguments
|
||||
call the method without arguments.
|
||||
Valid resource names: background, bg, foreground, fg,
|
||||
selectbackground, selectforeground.
|
||||
Similar to configure() except that it applies to the specified item.
|
||||
"""
|
||||
itemconfig = itemconfigure
|
||||
|
||||
|
|
@ -4358,7 +4412,7 @@ class Menu(Widget):
|
|||
) -> None:
|
||||
"""Construct menu widget with the parent MASTER.
|
||||
|
||||
Valid resource names: activebackground, activeborderwidth,
|
||||
Valid option names: activebackground, activeborderwidth,
|
||||
activeforeground, background, bd, bg, borderwidth, cursor,
|
||||
disabledforeground, fg, font, foreground, postcommand, relief,
|
||||
selectcolor, takefocus, tearoff, tearoffcommand, title, type.
|
||||
|
|
@ -4391,11 +4445,17 @@ class Menu(Widget):
|
|||
title: str = ...,
|
||||
type: Literal["menubar", "tearoff", "normal"] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4627,12 +4687,16 @@ class Menu(Widget):
|
|||
"""Delete menu items between INDEX1 and INDEX2 (included)."""
|
||||
|
||||
def entrycget(self, index: str | int, option: str) -> Any:
|
||||
"""Return the resource value of a menu item for OPTION at INDEX."""
|
||||
"""Return the value of OPTION for a menu item at INDEX."""
|
||||
|
||||
def entryconfigure(
|
||||
self, index: str | int, cnf: dict[str, Any] | None = None, **kw: Any
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure a menu item at INDEX."""
|
||||
"""Query or modify the configuration options of a menu item at INDEX.
|
||||
|
||||
Similar to configure() except that it applies to the specified
|
||||
menu item.
|
||||
"""
|
||||
entryconfig = entryconfigure
|
||||
def index(self, index: str | int) -> int | None:
|
||||
"""Return the index of a menu item identified by INDEX."""
|
||||
|
|
@ -4743,11 +4807,17 @@ class Menubutton(Widget):
|
|||
width: float | str = ...,
|
||||
wraplength: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4815,11 +4885,17 @@ class Message(Widget):
|
|||
textvariable: Variable = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4879,7 +4955,7 @@ class Radiobutton(Widget):
|
|||
) -> None:
|
||||
"""Construct a radiobutton widget with the parent MASTER.
|
||||
|
||||
Valid resource names: activebackground, activeforeground, anchor,
|
||||
Valid option names: activebackground, activeforeground, anchor,
|
||||
background, bd, bg, bitmap, borderwidth, command, cursor,
|
||||
disabledforeground, fg, font, foreground, height,
|
||||
highlightbackground, highlightcolor, highlightthickness, image,
|
||||
|
|
@ -4935,11 +5011,17 @@ class Radiobutton(Widget):
|
|||
width: float | str = ...,
|
||||
wraplength: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -4952,7 +5034,7 @@ class Radiobutton(Widget):
|
|||
"""Flash the button."""
|
||||
|
||||
def invoke(self) -> Any:
|
||||
"""Toggle the button and invoke a command if given as resource."""
|
||||
"""Toggle the button and invoke a command if given as option."""
|
||||
|
||||
def select(self) -> None:
|
||||
"""Put the button in on-state."""
|
||||
|
|
@ -5004,7 +5086,7 @@ class Scale(Widget):
|
|||
) -> None:
|
||||
"""Construct a scale widget with the parent MASTER.
|
||||
|
||||
Valid resource names: activebackground, background, bigincrement, bd,
|
||||
Valid option names: activebackground, background, bigincrement, bd,
|
||||
bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
|
||||
highlightbackground, highlightcolor, highlightthickness, label,
|
||||
length, orient, relief, repeatdelay, repeatinterval, resolution,
|
||||
|
|
@ -5052,11 +5134,17 @@ class Scale(Widget):
|
|||
variable: IntVar | DoubleVar = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -5116,7 +5204,7 @@ class Scrollbar(Widget):
|
|||
) -> None:
|
||||
"""Construct a scrollbar widget with the parent MASTER.
|
||||
|
||||
Valid resource names: activebackground, activerelief,
|
||||
Valid option names: activebackground, activerelief,
|
||||
background, bd, bg, borderwidth, command, cursor,
|
||||
elementborderwidth, highlightbackground,
|
||||
highlightcolor, highlightthickness, jump, orient,
|
||||
|
|
@ -5151,11 +5239,17 @@ class Scrollbar(Widget):
|
|||
troughcolor: str = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -5332,11 +5426,17 @@ class Text(Widget, XView, YView):
|
|||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
yscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -5713,7 +5813,11 @@ class Text(Widget, XView, YView):
|
|||
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ...
|
||||
@overload
|
||||
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."""
|
||||
"""Query or modify the configuration options of an embedded image at INDEX.
|
||||
|
||||
Similar to configure() except that it applies to the specified
|
||||
embedded image.
|
||||
"""
|
||||
|
||||
@overload
|
||||
def image_configure(
|
||||
|
|
@ -5899,7 +6003,10 @@ class Text(Widget, XView, YView):
|
|||
underlinefg: str = ...,
|
||||
wrap: Literal["none", "char", "word"] = ..., # be careful with "none" vs None
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure a tag TAGNAME."""
|
||||
"""Query or modify the configuration options of a tag TAGNAME.
|
||||
|
||||
Similar to configure() except that it applies to the specified tag.
|
||||
"""
|
||||
|
||||
@overload
|
||||
def tag_configure(self, tagName: str, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
|
|
@ -5971,7 +6078,11 @@ class Text(Widget, XView, YView):
|
|||
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ...
|
||||
@overload
|
||||
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."""
|
||||
"""Query or modify the configuration options of an embedded window at INDEX.
|
||||
|
||||
Similar to configure() except that it applies to the specified
|
||||
embedded window.
|
||||
"""
|
||||
|
||||
@overload
|
||||
def window_configure(
|
||||
|
|
@ -6029,7 +6140,7 @@ class OptionMenu(Menubutton):
|
|||
command: Callable[[StringVar], object] | None = ...,
|
||||
) -> None:
|
||||
"""Construct an optionmenu widget with the parent MASTER, with
|
||||
the resource textvariable set to VARIABLE, the initially selected
|
||||
the option textvariable set to VARIABLE, the initially selected
|
||||
value VALUE, the other menu values VALUES and an additional
|
||||
keyword argument command.
|
||||
"""
|
||||
|
|
@ -6085,7 +6196,7 @@ class PhotoImage(Image, _PhotoImageLike):
|
|||
) -> None:
|
||||
"""Create an image with NAME.
|
||||
|
||||
Valid resource names: data, format, file, gamma, height, palette,
|
||||
Valid option names: data, format, file, gamma, height, palette,
|
||||
width.
|
||||
"""
|
||||
|
||||
|
|
@ -6375,7 +6486,7 @@ class BitmapImage(Image, _BitmapImageLike):
|
|||
) -> None:
|
||||
"""Create a bitmap with NAME.
|
||||
|
||||
Valid resource names: background, data, file, foreground, maskdata, maskfile.
|
||||
Valid option names: background, data, file, foreground, maskdata, maskfile.
|
||||
"""
|
||||
|
||||
def image_names() -> tuple[str, ...]: ...
|
||||
|
|
@ -6525,11 +6636,17 @@ class Spinbox(Widget, XView):
|
|||
wrap: bool = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -6735,11 +6852,17 @@ class LabelFrame(Widget):
|
|||
text: float | str = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -6818,11 +6941,17 @@ class PanedWindow(Widget):
|
|||
showhandle: bool = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -6892,24 +7021,15 @@ class PanedWindow(Widget):
|
|||
"""Place the sash given by index at the given coordinates"""
|
||||
|
||||
def panecget(self, child, option):
|
||||
"""Query a management option for window.
|
||||
|
||||
Option may be any value allowed by the paneconfigure subcommand
|
||||
"""
|
||||
"""Return the value of option for a child window."""
|
||||
|
||||
def paneconfigure(self, tagOrId, cnf=None, **kw):
|
||||
"""Query or modify the management options for window.
|
||||
"""Query or modify the configuration options for a child window.
|
||||
|
||||
If no option is specified, returns a list describing all
|
||||
of the available options for pathName. If option is
|
||||
specified with no value, then the command returns a list
|
||||
describing the one named option (this list will be identical
|
||||
to the corresponding sublist of the value returned if no
|
||||
option is specified). If one or more option-value pairs are
|
||||
specified, then the command modifies the given widget
|
||||
option(s) to have the given value(s); in this case the
|
||||
command returns an empty string. The following options
|
||||
are supported:
|
||||
Similar to configure() except that it applies to the specified
|
||||
window.
|
||||
|
||||
The following options are supported:
|
||||
|
||||
after window
|
||||
Insert the window after the window specified. window
|
||||
|
|
|
|||
|
|
@ -420,11 +420,17 @@ class Button(Widget):
|
|||
underline: int = ...,
|
||||
width: int | Literal[""] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -494,11 +500,17 @@ class Checkbutton(Widget):
|
|||
variable: tkinter.Variable = ...,
|
||||
width: int | Literal[""] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -581,11 +593,17 @@ class Entry(Widget, tkinter.Entry):
|
|||
width: int = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -613,11 +631,17 @@ class Entry(Widget, tkinter.Entry):
|
|||
width: int = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -706,11 +730,17 @@ class Combobox(Entry):
|
|||
width: int = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -741,11 +771,17 @@ class Combobox(Entry):
|
|||
width: int = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -809,11 +845,17 @@ class Frame(Widget):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -889,11 +931,17 @@ class Label(Widget):
|
|||
width: int | Literal[""] = ...,
|
||||
wraplength: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -956,11 +1004,17 @@ class Labelframe(Widget):
|
|||
underline: int = ...,
|
||||
width: float | str = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1025,11 +1079,17 @@ class Menubutton(Widget):
|
|||
underline: int = ...,
|
||||
width: int | Literal[""] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1096,11 +1156,17 @@ class Notebook(Widget):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: int = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1253,11 +1319,17 @@ class Panedwindow(Widget, tkinter.PanedWindow):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: int = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1274,11 +1346,17 @@ class Panedwindow(Widget, tkinter.PanedWindow):
|
|||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
width: int = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1365,11 +1443,17 @@ class Progressbar(Widget):
|
|||
value: float = ...,
|
||||
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1451,11 +1535,17 @@ class Radiobutton(Widget):
|
|||
variable: tkinter.Variable | Literal[""] = ...,
|
||||
width: int | Literal[""] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1547,11 +1637,17 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc]
|
|||
value: float = ...,
|
||||
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1602,11 +1698,17 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc]
|
|||
style: str = ...,
|
||||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1623,11 +1725,17 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc]
|
|||
style: str = ...,
|
||||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1670,11 +1778,17 @@ class Separator(Widget):
|
|||
style: str = ...,
|
||||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1712,11 +1826,17 @@ class Sizegrip(Widget):
|
|||
style: str = ...,
|
||||
takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1801,11 +1921,17 @@ class Spinbox(Entry):
|
|||
wrap: bool = ...,
|
||||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1913,11 +2039,17 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
|
|||
xscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
yscrollcommand: str | Callable[[float, float], object] = ...,
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Configure resources of a widget.
|
||||
"""Query or modify the configuration options of the widget.
|
||||
|
||||
The values for resources are specified as keyword
|
||||
arguments. To get an overview about
|
||||
the allowed keyword arguments call the method keys.
|
||||
If no arguments are specified, return a dictionary describing
|
||||
all of the available options for the widget.
|
||||
|
||||
If an option name is specified, then return a tuple describing
|
||||
the one named option.
|
||||
|
||||
If one or more keyword arguments are specified or a dictionary
|
||||
is specified, then modify the widget option(s) to have the given
|
||||
value(s).
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -2333,7 +2465,7 @@ class OptionMenu(Menubutton):
|
|||
command: Callable[[tkinter.StringVar], object] | None = None,
|
||||
) -> None:
|
||||
"""Construct a themed OptionMenu widget with master as the parent,
|
||||
the resource textvariable set to variable, the initially selected
|
||||
the option textvariable set to variable, the initially selected
|
||||
value specified by the default parameter, the menu values given by
|
||||
*values and additional keywords.
|
||||
|
||||
|
|
|
|||
|
|
@ -560,16 +560,32 @@ class TurtleScreen(TurtleScreenBase):
|
|||
def bgcolor(self) -> _AnyColor:
|
||||
"""Set or return backgroundcolor of the TurtleScreen.
|
||||
|
||||
Arguments (if given): a color string or three numbers
|
||||
in the range 0..colormode or a 3-tuple of such numbers.
|
||||
Four input formats are allowed:
|
||||
- bgcolor()
|
||||
Return the current background color as color specification
|
||||
string or as a tuple (see example). May be used as input
|
||||
to another color/pencolor/fillcolor/bgcolor call.
|
||||
- bgcolor(colorstring)
|
||||
Set the background color to colorstring, which is a Tk color
|
||||
specification string, such as "red", "yellow", or "#33cc8c".
|
||||
- bgcolor((r, g, b))
|
||||
Set the background color to the RGB color represented by
|
||||
the tuple of r, g, and b. Each of r, g, and b must be in
|
||||
the range 0..colormode, where colormode is either 1.0 or 255
|
||||
(see colormode()).
|
||||
- bgcolor(r, g, b)
|
||||
Set the background color to the RGB color represented by
|
||||
r, g, and b. Each of r, g, and b must be in the range
|
||||
0..colormode.
|
||||
|
||||
Example (for a TurtleScreen instance named screen):
|
||||
>>> screen.bgcolor("orange")
|
||||
>>> screen.bgcolor()
|
||||
'orange'
|
||||
>>> screen.bgcolor(0.5,0,0.5)
|
||||
>>> colormode(255)
|
||||
>>> screen.bgcolor('#800080')
|
||||
>>> screen.bgcolor()
|
||||
'#800080'
|
||||
(128.0, 0.0, 128.0)
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -897,7 +913,7 @@ class TNavigator:
|
|||
|
||||
Example (for a Turtle instance named turtle):
|
||||
>>> turtle.position()
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> turtle.forward(25)
|
||||
>>> turtle.position()
|
||||
(25.00,0.00)
|
||||
|
|
@ -919,10 +935,10 @@ class TNavigator:
|
|||
|
||||
Example (for a Turtle instance named turtle):
|
||||
>>> turtle.position()
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> turtle.backward(30)
|
||||
>>> turtle.position()
|
||||
(-30.00, 0.00)
|
||||
(-30.00,0.00)
|
||||
"""
|
||||
|
||||
def right(self, angle: float) -> None:
|
||||
|
|
@ -1023,7 +1039,7 @@ class TNavigator:
|
|||
Example (for a Turtle instance named turtle):
|
||||
>>> tp = turtle.pos()
|
||||
>>> tp
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> turtle.setpos(60,30)
|
||||
>>> turtle.pos()
|
||||
(60.00,30.00)
|
||||
|
|
@ -1098,7 +1114,7 @@ class TNavigator:
|
|||
|
||||
Example (for a Turtle instance named turtle):
|
||||
>>> turtle.pos()
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> turtle.distance(30,40)
|
||||
50.0
|
||||
>>> pen = Turtle()
|
||||
|
|
@ -1341,28 +1357,32 @@ class TPen:
|
|||
Arguments:
|
||||
Four input formats are allowed:
|
||||
- pencolor()
|
||||
Return the current pencolor as color specification string,
|
||||
possibly in hex-number format (see example).
|
||||
May be used as input to another color/pencolor/fillcolor call.
|
||||
Return the current pencolor as color specification string or
|
||||
as a tuple (see example). May be used as input to another
|
||||
color/pencolor/fillcolor/bgcolor call.
|
||||
- pencolor(colorstring)
|
||||
s is a Tk color specification string, such as "red" or "yellow"
|
||||
Set pencolor to colorstring, which is a Tk color
|
||||
specification string, such as "red", "yellow", or "#33cc8c".
|
||||
- pencolor((r, g, b))
|
||||
*a tuple* of r, g, and b, which represent, an RGB color,
|
||||
and each of r, g, and b are in the range 0..colormode,
|
||||
where colormode is either 1.0 or 255
|
||||
Set pencolor to the RGB color represented by the tuple of
|
||||
r, g, and b. Each of r, g, and b must be in the range
|
||||
0..colormode, where colormode is either 1.0 or 255 (see
|
||||
colormode()).
|
||||
- pencolor(r, g, b)
|
||||
r, g, and b represent an RGB color, and each of r, g, and b
|
||||
are in the range 0..colormode
|
||||
Set pencolor to the RGB color represented by r, g, and b.
|
||||
Each of r, g, and b must be in the range 0..colormode.
|
||||
|
||||
If turtleshape is a polygon, the outline of that polygon is drawn
|
||||
with the newly set pencolor.
|
||||
|
||||
Example (for a Turtle instance named turtle):
|
||||
>>> turtle.pencolor('brown')
|
||||
>>> tup = (0.2, 0.8, 0.55)
|
||||
>>> turtle.pencolor(tup)
|
||||
>>> turtle.pencolor()
|
||||
'#33cc8c'
|
||||
'brown'
|
||||
>>> colormode(255)
|
||||
>>> turtle.pencolor('#32c18f')
|
||||
>>> turtle.pencolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1377,26 +1397,31 @@ class TPen:
|
|||
Four input formats are allowed:
|
||||
- fillcolor()
|
||||
Return the current fillcolor as color specification string,
|
||||
possibly in hex-number format (see example).
|
||||
May be used as input to another color/pencolor/fillcolor call.
|
||||
possibly in tuple format (see example). May be used as
|
||||
input to another color/pencolor/fillcolor/bgcolor call.
|
||||
- fillcolor(colorstring)
|
||||
s is a Tk color specification string, such as "red" or "yellow"
|
||||
Set fillcolor to colorstring, which is a Tk color
|
||||
specification string, such as "red", "yellow", or "#33cc8c".
|
||||
- fillcolor((r, g, b))
|
||||
*a tuple* of r, g, and b, which represent, an RGB color,
|
||||
and each of r, g, and b are in the range 0..colormode,
|
||||
where colormode is either 1.0 or 255
|
||||
Set fillcolor to the RGB color represented by the tuple of
|
||||
r, g, and b. Each of r, g, and b must be in the range
|
||||
0..colormode, where colormode is either 1.0 or 255 (see
|
||||
colormode()).
|
||||
- fillcolor(r, g, b)
|
||||
r, g, and b represent an RGB color, and each of r, g, and b
|
||||
are in the range 0..colormode
|
||||
Set fillcolor to the RGB color represented by r, g, and b.
|
||||
Each of r, g, and b must be in the range 0..colormode.
|
||||
|
||||
If turtleshape is a polygon, the interior of that polygon is drawn
|
||||
with the newly set fillcolor.
|
||||
|
||||
Example (for a Turtle instance named turtle):
|
||||
>>> turtle.fillcolor('violet')
|
||||
>>> col = turtle.pencolor()
|
||||
>>> turtle.fillcolor(col)
|
||||
>>> turtle.fillcolor(0, .5, 0)
|
||||
>>> turtle.fillcolor()
|
||||
'violet'
|
||||
>>> colormode(255)
|
||||
>>> turtle.fillcolor('#ffffff')
|
||||
>>> turtle.fillcolor()
|
||||
(255.0, 255.0, 255.0)
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -1409,19 +1434,17 @@ class TPen:
|
|||
|
||||
Arguments:
|
||||
Several input formats are allowed.
|
||||
They use 0, 1, 2, or 3 arguments as follows:
|
||||
|
||||
color()
|
||||
Return the current pencolor and the current fillcolor
|
||||
as a pair of color specification strings as are returned
|
||||
by pencolor and fillcolor.
|
||||
color(colorstring), color((r,g,b)), color(r,g,b)
|
||||
inputs as in pencolor, set both, fillcolor and pencolor,
|
||||
They use 0 to 3 arguments as follows:
|
||||
- color()
|
||||
Return the current pencolor and the current fillcolor as
|
||||
a pair of color specification strings or tuples as returned
|
||||
by pencolor() and fillcolor().
|
||||
- color(colorstring), color((r,g,b)), color(r,g,b)
|
||||
Inputs as in pencolor(), set both, fillcolor and pencolor,
|
||||
to the given value.
|
||||
color(colorstring1, colorstring2),
|
||||
color((r1,g1,b1), (r2,g2,b2))
|
||||
equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
|
||||
and analogously, if the other input format is used.
|
||||
- color(colorstring1, colorstring2), color((r1,g1,b1), (r2,g2,b2))
|
||||
Equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
|
||||
and analogously if the other input format is used.
|
||||
|
||||
If turtleshape is a polygon, outline and interior of that polygon
|
||||
is drawn with the newly set colors.
|
||||
|
|
@ -1432,9 +1455,9 @@ class TPen:
|
|||
>>> turtle.color()
|
||||
('red', 'green')
|
||||
>>> colormode(255)
|
||||
>>> color((40, 80, 120), (160, 200, 240))
|
||||
>>> color(('#285078', '#a0c8f0'))
|
||||
>>> color()
|
||||
('#285078', '#a0c8f0')
|
||||
((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -2430,16 +2453,32 @@ def turtles() -> list[Turtle]:
|
|||
def bgcolor() -> _AnyColor:
|
||||
"""Set or return backgroundcolor of the TurtleScreen.
|
||||
|
||||
Arguments (if given): a color string or three numbers
|
||||
in the range 0..colormode or a 3-tuple of such numbers.
|
||||
Four input formats are allowed:
|
||||
- bgcolor()
|
||||
Return the current background color as color specification
|
||||
string or as a tuple (see example). May be used as input
|
||||
to another color/pencolor/fillcolor/bgcolor call.
|
||||
- bgcolor(colorstring)
|
||||
Set the background color to colorstring, which is a Tk color
|
||||
specification string, such as "red", "yellow", or "#33cc8c".
|
||||
- bgcolor((r, g, b))
|
||||
Set the background color to the RGB color represented by
|
||||
the tuple of r, g, and b. Each of r, g, and b must be in
|
||||
the range 0..colormode, where colormode is either 1.0 or 255
|
||||
(see colormode()).
|
||||
- bgcolor(r, g, b)
|
||||
Set the background color to the RGB color represented by
|
||||
r, g, and b. Each of r, g, and b must be in the range
|
||||
0..colormode.
|
||||
|
||||
Example:
|
||||
>>> bgcolor("orange")
|
||||
>>> bgcolor()
|
||||
'orange'
|
||||
>>> bgcolor(0.5,0,0.5)
|
||||
>>> colormode(255)
|
||||
>>> bgcolor('#800080')
|
||||
>>> bgcolor()
|
||||
'#800080'
|
||||
(128.0, 0.0, 128.0)
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -2830,7 +2869,7 @@ def forward(distance: float) -> None:
|
|||
|
||||
Example:
|
||||
>>> position()
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> forward(25)
|
||||
>>> position()
|
||||
(25.00,0.00)
|
||||
|
|
@ -2852,10 +2891,10 @@ def back(distance: float) -> None:
|
|||
|
||||
Example:
|
||||
>>> position()
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> backward(30)
|
||||
>>> position()
|
||||
(-30.00, 0.00)
|
||||
(-30.00,0.00)
|
||||
"""
|
||||
|
||||
def right(angle: float) -> None:
|
||||
|
|
@ -2956,7 +2995,7 @@ def goto(x: tuple[float, float], y: None = None) -> None:
|
|||
Example:
|
||||
>>> tp = pos()
|
||||
>>> tp
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> setpos(60,30)
|
||||
>>> pos()
|
||||
(60.00,30.00)
|
||||
|
|
@ -3031,7 +3070,7 @@ def distance(x: TNavigator | tuple[float, float], y: None = None) -> float:
|
|||
|
||||
Example:
|
||||
>>> pos()
|
||||
(0.00, 0.00)
|
||||
(0.00,0.00)
|
||||
>>> distance(30,40)
|
||||
50.0
|
||||
>>> pen = Turtle()
|
||||
|
|
@ -3267,28 +3306,32 @@ def pencolor() -> _AnyColor:
|
|||
Arguments:
|
||||
Four input formats are allowed:
|
||||
- pencolor()
|
||||
Return the current pencolor as color specification string,
|
||||
possibly in hex-number format (see example).
|
||||
May be used as input to another color/pencolor/fillcolor call.
|
||||
Return the current pencolor as color specification string or
|
||||
as a tuple (see example). May be used as input to another
|
||||
color/pencolor/fillcolor/bgcolor call.
|
||||
- pencolor(colorstring)
|
||||
s is a Tk color specification string, such as "red" or "yellow"
|
||||
Set pencolor to colorstring, which is a Tk color
|
||||
specification string, such as "red", "yellow", or "#33cc8c".
|
||||
- pencolor((r, g, b))
|
||||
*a tuple* of r, g, and b, which represent, an RGB color,
|
||||
and each of r, g, and b are in the range 0..colormode,
|
||||
where colormode is either 1.0 or 255
|
||||
Set pencolor to the RGB color represented by the tuple of
|
||||
r, g, and b. Each of r, g, and b must be in the range
|
||||
0..colormode, where colormode is either 1.0 or 255 (see
|
||||
colormode()).
|
||||
- pencolor(r, g, b)
|
||||
r, g, and b represent an RGB color, and each of r, g, and b
|
||||
are in the range 0..colormode
|
||||
Set pencolor to the RGB color represented by r, g, and b.
|
||||
Each of r, g, and b must be in the range 0..colormode.
|
||||
|
||||
If turtleshape is a polygon, the outline of that polygon is drawn
|
||||
with the newly set pencolor.
|
||||
|
||||
Example:
|
||||
>>> pencolor('brown')
|
||||
>>> tup = (0.2, 0.8, 0.55)
|
||||
>>> pencolor(tup)
|
||||
>>> pencolor()
|
||||
'#33cc8c'
|
||||
'brown'
|
||||
>>> colormode(255)
|
||||
>>> pencolor('#32c18f')
|
||||
>>> pencolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -3303,26 +3346,31 @@ def fillcolor() -> _AnyColor:
|
|||
Four input formats are allowed:
|
||||
- fillcolor()
|
||||
Return the current fillcolor as color specification string,
|
||||
possibly in hex-number format (see example).
|
||||
May be used as input to another color/pencolor/fillcolor call.
|
||||
possibly in tuple format (see example). May be used as
|
||||
input to another color/pencolor/fillcolor/bgcolor call.
|
||||
- fillcolor(colorstring)
|
||||
s is a Tk color specification string, such as "red" or "yellow"
|
||||
Set fillcolor to colorstring, which is a Tk color
|
||||
specification string, such as "red", "yellow", or "#33cc8c".
|
||||
- fillcolor((r, g, b))
|
||||
*a tuple* of r, g, and b, which represent, an RGB color,
|
||||
and each of r, g, and b are in the range 0..colormode,
|
||||
where colormode is either 1.0 or 255
|
||||
Set fillcolor to the RGB color represented by the tuple of
|
||||
r, g, and b. Each of r, g, and b must be in the range
|
||||
0..colormode, where colormode is either 1.0 or 255 (see
|
||||
colormode()).
|
||||
- fillcolor(r, g, b)
|
||||
r, g, and b represent an RGB color, and each of r, g, and b
|
||||
are in the range 0..colormode
|
||||
Set fillcolor to the RGB color represented by r, g, and b.
|
||||
Each of r, g, and b must be in the range 0..colormode.
|
||||
|
||||
If turtleshape is a polygon, the interior of that polygon is drawn
|
||||
with the newly set fillcolor.
|
||||
|
||||
Example:
|
||||
>>> fillcolor('violet')
|
||||
>>> col = pencolor()
|
||||
>>> fillcolor(col)
|
||||
>>> fillcolor(0, .5, 0)
|
||||
>>> fillcolor()
|
||||
'violet'
|
||||
>>> colormode(255)
|
||||
>>> fillcolor('#ffffff')
|
||||
>>> fillcolor()
|
||||
(255.0, 255.0, 255.0)
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
@ -3335,19 +3383,17 @@ def color() -> tuple[_AnyColor, _AnyColor]:
|
|||
|
||||
Arguments:
|
||||
Several input formats are allowed.
|
||||
They use 0, 1, 2, or 3 arguments as follows:
|
||||
|
||||
color()
|
||||
Return the current pencolor and the current fillcolor
|
||||
as a pair of color specification strings as are returned
|
||||
by pencolor and fillcolor.
|
||||
color(colorstring), color((r,g,b)), color(r,g,b)
|
||||
inputs as in pencolor, set both, fillcolor and pencolor,
|
||||
They use 0 to 3 arguments as follows:
|
||||
- color()
|
||||
Return the current pencolor and the current fillcolor as
|
||||
a pair of color specification strings or tuples as returned
|
||||
by pencolor() and fillcolor().
|
||||
- color(colorstring), color((r,g,b)), color(r,g,b)
|
||||
Inputs as in pencolor(), set both, fillcolor and pencolor,
|
||||
to the given value.
|
||||
color(colorstring1, colorstring2),
|
||||
color((r1,g1,b1), (r2,g2,b2))
|
||||
equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
|
||||
and analogously, if the other input format is used.
|
||||
- color(colorstring1, colorstring2), color((r1,g1,b1), (r2,g2,b2))
|
||||
Equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
|
||||
and analogously if the other input format is used.
|
||||
|
||||
If turtleshape is a polygon, outline and interior of that polygon
|
||||
is drawn with the newly set colors.
|
||||
|
|
@ -3358,9 +3404,9 @@ def color() -> tuple[_AnyColor, _AnyColor]:
|
|||
>>> color()
|
||||
('red', 'green')
|
||||
>>> colormode(255)
|
||||
>>> color((40, 80, 120), (160, 200, 240))
|
||||
>>> color(('#285078', '#a0c8f0'))
|
||||
>>> color()
|
||||
('#285078', '#a0c8f0')
|
||||
((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
|
||||
"""
|
||||
|
||||
@overload
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
|||
"""Implement next(self)."""
|
||||
|
||||
def send(self, arg: _SendT_contra, /) -> _YieldT_co:
|
||||
"""send(arg) -> send 'arg' into generator,
|
||||
"""send(value) -> send 'value' into generator,
|
||||
return next yielded value or raise StopIteration.
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -1244,6 +1244,11 @@ class ValuesView(MappingView, Collection[_VT_co]):
|
|||
def __contains__(self, value: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_VT_co]: ...
|
||||
|
||||
# note for Mapping.get and MutableMapping.pop and MutableMapping.setdefault
|
||||
# In _collections_abc.py the parameters are positional-or-keyword,
|
||||
# but dict and types.MappingProxyType (the vast majority of Mapping types)
|
||||
# don't allow keyword arguments.
|
||||
|
||||
class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
|
||||
"""A Mapping is a generic container for associating key/value
|
||||
pairs.
|
||||
|
|
@ -1262,9 +1267,9 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
|
|||
"""D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."""
|
||||
|
||||
@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, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||
@overload
|
||||
def get(self, key: _KT, /, default: _T) -> _VT_co | _T: ...
|
||||
def get(self, key: _KT, default: _T, /) -> _VT_co | _T: ...
|
||||
def items(self) -> ItemsView[_KT, _VT_co]:
|
||||
"""D.items() -> a set-like object providing a view on D's items"""
|
||||
|
||||
|
|
@ -1300,9 +1305,9 @@ class MutableMapping(Mapping[_KT, _VT]):
|
|||
"""
|
||||
|
||||
@overload
|
||||
def pop(self, key: _KT, /, default: _VT) -> _VT: ...
|
||||
def pop(self, key: _KT, default: _VT, /) -> _VT: ...
|
||||
@overload
|
||||
def pop(self, key: _KT, /, default: _T) -> _VT | _T: ...
|
||||
def pop(self, key: _KT, default: _T, /) -> _VT | _T: ...
|
||||
def popitem(self) -> tuple[_KT, _VT]:
|
||||
"""D.popitem() -> (k, v), remove and return some (key, value) pair
|
||||
as a 2-tuple; but raise KeyError if D is empty.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ ConnectRegistry() - Establishes a connection to a predefined registry handle
|
|||
CreateKey() - Creates the specified key, or opens it if it already exists.
|
||||
DeleteKey() - Deletes the specified key.
|
||||
DeleteValue() - Removes a named value from the specified registry key.
|
||||
DeleteTree() - Deletes the specified key and all its subkeys and values recursively.
|
||||
EnumKey() - Enumerates subkeys of the specified open registry key.
|
||||
EnumValue() - Enumerates values of the specified open registry key.
|
||||
ExpandEnvironmentStrings() - Expand the env strings in a REG_EXPAND_SZ
|
||||
|
|
@ -539,7 +540,8 @@ if sys.platform == "win32":
|
|||
Operations:
|
||||
__bool__ - Handles with an open object return true, otherwise false.
|
||||
__int__ - Converting a handle to an integer returns the Win32 handle.
|
||||
rich comparison - Handle objects are compared using the handle value.
|
||||
__enter__, __exit__ - Context manager support for 'with' statement,
|
||||
automatically closes handle.
|
||||
"""
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
|
|
|
|||
Loading…
Reference in New Issue