From 6b621a989cd6fde98981573ef273e76326e73afd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 24 Jun 2023 00:21:40 +0000 Subject: [PATCH 1/9] sync with cpython 05d06e58 --- library/typing.po | 1048 +++++++++++++++++++++++---------------------- 1 file changed, 533 insertions(+), 515 deletions(-) diff --git a/library/typing.po b/library/typing.po index 900dfac899..ed19a42637 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-20 00:15+0000\n" +"POT-Creation-Date: 2023-06-24 00:19+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -368,7 +368,7 @@ msgid "" "hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``." msgstr "" -#: ../../library/typing.rst:254 ../../library/typing.rst:2640 +#: ../../library/typing.rst:254 ../../library/typing.rst:2682 msgid "For example:" msgstr "舉例來說" @@ -379,7 +379,7 @@ msgid "" "arguments in the type hint: ``Callable[..., ReturnType]``." msgstr "" -#: ../../library/typing.rst:276 ../../library/typing.rst:920 +#: ../../library/typing.rst:276 ../../library/typing.rst:962 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -390,7 +390,7 @@ msgid "" "ReturnType]`` respectively." msgstr "" -#: ../../library/typing.rst:284 ../../library/typing.rst:932 +#: ../../library/typing.rst:284 ../../library/typing.rst:974 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -420,67 +420,101 @@ msgid "" msgstr "" #: ../../library/typing.rst:330 -msgid "User-defined generic types" +msgid "Annotating tuples" msgstr "" #: ../../library/typing.rst:332 +msgid "" +"For most containers in Python, the typing system assumes that all elements " +"in the container will be of the same type. For example::" +msgstr "" + +#: ../../library/typing.rst:347 +msgid "" +":class:`list` only accepts one type argument, so a type checker would emit " +"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." +"Mapping` only accepts two type arguments: the first indicates the type of " +"the keys, and the second indicates the type of the values." +msgstr "" + +#: ../../library/typing.rst:353 +msgid "" +"Unlike most other Python containers, however, it is common in idiomatic " +"Python code for tuples to have elements which are not all of the same type. " +"For this reason, tuples are special-cased in Python's typing system. :class:" +"`tuple` accepts *any number* of type arguments::" +msgstr "" + +#: ../../library/typing.rst:369 +msgid "" +"To denote a tuple which could be of *any* length, and in which all elements " +"are of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, " +"use ``tuple[()]``. Using plain ``tuple`` as an annotation is equivalent to " +"using ``tuple[Any, ...]``::" +msgstr "" + +#: ../../library/typing.rst:392 +msgid "User-defined generic types" +msgstr "" + +#: ../../library/typing.rst:394 msgid "A user-defined class can be defined as a generic class." msgstr "" -#: ../../library/typing.rst:358 +#: ../../library/typing.rst:420 msgid "" "``Generic[T]`` as a base class defines that the class ``LoggedVar`` takes a " "single type parameter ``T`` . This also makes ``T`` valid as a type within " "the class body." msgstr "" -#: ../../library/typing.rst:362 +#: ../../library/typing.rst:424 msgid "" "The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so " "that ``LoggedVar[T]`` is valid as a type::" msgstr "" -#: ../../library/typing.rst:371 +#: ../../library/typing.rst:433 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" -#: ../../library/typing.rst:383 +#: ../../library/typing.rst:445 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr "" -#: ../../library/typing.rst:394 +#: ../../library/typing.rst:456 msgid "You can use multiple inheritance with :class:`Generic`::" msgstr "" -#: ../../library/typing.rst:404 +#: ../../library/typing.rst:466 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "" -#: ../../library/typing.rst:414 +#: ../../library/typing.rst:476 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "" -#: ../../library/typing.rst:416 +#: ../../library/typing.rst:478 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " "but implicitly inherits from ``Iterable[Any]``:" msgstr "" -#: ../../library/typing.rst:427 +#: ../../library/typing.rst:489 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "" -#: ../../library/typing.rst:444 +#: ../../library/typing.rst:506 msgid ":class:`Generic` no longer has a custom metaclass." msgstr "" -#: ../../library/typing.rst:447 +#: ../../library/typing.rst:509 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``Generic[P]``. The behavior " @@ -490,7 +524,7 @@ msgid "" "used to substitute a :class:`ParamSpec`::" msgstr "" -#: ../../library/typing.rst:463 +#: ../../library/typing.rst:525 msgid "" "Furthermore, a generic with only one parameter specification variable will " "accept parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also " @@ -498,20 +532,20 @@ msgid "" "converted to the former, so the following are equivalent::" msgstr "" -#: ../../library/typing.rst:475 +#: ../../library/typing.rst:537 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " "intended primarily for static type checking." msgstr "" -#: ../../library/typing.rst:479 +#: ../../library/typing.rst:541 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:483 +#: ../../library/typing.rst:545 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -519,24 +553,24 @@ msgid "" "term:`hashable` and comparable for equality." msgstr "" -#: ../../library/typing.rst:490 +#: ../../library/typing.rst:552 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:492 +#: ../../library/typing.rst:554 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -#: ../../library/typing.rst:496 +#: ../../library/typing.rst:558 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" msgstr "" -#: ../../library/typing.rst:514 +#: ../../library/typing.rst:576 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -545,19 +579,19 @@ msgid "" "runtime!" msgstr "" -#: ../../library/typing.rst:520 +#: ../../library/typing.rst:582 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -#: ../../library/typing.rst:533 +#: ../../library/typing.rst:595 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." msgstr "" -#: ../../library/typing.rst:536 +#: ../../library/typing.rst:598 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -565,7 +599,7 @@ msgid "" "subtype of every other type." msgstr "" -#: ../../library/typing.rst:541 +#: ../../library/typing.rst:603 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -573,24 +607,24 @@ msgid "" "example::" msgstr "" -#: ../../library/typing.rst:563 +#: ../../library/typing.rst:625 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." msgstr "" -#: ../../library/typing.rst:568 +#: ../../library/typing.rst:630 msgid "Nominal vs structural subtyping" msgstr "" -#: ../../library/typing.rst:570 +#: ../../library/typing.rst:632 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " "expected if and only if ``A`` is a subclass of ``B``." msgstr "" -#: ../../library/typing.rst:574 +#: ../../library/typing.rst:636 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -599,7 +633,7 @@ msgid "" "code. For example, this conforms to :pep:`484`::" msgstr "" -#: ../../library/typing.rst:587 +#: ../../library/typing.rst:649 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -608,85 +642,85 @@ msgid "" "subtyping* (or static duck-typing)::" msgstr "" -#: ../../library/typing.rst:603 +#: ../../library/typing.rst:665 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " "examples below)." msgstr "" -#: ../../library/typing.rst:608 +#: ../../library/typing.rst:670 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:610 +#: ../../library/typing.rst:672 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "" -#: ../../library/typing.rst:613 +#: ../../library/typing.rst:675 msgid "Special typing primitives" msgstr "" -#: ../../library/typing.rst:616 +#: ../../library/typing.rst:678 msgid "Special types" msgstr "" -#: ../../library/typing.rst:618 +#: ../../library/typing.rst:680 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "" -#: ../../library/typing.rst:623 +#: ../../library/typing.rst:685 msgid "Special type indicating an unconstrained type." msgstr "" -#: ../../library/typing.rst:625 +#: ../../library/typing.rst:687 msgid "Every type is compatible with :data:`Any`." msgstr "" -#: ../../library/typing.rst:626 +#: ../../library/typing.rst:688 msgid ":data:`Any` is compatible with every type." msgstr "" -#: ../../library/typing.rst:628 +#: ../../library/typing.rst:690 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " "dynamic." msgstr "" -#: ../../library/typing.rst:635 +#: ../../library/typing.rst:697 msgid "A :ref:`constrained type variable `." msgstr "" -#: ../../library/typing.rst:637 +#: ../../library/typing.rst:699 msgid "Definition::" msgstr "" -#: ../../library/typing.rst:641 +#: ../../library/typing.rst:703 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." msgstr "" -#: ../../library/typing.rst:644 ../../library/typing.rst:720 -#: ../../library/typing.rst:740 ../../library/typing.rst:786 -#: ../../library/typing.rst:1053 ../../library/typing.rst:1110 -#: ../../library/typing.rst:1318 ../../library/typing.rst:2480 +#: ../../library/typing.rst:706 ../../library/typing.rst:782 +#: ../../library/typing.rst:802 ../../library/typing.rst:848 +#: ../../library/typing.rst:1095 ../../library/typing.rst:1152 +#: ../../library/typing.rst:1360 ../../library/typing.rst:2522 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:655 +#: ../../library/typing.rst:717 msgid "Special type that includes only literal strings." msgstr "" -#: ../../library/typing.rst:657 +#: ../../library/typing.rst:719 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -694,14 +728,14 @@ msgid "" "``LiteralString``." msgstr "" -#: ../../library/typing.rst:663 +#: ../../library/typing.rst:725 msgid "Example:" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:679 +#: ../../library/typing.rst:741 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -709,33 +743,33 @@ msgid "" "attack." msgstr "" -#: ../../library/typing.rst:684 +#: ../../library/typing.rst:746 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:690 +#: ../../library/typing.rst:752 msgid "" "The `bottom type `_, a type that " "has no members." msgstr "" -#: ../../library/typing.rst:693 +#: ../../library/typing.rst:755 msgid "" "This can be used to define a function that should never be called, or a " "function that never returns::" msgstr "" -#: ../../library/typing.rst:713 +#: ../../library/typing.rst:775 msgid "" "On older Python versions, :data:`NoReturn` may be used to express the same " "concept. ``Never`` was added to make the intended meaning more explicit." msgstr "" -#: ../../library/typing.rst:718 +#: ../../library/typing.rst:780 msgid "Special type indicating that a function never returns." msgstr "" -#: ../../library/typing.rst:727 +#: ../../library/typing.rst:789 msgid "" "``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " @@ -743,157 +777,126 @@ msgid "" "checkers should treat the two equivalently." msgstr "" -#: ../../library/typing.rst:738 +#: ../../library/typing.rst:800 msgid "Special type to represent the current enclosed class." msgstr "" -#: ../../library/typing.rst:750 +#: ../../library/typing.rst:812 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "" -#: ../../library/typing.rst:762 +#: ../../library/typing.rst:824 msgid "In general if something currently follows the pattern of::" msgstr "" -#: ../../library/typing.rst:769 +#: ../../library/typing.rst:831 msgid "" "You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would " "have ``Foo`` as the return type and not ``SubclassOfFoo``." msgstr "" -#: ../../library/typing.rst:772 +#: ../../library/typing.rst:834 msgid "Other common use cases include:" msgstr "" -#: ../../library/typing.rst:774 +#: ../../library/typing.rst:836 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." msgstr "" -#: ../../library/typing.rst:776 +#: ../../library/typing.rst:838 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "" -#: ../../library/typing.rst:778 +#: ../../library/typing.rst:840 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:784 +#: ../../library/typing.rst:846 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "" -#: ../../library/typing.rst:792 +#: ../../library/typing.rst:854 msgid "" "``TypeAlias`` is particularly useful for annotating aliases that make use of " "forward references, as it can be hard for type checkers to distinguish these " "from normal variable assignments:" msgstr "" -#: ../../library/typing.rst:812 +#: ../../library/typing.rst:874 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:817 +#: ../../library/typing.rst:879 msgid "Special forms" msgstr "" -#: ../../library/typing.rst:819 +#: ../../library/typing.rst:881 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." msgstr "" -#: ../../library/typing.rst:824 -msgid "Deprecated alias for :class:`tuple`." -msgstr "" - -#: ../../library/typing.rst:826 -msgid "" -"``Tuple[X, Y]`` is the type of a tuple of two items with the first item of " -"type X and the second of type Y. The type of the empty tuple can be written " -"as ``Tuple[()]``." -msgstr "" - -#: ../../library/typing.rst:830 -msgid "" -"Example: ``Tuple[T1, T2]`` is a tuple of two elements corresponding to type " -"variables T1 and T2. ``Tuple[int, float, str]`` is a tuple of an int, a " -"float and a string." -msgstr "" - -#: ../../library/typing.rst:834 -msgid "" -"To specify a variable-length tuple of homogeneous type, use literal " -"ellipsis, e.g. ``Tuple[int, ...]``. A plain ``Tuple`` annotation is " -"equivalent to ``tuple``, ``Tuple[Any, ...]``, or ``tuple[Any, ...]``." -msgstr "" - -#: ../../library/typing.rst:838 -msgid "" -":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." -msgstr "" - -#: ../../library/typing.rst:844 +#: ../../library/typing.rst:886 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" -#: ../../library/typing.rst:846 +#: ../../library/typing.rst:888 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" msgstr "" -#: ../../library/typing.rst:848 +#: ../../library/typing.rst:890 msgid "The arguments must be types and there must be at least one." msgstr "" -#: ../../library/typing.rst:850 +#: ../../library/typing.rst:892 msgid "Unions of unions are flattened, e.g.::" msgstr "" -#: ../../library/typing.rst:854 +#: ../../library/typing.rst:896 msgid "Unions of a single argument vanish, e.g.::" msgstr "" -#: ../../library/typing.rst:858 +#: ../../library/typing.rst:900 msgid "Redundant arguments are skipped, e.g.::" msgstr "" -#: ../../library/typing.rst:862 +#: ../../library/typing.rst:904 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "" -#: ../../library/typing.rst:866 +#: ../../library/typing.rst:908 msgid "You cannot subclass or instantiate a ``Union``." msgstr "" -#: ../../library/typing.rst:868 +#: ../../library/typing.rst:910 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:870 +#: ../../library/typing.rst:912 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" -#: ../../library/typing.rst:873 +#: ../../library/typing.rst:915 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:879 +#: ../../library/typing.rst:921 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "" -#: ../../library/typing.rst:881 +#: ../../library/typing.rst:923 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -901,30 +904,30 @@ msgid "" "optional. For example::" msgstr "" -#: ../../library/typing.rst:889 +#: ../../library/typing.rst:931 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " "example::" msgstr "" -#: ../../library/typing.rst:896 +#: ../../library/typing.rst:938 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:902 +#: ../../library/typing.rst:944 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "" -#: ../../library/typing.rst:904 +#: ../../library/typing.rst:946 msgid "" "``Callable[[int], str]`` signifies a function that takes a single parameter " "of type :class:`int` and returns a :class:`str`." msgstr "" -#: ../../library/typing.rst:907 +#: ../../library/typing.rst:949 msgid "" "The subscription syntax must always be used with exactly two values: the " "argument list and the return type. The argument list must be a list of " @@ -932,7 +935,7 @@ msgid "" "type must be a single type." msgstr "" -#: ../../library/typing.rst:912 +#: ../../library/typing.rst:954 msgid "" "There is no syntax to indicate optional or keyword arguments; such function " "types are rarely used as callback types. ``Callable[..., ReturnType]`` " @@ -942,23 +945,23 @@ msgid "" "Callable`." msgstr "" -#: ../../library/typing.rst:928 +#: ../../library/typing.rst:970 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:937 +#: ../../library/typing.rst:979 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provide " "examples of usage with ``Callable``." msgstr "" -#: ../../library/typing.rst:942 +#: ../../library/typing.rst:984 msgid "Special form for annotating higher-order functions." msgstr "" -#: ../../library/typing.rst:944 +#: ../../library/typing.rst:986 msgid "" "``Concatenate`` can be used in conjunction with :data:`Callable` and :class:" "`ParamSpec` to annotate a higher-order callable which adds, removes, or " @@ -969,7 +972,7 @@ msgid "" "`ParamSpec` or ellipsis (``...``)." msgstr "" -#: ../../library/typing.rst:953 +#: ../../library/typing.rst:995 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -980,21 +983,21 @@ msgid "" "passed in::" msgstr "" -#: ../../library/typing.rst:992 ../../library/typing.rst:1697 +#: ../../library/typing.rst:1034 ../../library/typing.rst:1739 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)." msgstr "" -#: ../../library/typing.rst:994 +#: ../../library/typing.rst:1036 msgid ":class:`ParamSpec` and :class:`Callable`." msgstr ":class:`ParamSpec` 和 :class:`Callable`\\ 。" -#: ../../library/typing.rst:999 +#: ../../library/typing.rst:1041 msgid "Deprecated alias to :class:`type`." msgstr "" -#: ../../library/typing.rst:1001 +#: ../../library/typing.rst:1043 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " "contrast, a variable annotated with ``type[C]`` or ``Type[C]`` may accept " @@ -1002,11 +1005,11 @@ msgid "" "*class object* of ``C``. For example::" msgstr "" -#: ../../library/typing.rst:1010 +#: ../../library/typing.rst:1052 msgid "Note that ``Type[C]`` is covariant::" msgstr "" -#: ../../library/typing.rst:1022 +#: ../../library/typing.rst:1064 msgid "" "The fact that ``Type[C]`` is covariant implies that all subclasses of ``C`` " "should implement the same constructor signature and class method signatures " @@ -1016,42 +1019,42 @@ msgid "" "particular case may change in future revisions of :pep:`484`." msgstr "" -#: ../../library/typing.rst:1030 +#: ../../library/typing.rst:1072 msgid "" "The only legal parameters for :class:`Type` are classes, :data:`Any`, :ref:" "`type variables `, and unions of any of these types. For example::" msgstr "" -#: ../../library/typing.rst:1036 +#: ../../library/typing.rst:1078 msgid "" "``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent to " "``type``, which is the root of Python's metaclass hierarchy." msgstr "" -#: ../../library/typing.rst:1041 +#: ../../library/typing.rst:1083 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1047 +#: ../../library/typing.rst:1089 msgid "Special typing form to define \"literal types\"." msgstr "" -#: ../../library/typing.rst:1049 +#: ../../library/typing.rst:1091 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" -#: ../../library/typing.rst:1065 +#: ../../library/typing.rst:1107 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " "restrictions. See :pep:`586` for more details about literal types." msgstr "" -#: ../../library/typing.rst:1071 +#: ../../library/typing.rst:1113 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -1059,22 +1062,22 @@ msgid "" "their parameters are not :term:`hashable`." msgstr "" -#: ../../library/typing.rst:1079 +#: ../../library/typing.rst:1121 msgid "Special type construct to mark class variables." msgstr "" -#: ../../library/typing.rst:1081 +#: ../../library/typing.rst:1123 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " "and should not be set on instances of that class. Usage::" msgstr "" -#: ../../library/typing.rst:1089 +#: ../../library/typing.rst:1131 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr "" -#: ../../library/typing.rst:1091 +#: ../../library/typing.rst:1133 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -1082,47 +1085,49 @@ msgid "" "example, a type checker might flag the following code as an error::" msgstr "" -#: ../../library/typing.rst:1105 +#: ../../library/typing.rst:1147 msgid "Special typing construct to indicate final names to type checkers." msgstr "" -#: ../../library/typing.rst:1107 +#: ../../library/typing.rst:1149 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." msgstr "" -#: ../../library/typing.rst:1121 ../../library/typing.rst:2496 +#: ../../library/typing.rst:1163 ../../library/typing.rst:2538 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -#: ../../library/typing.rst:1128 +#: ../../library/typing.rst:1170 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "" -#: ../../library/typing.rst:1130 +#: ../../library/typing.rst:1172 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." -msgstr "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :pep:`655`。" +msgstr "" +"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" +"pep:`655`。" -#: ../../library/typing.rst:1137 +#: ../../library/typing.rst:1179 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "" -#: ../../library/typing.rst:1140 +#: ../../library/typing.rst:1182 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1146 +#: ../../library/typing.rst:1188 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1148 +#: ../../library/typing.rst:1190 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -1130,7 +1135,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1153 +#: ../../library/typing.rst:1195 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -1139,7 +1144,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1159 +#: ../../library/typing.rst:1201 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -1149,7 +1154,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1166 +#: ../../library/typing.rst:1208 msgid "" "The responsibility of how to interpret the metadata lies with the the tool " "or library encountering an ``Annotated`` annotation. A tool or library " @@ -1157,108 +1162,108 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1174 +#: ../../library/typing.rst:1216 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1187 +#: ../../library/typing.rst:1229 msgid "Details of the syntax:" msgstr "" -#: ../../library/typing.rst:1189 +#: ../../library/typing.rst:1231 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:1191 +#: ../../library/typing.rst:1233 msgid "" "Multiple metadata elements can be supplied (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:1200 +#: ../../library/typing.rst:1242 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1204 +#: ../../library/typing.rst:1246 msgid "" "``Annotated`` must be subscripted with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:1207 +#: ../../library/typing.rst:1249 msgid "" "The order of the metadata elements is preserved and matters for equality " "checks::" msgstr "" -#: ../../library/typing.rst:1214 +#: ../../library/typing.rst:1256 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1221 +#: ../../library/typing.rst:1263 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1227 +#: ../../library/typing.rst:1269 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1240 +#: ../../library/typing.rst:1282 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1244 +#: ../../library/typing.rst:1286 msgid "This would be equivalent to::" msgstr "" "這會等價於:\n" "\n" "::" -#: ../../library/typing.rst:1248 +#: ../../library/typing.rst:1290 msgid "" "where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " "invalid: only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1251 +#: ../../library/typing.rst:1293 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1264 +#: ../../library/typing.rst:1306 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1278 +#: ../../library/typing.rst:1320 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1279 +#: ../../library/typing.rst:1321 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1286 +#: ../../library/typing.rst:1328 msgid "Special typing construct for marking user-defined type guard functions." msgstr "" -#: ../../library/typing.rst:1288 +#: ../../library/typing.rst:1330 msgid "" "``TypeGuard`` can be used to annotate the return type of a user-defined type " "guard function. ``TypeGuard`` only accepts a single type argument. At " "runtime, functions marked this way should return a boolean." msgstr "" -#: ../../library/typing.rst:1292 +#: ../../library/typing.rst:1334 msgid "" "``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -1267,44 +1272,44 @@ msgid "" "conditional expression here is sometimes referred to as a \"type guard\"::" msgstr "" -#: ../../library/typing.rst:1307 +#: ../../library/typing.rst:1349 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type guard. Such a function should use ``TypeGuard[...]`` as its return " "type to alert static type checkers to this intention." msgstr "" -#: ../../library/typing.rst:1311 +#: ../../library/typing.rst:1353 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1314 +#: ../../library/typing.rst:1356 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1315 +#: ../../library/typing.rst:1357 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1332 +#: ../../library/typing.rst:1374 msgid "" "If ``is_str_list`` is a class or instance method, then the type in " "``TypeGuard`` maps to the type of the second parameter after ``cls`` or " "``self``." msgstr "" -#: ../../library/typing.rst:1336 +#: ../../library/typing.rst:1378 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means " "that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` " "to ``TypeB``." msgstr "" -#: ../../library/typing.rst:1342 +#: ../../library/typing.rst:1384 msgid "" "``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider " "form. The main reason is to allow for things like narrowing ``list[object]`` " @@ -1313,24 +1318,24 @@ msgid "" "guards is left to the user." msgstr "" -#: ../../library/typing.rst:1348 +#: ../../library/typing.rst:1390 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1355 +#: ../../library/typing.rst:1397 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1357 +#: ../../library/typing.rst:1399 msgid "" "For example, using the unpack operator ``*`` on a :class:`type variable " "tuple ` is equivalent to using ``Unpack`` to mark the type " "variable tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1366 +#: ../../library/typing.rst:1408 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -1338,45 +1343,45 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1383 +#: ../../library/typing.rst:1425 msgid "Building generic types" msgstr "" -#: ../../library/typing.rst:1385 +#: ../../library/typing.rst:1427 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types." msgstr "" -#: ../../library/typing.rst:1391 +#: ../../library/typing.rst:1433 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1393 +#: ../../library/typing.rst:1435 msgid "" "A generic type is typically declared by inheriting from an instantiation of " "this class with one or more type variables. For example, a generic mapping " "type might be defined as::" msgstr "" -#: ../../library/typing.rst:1402 +#: ../../library/typing.rst:1444 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1415 +#: ../../library/typing.rst:1457 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1417 ../../library/typing.rst:1512 -#: ../../library/typing.rst:1622 ../../library/typing.rst:1735 -#: ../../library/typing.rst:1806 ../../library/typing.rst:2680 +#: ../../library/typing.rst:1459 ../../library/typing.rst:1554 +#: ../../library/typing.rst:1664 ../../library/typing.rst:1777 +#: ../../library/typing.rst:1848 ../../library/typing.rst:2722 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/typing.rst:1423 +#: ../../library/typing.rst:1465 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -1384,69 +1389,69 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1444 +#: ../../library/typing.rst:1486 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1447 +#: ../../library/typing.rst:1489 msgid "" "Type variables may be marked covariant or contravariant by passing " "``covariant=True`` or ``contravariant=True``. See :pep:`484` for more " "details. By default, type variables are invariant." msgstr "" -#: ../../library/typing.rst:1451 +#: ../../library/typing.rst:1493 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1466 +#: ../../library/typing.rst:1508 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1474 +#: ../../library/typing.rst:1516 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1485 +#: ../../library/typing.rst:1527 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1489 +#: ../../library/typing.rst:1531 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1535 msgid "Whether the type var has been marked as covariant." msgstr "" -#: ../../library/typing.rst:1497 +#: ../../library/typing.rst:1539 msgid "Whether the type var has been marked as contravariant." msgstr "" -#: ../../library/typing.rst:1501 +#: ../../library/typing.rst:1543 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1547 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1509 +#: ../../library/typing.rst:1551 msgid "" "Type variable tuple. A specialized form of :class:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1520 +#: ../../library/typing.rst:1562 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -1454,7 +1459,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1542 +#: ../../library/typing.rst:1584 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -1464,36 +1469,36 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1550 +#: ../../library/typing.rst:1592 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1557 +#: ../../library/typing.rst:1599 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1566 +#: ../../library/typing.rst:1608 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1585 +#: ../../library/typing.rst:1627 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1592 +#: ../../library/typing.rst:1634 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1602 +#: ../../library/typing.rst:1644 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -1502,21 +1507,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1609 +#: ../../library/typing.rst:1651 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1613 +#: ../../library/typing.rst:1655 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1619 +#: ../../library/typing.rst:1661 msgid "" "Parameter specification variable. A specialized version of :class:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1626 +#: ../../library/typing.rst:1668 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1526,7 +1531,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1633 +#: ../../library/typing.rst:1675 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -1534,27 +1539,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1657 +#: ../../library/typing.rst:1699 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:1661 +#: ../../library/typing.rst:1703 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:1663 +#: ../../library/typing.rst:1705 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1712 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1567,11 +1572,11 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1682 +#: ../../library/typing.rst:1724 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:1684 +#: ../../library/typing.rst:1726 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1580,17 +1585,17 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1735 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1699 +#: ../../library/typing.rst:1741 msgid ":class:`Callable` and :class:`Concatenate`." msgstr ":class:`Callable` 和 :class:`Concatenate`\\ 。" -#: ../../library/typing.rst:1704 +#: ../../library/typing.rst:1746 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1598,45 +1603,45 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1709 +#: ../../library/typing.rst:1751 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:1725 +#: ../../library/typing.rst:1767 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1727 +#: ../../library/typing.rst:1769 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:1733 +#: ../../library/typing.rst:1775 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1783 msgid "This is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/typing.rst:1745 +#: ../../library/typing.rst:1787 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1754 +#: ../../library/typing.rst:1796 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1756 +#: ../../library/typing.rst:1798 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -1645,83 +1650,83 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:1762 +#: ../../library/typing.rst:1804 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:1772 +#: ../../library/typing.rst:1814 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:1778 +#: ../../library/typing.rst:1820 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:1782 +#: ../../library/typing.rst:1824 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:1785 +#: ../../library/typing.rst:1827 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:1788 +#: ../../library/typing.rst:1830 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1834 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:1796 +#: ../../library/typing.rst:1838 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:1801 +#: ../../library/typing.rst:1843 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:1803 +#: ../../library/typing.rst:1845 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:1813 +#: ../../library/typing.rst:1855 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:1817 +#: ../../library/typing.rst:1859 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:1821 +#: ../../library/typing.rst:1863 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:1825 +#: ../../library/typing.rst:1867 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:1830 +#: ../../library/typing.rst:1872 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:1832 +#: ../../library/typing.rst:1874 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:1838 +#: ../../library/typing.rst:1880 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:1850 +#: ../../library/typing.rst:1892 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -1729,15 +1734,15 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:1855 +#: ../../library/typing.rst:1897 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:1867 +#: ../../library/typing.rst:1909 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:1869 +#: ../../library/typing.rst:1911 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -1746,7 +1751,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:1889 +#: ../../library/typing.rst:1931 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -1757,7 +1762,7 @@ msgid "" "SSLObject`." msgstr "" -#: ../../library/typing.rst:1900 +#: ../../library/typing.rst:1942 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -1765,13 +1770,13 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:1911 +#: ../../library/typing.rst:1953 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:1914 +#: ../../library/typing.rst:1956 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -1779,53 +1784,53 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:1930 +#: ../../library/typing.rst:1972 msgid "" "To allow using this feature with older versions of Python that do not " "support :pep:`526`, ``TypedDict`` supports two additional equivalent " "syntactic forms:" msgstr "" -#: ../../library/typing.rst:1934 +#: ../../library/typing.rst:1976 msgid "Using a literal :class:`dict` as the second argument::" msgstr "" -#: ../../library/typing.rst:1938 +#: ../../library/typing.rst:1980 msgid "Using keyword arguments::" msgstr "" -#: ../../library/typing.rst:1945 +#: ../../library/typing.rst:1987 msgid "" "The keyword-argument syntax is deprecated in 3.11 and will be removed in " "3.13. It may also be unsupported by static type checkers." msgstr "" -#: ../../library/typing.rst:1946 +#: ../../library/typing.rst:1988 msgid "" "The functional syntax should also be used when any of the keys are not " "valid :ref:`identifiers `, for example because they are " "keywords or contain hyphens. Example::" msgstr "" -#: ../../library/typing.rst:1958 +#: ../../library/typing.rst:2000 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:1969 +#: ../../library/typing.rst:2011 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:1972 +#: ../../library/typing.rst:2014 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:1982 +#: ../../library/typing.rst:2024 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -1833,61 +1838,61 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:2029 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2002 +#: ../../library/typing.rst:2044 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2009 +#: ../../library/typing.rst:2051 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2017 +#: ../../library/typing.rst:2059 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2035 +#: ../../library/typing.rst:2077 msgid "A ``TypedDict`` can be generic:" msgstr "" -#: ../../library/typing.rst:2045 +#: ../../library/typing.rst:2087 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2093 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2073 +#: ../../library/typing.rst:2115 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2076 +#: ../../library/typing.rst:2118 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2079 +#: ../../library/typing.rst:2121 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -1896,133 +1901,133 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2102 +#: ../../library/typing.rst:2144 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2106 +#: ../../library/typing.rst:2148 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2110 +#: ../../library/typing.rst:2152 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2114 +#: ../../library/typing.rst:2156 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2116 +#: ../../library/typing.rst:2158 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2121 +#: ../../library/typing.rst:2163 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2126 +#: ../../library/typing.rst:2168 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2130 +#: ../../library/typing.rst:2172 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2134 +#: ../../library/typing.rst:2176 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2138 +#: ../../library/typing.rst:2180 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2144 +#: ../../library/typing.rst:2186 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2148 +#: ../../library/typing.rst:2190 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2152 +#: ../../library/typing.rst:2194 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2158 +#: ../../library/typing.rst:2200 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2164 +#: ../../library/typing.rst:2206 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2168 +#: ../../library/typing.rst:2210 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2170 +#: ../../library/typing.rst:2212 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2177 +#: ../../library/typing.rst:2219 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2179 +#: ../../library/typing.rst:2221 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2182 +#: ../../library/typing.rst:2224 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2231 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2203 +#: ../../library/typing.rst:2245 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2205 +#: ../../library/typing.rst:2247 msgid "Example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:2216 +#: ../../library/typing.rst:2258 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2221 +#: ../../library/typing.rst:2263 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -2032,59 +2037,59 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2229 +#: ../../library/typing.rst:2271 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2232 +#: ../../library/typing.rst:2274 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2240 +#: ../../library/typing.rst:2282 msgid "Reveal the inferred static type of an expression." msgstr "" -#: ../../library/typing.rst:2242 +#: ../../library/typing.rst:2284 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2248 +#: ../../library/typing.rst:2290 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2251 +#: ../../library/typing.rst:2293 msgid "" "The function returns its argument unchanged, which allows using it within an " "expression::" msgstr "" -#: ../../library/typing.rst:2256 +#: ../../library/typing.rst:2298 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing`` allows your " "code to run without runtime errors and communicates intent more clearly." msgstr "" -#: ../../library/typing.rst:2261 +#: ../../library/typing.rst:2303 msgid "" "At runtime, this function prints the runtime type of its argument to stderr " "and returns it unchanged::" msgstr "" -#: ../../library/typing.rst:2273 +#: ../../library/typing.rst:2315 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2318 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -2093,19 +2098,19 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2283 +#: ../../library/typing.rst:2325 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2299 +#: ../../library/typing.rst:2341 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2308 +#: ../../library/typing.rst:2350 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2361 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:2450 +#: ../../library/typing.rst:2492 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -2310,32 +2315,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2499 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:2465 +#: ../../library/typing.rst:2507 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:2467 +#: ../../library/typing.rst:2509 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2474 +#: ../../library/typing.rst:2516 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:2476 +#: ../../library/typing.rst:2518 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:2501 +#: ../../library/typing.rst:2543 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -2345,11 +2350,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2554 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2514 +#: ../../library/typing.rst:2556 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -2357,48 +2362,48 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2562 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:2524 +#: ../../library/typing.rst:2566 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2526 +#: ../../library/typing.rst:2568 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2531 +#: ../../library/typing.rst:2573 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2533 +#: ../../library/typing.rst:2575 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:2544 +#: ../../library/typing.rst:2586 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2548 +#: ../../library/typing.rst:2590 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2552 +#: ../../library/typing.rst:2594 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2555 +#: ../../library/typing.rst:2597 msgid "" "This is often the same as ``obj.__annotations__``. In addition, forward " "references encoded as string literals are handled by evaluating them in " @@ -2407,41 +2412,42 @@ msgid "" "__mro__`` in reverse order." msgstr "" -#: ../../library/typing.rst:2561 +#: ../../library/typing.rst:2603 msgid "" "The function recursively replaces all ``Annotated[T, ...]`` with ``T``, " "unless ``include_extras`` is set to ``True`` (see :class:`Annotated` for " "more information). For example:" msgstr "" -#: ../../library/typing.rst:2578 +#: ../../library/typing.rst:2620 msgid "" ":func:`get_type_hints` does not work with imported :ref:`type aliases ` that include forward references. Enabling postponed evaluation of " "annotations (:pep:`563`) may remove the need for most forward references." msgstr "" -#: ../../library/typing.rst:2583 +#: ../../library/typing.rst:2625 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" -"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:`Annotated` 的文件。" +"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" +"`Annotated` 的文件。" -#: ../../library/typing.rst:2587 +#: ../../library/typing.rst:2629 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:2594 +#: ../../library/typing.rst:2636 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:2597 +#: ../../library/typing.rst:2639 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -2449,17 +2455,17 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:2603 ../../library/typing.rst:2626 +#: ../../library/typing.rst:2645 ../../library/typing.rst:2668 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:2618 +#: ../../library/typing.rst:2660 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:2621 +#: ../../library/typing.rst:2663 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -2467,40 +2473,40 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:2638 +#: ../../library/typing.rst:2680 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2659 +#: ../../library/typing.rst:2701 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:2661 +#: ../../library/typing.rst:2703 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:2666 +#: ../../library/typing.rst:2708 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:2673 +#: ../../library/typing.rst:2715 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:2677 +#: ../../library/typing.rst:2719 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:2688 +#: ../../library/typing.rst:2730 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2508,7 +2514,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2695 +#: ../../library/typing.rst:2737 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -2516,11 +2522,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:2706 +#: ../../library/typing.rst:2748 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2750 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -2529,7 +2535,7 @@ msgid "" "existing classes were enhanced to support ``[]``." msgstr "" -#: ../../library/typing.rst:2714 +#: ../../library/typing.rst:2756 msgid "" "The redundant types are deprecated as of Python 3.9 but no deprecation " "warnings are issued by the interpreter. It is expected that type checkers " @@ -2537,7 +2543,7 @@ msgid "" "or newer." msgstr "" -#: ../../library/typing.rst:2719 +#: ../../library/typing.rst:2761 msgid "" "The deprecated types will be removed from the :mod:`typing` module no sooner " "than the first Python version released 5 years after the release of Python " @@ -2545,148 +2551,160 @@ msgid "" "Collections*." msgstr "" -#: ../../library/typing.rst:2726 +#: ../../library/typing.rst:2768 msgid "Aliases to built-in types" msgstr "" -#: ../../library/typing.rst:2730 +#: ../../library/typing.rst:2772 msgid "Deprecated alias to :class:`dict`." msgstr "" -#: ../../library/typing.rst:2732 +#: ../../library/typing.rst:2774 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Mapping` rather than to use :class:`dict` " "or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:2736 ../../library/typing.rst:2954 +#: ../../library/typing.rst:2778 ../../library/typing.rst:3005 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:2741 +#: ../../library/typing.rst:2783 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2789 msgid "Deprecated alias to :class:`list`." msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2791 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Sequence` or :class:`Iterable` rather than " "to use :class:`list` or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:2753 +#: ../../library/typing.rst:2795 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:2763 +#: ../../library/typing.rst:2805 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2769 +#: ../../library/typing.rst:2811 msgid "Deprecated alias to :class:`builtins.set `." msgstr "" -#: ../../library/typing.rst:2771 +#: ../../library/typing.rst:2813 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`AbstractSet` rather than to use :class:`set` " "or :class:`!typing.Set`." msgstr "" -#: ../../library/typing.rst:2775 +#: ../../library/typing.rst:2817 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2781 +#: ../../library/typing.rst:2823 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "" -#: ../../library/typing.rst:2783 +#: ../../library/typing.rst:2825 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2788 -msgid ":data:`Tuple` is a special form." +#: ../../library/typing.rst:2832 +msgid "Deprecated alias for :class:`tuple`." msgstr "" -#: ../../library/typing.rst:2793 +#: ../../library/typing.rst:2834 +msgid "" +":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" +"`annotating-tuples` for more details." +msgstr "" + +#: ../../library/typing.rst:2837 +msgid "" +":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." +msgstr "" + +#: ../../library/typing.rst:2844 msgid "Aliases to types in :mod:`collections`" msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:2848 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "" -#: ../../library/typing.rst:2801 +#: ../../library/typing.rst:2852 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2807 +#: ../../library/typing.rst:2858 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2862 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2817 +#: ../../library/typing.rst:2868 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "" -#: ../../library/typing.rst:2822 +#: ../../library/typing.rst:2873 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2828 +#: ../../library/typing.rst:2879 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "" -#: ../../library/typing.rst:2833 +#: ../../library/typing.rst:2884 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2839 +#: ../../library/typing.rst:2890 msgid "Deprecated alias to :class:`collections.deque`." msgstr "" -#: ../../library/typing.rst:2844 +#: ../../library/typing.rst:2895 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2851 +#: ../../library/typing.rst:2902 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:2856 +#: ../../library/typing.rst:2907 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:2859 +#: ../../library/typing.rst:2910 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -2694,367 +2712,367 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:2867 +#: ../../library/typing.rst:2918 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2919 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2874 +#: ../../library/typing.rst:2925 msgid "Deprecated alias for :class:`str`." msgstr "" -#: ../../library/typing.rst:2876 +#: ../../library/typing.rst:2927 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:2880 +#: ../../library/typing.rst:2931 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:2888 +#: ../../library/typing.rst:2939 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:2898 +#: ../../library/typing.rst:2949 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:2902 +#: ../../library/typing.rst:2953 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "" -#: ../../library/typing.rst:2904 +#: ../../library/typing.rst:2955 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2910 +#: ../../library/typing.rst:2961 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:2914 +#: ../../library/typing.rst:2965 msgid "" "Prefer ``typing_extensions.Buffer``, or a union like ``bytes | bytearray | " "memoryview``." msgstr "" -#: ../../library/typing.rst:2918 +#: ../../library/typing.rst:2969 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "" -#: ../../library/typing.rst:2922 +#: ../../library/typing.rst:2973 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2928 +#: ../../library/typing.rst:2979 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "" -#: ../../library/typing.rst:2930 +#: ../../library/typing.rst:2981 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2936 +#: ../../library/typing.rst:2987 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "" -#: ../../library/typing.rst:2938 +#: ../../library/typing.rst:2989 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2944 +#: ../../library/typing.rst:2995 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "" -#: ../../library/typing.rst:2946 +#: ../../library/typing.rst:2997 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2952 +#: ../../library/typing.rst:3003 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "" -#: ../../library/typing.rst:2959 +#: ../../library/typing.rst:3010 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2965 +#: ../../library/typing.rst:3016 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "" -#: ../../library/typing.rst:2967 +#: ../../library/typing.rst:3018 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2973 +#: ../../library/typing.rst:3024 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "" -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:3026 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2982 +#: ../../library/typing.rst:3033 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "" -#: ../../library/typing.rst:2984 +#: ../../library/typing.rst:3035 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2991 +#: ../../library/typing.rst:3042 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "" -#: ../../library/typing.rst:2993 +#: ../../library/typing.rst:3044 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2999 +#: ../../library/typing.rst:3050 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "" -#: ../../library/typing.rst:3001 +#: ../../library/typing.rst:3052 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3007 +#: ../../library/typing.rst:3058 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "" -#: ../../library/typing.rst:3009 +#: ../../library/typing.rst:3060 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3016 +#: ../../library/typing.rst:3067 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3020 +#: ../../library/typing.rst:3071 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "" -#: ../../library/typing.rst:3022 +#: ../../library/typing.rst:3073 msgid "" "The variance and order of type variables correspond to those of :class:" "`Generator`, for example::" msgstr "" -#: ../../library/typing.rst:3033 +#: ../../library/typing.rst:3084 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3039 +#: ../../library/typing.rst:3090 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "" -#: ../../library/typing.rst:3041 +#: ../../library/typing.rst:3092 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:3050 +#: ../../library/typing.rst:3101 msgid "" "Unlike normal generators, async generators cannot return a value, so there " "is no ``ReturnType`` type parameter. As with :class:`Generator`, the " "``SendType`` behaves contravariantly." msgstr "" -#: ../../library/typing.rst:3054 +#: ../../library/typing.rst:3105 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3062 +#: ../../library/typing.rst:3113 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3072 +#: ../../library/typing.rst:3123 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3079 +#: ../../library/typing.rst:3130 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "" -#: ../../library/typing.rst:3083 +#: ../../library/typing.rst:3134 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3089 +#: ../../library/typing.rst:3140 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "" -#: ../../library/typing.rst:3093 +#: ../../library/typing.rst:3144 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3099 +#: ../../library/typing.rst:3150 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "" -#: ../../library/typing.rst:3103 +#: ../../library/typing.rst:3154 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3110 +#: ../../library/typing.rst:3161 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3114 +#: ../../library/typing.rst:3165 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "" -#: ../../library/typing.rst:3116 +#: ../../library/typing.rst:3167 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3122 +#: ../../library/typing.rst:3173 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "" -#: ../../library/typing.rst:3124 +#: ../../library/typing.rst:3175 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3130 +#: ../../library/typing.rst:3181 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "" -#: ../../library/typing.rst:3132 +#: ../../library/typing.rst:3183 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:3141 +#: ../../library/typing.rst:3192 msgid "" "Note that unlike many other generics in the typing module, the ``SendType`` " "of :class:`Generator` behaves contravariantly, not covariantly or " "invariantly." msgstr "" -#: ../../library/typing.rst:3145 +#: ../../library/typing.rst:3196 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3153 +#: ../../library/typing.rst:3204 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3212 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3167 +#: ../../library/typing.rst:3218 msgid "Alias to :class:`collections.abc.Hashable`." msgstr "" -#: ../../library/typing.rst:3171 +#: ../../library/typing.rst:3222 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "" -#: ../../library/typing.rst:3173 +#: ../../library/typing.rst:3224 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3179 +#: ../../library/typing.rst:3230 msgid "Alias to :class:`collections.abc.Sized`." msgstr "" -#: ../../library/typing.rst:3184 +#: ../../library/typing.rst:3235 msgid "Aliases to :mod:`contextlib` ABCs" msgstr "" -#: ../../library/typing.rst:3188 +#: ../../library/typing.rst:3239 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3244 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3200 +#: ../../library/typing.rst:3251 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3205 +#: ../../library/typing.rst:3256 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3211 +#: ../../library/typing.rst:3262 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3213 +#: ../../library/typing.rst:3264 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -3062,74 +3080,74 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3269 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3269 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3269 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3269 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3271 msgid "``typing.io`` and ``typing.re`` submodules" msgstr "" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3271 msgid "3.8" msgstr "3.8" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3271 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3271 msgid ":issue:`38291`" msgstr ":issue:`38291`" -#: ../../library/typing.rst:3223 +#: ../../library/typing.rst:3274 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3223 ../../library/typing.rst:3226 +#: ../../library/typing.rst:3274 ../../library/typing.rst:3277 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3223 ../../library/typing.rst:3228 +#: ../../library/typing.rst:3274 ../../library/typing.rst:3279 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3223 +#: ../../library/typing.rst:3274 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3226 +#: ../../library/typing.rst:3277 msgid "``typing.ByteString``" msgstr "``typing.Text``" -#: ../../library/typing.rst:3226 +#: ../../library/typing.rst:3277 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3226 +#: ../../library/typing.rst:3277 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3228 +#: ../../library/typing.rst:3279 msgid "``typing.Text``" msgstr "``typing.Text``" -#: ../../library/typing.rst:3228 +#: ../../library/typing.rst:3279 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3228 +#: ../../library/typing.rst:3279 msgid ":gh:`92332`" msgstr ":gh:`92332`" From 7f59396fb521f9092aedd5c724b434db26b2e2dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 25 Jun 2023 00:23:26 +0000 Subject: [PATCH 2/9] sync with cpython dbe416b8 --- c-api/dict.po | 51 +++++++++--------- c-api/object.po | 138 ++++++++++++++++++++++++------------------------ 2 files changed, 95 insertions(+), 94 deletions(-) diff --git a/c-api/dict.po b/c-api/dict.po index 2ab6086ecb..8673ea6315 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-25 00:20+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -117,40 +117,41 @@ msgid "" "``NULL`` if the key *key* is not present, but *without* setting an exception." msgstr "" -#: ../../c-api/dict.rst:101 +#: ../../c-api/dict.rst:103 msgid "" -"Note that exceptions which occur while calling :meth:`__hash__` and :meth:" -"`__eq__` methods will get suppressed. To get error reporting use :c:func:" -"`PyDict_GetItemWithError()` instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" +"`~object.__eq__` methods are silently ignored. Prefer the :c:func:" +"`PyDict_GetItemWithError` function instead." msgstr "" -#: ../../c-api/dict.rst:105 +#: ../../c-api/dict.rst:107 msgid "" "Calling this API without :term:`GIL` held had been allowed for historical " "reason. It is no longer allowed." msgstr "" -#: ../../c-api/dict.rst:112 +#: ../../c-api/dict.rst:114 msgid "" "Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. " "Return ``NULL`` **with** an exception set if an exception occurred. Return " "``NULL`` **without** an exception set if the key wasn't present." msgstr "" -#: ../../c-api/dict.rst:120 +#: ../../c-api/dict.rst:122 msgid "" "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" "expr:`const char*`, rather than a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:123 +#: ../../c-api/dict.rst:127 msgid "" -"Note that exceptions which occur while calling :meth:`__hash__` and :meth:" -"`__eq__` methods and creating a temporary string object will get suppressed. " -"To get error reporting use :c:func:`PyDict_GetItemWithError()` instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" +"`~object.__eq__` methods or while creating the temporary :class:`str` object " +"are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` " +"function with your own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" -#: ../../c-api/dict.rst:131 +#: ../../c-api/dict.rst:136 msgid "" "This is the same as the Python-level :meth:`dict.setdefault`. If present, " "it returns the value corresponding to *key* from the dictionary *p*. If the " @@ -160,29 +161,29 @@ msgid "" "the insertion." msgstr "" -#: ../../c-api/dict.rst:141 +#: ../../c-api/dict.rst:146 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." msgstr "" -#: ../../c-api/dict.rst:146 +#: ../../c-api/dict.rst:151 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." msgstr "" -#: ../../c-api/dict.rst:151 +#: ../../c-api/dict.rst:156 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." msgstr "" -#: ../../c-api/dict.rst:159 +#: ../../c-api/dict.rst:164 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." msgstr "" -#: ../../c-api/dict.rst:165 +#: ../../c-api/dict.rst:170 msgid "" "Iterate over all key-value pairs in the dictionary *p*. The :c:type:" "`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " @@ -196,21 +197,21 @@ msgid "" "structure is sparse, the offsets are not consecutive." msgstr "" -#: ../../c-api/dict.rst:176 +#: ../../c-api/dict.rst:181 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../c-api/dict.rst:186 +#: ../../c-api/dict.rst:191 msgid "" "The dictionary *p* should not be mutated during iteration. It is safe to " "modify the values of the keys as you iterate over the dictionary, but only " "so long as the set of keys does not change. For example::" msgstr "" -#: ../../c-api/dict.rst:211 +#: ../../c-api/dict.rst:216 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -220,7 +221,7 @@ msgid "" "or ``-1`` if an exception was raised." msgstr "" -#: ../../c-api/dict.rst:221 +#: ../../c-api/dict.rst:226 msgid "" "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." "update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " @@ -229,7 +230,7 @@ msgid "" "exception was raised." msgstr "" -#: ../../c-api/dict.rst:230 +#: ../../c-api/dict.rst:235 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -250,10 +251,10 @@ msgstr "dictionary(字典)" msgid "PyUnicode_FromString()" msgstr "PyUnicode_FromString()" -#: ../../c-api/dict.rst:157 +#: ../../c-api/dict.rst:162 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/dict.rst:157 +#: ../../c-api/dict.rst:162 msgid "len" msgstr "len" diff --git a/c-api/object.po b/c-api/object.po index deaff07cd2..8ddc04da21 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-25 00:20+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,43 +43,43 @@ msgid "" "the object is written instead of the :func:`repr`." msgstr "" -#: ../../c-api/object.rst:32 ../../c-api/object.rst:43 +#: ../../c-api/object.rst:32 ../../c-api/object.rst:45 msgid "" "Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " "This is equivalent to the Python expression ``hasattr(o, attr_name)``. This " "function always succeeds." msgstr "" -#: ../../c-api/object.rst:36 +#: ../../c-api/object.rst:38 msgid "" -"Note that exceptions which occur while calling :meth:`__getattr__` and :meth:" -"`__getattribute__` methods will get suppressed. To get error reporting use :" -"c:func:`PyObject_GetAttr()` instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" +"`~object.__getattribute__` methods are silently ignored. For proper error " +"handling, use :c:func:`PyObject_GetAttr` instead." msgstr "" -#: ../../c-api/object.rst:47 +#: ../../c-api/object.rst:51 msgid "" -"Note that exceptions which occur while calling :meth:`__getattr__` and :meth:" -"`__getattribute__` methods and creating a temporary string object will get " -"suppressed. To get error reporting use :c:func:`PyObject_GetAttrString()` " -"instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" +"`~object.__getattribute__` methods or while creating the temporary :class:" +"`str` object are silently ignored. For proper error handling, use :c:func:" +"`PyObject_GetAttrString` instead." msgstr "" -#: ../../c-api/object.rst:55 +#: ../../c-api/object.rst:59 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: ../../c-api/object.rst:62 +#: ../../c-api/object.rst:66 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: ../../c-api/object.rst:69 +#: ../../c-api/object.rst:73 msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " @@ -89,27 +89,27 @@ msgid "" "descriptors don't. Otherwise, an :exc:`AttributeError` is raised." msgstr "" -#: ../../c-api/object.rst:79 ../../c-api/object.rst:91 +#: ../../c-api/object.rst:83 ../../c-api/object.rst:95 msgid "" "Set the value of the attribute named *attr_name*, for object *o*, to the " "value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " "success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -#: ../../c-api/object.rst:84 +#: ../../c-api/object.rst:88 msgid "" "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -#: ../../c-api/object.rst:96 +#: ../../c-api/object.rst:100 msgid "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -#: ../../c-api/object.rst:102 +#: ../../c-api/object.rst:106 msgid "" "Generic attribute setter and deleter function that is meant to be put into a " "type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " @@ -121,19 +121,19 @@ msgid "" "returned." msgstr "" -#: ../../c-api/object.rst:114 ../../c-api/object.rst:120 +#: ../../c-api/object.rst:118 ../../c-api/object.rst:124 msgid "" "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " "failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -#: ../../c-api/object.rst:126 +#: ../../c-api/object.rst:130 msgid "" "A generic implementation for the getter of a ``__dict__`` descriptor. It " "creates the dictionary if necessary." msgstr "" -#: ../../c-api/object.rst:129 +#: ../../c-api/object.rst:133 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -142,30 +142,30 @@ msgid "" "the object." msgstr "" -#: ../../c-api/object.rst:135 +#: ../../c-api/object.rst:139 msgid "On failure, returns ``NULL`` with an exception set." msgstr "" -#: ../../c-api/object.rst:142 +#: ../../c-api/object.rst:146 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: ../../c-api/object.rst:150 +#: ../../c-api/object.rst:154 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -#: ../../c-api/object.rst:153 +#: ../../c-api/object.rst:157 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" -#: ../../c-api/object.rst:160 +#: ../../c-api/object.rst:164 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`, :const:" @@ -176,7 +176,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/object.rst:170 +#: ../../c-api/object.rst:174 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`, :const:" @@ -187,26 +187,26 @@ msgid "" "to *opid*." msgstr "" -#: ../../c-api/object.rst:179 +#: ../../c-api/object.rst:183 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`." msgstr "" -#: ../../c-api/object.rst:184 +#: ../../c-api/object.rst:188 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" -#: ../../c-api/object.rst:187 +#: ../../c-api/object.rst:191 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" -#: ../../c-api/object.rst:195 +#: ../../c-api/object.rst:199 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -214,13 +214,13 @@ msgid "" "function." msgstr "" -#: ../../c-api/object.rst:199 ../../c-api/object.rst:223 +#: ../../c-api/object.rst:203 ../../c-api/object.rst:227 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/object.rst:207 +#: ../../c-api/object.rst:211 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " "but escape the non-ASCII characters in the string returned by :c:func:" @@ -229,7 +229,7 @@ msgid "" "Called by the :func:`ascii` built-in function." msgstr "" -#: ../../c-api/object.rst:218 +#: ../../c-api/object.rst:222 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -237,7 +237,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: ../../c-api/object.rst:232 +#: ../../c-api/object.rst:236 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -246,20 +246,20 @@ msgid "" "bytes object." msgstr "" -#: ../../c-api/object.rst:241 +#: ../../c-api/object.rst:245 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: ../../c-api/object.rst:244 ../../c-api/object.rst:263 +#: ../../c-api/object.rst:248 ../../c-api/object.rst:267 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: ../../c-api/object.rst:248 +#: ../../c-api/object.rst:252 msgid "" "If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " @@ -267,52 +267,52 @@ msgid "" "e. contained in ``cls.__mro__``." msgstr "" -#: ../../c-api/object.rst:253 +#: ../../c-api/object.rst:257 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " "a :attr:`__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:260 +#: ../../c-api/object.rst:264 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: ../../c-api/object.rst:267 +#: ../../c-api/object.rst:271 msgid "" "If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -#: ../../c-api/object.rst:271 +#: ../../c-api/object.rst:275 msgid "" "An instance *inst* can override what is considered its class by having a :" "attr:`__class__` attribute." msgstr "" -#: ../../c-api/object.rst:274 +#: ../../c-api/object.rst:278 msgid "" "An object *cls* can override if it is considered a class, and what its base " "classes are, by having a :attr:`__bases__` attribute (which must be a tuple " "of base classes)." msgstr "" -#: ../../c-api/object.rst:283 +#: ../../c-api/object.rst:287 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: ../../c-api/object.rst:286 +#: ../../c-api/object.rst:290 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/object.rst:293 +#: ../../c-api/object.rst:297 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " @@ -320,21 +320,21 @@ msgid "" "that it is not hashable." msgstr "" -#: ../../c-api/object.rst:301 +#: ../../c-api/object.rst:305 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:308 +#: ../../c-api/object.rst:312 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:317 +#: ../../c-api/object.rst:321 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -345,13 +345,13 @@ msgid "" "incremented reference count is needed." msgstr "" -#: ../../c-api/object.rst:328 +#: ../../c-api/object.rst:332 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: ../../c-api/object.rst:337 +#: ../../c-api/object.rst:341 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -359,7 +359,7 @@ msgid "" "``len(o)``." msgstr "" -#: ../../c-api/object.rst:344 +#: ../../c-api/object.rst:348 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -368,26 +368,26 @@ msgid "" "defaultvalue)``." msgstr "" -#: ../../c-api/object.rst:354 +#: ../../c-api/object.rst:358 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: ../../c-api/object.rst:360 +#: ../../c-api/object.rst:364 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: ../../c-api/object.rst:368 +#: ../../c-api/object.rst:372 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: ../../c-api/object.rst:374 +#: ../../c-api/object.rst:378 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -397,7 +397,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:383 +#: ../../c-api/object.rst:387 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -405,7 +405,7 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:391 +#: ../../c-api/object.rst:395 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -414,40 +414,40 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:193 ../../c-api/object.rst:205 -#: ../../c-api/object.rst:230 ../../c-api/object.rst:281 -#: ../../c-api/object.rst:315 ../../c-api/object.rst:335 +#: ../../c-api/object.rst:197 ../../c-api/object.rst:209 +#: ../../c-api/object.rst:234 ../../c-api/object.rst:285 +#: ../../c-api/object.rst:319 ../../c-api/object.rst:339 msgid "built-in function" msgstr "bulit-in function(內建函式)" -#: ../../c-api/object.rst:193 +#: ../../c-api/object.rst:197 msgid "repr" msgstr "repr" -#: ../../c-api/object.rst:205 +#: ../../c-api/object.rst:209 msgid "ascii" msgstr "ascii" -#: ../../c-api/object.rst:213 +#: ../../c-api/object.rst:217 msgid "string" msgstr "string(字串)" -#: ../../c-api/object.rst:213 +#: ../../c-api/object.rst:217 msgid "PyObject_Str (C function)" msgstr "PyObject_Str(C 函式)" -#: ../../c-api/object.rst:230 +#: ../../c-api/object.rst:234 msgid "bytes" msgstr "bytes(位元組)" -#: ../../c-api/object.rst:281 +#: ../../c-api/object.rst:285 msgid "hash" msgstr "hash(雜湊)" -#: ../../c-api/object.rst:315 +#: ../../c-api/object.rst:319 msgid "type" msgstr "type(型別)" -#: ../../c-api/object.rst:335 +#: ../../c-api/object.rst:339 msgid "len" msgstr "len" From 2268c7b26199e28c9eb98c65f600a4220bf3376c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 25 Jun 2023 19:32:05 +0000 Subject: [PATCH 3/9] sync with cpython 1bbf60dc --- library/sqlite3.po | 468 ++++++++++++++++++++++----------------------- 1 file changed, 234 insertions(+), 234 deletions(-) diff --git a/library/sqlite3.po b/library/sqlite3.po index df7d1bd352..f58e35fd8c 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-12 00:15+0000\n" +"POT-Creation-Date: 2023-06-25 19:30+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -400,15 +400,15 @@ msgstr "" #: ../../library/sqlite3.rst:397 msgid "" -"Register an *adapter* callable to adapt the Python type *type* into an " -"SQLite type. The adapter is called with a Python object of type *type* as " +"Register an *adapter* :term:`callable` to adapt the Python type *type* into " +"an SQLite type. The adapter is called with a Python object of type *type* as " "its sole argument, and must return a value of a :ref:`type that SQLite " "natively understands `." msgstr "" #: ../../library/sqlite3.rst:405 msgid "" -"Register the *converter* callable to convert SQLite objects of type " +"Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " "for all SQLite values of type *typename*; it is passed a :class:`bytes` " "object and should return an object of the desired Python type. Consult the " @@ -457,8 +457,8 @@ msgstr "" #: ../../library/sqlite3.rst:462 msgid "" -"Flags that should be returned by the *authorizer_callback* callable passed " -"to :meth:`Connection.set_authorizer`, to indicate whether:" +"Flags that should be returned by the *authorizer_callback* :term:`callable` " +"passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" #: ../../library/sqlite3.rst:465 @@ -630,8 +630,8 @@ msgstr "" #: ../../library/sqlite3.rst:563 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " -"single optional parameter *factory*. If supplied, this must be a callable " -"returning an instance of :class:`Cursor` or its subclasses." +"single optional parameter *factory*. If supplied, this must be a :term:" +"`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" #: ../../library/sqlite3.rst:570 @@ -730,9 +730,9 @@ msgstr "" #: ../../library/sqlite3.rst:649 msgid "" -"A callable that is called when the SQL function is invoked. The callable " -"must return :ref:`a type natively supported by SQLite `. Set " -"to ``None`` to remove an existing SQL function." +"A :term:`callable` that is called when the SQL function is invoked. The " +"callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" #: ../../library/sqlite3.rst:656 @@ -751,9 +751,9 @@ msgid "The *deterministic* parameter." msgstr "新增 *deterministic* 參數。" #: ../../library/sqlite3.rst:667 ../../library/sqlite3.rst:705 -#: ../../library/sqlite3.rst:768 ../../library/sqlite3.rst:1019 -#: ../../library/sqlite3.rst:1256 ../../library/sqlite3.rst:1383 -#: ../../library/sqlite3.rst:1411 +#: ../../library/sqlite3.rst:768 ../../library/sqlite3.rst:1020 +#: ../../library/sqlite3.rst:1257 ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1412 msgid "Example:" msgstr "範例:" @@ -904,14 +904,14 @@ msgstr "" #: ../../library/sqlite3.rst:875 msgid "" -"Register callable *authorizer_callback* to be invoked for each attempt to " -"access a column of a table in the database. The callback should return one " -"of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:`SQLITE_IGNORE` to " -"signal how access to the column should be handled by the underlying SQLite " -"library." +"Register :term:`callable` *authorizer_callback* to be invoked for each " +"attempt to access a column of a table in the database. The callback should " +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" +"`SQLITE_IGNORE` to signal how access to the column should be handled by the " +"underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:881 +#: ../../library/sqlite3.rst:882 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -921,7 +921,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:888 +#: ../../library/sqlite3.rst:889 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -929,42 +929,42 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:892 +#: ../../library/sqlite3.rst:893 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:894 +#: ../../library/sqlite3.rst:895 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:900 +#: ../../library/sqlite3.rst:901 msgid "" -"Register callable *progress_handler* to be invoked for every *n* " +"Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " "get called from SQLite during long-running operations, for example to update " "a GUI." msgstr "" -#: ../../library/sqlite3.rst:905 +#: ../../library/sqlite3.rst:906 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:908 +#: ../../library/sqlite3.rst:909 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise an :exc:`OperationalError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:915 +#: ../../library/sqlite3.rst:916 msgid "" -"Register callable *trace_callback* to be invoked for each SQL statement that " -"is actually executed by the SQLite backend." +"Register :term:`callable` *trace_callback* to be invoked for each SQL " +"statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:918 +#: ../../library/sqlite3.rst:919 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -974,18 +974,18 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:926 +#: ../../library/sqlite3.rst:927 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:929 +#: ../../library/sqlite3.rst:930 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:939 +#: ../../library/sqlite3.rst:940 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -994,7 +994,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:948 +#: ../../library/sqlite3.rst:949 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1003,7 +1003,7 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:955 +#: ../../library/sqlite3.rst:956 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1011,18 +1011,18 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:959 +#: ../../library/sqlite3.rst:960 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1002 +#: ../../library/sqlite3.rst:1003 msgid "" "Load an SQLite extension from a shared library located at *path*. Enable " "extension loading with :meth:`enable_load_extension` before calling this " "method." msgstr "" -#: ../../library/sqlite3.rst:1006 +#: ../../library/sqlite3.rst:1007 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1030,85 +1030,85 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1010 +#: ../../library/sqlite3.rst:1011 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1015 +#: ../../library/sqlite3.rst:1016 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1033 +#: ../../library/sqlite3.rst:1034 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1035 +#: ../../library/sqlite3.rst:1036 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1038 +#: ../../library/sqlite3.rst:1039 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1041 +#: ../../library/sqlite3.rst:1042 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1047 +#: ../../library/sqlite3.rst:1048 msgid "" -"If set to a callable, it is invoked with three integer arguments for every " -"backup iteration: the *status* of the last iteration, the *remaining* number " -"of pages still to be copied, and the *total* number of pages. Defaults to " -"``None``." +"If set to a :term:`callable`, it is invoked with three integer arguments for " +"every backup iteration: the *status* of the last iteration, the *remaining* " +"number of pages still to be copied, and the *total* number of pages. " +"Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1056 +#: ../../library/sqlite3.rst:1057 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1063 +#: ../../library/sqlite3.rst:1064 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1067 +#: ../../library/sqlite3.rst:1068 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1086 +#: ../../library/sqlite3.rst:1087 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1098 +#: ../../library/sqlite3.rst:1099 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1100 +#: ../../library/sqlite3.rst:1101 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1105 ../../library/sqlite3.rst:1142 +#: ../../library/sqlite3.rst:1106 ../../library/sqlite3.rst:1143 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1108 +#: ../../library/sqlite3.rst:1109 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1128 +#: ../../library/sqlite3.rst:1129 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1116,22 +1116,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1133 +#: ../../library/sqlite3.rst:1134 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1136 +#: ../../library/sqlite3.rst:1137 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1145 +#: ../../library/sqlite3.rst:1146 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1162 +#: ../../library/sqlite3.rst:1163 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1140,17 +1140,17 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1168 +#: ../../library/sqlite3.rst:1169 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1176 +#: ../../library/sqlite3.rst:1177 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1184 +#: ../../library/sqlite3.rst:1185 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1158,47 +1158,47 @@ msgid "" "serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1190 +#: ../../library/sqlite3.rst:1191 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1193 +#: ../../library/sqlite3.rst:1194 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1197 +#: ../../library/sqlite3.rst:1198 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1201 +#: ../../library/sqlite3.rst:1202 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1204 +#: ../../library/sqlite3.rst:1205 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1209 +#: ../../library/sqlite3.rst:1210 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1216 +#: ../../library/sqlite3.rst:1217 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1219 +#: ../../library/sqlite3.rst:1220 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1226 +#: ../../library/sqlite3.rst:1227 msgid "" "This attribute controls the :ref:`transaction handling ` performed by :mod:`!sqlite3`. If set to ``None``, " @@ -1208,13 +1208,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1234 +#: ../../library/sqlite3.rst:1235 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1239 +#: ../../library/sqlite3.rst:1240 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1223,30 +1223,30 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1246 ../../library/sqlite3.rst:1538 -#: ../../library/sqlite3.rst:1561 +#: ../../library/sqlite3.rst:1247 ../../library/sqlite3.rst:1539 +#: ../../library/sqlite3.rst:1562 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "" -#: ../../library/sqlite3.rst:1250 +#: ../../library/sqlite3.rst:1251 msgid "" -"A callable that accepts a :class:`bytes` parameter and returns a text " -"representation of it. The callable is invoked for SQLite values with the " -"``TEXT`` data type. By default, this attribute is set to :class:`str`. If " -"you want to return ``bytes`` instead, set *text_factory* to ``bytes``." +"A :term:`callable` that accepts a :class:`bytes` parameter and returns a " +"text representation of it. The callable is invoked for SQLite values with " +"the ``TEXT`` data type. By default, this attribute is set to :class:`str`. " +"If you want to return ``bytes`` instead, set *text_factory* to ``bytes``." msgstr "" -#: ../../library/sqlite3.rst:1290 +#: ../../library/sqlite3.rst:1291 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1297 +#: ../../library/sqlite3.rst:1298 msgid "Cursor objects" msgstr "" -#: ../../library/sqlite3.rst:1299 +#: ../../library/sqlite3.rst:1300 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -1254,39 +1254,39 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1306 +#: ../../library/sqlite3.rst:1307 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1331 +#: ../../library/sqlite3.rst:1332 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1338 +#: ../../library/sqlite3.rst:1339 msgid "" "Execute SQL a single SQL statement, optionally binding Python values using :" "ref:`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1342 +#: ../../library/sqlite3.rst:1343 msgid "A single SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1345 +#: ../../library/sqlite3.rst:1346 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1352 +#: ../../library/sqlite3.rst:1353 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1355 +#: ../../library/sqlite3.rst:1356 msgid "" "If :attr:`~Connection.isolation_level` is not ``None``, *sql* is an " "``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is " @@ -1294,43 +1294,43 @@ msgid "" "*sql*." msgstr "" -#: ../../library/sqlite3.rst:1360 +#: ../../library/sqlite3.rst:1361 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1364 +#: ../../library/sqlite3.rst:1365 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1368 +#: ../../library/sqlite3.rst:1369 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1370 +#: ../../library/sqlite3.rst:1371 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1373 +#: ../../library/sqlite3.rst:1374 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1379 +#: ../../library/sqlite3.rst:1380 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statment." msgstr "" -#: ../../library/sqlite3.rst:1396 +#: ../../library/sqlite3.rst:1397 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1403 +#: ../../library/sqlite3.rst:1404 msgid "" "Execute the SQL statements in *sql_script*. If there is a pending " "transaction, an implicit ``COMMIT`` statement is executed first. No other " @@ -1338,24 +1338,24 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1409 +#: ../../library/sqlite3.rst:1410 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1427 +#: ../../library/sqlite3.rst:1428 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1435 +#: ../../library/sqlite3.rst:1436 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1438 +#: ../../library/sqlite3.rst:1439 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -1363,7 +1363,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1444 +#: ../../library/sqlite3.rst:1445 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1371,36 +1371,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1451 +#: ../../library/sqlite3.rst:1452 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1458 +#: ../../library/sqlite3.rst:1459 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1460 +#: ../../library/sqlite3.rst:1461 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1465 ../../library/sqlite3.rst:1469 +#: ../../library/sqlite3.rst:1466 ../../library/sqlite3.rst:1470 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1473 +#: ../../library/sqlite3.rst:1474 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1478 +#: ../../library/sqlite3.rst:1479 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -1408,18 +1408,18 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1492 +#: ../../library/sqlite3.rst:1493 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1496 +#: ../../library/sqlite3.rst:1497 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1500 +#: ../../library/sqlite3.rst:1501 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -1429,15 +1429,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1508 +#: ../../library/sqlite3.rst:1509 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1510 +#: ../../library/sqlite3.rst:1511 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1515 +#: ../../library/sqlite3.rst:1516 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -1447,7 +1447,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1526 +#: ../../library/sqlite3.rst:1527 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -1456,18 +1456,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1533 +#: ../../library/sqlite3.rst:1534 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1549 +#: ../../library/sqlite3.rst:1550 msgid "Row objects" msgstr "" -#: ../../library/sqlite3.rst:1553 +#: ../../library/sqlite3.rst:1554 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -1475,28 +1475,28 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1558 +#: ../../library/sqlite3.rst:1559 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1565 +#: ../../library/sqlite3.rst:1566 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1569 +#: ../../library/sqlite3.rst:1570 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:1576 +#: ../../library/sqlite3.rst:1577 msgid "Blob objects" msgstr "" -#: ../../library/sqlite3.rst:1582 +#: ../../library/sqlite3.rst:1583 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " "write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" @@ -1504,24 +1504,24 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1587 +#: ../../library/sqlite3.rst:1588 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1617 +#: ../../library/sqlite3.rst:1618 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1620 msgid "" "The blob will be unusable from this point onward. An :class:`~sqlite3." "Error` (or subclass) exception will be raised if any further operation is " "attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1625 +#: ../../library/sqlite3.rst:1626 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " @@ -1529,18 +1529,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1633 +#: ../../library/sqlite3.rst:1634 msgid "" "Write *data* to the blob at the current offset. This function cannot change " "the blob length. Writing beyond the end of the blob will raise :exc:" "`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1639 +#: ../../library/sqlite3.rst:1640 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1643 +#: ../../library/sqlite3.rst:1644 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :data:`os.SEEK_SET` (absolute blob positioning). Other " @@ -1548,26 +1548,26 @@ msgid "" "position) and :data:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1651 +#: ../../library/sqlite3.rst:1652 msgid "PrepareProtocol objects" msgstr "" -#: ../../library/sqlite3.rst:1655 +#: ../../library/sqlite3.rst:1656 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1663 +#: ../../library/sqlite3.rst:1664 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1665 +#: ../../library/sqlite3.rst:1666 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1669 +#: ../../library/sqlite3.rst:1670 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -1575,39 +1575,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1676 +#: ../../library/sqlite3.rst:1677 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1680 +#: ../../library/sqlite3.rst:1681 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1685 +#: ../../library/sqlite3.rst:1686 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1692 +#: ../../library/sqlite3.rst:1693 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1699 +#: ../../library/sqlite3.rst:1700 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1706 +#: ../../library/sqlite3.rst:1707 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -1615,14 +1615,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1713 +#: ../../library/sqlite3.rst:1714 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1719 +#: ../../library/sqlite3.rst:1720 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -1630,20 +1630,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1727 +#: ../../library/sqlite3.rst:1728 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1732 +#: ../../library/sqlite3.rst:1733 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1739 +#: ../../library/sqlite3.rst:1740 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " @@ -1651,7 +1651,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1746 +#: ../../library/sqlite3.rst:1747 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -1660,78 +1660,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1756 +#: ../../library/sqlite3.rst:1757 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1758 +#: ../../library/sqlite3.rst:1759 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1761 +#: ../../library/sqlite3.rst:1762 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1764 ../../library/sqlite3.rst:1781 +#: ../../library/sqlite3.rst:1765 ../../library/sqlite3.rst:1782 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1764 ../../library/sqlite3.rst:1781 +#: ../../library/sqlite3.rst:1765 ../../library/sqlite3.rst:1782 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1766 ../../library/sqlite3.rst:1783 +#: ../../library/sqlite3.rst:1767 ../../library/sqlite3.rst:1784 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1766 ../../library/sqlite3.rst:1783 +#: ../../library/sqlite3.rst:1767 ../../library/sqlite3.rst:1784 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1768 ../../library/sqlite3.rst:1785 +#: ../../library/sqlite3.rst:1769 ../../library/sqlite3.rst:1786 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1768 ../../library/sqlite3.rst:1785 +#: ../../library/sqlite3.rst:1769 ../../library/sqlite3.rst:1786 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1770 ../../library/sqlite3.rst:1787 +#: ../../library/sqlite3.rst:1771 ../../library/sqlite3.rst:1788 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1770 ../../library/sqlite3.rst:1787 +#: ../../library/sqlite3.rst:1771 ../../library/sqlite3.rst:1788 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1772 +#: ../../library/sqlite3.rst:1773 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1772 ../../library/sqlite3.rst:1789 +#: ../../library/sqlite3.rst:1773 ../../library/sqlite3.rst:1790 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1774 ../../library/sqlite3.rst:1792 +#: ../../library/sqlite3.rst:1775 ../../library/sqlite3.rst:1793 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1774 ../../library/sqlite3.rst:1792 +#: ../../library/sqlite3.rst:1775 ../../library/sqlite3.rst:1793 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1778 +#: ../../library/sqlite3.rst:1779 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1789 +#: ../../library/sqlite3.rst:1790 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1795 +#: ../../library/sqlite3.rst:1796 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -1740,42 +1740,42 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1805 +#: ../../library/sqlite3.rst:1806 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1807 +#: ../../library/sqlite3.rst:1808 msgid "" "There are default adapters for the date and datetime types in the datetime " "module. They will be sent as ISO dates/ISO timestamps to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1810 +#: ../../library/sqlite3.rst:1811 msgid "" "The default converters are registered under the name \"date\" for :class:" "`datetime.date` and under the name \"timestamp\" for :class:`datetime." "datetime`." msgstr "" -#: ../../library/sqlite3.rst:1814 +#: ../../library/sqlite3.rst:1815 msgid "" "This way, you can use date/timestamps from Python without any additional " "fiddling in most cases. The format of the adapters is also compatible with " "the experimental SQLite date/time functions." msgstr "" -#: ../../library/sqlite3.rst:1818 +#: ../../library/sqlite3.rst:1819 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1822 +#: ../../library/sqlite3.rst:1823 msgid "" "If a timestamp stored in SQLite has a fractional part longer than 6 numbers, " "its value will be truncated to microsecond precision by the timestamp " "converter." msgstr "" -#: ../../library/sqlite3.rst:1828 +#: ../../library/sqlite3.rst:1829 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1783,15 +1783,15 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1837 +#: ../../library/sqlite3.rst:1838 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:1842 +#: ../../library/sqlite3.rst:1843 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:1844 +#: ../../library/sqlite3.rst:1845 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -1799,7 +1799,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:1857 +#: ../../library/sqlite3.rst:1858 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -1807,7 +1807,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:1862 +#: ../../library/sqlite3.rst:1863 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -1818,24 +1818,24 @@ msgid "" "are ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:1899 +#: ../../library/sqlite3.rst:1900 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:1906 +#: ../../library/sqlite3.rst:1907 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:1908 +#: ../../library/sqlite3.rst:1909 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:1912 +#: ../../library/sqlite3.rst:1913 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -1845,11 +1845,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1925 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1927 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -1859,84 +1859,84 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1957 +#: ../../library/sqlite3.rst:1958 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:1959 +#: ../../library/sqlite3.rst:1960 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1989 +#: ../../library/sqlite3.rst:1990 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1991 +#: ../../library/sqlite3.rst:1992 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:1996 +#: ../../library/sqlite3.rst:1997 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:1999 +#: ../../library/sqlite3.rst:2000 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2004 +#: ../../library/sqlite3.rst:2005 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2013 +#: ../../library/sqlite3.rst:2014 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2017 +#: ../../library/sqlite3.rst:2018 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2018 +#: ../../library/sqlite3.rst:2019 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2019 +#: ../../library/sqlite3.rst:2020 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2023 +#: ../../library/sqlite3.rst:2024 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2074 +#: ../../library/sqlite3.rst:2075 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2076 +#: ../../library/sqlite3.rst:2077 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2138 +#: ../../library/sqlite3.rst:2139 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2140 +#: ../../library/sqlite3.rst:2141 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -1948,11 +1948,11 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:2181 +#: ../../library/sqlite3.rst:2182 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2183 +#: ../../library/sqlite3.rst:2184 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -1962,58 +1962,58 @@ msgid "" "exception, the transaction is rolled back." msgstr "" -#: ../../library/sqlite3.rst:2192 +#: ../../library/sqlite3.rst:2193 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, the context manager is a no-op." msgstr "" -#: ../../library/sqlite3.rst:2197 +#: ../../library/sqlite3.rst:2198 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection." msgstr "" -#: ../../library/sqlite3.rst:2230 +#: ../../library/sqlite3.rst:2231 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2232 +#: ../../library/sqlite3.rst:2233 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2234 +#: ../../library/sqlite3.rst:2235 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2243 +#: ../../library/sqlite3.rst:2244 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2253 +#: ../../library/sqlite3.rst:2254 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2267 +#: ../../library/sqlite3.rst:2268 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2276 +#: ../../library/sqlite3.rst:2277 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2278 +#: ../../library/sqlite3.rst:2279 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2283 +#: ../../library/sqlite3.rst:2284 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -2021,7 +2021,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2288 +#: ../../library/sqlite3.rst:2289 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -2029,51 +2029,51 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2298 +#: ../../library/sqlite3.rst:2299 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2313 +#: ../../library/sqlite3.rst:2314 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2322 +#: ../../library/sqlite3.rst:2323 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2332 +#: ../../library/sqlite3.rst:2333 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2343 +#: ../../library/sqlite3.rst:2344 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2358 +#: ../../library/sqlite3.rst:2359 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2366 +#: ../../library/sqlite3.rst:2367 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2371 +#: ../../library/sqlite3.rst:2372 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2373 +#: ../../library/sqlite3.rst:2374 msgid "" "The :mod:`!sqlite3` module does not adhere to the transaction handling " "recommended by :pep:`249`." msgstr "" -#: ../../library/sqlite3.rst:2376 +#: ../../library/sqlite3.rst:2377 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -2087,7 +2087,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2389 +#: ../../library/sqlite3.rst:2390 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -2097,27 +2097,27 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2397 +#: ../../library/sqlite3.rst:2398 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2401 +#: ../../library/sqlite3.rst:2402 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:1333 +#: ../../library/sqlite3.rst:1334 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1333 ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1334 ../../library/sqlite3.rst:1335 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1335 msgid ": (colon)" msgstr ": (冒號)" From d7b642bc66876d2d0dcf54e0bc1e625a39711632 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 27 Jun 2023 00:21:02 +0000 Subject: [PATCH 4/9] sync with cpython 97cf0291 --- library/dataclasses.po | 4 +- library/typing.po | 1040 ++++++++++++++++++++-------------------- 2 files changed, 522 insertions(+), 522 deletions(-) diff --git a/library/dataclasses.po b/library/dataclasses.po index 801367fba2..a8a4db9d6b 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-25 00:20+0000\n" +"POT-Creation-Date: 2023-06-27 00:19+0000\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1114,7 +1114,7 @@ msgid "" "dataclasses just use normal Python class creation they also share this " "behavior. There is no general way for Data Classes to detect this " "condition. Instead, the :func:`dataclass` decorator will raise a :exc:" -"`TypeError` if it detects an unhashable default parameter. The assumption " +"`ValueError` if it detects an unhashable default parameter. The assumption " "is that if a value is unhashable, it is mutable. This is a partial " "solution, but it does protect against many common errors." msgstr "" diff --git a/library/typing.po b/library/typing.po index ed19a42637..24d98a9ab7 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-24 00:19+0000\n" +"POT-Creation-Date: 2023-06-27 00:19+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -368,7 +368,7 @@ msgid "" "hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``." msgstr "" -#: ../../library/typing.rst:254 ../../library/typing.rst:2682 +#: ../../library/typing.rst:254 ../../library/typing.rst:2679 msgid "For example:" msgstr "舉例來說" @@ -379,7 +379,7 @@ msgid "" "arguments in the type hint: ``Callable[..., ReturnType]``." msgstr "" -#: ../../library/typing.rst:276 ../../library/typing.rst:962 +#: ../../library/typing.rst:276 ../../library/typing.rst:1008 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -390,7 +390,7 @@ msgid "" "ReturnType]`` respectively." msgstr "" -#: ../../library/typing.rst:284 ../../library/typing.rst:974 +#: ../../library/typing.rst:284 ../../library/typing.rst:1020 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -454,67 +454,95 @@ msgid "" msgstr "" #: ../../library/typing.rst:392 -msgid "User-defined generic types" +msgid "The type of class objects" msgstr "" #: ../../library/typing.rst:394 -msgid "A user-defined class can be defined as a generic class." +msgid "" +"A variable annotated with ``C`` may accept a value of type ``C``. In " +"contrast, a variable annotated with ``type[C]`` (or :class:`typing.Type[C] " +"`) may accept values that are classes themselves -- specifically, it " +"will accept the *class object* of ``C``. For example::" +msgstr "" + +#: ../../library/typing.rst:404 +msgid "Note that ``type[C]`` is covariant::" msgstr "" #: ../../library/typing.rst:420 msgid "" +"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" +"`type variables `, and unions of any of these types. For example::" +msgstr "" + +#: ../../library/typing.rst:432 +msgid "" +"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" +"ref:`metaclass hierarchy `." +msgstr "" + +#: ../../library/typing.rst:438 +msgid "User-defined generic types" +msgstr "" + +#: ../../library/typing.rst:440 +msgid "A user-defined class can be defined as a generic class." +msgstr "" + +#: ../../library/typing.rst:466 +msgid "" "``Generic[T]`` as a base class defines that the class ``LoggedVar`` takes a " "single type parameter ``T`` . This also makes ``T`` valid as a type within " "the class body." msgstr "" -#: ../../library/typing.rst:424 +#: ../../library/typing.rst:470 msgid "" "The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so " "that ``LoggedVar[T]`` is valid as a type::" msgstr "" -#: ../../library/typing.rst:433 +#: ../../library/typing.rst:479 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" -#: ../../library/typing.rst:445 +#: ../../library/typing.rst:491 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr "" -#: ../../library/typing.rst:456 +#: ../../library/typing.rst:502 msgid "You can use multiple inheritance with :class:`Generic`::" msgstr "" -#: ../../library/typing.rst:466 +#: ../../library/typing.rst:512 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "" -#: ../../library/typing.rst:476 +#: ../../library/typing.rst:522 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "" -#: ../../library/typing.rst:478 +#: ../../library/typing.rst:524 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " "but implicitly inherits from ``Iterable[Any]``:" msgstr "" -#: ../../library/typing.rst:489 +#: ../../library/typing.rst:535 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "" -#: ../../library/typing.rst:506 +#: ../../library/typing.rst:552 msgid ":class:`Generic` no longer has a custom metaclass." msgstr "" -#: ../../library/typing.rst:509 +#: ../../library/typing.rst:555 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``Generic[P]``. The behavior " @@ -524,7 +552,7 @@ msgid "" "used to substitute a :class:`ParamSpec`::" msgstr "" -#: ../../library/typing.rst:525 +#: ../../library/typing.rst:571 msgid "" "Furthermore, a generic with only one parameter specification variable will " "accept parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also " @@ -532,20 +560,20 @@ msgid "" "converted to the former, so the following are equivalent::" msgstr "" -#: ../../library/typing.rst:537 +#: ../../library/typing.rst:583 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " "intended primarily for static type checking." msgstr "" -#: ../../library/typing.rst:541 +#: ../../library/typing.rst:587 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:545 +#: ../../library/typing.rst:591 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -553,24 +581,24 @@ msgid "" "term:`hashable` and comparable for equality." msgstr "" -#: ../../library/typing.rst:552 +#: ../../library/typing.rst:598 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:554 +#: ../../library/typing.rst:600 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -#: ../../library/typing.rst:558 +#: ../../library/typing.rst:604 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" msgstr "" -#: ../../library/typing.rst:576 +#: ../../library/typing.rst:622 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -579,19 +607,19 @@ msgid "" "runtime!" msgstr "" -#: ../../library/typing.rst:582 +#: ../../library/typing.rst:628 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -#: ../../library/typing.rst:595 +#: ../../library/typing.rst:641 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." msgstr "" -#: ../../library/typing.rst:598 +#: ../../library/typing.rst:644 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -599,7 +627,7 @@ msgid "" "subtype of every other type." msgstr "" -#: ../../library/typing.rst:603 +#: ../../library/typing.rst:649 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -607,24 +635,24 @@ msgid "" "example::" msgstr "" -#: ../../library/typing.rst:625 +#: ../../library/typing.rst:671 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." msgstr "" -#: ../../library/typing.rst:630 +#: ../../library/typing.rst:676 msgid "Nominal vs structural subtyping" msgstr "" -#: ../../library/typing.rst:632 +#: ../../library/typing.rst:678 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " "expected if and only if ``A`` is a subclass of ``B``." msgstr "" -#: ../../library/typing.rst:636 +#: ../../library/typing.rst:682 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -633,7 +661,7 @@ msgid "" "code. For example, this conforms to :pep:`484`::" msgstr "" -#: ../../library/typing.rst:649 +#: ../../library/typing.rst:695 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -642,85 +670,85 @@ msgid "" "subtyping* (or static duck-typing)::" msgstr "" -#: ../../library/typing.rst:665 +#: ../../library/typing.rst:711 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " "examples below)." msgstr "" -#: ../../library/typing.rst:670 +#: ../../library/typing.rst:716 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:672 +#: ../../library/typing.rst:718 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "" -#: ../../library/typing.rst:675 +#: ../../library/typing.rst:721 msgid "Special typing primitives" msgstr "" -#: ../../library/typing.rst:678 +#: ../../library/typing.rst:724 msgid "Special types" msgstr "" -#: ../../library/typing.rst:680 +#: ../../library/typing.rst:726 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "" -#: ../../library/typing.rst:685 +#: ../../library/typing.rst:731 msgid "Special type indicating an unconstrained type." msgstr "" -#: ../../library/typing.rst:687 +#: ../../library/typing.rst:733 msgid "Every type is compatible with :data:`Any`." msgstr "" -#: ../../library/typing.rst:688 +#: ../../library/typing.rst:734 msgid ":data:`Any` is compatible with every type." msgstr "" -#: ../../library/typing.rst:690 +#: ../../library/typing.rst:736 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " "dynamic." msgstr "" -#: ../../library/typing.rst:697 +#: ../../library/typing.rst:743 msgid "A :ref:`constrained type variable `." msgstr "" -#: ../../library/typing.rst:699 +#: ../../library/typing.rst:745 msgid "Definition::" msgstr "" -#: ../../library/typing.rst:703 +#: ../../library/typing.rst:749 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." msgstr "" -#: ../../library/typing.rst:706 ../../library/typing.rst:782 -#: ../../library/typing.rst:802 ../../library/typing.rst:848 -#: ../../library/typing.rst:1095 ../../library/typing.rst:1152 -#: ../../library/typing.rst:1360 ../../library/typing.rst:2522 +#: ../../library/typing.rst:752 ../../library/typing.rst:828 +#: ../../library/typing.rst:848 ../../library/typing.rst:894 +#: ../../library/typing.rst:1092 ../../library/typing.rst:1149 +#: ../../library/typing.rst:1357 ../../library/typing.rst:2519 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:717 +#: ../../library/typing.rst:763 msgid "Special type that includes only literal strings." msgstr "" -#: ../../library/typing.rst:719 +#: ../../library/typing.rst:765 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -728,14 +756,14 @@ msgid "" "``LiteralString``." msgstr "" -#: ../../library/typing.rst:725 +#: ../../library/typing.rst:771 msgid "Example:" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:741 +#: ../../library/typing.rst:787 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -743,33 +771,33 @@ msgid "" "attack." msgstr "" -#: ../../library/typing.rst:746 +#: ../../library/typing.rst:792 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:752 +#: ../../library/typing.rst:798 msgid "" "The `bottom type `_, a type that " "has no members." msgstr "" -#: ../../library/typing.rst:755 +#: ../../library/typing.rst:801 msgid "" "This can be used to define a function that should never be called, or a " "function that never returns::" msgstr "" -#: ../../library/typing.rst:775 +#: ../../library/typing.rst:821 msgid "" "On older Python versions, :data:`NoReturn` may be used to express the same " "concept. ``Never`` was added to make the intended meaning more explicit." msgstr "" -#: ../../library/typing.rst:780 +#: ../../library/typing.rst:826 msgid "Special type indicating that a function never returns." msgstr "" -#: ../../library/typing.rst:789 +#: ../../library/typing.rst:835 msgid "" "``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " @@ -777,126 +805,126 @@ msgid "" "checkers should treat the two equivalently." msgstr "" -#: ../../library/typing.rst:800 +#: ../../library/typing.rst:846 msgid "Special type to represent the current enclosed class." msgstr "" -#: ../../library/typing.rst:812 +#: ../../library/typing.rst:858 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "" -#: ../../library/typing.rst:824 +#: ../../library/typing.rst:870 msgid "In general if something currently follows the pattern of::" msgstr "" -#: ../../library/typing.rst:831 +#: ../../library/typing.rst:877 msgid "" "You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would " "have ``Foo`` as the return type and not ``SubclassOfFoo``." msgstr "" -#: ../../library/typing.rst:834 +#: ../../library/typing.rst:880 msgid "Other common use cases include:" msgstr "" -#: ../../library/typing.rst:836 +#: ../../library/typing.rst:882 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." msgstr "" -#: ../../library/typing.rst:838 +#: ../../library/typing.rst:884 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "" -#: ../../library/typing.rst:840 +#: ../../library/typing.rst:886 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:846 +#: ../../library/typing.rst:892 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "" -#: ../../library/typing.rst:854 +#: ../../library/typing.rst:900 msgid "" "``TypeAlias`` is particularly useful for annotating aliases that make use of " "forward references, as it can be hard for type checkers to distinguish these " "from normal variable assignments:" msgstr "" -#: ../../library/typing.rst:874 +#: ../../library/typing.rst:920 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:879 +#: ../../library/typing.rst:925 msgid "Special forms" msgstr "" -#: ../../library/typing.rst:881 +#: ../../library/typing.rst:927 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." msgstr "" -#: ../../library/typing.rst:886 +#: ../../library/typing.rst:932 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" -#: ../../library/typing.rst:888 +#: ../../library/typing.rst:934 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" msgstr "" -#: ../../library/typing.rst:890 +#: ../../library/typing.rst:936 msgid "The arguments must be types and there must be at least one." msgstr "" -#: ../../library/typing.rst:892 +#: ../../library/typing.rst:938 msgid "Unions of unions are flattened, e.g.::" msgstr "" -#: ../../library/typing.rst:896 +#: ../../library/typing.rst:942 msgid "Unions of a single argument vanish, e.g.::" msgstr "" -#: ../../library/typing.rst:900 +#: ../../library/typing.rst:946 msgid "Redundant arguments are skipped, e.g.::" msgstr "" -#: ../../library/typing.rst:904 +#: ../../library/typing.rst:950 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "" -#: ../../library/typing.rst:908 +#: ../../library/typing.rst:954 msgid "You cannot subclass or instantiate a ``Union``." msgstr "" -#: ../../library/typing.rst:910 +#: ../../library/typing.rst:956 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:912 +#: ../../library/typing.rst:958 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" -#: ../../library/typing.rst:915 +#: ../../library/typing.rst:961 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:921 +#: ../../library/typing.rst:967 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "" -#: ../../library/typing.rst:923 +#: ../../library/typing.rst:969 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -904,30 +932,30 @@ msgid "" "optional. For example::" msgstr "" -#: ../../library/typing.rst:931 +#: ../../library/typing.rst:977 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " "example::" msgstr "" -#: ../../library/typing.rst:938 +#: ../../library/typing.rst:984 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:944 +#: ../../library/typing.rst:990 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "" -#: ../../library/typing.rst:946 +#: ../../library/typing.rst:992 msgid "" "``Callable[[int], str]`` signifies a function that takes a single parameter " "of type :class:`int` and returns a :class:`str`." msgstr "" -#: ../../library/typing.rst:949 +#: ../../library/typing.rst:995 msgid "" "The subscription syntax must always be used with exactly two values: the " "argument list and the return type. The argument list must be a list of " @@ -935,7 +963,7 @@ msgid "" "type must be a single type." msgstr "" -#: ../../library/typing.rst:954 +#: ../../library/typing.rst:1000 msgid "" "There is no syntax to indicate optional or keyword arguments; such function " "types are rarely used as callback types. ``Callable[..., ReturnType]`` " @@ -945,23 +973,23 @@ msgid "" "Callable`." msgstr "" -#: ../../library/typing.rst:970 +#: ../../library/typing.rst:1016 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:979 +#: ../../library/typing.rst:1025 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provide " "examples of usage with ``Callable``." msgstr "" -#: ../../library/typing.rst:984 +#: ../../library/typing.rst:1030 msgid "Special form for annotating higher-order functions." msgstr "" -#: ../../library/typing.rst:986 +#: ../../library/typing.rst:1032 msgid "" "``Concatenate`` can be used in conjunction with :data:`Callable` and :class:" "`ParamSpec` to annotate a higher-order callable which adds, removes, or " @@ -972,7 +1000,7 @@ msgid "" "`ParamSpec` or ellipsis (``...``)." msgstr "" -#: ../../library/typing.rst:995 +#: ../../library/typing.rst:1041 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -983,78 +1011,34 @@ msgid "" "passed in::" msgstr "" -#: ../../library/typing.rst:1034 ../../library/typing.rst:1739 +#: ../../library/typing.rst:1080 ../../library/typing.rst:1736 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)." msgstr "" -#: ../../library/typing.rst:1036 +#: ../../library/typing.rst:1082 msgid ":class:`ParamSpec` and :class:`Callable`." msgstr ":class:`ParamSpec` 和 :class:`Callable`\\ 。" -#: ../../library/typing.rst:1041 -msgid "Deprecated alias to :class:`type`." -msgstr "" - -#: ../../library/typing.rst:1043 -msgid "" -"A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` or ``Type[C]`` may accept " -"values that are classes themselves -- specifically, it will accept the " -"*class object* of ``C``. For example::" -msgstr "" - -#: ../../library/typing.rst:1052 -msgid "Note that ``Type[C]`` is covariant::" -msgstr "" - -#: ../../library/typing.rst:1064 -msgid "" -"The fact that ``Type[C]`` is covariant implies that all subclasses of ``C`` " -"should implement the same constructor signature and class method signatures " -"as ``C``. The type checker should flag violations of this, but should also " -"allow constructor calls in subclasses that match the constructor calls in " -"the indicated base class. How the type checker is required to handle this " -"particular case may change in future revisions of :pep:`484`." -msgstr "" - -#: ../../library/typing.rst:1072 -msgid "" -"The only legal parameters for :class:`Type` are classes, :data:`Any`, :ref:" -"`type variables `, and unions of any of these types. For example::" -msgstr "" - -#: ../../library/typing.rst:1078 -msgid "" -"``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent to " -"``type``, which is the root of Python's metaclass hierarchy." -msgstr "" - -#: ../../library/typing.rst:1083 -msgid "" -":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." -msgstr "" - -#: ../../library/typing.rst:1089 +#: ../../library/typing.rst:1086 msgid "Special typing form to define \"literal types\"." msgstr "" -#: ../../library/typing.rst:1091 +#: ../../library/typing.rst:1088 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" -#: ../../library/typing.rst:1107 +#: ../../library/typing.rst:1104 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " "restrictions. See :pep:`586` for more details about literal types." msgstr "" -#: ../../library/typing.rst:1113 +#: ../../library/typing.rst:1110 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -1062,22 +1046,22 @@ msgid "" "their parameters are not :term:`hashable`." msgstr "" -#: ../../library/typing.rst:1121 +#: ../../library/typing.rst:1118 msgid "Special type construct to mark class variables." msgstr "" -#: ../../library/typing.rst:1123 +#: ../../library/typing.rst:1120 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " "and should not be set on instances of that class. Usage::" msgstr "" -#: ../../library/typing.rst:1131 +#: ../../library/typing.rst:1128 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr "" -#: ../../library/typing.rst:1133 +#: ../../library/typing.rst:1130 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -1085,27 +1069,27 @@ msgid "" "example, a type checker might flag the following code as an error::" msgstr "" -#: ../../library/typing.rst:1147 +#: ../../library/typing.rst:1144 msgid "Special typing construct to indicate final names to type checkers." msgstr "" -#: ../../library/typing.rst:1149 +#: ../../library/typing.rst:1146 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." msgstr "" -#: ../../library/typing.rst:1163 ../../library/typing.rst:2538 +#: ../../library/typing.rst:1160 ../../library/typing.rst:2535 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -#: ../../library/typing.rst:1170 +#: ../../library/typing.rst:1167 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "" -#: ../../library/typing.rst:1172 +#: ../../library/typing.rst:1169 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -1113,21 +1097,21 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1179 +#: ../../library/typing.rst:1176 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "" -#: ../../library/typing.rst:1182 +#: ../../library/typing.rst:1179 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1188 +#: ../../library/typing.rst:1185 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1190 +#: ../../library/typing.rst:1187 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -1135,7 +1119,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1195 +#: ../../library/typing.rst:1192 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -1144,7 +1128,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1201 +#: ../../library/typing.rst:1198 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -1154,7 +1138,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1208 +#: ../../library/typing.rst:1205 msgid "" "The responsibility of how to interpret the metadata lies with the the tool " "or library encountering an ``Annotated`` annotation. A tool or library " @@ -1162,108 +1146,108 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1216 +#: ../../library/typing.rst:1213 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1229 +#: ../../library/typing.rst:1226 msgid "Details of the syntax:" msgstr "" -#: ../../library/typing.rst:1231 +#: ../../library/typing.rst:1228 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:1233 +#: ../../library/typing.rst:1230 msgid "" "Multiple metadata elements can be supplied (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:1242 +#: ../../library/typing.rst:1239 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1246 +#: ../../library/typing.rst:1243 msgid "" "``Annotated`` must be subscripted with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:1249 +#: ../../library/typing.rst:1246 msgid "" "The order of the metadata elements is preserved and matters for equality " "checks::" msgstr "" -#: ../../library/typing.rst:1256 +#: ../../library/typing.rst:1253 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1263 +#: ../../library/typing.rst:1260 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1269 +#: ../../library/typing.rst:1266 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1282 +#: ../../library/typing.rst:1279 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1286 +#: ../../library/typing.rst:1283 msgid "This would be equivalent to::" msgstr "" "這會等價於:\n" "\n" "::" -#: ../../library/typing.rst:1290 +#: ../../library/typing.rst:1287 msgid "" "where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " "invalid: only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1293 +#: ../../library/typing.rst:1290 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1306 +#: ../../library/typing.rst:1303 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1320 +#: ../../library/typing.rst:1317 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1321 +#: ../../library/typing.rst:1318 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1328 +#: ../../library/typing.rst:1325 msgid "Special typing construct for marking user-defined type guard functions." msgstr "" -#: ../../library/typing.rst:1330 +#: ../../library/typing.rst:1327 msgid "" "``TypeGuard`` can be used to annotate the return type of a user-defined type " "guard function. ``TypeGuard`` only accepts a single type argument. At " "runtime, functions marked this way should return a boolean." msgstr "" -#: ../../library/typing.rst:1334 +#: ../../library/typing.rst:1331 msgid "" "``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -1272,44 +1256,44 @@ msgid "" "conditional expression here is sometimes referred to as a \"type guard\"::" msgstr "" -#: ../../library/typing.rst:1349 +#: ../../library/typing.rst:1346 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type guard. Such a function should use ``TypeGuard[...]`` as its return " "type to alert static type checkers to this intention." msgstr "" -#: ../../library/typing.rst:1353 +#: ../../library/typing.rst:1350 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1356 +#: ../../library/typing.rst:1353 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1357 +#: ../../library/typing.rst:1354 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1374 +#: ../../library/typing.rst:1371 msgid "" "If ``is_str_list`` is a class or instance method, then the type in " "``TypeGuard`` maps to the type of the second parameter after ``cls`` or " "``self``." msgstr "" -#: ../../library/typing.rst:1378 +#: ../../library/typing.rst:1375 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means " "that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` " "to ``TypeB``." msgstr "" -#: ../../library/typing.rst:1384 +#: ../../library/typing.rst:1381 msgid "" "``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider " "form. The main reason is to allow for things like narrowing ``list[object]`` " @@ -1318,24 +1302,24 @@ msgid "" "guards is left to the user." msgstr "" -#: ../../library/typing.rst:1390 +#: ../../library/typing.rst:1387 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1397 +#: ../../library/typing.rst:1394 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1399 +#: ../../library/typing.rst:1396 msgid "" "For example, using the unpack operator ``*`` on a :class:`type variable " "tuple ` is equivalent to using ``Unpack`` to mark the type " "variable tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1408 +#: ../../library/typing.rst:1405 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -1343,45 +1327,45 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1425 +#: ../../library/typing.rst:1422 msgid "Building generic types" msgstr "" -#: ../../library/typing.rst:1427 +#: ../../library/typing.rst:1424 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types." msgstr "" -#: ../../library/typing.rst:1433 +#: ../../library/typing.rst:1430 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1435 +#: ../../library/typing.rst:1432 msgid "" "A generic type is typically declared by inheriting from an instantiation of " "this class with one or more type variables. For example, a generic mapping " "type might be defined as::" msgstr "" -#: ../../library/typing.rst:1444 +#: ../../library/typing.rst:1441 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1457 +#: ../../library/typing.rst:1454 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1459 ../../library/typing.rst:1554 -#: ../../library/typing.rst:1664 ../../library/typing.rst:1777 -#: ../../library/typing.rst:1848 ../../library/typing.rst:2722 +#: ../../library/typing.rst:1456 ../../library/typing.rst:1551 +#: ../../library/typing.rst:1661 ../../library/typing.rst:1774 +#: ../../library/typing.rst:1845 ../../library/typing.rst:2719 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/typing.rst:1465 +#: ../../library/typing.rst:1462 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -1389,69 +1373,69 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1486 +#: ../../library/typing.rst:1483 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1489 +#: ../../library/typing.rst:1486 msgid "" "Type variables may be marked covariant or contravariant by passing " "``covariant=True`` or ``contravariant=True``. See :pep:`484` for more " "details. By default, type variables are invariant." msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1490 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1508 +#: ../../library/typing.rst:1505 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1516 +#: ../../library/typing.rst:1513 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1527 +#: ../../library/typing.rst:1524 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1531 +#: ../../library/typing.rst:1528 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1535 +#: ../../library/typing.rst:1532 msgid "Whether the type var has been marked as covariant." msgstr "" -#: ../../library/typing.rst:1539 +#: ../../library/typing.rst:1536 msgid "Whether the type var has been marked as contravariant." msgstr "" -#: ../../library/typing.rst:1543 +#: ../../library/typing.rst:1540 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1547 +#: ../../library/typing.rst:1544 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1551 +#: ../../library/typing.rst:1548 msgid "" "Type variable tuple. A specialized form of :class:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1562 +#: ../../library/typing.rst:1559 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -1459,7 +1443,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1584 +#: ../../library/typing.rst:1581 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -1469,36 +1453,36 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1592 +#: ../../library/typing.rst:1589 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1599 +#: ../../library/typing.rst:1596 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1608 +#: ../../library/typing.rst:1605 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1624 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1634 +#: ../../library/typing.rst:1631 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1644 +#: ../../library/typing.rst:1641 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -1507,21 +1491,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1651 +#: ../../library/typing.rst:1648 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1655 +#: ../../library/typing.rst:1652 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1661 +#: ../../library/typing.rst:1658 msgid "" "Parameter specification variable. A specialized version of :class:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1668 +#: ../../library/typing.rst:1665 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1531,7 +1515,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1675 +#: ../../library/typing.rst:1672 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -1539,27 +1523,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1699 +#: ../../library/typing.rst:1696 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:1703 +#: ../../library/typing.rst:1700 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:1705 +#: ../../library/typing.rst:1702 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:1712 +#: ../../library/typing.rst:1709 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1572,11 +1556,11 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1724 +#: ../../library/typing.rst:1721 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:1726 +#: ../../library/typing.rst:1723 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1585,17 +1569,17 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1735 +#: ../../library/typing.rst:1732 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1738 msgid ":class:`Callable` and :class:`Concatenate`." msgstr ":class:`Callable` 和 :class:`Concatenate`\\ 。" -#: ../../library/typing.rst:1746 +#: ../../library/typing.rst:1743 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1603,45 +1587,45 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1751 +#: ../../library/typing.rst:1748 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:1767 +#: ../../library/typing.rst:1764 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1766 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:1775 +#: ../../library/typing.rst:1772 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1783 +#: ../../library/typing.rst:1780 msgid "This is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/typing.rst:1787 +#: ../../library/typing.rst:1784 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1796 +#: ../../library/typing.rst:1793 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1798 +#: ../../library/typing.rst:1795 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -1650,83 +1634,83 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:1804 +#: ../../library/typing.rst:1801 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:1814 +#: ../../library/typing.rst:1811 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:1820 +#: ../../library/typing.rst:1817 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:1824 +#: ../../library/typing.rst:1821 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:1827 +#: ../../library/typing.rst:1824 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:1830 +#: ../../library/typing.rst:1827 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:1834 +#: ../../library/typing.rst:1831 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:1838 +#: ../../library/typing.rst:1835 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:1843 +#: ../../library/typing.rst:1840 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:1845 +#: ../../library/typing.rst:1842 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:1855 +#: ../../library/typing.rst:1852 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:1859 +#: ../../library/typing.rst:1856 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:1863 +#: ../../library/typing.rst:1860 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:1867 +#: ../../library/typing.rst:1864 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:1872 +#: ../../library/typing.rst:1869 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:1874 +#: ../../library/typing.rst:1871 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:1880 +#: ../../library/typing.rst:1877 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:1892 +#: ../../library/typing.rst:1889 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -1734,15 +1718,15 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:1897 +#: ../../library/typing.rst:1894 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:1909 +#: ../../library/typing.rst:1906 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:1911 +#: ../../library/typing.rst:1908 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -1751,7 +1735,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:1931 +#: ../../library/typing.rst:1928 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -1762,7 +1746,7 @@ msgid "" "SSLObject`." msgstr "" -#: ../../library/typing.rst:1942 +#: ../../library/typing.rst:1939 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -1770,13 +1754,13 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:1953 +#: ../../library/typing.rst:1950 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:1956 +#: ../../library/typing.rst:1953 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -1784,53 +1768,53 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:1972 +#: ../../library/typing.rst:1969 msgid "" "To allow using this feature with older versions of Python that do not " "support :pep:`526`, ``TypedDict`` supports two additional equivalent " "syntactic forms:" msgstr "" -#: ../../library/typing.rst:1976 +#: ../../library/typing.rst:1973 msgid "Using a literal :class:`dict` as the second argument::" msgstr "" -#: ../../library/typing.rst:1980 +#: ../../library/typing.rst:1977 msgid "Using keyword arguments::" msgstr "" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:1984 msgid "" "The keyword-argument syntax is deprecated in 3.11 and will be removed in " "3.13. It may also be unsupported by static type checkers." msgstr "" -#: ../../library/typing.rst:1988 +#: ../../library/typing.rst:1985 msgid "" "The functional syntax should also be used when any of the keys are not " "valid :ref:`identifiers `, for example because they are " "keywords or contain hyphens. Example::" msgstr "" -#: ../../library/typing.rst:2000 +#: ../../library/typing.rst:1997 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2011 +#: ../../library/typing.rst:2008 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2014 +#: ../../library/typing.rst:2011 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2024 +#: ../../library/typing.rst:2021 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -1838,61 +1822,61 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2029 +#: ../../library/typing.rst:2026 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2044 +#: ../../library/typing.rst:2041 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2048 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2059 +#: ../../library/typing.rst:2056 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2077 +#: ../../library/typing.rst:2074 msgid "A ``TypedDict`` can be generic:" msgstr "" -#: ../../library/typing.rst:2087 +#: ../../library/typing.rst:2084 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2093 +#: ../../library/typing.rst:2090 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2115 +#: ../../library/typing.rst:2112 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2118 +#: ../../library/typing.rst:2115 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2121 +#: ../../library/typing.rst:2118 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -1901,133 +1885,133 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2144 +#: ../../library/typing.rst:2141 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2148 +#: ../../library/typing.rst:2145 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2152 +#: ../../library/typing.rst:2149 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2156 +#: ../../library/typing.rst:2153 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2158 +#: ../../library/typing.rst:2155 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2163 +#: ../../library/typing.rst:2160 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2168 +#: ../../library/typing.rst:2165 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2169 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2176 +#: ../../library/typing.rst:2173 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2180 +#: ../../library/typing.rst:2177 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2186 +#: ../../library/typing.rst:2183 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2190 +#: ../../library/typing.rst:2187 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2194 +#: ../../library/typing.rst:2191 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2200 +#: ../../library/typing.rst:2197 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2206 +#: ../../library/typing.rst:2203 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2210 +#: ../../library/typing.rst:2207 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2212 +#: ../../library/typing.rst:2209 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2219 +#: ../../library/typing.rst:2216 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2221 +#: ../../library/typing.rst:2218 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2224 +#: ../../library/typing.rst:2221 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2231 +#: ../../library/typing.rst:2228 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2245 +#: ../../library/typing.rst:2242 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2247 +#: ../../library/typing.rst:2244 msgid "Example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:2258 +#: ../../library/typing.rst:2255 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2263 +#: ../../library/typing.rst:2260 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -2037,59 +2021,59 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2271 +#: ../../library/typing.rst:2268 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2271 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2282 +#: ../../library/typing.rst:2279 msgid "Reveal the inferred static type of an expression." msgstr "" -#: ../../library/typing.rst:2284 +#: ../../library/typing.rst:2281 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2290 +#: ../../library/typing.rst:2287 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2293 +#: ../../library/typing.rst:2290 msgid "" "The function returns its argument unchanged, which allows using it within an " "expression::" msgstr "" -#: ../../library/typing.rst:2298 +#: ../../library/typing.rst:2295 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing`` allows your " "code to run without runtime errors and communicates intent more clearly." msgstr "" -#: ../../library/typing.rst:2303 +#: ../../library/typing.rst:2300 msgid "" "At runtime, this function prints the runtime type of its argument to stderr " "and returns it unchanged::" msgstr "" -#: ../../library/typing.rst:2315 +#: ../../library/typing.rst:2312 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2318 +#: ../../library/typing.rst:2315 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -2098,19 +2082,19 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2325 +#: ../../library/typing.rst:2322 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2341 +#: ../../library/typing.rst:2338 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2350 +#: ../../library/typing.rst:2347 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2361 +#: ../../library/typing.rst:2358 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:2492 +#: ../../library/typing.rst:2489 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -2315,32 +2299,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2496 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:2507 +#: ../../library/typing.rst:2504 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:2509 +#: ../../library/typing.rst:2506 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2516 +#: ../../library/typing.rst:2513 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:2518 +#: ../../library/typing.rst:2515 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:2543 +#: ../../library/typing.rst:2540 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -2350,11 +2334,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:2554 +#: ../../library/typing.rst:2551 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2556 +#: ../../library/typing.rst:2553 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -2362,48 +2346,48 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:2562 +#: ../../library/typing.rst:2559 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:2566 +#: ../../library/typing.rst:2563 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2568 +#: ../../library/typing.rst:2565 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2573 +#: ../../library/typing.rst:2570 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2575 +#: ../../library/typing.rst:2572 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:2586 +#: ../../library/typing.rst:2583 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2590 +#: ../../library/typing.rst:2587 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2594 +#: ../../library/typing.rst:2591 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2597 +#: ../../library/typing.rst:2594 msgid "" "This is often the same as ``obj.__annotations__``. In addition, forward " "references encoded as string literals are handled by evaluating them in " @@ -2412,21 +2396,21 @@ msgid "" "__mro__`` in reverse order." msgstr "" -#: ../../library/typing.rst:2603 +#: ../../library/typing.rst:2600 msgid "" "The function recursively replaces all ``Annotated[T, ...]`` with ``T``, " "unless ``include_extras`` is set to ``True`` (see :class:`Annotated` for " "more information). For example:" msgstr "" -#: ../../library/typing.rst:2620 +#: ../../library/typing.rst:2617 msgid "" ":func:`get_type_hints` does not work with imported :ref:`type aliases ` that include forward references. Enabling postponed evaluation of " "annotations (:pep:`563`) may remove the need for most forward references." msgstr "" -#: ../../library/typing.rst:2625 +#: ../../library/typing.rst:2622 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -2434,20 +2418,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:2629 +#: ../../library/typing.rst:2626 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:2636 +#: ../../library/typing.rst:2633 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:2639 +#: ../../library/typing.rst:2636 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -2455,17 +2439,17 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:2645 ../../library/typing.rst:2668 +#: ../../library/typing.rst:2642 ../../library/typing.rst:2665 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:2660 +#: ../../library/typing.rst:2657 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:2663 +#: ../../library/typing.rst:2660 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -2473,40 +2457,40 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:2680 +#: ../../library/typing.rst:2677 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2701 +#: ../../library/typing.rst:2698 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:2703 +#: ../../library/typing.rst:2700 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2705 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:2715 +#: ../../library/typing.rst:2712 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:2719 +#: ../../library/typing.rst:2716 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:2730 +#: ../../library/typing.rst:2727 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2514,7 +2498,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2737 +#: ../../library/typing.rst:2734 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -2522,11 +2506,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:2748 +#: ../../library/typing.rst:2745 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:2750 +#: ../../library/typing.rst:2747 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -2535,7 +2519,7 @@ msgid "" "existing classes were enhanced to support ``[]``." msgstr "" -#: ../../library/typing.rst:2756 +#: ../../library/typing.rst:2753 msgid "" "The redundant types are deprecated as of Python 3.9 but no deprecation " "warnings are issued by the interpreter. It is expected that type checkers " @@ -2543,7 +2527,7 @@ msgid "" "or newer." msgstr "" -#: ../../library/typing.rst:2761 +#: ../../library/typing.rst:2758 msgid "" "The deprecated types will be removed from the :mod:`typing` module no sooner " "than the first Python version released 5 years after the release of Python " @@ -2551,160 +2535,176 @@ msgid "" "Collections*." msgstr "" -#: ../../library/typing.rst:2768 +#: ../../library/typing.rst:2765 msgid "Aliases to built-in types" msgstr "" -#: ../../library/typing.rst:2772 +#: ../../library/typing.rst:2769 msgid "Deprecated alias to :class:`dict`." msgstr "" -#: ../../library/typing.rst:2774 +#: ../../library/typing.rst:2771 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Mapping` rather than to use :class:`dict` " "or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:2778 ../../library/typing.rst:3005 +#: ../../library/typing.rst:2775 ../../library/typing.rst:3015 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:2783 +#: ../../library/typing.rst:2780 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2789 +#: ../../library/typing.rst:2786 msgid "Deprecated alias to :class:`list`." msgstr "" -#: ../../library/typing.rst:2791 +#: ../../library/typing.rst:2788 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Sequence` or :class:`Iterable` rather than " "to use :class:`list` or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:2795 +#: ../../library/typing.rst:2792 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:2805 +#: ../../library/typing.rst:2802 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2808 msgid "Deprecated alias to :class:`builtins.set `." msgstr "" -#: ../../library/typing.rst:2813 +#: ../../library/typing.rst:2810 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`AbstractSet` rather than to use :class:`set` " "or :class:`!typing.Set`." msgstr "" -#: ../../library/typing.rst:2817 +#: ../../library/typing.rst:2814 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2823 +#: ../../library/typing.rst:2820 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "" -#: ../../library/typing.rst:2825 +#: ../../library/typing.rst:2822 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2832 +#: ../../library/typing.rst:2829 msgid "Deprecated alias for :class:`tuple`." msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2831 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:2837 +#: ../../library/typing.rst:2834 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2844 +#: ../../library/typing.rst:2840 +msgid "Deprecated alias to :class:`type`." +msgstr "" + +#: ../../library/typing.rst:2842 +msgid "" +"See :ref:`type-of-class-objects` for details on using :class:`type` or " +"``typing.Type`` in type annotations." +msgstr "" + +#: ../../library/typing.rst:2847 +msgid "" +":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." +msgstr "" + +#: ../../library/typing.rst:2854 msgid "Aliases to types in :mod:`collections`" msgstr "" -#: ../../library/typing.rst:2848 +#: ../../library/typing.rst:2858 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "" -#: ../../library/typing.rst:2852 +#: ../../library/typing.rst:2862 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:2868 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "" -#: ../../library/typing.rst:2862 +#: ../../library/typing.rst:2872 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2878 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "" -#: ../../library/typing.rst:2873 +#: ../../library/typing.rst:2883 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2879 +#: ../../library/typing.rst:2889 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "" -#: ../../library/typing.rst:2884 +#: ../../library/typing.rst:2894 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2890 +#: ../../library/typing.rst:2900 msgid "Deprecated alias to :class:`collections.deque`." msgstr "" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2905 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2902 +#: ../../library/typing.rst:2912 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:2907 +#: ../../library/typing.rst:2917 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:2910 +#: ../../library/typing.rst:2920 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -2712,367 +2712,367 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:2918 +#: ../../library/typing.rst:2928 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:2919 +#: ../../library/typing.rst:2929 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2925 +#: ../../library/typing.rst:2935 msgid "Deprecated alias for :class:`str`." msgstr "" -#: ../../library/typing.rst:2927 +#: ../../library/typing.rst:2937 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:2931 +#: ../../library/typing.rst:2941 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:2939 +#: ../../library/typing.rst:2949 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:2949 +#: ../../library/typing.rst:2959 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:2953 +#: ../../library/typing.rst:2963 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "" -#: ../../library/typing.rst:2955 +#: ../../library/typing.rst:2965 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2961 +#: ../../library/typing.rst:2971 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:2965 +#: ../../library/typing.rst:2975 msgid "" "Prefer ``typing_extensions.Buffer``, or a union like ``bytes | bytearray | " "memoryview``." msgstr "" -#: ../../library/typing.rst:2969 +#: ../../library/typing.rst:2979 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "" -#: ../../library/typing.rst:2973 +#: ../../library/typing.rst:2983 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2979 +#: ../../library/typing.rst:2989 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "" -#: ../../library/typing.rst:2981 +#: ../../library/typing.rst:2991 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2987 +#: ../../library/typing.rst:2997 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "" -#: ../../library/typing.rst:2989 +#: ../../library/typing.rst:2999 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2995 +#: ../../library/typing.rst:3005 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "" -#: ../../library/typing.rst:2997 +#: ../../library/typing.rst:3007 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3003 +#: ../../library/typing.rst:3013 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "" -#: ../../library/typing.rst:3010 +#: ../../library/typing.rst:3020 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3016 +#: ../../library/typing.rst:3026 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "" -#: ../../library/typing.rst:3018 +#: ../../library/typing.rst:3028 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3024 +#: ../../library/typing.rst:3034 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "" -#: ../../library/typing.rst:3026 +#: ../../library/typing.rst:3036 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3033 +#: ../../library/typing.rst:3043 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "" -#: ../../library/typing.rst:3035 +#: ../../library/typing.rst:3045 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3052 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "" -#: ../../library/typing.rst:3044 +#: ../../library/typing.rst:3054 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3050 +#: ../../library/typing.rst:3060 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3062 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3058 +#: ../../library/typing.rst:3068 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "" -#: ../../library/typing.rst:3060 +#: ../../library/typing.rst:3070 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3077 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3071 +#: ../../library/typing.rst:3081 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "" -#: ../../library/typing.rst:3073 +#: ../../library/typing.rst:3083 msgid "" "The variance and order of type variables correspond to those of :class:" "`Generator`, for example::" msgstr "" -#: ../../library/typing.rst:3084 +#: ../../library/typing.rst:3094 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3090 +#: ../../library/typing.rst:3100 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "" -#: ../../library/typing.rst:3092 +#: ../../library/typing.rst:3102 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:3101 +#: ../../library/typing.rst:3111 msgid "" "Unlike normal generators, async generators cannot return a value, so there " "is no ``ReturnType`` type parameter. As with :class:`Generator`, the " "``SendType`` behaves contravariantly." msgstr "" -#: ../../library/typing.rst:3105 +#: ../../library/typing.rst:3115 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3113 +#: ../../library/typing.rst:3123 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3133 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3130 +#: ../../library/typing.rst:3140 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "" -#: ../../library/typing.rst:3134 +#: ../../library/typing.rst:3144 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3140 +#: ../../library/typing.rst:3150 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3154 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3150 +#: ../../library/typing.rst:3160 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "" -#: ../../library/typing.rst:3154 +#: ../../library/typing.rst:3164 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3171 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3165 +#: ../../library/typing.rst:3175 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "" -#: ../../library/typing.rst:3167 +#: ../../library/typing.rst:3177 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3173 +#: ../../library/typing.rst:3183 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "" -#: ../../library/typing.rst:3175 +#: ../../library/typing.rst:3185 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3181 +#: ../../library/typing.rst:3191 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "" -#: ../../library/typing.rst:3183 +#: ../../library/typing.rst:3193 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:3192 +#: ../../library/typing.rst:3202 msgid "" "Note that unlike many other generics in the typing module, the ``SendType`` " "of :class:`Generator` behaves contravariantly, not covariantly or " "invariantly." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3206 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3204 +#: ../../library/typing.rst:3214 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3222 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3228 msgid "Alias to :class:`collections.abc.Hashable`." msgstr "" -#: ../../library/typing.rst:3222 +#: ../../library/typing.rst:3232 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "" -#: ../../library/typing.rst:3224 +#: ../../library/typing.rst:3234 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3230 +#: ../../library/typing.rst:3240 msgid "Alias to :class:`collections.abc.Sized`." msgstr "" -#: ../../library/typing.rst:3235 +#: ../../library/typing.rst:3245 msgid "Aliases to :mod:`contextlib` ABCs" msgstr "" -#: ../../library/typing.rst:3239 +#: ../../library/typing.rst:3249 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3244 +#: ../../library/typing.rst:3254 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3251 +#: ../../library/typing.rst:3261 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3256 +#: ../../library/typing.rst:3266 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3262 +#: ../../library/typing.rst:3272 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3274 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -3080,74 +3080,74 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3269 +#: ../../library/typing.rst:3279 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3269 +#: ../../library/typing.rst:3279 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3269 +#: ../../library/typing.rst:3279 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3269 +#: ../../library/typing.rst:3279 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3271 +#: ../../library/typing.rst:3281 msgid "``typing.io`` and ``typing.re`` submodules" msgstr "" -#: ../../library/typing.rst:3271 +#: ../../library/typing.rst:3281 msgid "3.8" msgstr "3.8" -#: ../../library/typing.rst:3271 +#: ../../library/typing.rst:3281 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3271 +#: ../../library/typing.rst:3281 msgid ":issue:`38291`" msgstr ":issue:`38291`" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3284 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3274 ../../library/typing.rst:3277 +#: ../../library/typing.rst:3284 ../../library/typing.rst:3287 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3274 ../../library/typing.rst:3279 +#: ../../library/typing.rst:3284 ../../library/typing.rst:3289 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3284 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3287 msgid "``typing.ByteString``" msgstr "``typing.Text``" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3287 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3287 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3289 msgid "``typing.Text``" msgstr "``typing.Text``" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3289 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3289 msgid ":gh:`92332`" msgstr ":gh:`92332`" From 90828264f8d8e2d3c6eb83bb0f272bd861cfd07c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 28 Jun 2023 00:20:48 +0000 Subject: [PATCH 5/9] sync with cpython fbb0151e --- library/ast.po | 442 ++++++++++++++++++++++---------------- library/decimal.po | 523 ++++++++++++++++++++++++--------------------- 2 files changed, 532 insertions(+), 433 deletions(-) diff --git a/library/ast.po b/library/ast.po index ed431e1051..87dea82e63 100644 --- a/library/ast.po +++ b/library/ast.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-27 00:16+0000\n" +"POT-Creation-Date: 2023-06-28 00:19+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -176,11 +176,73 @@ msgid "" "readthedocs.io/en/latest/>`__ project and all its contributors." msgstr "" -#: ../../library/ast.rst:150 +#: ../../library/ast.rst:153 +msgid "Root nodes" +msgstr "" + +#: ../../library/ast.rst:157 +msgid "" +"A Python module, as with :ref:`file input `. Node type generated " +"by :func:`ast.parse` in the default ``\"exec\"`` *mode*." +msgstr "" + +#: ../../library/ast.rst:160 +msgid "*body* is a :class:`list` of the module's :ref:`ast-statements`." +msgstr "" + +#: ../../library/ast.rst:162 +msgid "" +"*type_ignores* is a :class:`list` of the module's type ignore comments; see :" +"func:`ast.parse` for more details." +msgstr "" + +#: ../../library/ast.rst:179 +msgid "" +"A single Python :ref:`expression input `. Node type " +"generated by :func:`ast.parse` when *mode* is ``\"eval\"``." +msgstr "" + +#: ../../library/ast.rst:182 +msgid "" +"*body* is a single node, one of the :ref:`expression types `." +msgstr "" + +#: ../../library/ast.rst:194 +msgid "" +"A single :ref:`interactive input `, like in :ref:`tut-interac`. " +"Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." +msgstr "" + +#: ../../library/ast.rst:197 +msgid "*body* is a :class:`list` of :ref:`statement nodes `." +msgstr "" + +#: ../../library/ast.rst:216 +msgid "" +"A representation of an old-style type comments for functions, as Python " +"versions prior to 3.5 didn't support :pep:`484` annotations. Node type " +"generated by :func:`ast.parse` when *mode* is ``\"func_type\"``." +msgstr "" + +#: ../../library/ast.rst:220 +msgid "Such type comments would look like this::" +msgstr "" + +#: ../../library/ast.rst:226 +msgid "" +"*argtypes* is a :class:`list` of :ref:`expression nodes `." +msgstr "" + +#: ../../library/ast.rst:228 +msgid "*returns* is a single :ref:`expression node `." +msgstr "" + +#: ../../library/ast.rst:246 msgid "Literals" msgstr "" -#: ../../library/ast.rst:154 +#: ../../library/ast.rst:250 msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " @@ -189,106 +251,106 @@ msgid "" "constant." msgstr "" -#: ../../library/ast.rst:168 +#: ../../library/ast.rst:264 msgid "" "Node representing a single formatting field in an f-string. If the string " "contains a single formatting field and nothing else the node can be isolated " "otherwise it appears in :class:`JoinedStr`." msgstr "" -#: ../../library/ast.rst:172 +#: ../../library/ast.rst:268 msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call)." msgstr "" -#: ../../library/ast.rst:174 +#: ../../library/ast.rst:270 msgid "``conversion`` is an integer:" msgstr "" -#: ../../library/ast.rst:176 +#: ../../library/ast.rst:272 msgid "-1: no formatting" msgstr "" -#: ../../library/ast.rst:177 +#: ../../library/ast.rst:273 msgid "115: ``!s`` string formatting" msgstr "" -#: ../../library/ast.rst:178 +#: ../../library/ast.rst:274 msgid "114: ``!r`` repr formatting" msgstr "" -#: ../../library/ast.rst:179 +#: ../../library/ast.rst:275 msgid "97: ``!a`` ascii formatting" msgstr "" -#: ../../library/ast.rst:181 +#: ../../library/ast.rst:277 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " "``format_spec`` can be set at the same time." msgstr "" -#: ../../library/ast.rst:188 +#: ../../library/ast.rst:284 msgid "" "An f-string, comprising a series of :class:`FormattedValue` and :class:" "`Constant` nodes." msgstr "" -#: ../../library/ast.rst:217 +#: ../../library/ast.rst:313 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -#: ../../library/ast.rst:243 +#: ../../library/ast.rst:339 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "" -#: ../../library/ast.rst:258 +#: ../../library/ast.rst:354 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " "when calling :code:`dictionary.keys()` and :code:`dictionary.values()`)." msgstr "" -#: ../../library/ast.rst:262 +#: ../../library/ast.rst:358 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " "corresponding position in ``keys``." msgstr "" -#: ../../library/ast.rst:280 +#: ../../library/ast.rst:376 msgid "Variables" msgstr "" -#: ../../library/ast.rst:284 +#: ../../library/ast.rst:380 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "" -#: ../../library/ast.rst:292 +#: ../../library/ast.rst:388 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " "distinguish these cases." msgstr "" -#: ../../library/ast.rst:325 +#: ../../library/ast.rst:421 msgid "" "A ``*var`` variable reference. ``value`` holds the variable, typically a :" "class:`Name` node. This type must be used when building a :class:`Call` node " "with ``*args``." msgstr "" -#: ../../library/ast.rst:348 +#: ../../library/ast.rst:446 msgid "Expressions" msgstr "" -#: ../../library/ast.rst:352 +#: ../../library/ast.rst:450 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " @@ -297,29 +359,29 @@ msgid "" "`YieldFrom` node." msgstr "" -#: ../../library/ast.rst:371 +#: ../../library/ast.rst:469 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" -#: ../../library/ast.rst:380 +#: ../../library/ast.rst:478 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." msgstr "" -#: ../../library/ast.rst:394 +#: ../../library/ast.rst:492 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." msgstr "" -#: ../../library/ast.rst:421 +#: ../../library/ast.rst:519 msgid "Binary operator tokens." msgstr "" -#: ../../library/ast.rst:426 +#: ../../library/ast.rst:524 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -327,60 +389,60 @@ msgid "" "values." msgstr "" -#: ../../library/ast.rst:431 +#: ../../library/ast.rst:529 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "" -#: ../../library/ast.rst:447 +#: ../../library/ast.rst:545 msgid "Boolean operator tokens." msgstr "" -#: ../../library/ast.rst:452 +#: ../../library/ast.rst:550 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " "values after the first element in the comparison." msgstr "" -#: ../../library/ast.rst:481 +#: ../../library/ast.rst:579 msgid "Comparison operator tokens." msgstr "" -#: ../../library/ast.rst:486 +#: ../../library/ast.rst:584 msgid "" "A function call. ``func`` is the function, which will often be a :class:" "`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -#: ../../library/ast.rst:489 +#: ../../library/ast.rst:587 msgid "``args`` holds a list of the arguments passed by position." msgstr "" -#: ../../library/ast.rst:490 +#: ../../library/ast.rst:588 msgid "" "``keywords`` holds a list of :class:`keyword` objects representing arguments " "passed by keyword." msgstr "" -#: ../../library/ast.rst:493 +#: ../../library/ast.rst:591 msgid "" "When creating a ``Call`` node, ``args`` and ``keywords`` are required, but " "they can be empty lists." msgstr "" -#: ../../library/ast.rst:517 +#: ../../library/ast.rst:615 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." msgstr "" -#: ../../library/ast.rst:523 +#: ../../library/ast.rst:621 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." msgstr "" -#: ../../library/ast.rst:538 +#: ../../library/ast.rst:636 msgid "" "Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" "`Name`. ``attr`` is a bare string giving the name of the attribute, and " @@ -388,7 +450,7 @@ msgid "" "the attribute is acted on." msgstr "" -#: ../../library/ast.rst:555 +#: ../../library/ast.rst:653 msgid "" "A named expression. This AST node is produced by the assignment expressions " "operator (also known as the walrus operator). As opposed to the :class:" @@ -396,11 +458,11 @@ msgid "" "case both ``target`` and ``value`` must be single nodes." msgstr "" -#: ../../library/ast.rst:570 +#: ../../library/ast.rst:668 msgid "Subscripting" msgstr "" -#: ../../library/ast.rst:574 +#: ../../library/ast.rst:672 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " "sequence or mapping). ``slice`` is an index, slice or key. It can be a :" @@ -408,29 +470,29 @@ msgid "" "`Store` or :class:`Del` according to the action performed with the subscript." msgstr "" -#: ../../library/ast.rst:598 +#: ../../library/ast.rst:696 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " "or as an element of :class:`Tuple`." msgstr "" -#: ../../library/ast.rst:615 +#: ../../library/ast.rst:713 msgid "Comprehensions" msgstr "" -#: ../../library/ast.rst:622 +#: ../../library/ast.rst:720 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " "representing the part that will be evaluated for each item." msgstr "" -#: ../../library/ast.rst:626 +#: ../../library/ast.rst:724 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "" -#: ../../library/ast.rst:668 +#: ../../library/ast.rst:766 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " @@ -438,36 +500,36 @@ msgid "" "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -#: ../../library/ast.rst:673 +#: ../../library/ast.rst:771 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." msgstr "" -#: ../../library/ast.rst:739 +#: ../../library/ast.rst:840 msgid "Statements" msgstr "" -#: ../../library/ast.rst:743 +#: ../../library/ast.rst:844 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "" -#: ../../library/ast.rst:745 +#: ../../library/ast.rst:846 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " "``targets``." msgstr "" -#: ../../library/ast.rst:751 ../../library/ast.rst:1038 -#: ../../library/ast.rst:1242 ../../library/ast.rst:1663 +#: ../../library/ast.rst:852 ../../library/ast.rst:1139 +#: ../../library/ast.rst:1343 ../../library/ast.rst:1764 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "" -#: ../../library/ast.rst:781 +#: ../../library/ast.rst:882 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, a :class:`Attribute` or a :class:`Subscript`. " @@ -477,7 +539,7 @@ msgid "" "appear in between parenthesis and are hence pure names and not expressions." msgstr "" -#: ../../library/ast.rst:836 +#: ../../library/ast.rst:937 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -485,50 +547,50 @@ msgid "" "value for 1." msgstr "" -#: ../../library/ast.rst:841 +#: ../../library/ast.rst:942 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -#: ../../library/ast.rst:858 +#: ../../library/ast.rst:959 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -#: ../../library/ast.rst:875 +#: ../../library/ast.rst:976 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." msgstr "" -#: ../../library/ast.rst:891 +#: ../../library/ast.rst:992 msgid "" "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" "class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -#: ../../library/ast.rst:909 +#: ../../library/ast.rst:1010 msgid "A ``pass`` statement." msgstr "" -#: ../../library/ast.rst:920 +#: ../../library/ast.rst:1021 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "" -#: ../../library/ast.rst:924 +#: ../../library/ast.rst:1025 msgid "Imports" msgstr "" -#: ../../library/ast.rst:928 +#: ../../library/ast.rst:1029 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "" -#: ../../library/ast.rst:945 +#: ../../library/ast.rst:1046 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -536,36 +598,36 @@ msgid "" "import (0 means absolute import)." msgstr "" -#: ../../library/ast.rst:967 +#: ../../library/ast.rst:1068 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." msgstr "" -#: ../../library/ast.rst:984 +#: ../../library/ast.rst:1085 msgid "Control flow" msgstr "" -#: ../../library/ast.rst:987 +#: ../../library/ast.rst:1088 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "" -#: ../../library/ast.rst:992 +#: ../../library/ast.rst:1093 msgid "" "An ``if`` statement. ``test`` holds a single node, such as a :class:" "`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" -#: ../../library/ast.rst:995 +#: ../../library/ast.rst:1096 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " "previous one." msgstr "" -#: ../../library/ast.rst:1030 +#: ../../library/ast.rst:1131 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " "single :class:`Name`, :class:`Tuple` or :class:`List` node. ``iter`` holds " @@ -574,30 +636,30 @@ msgid "" "loop finishes normally, rather than via a ``break`` statement." msgstr "" -#: ../../library/ast.rst:1064 +#: ../../library/ast.rst:1165 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "" -#: ../../library/ast.rst:1091 +#: ../../library/ast.rst:1192 msgid "The ``break`` and ``continue`` statements." msgstr "" -#: ../../library/ast.rst:1126 +#: ../../library/ast.rst:1227 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." msgstr "" -#: ../../library/ast.rst:1172 +#: ../../library/ast.rst:1273 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " "``handlers`` are interpreted as ``except*`` blocks rather then ``except``." msgstr "" -#: ../../library/ast.rst:1203 +#: ../../library/ast.rst:1304 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " @@ -605,14 +667,14 @@ msgid "" "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -#: ../../library/ast.rst:1237 +#: ../../library/ast.rst:1338 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " "the context." msgstr "" -#: ../../library/ast.rst:1247 +#: ../../library/ast.rst:1348 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " "context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" @@ -620,18 +682,18 @@ msgid "" "if that isn't used." msgstr "" -#: ../../library/ast.rst:1280 +#: ../../library/ast.rst:1381 msgid "Pattern matching" msgstr "" -#: ../../library/ast.rst:1285 +#: ../../library/ast.rst:1386 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " "iterable of :class:`match_case` nodes with the different cases." msgstr "" -#: ../../library/ast.rst:1291 +#: ../../library/ast.rst:1392 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" @@ -639,19 +701,19 @@ msgid "" "expressions, even when they share the same syntax." msgstr "" -#: ../../library/ast.rst:1296 +#: ../../library/ast.rst:1397 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "" -#: ../../library/ast.rst:1299 +#: ../../library/ast.rst:1400 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." msgstr "" -#: ../../library/ast.rst:1342 +#: ../../library/ast.rst:1443 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -659,14 +721,14 @@ msgid "" "equal to the evaluated value." msgstr "" -#: ../../library/ast.rst:1369 +#: ../../library/ast.rst:1470 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " "pattern succeeds if the match subject is the given constant." msgstr "" -#: ../../library/ast.rst:1394 +#: ../../library/ast.rst:1495 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -674,7 +736,7 @@ msgid "" "otherwise matches a fixed length sequence." msgstr "" -#: ../../library/ast.rst:1425 +#: ../../library/ast.rst:1526 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -682,7 +744,7 @@ msgid "" "successful." msgstr "" -#: ../../library/ast.rst:1465 +#: ../../library/ast.rst:1566 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -691,7 +753,7 @@ msgid "" "statement documentation." msgstr "" -#: ../../library/ast.rst:1471 +#: ../../library/ast.rst:1572 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -700,7 +762,7 @@ msgid "" "overall mapping pattern is successful." msgstr "" -#: ../../library/ast.rst:1511 +#: ../../library/ast.rst:1612 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -711,21 +773,21 @@ msgid "" "pattern)." msgstr "" -#: ../../library/ast.rst:1518 +#: ../../library/ast.rst:1619 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " "and any specified keyword attributes match their corresponding pattern." msgstr "" -#: ../../library/ast.rst:1522 +#: ../../library/ast.rst:1623 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " "also matched that way, as described in the match statement documentation." msgstr "" -#: ../../library/ast.rst:1575 +#: ../../library/ast.rst:1676 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -733,14 +795,14 @@ msgid "" "and will always succeed." msgstr "" -#: ../../library/ast.rst:1580 +#: ../../library/ast.rst:1681 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " "and the node represents the wildcard pattern." msgstr "" -#: ../../library/ast.rst:1616 +#: ../../library/ast.rst:1717 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -749,151 +811,151 @@ msgid "" "matched against the subject." msgstr "" -#: ../../library/ast.rst:1648 +#: ../../library/ast.rst:1749 msgid "Function and class definitions" msgstr "" -#: ../../library/ast.rst:1652 +#: ../../library/ast.rst:1753 msgid "A function definition." msgstr "" -#: ../../library/ast.rst:1654 +#: ../../library/ast.rst:1755 msgid "``name`` is a raw string of the function name." msgstr "" -#: ../../library/ast.rst:1655 +#: ../../library/ast.rst:1756 msgid "``args`` is an :class:`arguments` node." msgstr "" -#: ../../library/ast.rst:1656 +#: ../../library/ast.rst:1757 msgid "``body`` is the list of nodes inside the function." msgstr "" -#: ../../library/ast.rst:1657 +#: ../../library/ast.rst:1758 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." msgstr "" -#: ../../library/ast.rst:1659 +#: ../../library/ast.rst:1760 msgid "``returns`` is the return annotation." msgstr "" -#: ../../library/ast.rst:1668 +#: ../../library/ast.rst:1769 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." msgstr "" -#: ../../library/ast.rst:1692 +#: ../../library/ast.rst:1793 msgid "The arguments for a function." msgstr "" -#: ../../library/ast.rst:1694 +#: ../../library/ast.rst:1795 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" -#: ../../library/ast.rst:1695 +#: ../../library/ast.rst:1796 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." msgstr "" -#: ../../library/ast.rst:1697 +#: ../../library/ast.rst:1798 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." msgstr "" -#: ../../library/ast.rst:1699 +#: ../../library/ast.rst:1800 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " "arguments." msgstr "" -#: ../../library/ast.rst:1706 +#: ../../library/ast.rst:1807 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name, " "``annotation`` is its annotation, such as a :class:`Str` or :class:`Name` " "node." msgstr "" -#: ../../library/ast.rst:1712 +#: ../../library/ast.rst:1813 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "" -#: ../../library/ast.rst:1756 +#: ../../library/ast.rst:1857 msgid "A ``return`` statement." msgstr "" -#: ../../library/ast.rst:1771 +#: ../../library/ast.rst:1872 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in a :class:`Expr` node if the value sent back is not " "used." msgstr "" -#: ../../library/ast.rst:1796 +#: ../../library/ast.rst:1897 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "" -#: ../../library/ast.rst:1823 +#: ../../library/ast.rst:1924 msgid "A class definition." msgstr "" -#: ../../library/ast.rst:1825 +#: ../../library/ast.rst:1926 msgid "``name`` is a raw string for the class name" msgstr "" -#: ../../library/ast.rst:1826 +#: ../../library/ast.rst:1927 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "" -#: ../../library/ast.rst:1827 +#: ../../library/ast.rst:1928 msgid "" "``keywords`` is a list of :class:`keyword` nodes, principally for " "'metaclass'. Other keywords will be passed to the metaclass, as per " "`PEP-3115 `_." msgstr "" -#: ../../library/ast.rst:1830 +#: ../../library/ast.rst:1931 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "" -#: ../../library/ast.rst:1832 +#: ../../library/ast.rst:1933 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "" -#: ../../library/ast.rst:1861 +#: ../../library/ast.rst:1962 msgid "Async and await" msgstr "" -#: ../../library/ast.rst:1865 +#: ../../library/ast.rst:1966 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "" -#: ../../library/ast.rst:1871 +#: ../../library/ast.rst:1972 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -#: ../../library/ast.rst:1904 +#: ../../library/ast.rst:2005 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -#: ../../library/ast.rst:1909 +#: ../../library/ast.rst:2010 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -902,23 +964,23 @@ msgid "" "same value (e.g. :class:`ast.Add`)." msgstr "" -#: ../../library/ast.rst:1917 +#: ../../library/ast.rst:2018 msgid ":mod:`ast` Helpers" msgstr "" -#: ../../library/ast.rst:1919 +#: ../../library/ast.rst:2020 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" msgstr "" -#: ../../library/ast.rst:1924 +#: ../../library/ast.rst:2025 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, ast.PyCF_ONLY_AST)``." msgstr "" -#: ../../library/ast.rst:1927 +#: ../../library/ast.rst:2028 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -931,14 +993,14 @@ msgid "" "empty list)." msgstr "" -#: ../../library/ast.rst:1937 +#: ../../library/ast.rst:2038 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " "List[str]``." msgstr "" -#: ../../library/ast.rst:1941 +#: ../../library/ast.rst:2042 msgid "" "Also, setting ``feature_version`` to a tuple ``(major, minor)`` will attempt " "to parse using that Python version's grammar. Currently ``major`` must equal " @@ -947,12 +1009,12 @@ msgid "" "version is ``(3, 4)``; the highest is ``sys.version_info[0:2]``." msgstr "" -#: ../../library/ast.rst:1948 +#: ../../library/ast.rst:2049 msgid "" "If source contains a null character ('\\0'), :exc:`ValueError` is raised." msgstr "" -#: ../../library/ast.rst:1951 +#: ../../library/ast.rst:2052 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -962,45 +1024,45 @@ msgid "" "inside a function node)." msgstr "" -#: ../../library/ast.rst:1958 +#: ../../library/ast.rst:2059 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" -#: ../../library/ast.rst:1962 +#: ../../library/ast.rst:2063 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." msgstr "" -#: ../../library/ast.rst:1966 +#: ../../library/ast.rst:2067 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "" "新增 ``type_comments``\\ 、\\ ``mode='func_type'`` 與 " "``feature_version``\\ 。" -#: ../../library/ast.rst:1972 +#: ../../library/ast.rst:2073 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" "func:`ast.parse`." msgstr "" -#: ../../library/ast.rst:1977 +#: ../../library/ast.rst:2078 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " "optimizations, such as constant tuples/frozensets)." msgstr "" -#: ../../library/ast.rst:1982 +#: ../../library/ast.rst:2083 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "" -#: ../../library/ast.rst:1990 +#: ../../library/ast.rst:2091 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -1008,14 +1070,14 @@ msgid "" "dicts, sets, booleans, ``None`` and ``Ellipsis``." msgstr "" -#: ../../library/ast.rst:1995 +#: ../../library/ast.rst:2096 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " "arbitrarily complex expressions, for example involving operators or indexing." msgstr "" -#: ../../library/ast.rst:2000 +#: ../../library/ast.rst:2101 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -1027,31 +1089,31 @@ msgid "" "untrusted data is thus not recommended." msgstr "" -#: ../../library/ast.rst:2010 +#: ../../library/ast.rst:2111 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "" -#: ../../library/ast.rst:2013 +#: ../../library/ast.rst:2114 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "" -#: ../../library/ast.rst:2017 +#: ../../library/ast.rst:2118 msgid "Now allows bytes and set literals." msgstr "" -#: ../../library/ast.rst:2020 +#: ../../library/ast.rst:2121 msgid "Now supports creating empty sets with ``'set()'``." msgstr "" -#: ../../library/ast.rst:2023 +#: ../../library/ast.rst:2124 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "" -#: ../../library/ast.rst:2029 +#: ../../library/ast.rst:2130 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -1059,24 +1121,24 @@ msgid "" "clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -#: ../../library/ast.rst:2035 +#: ../../library/ast.rst:2136 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`\\ 。" -#: ../../library/ast.rst:2041 +#: ../../library/ast.rst:2142 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`lineno`, :attr:`end_lineno`, :attr:" "`col_offset`, or :attr:`end_col_offset`) is missing, return ``None``." msgstr "" -#: ../../library/ast.rst:2045 +#: ../../library/ast.rst:2146 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." msgstr "" -#: ../../library/ast.rst:2053 +#: ../../library/ast.rst:2154 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`lineno` and :attr:`col_offset` attributes for every node that supports " @@ -1085,77 +1147,77 @@ msgid "" "the values of the parent node. It works recursively starting at *node*." msgstr "" -#: ../../library/ast.rst:2062 +#: ../../library/ast.rst:2163 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " "location in a file." msgstr "" -#: ../../library/ast.rst:2069 +#: ../../library/ast.rst:2170 msgid "" "Copy source location (:attr:`lineno`, :attr:`col_offset`, :attr:" "`end_lineno`, and :attr:`end_col_offset`) from *old_node* to *new_node* if " "possible, and return *new_node*." msgstr "" -#: ../../library/ast.rst:2076 +#: ../../library/ast.rst:2177 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." msgstr "" -#: ../../library/ast.rst:2082 +#: ../../library/ast.rst:2183 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." msgstr "" -#: ../../library/ast.rst:2088 +#: ../../library/ast.rst:2189 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " "only want to modify nodes in place and don't care about the context." msgstr "" -#: ../../library/ast.rst:2095 +#: ../../library/ast.rst:2196 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " "which is forwarded by the :meth:`visit` method." msgstr "" -#: ../../library/ast.rst:2099 +#: ../../library/ast.rst:2200 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "" -#: ../../library/ast.rst:2104 +#: ../../library/ast.rst:2205 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " "or :meth:`generic_visit` if that method doesn't exist." msgstr "" -#: ../../library/ast.rst:2110 +#: ../../library/ast.rst:2211 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "" -#: ../../library/ast.rst:2112 +#: ../../library/ast.rst:2213 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." msgstr "" -#: ../../library/ast.rst:2116 +#: ../../library/ast.rst:2217 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" "`NodeTransformer`) that allows modifications." msgstr "" -#: ../../library/ast.rst:2122 +#: ../../library/ast.rst:2223 msgid "" "Methods :meth:`visit_Num`, :meth:`visit_Str`, :meth:`visit_Bytes`, :meth:" "`visit_NameConstant` and :meth:`visit_Ellipsis` are deprecated now and will " @@ -1163,13 +1225,13 @@ msgid "" "method to handle all constant nodes." msgstr "" -#: ../../library/ast.rst:2130 +#: ../../library/ast.rst:2231 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "" -#: ../../library/ast.rst:2133 +#: ../../library/ast.rst:2234 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -1178,27 +1240,27 @@ msgid "" "may be the original node in which case no replacement takes place." msgstr "" -#: ../../library/ast.rst:2139 +#: ../../library/ast.rst:2240 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" msgstr "" -#: ../../library/ast.rst:2151 +#: ../../library/ast.rst:2252 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`generic_visit` " "method for the node first." msgstr "" -#: ../../library/ast.rst:2155 +#: ../../library/ast.rst:2256 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " "just a single node." msgstr "" -#: ../../library/ast.rst:2159 +#: ../../library/ast.rst:2260 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:" @@ -1206,11 +1268,11 @@ msgid "" "tree to recalculate the location information::" msgstr "" -#: ../../library/ast.rst:2167 +#: ../../library/ast.rst:2268 msgid "Usually you use the transformer like this::" msgstr "" -#: ../../library/ast.rst:2174 +#: ../../library/ast.rst:2275 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -1221,7 +1283,7 @@ msgid "" "true." msgstr "" -#: ../../library/ast.rst:2182 +#: ../../library/ast.rst:2283 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -1231,87 +1293,87 @@ msgid "" "string is used to indent each level." msgstr "" -#: ../../library/ast.rst:2189 +#: ../../library/ast.rst:2290 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2196 +#: ../../library/ast.rst:2297 msgid "Compiler Flags" msgstr "" -#: ../../library/ast.rst:2198 +#: ../../library/ast.rst:2299 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "" -#: ../../library/ast.rst:2203 +#: ../../library/ast.rst:2304 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." msgstr "" -#: ../../library/ast.rst:2210 +#: ../../library/ast.rst:2311 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "" -#: ../../library/ast.rst:2215 +#: ../../library/ast.rst:2316 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." msgstr "" -#: ../../library/ast.rst:2224 +#: ../../library/ast.rst:2325 msgid "Command-Line Usage" msgstr "" -#: ../../library/ast.rst:2228 +#: ../../library/ast.rst:2329 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr "" -#: ../../library/ast.rst:2235 +#: ../../library/ast.rst:2336 msgid "The following options are accepted:" msgstr "" -#: ../../library/ast.rst:2241 +#: ../../library/ast.rst:2342 msgid "Show the help message and exit." msgstr "" -#: ../../library/ast.rst:2246 +#: ../../library/ast.rst:2347 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "" -#: ../../library/ast.rst:2251 +#: ../../library/ast.rst:2352 msgid "Don't parse type comments." msgstr "" -#: ../../library/ast.rst:2255 +#: ../../library/ast.rst:2356 msgid "Include attributes such as line numbers and column offsets." msgstr "" -#: ../../library/ast.rst:2260 +#: ../../library/ast.rst:2361 msgid "Indentation of nodes in AST (number of spaces)." msgstr "" -#: ../../library/ast.rst:2262 +#: ../../library/ast.rst:2363 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." msgstr "" -#: ../../library/ast.rst:2268 +#: ../../library/ast.rst:2369 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." msgstr "" -#: ../../library/ast.rst:2271 +#: ../../library/ast.rst:2372 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -1319,21 +1381,21 @@ msgid "" "transformations." msgstr "" -#: ../../library/ast.rst:2276 +#: ../../library/ast.rst:2377 msgid "" "`leoAst.py `_ unifies the " "token-based and parse-tree-based views of python programs by inserting two-" "way links between tokens and ast nodes." msgstr "" -#: ../../library/ast.rst:2280 +#: ../../library/ast.rst:2381 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " "useful for building automated refactoring (codemod) applications and linters." msgstr "" -#: ../../library/ast.rst:2285 +#: ../../library/ast.rst:2386 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/decimal.po b/library/decimal.po index 11e58beca7..c2aebf7a69 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-02-26 00:19+0000\n" +"POT-Creation-Date: 2023-06-28 00:19+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -455,7 +455,7 @@ msgid "" msgstr "" #: ../../library/decimal.rst:520 ../../library/decimal.rst:531 -#: ../../library/decimal.rst:559 ../../library/decimal.rst:835 +#: ../../library/decimal.rst:559 ../../library/decimal.rst:846 msgid "" "This operation is unaffected by context and is quiet: no flags are changed " "and no rounding is performed. As an exception, the C version may raise " @@ -686,70 +686,93 @@ msgstr "" #: ../../library/decimal.rst:746 msgid "" -"Normalize the number by stripping the rightmost trailing zeros and " -"converting any result equal to ``Decimal('0')`` to ``Decimal('0e0')``. Used " -"for producing canonical values for attributes of an equivalence class. For " -"example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize " -"to the equivalent value ``Decimal('32.1')``." +"Used for producing canonical values of an equivalence class within either " +"the current context or the specified context." msgstr "" -#: ../../library/decimal.rst:755 +#: ../../library/decimal.rst:749 +msgid "" +"This has the same semantics as the unary plus operation, except that if the " +"final result is finite it is reduced to its simplest form, with all trailing " +"zeros removed and its sign preserved. That is, while the coefficient is non-" +"zero and a multiple of ten the coefficient is divided by ten and the " +"exponent is incremented by 1. Otherwise (the coefficient is zero) the " +"exponent is set to 0. In all cases the sign is unchanged." +msgstr "" + +#: ../../library/decimal.rst:756 +msgid "" +"For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " +"normalize to the equivalent value ``Decimal('32.1')``." +msgstr "" + +#: ../../library/decimal.rst:759 +msgid "Note that rounding is applied *before* reducing to simplest form." +msgstr "" + +#: ../../library/decimal.rst:761 +msgid "" +"In the latest versions of the specification, this operation is also known as " +"``reduce``." +msgstr "" + +#: ../../library/decimal.rst:766 msgid "" "Return a string describing the *class* of the operand. The returned value " "is one of the following ten strings." msgstr "" -#: ../../library/decimal.rst:758 +#: ../../library/decimal.rst:769 msgid "``\"-Infinity\"``, indicating that the operand is negative infinity." msgstr "" -#: ../../library/decimal.rst:759 +#: ../../library/decimal.rst:770 msgid "" "``\"-Normal\"``, indicating that the operand is a negative normal number." msgstr "" -#: ../../library/decimal.rst:760 +#: ../../library/decimal.rst:771 msgid "" "``\"-Subnormal\"``, indicating that the operand is negative and subnormal." msgstr "" -#: ../../library/decimal.rst:761 +#: ../../library/decimal.rst:772 msgid "``\"-Zero\"``, indicating that the operand is a negative zero." msgstr "" -#: ../../library/decimal.rst:762 +#: ../../library/decimal.rst:773 msgid "``\"+Zero\"``, indicating that the operand is a positive zero." msgstr "" -#: ../../library/decimal.rst:763 +#: ../../library/decimal.rst:774 msgid "" "``\"+Subnormal\"``, indicating that the operand is positive and subnormal." msgstr "" -#: ../../library/decimal.rst:764 +#: ../../library/decimal.rst:775 msgid "" "``\"+Normal\"``, indicating that the operand is a positive normal number." msgstr "" -#: ../../library/decimal.rst:765 +#: ../../library/decimal.rst:776 msgid "``\"+Infinity\"``, indicating that the operand is positive infinity." msgstr "" -#: ../../library/decimal.rst:766 +#: ../../library/decimal.rst:777 msgid "``\"NaN\"``, indicating that the operand is a quiet NaN (Not a Number)." msgstr "" -#: ../../library/decimal.rst:767 +#: ../../library/decimal.rst:778 msgid "``\"sNaN\"``, indicating that the operand is a signaling NaN." msgstr "" -#: ../../library/decimal.rst:771 +#: ../../library/decimal.rst:782 msgid "" "Return a value equal to the first operand after rounding and having the " "exponent of the second operand." msgstr "" -#: ../../library/decimal.rst:777 +#: ../../library/decimal.rst:788 msgid "" "Unlike other operations, if the length of the coefficient after the quantize " "operation would be greater than precision, then an :const:`InvalidOperation` " @@ -757,13 +780,13 @@ msgid "" "quantized exponent is always equal to that of the right-hand operand." msgstr "" -#: ../../library/decimal.rst:783 +#: ../../library/decimal.rst:794 msgid "" "Also unlike other operations, quantize never signals Underflow, even if the " "result is subnormal and inexact." msgstr "" -#: ../../library/decimal.rst:786 +#: ../../library/decimal.rst:797 msgid "" "If the exponent of the second operand is larger than that of the first then " "rounding may be necessary. In this case, the rounding mode is determined by " @@ -772,19 +795,19 @@ msgid "" "context is used." msgstr "" -#: ../../library/decimal.rst:792 +#: ../../library/decimal.rst:803 msgid "" "An error is returned whenever the resulting exponent is greater than :attr:" "`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -#: ../../library/decimal.rst:797 +#: ../../library/decimal.rst:808 msgid "" "Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class " "does all its arithmetic. Included for compatibility with the specification." msgstr "" -#: ../../library/decimal.rst:803 +#: ../../library/decimal.rst:814 msgid "" "Return the remainder from dividing *self* by *other*. This differs from " "``self % other`` in that the sign of the remainder is chosen so as to " @@ -793,11 +816,11 @@ msgid "" "other``, and if two integers are equally near then the even one is chosen." msgstr "" -#: ../../library/decimal.rst:810 +#: ../../library/decimal.rst:821 msgid "If the result is zero then its sign will be the sign of *self*." msgstr "" -#: ../../library/decimal.rst:821 +#: ../../library/decimal.rst:832 msgid "" "Return the result of rotating the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -809,20 +832,20 @@ msgid "" "are unchanged." msgstr "" -#: ../../library/decimal.rst:832 +#: ../../library/decimal.rst:843 msgid "" "Test whether self and other have the same exponent or whether both are " "``NaN``." msgstr "" -#: ../../library/decimal.rst:841 +#: ../../library/decimal.rst:852 msgid "" "Return the first operand with exponent adjusted by the second. Equivalently, " "return the first operand multiplied by ``10**other``. The second operand " "must be an integer." msgstr "" -#: ../../library/decimal.rst:847 +#: ../../library/decimal.rst:858 msgid "" "Return the result of shifting the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -833,34 +856,34 @@ msgid "" "exponent of the first operand are unchanged." msgstr "" -#: ../../library/decimal.rst:857 +#: ../../library/decimal.rst:868 msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:862 ../../library/decimal.rst:1457 +#: ../../library/decimal.rst:873 ../../library/decimal.rst:1468 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:864 ../../library/decimal.rst:1459 +#: ../../library/decimal.rst:875 ../../library/decimal.rst:1470 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " "addition of either one or two trailing zeros." msgstr "" -#: ../../library/decimal.rst:868 +#: ../../library/decimal.rst:879 msgid "" "For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." msgstr "" -#: ../../library/decimal.rst:872 +#: ../../library/decimal.rst:883 msgid "" "Identical to the :meth:`to_integral_value` method. The ``to_integral`` name " "has been kept for compatibility with older versions." msgstr "" -#: ../../library/decimal.rst:877 +#: ../../library/decimal.rst:888 msgid "" "Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` " "as appropriate if rounding occurs. The rounding mode is determined by the " @@ -868,18 +891,18 @@ msgid "" "parameter is given then the rounding mode of the current context is used." msgstr "" -#: ../../library/decimal.rst:885 +#: ../../library/decimal.rst:896 msgid "" "Round to the nearest integer without signaling :const:`Inexact` or :const:" "`Rounded`. If given, applies *rounding*; otherwise, uses the rounding " "method in either the supplied *context* or the current context." msgstr "" -#: ../../library/decimal.rst:893 +#: ../../library/decimal.rst:904 msgid "Logical operands" msgstr "" -#: ../../library/decimal.rst:895 +#: ../../library/decimal.rst:906 msgid "" "The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" "`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " @@ -888,38 +911,38 @@ msgid "" "are all either ``0`` or ``1``." msgstr "" -#: ../../library/decimal.rst:907 +#: ../../library/decimal.rst:918 msgid "Context objects" msgstr "" -#: ../../library/decimal.rst:909 +#: ../../library/decimal.rst:920 msgid "" "Contexts are environments for arithmetic operations. They govern precision, " "set rules for rounding, determine which signals are treated as exceptions, " "and limit the range for exponents." msgstr "" -#: ../../library/decimal.rst:913 +#: ../../library/decimal.rst:924 msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -#: ../../library/decimal.rst:919 +#: ../../library/decimal.rst:930 msgid "Return the current context for the active thread." msgstr "" -#: ../../library/decimal.rst:924 +#: ../../library/decimal.rst:935 msgid "Set the current context for the active thread to *c*." msgstr "" -#: ../../library/decimal.rst:926 +#: ../../library/decimal.rst:937 msgid "" "You can also use the :keyword:`with` statement and the :func:`localcontext` " "function to temporarily change the active context." msgstr "" -#: ../../library/decimal.rst:931 +#: ../../library/decimal.rst:942 msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " @@ -928,37 +951,37 @@ msgid "" "used to set the attributes of the new context." msgstr "" -#: ../../library/decimal.rst:937 +#: ../../library/decimal.rst:948 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: ../../library/decimal.rst:947 +#: ../../library/decimal.rst:958 msgid "Using keyword arguments, the code would be the following::" msgstr "" -#: ../../library/decimal.rst:955 +#: ../../library/decimal.rst:966 msgid "" "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" "`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" "`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -#: ../../library/decimal.rst:959 +#: ../../library/decimal.rst:970 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" -#: ../../library/decimal.rst:962 +#: ../../library/decimal.rst:973 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: ../../library/decimal.rst:968 +#: ../../library/decimal.rst:979 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -967,12 +990,12 @@ msgid "" "`Subnormal`." msgstr "" -#: ../../library/decimal.rst:974 +#: ../../library/decimal.rst:985 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: ../../library/decimal.rst:979 +#: ../../library/decimal.rst:990 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -980,7 +1003,7 @@ msgid "" "exceptions are not raised during computations)." msgstr "" -#: ../../library/decimal.rst:984 +#: ../../library/decimal.rst:995 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " @@ -988,7 +1011,7 @@ msgid "" "conditions that would otherwise halt the program." msgstr "" -#: ../../library/decimal.rst:992 +#: ../../library/decimal.rst:1003 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -996,7 +1019,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/decimal.rst:996 +#: ../../library/decimal.rst:1007 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -1004,65 +1027,65 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: ../../library/decimal.rst:1001 +#: ../../library/decimal.rst:1012 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: ../../library/decimal.rst:1004 +#: ../../library/decimal.rst:1015 msgid "" "The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." "rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" "`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." msgstr "" -#: ../../library/decimal.rst:1009 +#: ../../library/decimal.rst:1020 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: ../../library/decimal.rst:1015 +#: ../../library/decimal.rst:1026 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1019 +#: ../../library/decimal.rst:1030 msgid "" "*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets the " "precision for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1022 +#: ../../library/decimal.rst:1033 msgid "" "The *rounding* option is one of the constants listed in the section " "`Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1025 +#: ../../library/decimal.rst:1036 msgid "" "The *traps* and *flags* fields list any signals to be set. Generally, new " "contexts should only set traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1028 +#: ../../library/decimal.rst:1039 msgid "" "The *Emin* and *Emax* fields are integers specifying the outer limits " "allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, " "``0``], *Emax* in the range [``0``, :const:`MAX_EMAX`]." msgstr "" -#: ../../library/decimal.rst:1032 +#: ../../library/decimal.rst:1043 msgid "" "The *capitals* field is either ``0`` or ``1`` (the default). If set to " "``1``, exponents are printed with a capital ``E``; otherwise, a lowercase " "``e`` is used: ``Decimal('6.02e+23')``." msgstr "" -#: ../../library/decimal.rst:1036 +#: ../../library/decimal.rst:1047 msgid "" "The *clamp* field is either ``0`` (the default) or ``1``. If set to ``1``, " "the exponent ``e`` of a :class:`Decimal` instance representable in this " @@ -1076,13 +1099,13 @@ msgid "" "For example::" msgstr "" -#: ../../library/decimal.rst:1051 +#: ../../library/decimal.rst:1062 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1054 +#: ../../library/decimal.rst:1065 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1095,30 +1118,30 @@ msgid "" "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -#: ../../library/decimal.rst:1067 +#: ../../library/decimal.rst:1078 msgid "Resets all of the flags to ``0``." msgstr "" -#: ../../library/decimal.rst:1071 +#: ../../library/decimal.rst:1082 msgid "Resets all of the traps to ``0``." msgstr "" -#: ../../library/decimal.rst:1077 +#: ../../library/decimal.rst:1088 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1081 +#: ../../library/decimal.rst:1092 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1085 +#: ../../library/decimal.rst:1096 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: ../../library/decimal.rst:1089 +#: ../../library/decimal.rst:1100 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1127,14 +1150,14 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1103 +#: ../../library/decimal.rst:1114 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: ../../library/decimal.rst:1109 +#: ../../library/decimal.rst:1120 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1142,18 +1165,18 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1129 +#: ../../library/decimal.rst:1140 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -#: ../../library/decimal.rst:1135 +#: ../../library/decimal.rst:1146 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1137 +#: ../../library/decimal.rst:1148 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1163,189 +1186,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1147 +#: ../../library/decimal.rst:1158 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1152 +#: ../../library/decimal.rst:1163 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1157 +#: ../../library/decimal.rst:1168 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1162 +#: ../../library/decimal.rst:1173 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1167 +#: ../../library/decimal.rst:1178 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1172 +#: ../../library/decimal.rst:1183 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1177 +#: ../../library/decimal.rst:1188 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1182 +#: ../../library/decimal.rst:1193 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1187 +#: ../../library/decimal.rst:1198 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1192 +#: ../../library/decimal.rst:1203 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1197 +#: ../../library/decimal.rst:1208 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1202 +#: ../../library/decimal.rst:1213 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1207 +#: ../../library/decimal.rst:1218 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1212 +#: ../../library/decimal.rst:1223 msgid "Returns ``e ** x``." msgstr "" -#: ../../library/decimal.rst:1217 +#: ../../library/decimal.rst:1228 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1222 +#: ../../library/decimal.rst:1233 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1227 +#: ../../library/decimal.rst:1238 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1232 +#: ../../library/decimal.rst:1243 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1237 +#: ../../library/decimal.rst:1248 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1242 +#: ../../library/decimal.rst:1253 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1247 +#: ../../library/decimal.rst:1258 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1252 +#: ../../library/decimal.rst:1263 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1257 +#: ../../library/decimal.rst:1268 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1262 +#: ../../library/decimal.rst:1273 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1267 +#: ../../library/decimal.rst:1278 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1272 +#: ../../library/decimal.rst:1283 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1277 +#: ../../library/decimal.rst:1288 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1282 +#: ../../library/decimal.rst:1293 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1287 +#: ../../library/decimal.rst:1298 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1292 +#: ../../library/decimal.rst:1303 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1297 +#: ../../library/decimal.rst:1308 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1302 +#: ../../library/decimal.rst:1313 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1307 +#: ../../library/decimal.rst:1318 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1312 ../../library/decimal.rst:1322 +#: ../../library/decimal.rst:1323 ../../library/decimal.rst:1333 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1317 +#: ../../library/decimal.rst:1328 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1327 +#: ../../library/decimal.rst:1338 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1332 +#: ../../library/decimal.rst:1343 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1337 +#: ../../library/decimal.rst:1348 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1342 +#: ../../library/decimal.rst:1353 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1347 +#: ../../library/decimal.rst:1358 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1352 +#: ../../library/decimal.rst:1363 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1357 +#: ../../library/decimal.rst:1368 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1362 +#: ../../library/decimal.rst:1373 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: ../../library/decimal.rst:1369 +#: ../../library/decimal.rst:1380 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1371 +#: ../../library/decimal.rst:1382 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1354,42 +1377,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1377 +#: ../../library/decimal.rst:1388 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1380 +#: ../../library/decimal.rst:1391 msgid "" "The C module computes :meth:`power` in terms of the correctly rounded :meth:" "`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " "always correctly rounded\"." msgstr "" -#: ../../library/decimal.rst:1385 +#: ../../library/decimal.rst:1396 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1388 +#: ../../library/decimal.rst:1399 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1389 +#: ../../library/decimal.rst:1400 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1390 +#: ../../library/decimal.rst:1401 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1391 +#: ../../library/decimal.rst:1402 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1393 +#: ../../library/decimal.rst:1404 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1398,110 +1421,110 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1403 +#: ../../library/decimal.rst:1414 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1408 +#: ../../library/decimal.rst:1419 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1413 +#: ../../library/decimal.rst:1424 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1415 +#: ../../library/decimal.rst:1426 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1421 +#: ../../library/decimal.rst:1432 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: ../../library/decimal.rst:1427 +#: ../../library/decimal.rst:1438 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1432 +#: ../../library/decimal.rst:1443 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1437 +#: ../../library/decimal.rst:1448 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1442 +#: ../../library/decimal.rst:1453 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1447 +#: ../../library/decimal.rst:1458 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1452 +#: ../../library/decimal.rst:1463 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1466 +#: ../../library/decimal.rst:1477 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1471 +#: ../../library/decimal.rst:1482 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1478 +#: ../../library/decimal.rst:1489 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1480 +#: ../../library/decimal.rst:1491 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: ../../library/decimal.rst:1484 +#: ../../library/decimal.rst:1495 msgid "32-bit" msgstr "" -#: ../../library/decimal.rst:1484 +#: ../../library/decimal.rst:1495 msgid "64-bit" msgstr "" -#: ../../library/decimal.rst:1486 ../../library/decimal.rst:1488 +#: ../../library/decimal.rst:1497 ../../library/decimal.rst:1499 msgid "``425000000``" msgstr "``425000000``" -#: ../../library/decimal.rst:1486 ../../library/decimal.rst:1488 +#: ../../library/decimal.rst:1497 ../../library/decimal.rst:1499 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../library/decimal.rst:1490 +#: ../../library/decimal.rst:1501 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../library/decimal.rst:1490 +#: ../../library/decimal.rst:1501 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../library/decimal.rst:1492 +#: ../../library/decimal.rst:1503 msgid "``-849999999``" msgstr "``-849999999``" -#: ../../library/decimal.rst:1492 +#: ../../library/decimal.rst:1503 msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1498 +#: ../../library/decimal.rst:1509 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1504 +#: ../../library/decimal.rst:1515 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1510,59 +1533,59 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1509 +#: ../../library/decimal.rst:1520 msgid "backported to 3.7 and 3.8." msgstr "" -#: ../../library/decimal.rst:1513 +#: ../../library/decimal.rst:1524 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1517 +#: ../../library/decimal.rst:1528 msgid "Round towards ``Infinity``." msgstr "" -#: ../../library/decimal.rst:1521 +#: ../../library/decimal.rst:1532 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1525 +#: ../../library/decimal.rst:1536 msgid "Round towards ``-Infinity``." msgstr "" -#: ../../library/decimal.rst:1529 +#: ../../library/decimal.rst:1540 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1533 +#: ../../library/decimal.rst:1544 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1537 +#: ../../library/decimal.rst:1548 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1541 +#: ../../library/decimal.rst:1552 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1556 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: ../../library/decimal.rst:1552 +#: ../../library/decimal.rst:1563 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1554 +#: ../../library/decimal.rst:1565 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1557 +#: ../../library/decimal.rst:1568 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -1570,7 +1593,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1562 +#: ../../library/decimal.rst:1573 msgid "" "If the context's trap enabler is set for the signal, then the condition " "causes a Python exception to be raised. For example, if the :class:" @@ -1578,58 +1601,58 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1570 +#: ../../library/decimal.rst:1581 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1572 +#: ../../library/decimal.rst:1583 msgid "" "Typically, clamping occurs when an exponent falls outside the context's :" "attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " "exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -#: ../../library/decimal.rst:1579 +#: ../../library/decimal.rst:1590 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1584 +#: ../../library/decimal.rst:1595 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1586 +#: ../../library/decimal.rst:1597 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns ``Infinity`` or ``-" "Infinity`` with the sign determined by the inputs to the calculation." msgstr "" -#: ../../library/decimal.rst:1593 +#: ../../library/decimal.rst:1604 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1595 +#: ../../library/decimal.rst:1606 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: ../../library/decimal.rst:1602 +#: ../../library/decimal.rst:1613 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1604 +#: ../../library/decimal.rst:1615 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1620 +#: ../../library/decimal.rst:1631 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1622 +#: ../../library/decimal.rst:1633 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " @@ -1638,42 +1661,42 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1631 +#: ../../library/decimal.rst:1642 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1633 +#: ../../library/decimal.rst:1644 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " "unchanged. This signal is used to detect loss of significant digits." msgstr "" -#: ../../library/decimal.rst:1641 +#: ../../library/decimal.rst:1652 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1643 +#: ../../library/decimal.rst:1654 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1649 +#: ../../library/decimal.rst:1660 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1651 +#: ../../library/decimal.rst:1662 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1657 +#: ../../library/decimal.rst:1668 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1659 +#: ../../library/decimal.rst:1670 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -1684,26 +1707,26 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1667 +#: ../../library/decimal.rst:1678 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " "conversions are silent. All other mixed operations raise :exc:" "`FloatOperation`." msgstr "" -#: ../../library/decimal.rst:1671 +#: ../../library/decimal.rst:1682 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1692 +#: ../../library/decimal.rst:1703 msgid "Floating Point Notes" msgstr "" -#: ../../library/decimal.rst:1696 +#: ../../library/decimal.rst:1707 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1698 +#: ../../library/decimal.rst:1709 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -1711,7 +1734,7 @@ msgid "" "precision." msgstr "" -#: ../../library/decimal.rst:1702 +#: ../../library/decimal.rst:1713 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -1720,24 +1743,24 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1726 +#: ../../library/decimal.rst:1737 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: ../../library/decimal.rst:1746 +#: ../../library/decimal.rst:1757 msgid "Special values" msgstr "" -#: ../../library/decimal.rst:1748 +#: ../../library/decimal.rst:1759 msgid "" "The number system for the :mod:`decimal` module provides special values " "including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " "``+0`` and ``-0``." msgstr "" -#: ../../library/decimal.rst:1752 +#: ../../library/decimal.rst:1763 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -1746,14 +1769,14 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1757 +#: ../../library/decimal.rst:1768 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: ../../library/decimal.rst:1761 +#: ../../library/decimal.rst:1772 msgid "" "Some operations are indeterminate and return ``NaN``, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -1764,14 +1787,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1769 +#: ../../library/decimal.rst:1780 msgid "" "A variant is ``sNaN`` which signals rather than remaining quiet after every " "operation. This is a useful return value when an invalid result needs to " "interrupt a calculation for special handling." msgstr "" -#: ../../library/decimal.rst:1773 +#: ../../library/decimal.rst:1784 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a ``NaN`` is involved. A test for equality where one of the operands " @@ -1788,7 +1811,7 @@ msgid "" "compare_signal` methods instead." msgstr "" -#: ../../library/decimal.rst:1786 +#: ../../library/decimal.rst:1797 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -1796,7 +1819,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1791 +#: ../../library/decimal.rst:1802 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -1805,11 +1828,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1806 +#: ../../library/decimal.rst:1817 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1808 +#: ../../library/decimal.rst:1819 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -1817,20 +1840,20 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1812 +#: ../../library/decimal.rst:1823 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1815 +#: ../../library/decimal.rst:1826 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " "current thread." msgstr "" -#: ../../library/decimal.rst:1819 +#: ../../library/decimal.rst:1830 msgid "" "The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " @@ -1839,51 +1862,51 @@ msgid "" "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1844 +#: ../../library/decimal.rst:1855 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1846 +#: ../../library/decimal.rst:1857 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: ../../library/decimal.rst:2001 +#: ../../library/decimal.rst:2012 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:2003 +#: ../../library/decimal.rst:2014 msgid "" "Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: ../../library/decimal.rst:2006 +#: ../../library/decimal.rst:2017 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:2012 +#: ../../library/decimal.rst:2023 msgid "" "Q. In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: ../../library/decimal.rst:2016 +#: ../../library/decimal.rst:2027 msgid "" "A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -#: ../../library/decimal.rst:2034 +#: ../../library/decimal.rst:2045 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2037 +#: ../../library/decimal.rst:2048 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -1891,13 +1914,13 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2055 +#: ../../library/decimal.rst:2066 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2068 +#: ../../library/decimal.rst:2079 msgid "" "Q. There are many ways to express the same value. The numbers ``200``, " "``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " @@ -1905,19 +1928,33 @@ msgid "" "canonical value?" msgstr "" -#: ../../library/decimal.rst:2073 +#: ../../library/decimal.rst:2084 msgid "" "A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: ../../library/decimal.rst:2080 +#: ../../library/decimal.rst:2091 +msgid "Q. When does rounding occur in a computation?" +msgstr "" + +#: ../../library/decimal.rst:2093 +msgid "" +"A. It occurs *after* the computation. The philosophy of the decimal " +"specification is that numbers are considered exact and are created " +"independent of the current context. They can even have greater precision " +"than current context. Computations process with those exact inputs and then " +"rounding (or other context operations) is applied to the *result* of the " +"computation::" +msgstr "" + +#: ../../library/decimal.rst:2111 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2083 +#: ../../library/decimal.rst:2114 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " @@ -1925,31 +1962,31 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2088 +#: ../../library/decimal.rst:2119 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: ../../library/decimal.rst:2098 +#: ../../library/decimal.rst:2129 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2100 +#: ../../library/decimal.rst:2131 msgid "" "A. Yes, any binary floating point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: ../../library/decimal.rst:2109 +#: ../../library/decimal.rst:2140 msgid "" "Q. Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: ../../library/decimal.rst:2112 +#: ../../library/decimal.rst:2143 msgid "" "A. The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " @@ -1957,14 +1994,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2117 +#: ../../library/decimal.rst:2148 msgid "" "Q. I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: ../../library/decimal.rst:2121 +#: ../../library/decimal.rst:2152 msgid "" "A. Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " @@ -1973,23 +2010,23 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2134 +#: ../../library/decimal.rst:2165 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2143 +#: ../../library/decimal.rst:2174 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2149 +#: ../../library/decimal.rst:2180 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2151 +#: ../../library/decimal.rst:2182 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec Date: Wed, 28 Jun 2023 07:24:44 +0000 Subject: [PATCH 6/9] sync with cpython 2cce4654 --- library/asyncio-task.po | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/asyncio-task.po b/library/asyncio-task.po index aed2ea72cc..f94c61e4ca 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-28 07:22+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -564,20 +564,19 @@ msgstr "" msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." -"CancelledError` internally, transforming it into an :exc:`asyncio." -"TimeoutError` which can be caught and handled." +"CancelledError` internally, transforming it into a :exc:`TimeoutError` which " +"can be caught and handled." msgstr "" #: ../../library/asyncio-task.rst:608 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" -"`asyncio.CancelledError` into an :exc:`asyncio.TimeoutError`, which means " -"the :exc:`asyncio.TimeoutError` can only be caught *outside* of the context " -"manager." +"`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" +"`TimeoutError` can only be caught *outside* of the context manager." msgstr "" #: ../../library/asyncio-task.rst:613 -msgid "Example of catching :exc:`asyncio.TimeoutError`::" +msgid "Example of catching :exc:`TimeoutError`::" msgstr "" #: ../../library/asyncio-task.rst:624 From 3e72b5cdf8f28c629245af4acc1abc8f56e959b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 29 Jun 2023 00:22:19 +0000 Subject: [PATCH 7/9] sync with cpython ce091c96 --- glossary.po | 45 ++- library/asyncio-eventloop.po | 426 ++++++++++---------- library/exceptions.po | 4 +- library/optparse.po | 725 ++++++++++++++++++----------------- 4 files changed, 611 insertions(+), 589 deletions(-) diff --git a/glossary.po b/glossary.po index 6d6cb30c2b..1d9b591370 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-29 00:19+0000\n" "PO-Revision-Date: 2022-10-23 20:00+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -128,8 +128,9 @@ msgid "" "in the :attr:`__annotations__` special attribute of modules, classes, and " "functions, respectively." msgstr "" -"在執行環境 (runtime),區域變數的註釋無法被存取,但全域變數、class 屬性和函式的" -"註解,會分別被儲存在模組、class 和函式的 :attr:`__annotations__` 特殊屬性中。" +"在執行環境 (runtime),區域變數的註釋無法被存取,但全域變數、class 屬性和函式" +"的註解,會分別被儲存在模組、class 和函式的 :attr:`__annotations__` 特殊屬性" +"中。" #: ../../glossary.rst:58 msgid "" @@ -205,10 +206,11 @@ msgid "asynchronous context manager" msgstr "asynchronous context manager(非同步情境管理器)" #: ../../glossary.rst:94 +#, fuzzy msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`__aenter__` and :meth:`__aexit__` methods. " -"Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` and :meth:`~object." +"__aexit__` methods. Introduced by :pep:`492`." msgstr "" "一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" "meth:`__aenter__` 和 :meth:`__aexit__` method(方法)來控制的。由 :pep:`492` " @@ -258,23 +260,25 @@ msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" #: ../../glossary.rst:115 +#, fuzzy msgid "" "This is an :term:`asynchronous iterator` which when called using the :meth:" -"`__anext__` method returns an awaitable object which will execute the body " -"of the asynchronous generator function until the next :keyword:`yield` " -"expression." +"`~object.__anext__` method returns an awaitable object which will execute " +"the body of the asynchronous generator function until the next :keyword:" +"`yield` expression." msgstr "" "這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" "`__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable object),該物件" "將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` 運算式。" #: ../../glossary.rst:120 +#, fuzzy msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" "statements). When the *asynchronous generator iterator* effectively resumes " -"with another awaitable returned by :meth:`__anext__`, it picks up where it " -"left off. See :pep:`492` and :pep:`525`." +"with another awaitable returned by :meth:`~object.__anext__`, it picks up " +"where it left off. See :pep:`492` and :pep:`525`." msgstr "" "每個 :keyword:`yield` 會暫停處理程序,並記住位置執行狀態(包括區域變數及擱置" "中的 try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`__anext__` " @@ -286,10 +290,11 @@ msgid "asynchronous iterable" msgstr "asynchronous iterable(非同步可疊代物件)" #: ../../glossary.rst:127 +#, fuzzy msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " -"return an :term:`asynchronous iterator` from its :meth:`__aiter__` method. " -"Introduced by :pep:`492`." +"return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " +"method. Introduced by :pep:`492`." msgstr "" "一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" "`__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步疊代" @@ -300,12 +305,13 @@ msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" #: ../../glossary.rst:132 +#, fuzzy msgid "" -"An object that implements the :meth:`__aiter__` and :meth:`__anext__` " -"methods. ``__anext__`` must return an :term:`awaitable` object. :keyword:" -"`async for` resolves the awaitables returned by an asynchronous iterator's :" -"meth:`__anext__` method until it raises a :exc:`StopAsyncIteration` " -"exception. Introduced by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." +"__anext__` methods. :meth:`~object.__anext__` must return an :term:" +"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " +"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " +"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." msgstr "" "一個實作 :meth:`__aiter__` 和 :meth:`__anext__` method 的物件。\\ " "``__anext__`` 必須回傳一個 :term:`awaitable`\\ (可等待物件)。\\ :keyword:" @@ -342,10 +348,11 @@ msgid "awaitable" msgstr "awaitable(可等待物件)" #: ../../glossary.rst:151 +#, fuzzy msgid "" "An object that can be used in an :keyword:`await` expression. Can be a :" -"term:`coroutine` or an object with an :meth:`__await__` method. See also :" -"pep:`492`." +"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " +"also :pep:`492`." msgstr "" "一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" "`coroutine`\\ (協程),或是一個有 :meth:`__await__` method 的物件。另請參" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 63679e3da4..444b4a9d1d 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-03 00:17+0000\n" +"POT-Creation-Date: 2023-06-29 00:19+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -262,8 +262,8 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:182 -#: ../../library/asyncio-eventloop.rst:1216 -#: ../../library/asyncio-eventloop.rst:1604 +#: ../../library/asyncio-eventloop.rst:1219 +#: ../../library/asyncio-eventloop.rst:1607 msgid "Example::" msgstr "" "範例:\n" @@ -526,8 +526,8 @@ msgid "The socket type will be :py:data:`~socket.SOCK_STREAM`." msgstr "" #: ../../library/asyncio-eventloop.rst:406 -#: ../../library/asyncio-eventloop.rst:1132 -#: ../../library/asyncio-eventloop.rst:1148 +#: ../../library/asyncio-eventloop.rst:1135 +#: ../../library/asyncio-eventloop.rst:1151 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -653,7 +653,7 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:484 -#: ../../library/asyncio-eventloop.rst:895 +#: ../../library/asyncio-eventloop.rst:898 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -663,7 +663,7 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:488 #: ../../library/asyncio-eventloop.rst:721 #: ../../library/asyncio-eventloop.rst:815 -#: ../../library/asyncio-eventloop.rst:899 +#: ../../library/asyncio-eventloop.rst:902 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -710,7 +710,7 @@ msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" #: ../../library/asyncio-eventloop.rst:747 #: ../../library/asyncio-eventloop.rst:782 #: ../../library/asyncio-eventloop.rst:829 -#: ../../library/asyncio-eventloop.rst:907 +#: ../../library/asyncio-eventloop.rst:910 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" @@ -863,7 +863,7 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:633 #: ../../library/asyncio-eventloop.rst:773 -#: ../../library/asyncio-eventloop.rst:1199 +#: ../../library/asyncio-eventloop.rst:1202 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -1044,7 +1044,7 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:794 -#: ../../library/asyncio-eventloop.rst:881 +#: ../../library/asyncio-eventloop.rst:884 msgid "Parameters:" msgstr "參數:" @@ -1089,7 +1089,7 @@ msgid "*file* must be a regular file object opened in binary mode." msgstr "" #: ../../library/asyncio-eventloop.rst:845 -#: ../../library/asyncio-eventloop.rst:1087 +#: ../../library/asyncio-eventloop.rst:1090 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1134,74 +1134,80 @@ msgid "" "exchanges extra TLS session packets with *transport*." msgstr "" -#: ../../library/asyncio-eventloop.rst:883 +#: ../../library/asyncio-eventloop.rst:881 +msgid "" +"In some situations (e.g. when the passed transport is already closing) this " +"may return ``None``." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:886 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." msgstr "" -#: ../../library/asyncio-eventloop.rst:887 +#: ../../library/asyncio-eventloop.rst:890 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -#: ../../library/asyncio-eventloop.rst:889 +#: ../../library/asyncio-eventloop.rst:892 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." msgstr "" -#: ../../library/asyncio-eventloop.rst:892 +#: ../../library/asyncio-eventloop.rst:895 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "" -#: ../../library/asyncio-eventloop.rst:912 +#: ../../library/asyncio-eventloop.rst:915 msgid "Watching file descriptors" msgstr "" -#: ../../library/asyncio-eventloop.rst:916 +#: ../../library/asyncio-eventloop.rst:919 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." msgstr "" -#: ../../library/asyncio-eventloop.rst:922 +#: ../../library/asyncio-eventloop.rst:925 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." msgstr "" -#: ../../library/asyncio-eventloop.rst:927 +#: ../../library/asyncio-eventloop.rst:930 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." msgstr "" -#: ../../library/asyncio-eventloop.rst:931 -#: ../../library/asyncio-eventloop.rst:1186 +#: ../../library/asyncio-eventloop.rst:934 +#: ../../library/asyncio-eventloop.rst:1189 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." msgstr "" -#: ../../library/asyncio-eventloop.rst:936 +#: ../../library/asyncio-eventloop.rst:939 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." msgstr "" -#: ../../library/asyncio-eventloop.rst:939 +#: ../../library/asyncio-eventloop.rst:942 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." msgstr "" -#: ../../library/asyncio-eventloop.rst:944 +#: ../../library/asyncio-eventloop.rst:947 msgid "Working with socket objects directly" msgstr "" -#: ../../library/asyncio-eventloop.rst:946 +#: ../../library/asyncio-eventloop.rst:949 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1210,72 +1216,72 @@ msgid "" "socket` objects directly is more convenient." msgstr "" -#: ../../library/asyncio-eventloop.rst:955 +#: ../../library/asyncio-eventloop.rst:958 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:958 +#: ../../library/asyncio-eventloop.rst:961 msgid "Return the received data as a bytes object." msgstr "" -#: ../../library/asyncio-eventloop.rst:960 -#: ../../library/asyncio-eventloop.rst:974 -#: ../../library/asyncio-eventloop.rst:985 -#: ../../library/asyncio-eventloop.rst:997 -#: ../../library/asyncio-eventloop.rst:1012 -#: ../../library/asyncio-eventloop.rst:1027 -#: ../../library/asyncio-eventloop.rst:1037 -#: ../../library/asyncio-eventloop.rst:1063 -#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:963 +#: ../../library/asyncio-eventloop.rst:977 +#: ../../library/asyncio-eventloop.rst:988 +#: ../../library/asyncio-eventloop.rst:1000 +#: ../../library/asyncio-eventloop.rst:1015 +#: ../../library/asyncio-eventloop.rst:1030 +#: ../../library/asyncio-eventloop.rst:1040 +#: ../../library/asyncio-eventloop.rst:1066 +#: ../../library/asyncio-eventloop.rst:1104 msgid "*sock* must be a non-blocking socket." msgstr "" -#: ../../library/asyncio-eventloop.rst:962 +#: ../../library/asyncio-eventloop.rst:965 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " "is an ``async def`` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:969 +#: ../../library/asyncio-eventloop.rst:972 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:972 +#: ../../library/asyncio-eventloop.rst:975 msgid "Return the number of bytes written to the buffer." msgstr "" -#: ../../library/asyncio-eventloop.rst:980 +#: ../../library/asyncio-eventloop.rst:983 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:983 +#: ../../library/asyncio-eventloop.rst:986 msgid "Return a tuple of (received data, remote address)." msgstr "" -#: ../../library/asyncio-eventloop.rst:991 +#: ../../library/asyncio-eventloop.rst:994 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:998 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "" -#: ../../library/asyncio-eventloop.rst:1003 +#: ../../library/asyncio-eventloop.rst:1006 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1006 +#: ../../library/asyncio-eventloop.rst:1009 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1284,34 +1290,34 @@ msgid "" "the connection." msgstr "" -#: ../../library/asyncio-eventloop.rst:1014 -#: ../../library/asyncio-eventloop.rst:1065 +#: ../../library/asyncio-eventloop.rst:1017 +#: ../../library/asyncio-eventloop.rst:1068 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " "``async def`` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:1021 +#: ../../library/asyncio-eventloop.rst:1024 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1025 +#: ../../library/asyncio-eventloop.rst:1028 msgid "Return the number of bytes sent." msgstr "" -#: ../../library/asyncio-eventloop.rst:1033 +#: ../../library/asyncio-eventloop.rst:1036 msgid "Connect *sock* to a remote socket at *address*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1038 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1039 +#: ../../library/asyncio-eventloop.rst:1042 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1319,19 +1325,19 @@ msgid "" "*address*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1048 +#: ../../library/asyncio-eventloop.rst:1051 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1054 +#: ../../library/asyncio-eventloop.rst:1057 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:1057 +#: ../../library/asyncio-eventloop.rst:1060 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1339,57 +1345,57 @@ msgid "" "the address bound to the socket on the other end of the connection." msgstr "" -#: ../../library/asyncio-eventloop.rst:1072 +#: ../../library/asyncio-eventloop.rst:1075 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`\\ 。" -#: ../../library/asyncio-eventloop.rst:1077 +#: ../../library/asyncio-eventloop.rst:1080 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" -#: ../../library/asyncio-eventloop.rst:1080 +#: ../../library/asyncio-eventloop.rst:1083 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1082 +#: ../../library/asyncio-eventloop.rst:1085 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1085 +#: ../../library/asyncio-eventloop.rst:1088 msgid "*file* must be a regular file object open in binary mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:1094 +#: ../../library/asyncio-eventloop.rst:1097 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " "or SSL socket on Unix)." msgstr "" -#: ../../library/asyncio-eventloop.rst:1098 +#: ../../library/asyncio-eventloop.rst:1101 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1107 +#: ../../library/asyncio-eventloop.rst:1110 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1112 +#: ../../library/asyncio-eventloop.rst:1115 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1116 +#: ../../library/asyncio-eventloop.rst:1119 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1118 +#: ../../library/asyncio-eventloop.rst:1121 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1397,67 +1403,67 @@ msgid "" "coroutines." msgstr "" -#: ../../library/asyncio-eventloop.rst:1126 +#: ../../library/asyncio-eventloop.rst:1129 msgid "Working with pipes" msgstr "" -#: ../../library/asyncio-eventloop.rst:1130 +#: ../../library/asyncio-eventloop.rst:1133 msgid "Register the read end of *pipe* in the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1135 +#: ../../library/asyncio-eventloop.rst:1138 msgid "*pipe* is a :term:`file-like object `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1137 +#: ../../library/asyncio-eventloop.rst:1140 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " "*protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1141 -#: ../../library/asyncio-eventloop.rst:1157 +#: ../../library/asyncio-eventloop.rst:1144 +#: ../../library/asyncio-eventloop.rst:1160 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:1146 +#: ../../library/asyncio-eventloop.rst:1149 msgid "Register the write end of *pipe* in the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1151 +#: ../../library/asyncio-eventloop.rst:1154 msgid "*pipe* is :term:`file-like object `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1153 +#: ../../library/asyncio-eventloop.rst:1156 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " "*protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1162 +#: ../../library/asyncio-eventloop.rst:1165 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -#: ../../library/asyncio-eventloop.rst:1167 +#: ../../library/asyncio-eventloop.rst:1170 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr "" -#: ../../library/asyncio-eventloop.rst:1172 +#: ../../library/asyncio-eventloop.rst:1175 msgid "Unix signals" msgstr "" -#: ../../library/asyncio-eventloop.rst:1176 +#: ../../library/asyncio-eventloop.rst:1179 msgid "Set *callback* as the handler for the *signum* signal." msgstr "" -#: ../../library/asyncio-eventloop.rst:1178 +#: ../../library/asyncio-eventloop.rst:1181 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1465,46 +1471,46 @@ msgid "" "function is allowed to interact with the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1186 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1189 +#: ../../library/asyncio-eventloop.rst:1192 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1197 msgid "Remove the handler for the *sig* signal." msgstr "" -#: ../../library/asyncio-eventloop.rst:1196 +#: ../../library/asyncio-eventloop.rst:1199 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." msgstr "" -#: ../../library/asyncio-eventloop.rst:1203 +#: ../../library/asyncio-eventloop.rst:1206 msgid "The :mod:`signal` module." msgstr "" -#: ../../library/asyncio-eventloop.rst:1207 +#: ../../library/asyncio-eventloop.rst:1210 msgid "Executing code in thread or process pools" msgstr "" -#: ../../library/asyncio-eventloop.rst:1211 +#: ../../library/asyncio-eventloop.rst:1214 msgid "Arrange for *func* to be called in the specified executor." msgstr "" -#: ../../library/asyncio-eventloop.rst:1213 +#: ../../library/asyncio-eventloop.rst:1216 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1258 +#: ../../library/asyncio-eventloop.rst:1261 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1512,17 +1518,17 @@ msgid "" "importing of main module `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1263 +#: ../../library/asyncio-eventloop.rst:1266 msgid "This method returns a :class:`asyncio.Future` object." msgstr "" -#: ../../library/asyncio-eventloop.rst:1265 +#: ../../library/asyncio-eventloop.rst:1268 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1268 +#: ../../library/asyncio-eventloop.rst:1271 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1530,32 +1536,32 @@ msgid "" "default." msgstr "" -#: ../../library/asyncio-eventloop.rst:1277 +#: ../../library/asyncio-eventloop.rst:1280 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1281 +#: ../../library/asyncio-eventloop.rst:1284 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1287 +#: ../../library/asyncio-eventloop.rst:1290 msgid "Error Handling API" msgstr "" -#: ../../library/asyncio-eventloop.rst:1289 +#: ../../library/asyncio-eventloop.rst:1292 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1293 +#: ../../library/asyncio-eventloop.rst:1296 msgid "Set *handler* as the new event loop exception handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1295 +#: ../../library/asyncio-eventloop.rst:1298 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -1564,158 +1570,158 @@ msgid "" "(see :meth:`call_exception_handler` documentation for details about context)." msgstr "" -#: ../../library/asyncio-eventloop.rst:1305 +#: ../../library/asyncio-eventloop.rst:1308 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" -#: ../../library/asyncio-eventloop.rst:1312 +#: ../../library/asyncio-eventloop.rst:1315 msgid "Default exception handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1314 +#: ../../library/asyncio-eventloop.rst:1317 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " "default handler behavior." msgstr "" -#: ../../library/asyncio-eventloop.rst:1318 +#: ../../library/asyncio-eventloop.rst:1321 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1323 +#: ../../library/asyncio-eventloop.rst:1326 msgid "Call the current event loop exception handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1325 +#: ../../library/asyncio-eventloop.rst:1328 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" msgstr "" -#: ../../library/asyncio-eventloop.rst:1328 +#: ../../library/asyncio-eventloop.rst:1331 msgid "'message': Error message;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1329 +#: ../../library/asyncio-eventloop.rst:1332 msgid "'exception' (optional): Exception object;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1333 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1331 +#: ../../library/asyncio-eventloop.rst:1334 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1332 +#: ../../library/asyncio-eventloop.rst:1335 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1333 +#: ../../library/asyncio-eventloop.rst:1336 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1334 +#: ../../library/asyncio-eventloop.rst:1337 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1335 +#: ../../library/asyncio-eventloop.rst:1338 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1337 +#: ../../library/asyncio-eventloop.rst:1340 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "" -#: ../../library/asyncio-eventloop.rst:1337 +#: ../../library/asyncio-eventloop.rst:1340 msgid "the exception." msgstr "" -#: ../../library/asyncio-eventloop.rst:1341 +#: ../../library/asyncio-eventloop.rst:1344 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler()` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:1346 +#: ../../library/asyncio-eventloop.rst:1349 msgid "Enabling debug mode" msgstr "" -#: ../../library/asyncio-eventloop.rst:1350 +#: ../../library/asyncio-eventloop.rst:1353 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1352 +#: ../../library/asyncio-eventloop.rst:1355 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." msgstr "" -#: ../../library/asyncio-eventloop.rst:1358 +#: ../../library/asyncio-eventloop.rst:1361 msgid "Set the debug mode of the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1362 +#: ../../library/asyncio-eventloop.rst:1365 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:1367 +#: ../../library/asyncio-eventloop.rst:1370 msgid "The :ref:`debug mode of asyncio `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1371 +#: ../../library/asyncio-eventloop.rst:1374 msgid "Running Subprocesses" msgstr "" -#: ../../library/asyncio-eventloop.rst:1373 +#: ../../library/asyncio-eventloop.rst:1376 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1383 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" "`Subprocess Support on Windows ` for details." msgstr "" -#: ../../library/asyncio-eventloop.rst:1389 +#: ../../library/asyncio-eventloop.rst:1392 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1392 +#: ../../library/asyncio-eventloop.rst:1395 msgid "*args* must be a list of strings represented by:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1397 msgid ":class:`str`;" msgstr ":class:`str`\\ ;" -#: ../../library/asyncio-eventloop.rst:1395 +#: ../../library/asyncio-eventloop.rst:1398 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1398 +#: ../../library/asyncio-eventloop.rst:1401 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " "program." msgstr "" -#: ../../library/asyncio-eventloop.rst:1402 +#: ../../library/asyncio-eventloop.rst:1405 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -1723,136 +1729,136 @@ msgid "" "which is list of strings, *subprocess_exec* takes multiple string arguments." msgstr "" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1411 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." msgstr "" -#: ../../library/asyncio-eventloop.rst:1411 +#: ../../library/asyncio-eventloop.rst:1414 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1413 +#: ../../library/asyncio-eventloop.rst:1416 msgid "*stdin* can be any of these:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1415 +#: ../../library/asyncio-eventloop.rst:1418 msgid "" "a file-like object representing a pipe to be connected to the subprocess's " "standard input stream using :meth:`~loop.connect_write_pipe`" msgstr "" -#: ../../library/asyncio-eventloop.rst:1418 -#: ../../library/asyncio-eventloop.rst:1430 -#: ../../library/asyncio-eventloop.rst:1442 +#: ../../library/asyncio-eventloop.rst:1421 +#: ../../library/asyncio-eventloop.rst:1433 +#: ../../library/asyncio-eventloop.rst:1445 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr "" -#: ../../library/asyncio-eventloop.rst:1420 -#: ../../library/asyncio-eventloop.rst:1432 -#: ../../library/asyncio-eventloop.rst:1444 +#: ../../library/asyncio-eventloop.rst:1423 +#: ../../library/asyncio-eventloop.rst:1435 +#: ../../library/asyncio-eventloop.rst:1447 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "" -#: ../../library/asyncio-eventloop.rst:1422 -#: ../../library/asyncio-eventloop.rst:1434 -#: ../../library/asyncio-eventloop.rst:1446 +#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1437 +#: ../../library/asyncio-eventloop.rst:1449 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" -#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1428 msgid "*stdout* can be any of these:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1427 +#: ../../library/asyncio-eventloop.rst:1430 msgid "" "a file-like object representing a pipe to be connected to the subprocess's " "standard output stream using :meth:`~loop.connect_write_pipe`" msgstr "" -#: ../../library/asyncio-eventloop.rst:1437 +#: ../../library/asyncio-eventloop.rst:1440 msgid "*stderr* can be any of these:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1439 +#: ../../library/asyncio-eventloop.rst:1442 msgid "" "a file-like object representing a pipe to be connected to the subprocess's " "standard error stream using :meth:`~loop.connect_write_pipe`" msgstr "" -#: ../../library/asyncio-eventloop.rst:1448 +#: ../../library/asyncio-eventloop.rst:1451 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" -#: ../../library/asyncio-eventloop.rst:1451 +#: ../../library/asyncio-eventloop.rst:1454 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " "*encoding* and *errors*, which should not be specified at all." msgstr "" -#: ../../library/asyncio-eventloop.rst:1456 +#: ../../library/asyncio-eventloop.rst:1459 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " "the stream to text." msgstr "" -#: ../../library/asyncio-eventloop.rst:1460 +#: ../../library/asyncio-eventloop.rst:1463 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "" -#: ../../library/asyncio-eventloop.rst:1463 +#: ../../library/asyncio-eventloop.rst:1466 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1471 +#: ../../library/asyncio-eventloop.rst:1474 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -#: ../../library/asyncio-eventloop.rst:1476 +#: ../../library/asyncio-eventloop.rst:1479 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1479 +#: ../../library/asyncio-eventloop.rst:1482 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." msgstr "" -#: ../../library/asyncio-eventloop.rst:1482 +#: ../../library/asyncio-eventloop.rst:1485 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "" -#: ../../library/asyncio-eventloop.rst:1485 +#: ../../library/asyncio-eventloop.rst:1488 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1490 +#: ../../library/asyncio-eventloop.rst:1493 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -1862,105 +1868,105 @@ msgid "" "used to construct shell commands." msgstr "" -#: ../../library/asyncio-eventloop.rst:1499 +#: ../../library/asyncio-eventloop.rst:1502 msgid "Callback Handles" msgstr "" -#: ../../library/asyncio-eventloop.rst:1503 +#: ../../library/asyncio-eventloop.rst:1506 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1508 +#: ../../library/asyncio-eventloop.rst:1511 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "" -#: ../../library/asyncio-eventloop.rst:1513 +#: ../../library/asyncio-eventloop.rst:1516 msgid "Return ``True`` if the callback was cancelled." msgstr "" -#: ../../library/asyncio-eventloop.rst:1519 +#: ../../library/asyncio-eventloop.rst:1522 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1522 +#: ../../library/asyncio-eventloop.rst:1525 msgid "This class is a subclass of :class:`Handle`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1526 +#: ../../library/asyncio-eventloop.rst:1529 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "" -#: ../../library/asyncio-eventloop.rst:1528 +#: ../../library/asyncio-eventloop.rst:1531 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1535 +#: ../../library/asyncio-eventloop.rst:1538 msgid "Server Objects" msgstr "" -#: ../../library/asyncio-eventloop.rst:1537 +#: ../../library/asyncio-eventloop.rst:1540 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " "functions." msgstr "" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1544 msgid "Do not instantiate the :class:`Server` class directly." msgstr "" -#: ../../library/asyncio-eventloop.rst:1545 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " "accepting new connections when the ``async with`` statement is completed::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1558 +#: ../../library/asyncio-eventloop.rst:1561 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "" -#: ../../library/asyncio-eventloop.rst:1563 +#: ../../library/asyncio-eventloop.rst:1566 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1566 +#: ../../library/asyncio-eventloop.rst:1569 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "" -#: ../../library/asyncio-eventloop.rst:1569 +#: ../../library/asyncio-eventloop.rst:1572 msgid "" "The server is closed asynchronously, use the :meth:`wait_closed` coroutine " "to wait until the server is closed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1574 +#: ../../library/asyncio-eventloop.rst:1577 msgid "Return the event loop associated with the server object." msgstr "" -#: ../../library/asyncio-eventloop.rst:1580 +#: ../../library/asyncio-eventloop.rst:1583 msgid "Start accepting connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1582 +#: ../../library/asyncio-eventloop.rst:1585 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "" -#: ../../library/asyncio-eventloop.rst:1585 +#: ../../library/asyncio-eventloop.rst:1588 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -1969,98 +1975,98 @@ msgid "" "accepting connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1596 +#: ../../library/asyncio-eventloop.rst:1599 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1600 +#: ../../library/asyncio-eventloop.rst:1603 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." msgstr "" -#: ../../library/asyncio-eventloop.rst:1622 +#: ../../library/asyncio-eventloop.rst:1625 msgid "Return ``True`` if the server is accepting new connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1628 +#: ../../library/asyncio-eventloop.rst:1631 msgid "Wait until the :meth:`close` method completes." msgstr "" -#: ../../library/asyncio-eventloop.rst:1632 +#: ../../library/asyncio-eventloop.rst:1635 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" -#: ../../library/asyncio-eventloop.rst:1635 +#: ../../library/asyncio-eventloop.rst:1638 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." msgstr "" -#: ../../library/asyncio-eventloop.rst:1645 +#: ../../library/asyncio-eventloop.rst:1648 msgid "Event Loop Implementations" msgstr "" -#: ../../library/asyncio-eventloop.rst:1647 +#: ../../library/asyncio-eventloop.rst:1650 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1650 +#: ../../library/asyncio-eventloop.rst:1653 msgid "" "By default asyncio is configured to use :class:`SelectorEventLoop` on Unix " "and :class:`ProactorEventLoop` on Windows." msgstr "" -#: ../../library/asyncio-eventloop.rst:1656 +#: ../../library/asyncio-eventloop.rst:1659 msgid "An event loop based on the :mod:`selectors` module." msgstr "" -#: ../../library/asyncio-eventloop.rst:1658 +#: ../../library/asyncio-eventloop.rst:1661 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " "used::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1673 +#: ../../library/asyncio-eventloop.rst:1676 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/asyncio-eventloop.rst:1678 +#: ../../library/asyncio-eventloop.rst:1681 msgid "An event loop for Windows that uses \"I/O Completion Ports\" (IOCP)." msgstr "" -#: ../../library/asyncio-eventloop.rst:1680 +#: ../../library/asyncio-eventloop.rst:1683 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/asyncio-eventloop.rst:1684 +#: ../../library/asyncio-eventloop.rst:1687 msgid "" "`MSDN documentation on I/O Completion Ports `_." msgstr "" -#: ../../library/asyncio-eventloop.rst:1690 +#: ../../library/asyncio-eventloop.rst:1693 msgid "Abstract base class for asyncio-compliant event loops." msgstr "" -#: ../../library/asyncio-eventloop.rst:1692 +#: ../../library/asyncio-eventloop.rst:1695 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." msgstr "" -#: ../../library/asyncio-eventloop.rst:1698 +#: ../../library/asyncio-eventloop.rst:1701 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1700 +#: ../../library/asyncio-eventloop.rst:1703 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -2068,70 +2074,70 @@ msgid "" "consider using the high-level functions like :func:`asyncio.run`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1710 +#: ../../library/asyncio-eventloop.rst:1713 msgid "Hello World with call_soon()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1712 +#: ../../library/asyncio-eventloop.rst:1715 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1736 +#: ../../library/asyncio-eventloop.rst:1739 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" -#: ../../library/asyncio-eventloop.rst:1743 +#: ../../library/asyncio-eventloop.rst:1746 msgid "Display the current date with call_later()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1745 +#: ../../library/asyncio-eventloop.rst:1748 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " "5 seconds, and then stops the event loop::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1773 +#: ../../library/asyncio-eventloop.rst:1776 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." msgstr "" -#: ../../library/asyncio-eventloop.rst:1780 +#: ../../library/asyncio-eventloop.rst:1783 msgid "Watch a file descriptor for read events" msgstr "" -#: ../../library/asyncio-eventloop.rst:1782 +#: ../../library/asyncio-eventloop.rst:1785 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1820 +#: ../../library/asyncio-eventloop.rst:1823 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:1824 +#: ../../library/asyncio-eventloop.rst:1827 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." msgstr "" -#: ../../library/asyncio-eventloop.rst:1832 +#: ../../library/asyncio-eventloop.rst:1835 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "" -#: ../../library/asyncio-eventloop.rst:1834 +#: ../../library/asyncio-eventloop.rst:1837 msgid "(This ``signals`` example only works on Unix.)" msgstr "" -#: ../../library/asyncio-eventloop.rst:1836 +#: ../../library/asyncio-eventloop.rst:1839 msgid "" "Register handlers for signals :py:data:`SIGINT` and :py:data:`SIGTERM` using " "the :meth:`loop.add_signal_handler` method::" diff --git a/library/exceptions.po b/library/exceptions.po index 9c79cde362..b0828b4fd3 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-29 00:19+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -524,7 +524,7 @@ msgstr "" #: ../../library/exceptions.rst:453 msgid "" -"Must be raised by :meth:`__anext__` method of an :term:`asynchronous " +"Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." msgstr "" diff --git a/library/optparse.po b/library/optparse.po index f284f026a0..ecec1b0603 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-25 00:20+0000\n" +"POT-Creation-Date: 2023-06-29 00:19+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -56,13 +56,14 @@ msgstr "" #: ../../library/optparse.rst:44 msgid "" "As it parses the command line, :mod:`optparse` sets attributes of the " -"``options`` object returned by :meth:`parse_args` based on user-supplied " -"command-line values. When :meth:`parse_args` returns from parsing this " -"command line, ``options.filename`` will be ``\"outfile\"`` and ``options." -"verbose`` will be ``False``. :mod:`optparse` supports both long and short " -"options, allows short options to be merged together, and allows options to " -"be associated with their arguments in a variety of ways. Thus, the " -"following command lines are all equivalent to the above example::" +"``options`` object returned by :meth:`~OptionParser.parse_args` based on " +"user-supplied command-line values. When :meth:`~OptionParser.parse_args` " +"returns from parsing this command line, ``options.filename`` will be " +"``\"outfile\"`` and ``options.verbose`` will be ``False``. :mod:`optparse` " +"supports both long and short options, allows short options to be merged " +"together, and allows options to be associated with their arguments in a " +"variety of ways. Thus, the following command lines are all equivalent to " +"the above example::" msgstr "" #: ../../library/optparse.rst:58 @@ -365,12 +366,14 @@ msgstr "" #: ../../library/optparse.rst:288 msgid "" -"(If you like, you can pass a custom argument list to :meth:`parse_args`, but " -"that's rarely necessary: by default it uses ``sys.argv[1:]``.)" +"(If you like, you can pass a custom argument list to :meth:`~OptionParser." +"parse_args`, but that's rarely necessary: by default it uses ``sys." +"argv[1:]``.)" msgstr "" #: ../../library/optparse.rst:291 -msgid ":meth:`parse_args` returns two values:" +#, fuzzy +msgid ":meth:`~OptionParser.parse_args` returns two values:" msgstr ":meth:`parse_args` 回傳兩個值:" #: ../../library/optparse.rst:293 @@ -440,7 +443,8 @@ msgstr "" msgid "" "When :mod:`optparse` sees the option string ``-f``, it consumes the next " "argument, ``foo.txt``, and stores it in ``options.filename``. So, after " -"this call to :meth:`parse_args`, ``options.filename`` is ``\"foo.txt\"``." +"this call to :meth:`~OptionParser.parse_args`, ``options.filename`` is " +"``\"foo.txt\"``." msgstr "" #: ../../library/optparse.rst:344 @@ -522,35 +526,35 @@ msgstr "" msgid "Some other actions supported by :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:407 ../../library/optparse.rst:928 +#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 msgid "``\"store_const\"``" msgstr "``\"store_const\"``" -#: ../../library/optparse.rst:407 ../../library/optparse.rst:928 +#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 msgid "store a constant value, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:410 ../../library/optparse.rst:937 +#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 msgid "``\"append\"``" msgstr "``\"append\"``" -#: ../../library/optparse.rst:410 ../../library/optparse.rst:937 +#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 msgid "append this option's argument to a list" msgstr "" -#: ../../library/optparse.rst:413 ../../library/optparse.rst:943 +#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 msgid "``\"count\"``" msgstr "``\"count\"``" -#: ../../library/optparse.rst:413 ../../library/optparse.rst:943 +#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 msgid "increment a counter by one" msgstr "" -#: ../../library/optparse.rst:416 ../../library/optparse.rst:946 +#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 msgid "``\"callback\"``" msgstr "``\"callback\"``" -#: ../../library/optparse.rst:416 ../../library/optparse.rst:946 +#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 msgid "call a specified function" msgstr "" @@ -601,21 +605,21 @@ msgstr "" msgid "" "A clearer way to specify default values is the :meth:`set_defaults` method " "of OptionParser, which you can call at any time before calling :meth:" -"`parse_args`::" +"`~OptionParser.parse_args`::" msgstr "" -#: ../../library/optparse.rst:462 +#: ../../library/optparse.rst:463 msgid "" "As before, the last value specified for a given option destination is the " "one that counts. For clarity, try to use one method or the other of setting " "default values, not both." msgstr "" -#: ../../library/optparse.rst:470 +#: ../../library/optparse.rst:471 msgid "Generating help" msgstr "" -#: ../../library/optparse.rst:472 +#: ../../library/optparse.rst:473 msgid "" ":mod:`optparse`'s ability to generate help and usage text automatically is " "useful for creating user-friendly command-line interfaces. All you have to " @@ -624,57 +628,57 @@ msgid "" "populated with user-friendly (documented) options::" msgstr "" -#: ../../library/optparse.rst:493 +#: ../../library/optparse.rst:494 msgid "" "If :mod:`optparse` encounters either ``-h`` or ``--help`` on the command-" "line, or if you just call :meth:`parser.print_help`, it prints the following " "to standard output:" msgstr "" -#: ../../library/optparse.rst:510 +#: ../../library/optparse.rst:511 msgid "" "(If the help output is triggered by a help option, :mod:`optparse` exits " "after printing the help text.)" msgstr "" -#: ../../library/optparse.rst:513 +#: ../../library/optparse.rst:514 msgid "" "There's a lot going on here to help :mod:`optparse` generate the best " "possible help message:" msgstr "" -#: ../../library/optparse.rst:516 +#: ../../library/optparse.rst:517 msgid "the script defines its own usage message::" msgstr "" -#: ../../library/optparse.rst:520 +#: ../../library/optparse.rst:521 msgid "" ":mod:`optparse` expands ``%prog`` in the usage string to the name of the " "current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded " "string is then printed before the detailed option help." msgstr "" -#: ../../library/optparse.rst:524 +#: ../../library/optparse.rst:525 msgid "" "If you don't supply a usage string, :mod:`optparse` uses a bland but " "sensible default: ``\"Usage: %prog [options]\"``, which is fine if your " "script doesn't take any positional arguments." msgstr "" -#: ../../library/optparse.rst:528 +#: ../../library/optparse.rst:529 msgid "" "every option defines a help string, and doesn't worry about line-wrapping---" "\\ :mod:`optparse` takes care of wrapping lines and making the help output " "look good." msgstr "" -#: ../../library/optparse.rst:532 +#: ../../library/optparse.rst:533 msgid "" "options that take a value indicate this fact in their automatically " "generated help message, e.g. for the \"mode\" option::" msgstr "" -#: ../../library/optparse.rst:537 +#: ../../library/optparse.rst:538 msgid "" "Here, \"MODE\" is called the meta-variable: it stands for the argument that " "the user is expected to supply to ``-m``/``--mode``. By default, :mod:" @@ -684,7 +688,7 @@ msgid "" "this automatically generated option description::" msgstr "" -#: ../../library/optparse.rst:546 +#: ../../library/optparse.rst:547 msgid "" "This is important for more than just saving space, though: the manually " "written help text uses the meta-variable ``FILE`` to clue the user in that " @@ -694,7 +698,7 @@ msgid "" "users." msgstr "" -#: ../../library/optparse.rst:552 +#: ../../library/optparse.rst:553 msgid "" "options that have a default value can include ``%default`` in the help " "string---\\ :mod:`optparse` will replace it with :func:`str` of the option's " @@ -702,96 +706,96 @@ msgid "" "``None``), ``%default`` expands to ``none``." msgstr "" -#: ../../library/optparse.rst:558 +#: ../../library/optparse.rst:559 msgid "Grouping Options" msgstr "" -#: ../../library/optparse.rst:560 +#: ../../library/optparse.rst:561 msgid "" "When dealing with many options, it is convenient to group these options for " "better help output. An :class:`OptionParser` can contain several option " "groups, each of which can contain several options." msgstr "" -#: ../../library/optparse.rst:564 +#: ../../library/optparse.rst:565 msgid "An option group is obtained using the class :class:`OptionGroup`:" msgstr "" -#: ../../library/optparse.rst:568 ../../library/optparse.rst:1637 +#: ../../library/optparse.rst:569 ../../library/optparse.rst:1640 msgid "where" msgstr "" -#: ../../library/optparse.rst:570 +#: ../../library/optparse.rst:571 msgid "" "parser is the :class:`OptionParser` instance the group will be inserted in to" msgstr "" -#: ../../library/optparse.rst:572 +#: ../../library/optparse.rst:573 msgid "title is the group title" msgstr "" -#: ../../library/optparse.rst:573 +#: ../../library/optparse.rst:574 msgid "description, optional, is a long description of the group" msgstr "" -#: ../../library/optparse.rst:575 +#: ../../library/optparse.rst:576 msgid "" ":class:`OptionGroup` inherits from :class:`OptionContainer` (like :class:" "`OptionParser`) and so the :meth:`add_option` method can be used to add an " "option to the group." msgstr "" -#: ../../library/optparse.rst:579 +#: ../../library/optparse.rst:580 msgid "" "Once all the options are declared, using the :class:`OptionParser` method :" "meth:`add_option_group` the group is added to the previously defined parser." msgstr "" -#: ../../library/optparse.rst:582 +#: ../../library/optparse.rst:583 msgid "" "Continuing with the parser defined in the previous section, adding an :class:" "`OptionGroup` to a parser is easy::" msgstr "" -#: ../../library/optparse.rst:591 +#: ../../library/optparse.rst:592 msgid "This would result in the following help output:" msgstr "" -#: ../../library/optparse.rst:612 +#: ../../library/optparse.rst:613 msgid "" "A bit more complete example might involve using more than one group: still " "extending the previous example::" msgstr "" -#: ../../library/optparse.rst:629 +#: ../../library/optparse.rst:630 msgid "that results in the following output:" msgstr "" -#: ../../library/optparse.rst:655 +#: ../../library/optparse.rst:656 msgid "" "Another interesting method, in particular when working programmatically with " "option groups is:" msgstr "" -#: ../../library/optparse.rst:660 +#: ../../library/optparse.rst:661 msgid "" "Return the :class:`OptionGroup` to which the short or long option string " "*opt_str* (e.g. ``'-o'`` or ``'--option'``) belongs. If there's no such :" "class:`OptionGroup`, return ``None``." msgstr "" -#: ../../library/optparse.rst:667 +#: ../../library/optparse.rst:668 msgid "Printing a version string" msgstr "" -#: ../../library/optparse.rst:669 +#: ../../library/optparse.rst:670 msgid "" "Similar to the brief usage string, :mod:`optparse` can also print a version " "string for your program. You have to supply the string as the ``version`` " "argument to OptionParser::" msgstr "" -#: ../../library/optparse.rst:675 +#: ../../library/optparse.rst:676 msgid "" "``%prog`` is expanded just like it is in ``usage``. Apart from that, " "``version`` can contain anything you like. When you supply it, :mod:" @@ -800,17 +804,17 @@ msgid "" "string (by replacing ``%prog``), prints it to stdout, and exits." msgstr "" -#: ../../library/optparse.rst:681 +#: ../../library/optparse.rst:682 msgid "For example, if your script is called ``/usr/bin/foo``:" msgstr "" -#: ../../library/optparse.rst:688 +#: ../../library/optparse.rst:689 msgid "" "The following two methods can be used to print and get the ``version`` " "string:" msgstr "" -#: ../../library/optparse.rst:692 +#: ../../library/optparse.rst:693 msgid "" "Print the version message for the current program (``self.version``) to " "*file* (default stdout). As with :meth:`print_usage`, any occurrence of " @@ -818,17 +822,17 @@ msgid "" "program. Does nothing if ``self.version`` is empty or undefined." msgstr "" -#: ../../library/optparse.rst:699 +#: ../../library/optparse.rst:700 msgid "" "Same as :meth:`print_version` but returns the version string instead of " "printing it." msgstr "" -#: ../../library/optparse.rst:706 +#: ../../library/optparse.rst:707 msgid "How :mod:`optparse` handles errors" msgstr "" -#: ../../library/optparse.rst:708 +#: ../../library/optparse.rst:709 msgid "" "There are two broad classes of errors that :mod:`optparse` has to worry " "about: programmer errors and user errors. Programmer errors are usually " @@ -838,7 +842,7 @@ msgid "" "OptionError` or :exc:`TypeError`) and let the program crash." msgstr "" -#: ../../library/optparse.rst:715 +#: ../../library/optparse.rst:716 msgid "" "Handling user errors is much more important, since they are guaranteed to " "happen no matter how stable your code is. :mod:`optparse` can automatically " @@ -849,71 +853,71 @@ msgid "" "error condition::" msgstr "" -#: ../../library/optparse.rst:728 +#: ../../library/optparse.rst:729 msgid "" "In either case, :mod:`optparse` handles the error the same way: it prints " "the program's usage message and an error message to standard error and exits " "with error status 2." msgstr "" -#: ../../library/optparse.rst:732 +#: ../../library/optparse.rst:733 msgid "" "Consider the first example above, where the user passes ``4x`` to an option " "that takes an integer:" msgstr "" -#: ../../library/optparse.rst:742 +#: ../../library/optparse.rst:743 msgid "Or, where the user fails to pass a value at all:" msgstr "" -#: ../../library/optparse.rst:751 +#: ../../library/optparse.rst:752 msgid "" ":mod:`optparse`\\ -generated error messages take care always to mention the " "option involved in the error; be sure to do the same when calling :func:" "`OptionParser.error` from your application code." msgstr "" -#: ../../library/optparse.rst:755 +#: ../../library/optparse.rst:756 msgid "" "If :mod:`optparse`'s default error-handling behaviour does not suit your " "needs, you'll need to subclass OptionParser and override its :meth:" "`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods." msgstr "" -#: ../../library/optparse.rst:763 +#: ../../library/optparse.rst:764 msgid "Putting it all together" msgstr "" -#: ../../library/optparse.rst:765 +#: ../../library/optparse.rst:766 msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::" msgstr "" -#: ../../library/optparse.rst:793 +#: ../../library/optparse.rst:794 msgid "Reference Guide" msgstr "" -#: ../../library/optparse.rst:799 +#: ../../library/optparse.rst:800 msgid "Creating the parser" msgstr "" -#: ../../library/optparse.rst:801 +#: ../../library/optparse.rst:802 msgid "" "The first step in using :mod:`optparse` is to create an OptionParser " "instance." msgstr "" -#: ../../library/optparse.rst:805 +#: ../../library/optparse.rst:806 msgid "" "The OptionParser constructor has no required arguments, but a number of " "optional keyword arguments. You should always pass them as keyword " "arguments, i.e. do not rely on the order in which the arguments are declared." msgstr "" -#: ../../library/optparse.rst:814 +#: ../../library/optparse.rst:815 msgid "``usage`` (default: ``\"%prog [options]\"``)" msgstr "" -#: ../../library/optparse.rst:810 +#: ../../library/optparse.rst:811 msgid "" "The usage summary to print when your program is run incorrectly or with a " "help option. When :mod:`optparse` prints the usage string, it expands " @@ -922,11 +926,11 @@ msgid "" "value :data:`optparse.SUPPRESS_USAGE`." msgstr "" -#: ../../library/optparse.rst:821 +#: ../../library/optparse.rst:822 msgid "``option_list`` (default: ``[]``)" msgstr "" -#: ../../library/optparse.rst:817 +#: ../../library/optparse.rst:818 msgid "" "A list of Option objects to populate the parser with. The options in " "``option_list`` are added after any options in ``standard_option_list`` (a " @@ -935,19 +939,19 @@ msgid "" "the parser instead." msgstr "" -#: ../../library/optparse.rst:824 +#: ../../library/optparse.rst:825 msgid "``option_class`` (default: optparse.Option)" msgstr "" -#: ../../library/optparse.rst:824 +#: ../../library/optparse.rst:825 msgid "Class to use when adding options to the parser in :meth:`add_option`." msgstr "" -#: ../../library/optparse.rst:830 +#: ../../library/optparse.rst:831 msgid "``version`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:827 +#: ../../library/optparse.rst:828 msgid "" "A version string to print when the user supplies a version option. If you " "supply a true value for ``version``, :mod:`optparse` automatically adds a " @@ -955,21 +959,21 @@ msgid "" "``%prog`` is expanded the same as for ``usage``." msgstr "" -#: ../../library/optparse.rst:835 +#: ../../library/optparse.rst:836 msgid "``conflict_handler`` (default: ``\"error\"``)" msgstr "" -#: ../../library/optparse.rst:833 +#: ../../library/optparse.rst:834 msgid "" "Specifies what to do when options with conflicting option strings are added " "to the parser; see section :ref:`optparse-conflicts-between-options`." msgstr "" -#: ../../library/optparse.rst:841 +#: ../../library/optparse.rst:842 msgid "``description`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:838 +#: ../../library/optparse.rst:839 msgid "" "A paragraph of text giving a brief overview of your program. :mod:`optparse` " "reformats this paragraph to fit the current terminal width and prints it " @@ -977,74 +981,74 @@ msgid "" "options)." msgstr "" -#: ../../library/optparse.rst:846 +#: ../../library/optparse.rst:847 msgid "``formatter`` (default: a new :class:`IndentedHelpFormatter`)" msgstr "" -#: ../../library/optparse.rst:844 +#: ../../library/optparse.rst:845 msgid "" "An instance of optparse.HelpFormatter that will be used for printing help " "text. :mod:`optparse` provides two concrete classes for this purpose: " "IndentedHelpFormatter and TitledHelpFormatter." msgstr "" -#: ../../library/optparse.rst:850 +#: ../../library/optparse.rst:851 msgid "``add_help_option`` (default: ``True``)" msgstr "" -#: ../../library/optparse.rst:849 +#: ../../library/optparse.rst:850 msgid "" "If true, :mod:`optparse` will add a help option (with option strings ``-h`` " "and ``--help``) to the parser." msgstr "" -#: ../../library/optparse.rst:854 +#: ../../library/optparse.rst:855 msgid "``prog``" msgstr "``prog``" -#: ../../library/optparse.rst:853 +#: ../../library/optparse.rst:854 msgid "" "The string to use when expanding ``%prog`` in ``usage`` and ``version`` " "instead of ``os.path.basename(sys.argv[0])``." msgstr "" -#: ../../library/optparse.rst:856 +#: ../../library/optparse.rst:857 msgid "``epilog`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:857 +#: ../../library/optparse.rst:858 msgid "A paragraph of help text to print after the option help." msgstr "" -#: ../../library/optparse.rst:862 +#: ../../library/optparse.rst:863 msgid "Populating the parser" msgstr "" -#: ../../library/optparse.rst:864 +#: ../../library/optparse.rst:865 msgid "" "There are several ways to populate the parser with options. The preferred " "way is by using :meth:`OptionParser.add_option`, as shown in section :ref:" "`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:" msgstr "" -#: ../../library/optparse.rst:868 +#: ../../library/optparse.rst:869 msgid "pass it an Option instance (as returned by :func:`make_option`)" msgstr "" -#: ../../library/optparse.rst:870 +#: ../../library/optparse.rst:871 msgid "" "pass it any combination of positional and keyword arguments that are " "acceptable to :func:`make_option` (i.e., to the Option constructor), and it " "will create the Option instance for you" msgstr "" -#: ../../library/optparse.rst:874 +#: ../../library/optparse.rst:875 msgid "" "The other alternative is to pass a list of pre-constructed Option instances " "to the OptionParser constructor, as in::" msgstr "" -#: ../../library/optparse.rst:885 +#: ../../library/optparse.rst:886 msgid "" "(:func:`make_option` is a factory function for creating Option instances; " "currently it is an alias for the Option constructor. A future version of :" @@ -1053,32 +1057,32 @@ msgid "" "Option directly.)" msgstr "" -#: ../../library/optparse.rst:894 +#: ../../library/optparse.rst:895 msgid "Defining options" msgstr "" -#: ../../library/optparse.rst:896 +#: ../../library/optparse.rst:897 msgid "" "Each Option instance represents a set of synonymous command-line option " "strings, e.g. ``-f`` and ``--file``. You can specify any number of short or " "long option strings, but you must specify at least one overall option string." msgstr "" -#: ../../library/optparse.rst:900 +#: ../../library/optparse.rst:901 msgid "" "The canonical way to create an :class:`Option` instance is with the :meth:" "`add_option` method of :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:906 +#: ../../library/optparse.rst:907 msgid "To define an option with only a short option string::" msgstr "" -#: ../../library/optparse.rst:910 +#: ../../library/optparse.rst:911 msgid "And to define an option with only a long option string::" msgstr "" -#: ../../library/optparse.rst:914 +#: ../../library/optparse.rst:915 msgid "" "The keyword arguments define attributes of the new Option object. The most " "important option attribute is :attr:`~Option.action`, and it largely " @@ -1087,69 +1091,69 @@ msgid "" "raises an :exc:`OptionError` exception explaining your mistake." msgstr "" -#: ../../library/optparse.rst:920 +#: ../../library/optparse.rst:921 msgid "" "An option's *action* determines what :mod:`optparse` does when it encounters " "this option on the command-line. The standard option actions hard-coded " "into :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:925 +#: ../../library/optparse.rst:926 msgid "``\"store\"``" msgstr "``\"store\"``" -#: ../../library/optparse.rst:925 +#: ../../library/optparse.rst:926 msgid "store this option's argument (default)" msgstr "" -#: ../../library/optparse.rst:931 +#: ../../library/optparse.rst:932 msgid "``\"store_true\"``" msgstr "``\"store_true\"``" -#: ../../library/optparse.rst:931 +#: ../../library/optparse.rst:932 msgid "store ``True``" msgstr "" -#: ../../library/optparse.rst:934 +#: ../../library/optparse.rst:935 msgid "``\"store_false\"``" msgstr "``\"store_false\"``" -#: ../../library/optparse.rst:934 +#: ../../library/optparse.rst:935 msgid "store ``False``" msgstr "" -#: ../../library/optparse.rst:940 +#: ../../library/optparse.rst:941 msgid "``\"append_const\"``" msgstr "``\"append_const\"``" -#: ../../library/optparse.rst:940 +#: ../../library/optparse.rst:941 msgid "append a constant value to a list, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:949 ../../library/optparse.rst:1243 +#: ../../library/optparse.rst:950 ../../library/optparse.rst:1244 msgid "``\"help\"``" msgstr "``\"help\"``" -#: ../../library/optparse.rst:949 +#: ../../library/optparse.rst:950 msgid "" "print a usage message including all options and the documentation for them" msgstr "" -#: ../../library/optparse.rst:951 +#: ../../library/optparse.rst:952 msgid "" "(If you don't supply an action, the default is ``\"store\"``. For this " "action, you may also supply :attr:`~Option.type` and :attr:`~Option.dest` " "option attributes; see :ref:`optparse-standard-option-actions`.)" msgstr "" -#: ../../library/optparse.rst:955 +#: ../../library/optparse.rst:956 msgid "" "As you can see, most actions involve storing or updating a value somewhere. :" "mod:`optparse` always creates a special object for this, conventionally " "called ``options``, which is an instance of :class:`optparse.Values`." msgstr "" -#: ../../library/optparse.rst:961 +#: ../../library/optparse.rst:962 msgid "" "An object holding parsed argument names and values as attributes. Normally " "created by calling when calling :meth:`OptionParser.parse_args`, and can be " @@ -1158,50 +1162,50 @@ msgid "" "arguments`)." msgstr "" -#: ../../library/optparse.rst:966 +#: ../../library/optparse.rst:967 msgid "" "Option arguments (and various other values) are stored as attributes of this " "object, according to the :attr:`~Option.dest` (destination) option attribute." msgstr "" -#: ../../library/optparse.rst:970 +#: ../../library/optparse.rst:971 msgid "For example, when you call ::" msgstr "" "例如說,當你呼叫:\n" "\n" "::" -#: ../../library/optparse.rst:974 +#: ../../library/optparse.rst:975 msgid "" "one of the first things :mod:`optparse` does is create the ``options`` " "object::" msgstr "" -#: ../../library/optparse.rst:978 +#: ../../library/optparse.rst:979 msgid "If one of the options in this parser is defined with ::" msgstr "" -#: ../../library/optparse.rst:982 +#: ../../library/optparse.rst:983 msgid "and the command-line being parsed includes any of the following::" msgstr "" -#: ../../library/optparse.rst:989 +#: ../../library/optparse.rst:990 msgid "" "then :mod:`optparse`, on seeing this option, will do the equivalent of ::" msgstr "" -#: ../../library/optparse.rst:993 +#: ../../library/optparse.rst:994 msgid "" "The :attr:`~Option.type` and :attr:`~Option.dest` option attributes are " "almost as important as :attr:`~Option.action`, but :attr:`~Option.action` is " "the only one that makes sense for *all* options." msgstr "" -#: ../../library/optparse.rst:1001 +#: ../../library/optparse.rst:1002 msgid "Option attributes" msgstr "" -#: ../../library/optparse.rst:1005 +#: ../../library/optparse.rst:1006 msgid "" "A single command line argument, with various attributes passed by keyword to " "the constructor. Normally created with :meth:`OptionParser.add_option` " @@ -1209,7 +1213,7 @@ msgid "" "*option_class* argument to :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:1011 +#: ../../library/optparse.rst:1012 msgid "" "The following option attributes may be passed as keyword arguments to :meth:" "`OptionParser.add_option`. If you pass an option attribute that is not " @@ -1217,33 +1221,33 @@ msgid "" "attribute, :mod:`optparse` raises :exc:`OptionError`." msgstr "" -#: ../../library/optparse.rst:1018 +#: ../../library/optparse.rst:1019 msgid "(default: ``\"store\"``)" msgstr "" -#: ../../library/optparse.rst:1020 +#: ../../library/optparse.rst:1021 msgid "" "Determines :mod:`optparse`'s behaviour when this option is seen on the " "command line; the available options are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1026 +#: ../../library/optparse.rst:1027 msgid "(default: ``\"string\"``)" msgstr "" -#: ../../library/optparse.rst:1028 +#: ../../library/optparse.rst:1029 msgid "" "The argument type expected by this option (e.g., ``\"string\"`` or " "``\"int\"``); the available option types are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1034 ../../library/optparse.rst:1084 +#: ../../library/optparse.rst:1035 ../../library/optparse.rst:1085 msgid "(default: derived from option strings)" msgstr "" -#: ../../library/optparse.rst:1036 +#: ../../library/optparse.rst:1037 msgid "" "If the option's action implies writing or modifying a value somewhere, this " "tells :mod:`optparse` where to write it: :attr:`~Option.dest` names an " @@ -1251,47 +1255,47 @@ msgid "" "the command line." msgstr "" -#: ../../library/optparse.rst:1043 +#: ../../library/optparse.rst:1044 msgid "" "The value to use for this option's destination if the option is not seen on " "the command line. See also :meth:`OptionParser.set_defaults`." msgstr "" -#: ../../library/optparse.rst:1048 +#: ../../library/optparse.rst:1049 msgid "(default: 1)" msgstr "" -#: ../../library/optparse.rst:1050 +#: ../../library/optparse.rst:1051 msgid "" "How many arguments of type :attr:`~Option.type` should be consumed when this " "option is seen. If > 1, :mod:`optparse` will store a tuple of values to :" "attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1056 +#: ../../library/optparse.rst:1057 msgid "For actions that store a constant value, the constant value to store." msgstr "" -#: ../../library/optparse.rst:1060 +#: ../../library/optparse.rst:1061 msgid "" "For options of type ``\"choice\"``, the list of strings the user may choose " "from." msgstr "" -#: ../../library/optparse.rst:1065 +#: ../../library/optparse.rst:1066 msgid "" "For options with action ``\"callback\"``, the callable to call when this " "option is seen. See section :ref:`optparse-option-callbacks` for detail on " "the arguments passed to the callable." msgstr "" -#: ../../library/optparse.rst:1072 +#: ../../library/optparse.rst:1073 msgid "" "Additional positional and keyword arguments to pass to ``callback`` after " "the four standard callback arguments." msgstr "" -#: ../../library/optparse.rst:1077 +#: ../../library/optparse.rst:1078 msgid "" "Help text to print for this option when listing all available options after " "the user supplies a :attr:`~Option.help` option (such as ``--help``). If no " @@ -1299,17 +1303,17 @@ msgid "" "this option, use the special value :data:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1086 +#: ../../library/optparse.rst:1087 msgid "" "Stand-in for the option argument(s) to use when printing help text. See " "section :ref:`optparse-tutorial` for an example." msgstr "" -#: ../../library/optparse.rst:1093 +#: ../../library/optparse.rst:1094 msgid "Standard option actions" msgstr "" -#: ../../library/optparse.rst:1095 +#: ../../library/optparse.rst:1096 msgid "" "The various option actions all have slightly different requirements and " "effects. Most actions have several relevant option attributes which you may " @@ -1317,13 +1321,13 @@ msgid "" "attributes, which you must specify for any option using that action." msgstr "" -#: ../../library/optparse.rst:1100 +#: ../../library/optparse.rst:1101 msgid "" "``\"store\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1103 +#: ../../library/optparse.rst:1104 msgid "" "The option must be followed by an argument, which is converted to a value " "according to :attr:`~Option.type` and stored in :attr:`~Option.dest`. If :" @@ -1333,17 +1337,17 @@ msgid "" "option-types` section." msgstr "" -#: ../../library/optparse.rst:1110 +#: ../../library/optparse.rst:1111 msgid "" "If :attr:`~Option.choices` is supplied (a list or tuple of strings), the " "type defaults to ``\"choice\"``." msgstr "" -#: ../../library/optparse.rst:1113 +#: ../../library/optparse.rst:1114 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." msgstr "" -#: ../../library/optparse.rst:1115 +#: ../../library/optparse.rst:1116 msgid "" "If :attr:`~Option.dest` is not supplied, :mod:`optparse` derives a " "destination from the first long option string (e.g., ``--foo-bar`` implies " @@ -1351,62 +1355,62 @@ msgid "" "destination from the first short option string (e.g., ``-f`` implies ``f``)." msgstr "" -#: ../../library/optparse.rst:1120 ../../library/optparse.rst:1140 -#: ../../library/optparse.rst:1162 ../../library/optparse.rst:1180 -#: ../../library/optparse.rst:1219 ../../library/optparse.rst:1257 +#: ../../library/optparse.rst:1121 ../../library/optparse.rst:1141 +#: ../../library/optparse.rst:1163 ../../library/optparse.rst:1181 +#: ../../library/optparse.rst:1220 ../../library/optparse.rst:1258 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/optparse.rst:1125 +#: ../../library/optparse.rst:1126 msgid "As it parses the command line ::" msgstr "" -#: ../../library/optparse.rst:1129 +#: ../../library/optparse.rst:1130 msgid ":mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1135 +#: ../../library/optparse.rst:1136 msgid "" "``\"store_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1138 +#: ../../library/optparse.rst:1139 msgid "The value :attr:`~Option.const` is stored in :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1149 +#: ../../library/optparse.rst:1150 msgid "If ``--noisy`` is seen, :mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1153 +#: ../../library/optparse.rst:1154 msgid "``\"store_true\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1155 +#: ../../library/optparse.rst:1156 msgid "" "A special case of ``\"store_const\"`` that stores ``True`` to :attr:`~Option." "dest`." msgstr "" -#: ../../library/optparse.rst:1158 +#: ../../library/optparse.rst:1159 msgid "``\"store_false\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1160 +#: ../../library/optparse.rst:1161 msgid "Like ``\"store_true\"``, but stores ``False``." msgstr "" -#: ../../library/optparse.rst:1167 +#: ../../library/optparse.rst:1168 msgid "" "``\"append\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1170 +#: ../../library/optparse.rst:1171 msgid "" "The option must be followed by an argument, which is appended to the list " "in :attr:`~Option.dest`. If no default value for :attr:`~Option.dest` is " @@ -1416,23 +1420,23 @@ msgid "" "is appended to :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1177 +#: ../../library/optparse.rst:1178 msgid "" "The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same " "as for the ``\"store\"`` action." msgstr "" -#: ../../library/optparse.rst:1184 +#: ../../library/optparse.rst:1185 msgid "" "If ``-t3`` is seen on the command-line, :mod:`optparse` does the equivalent " "of::" msgstr "" -#: ../../library/optparse.rst:1190 +#: ../../library/optparse.rst:1191 msgid "If, a little later on, ``--tracks=4`` is seen, it does::" msgstr "" -#: ../../library/optparse.rst:1194 +#: ../../library/optparse.rst:1195 msgid "" "The ``append`` action calls the ``append`` method on the current value of " "the option. This means that any default value specified must have an " @@ -1441,13 +1445,13 @@ msgid "" "with any values from the command line appended after those default values::" msgstr "" -#: ../../library/optparse.rst:1205 +#: ../../library/optparse.rst:1206 msgid "" "``\"append_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1208 +#: ../../library/optparse.rst:1209 msgid "" "Like ``\"store_const\"``, but the value :attr:`~Option.const` is appended " "to :attr:`~Option.dest`; as with ``\"append\"``, :attr:`~Option.dest` " @@ -1455,45 +1459,45 @@ msgid "" "time the option is encountered." msgstr "" -#: ../../library/optparse.rst:1213 +#: ../../library/optparse.rst:1214 msgid "``\"count\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1215 +#: ../../library/optparse.rst:1216 msgid "" "Increment the integer stored at :attr:`~Option.dest`. If no default value " "is supplied, :attr:`~Option.dest` is set to zero before being incremented " "the first time." msgstr "" -#: ../../library/optparse.rst:1223 +#: ../../library/optparse.rst:1224 msgid "" "The first time ``-v`` is seen on the command line, :mod:`optparse` does the " "equivalent of::" msgstr "" -#: ../../library/optparse.rst:1229 +#: ../../library/optparse.rst:1230 msgid "Every subsequent occurrence of ``-v`` results in ::" msgstr "" -#: ../../library/optparse.rst:1233 +#: ../../library/optparse.rst:1234 msgid "" "``\"callback\"`` [required: :attr:`~Option.callback`; relevant: :attr:" "`~Option.type`, :attr:`~Option.nargs`, :attr:`~Option.callback_args`, :attr:" "`~Option.callback_kwargs`]" msgstr "" -#: ../../library/optparse.rst:1237 +#: ../../library/optparse.rst:1238 msgid "" "Call the function specified by :attr:`~Option.callback`, which is called " "as ::" msgstr "" -#: ../../library/optparse.rst:1241 +#: ../../library/optparse.rst:1242 msgid "See section :ref:`optparse-option-callbacks` for more detail." msgstr "更多細節請見 :ref:`optparse-option-callbacks`\\ 。" -#: ../../library/optparse.rst:1245 +#: ../../library/optparse.rst:1246 msgid "" "Prints a complete help message for all the options in the current option " "parser. The help message is constructed from the ``usage`` string passed to " @@ -1501,37 +1505,37 @@ msgid "" "every option." msgstr "" -#: ../../library/optparse.rst:1250 +#: ../../library/optparse.rst:1251 msgid "" "If no :attr:`~Option.help` string is supplied for an option, it will still " "be listed in the help message. To omit an option entirely, use the special " "value :data:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1254 +#: ../../library/optparse.rst:1255 msgid "" ":mod:`optparse` automatically adds a :attr:`~Option.help` option to all " "OptionParsers, so you do not normally need to create one." msgstr "" -#: ../../library/optparse.rst:1272 +#: ../../library/optparse.rst:1273 msgid "" "If :mod:`optparse` sees either ``-h`` or ``--help`` on the command line, it " "will print something like the following help message to stdout (assuming " "``sys.argv[0]`` is ``\"foo.py\"``):" msgstr "" -#: ../../library/optparse.rst:1285 +#: ../../library/optparse.rst:1286 msgid "" "After printing the help message, :mod:`optparse` terminates your process " "with ``sys.exit(0)``." msgstr "" -#: ../../library/optparse.rst:1288 +#: ../../library/optparse.rst:1289 msgid "``\"version\"``" msgstr "``\"version\"``" -#: ../../library/optparse.rst:1290 +#: ../../library/optparse.rst:1291 msgid "" "Prints the version number supplied to the OptionParser to stdout and exits. " "The version number is actually formatted and printed by the " @@ -1541,58 +1545,58 @@ msgid "" "since :mod:`optparse` automatically adds them when needed." msgstr "" -#: ../../library/optparse.rst:1301 +#: ../../library/optparse.rst:1302 msgid "Standard option types" msgstr "" -#: ../../library/optparse.rst:1303 +#: ../../library/optparse.rst:1304 msgid "" ":mod:`optparse` has five built-in option types: ``\"string\"``, ``\"int\"``, " "``\"choice\"``, ``\"float\"`` and ``\"complex\"``. If you need to add new " "option types, see section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:1307 +#: ../../library/optparse.rst:1308 msgid "" "Arguments to string options are not checked or converted in any way: the " "text on the command line is stored in the destination (or passed to the " "callback) as-is." msgstr "" -#: ../../library/optparse.rst:1310 +#: ../../library/optparse.rst:1311 msgid "Integer arguments (type ``\"int\"``) are parsed as follows:" msgstr "" -#: ../../library/optparse.rst:1312 +#: ../../library/optparse.rst:1313 msgid "if the number starts with ``0x``, it is parsed as a hexadecimal number" msgstr "" -#: ../../library/optparse.rst:1314 +#: ../../library/optparse.rst:1315 msgid "if the number starts with ``0``, it is parsed as an octal number" msgstr "" -#: ../../library/optparse.rst:1316 +#: ../../library/optparse.rst:1317 msgid "if the number starts with ``0b``, it is parsed as a binary number" msgstr "" -#: ../../library/optparse.rst:1318 +#: ../../library/optparse.rst:1319 msgid "otherwise, the number is parsed as a decimal number" msgstr "" -#: ../../library/optparse.rst:1321 +#: ../../library/optparse.rst:1322 msgid "" "The conversion is done by calling :func:`int` with the appropriate base (2, " "8, 10, or 16). If this fails, so will :mod:`optparse`, although with a more " "useful error message." msgstr "" -#: ../../library/optparse.rst:1325 +#: ../../library/optparse.rst:1326 msgid "" "``\"float\"`` and ``\"complex\"`` option arguments are converted directly " "with :func:`float` and :func:`complex`, with similar error-handling." msgstr "" -#: ../../library/optparse.rst:1328 +#: ../../library/optparse.rst:1329 msgid "" "``\"choice\"`` options are a subtype of ``\"string\"`` options. The :attr:" "`~Option.choices` option attribute (a sequence of strings) defines the set " @@ -1601,129 +1605,133 @@ msgid "" "`OptionValueError` if an invalid string is given." msgstr "" -#: ../../library/optparse.rst:1338 +#: ../../library/optparse.rst:1339 msgid "Parsing arguments" msgstr "" -#: ../../library/optparse.rst:1340 +#: ../../library/optparse.rst:1341 msgid "" "The whole point of creating and populating an OptionParser is to call its :" -"meth:`parse_args` method::" +"meth:`~OptionParser.parse_args` method." msgstr "" -#: ../../library/optparse.rst:1345 -msgid "where the input parameters are" +#: ../../library/optparse.rst:1346 +msgid "Parse the command-line options found in *args*." msgstr "" -#: ../../library/optparse.rst:1348 ../../library/optparse.rst:1362 -#: ../../library/optparse.rst:1681 +#: ../../library/optparse.rst:1348 +msgid "The input parameters are" +msgstr "" + +#: ../../library/optparse.rst:1351 ../../library/optparse.rst:1364 +#: ../../library/optparse.rst:1684 msgid "``args``" msgstr "``args``" -#: ../../library/optparse.rst:1348 +#: ../../library/optparse.rst:1351 msgid "the list of arguments to process (default: ``sys.argv[1:]``)" msgstr "" -#: ../../library/optparse.rst:1353 +#: ../../library/optparse.rst:1356 msgid "``values``" msgstr "``values``" -#: ../../library/optparse.rst:1351 +#: ../../library/optparse.rst:1354 msgid "" -"an :class:`optparse.Values` object to store option arguments in (default: a " -"new instance of :class:`Values`) -- if you give an existing object, the " -"option defaults will not be initialized on it" +"an :class:`Values` object to store option arguments in (default: a new " +"instance of :class:`Values`) -- if you give an existing object, the option " +"defaults will not be initialized on it" msgstr "" -#: ../../library/optparse.rst:1355 -msgid "and the return values are" +#: ../../library/optparse.rst:1358 +msgid "and the return value is a pair ``(options, args)`` where" msgstr "" -#: ../../library/optparse.rst:1359 +#: ../../library/optparse.rst:1362 msgid "``options``" msgstr "``options``" -#: ../../library/optparse.rst:1358 +#: ../../library/optparse.rst:1361 msgid "" -"the same object that was passed in as ``values``, or the optparse.Values " +"the same object that was passed in as *values*, or the ``optparse.Values`` " "instance created by :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1362 +#: ../../library/optparse.rst:1365 msgid "the leftover positional arguments after all options have been processed" msgstr "" -#: ../../library/optparse.rst:1364 +#: ../../library/optparse.rst:1367 msgid "" "The most common usage is to supply neither keyword argument. If you supply " "``values``, it will be modified with repeated :func:`setattr` calls (roughly " "one for every option argument stored to an option destination) and returned " -"by :meth:`parse_args`." +"by :meth:`~OptionParser.parse_args`." msgstr "" -#: ../../library/optparse.rst:1369 +#: ../../library/optparse.rst:1372 msgid "" -"If :meth:`parse_args` encounters any errors in the argument list, it calls " -"the OptionParser's :meth:`error` method with an appropriate end-user error " -"message. This ultimately terminates your process with an exit status of 2 " -"(the traditional Unix exit status for command-line errors)." +"If :meth:`~OptionParser.parse_args` encounters any errors in the argument " +"list, it calls the OptionParser's :meth:`error` method with an appropriate " +"end-user error message. This ultimately terminates your process with an exit " +"status of 2 (the traditional Unix exit status for command-line errors)." msgstr "" -#: ../../library/optparse.rst:1378 +#: ../../library/optparse.rst:1381 msgid "Querying and manipulating your option parser" msgstr "" -#: ../../library/optparse.rst:1380 +#: ../../library/optparse.rst:1383 msgid "" "The default behavior of the option parser can be customized slightly, and " "you can also poke around your option parser and see what's there. " "OptionParser provides several methods to help you out:" msgstr "" -#: ../../library/optparse.rst:1386 +#: ../../library/optparse.rst:1389 msgid "" "Set parsing to stop on the first non-option. For example, if ``-a`` and ``-" "b`` are both simple options that take no arguments, :mod:`optparse` normally " "accepts this syntax::" msgstr "" -#: ../../library/optparse.rst:1392 +#: ../../library/optparse.rst:1395 msgid "and treats it as equivalent to ::" msgstr "" -#: ../../library/optparse.rst:1396 +#: ../../library/optparse.rst:1399 msgid "" "To disable this feature, call :meth:`disable_interspersed_args`. This " "restores traditional Unix syntax, where option parsing stops with the first " "non-option argument." msgstr "" -#: ../../library/optparse.rst:1400 +#: ../../library/optparse.rst:1403 msgid "" "Use this if you have a command processor which runs another command which " "has options of its own and you want to make sure these options don't get " "confused. For example, each command might have a different set of options." msgstr "" -#: ../../library/optparse.rst:1406 +#: ../../library/optparse.rst:1409 msgid "" "Set parsing to not stop on the first non-option, allowing interspersing " "switches with command arguments. This is the default behavior." msgstr "" -#: ../../library/optparse.rst:1411 +#: ../../library/optparse.rst:1414 msgid "" "Returns the Option instance with the option string *opt_str*, or ``None`` if " "no options have that option string." msgstr "" -#: ../../library/optparse.rst:1416 +#: ../../library/optparse.rst:1419 msgid "" "Return ``True`` if the OptionParser has an option with option string " "*opt_str* (e.g., ``-q`` or ``--verbose``)." msgstr "" -#: ../../library/optparse.rst:1421 +#: ../../library/optparse.rst:1424 msgid "" "If the :class:`OptionParser` has an option corresponding to *opt_str*, that " "option is removed. If that option provided any other option strings, all of " @@ -1731,23 +1739,23 @@ msgid "" "option belonging to this :class:`OptionParser`, raises :exc:`ValueError`." msgstr "" -#: ../../library/optparse.rst:1430 +#: ../../library/optparse.rst:1433 msgid "Conflicts between options" msgstr "" -#: ../../library/optparse.rst:1432 +#: ../../library/optparse.rst:1435 msgid "" "If you're not careful, it's easy to define options with conflicting option " "strings::" msgstr "" -#: ../../library/optparse.rst:1439 +#: ../../library/optparse.rst:1442 msgid "" "(This is particularly true if you've defined your own OptionParser subclass " "with some standard options.)" msgstr "" -#: ../../library/optparse.rst:1442 +#: ../../library/optparse.rst:1445 msgid "" "Every time you add an option, :mod:`optparse` checks for conflicts with " "existing options. If it finds any, it invokes the current conflict-handling " @@ -1755,39 +1763,39 @@ msgid "" "constructor::" msgstr "" -#: ../../library/optparse.rst:1448 +#: ../../library/optparse.rst:1451 msgid "or with a separate call::" msgstr "" -#: ../../library/optparse.rst:1452 +#: ../../library/optparse.rst:1455 msgid "The available conflict handlers are:" msgstr "" -#: ../../library/optparse.rst:1456 +#: ../../library/optparse.rst:1459 msgid "``\"error\"`` (default)" msgstr "" -#: ../../library/optparse.rst:1455 +#: ../../library/optparse.rst:1458 msgid "" "assume option conflicts are a programming error and raise :exc:" "`OptionConflictError`" msgstr "" -#: ../../library/optparse.rst:1460 +#: ../../library/optparse.rst:1463 msgid "``\"resolve\"``" msgstr "``\"resolve\"``" -#: ../../library/optparse.rst:1459 +#: ../../library/optparse.rst:1462 msgid "resolve option conflicts intelligently (see below)" msgstr "" -#: ../../library/optparse.rst:1462 +#: ../../library/optparse.rst:1465 msgid "" "As an example, let's define an :class:`OptionParser` that resolves conflicts " "intelligently and add conflicting options to it::" msgstr "" -#: ../../library/optparse.rst:1469 +#: ../../library/optparse.rst:1472 msgid "" "At this point, :mod:`optparse` detects that a previously added option is " "already using the ``-n`` option string. Since ``conflict_handler`` is " @@ -1797,7 +1805,7 @@ msgid "" "message will reflect that::" msgstr "" -#: ../../library/optparse.rst:1480 +#: ../../library/optparse.rst:1483 msgid "" "It's possible to whittle away the option strings for a previously added " "option until there are none left, and the user has no way of invoking that " @@ -1806,17 +1814,17 @@ msgid "" "Carrying on with our existing OptionParser::" msgstr "" -#: ../../library/optparse.rst:1488 +#: ../../library/optparse.rst:1491 msgid "" "At this point, the original ``-n``/``--dry-run`` option is no longer " "accessible, so :mod:`optparse` removes it, leaving this help text::" msgstr "" -#: ../../library/optparse.rst:1500 +#: ../../library/optparse.rst:1503 msgid "Cleanup" msgstr "" -#: ../../library/optparse.rst:1502 +#: ../../library/optparse.rst:1505 msgid "" "OptionParser instances have several cyclic references. This should not be a " "problem for Python's garbage collector, but you may wish to break the cyclic " @@ -1826,15 +1834,15 @@ msgid "" "OptionParser." msgstr "" -#: ../../library/optparse.rst:1513 +#: ../../library/optparse.rst:1516 msgid "Other methods" msgstr "" -#: ../../library/optparse.rst:1515 +#: ../../library/optparse.rst:1518 msgid "OptionParser supports several other public methods:" msgstr "" -#: ../../library/optparse.rst:1519 +#: ../../library/optparse.rst:1522 msgid "" "Set the usage string according to the rules described above for the " "``usage`` constructor keyword argument. Passing ``None`` sets the default " @@ -1842,7 +1850,7 @@ msgid "" "message." msgstr "" -#: ../../library/optparse.rst:1525 +#: ../../library/optparse.rst:1528 msgid "" "Print the usage message for the current program (``self.usage``) to *file* " "(default stdout). Any occurrence of the string ``%prog`` in ``self.usage`` " @@ -1850,13 +1858,13 @@ msgid "" "usage`` is empty or not defined." msgstr "" -#: ../../library/optparse.rst:1532 +#: ../../library/optparse.rst:1535 msgid "" "Same as :meth:`print_usage` but returns the usage string instead of printing " "it." msgstr "" -#: ../../library/optparse.rst:1537 +#: ../../library/optparse.rst:1540 msgid "" "Set default values for several option destinations at once. Using :meth:" "`set_defaults` is the preferred way to set default values for options, since " @@ -1865,15 +1873,15 @@ msgid "" "default, and the last one wins::" msgstr "" -#: ../../library/optparse.rst:1550 +#: ../../library/optparse.rst:1553 msgid "To avoid this confusion, use :meth:`set_defaults`::" msgstr "" -#: ../../library/optparse.rst:1562 +#: ../../library/optparse.rst:1565 msgid "Option Callbacks" msgstr "" -#: ../../library/optparse.rst:1564 +#: ../../library/optparse.rst:1567 msgid "" "When :mod:`optparse`'s built-in actions and types aren't quite enough for " "your needs, you have two choices: extend :mod:`optparse` or define a " @@ -1881,25 +1889,25 @@ msgid "" "a lot of simple cases. Quite often a simple callback is all you need." msgstr "" -#: ../../library/optparse.rst:1569 +#: ../../library/optparse.rst:1572 msgid "There are two steps to defining a callback option:" msgstr "" -#: ../../library/optparse.rst:1571 +#: ../../library/optparse.rst:1574 msgid "define the option itself using the ``\"callback\"`` action" msgstr "" -#: ../../library/optparse.rst:1573 +#: ../../library/optparse.rst:1576 msgid "" "write the callback; this is a function (or method) that takes at least four " "arguments, as described below" msgstr "" -#: ../../library/optparse.rst:1580 +#: ../../library/optparse.rst:1583 msgid "Defining a callback option" msgstr "" -#: ../../library/optparse.rst:1582 +#: ../../library/optparse.rst:1585 msgid "" "As always, the easiest way to define a callback option is by using the :meth:" "`OptionParser.add_option` method. Apart from :attr:`~Option.action`, the " @@ -1907,7 +1915,7 @@ msgid "" "call::" msgstr "" -#: ../../library/optparse.rst:1588 +#: ../../library/optparse.rst:1591 msgid "" "``callback`` is a function (or other callable object), so you must have " "already defined ``my_callback()`` when you create this callback option. In " @@ -1919,7 +1927,7 @@ msgid "" "tricky; it's covered later in this section." msgstr "" -#: ../../library/optparse.rst:1597 +#: ../../library/optparse.rst:1600 msgid "" ":mod:`optparse` always passes four particular arguments to your callback, " "and it will only pass additional arguments if you specify them via :attr:" @@ -1927,21 +1935,21 @@ msgid "" "minimal callback function signature is::" msgstr "" -#: ../../library/optparse.rst:1604 +#: ../../library/optparse.rst:1607 msgid "The four arguments to a callback are described below." msgstr "" -#: ../../library/optparse.rst:1606 +#: ../../library/optparse.rst:1609 msgid "" "There are several other option attributes that you can supply when you " "define a callback option:" msgstr "" -#: ../../library/optparse.rst:1613 +#: ../../library/optparse.rst:1616 msgid ":attr:`~Option.type`" msgstr ":attr:`~Option.type`" -#: ../../library/optparse.rst:1610 +#: ../../library/optparse.rst:1613 msgid "" "has its usual meaning: as with the ``\"store\"`` or ``\"append\"`` actions, " "it instructs :mod:`optparse` to consume one argument and convert it to :attr:" @@ -1949,11 +1957,11 @@ msgid "" "though, :mod:`optparse` passes it to your callback function." msgstr "" -#: ../../library/optparse.rst:1619 +#: ../../library/optparse.rst:1622 msgid ":attr:`~Option.nargs`" msgstr ":attr:`~Option.nargs`" -#: ../../library/optparse.rst:1616 +#: ../../library/optparse.rst:1619 msgid "" "also has its usual meaning: if it is supplied and > 1, :mod:`optparse` will " "consume :attr:`~Option.nargs` arguments, each of which must be convertible " @@ -1961,43 +1969,43 @@ msgid "" "callback." msgstr "" -#: ../../library/optparse.rst:1622 +#: ../../library/optparse.rst:1625 msgid ":attr:`~Option.callback_args`" msgstr ":attr:`~Option.callback_args`" -#: ../../library/optparse.rst:1622 +#: ../../library/optparse.rst:1625 msgid "a tuple of extra positional arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1626 +#: ../../library/optparse.rst:1629 msgid ":attr:`~Option.callback_kwargs`" msgstr ":attr:`~Option.callback_kwargs`" -#: ../../library/optparse.rst:1625 +#: ../../library/optparse.rst:1628 msgid "a dictionary of extra keyword arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1631 +#: ../../library/optparse.rst:1634 msgid "How callbacks are called" msgstr "" -#: ../../library/optparse.rst:1633 +#: ../../library/optparse.rst:1636 msgid "All callbacks are called as follows::" msgstr "" -#: ../../library/optparse.rst:1640 +#: ../../library/optparse.rst:1643 msgid "``option``" msgstr "``option``" -#: ../../library/optparse.rst:1640 +#: ../../library/optparse.rst:1643 msgid "is the Option instance that's calling the callback" msgstr "" -#: ../../library/optparse.rst:1647 +#: ../../library/optparse.rst:1650 msgid "``opt_str``" msgstr "``opt_str``" -#: ../../library/optparse.rst:1643 +#: ../../library/optparse.rst:1646 msgid "" "is the option string seen on the command-line that's triggering the " "callback. (If an abbreviated long option was used, ``opt_str`` will be the " @@ -2006,11 +2014,11 @@ msgid "" "``\"--foobar\"``.)" msgstr "" -#: ../../library/optparse.rst:1654 +#: ../../library/optparse.rst:1657 msgid "``value``" msgstr "``value``" -#: ../../library/optparse.rst:1650 +#: ../../library/optparse.rst:1653 msgid "" "is the argument to this option seen on the command-line. :mod:`optparse` " "will only expect an argument if :attr:`~Option.type` is set; the type of " @@ -2020,44 +2028,45 @@ msgid "" "of values of the appropriate type." msgstr "" -#: ../../library/optparse.rst:1677 +#: ../../library/optparse.rst:1680 msgid "``parser``" msgstr "``parser``" -#: ../../library/optparse.rst:1657 +#: ../../library/optparse.rst:1660 msgid "" "is the OptionParser instance driving the whole thing, mainly useful because " "you can access some other interesting data through its instance attributes:" msgstr "" -#: ../../library/optparse.rst:1664 +#: ../../library/optparse.rst:1667 msgid "``parser.largs``" msgstr "``parser.largs``" -#: ../../library/optparse.rst:1661 +#: ../../library/optparse.rst:1664 msgid "" "the current list of leftover arguments, ie. arguments that have been " "consumed but are neither options nor option arguments. Feel free to modify " "``parser.largs``, e.g. by adding more arguments to it. (This list will " -"become ``args``, the second return value of :meth:`parse_args`.)" +"become ``args``, the second return value of :meth:`~OptionParser." +"parse_args`.)" msgstr "" -#: ../../library/optparse.rst:1670 +#: ../../library/optparse.rst:1673 msgid "``parser.rargs``" msgstr "``parser.rargs``" -#: ../../library/optparse.rst:1667 +#: ../../library/optparse.rst:1670 msgid "" "the current list of remaining arguments, ie. with ``opt_str`` and ``value`` " "(if applicable) removed, and only the arguments following them still there. " "Feel free to modify ``parser.rargs``, e.g. by consuming more arguments." msgstr "" -#: ../../library/optparse.rst:1677 +#: ../../library/optparse.rst:1680 msgid "``parser.values``" msgstr "``parser.values``" -#: ../../library/optparse.rst:1673 +#: ../../library/optparse.rst:1676 msgid "" "the object where option values are by default stored (an instance of " "optparse.OptionValues). This lets callbacks use the same mechanism as the " @@ -2066,27 +2075,27 @@ msgid "" "of any options already encountered on the command-line." msgstr "" -#: ../../library/optparse.rst:1680 +#: ../../library/optparse.rst:1683 msgid "" "is a tuple of arbitrary positional arguments supplied via the :attr:`~Option." "callback_args` option attribute." msgstr "" -#: ../../library/optparse.rst:1686 +#: ../../library/optparse.rst:1689 msgid "``kwargs``" msgstr "``kwargs``" -#: ../../library/optparse.rst:1684 +#: ../../library/optparse.rst:1687 msgid "" "is a dictionary of arbitrary keyword arguments supplied via :attr:`~Option." "callback_kwargs`." msgstr "" -#: ../../library/optparse.rst:1691 +#: ../../library/optparse.rst:1694 msgid "Raising errors in a callback" msgstr "" -#: ../../library/optparse.rst:1693 +#: ../../library/optparse.rst:1696 msgid "" "The callback function should raise :exc:`OptionValueError` if there are any " "problems with the option or its argument(s). :mod:`optparse` catches this " @@ -2096,46 +2105,46 @@ msgid "" "they did wrong." msgstr "" -#: ../../library/optparse.rst:1703 +#: ../../library/optparse.rst:1706 msgid "Callback example 1: trivial callback" msgstr "" -#: ../../library/optparse.rst:1705 +#: ../../library/optparse.rst:1708 msgid "" "Here's an example of a callback option that takes no arguments, and simply " "records that the option was seen::" msgstr "" -#: ../../library/optparse.rst:1713 +#: ../../library/optparse.rst:1716 msgid "Of course, you could do that with the ``\"store_true\"`` action." msgstr "" -#: ../../library/optparse.rst:1719 +#: ../../library/optparse.rst:1722 msgid "Callback example 2: check option order" msgstr "" -#: ../../library/optparse.rst:1721 +#: ../../library/optparse.rst:1724 msgid "" "Here's a slightly more interesting example: record the fact that ``-a`` is " "seen, but blow up if it comes after ``-b`` in the command-line. ::" msgstr "" -#: ../../library/optparse.rst:1736 +#: ../../library/optparse.rst:1739 msgid "Callback example 3: check option order (generalized)" msgstr "" -#: ../../library/optparse.rst:1738 +#: ../../library/optparse.rst:1741 msgid "" "If you want to re-use this callback for several similar options (set a flag, " "but blow up if ``-b`` has already been seen), it needs a bit of work: the " "error message and the flag that it sets must be generalized. ::" msgstr "" -#: ../../library/optparse.rst:1755 +#: ../../library/optparse.rst:1758 msgid "Callback example 4: check arbitrary condition" msgstr "" -#: ../../library/optparse.rst:1757 +#: ../../library/optparse.rst:1760 msgid "" "Of course, you could put any condition in there---you're not limited to " "checking the values of already-defined options. For example, if you have " @@ -2143,16 +2152,16 @@ msgid "" "is this::" msgstr "" -#: ../../library/optparse.rst:1770 +#: ../../library/optparse.rst:1773 msgid "" "(The definition of ``is_moon_full()`` is left as an exercise for the reader.)" msgstr "" -#: ../../library/optparse.rst:1776 +#: ../../library/optparse.rst:1779 msgid "Callback example 5: fixed arguments" msgstr "" -#: ../../library/optparse.rst:1778 +#: ../../library/optparse.rst:1781 msgid "" "Things get slightly more interesting when you define callback options that " "take a fixed number of arguments. Specifying that a callback option takes " @@ -2162,23 +2171,23 @@ msgid "" "nargs`, then the option takes :attr:`~Option.nargs` arguments." msgstr "" -#: ../../library/optparse.rst:1785 +#: ../../library/optparse.rst:1788 msgid "" "Here's an example that just emulates the standard ``\"store\"`` action::" msgstr "" -#: ../../library/optparse.rst:1794 +#: ../../library/optparse.rst:1797 msgid "" "Note that :mod:`optparse` takes care of consuming 3 arguments and converting " "them to integers for you; all you have to do is store them. (Or whatever; " "obviously you don't need a callback for this example.)" msgstr "" -#: ../../library/optparse.rst:1802 +#: ../../library/optparse.rst:1805 msgid "Callback example 6: variable arguments" msgstr "" -#: ../../library/optparse.rst:1804 +#: ../../library/optparse.rst:1807 msgid "" "Things get hairy when you want an option to take a variable number of " "arguments. For this case, you must write a callback, as :mod:`optparse` " @@ -2188,23 +2197,23 @@ msgid "" "implement the conventional rules for bare ``--`` and ``-`` arguments:" msgstr "" -#: ../../library/optparse.rst:1811 +#: ../../library/optparse.rst:1814 msgid "either ``--`` or ``-`` can be option arguments" msgstr "" -#: ../../library/optparse.rst:1813 +#: ../../library/optparse.rst:1816 msgid "" "bare ``--`` (if not the argument to some option): halt command-line " "processing and discard the ``--``" msgstr "" -#: ../../library/optparse.rst:1816 +#: ../../library/optparse.rst:1819 msgid "" "bare ``-`` (if not the argument to some option): halt command-line " "processing but keep the ``-`` (append it to ``parser.largs``)" msgstr "" -#: ../../library/optparse.rst:1819 +#: ../../library/optparse.rst:1822 msgid "" "If you want an option that takes a variable number of arguments, there are " "several subtle, tricky issues to worry about. The exact implementation you " @@ -2213,28 +2222,28 @@ msgid "" "directly)." msgstr "" -#: ../../library/optparse.rst:1825 +#: ../../library/optparse.rst:1828 msgid "" "Nevertheless, here's a stab at a callback for an option with variable " "arguments::" msgstr "" -#: ../../library/optparse.rst:1859 +#: ../../library/optparse.rst:1862 msgid "Extending :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1861 +#: ../../library/optparse.rst:1864 msgid "" "Since the two major controlling factors in how :mod:`optparse` interprets " "command-line options are the action and type of each option, the most likely " "direction of extension is to add new actions and new types." msgstr "" -#: ../../library/optparse.rst:1869 +#: ../../library/optparse.rst:1872 msgid "Adding new types" msgstr "" -#: ../../library/optparse.rst:1871 +#: ../../library/optparse.rst:1874 msgid "" "To add new types, you need to define your own subclass of :mod:`optparse`'s :" "class:`Option` class. This class has a couple of attributes that define :" @@ -2242,19 +2251,19 @@ msgid "" "TYPE_CHECKER`." msgstr "" -#: ../../library/optparse.rst:1877 +#: ../../library/optparse.rst:1880 msgid "" "A tuple of type names; in your subclass, simply define a new tuple :attr:" "`TYPES` that builds on the standard one." msgstr "" -#: ../../library/optparse.rst:1882 +#: ../../library/optparse.rst:1885 msgid "" "A dictionary mapping type names to type-checking functions. A type-checking " "function has the following signature::" msgstr "" -#: ../../library/optparse.rst:1887 +#: ../../library/optparse.rst:1890 msgid "" "where ``option`` is an :class:`Option` instance, ``opt`` is an option string " "(e.g., ``-f``), and ``value`` is the string from the command line that must " @@ -2265,7 +2274,7 @@ msgid "" "``value`` parameter." msgstr "" -#: ../../library/optparse.rst:1895 +#: ../../library/optparse.rst:1898 msgid "" "Your type-checking function should raise :exc:`OptionValueError` if it " "encounters any problems. :exc:`OptionValueError` takes a single string " @@ -2274,7 +2283,7 @@ msgid "" "\"`` and prints everything to stderr before terminating the process." msgstr "" -#: ../../library/optparse.rst:1901 +#: ../../library/optparse.rst:1904 msgid "" "Here's a silly example that demonstrates adding a ``\"complex\"`` option " "type to parse Python-style complex numbers on the command line. (This is " @@ -2282,21 +2291,21 @@ msgid "" "support for complex numbers, but never mind.)" msgstr "" -#: ../../library/optparse.rst:1906 +#: ../../library/optparse.rst:1909 msgid "First, the necessary imports::" msgstr "" -#: ../../library/optparse.rst:1911 +#: ../../library/optparse.rst:1914 msgid "" "You need to define your type-checker first, since it's referred to later (in " "the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::" msgstr "" -#: ../../library/optparse.rst:1921 +#: ../../library/optparse.rst:1924 msgid "Finally, the Option subclass::" msgstr "" -#: ../../library/optparse.rst:1928 +#: ../../library/optparse.rst:1931 msgid "" "(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would " "end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:" @@ -2304,46 +2313,46 @@ msgid "" "that except good manners and common sense.)" msgstr "" -#: ../../library/optparse.rst:1933 +#: ../../library/optparse.rst:1936 msgid "" "That's it! Now you can write a script that uses the new option type just " "like any other :mod:`optparse`\\ -based script, except you have to instruct " "your OptionParser to use MyOption instead of Option::" msgstr "" -#: ../../library/optparse.rst:1940 +#: ../../library/optparse.rst:1943 msgid "" "Alternately, you can build your own option list and pass it to OptionParser; " "if you don't use :meth:`add_option` in the above way, you don't need to tell " "OptionParser which option class to use::" msgstr "" -#: ../../library/optparse.rst:1951 +#: ../../library/optparse.rst:1954 msgid "Adding new actions" msgstr "" -#: ../../library/optparse.rst:1953 +#: ../../library/optparse.rst:1956 msgid "" "Adding new actions is a bit trickier, because you have to understand that :" "mod:`optparse` has a couple of classifications for actions:" msgstr "" -#: ../../library/optparse.rst:1959 +#: ../../library/optparse.rst:1962 msgid "\"store\" actions" msgstr "" -#: ../../library/optparse.rst:1957 +#: ../../library/optparse.rst:1960 msgid "" "actions that result in :mod:`optparse` storing a value to an attribute of " "the current OptionValues instance; these options require a :attr:`~Option." "dest` attribute to be supplied to the Option constructor." msgstr "" -#: ../../library/optparse.rst:1965 +#: ../../library/optparse.rst:1968 msgid "\"typed\" actions" msgstr "" -#: ../../library/optparse.rst:1962 +#: ../../library/optparse.rst:1965 msgid "" "actions that take a value from the command line and expect it to be of a " "certain type; or rather, a string that can be converted to a certain type. " @@ -2351,7 +2360,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/optparse.rst:1967 +#: ../../library/optparse.rst:1970 msgid "" "These are overlapping sets: some default \"store\" actions are " "``\"store\"``, ``\"store_const\"``, ``\"append\"``, and ``\"count\"``, while " @@ -2359,25 +2368,25 @@ msgid "" "``\"callback\"``." msgstr "" -#: ../../library/optparse.rst:1971 +#: ../../library/optparse.rst:1974 msgid "" "When you add an action, you need to categorize it by listing it in at least " "one of the following class attributes of Option (all are lists of strings):" msgstr "" -#: ../../library/optparse.rst:1976 +#: ../../library/optparse.rst:1979 msgid "All actions must be listed in ACTIONS." msgstr "" -#: ../../library/optparse.rst:1980 +#: ../../library/optparse.rst:1983 msgid "\"store\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1984 +#: ../../library/optparse.rst:1987 msgid "\"typed\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1988 +#: ../../library/optparse.rst:1991 msgid "" "Actions that always take a type (i.e. whose options always take a value) are " "additionally listed here. The only effect of this is that :mod:`optparse` " @@ -2385,13 +2394,13 @@ msgid "" "whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:1993 +#: ../../library/optparse.rst:1996 msgid "" "In order to actually implement your new action, you must override Option's :" "meth:`take_action` method and add a case that recognizes your action." msgstr "" -#: ../../library/optparse.rst:1996 +#: ../../library/optparse.rst:1999 msgid "" "For example, let's add an ``\"extend\"`` action. This is similar to the " "standard ``\"append\"`` action, but instead of taking a single value from " @@ -2401,47 +2410,47 @@ msgid "" "option of type ``\"string\"``, the command line ::" msgstr "" -#: ../../library/optparse.rst:2005 +#: ../../library/optparse.rst:2008 msgid "would result in a list ::" msgstr "" -#: ../../library/optparse.rst:2009 +#: ../../library/optparse.rst:2012 msgid "Again we define a subclass of Option::" msgstr "" -#: ../../library/optparse.rst:2026 +#: ../../library/optparse.rst:2029 msgid "Features of note:" msgstr "" -#: ../../library/optparse.rst:2028 +#: ../../library/optparse.rst:2031 msgid "" "``\"extend\"`` both expects a value on the command-line and stores that " "value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:" "`~Option.TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:2032 +#: ../../library/optparse.rst:2035 msgid "" "to ensure that :mod:`optparse` assigns the default type of ``\"string\"`` to " "``\"extend\"`` actions, we put the ``\"extend\"`` action in :attr:`~Option." "ALWAYS_TYPED_ACTIONS` as well." msgstr "" -#: ../../library/optparse.rst:2036 +#: ../../library/optparse.rst:2039 msgid "" ":meth:`MyOption.take_action` implements just this one new action, and passes " "control back to :meth:`Option.take_action` for the standard :mod:`optparse` " "actions." msgstr "" -#: ../../library/optparse.rst:2040 +#: ../../library/optparse.rst:2043 msgid "" "``values`` is an instance of the optparse_parser.Values class, which " "provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` " "is essentially :func:`getattr` with a safety valve; it is called as ::" msgstr "" -#: ../../library/optparse.rst:2046 +#: ../../library/optparse.rst:2049 msgid "" "If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then " "ensure_value() first sets it to ``value``, and then returns 'value. This is " @@ -2454,28 +2463,28 @@ msgid "" "meth:`ensure_value` will take care of getting it right when it's needed." msgstr "" -#: ../../library/optparse.rst:2057 +#: ../../library/optparse.rst:2060 msgid "Exceptions" msgstr "" -#: ../../library/optparse.rst:2061 +#: ../../library/optparse.rst:2064 msgid "" "Raised if an :class:`Option` instance is created with invalid or " "inconsistent arguments." msgstr "" -#: ../../library/optparse.rst:2066 +#: ../../library/optparse.rst:2069 msgid "Raised if conflicting options are added to an :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:2070 +#: ../../library/optparse.rst:2073 msgid "Raised if an invalid option value is encountered on the command line." msgstr "" -#: ../../library/optparse.rst:2074 +#: ../../library/optparse.rst:2077 msgid "Raised if an invalid option is passed on the command line." msgstr "" -#: ../../library/optparse.rst:2078 +#: ../../library/optparse.rst:2081 msgid "Raised if an ambiguous option is passed on the command line." msgstr "" From 0c52e8cbf38bc439d4fb1bf5ea0dcd2adf898b57 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 30 Jun 2023 15:33:49 +0000 Subject: [PATCH 8/9] sync with cpython f5e29f42 --- c-api/complex.po | 17 +++++++------- c-api/float.po | 14 ++++++------ c-api/long.po | 22 +++++++++--------- library/cmath.po | 10 ++++----- library/functions.po | 53 +++++++++++++++++++++++++++----------------- library/struct.po | 8 +++---- 6 files changed, 69 insertions(+), 55 deletions(-) diff --git a/c-api/complex.po b/c-api/complex.po index 5142d49c24..0fb678f8dd 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-30 15:31+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -148,16 +148,17 @@ msgstr "" #: ../../c-api/complex.rst:130 msgid "" -"If *op* is not a Python complex number object but has a :meth:`__complex__` " -"method, this method will first be called to convert *op* to a Python complex " -"number object. If ``__complex__()`` is not defined then it falls back to :" -"meth:`__float__`. If ``__float__()`` is not defined then it falls back to :" -"meth:`__index__`. Upon failure, this method returns ``-1.0`` as a real " -"value." +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " +"defined then it falls back to :meth:`~object.__index__`. Upon failure, this " +"method returns ``-1.0`` as a real value." msgstr "" #: ../../c-api/complex.rst:137 -msgid "Use :meth:`__index__` if available." +#, fuzzy +msgid "Use :meth:`~object.__index__` if available." msgstr "如果可用則會使用 :meth:`__index__`。" #: ../../c-api/complex.rst:8 diff --git a/c-api/float.po b/c-api/float.po index 9baf554044..53c8dc7856 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-30 15:31+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,15 +61,15 @@ msgstr "" #: ../../c-api/float.rst:47 msgid "" "Return a C :c:expr:`double` representation of the contents of *pyfloat*. If " -"*pyfloat* is not a Python floating point object but has a :meth:`__float__` " -"method, this method will first be called to convert *pyfloat* into a float. " -"If ``__float__()`` is not defined then it falls back to :meth:`__index__`. " -"This method returns ``-1.0`` upon failure, so one should call :c:func:" -"`PyErr_Occurred` to check for errors." +"*pyfloat* is not a Python floating point object but has a :meth:`~object." +"__float__` method, this method will first be called to convert *pyfloat* " +"into a float. If :meth:`!__float__` is not defined then it falls back to :" +"meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one " +"should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" #: ../../c-api/float.rst:54 -msgid "Use :meth:`__index__` if available." +msgid "Use :meth:`~object.__index__` if available." msgstr "" #: ../../c-api/float.rst:60 diff --git a/c-api/long.po b/c-api/long.po index be5ad46870..35b37d7483 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-30 15:31+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -140,8 +140,8 @@ msgstr "" #: ../../c-api/long.rst:122 ../../c-api/long.rst:140 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " -"instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method " -"(if present) to convert it to a :c:type:`PyLongObject`." +"instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " +"method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" #: ../../c-api/long.rst:126 @@ -157,12 +157,12 @@ msgstr "" #: ../../c-api/long.rst:131 ../../c-api/long.rst:151 ../../c-api/long.rst:172 #: ../../c-api/long.rst:194 ../../c-api/long.rst:278 ../../c-api/long.rst:298 -msgid "Use :meth:`__index__` if available." +msgid "Use :meth:`~object.__index__` if available." msgstr "" #: ../../c-api/long.rst:134 ../../c-api/long.rst:154 ../../c-api/long.rst:175 #: ../../c-api/long.rst:197 ../../c-api/long.rst:281 ../../c-api/long.rst:301 -msgid "This function will no longer use :meth:`__int__`." +msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" #: ../../c-api/long.rst:144 @@ -176,8 +176,8 @@ msgstr "" #: ../../c-api/long.rst:163 ../../c-api/long.rst:181 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " -"instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method " -"(if present) to convert it to a :c:type:`PyLongObject`." +"instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " +"method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" #: ../../c-api/long.rst:167 @@ -268,8 +268,8 @@ msgstr "" #: ../../c-api/long.rst:268 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " -"an instance of :c:type:`PyLongObject`, first call its :meth:`__index__` " -"method (if present) to convert it to a :c:type:`PyLongObject`." +"an instance of :c:type:`PyLongObject`, first call its :meth:`~object." +"__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" #: ../../c-api/long.rst:272 @@ -287,8 +287,8 @@ msgstr "" #: ../../c-api/long.rst:287 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " -"is not an instance of :c:type:`PyLongObject`, first call its :meth:" -"`__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +"is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." +"__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" #: ../../c-api/long.rst:292 diff --git a/library/cmath.po b/library/cmath.po index 762079bff9..a923b447dd 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-30 15:31+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,10 +27,10 @@ msgid "" "This module provides access to mathematical functions for complex numbers. " "The functions in this module accept integers, floating-point numbers or " "complex numbers as arguments. They will also accept any Python object that " -"has either a :meth:`__complex__` or a :meth:`__float__` method: these " -"methods are used to convert the object to a complex or floating-point " -"number, respectively, and the function is then applied to the result of the " -"conversion." +"has either a :meth:`~object.__complex__` or a :meth:`~object.__float__` " +"method: these methods are used to convert the object to a complex or " +"floating-point number, respectively, and the function is then applied to the " +"result of the conversion." msgstr "" #: ../../library/cmath.rst:18 diff --git a/library/functions.po b/library/functions.po index df0fb17a06..472a6cec14 100644 --- a/library/functions.po +++ b/library/functions.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-14 00:16+0000\n" +"POT-Creation-Date: 2023-06-30 15:31+0000\n" "PO-Revision-Date: 2023-01-04 14:53+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -466,10 +466,11 @@ msgstr "" "函式生成的字串和 Python 2 的 :func:`repr` 回傳的結果相似。" #: ../../library/functions.rst:123 +#, fuzzy msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " -"object, it has to define an :meth:`__index__` method that returns an " +"object, it has to define an :meth:`~object.__index__` method that returns an " "integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" @@ -754,8 +755,8 @@ msgid "" msgstr "" "*mode* 引數指定了編譯程式碼時必須用的模式。如果 *source* 是一系列的陳述式,可" "以是 ``'exec'``;如果是單一運算式,可以是 ``'eval'``;如果是單個互動式陳述" -"式,可以是 ``'single'`` (在最後一種情況下,如果運算式執行結果不是 ``None`` 則" -"會被印出來)。" +"式,可以是 ``'single'`` (在最後一種情況下,如果運算式執行結果不是 ``None`` " +"則會被印出來)。" #: ../../library/functions.rst:310 msgid "" @@ -889,12 +890,15 @@ msgstr "" "果兩個引數都省略,則回傳 ``0j``。" #: ../../library/functions.rst:385 +#, fuzzy msgid "" "For a general Python object ``x``, ``complex(x)`` delegates to ``x." -"__complex__()``. If ``__complex__()`` is not defined then it falls back to :" -"meth:`__float__`. If ``__float__()`` is not defined then it falls back to :" -"meth:`__index__`." +"__complex__()``. If :meth:`~object.__complex__` is not defined then it " +"falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " +"defined then it falls back to :meth:`~object.__index__`." msgstr "" +"對於一般的 Python 物件 ``x``,``float(x)`` 指派給 ``x.__float__()``。如果未定" +"義 ``__float__()`` 則使用 :meth:`__index__`。" #: ../../library/functions.rst:392 msgid "" @@ -917,8 +921,8 @@ msgstr "可以使用底線將程式碼文字中的數字進行分組。" #: ../../library/functions.rst:402 msgid "" -"Falls back to :meth:`__index__` if :meth:`__complex__` and :meth:`__float__` " -"are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" +"meth:`~object.__float__` are not defined." msgstr "" #: ../../library/functions.rst:409 @@ -1318,10 +1322,11 @@ msgstr "" "浮點數。如果引數在 Python 浮點精度範圍外,則會觸發 :exc:`OverflowError`。" #: ../../library/functions.rst:682 +#, fuzzy msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." -"__float__()``. If ``__float__()`` is not defined then it falls back to :" -"meth:`__index__`." +"__float__()``. If :meth:`~object.__float__` is not defined then it falls " +"back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 指派給 ``x.__float__()``。如果未定" "義 ``__float__()`` 則使用 :meth:`__index__`。" @@ -1342,7 +1347,9 @@ msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" #: ../../library/functions.rst:709 -msgid "Falls back to :meth:`__index__` if :meth:`__float__` is not defined." +msgid "" +"Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " +"defined." msgstr "" #: ../../library/functions.rst:719 @@ -1503,10 +1510,11 @@ msgstr "" "加全面和一致。" #: ../../library/functions.rst:822 +#, fuzzy msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" -"meth:`__index__` method that returns an integer. Some examples:" +"meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" "將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 Python :" "class:`int` 物件,則必須定義一個 :meth:`__index__` method 並且回傳一個整數。" @@ -1609,12 +1617,14 @@ msgstr "" "result``。" #: ../../library/functions.rst:894 +#, fuzzy msgid "" "Return an integer object constructed from a number or string *x*, or return " -"``0`` if no arguments are given. If *x* defines :meth:`__int__`, ``int(x)`` " -"returns ``x.__int__()``. If *x* defines :meth:`__index__`, it returns ``x." -"__index__()``. If *x* defines :meth:`__trunc__`, it returns ``x." -"__trunc__()``. For floating point numbers, this truncates towards zero." +"``0`` if no arguments are given. If *x* defines :meth:`~object.__int__`, " +"``int(x)`` returns ``x.__int__()``. If *x* defines :meth:`~object." +"__index__`, it returns ``x.__index__()``. If *x* defines :meth:`~object." +"__trunc__`, it returns ``x.__trunc__()``. For floating point numbers, this " +"truncates towards zero." msgstr "" "回傳一個使用數字或字串 *x* 建構的整數物件,或者在沒有引數時回傳 ``0``。如果 " "*x* 定義了 :meth:`__int__`,``int(x)`` 回傳 ``x.__int__()``。如果 *x* 定義" @@ -1673,11 +1683,13 @@ msgstr "" "`。" #: ../../library/functions.rst:933 -msgid "Falls back to :meth:`__index__` if :meth:`__int__` is not defined." +msgid "" +"Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " +"defined." msgstr "" #: ../../library/functions.rst:936 -msgid "The delegation to :meth:`__trunc__` is deprecated." +msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "" #: ../../library/functions.rst:939 @@ -1929,10 +1941,11 @@ msgstr "" "給 :class:`object` class 的實例。" #: ../../library/functions.rst:1138 +#, fuzzy msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " -"object, it has to define an :meth:`__index__` method that returns an " +"object, it has to define an :meth:`~object.__index__` method that returns an " "integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " diff --git a/library/struct.po b/library/struct.po index 326ddb8183..5686458d29 100644 --- a/library/struct.po +++ b/library/struct.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-06-30 15:31+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -595,12 +595,12 @@ msgstr "" #: ../../library/struct.rst:268 msgid "" "When attempting to pack a non-integer using any of the integer conversion " -"codes, if the non-integer has a :meth:`__index__` method then that method is " -"called to convert the argument to an integer before packing." +"codes, if the non-integer has a :meth:`~object.__index__` method then that " +"method is called to convert the argument to an integer before packing." msgstr "" #: ../../library/struct.rst:272 -msgid "Added use of the :meth:`__index__` method for non-integers." +msgid "Added use of the :meth:`~object.__index__` method for non-integers." msgstr "" #: ../../library/struct.rst:276 From d525208e97efcaedc61e3a595482577455af4079 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Sun, 2 Jul 2023 22:56:33 +0800 Subject: [PATCH 9/9] fix: resolve fuzzy entries --- c-api/complex.po | 3 +-- glossary.po | 44 ++++++++++++++++++++------------------------ library/functions.po | 35 +++++++++++++++-------------------- library/optparse.po | 3 +-- 4 files changed, 37 insertions(+), 48 deletions(-) diff --git a/c-api/complex.po b/c-api/complex.po index 0fb678f8dd..996c39de33 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -157,9 +157,8 @@ msgid "" msgstr "" #: ../../c-api/complex.rst:137 -#, fuzzy msgid "Use :meth:`~object.__index__` if available." -msgstr "如果可用則會使用 :meth:`__index__`。" +msgstr "如果可用則使用 :meth:`~object.__index__`。" #: ../../c-api/complex.rst:8 msgid "object" diff --git a/glossary.po b/glossary.po index 1d9b591370..648315300e 100644 --- a/glossary.po +++ b/glossary.po @@ -9,8 +9,8 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-29 00:19+0000\n" -"PO-Revision-Date: 2022-10-23 20:00+0800\n" -"Last-Translator: Steven Hsu \n" +"PO-Revision-Date: 2023-07-02 22:47+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.2\n" +"X-Generator: Poedit 3.3.2\n" #: ../../glossary.rst:5 msgid "Glossary" @@ -206,15 +206,14 @@ msgid "asynchronous context manager" msgstr "asynchronous context manager(非同步情境管理器)" #: ../../glossary.rst:94 -#, fuzzy msgid "" "An object which controls the environment seen in an :keyword:`async with` " "statement by defining :meth:`~object.__aenter__` and :meth:`~object." "__aexit__` methods. Introduced by :pep:`492`." msgstr "" "一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" -"meth:`__aenter__` 和 :meth:`__aexit__` method(方法)來控制的。由 :pep:`492` " -"引入。" +"meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" +"的。由 :pep:`492` 引入。" #: ../../glossary.rst:97 msgid "asynchronous generator" @@ -260,7 +259,6 @@ msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" #: ../../glossary.rst:115 -#, fuzzy msgid "" "This is an :term:`asynchronous iterator` which when called using the :meth:" "`~object.__anext__` method returns an awaitable object which will execute " @@ -268,11 +266,11 @@ msgid "" "`yield` expression." msgstr "" "這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" -"`__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable object),該物件" -"將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` 運算式。" +"`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable " +"object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " +"運算式。" #: ../../glossary.rst:120 -#, fuzzy msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -281,31 +279,29 @@ msgid "" "where it left off. See :pep:`492` and :pep:`525`." msgstr "" "每個 :keyword:`yield` 會暫停處理程序,並記住位置執行狀態(包括區域變數及擱置" -"中的 try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`__anext__` " -"回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :pep:`492` " -"和 :pep:`525`。" +"中的 try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`~object." +"__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" +"pep:`492` 和 :pep:`525`。" #: ../../glossary.rst:125 msgid "asynchronous iterable" msgstr "asynchronous iterable(非同步可疊代物件)" #: ../../glossary.rst:127 -#, fuzzy msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " "method. Introduced by :pep:`492`." msgstr "" "一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" -"`__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步疊代" -"器)。由 :pep:`492` 引入。" +"`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" +"疊代器)。由 :pep:`492` 引入。" #: ../../glossary.rst:130 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" #: ../../glossary.rst:132 -#, fuzzy msgid "" "An object that implements the :meth:`~object.__aiter__` and :meth:`~object." "__anext__` methods. :meth:`~object.__anext__` must return an :term:" @@ -313,10 +309,11 @@ msgid "" "an asynchronous iterator's :meth:`~object.__anext__` method until it raises " "a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." msgstr "" -"一個實作 :meth:`__aiter__` 和 :meth:`__anext__` method 的物件。\\ " -"``__anext__`` 必須回傳一個 :term:`awaitable`\\ (可等待物件)。\\ :keyword:" -"`async for` 會解析非同步疊代器的 :meth:`__anext__` method 所回傳的可等待物" -"件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :pep:`492` 引入。" +"一個實作 :meth:`~object.__aiter__` 和 :meth:`~object.__anext__` method 的物" +"件。:meth:`~object.__anext__` 必須回傳一個 :term:`awaitable`\\ (可等待物" +"件)。:keyword:`async for` 會解析非同步疊代器的 :meth:`~object.__anext__` " +"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" +"pep:`492` 引入。" #: ../../glossary.rst:137 msgid "attribute" @@ -348,15 +345,14 @@ msgid "awaitable" msgstr "awaitable(可等待物件)" #: ../../glossary.rst:151 -#, fuzzy msgid "" "An object that can be used in an :keyword:`await` expression. Can be a :" "term:`coroutine` or an object with an :meth:`~object.__await__` method. See " "also :pep:`492`." msgstr "" "一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" -"`coroutine`\\ (協程),或是一個有 :meth:`__await__` method 的物件。另請參" -"閱 :pep:`492`。" +"`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" +"另請參閱 :pep:`492`。" #: ../../glossary.rst:154 msgid "BDFL" diff --git a/library/functions.po b/library/functions.po index 472a6cec14..9455147f6e 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,8 +10,8 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-30 15:31+0000\n" -"PO-Revision-Date: 2023-01-04 14:53+0800\n" -"Last-Translator: Phil Lin \n" +"PO-Revision-Date: 2023-07-02 22:53+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -19,7 +19,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.2.2\n" +"X-Generator: Poedit 3.3.2\n" #: ../../library/functions.rst:5 ../../library/functions.rst:11 msgid "Built-in Functions" @@ -466,7 +466,6 @@ msgstr "" "函式生成的字串和 Python 2 的 :func:`repr` 回傳的結果相似。" #: ../../library/functions.rst:123 -#, fuzzy msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -474,8 +473,8 @@ msgid "" "integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" -"`__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:`~object." +"__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:133 msgid "" @@ -890,15 +889,15 @@ msgstr "" "果兩個引數都省略,則回傳 ``0j``。" #: ../../library/functions.rst:385 -#, fuzzy msgid "" "For a general Python object ``x``, ``complex(x)`` delegates to ``x." "__complex__()``. If :meth:`~object.__complex__` is not defined then it " "falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " "defined then it falls back to :meth:`~object.__index__`." msgstr "" -"對於一般的 Python 物件 ``x``,``float(x)`` 指派給 ``x.__float__()``。如果未定" -"義 ``__float__()`` 則使用 :meth:`__index__`。" +"對於一般的 Python 物件 ``x``,``complex(x)`` 指派給 ``x.__complex__()``。如果" +"未定義 :meth:`~object.__complex__` 則會回退使用 :meth:`~object.__float__`。如" +"果未定義 :meth:`!__float__` 則會回退使用 :meth:`~object.__index__`。" #: ../../library/functions.rst:392 msgid "" @@ -1322,14 +1321,13 @@ msgstr "" "浮點數。如果引數在 Python 浮點精度範圍外,則會觸發 :exc:`OverflowError`。" #: ../../library/functions.rst:682 -#, fuzzy msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " "back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 指派給 ``x.__float__()``。如果未定" -"義 ``__float__()`` 則使用 :meth:`__index__`。" +"義 :meth:`~object.__float__` 則回退使用 :meth:`~object.__index__`。" #: ../../library/functions.rst:686 msgid "If no argument is given, ``0.0`` is returned." @@ -1510,15 +1508,14 @@ msgstr "" "加全面和一致。" #: ../../library/functions.rst:822 -#, fuzzy msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" "meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" "將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 Python :" -"class:`int` 物件,則必須定義一個 :meth:`__index__` method 並且回傳一個整數。" -"舉例來說:" +"class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" +"個整數。舉例來說:" #: ../../library/functions.rst:831 msgid "" @@ -1617,7 +1614,6 @@ msgstr "" "result``。" #: ../../library/functions.rst:894 -#, fuzzy msgid "" "Return an integer object constructed from a number or string *x*, or return " "``0`` if no arguments are given. If *x* defines :meth:`~object.__int__`, " @@ -1627,9 +1623,9 @@ msgid "" "truncates towards zero." msgstr "" "回傳一個使用數字或字串 *x* 建構的整數物件,或者在沒有引數時回傳 ``0``。如果 " -"*x* 定義了 :meth:`__int__`,``int(x)`` 回傳 ``x.__int__()``。如果 *x* 定義" -"了 :meth:`__index__` 則回傳 ``x.__index__()``。如果 *x* 定義了 :meth:" -"`__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數則向零舍入。" +"*x* 定義了 :meth:`~object.__int__`,``int(x)`` 回傳 ``x.__int__()``。如果 " +"*x* 定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果 *x* 定義" +"了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數則向零舍入。" #: ../../library/functions.rst:901 msgid "" @@ -1941,7 +1937,6 @@ msgstr "" "給 :class:`object` class 的實例。" #: ../../library/functions.rst:1138 -#, fuzzy msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -1950,7 +1945,7 @@ msgid "" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" -"`__index__` method 回傳一個整數。舉例來說:" +"`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:1148 msgid "" diff --git a/library/optparse.po b/library/optparse.po index ecec1b0603..380eb8bf7b 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -372,9 +372,8 @@ msgid "" msgstr "" #: ../../library/optparse.rst:291 -#, fuzzy msgid ":meth:`~OptionParser.parse_args` returns two values:" -msgstr ":meth:`parse_args` 回傳兩個值:" +msgstr ":meth:`~OptionParser.parse_args` 回傳兩個值:" #: ../../library/optparse.rst:293 msgid "" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy