From db40d57502fb76130d57feab1d1efeef28442785 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Nov 2021 00:11:35 +0000 Subject: [PATCH 1/4] sync with cpython 94dad5e4 --- extending/extending.po | 293 +++++++++++++------------ library/sqlite3.po | 471 +++++++++++++++++++++-------------------- 2 files changed, 381 insertions(+), 383 deletions(-) diff --git a/extending/extending.po b/extending/extending.po index 40b1be2dce..168dd35ef1 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-16 00:09+0000\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -164,24 +164,21 @@ msgstr "" msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " -"error value (usually a ``NULL`` pointer). Exceptions are stored in a static " -"global variable inside the interpreter; if this variable is ``NULL`` no " -"exception has occurred. A second global variable stores the \"associated " -"value\" of the exception (the second argument to :keyword:`raise`). A third " -"variable contains the stack traceback in case the error originated in Python " -"code. These three variables are the C equivalents of the result in Python " -"of :meth:`sys.exc_info` (see the section on module :mod:`sys` in the Python " -"Library Reference). It is important to know about them to understand how " -"errors are passed around." +"error value (usually ``-1`` or a ``NULL`` pointer). Exception information " +"is stored in three members of the interpreter's thread state. These are " +"``NULL`` if there is no exception. Otherwise they are the C equivalents of " +"the members of the Python tuple returned by :meth:`sys.exc_info`. These are " +"the exception type, exception instance, and a traceback object. It is " +"important to know about them to understand how errors are passed around." msgstr "" -#: ../../extending/extending.rst:139 +#: ../../extending/extending.rst:137 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "" -#: ../../extending/extending.rst:141 +#: ../../extending/extending.rst:139 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -190,7 +187,7 @@ msgid "" "and stored as the \"associated value\" of the exception." msgstr "" -#: ../../extending/extending.rst:147 +#: ../../extending/extending.rst:145 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " @@ -200,7 +197,7 @@ msgid "" "to any of these functions." msgstr "" -#: ../../extending/extending.rst:154 +#: ../../extending/extending.rst:152 msgid "" "You can test non-destructively whether an exception has been set with :c:" "func:`PyErr_Occurred`. This returns the current exception object, or " @@ -209,7 +206,7 @@ msgid "" "since you should be able to tell from the return value." msgstr "" -#: ../../extending/extending.rst:160 +#: ../../extending/extending.rst:158 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -223,7 +220,7 @@ msgid "" "programmer." msgstr "" -#: ../../extending/extending.rst:170 +#: ../../extending/extending.rst:168 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another :c:func:`PyErr_\\*` function, and in such cases " @@ -232,7 +229,7 @@ msgid "" "operations can fail for a variety of reasons.)" msgstr "" -#: ../../extending/extending.rst:176 +#: ../../extending/extending.rst:174 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -241,7 +238,7 @@ msgid "" "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" -#: ../../extending/extending.rst:182 +#: ../../extending/extending.rst:180 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " "direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" @@ -250,7 +247,7 @@ msgid "" "so this note is only relevant to those who call :c:func:`malloc` directly." msgstr "" -#: ../../extending/extending.rst:188 +#: ../../extending/extending.rst:186 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -258,14 +255,14 @@ msgid "" "calls." msgstr "" -#: ../../extending/extending.rst:192 +#: ../../extending/extending.rst:190 msgid "" "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" "c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" -#: ../../extending/extending.rst:196 +#: ../../extending/extending.rst:194 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -278,19 +275,19 @@ msgid "" "satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" -#: ../../extending/extending.rst:206 +#: ../../extending/extending.rst:204 msgid "" "You can also define a new exception that is unique to your module. For this, " "you usually declare a static object variable at the beginning of your file::" msgstr "" -#: ../../extending/extending.rst:211 +#: ../../extending/extending.rst:209 msgid "" "and initialize it in your module's initialization function (:c:func:" "`PyInit_spam`) with an exception object::" msgstr "" -#: ../../extending/extending.rst:235 +#: ../../extending/extending.rst:233 msgid "" "Note that the Python name for the exception object is :exc:`spam.error`. " "The :c:func:`PyErr_NewException` function may create a class with the base " @@ -298,7 +295,7 @@ msgid "" "``NULL``), described in :ref:`bltin-exceptions`." msgstr "" -#: ../../extending/extending.rst:240 +#: ../../extending/extending.rst:238 msgid "" "Note also that the :c:data:`SpamError` variable retains a reference to the " "newly created exception class; this is intentional! Since the exception " @@ -309,29 +306,29 @@ msgid "" "unintended side effects." msgstr "" -#: ../../extending/extending.rst:247 +#: ../../extending/extending.rst:245 msgid "" "We discuss the use of ``PyMODINIT_FUNC`` as a function return type later in " "this sample." msgstr "" -#: ../../extending/extending.rst:250 +#: ../../extending/extending.rst:248 msgid "" "The :exc:`spam.error` exception can be raised in your extension module using " "a call to :c:func:`PyErr_SetString` as shown below::" msgstr "" -#: ../../extending/extending.rst:273 +#: ../../extending/extending.rst:271 msgid "Back to the Example" msgstr "" -#: ../../extending/extending.rst:275 +#: ../../extending/extending.rst:273 msgid "" "Going back to our example function, you should now be able to understand " "this statement::" msgstr "" -#: ../../extending/extending.rst:281 +#: ../../extending/extending.rst:279 msgid "" "It returns ``NULL`` (the error indicator for functions returning object " "pointers) if an error is detected in the argument list, relying on the " @@ -342,25 +339,25 @@ msgid "" "properly be declared as ``const char *command``)." msgstr "" -#: ../../extending/extending.rst:289 +#: ../../extending/extending.rst:287 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../extending/extending.rst:294 +#: ../../extending/extending.rst:292 msgid "" "Our :func:`spam.system` function must return the value of :c:data:`sts` as a " "Python object. This is done using the function :c:func:`PyLong_FromLong`. ::" msgstr "" -#: ../../extending/extending.rst:299 +#: ../../extending/extending.rst:297 msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" msgstr "" -#: ../../extending/extending.rst:302 +#: ../../extending/extending.rst:300 msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:type:`void`), the corresponding Python function must return " @@ -368,24 +365,24 @@ msgid "" "macro:`Py_RETURN_NONE` macro)::" msgstr "" -#: ../../extending/extending.rst:310 +#: ../../extending/extending.rst:308 msgid "" ":c:data:`Py_None` is the C name for the special Python object ``None``. It " "is a genuine Python object rather than a ``NULL`` pointer, which means " "\"error\" in most contexts, as we have seen." msgstr "" -#: ../../extending/extending.rst:318 +#: ../../extending/extending.rst:316 msgid "The Module's Method Table and Initialization Function" msgstr "" -#: ../../extending/extending.rst:320 +#: ../../extending/extending.rst:318 msgid "" "I promised to show how :c:func:`spam_system` is called from Python programs. " "First, we need to list its name and address in a \"method table\"::" msgstr "" -#: ../../extending/extending.rst:331 +#: ../../extending/extending.rst:329 msgid "" "Note the third entry (``METH_VARARGS``). This is a flag telling the " "interpreter the calling convention to be used for the C function. It should " @@ -394,14 +391,14 @@ msgid "" "is used." msgstr "" -#: ../../extending/extending.rst:336 +#: ../../extending/extending.rst:334 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" "level parameters to be passed in as a tuple acceptable for parsing via :c:" "func:`PyArg_ParseTuple`; more information on this function is provided below." msgstr "" -#: ../../extending/extending.rst:340 +#: ../../extending/extending.rst:338 msgid "" "The :const:`METH_KEYWORDS` bit may be set in the third field if keyword " "arguments should be passed to the function. In this case, the C function " @@ -410,12 +407,12 @@ msgid "" "to such a function." msgstr "" -#: ../../extending/extending.rst:346 +#: ../../extending/extending.rst:344 msgid "" "The method table must be referenced in the module definition structure::" msgstr "" -#: ../../extending/extending.rst:357 +#: ../../extending/extending.rst:355 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " "initialization function. The initialization function must be named :c:func:" @@ -423,14 +420,14 @@ msgid "" "only non-\\ ``static`` item defined in the module file::" msgstr "" -#: ../../extending/extending.rst:368 +#: ../../extending/extending.rst:366 msgid "" "Note that PyMODINIT_FUNC declares the function as ``PyObject *`` return " "type, declares any special linkage declarations required by the platform, " "and for C++ declares the function as ``extern \"C\"``." msgstr "" -#: ../../extending/extending.rst:372 +#: ../../extending/extending.rst:370 msgid "" "When the Python program imports module :mod:`spam` for the first time, :c:" "func:`PyInit_spam` is called. (See below for comments about embedding " @@ -444,7 +441,7 @@ msgid "" "then gets inserted into ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:383 +#: ../../extending/extending.rst:381 msgid "" "When embedding Python, the :c:func:`PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`PyImport_Inittab` " @@ -452,7 +449,7 @@ msgid "" "`PyImport_AppendInittab`, optionally followed by an import of the module::" msgstr "" -#: ../../extending/extending.rst:427 +#: ../../extending/extending.rst:425 msgid "" "Removing entries from ``sys.modules`` or importing compiled modules into " "multiple interpreters within a process (or following a :c:func:`fork` " @@ -461,14 +458,14 @@ msgid "" "initializing internal data structures." msgstr "" -#: ../../extending/extending.rst:433 +#: ../../extending/extending.rst:431 msgid "" "A more substantial example module is included in the Python source " "distribution as :file:`Modules/xxmodule.c`. This file may be used as a " "template or simply read as an example." msgstr "" -#: ../../extending/extending.rst:439 +#: ../../extending/extending.rst:437 msgid "" "Unlike our ``spam`` example, ``xxmodule`` uses *multi-phase initialization* " "(new in Python 3.5), where a PyModuleDef structure is returned from " @@ -476,11 +473,11 @@ msgid "" "For details on multi-phase initialization, see :PEP:`489`." msgstr "" -#: ../../extending/extending.rst:448 +#: ../../extending/extending.rst:446 msgid "Compilation and Linkage" msgstr "" -#: ../../extending/extending.rst:450 +#: ../../extending/extending.rst:448 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " @@ -490,7 +487,7 @@ msgid "" "Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" -#: ../../extending/extending.rst:457 +#: ../../extending/extending.rst:455 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -500,7 +497,7 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: ../../extending/extending.rst:468 +#: ../../extending/extending.rst:466 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -509,17 +506,17 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: ../../extending/extending.rst:474 +#: ../../extending/extending.rst:472 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: ../../extending/extending.rst:485 +#: ../../extending/extending.rst:483 msgid "Calling Python Functions from C" msgstr "" -#: ../../extending/extending.rst:487 +#: ../../extending/extending.rst:485 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -530,7 +527,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: ../../extending/extending.rst:495 +#: ../../extending/extending.rst:493 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -539,7 +536,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: ../../extending/extending.rst:501 +#: ../../extending/extending.rst:499 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -549,7 +546,7 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: ../../extending/extending.rst:531 +#: ../../extending/extending.rst:529 msgid "" "This function must be registered with the interpreter using the :const:" "`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" @@ -557,7 +554,7 @@ msgid "" "section :ref:`parsetuple`." msgstr "" -#: ../../extending/extending.rst:536 +#: ../../extending/extending.rst:534 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -565,7 +562,7 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: ../../extending/extending.rst:543 +#: ../../extending/extending.rst:541 msgid "" "Later, when it is time to call the function, you call the C function :c:func:" "`PyObject_CallObject`. This function has two arguments, both pointers to " @@ -577,7 +574,7 @@ msgid "" "or more format codes between parentheses. For example::" msgstr "" -#: ../../extending/extending.rst:563 +#: ../../extending/extending.rst:561 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " @@ -586,7 +583,7 @@ msgid "" "`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" -#: ../../extending/extending.rst:570 +#: ../../extending/extending.rst:568 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -595,7 +592,7 @@ msgid "" "not interested in its value." msgstr "" -#: ../../extending/extending.rst:576 +#: ../../extending/extending.rst:574 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -606,7 +603,7 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: ../../extending/extending.rst:589 +#: ../../extending/extending.rst:587 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -618,7 +615,7 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: ../../extending/extending.rst:608 +#: ../../extending/extending.rst:606 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -626,22 +623,22 @@ msgid "" "checked." msgstr "" -#: ../../extending/extending.rst:612 +#: ../../extending/extending.rst:610 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -#: ../../extending/extending.rst:630 +#: ../../extending/extending.rst:628 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: ../../extending/extending.rst:634 +#: ../../extending/extending.rst:632 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:638 +#: ../../extending/extending.rst:636 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -650,7 +647,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: ../../extending/extending.rst:644 +#: ../../extending/extending.rst:642 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -658,26 +655,26 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: ../../extending/extending.rst:649 +#: ../../extending/extending.rst:647 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../extending/extending.rst:652 +#: ../../extending/extending.rst:650 msgid "Some example calls::" msgstr "" -#: ../../extending/extending.rst:722 +#: ../../extending/extending.rst:720 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: ../../extending/extending.rst:726 +#: ../../extending/extending.rst:724 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:731 +#: ../../extending/extending.rst:729 msgid "" "The *arg* and *format* parameters are identical to those of the :c:func:" "`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " @@ -689,30 +686,30 @@ msgid "" "raises an appropriate exception." msgstr "" -#: ../../extending/extending.rst:741 +#: ../../extending/extending.rst:739 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " "parameters passed in which are not present in the *kwlist* will cause :exc:" "`TypeError` to be raised." msgstr "" -#: ../../extending/extending.rst:747 +#: ../../extending/extending.rst:745 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: ../../extending/extending.rst:802 +#: ../../extending/extending.rst:800 msgid "Building Arbitrary Values" msgstr "" -#: ../../extending/extending.rst:804 +#: ../../extending/extending.rst:802 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: ../../extending/extending.rst:809 +#: ../../extending/extending.rst:807 msgid "" "It recognizes a set of format units similar to the ones recognized by :c:" "func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " @@ -720,7 +717,7 @@ msgid "" "object, suitable for returning from a C function called from Python." msgstr "" -#: ../../extending/extending.rst:814 +#: ../../extending/extending.rst:812 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -732,16 +729,16 @@ msgid "" "parenthesize the format string." msgstr "" -#: ../../extending/extending.rst:822 +#: ../../extending/extending.rst:820 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: ../../extending/extending.rst:848 +#: ../../extending/extending.rst:846 msgid "Reference Counts" msgstr "" -#: ../../extending/extending.rst:850 +#: ../../extending/extending.rst:848 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -750,7 +747,7 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: ../../extending/extending.rst:856 +#: ../../extending/extending.rst:854 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -765,7 +762,7 @@ msgid "" "crashes." msgstr "" -#: ../../extending/extending.rst:867 +#: ../../extending/extending.rst:865 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -782,7 +779,7 @@ msgid "" "of errors." msgstr "" -#: ../../extending/extending.rst:880 +#: ../../extending/extending.rst:878 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -793,7 +790,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: ../../extending/extending.rst:888 +#: ../../extending/extending.rst:886 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -809,7 +806,7 @@ msgid "" "with reference counts." msgstr "" -#: ../../extending/extending.rst:900 +#: ../../extending/extending.rst:898 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -823,7 +820,7 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: ../../extending/extending.rst:911 +#: ../../extending/extending.rst:909 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " "The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." @@ -831,11 +828,11 @@ msgid "" "disable the detector at runtime." msgstr "" -#: ../../extending/extending.rst:920 +#: ../../extending/extending.rst:918 msgid "Reference Counting in Python" msgstr "" -#: ../../extending/extending.rst:922 +#: ../../extending/extending.rst:920 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -846,7 +843,7 @@ msgid "" "object." msgstr "" -#: ../../extending/extending.rst:929 +#: ../../extending/extending.rst:927 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -859,7 +856,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: ../../extending/extending.rst:938 +#: ../../extending/extending.rst:936 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -868,7 +865,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: ../../extending/extending.rst:944 +#: ../../extending/extending.rst:942 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -879,7 +876,7 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: ../../extending/extending.rst:952 +#: ../../extending/extending.rst:950 msgid "" "A borrowed reference can be changed into an owned reference by calling :c:" "func:`Py_INCREF`. This does not affect the status of the owner from which " @@ -888,18 +885,18 @@ msgid "" "properly, as well as the previous owner)." msgstr "" -#: ../../extending/extending.rst:962 +#: ../../extending/extending.rst:960 msgid "Ownership Rules" msgstr "" -#: ../../extending/extending.rst:964 +#: ../../extending/extending.rst:962 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: ../../extending/extending.rst:968 +#: ../../extending/extending.rst:966 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " @@ -910,7 +907,7 @@ msgid "" "reference to a cached item." msgstr "" -#: ../../extending/extending.rst:976 +#: ../../extending/extending.rst:974 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -921,14 +918,14 @@ msgid "" "list or dictionary." msgstr "" -#: ../../extending/extending.rst:983 +#: ../../extending/extending.rst:981 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:987 +#: ../../extending/extending.rst:985 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " @@ -939,7 +936,7 @@ msgid "" "don't take over ownership --- they are \"normal.\")" msgstr "" -#: ../../extending/extending.rst:995 +#: ../../extending/extending.rst:993 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -948,18 +945,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: ../../extending/extending.rst:1001 +#: ../../extending/extending.rst:999 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: ../../extending/extending.rst:1009 +#: ../../extending/extending.rst:1007 msgid "Thin Ice" msgstr "" -#: ../../extending/extending.rst:1011 +#: ../../extending/extending.rst:1009 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -967,21 +964,21 @@ msgid "" "dispose of it." msgstr "" -#: ../../extending/extending.rst:1015 +#: ../../extending/extending.rst:1013 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: ../../extending/extending.rst:1027 +#: ../../extending/extending.rst:1025 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: ../../extending/extending.rst:1031 +#: ../../extending/extending.rst:1029 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " @@ -991,7 +988,7 @@ msgid "" "count of 1, disposing of it will call its :meth:`__del__` method." msgstr "" -#: ../../extending/extending.rst:1038 +#: ../../extending/extending.rst:1036 msgid "" "Since it is written in Python, the :meth:`__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1002,20 +999,20 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1046 +#: ../../extending/extending.rst:1044 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1060 +#: ../../extending/extending.rst:1058 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1064 +#: ../../extending/extending.rst:1062 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " @@ -1028,11 +1025,11 @@ msgid "" "previous one::" msgstr "" -#: ../../extending/extending.rst:1087 +#: ../../extending/extending.rst:1085 msgid "NULL Pointers" msgstr "" -#: ../../extending/extending.rst:1089 +#: ../../extending/extending.rst:1087 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1044,21 +1041,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1097 +#: ../../extending/extending.rst:1095 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1101 +#: ../../extending/extending.rst:1099 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1105 +#: ../../extending/extending.rst:1103 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1067,24 +1064,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1111 +#: ../../extending/extending.rst:1109 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1115 +#: ../../extending/extending.rst:1113 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1126 +#: ../../extending/extending.rst:1124 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1128 +#: ../../extending/extending.rst:1126 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1097,11 +1094,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1142 +#: ../../extending/extending.rst:1140 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1147 +#: ../../extending/extending.rst:1145 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1112,7 +1109,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1155 +#: ../../extending/extending.rst:1153 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1128,7 +1125,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1167 +#: ../../extending/extending.rst:1165 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1138,7 +1135,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1174 +#: ../../extending/extending.rst:1172 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1150,7 +1147,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1182 +#: ../../extending/extending.rst:1180 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -1160,7 +1157,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1188 +#: ../../extending/extending.rst:1186 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:type:`const " @@ -1170,13 +1167,13 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1195 +#: ../../extending/extending.rst:1193 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1200 +#: ../../extending/extending.rst:1198 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -1184,7 +1181,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1205 +#: ../../extending/extending.rst:1203 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -1195,7 +1192,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1213 +#: ../../extending/extending.rst:1211 msgid "" "The exporting module is a modification of the :mod:`spam` module from " "section :ref:`extending-simpleexample`. The function :func:`spam.system` " @@ -1205,25 +1202,25 @@ msgid "" "function :c:func:`PySpam_System` is also exported to other extension modules." msgstr "" -#: ../../extending/extending.rst:1220 +#: ../../extending/extending.rst:1218 msgid "" "The function :c:func:`PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1229 +#: ../../extending/extending.rst:1227 msgid "The function :c:func:`spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1243 +#: ../../extending/extending.rst:1241 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1245 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1252 +#: ../../extending/extending.rst:1250 msgid "" "The ``#define`` is used to tell the header file that it is being included in " "the exporting module, not a client module. Finally, the module's " @@ -1231,33 +1228,33 @@ msgid "" "array::" msgstr "" -#: ../../extending/extending.rst:1282 +#: ../../extending/extending.rst:1280 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :func:`PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1285 +#: ../../extending/extending.rst:1283 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1336 +#: ../../extending/extending.rst:1334 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`PySpam_System` is to call the function (or rather macro) :c:func:" "`import_spam` in its initialization function::" msgstr "" -#: ../../extending/extending.rst:1354 +#: ../../extending/extending.rst:1352 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1358 +#: ../../extending/extending.rst:1356 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -1267,30 +1264,30 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1366 +#: ../../extending/extending.rst:1364 msgid "Footnotes" msgstr "註解" -#: ../../extending/extending.rst:1367 +#: ../../extending/extending.rst:1365 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1370 +#: ../../extending/extending.rst:1368 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1373 +#: ../../extending/extending.rst:1371 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1377 +#: ../../extending/extending.rst:1375 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." diff --git a/library/sqlite3.po b/library/sqlite3.po index e9914dc503..191d9b829f 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-30 00:08+0000\n" +"POT-Creation-Date: 2021-11-16 00:09+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-" @@ -45,108 +45,109 @@ msgstr "" #: ../../library/sqlite3.rst:24 msgid "" -"To use the module, you must first create a :class:`Connection` object that " +"To use the module, start by creating a :class:`Connection` object that " "represents the database. Here the data will be stored in the :file:`example." "db` file::" msgstr "" #: ../../library/sqlite3.rst:31 msgid "" -"You can also supply the special name ``:memory:`` to create a database in " -"RAM." +"The special path name ``:memory:`` can be provided to create a temporary " +"database in RAM." msgstr "" -#: ../../library/sqlite3.rst:33 +#: ../../library/sqlite3.rst:34 msgid "" -"Once you have a :class:`Connection`, you can create a :class:`Cursor` " +"Once a :class:`Connection` has been established, create a :class:`Cursor` " "object and call its :meth:`~Cursor.execute` method to perform SQL commands::" msgstr "" -#: ../../library/sqlite3.rst:52 +#: ../../library/sqlite3.rst:53 msgid "" -"The data you've saved is persistent and is available in subsequent sessions::" +"The saved data is persistent: it can be reloaded in a subsequent session " +"even after restarting the Python interpreter::" msgstr "" -#: ../../library/sqlite3.rst:58 +#: ../../library/sqlite3.rst:60 msgid "" -"To retrieve data after executing a SELECT statement, you can either treat " -"the cursor as an :term:`iterator`, call the cursor's :meth:`~Cursor." -"fetchone` method to retrieve a single matching row, or call :meth:`~Cursor." -"fetchall` to get a list of the matching rows." +"To retrieve data after executing a SELECT statement, either treat the cursor " +"as an :term:`iterator`, call the cursor's :meth:`~Cursor.fetchone` method to " +"retrieve a single matching row, or call :meth:`~Cursor.fetchall` to get a " +"list of the matching rows." msgstr "" -#: ../../library/sqlite3.rst:63 +#: ../../library/sqlite3.rst:65 msgid "This example uses the iterator form::" msgstr "" -#: ../../library/sqlite3.rst:76 +#: ../../library/sqlite3.rst:78 msgid "" -"Usually your SQL operations will need to use values from Python variables. " -"You shouldn't assemble your query using Python's string operations because " -"doing so is insecure; it makes your program vulnerable to an SQL injection " -"attack (see the `xkcd webcomic `_ for a humorous " -"example of what can go wrong)::" +"SQL operations usually need to use values from Python variables. However, " +"beware of using Python's string operations to assemble queries, as they are " +"vulnerable to SQL injection attacks (see the `xkcd webcomic `_ for a humorous example of what can go wrong)::" msgstr "" -#: ../../library/sqlite3.rst:86 +#: ../../library/sqlite3.rst:87 msgid "" -"Instead, use the DB-API's parameter substitution. Put a placeholder wherever " -"you want to use a value, and then provide a tuple of values as the second " -"argument to the cursor's :meth:`~Cursor.execute` method. An SQL statement " -"may use one of two kinds of placeholders: question marks (qmark style) or " -"named placeholders (named style). For the qmark style, ``parameters`` must " -"be a :term:`sequence `. For the named style, it can be either a :" -"term:`sequence ` or :class:`dict` instance. The length of the :" -"term:`sequence ` must match the number of placeholders, or a :exc:" -"`ProgrammingError` is raised. If a :class:`dict` is given, it must contain " -"keys for all named parameters. Any extra items are ignored. Here's an " -"example of both styles:" +"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 " +"values into the query by providing them as a :class:`tuple` of values to the " +"second argument of the cursor's :meth:`~Cursor.execute` method. An SQL " +"statement may use one of two kinds of placeholders: question marks (qmark " +"style) or named placeholders (named style). For the qmark style, " +"``parameters`` must be a :term:`sequence `. For the named style, " +"it can be either a :term:`sequence ` or :class:`dict` instance. " +"The length of the :term:`sequence ` must match the number of " +"placeholders, or a :exc:`ProgrammingError` is raised. If a :class:`dict` is " +"given, it must contain keys for all named parameters. Any extra items are " +"ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:105 +#: ../../library/sqlite3.rst:107 msgid "https://www.sqlite.org" msgstr "https://www.sqlite.org" -#: ../../library/sqlite3.rst:104 +#: ../../library/sqlite3.rst:106 msgid "" "The SQLite web page; the documentation describes the syntax and the " "available data types for the supported SQL dialect." msgstr "" -#: ../../library/sqlite3.rst:108 +#: ../../library/sqlite3.rst:110 msgid "https://www.w3schools.com/sql/" msgstr "https://www.w3schools.com/sql/" -#: ../../library/sqlite3.rst:108 +#: ../../library/sqlite3.rst:110 msgid "Tutorial, reference and examples for learning SQL syntax." msgstr "" -#: ../../library/sqlite3.rst:110 +#: ../../library/sqlite3.rst:112 msgid ":pep:`249` - Database API Specification 2.0" msgstr "" -#: ../../library/sqlite3.rst:111 +#: ../../library/sqlite3.rst:113 msgid "PEP written by Marc-André Lemburg." msgstr "" -#: ../../library/sqlite3.rst:117 +#: ../../library/sqlite3.rst:119 msgid "Module functions and constants" msgstr "" -#: ../../library/sqlite3.rst:122 +#: ../../library/sqlite3.rst:124 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:127 +#: ../../library/sqlite3.rst:129 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`sqlite3` module. Required by the DB-API. Hard-coded to ``\"qmark" "\"``." msgstr "" -#: ../../library/sqlite3.rst:133 +#: ../../library/sqlite3.rst:135 msgid "" "The :mod:`sqlite3` module supports both ``qmark`` and ``numeric`` DB-API " "parameter styles, because that is what the underlying SQLite library " @@ -154,28 +155,28 @@ msgid "" "``paramstyle`` attribute." msgstr "" -#: ../../library/sqlite3.rst:140 +#: ../../library/sqlite3.rst:142 msgid "" "The version number of this module, as a string. This is not the version of " "the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:146 +#: ../../library/sqlite3.rst:148 msgid "" "The version number of this module, as a tuple of integers. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:152 +#: ../../library/sqlite3.rst:154 msgid "The version number of the run-time SQLite library, as a string." msgstr "" -#: ../../library/sqlite3.rst:157 +#: ../../library/sqlite3.rst:159 msgid "" "The version number of the run-time SQLite library, as a tuple of integers." msgstr "" -#: ../../library/sqlite3.rst:162 +#: ../../library/sqlite3.rst:164 msgid "" "Integer constant required by the DB-API, stating the level of thread safety " "the :mod:`sqlite3` module supports. Currently hard-coded to ``1``, meaning *" @@ -184,19 +185,19 @@ msgid "" "time threaded mode using the following query::" msgstr "" -#: ../../library/sqlite3.rst:175 +#: ../../library/sqlite3.rst:177 msgid "" "Note that the `SQLITE_THREADSAFE levels `_ do not match the DB-API 2.0 ``threadsafety`` levels." msgstr "" -#: ../../library/sqlite3.rst:182 ../../library/sqlite3.rst:195 +#: ../../library/sqlite3.rst:184 ../../library/sqlite3.rst:197 msgid "" "This constant is meant to be used with the *detect_types* parameter of the :" "func:`connect` function." msgstr "" -#: ../../library/sqlite3.rst:185 +#: ../../library/sqlite3.rst:187 msgid "" "Setting it makes the :mod:`sqlite3` module parse the declared type for each " "column it returns. It will parse out the first word of the declared type, " @@ -206,7 +207,7 @@ msgid "" "registered for that type there." msgstr "" -#: ../../library/sqlite3.rst:198 +#: ../../library/sqlite3.rst:200 msgid "" "Setting this makes the SQLite interface parse the column name for each " "column it returns. It will look for a string formed [mytype] in there, and " @@ -219,13 +220,13 @@ msgid "" "preceding space: the column name would simply be \"Expiration date\"." msgstr "" -#: ../../library/sqlite3.rst:211 +#: ../../library/sqlite3.rst:213 msgid "" "Opens a connection to the SQLite database file *database*. By default " "returns a :class:`Connection` object, unless a custom *factory* is given." msgstr "" -#: ../../library/sqlite3.rst:214 +#: ../../library/sqlite3.rst:216 msgid "" "*database* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the database file to be " @@ -233,7 +234,7 @@ msgid "" "database that resides in RAM instead of on disk." msgstr "" -#: ../../library/sqlite3.rst:219 +#: ../../library/sqlite3.rst:221 msgid "" "When a database is accessed by multiple connections, and one of the " "processes modifies the database, the SQLite database is locked until that " @@ -242,13 +243,13 @@ msgid "" "The default for the timeout parameter is 5.0 (five seconds)." msgstr "" -#: ../../library/sqlite3.rst:225 +#: ../../library/sqlite3.rst:227 msgid "" "For the *isolation_level* parameter, please see the :attr:`~Connection." "isolation_level` property of :class:`Connection` objects." msgstr "" -#: ../../library/sqlite3.rst:228 +#: ../../library/sqlite3.rst:230 msgid "" "SQLite natively supports only the types TEXT, INTEGER, REAL, BLOB and NULL. " "If you want to use other types you must add support for them yourself. The " @@ -257,7 +258,7 @@ msgid "" "that." msgstr "" -#: ../../library/sqlite3.rst:233 +#: ../../library/sqlite3.rst:235 msgid "" "*detect_types* defaults to 0 (i. e. off, no type detection), you can set it " "to any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` " @@ -266,7 +267,7 @@ msgid "" "parameter is set. In such case, the returned type is :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:239 +#: ../../library/sqlite3.rst:241 msgid "" "By default, *check_same_thread* is :const:`True` and only the creating " "thread may use the connection. If set :const:`False`, the returned " @@ -275,7 +276,7 @@ msgid "" "the user to avoid data corruption." msgstr "" -#: ../../library/sqlite3.rst:244 +#: ../../library/sqlite3.rst:246 msgid "" "By default, the :mod:`sqlite3` module uses its :class:`Connection` class for " "the connect call. You can, however, subclass the :class:`Connection` class " @@ -283,11 +284,11 @@ msgid "" "the *factory* parameter." msgstr "" -#: ../../library/sqlite3.rst:249 +#: ../../library/sqlite3.rst:251 msgid "Consult the section :ref:`sqlite3-types` of this manual for details." msgstr "" -#: ../../library/sqlite3.rst:251 +#: ../../library/sqlite3.rst:253 msgid "" "The :mod:`sqlite3` module internally uses a statement cache to avoid SQL " "parsing overhead. If you want to explicitly set the number of statements " @@ -295,46 +296,46 @@ msgid "" "parameter. The currently implemented default is to cache 100 statements." msgstr "" -#: ../../library/sqlite3.rst:256 +#: ../../library/sqlite3.rst:258 msgid "" "If *uri* is true, *database* is interpreted as a URI. This allows you to " "specify options. For example, to open a database in read-only mode you can " "use::" msgstr "" -#: ../../library/sqlite3.rst:262 +#: ../../library/sqlite3.rst:264 msgid "" "More information about this feature, including a list of recognized options, " "can be found in the `SQLite URI documentation `_." msgstr "" -#: ../../library/sqlite3.rst:265 +#: ../../library/sqlite3.rst:267 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -#: ../../library/sqlite3.rst:266 +#: ../../library/sqlite3.rst:268 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." msgstr "" -#: ../../library/sqlite3.rst:268 +#: ../../library/sqlite3.rst:270 msgid "Added the *uri* parameter." msgstr "" -#: ../../library/sqlite3.rst:271 +#: ../../library/sqlite3.rst:273 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:274 +#: ../../library/sqlite3.rst:276 msgid "Added the ``sqlite3.connect/handle`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:280 +#: ../../library/sqlite3.rst:282 msgid "" "Registers a callable to convert a bytestring from the database into a custom " "Python type. The callable will be invoked for all database values that are " @@ -344,7 +345,7 @@ msgid "" "manner." msgstr "" -#: ../../library/sqlite3.rst:289 +#: ../../library/sqlite3.rst:291 msgid "" "Registers a callable to convert the custom Python type *type* into one of " "SQLite's supported types. The callable *callable* accepts as single " @@ -352,7 +353,7 @@ msgid "" "int, float, str or bytes." msgstr "" -#: ../../library/sqlite3.rst:297 +#: ../../library/sqlite3.rst:299 msgid "" "Returns :const:`True` if the string *sql* contains one or more complete SQL " "statements terminated by semicolons. It does not verify that the SQL is " @@ -360,12 +361,12 @@ msgid "" "the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:302 +#: ../../library/sqlite3.rst:304 msgid "" "This can be used to build a shell for SQLite, as in the following example:" msgstr "" -#: ../../library/sqlite3.rst:310 +#: ../../library/sqlite3.rst:312 msgid "" "By default you will not get any tracebacks in user-defined functions, " "aggregates, converters, authorizer callbacks etc. If you want to debug them, " @@ -374,35 +375,35 @@ msgid "" "disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:320 +#: ../../library/sqlite3.rst:322 msgid "Connection Objects" msgstr "" -#: ../../library/sqlite3.rst:324 +#: ../../library/sqlite3.rst:326 msgid "A SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:328 +#: ../../library/sqlite3.rst:330 msgid "" "Get or set the current default isolation level. :const:`None` for autocommit " "mode or one of \"DEFERRED\", \"IMMEDIATE\" or \"EXCLUSIVE\". See section :" "ref:`sqlite3-controlling-transactions` for a more detailed explanation." msgstr "" -#: ../../library/sqlite3.rst:334 +#: ../../library/sqlite3.rst:336 msgid "" ":const:`True` if a transaction is active (there are uncommitted changes), :" "const:`False` otherwise. Read-only attribute." msgstr "" -#: ../../library/sqlite3.rst:341 +#: ../../library/sqlite3.rst:343 msgid "" "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." msgstr "" -#: ../../library/sqlite3.rst:347 +#: ../../library/sqlite3.rst:349 msgid "" "This method commits the current transaction. If you don't call this method, " "anything you did since the last call to ``commit()`` is not visible from " @@ -410,41 +411,41 @@ msgid "" "written to the database, please check you didn't forget to call this method." msgstr "" -#: ../../library/sqlite3.rst:354 +#: ../../library/sqlite3.rst:356 msgid "" "This method rolls back any changes to the database since the last call to :" "meth:`commit`." msgstr "" -#: ../../library/sqlite3.rst:359 +#: ../../library/sqlite3.rst:361 msgid "" "This closes the database connection. Note that this does not automatically " "call :meth:`commit`. If you just close your database connection without " "calling :meth:`commit` first, your changes will be lost!" msgstr "" -#: ../../library/sqlite3.rst:365 +#: ../../library/sqlite3.rst:367 msgid "" "This is a nonstandard shortcut that creates a cursor object by calling the :" "meth:`~Connection.cursor` method, calls the cursor's :meth:`~Cursor.execute` " "method with the *parameters* given, and returns the cursor." msgstr "" -#: ../../library/sqlite3.rst:372 +#: ../../library/sqlite3.rst:374 msgid "" "This is a nonstandard shortcut that creates a cursor object by calling the :" "meth:`~Connection.cursor` method, calls the cursor's :meth:`~Cursor." "executemany` method with the *parameters* given, and returns the cursor." msgstr "" -#: ../../library/sqlite3.rst:379 +#: ../../library/sqlite3.rst:381 msgid "" "This is a nonstandard shortcut that creates a cursor object by calling the :" "meth:`~Connection.cursor` method, calls the cursor's :meth:`~Cursor." "executescript` method with the given *sql_script*, and returns the cursor." msgstr "" -#: ../../library/sqlite3.rst:386 +#: ../../library/sqlite3.rst:388 msgid "" "Creates a user-defined function that you can later use from within SQL " "statements under the function name *name*. *num_params* is the number of " @@ -457,26 +458,26 @@ msgid "" "older versions." msgstr "" -#: ../../library/sqlite3.rst:396 +#: ../../library/sqlite3.rst:398 msgid "" "The function can return any of the types supported by SQLite: bytes, str, " "int, float and ``None``." msgstr "" -#: ../../library/sqlite3.rst:399 +#: ../../library/sqlite3.rst:401 msgid "The *deterministic* parameter was added." msgstr "" -#: ../../library/sqlite3.rst:402 ../../library/sqlite3.rst:419 -#: ../../library/sqlite3.rst:551 ../../library/sqlite3.rst:702 +#: ../../library/sqlite3.rst:404 ../../library/sqlite3.rst:421 +#: ../../library/sqlite3.rst:553 ../../library/sqlite3.rst:704 msgid "Example:" msgstr "" -#: ../../library/sqlite3.rst:409 +#: ../../library/sqlite3.rst:411 msgid "Creates a user-defined aggregate function." msgstr "" -#: ../../library/sqlite3.rst:411 +#: ../../library/sqlite3.rst:413 msgid "" "The aggregate class must implement a ``step`` method, which accepts the " "number of parameters *num_params* (if *num_params* is -1, the function may " @@ -484,13 +485,13 @@ msgid "" "the final result of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:416 +#: ../../library/sqlite3.rst:418 msgid "" "The ``finalize`` method can return any of the types supported by SQLite: " "bytes, str, int, float and ``None``." msgstr "" -#: ../../library/sqlite3.rst:426 +#: ../../library/sqlite3.rst:428 msgid "" "Creates a collation with the specified *name* and *callable*. The callable " "will be passed two string arguments. It should return -1 if the first is " @@ -499,30 +500,30 @@ msgid "" "(ORDER BY in SQL) so your comparisons don't affect other SQL operations." msgstr "" -#: ../../library/sqlite3.rst:432 +#: ../../library/sqlite3.rst:434 msgid "" "Note that the callable will get its parameters as Python bytestrings, which " "will normally be encoded in UTF-8." msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:437 msgid "" "The following example shows a custom collation that sorts \"the wrong way\":" msgstr "" -#: ../../library/sqlite3.rst:439 +#: ../../library/sqlite3.rst:441 msgid "" "To remove a collation, call ``create_collation`` with ``None`` as callable::" msgstr "" -#: ../../library/sqlite3.rst:446 +#: ../../library/sqlite3.rst:448 msgid "" "You can call this method from a different thread to abort any queries that " "might be executing on the connection. The query will then abort and the " "caller will get an exception." msgstr "" -#: ../../library/sqlite3.rst:453 +#: ../../library/sqlite3.rst:455 msgid "" "This routine registers a callback. The callback is invoked for each attempt " "to access a column of a table in the database. The callback should return :" @@ -532,7 +533,7 @@ msgid "" "in the :mod:`sqlite3` module." msgstr "" -#: ../../library/sqlite3.rst:460 +#: ../../library/sqlite3.rst:462 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 :const:`None` " @@ -543,7 +544,7 @@ msgid "" "code." msgstr "" -#: ../../library/sqlite3.rst:467 +#: ../../library/sqlite3.rst:469 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 " @@ -551,7 +552,7 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:474 +#: ../../library/sqlite3.rst:476 msgid "" "This routine registers a callback. The callback is invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -559,26 +560,26 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:479 +#: ../../library/sqlite3.rst:481 msgid "" "If you want to clear any previously installed progress handler, call the " "method with :const:`None` for *handler*." msgstr "" -#: ../../library/sqlite3.rst:482 +#: ../../library/sqlite3.rst:484 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:489 +#: ../../library/sqlite3.rst:491 msgid "" "Registers *trace_callback* to be called for each SQL statement that is " "actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:492 +#: ../../library/sqlite3.rst:494 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 " @@ -588,19 +589,19 @@ msgid "" "of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:500 +#: ../../library/sqlite3.rst:502 msgid "" "Passing :const:`None` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:503 +#: ../../library/sqlite3.rst:505 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:513 +#: ../../library/sqlite3.rst:515 msgid "" "This routine allows/disallows the SQLite engine to load SQLite extensions " "from shared libraries. SQLite extensions can define new functions, " @@ -608,38 +609,38 @@ msgid "" "extension is the fulltext-search extension distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:518 ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:520 ../../library/sqlite3.rst:537 msgid "Loadable extensions are disabled by default. See [#f1]_." msgstr "" -#: ../../library/sqlite3.rst:520 +#: ../../library/sqlite3.rst:522 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: ../../library/sqlite3.rst:524 +#: ../../library/sqlite3.rst:526 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:531 +#: ../../library/sqlite3.rst:533 msgid "" "This routine loads a SQLite extension from a shared library. You have to " "enable extension loading with :meth:`enable_load_extension` before you can " "use this routine." msgstr "" -#: ../../library/sqlite3.rst:537 +#: ../../library/sqlite3.rst:539 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: ../../library/sqlite3.rst:541 +#: ../../library/sqlite3.rst:543 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:546 +#: ../../library/sqlite3.rst:548 msgid "" "You can change this attribute to a callable that accepts the cursor and the " "original row as a tuple and will return the real result row. This way, you " @@ -647,7 +648,7 @@ msgid "" "object that can also access columns by name." msgstr "" -#: ../../library/sqlite3.rst:555 +#: ../../library/sqlite3.rst:557 msgid "" "If returning a tuple doesn't suffice and you want name-based access to " "columns, you should consider setting :attr:`row_factory` to the highly-" @@ -657,7 +658,7 @@ msgid "" "approach or even a db_row based solution." msgstr "" -#: ../../library/sqlite3.rst:567 +#: ../../library/sqlite3.rst:569 msgid "" "Using this attribute you can control what objects are returned for the " "``TEXT`` data type. By default, this attribute is set to :class:`str` and " @@ -665,23 +666,23 @@ msgid "" "you want to return :class:`bytes` instead, you can set it to :class:`bytes`." msgstr "" -#: ../../library/sqlite3.rst:572 +#: ../../library/sqlite3.rst:574 msgid "" "You can also set it to any other callable that accepts a single bytestring " "parameter and returns the resulting object." msgstr "" -#: ../../library/sqlite3.rst:575 +#: ../../library/sqlite3.rst:577 msgid "See the following example code for illustration:" msgstr "" -#: ../../library/sqlite3.rst:582 +#: ../../library/sqlite3.rst:584 msgid "" "Returns the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:588 +#: ../../library/sqlite3.rst:590 msgid "" "Returns an iterator to dump the database in an SQL text format. Useful when " "saving an in-memory database for later restoration. This function provides " @@ -689,11 +690,11 @@ msgid "" "shell." msgstr "" -#: ../../library/sqlite3.rst:593 +#: ../../library/sqlite3.rst:595 msgid "Example::" msgstr "" -#: ../../library/sqlite3.rst:607 +#: ../../library/sqlite3.rst:609 msgid "" "This method makes a backup of a SQLite database even while it's being " "accessed by other clients, or concurrently by the same connection. The copy " @@ -701,14 +702,14 @@ msgid "" "class:`Connection` instance." msgstr "" -#: ../../library/sqlite3.rst:612 +#: ../../library/sqlite3.rst:614 msgid "" "By default, or when *pages* is either ``0`` or a negative integer, the " "entire database is copied in a single step; otherwise the method performs a " "loop copying up to *pages* pages at a time." msgstr "" -#: ../../library/sqlite3.rst:616 +#: ../../library/sqlite3.rst:618 msgid "" "If *progress* is specified, it must either be ``None`` or a callable object " "that will be executed at each iteration with three integer arguments, " @@ -716,7 +717,7 @@ msgid "" "pages still to be copied and the *total* number of pages." msgstr "" -#: ../../library/sqlite3.rst:621 +#: ../../library/sqlite3.rst:623 msgid "" "The *name* argument specifies the database name that will be copied: it must " "be a string containing either ``\"main\"``, the default, to indicate the " @@ -725,36 +726,36 @@ msgid "" "an attached database." msgstr "" -#: ../../library/sqlite3.rst:627 +#: ../../library/sqlite3.rst:629 msgid "" "The *sleep* argument specifies the number of seconds to sleep by between " "successive attempts to backup remaining pages, can be specified either as an " "integer or a floating point value." msgstr "" -#: ../../library/sqlite3.rst:631 +#: ../../library/sqlite3.rst:633 msgid "Example 1, copy an existing database into another::" msgstr "" -#: ../../library/sqlite3.rst:645 +#: ../../library/sqlite3.rst:647 msgid "Example 2, copy an existing database into a transient copy::" msgstr "" -#: ../../library/sqlite3.rst:659 +#: ../../library/sqlite3.rst:661 msgid "Cursor Objects" msgstr "" -#: ../../library/sqlite3.rst:663 +#: ../../library/sqlite3.rst:665 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:670 +#: ../../library/sqlite3.rst:672 msgid "" "Executes an SQL statement. Values may be bound to the statement using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:673 +#: ../../library/sqlite3.rst:675 msgid "" ":meth:`execute` will only execute a single SQL statement. If you try to " "execute more than one statement with it, it will raise a :exc:`.Warning`. " @@ -762,7 +763,7 @@ msgid "" "with one call." msgstr "" -#: ../../library/sqlite3.rst:681 +#: ../../library/sqlite3.rst:683 msgid "" "Executes a :ref:`parameterized ` SQL command against " "all parameter sequences or mappings found in the sequence " @@ -770,11 +771,11 @@ msgid "" "`iterator` yielding parameters instead of a sequence." msgstr "" -#: ../../library/sqlite3.rst:688 +#: ../../library/sqlite3.rst:690 msgid "Here's a shorter example using a :term:`generator`:" msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:697 msgid "" "This is a nonstandard convenience method for executing multiple SQL " "statements at once. It issues a ``COMMIT`` statement first, then executes " @@ -782,23 +783,23 @@ msgid "" "`isolation_level`; any transaction control must be added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:700 +#: ../../library/sqlite3.rst:702 msgid "*sql_script* can be an instance of :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:709 +#: ../../library/sqlite3.rst:711 msgid "" "Fetches the next row of a query result set, returning a single sequence, or :" "const:`None` when no more data is available." msgstr "" -#: ../../library/sqlite3.rst:715 +#: ../../library/sqlite3.rst:717 msgid "" "Fetches the next set of rows of a query result, returning a list. An empty " "list is returned when no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:718 +#: ../../library/sqlite3.rst:720 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If it is not given, the cursor's arraysize determines the number of rows to " @@ -807,7 +808,7 @@ msgid "" "not being available, fewer rows may be returned." msgstr "" -#: ../../library/sqlite3.rst:724 +#: ../../library/sqlite3.rst:726 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -815,42 +816,42 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:731 +#: ../../library/sqlite3.rst:733 msgid "" "Fetches all (remaining) rows of a query result, returning a list. Note that " "the cursor's arraysize attribute can affect the performance of this " "operation. An empty list is returned when no rows are available." msgstr "" -#: ../../library/sqlite3.rst:737 +#: ../../library/sqlite3.rst:739 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:739 +#: ../../library/sqlite3.rst:741 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:744 ../../library/sqlite3.rst:748 +#: ../../library/sqlite3.rst:746 ../../library/sqlite3.rst:750 msgid "Required by the DB-API. Is a no-op in :mod:`sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:752 +#: ../../library/sqlite3.rst:754 msgid "" "Although the :class:`Cursor` class of the :mod:`sqlite3` module implements " "this attribute, the database engine's own support for the determination of " "\"rows affected\"/\"rows selected\" is quirky." msgstr "" -#: ../../library/sqlite3.rst:756 +#: ../../library/sqlite3.rst:758 msgid "" "For :meth:`executemany` statements, the number of modifications are summed " "up into :attr:`rowcount`." msgstr "" -#: ../../library/sqlite3.rst:759 +#: ../../library/sqlite3.rst:761 msgid "" "As required by the Python DB API Spec, the :attr:`rowcount` attribute \"is " "-1 in case no ``executeXX()`` has been performed on the cursor or the " @@ -859,7 +860,7 @@ msgid "" "rows a query produced until all rows were fetched." msgstr "" -#: ../../library/sqlite3.rst:767 +#: ../../library/sqlite3.rst:769 msgid "" "This read-only attribute provides the rowid of the last modified row. It is " "only set if you issued an ``INSERT`` or a ``REPLACE`` statement using the :" @@ -868,35 +869,35 @@ msgid "" "`None`." msgstr "" -#: ../../library/sqlite3.rst:773 +#: ../../library/sqlite3.rst:775 msgid "" "If the ``INSERT`` or ``REPLACE`` statement failed to insert the previous " "successful rowid is returned." msgstr "" -#: ../../library/sqlite3.rst:776 +#: ../../library/sqlite3.rst:778 msgid "Added support for the ``REPLACE`` statement." msgstr "" -#: ../../library/sqlite3.rst:781 +#: ../../library/sqlite3.rst:783 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:786 +#: ../../library/sqlite3.rst:788 msgid "" "This read-only attribute 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 :const:`None`." msgstr "" -#: ../../library/sqlite3.rst:790 +#: ../../library/sqlite3.rst:792 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:794 +#: ../../library/sqlite3.rst:796 msgid "" "This read-only attribute provides the SQLite database :class:`Connection` " "used by the :class:`Cursor` object. A :class:`Cursor` object created by " @@ -904,79 +905,79 @@ msgid "" "`connection` attribute that refers to *con*::" msgstr "" -#: ../../library/sqlite3.rst:807 +#: ../../library/sqlite3.rst:809 msgid "Row Objects" msgstr "" -#: ../../library/sqlite3.rst:811 +#: ../../library/sqlite3.rst:813 msgid "" "A :class:`Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It tries to mimic a tuple in " "most of its features." msgstr "" -#: ../../library/sqlite3.rst:815 +#: ../../library/sqlite3.rst:817 msgid "" "It supports mapping access by column name and index, iteration, " "representation, equality testing and :func:`len`." msgstr "" -#: ../../library/sqlite3.rst:818 +#: ../../library/sqlite3.rst:820 msgid "" "If two :class:`Row` objects have exactly the same columns and their members " "are equal, they compare equal." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:825 msgid "" "This method returns a list of column names. Immediately after a query, it is " "the first member of each tuple in :attr:`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:826 +#: ../../library/sqlite3.rst:828 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:829 +#: ../../library/sqlite3.rst:831 msgid "Let's assume we initialize a table as in the example given above::" msgstr "" -#: ../../library/sqlite3.rst:841 +#: ../../library/sqlite3.rst:843 msgid "Now we plug :class:`Row` in::" msgstr "" -#: ../../library/sqlite3.rst:873 +#: ../../library/sqlite3.rst:875 msgid "Exceptions" msgstr "" -#: ../../library/sqlite3.rst:877 +#: ../../library/sqlite3.rst:879 msgid "A subclass of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:881 +#: ../../library/sqlite3.rst:883 msgid "" "The base class of the other exceptions in this module. It is a subclass of :" "exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:886 +#: ../../library/sqlite3.rst:888 msgid "Exception raised for errors that are related to the database." msgstr "" -#: ../../library/sqlite3.rst:890 +#: ../../library/sqlite3.rst:892 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:895 +#: ../../library/sqlite3.rst:897 msgid "" "Exception raised for programming errors, e.g. table not found or already " "exists, syntax error in the SQL statement, wrong number of parameters " "specified, etc. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:901 +#: ../../library/sqlite3.rst:903 msgid "" "Exception raised for errors that are related to the database's operation and " "not necessarily under the control of the programmer, e.g. an unexpected " @@ -984,7 +985,7 @@ msgid "" "not be processed, etc. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:908 +#: ../../library/sqlite3.rst:910 msgid "" "Exception raised in case a method or database API was used which is not " "supported by the database, e.g. calling the :meth:`~Connection.rollback` " @@ -992,82 +993,82 @@ msgid "" "turned off. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:917 +#: ../../library/sqlite3.rst:919 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:921 +#: ../../library/sqlite3.rst:923 msgid "Introduction" msgstr "簡介" -#: ../../library/sqlite3.rst:923 +#: ../../library/sqlite3.rst:925 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:926 +#: ../../library/sqlite3.rst:928 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:929 ../../library/sqlite3.rst:946 +#: ../../library/sqlite3.rst:931 ../../library/sqlite3.rst:948 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:929 ../../library/sqlite3.rst:946 +#: ../../library/sqlite3.rst:931 ../../library/sqlite3.rst:948 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:931 ../../library/sqlite3.rst:948 +#: ../../library/sqlite3.rst:933 ../../library/sqlite3.rst:950 msgid ":const:`None`" msgstr "" -#: ../../library/sqlite3.rst:931 ../../library/sqlite3.rst:948 +#: ../../library/sqlite3.rst:933 ../../library/sqlite3.rst:950 msgid "``NULL``" msgstr "" -#: ../../library/sqlite3.rst:933 ../../library/sqlite3.rst:950 +#: ../../library/sqlite3.rst:935 ../../library/sqlite3.rst:952 msgid ":class:`int`" msgstr "" -#: ../../library/sqlite3.rst:933 ../../library/sqlite3.rst:950 +#: ../../library/sqlite3.rst:935 ../../library/sqlite3.rst:952 msgid "``INTEGER``" msgstr "" -#: ../../library/sqlite3.rst:935 ../../library/sqlite3.rst:952 +#: ../../library/sqlite3.rst:937 ../../library/sqlite3.rst:954 msgid ":class:`float`" msgstr "" -#: ../../library/sqlite3.rst:935 ../../library/sqlite3.rst:952 +#: ../../library/sqlite3.rst:937 ../../library/sqlite3.rst:954 msgid "``REAL``" msgstr "" -#: ../../library/sqlite3.rst:937 +#: ../../library/sqlite3.rst:939 msgid ":class:`str`" msgstr "" -#: ../../library/sqlite3.rst:937 ../../library/sqlite3.rst:954 +#: ../../library/sqlite3.rst:939 ../../library/sqlite3.rst:956 msgid "``TEXT``" msgstr "" -#: ../../library/sqlite3.rst:939 ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:941 ../../library/sqlite3.rst:959 msgid ":class:`bytes`" msgstr "" -#: ../../library/sqlite3.rst:939 ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:941 ../../library/sqlite3.rst:959 msgid "``BLOB``" msgstr "" -#: ../../library/sqlite3.rst:943 +#: ../../library/sqlite3.rst:945 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:954 +#: ../../library/sqlite3.rst:956 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:960 +#: ../../library/sqlite3.rst:962 msgid "" "The type system of the :mod:`sqlite3` module is extensible in two ways: you " "can store additional Python types in a SQLite database via object " @@ -1075,11 +1076,11 @@ msgid "" "to different Python types via converters." msgstr "" -#: ../../library/sqlite3.rst:967 +#: ../../library/sqlite3.rst:969 msgid "Using adapters to store additional Python types in SQLite databases" msgstr "" -#: ../../library/sqlite3.rst:969 +#: ../../library/sqlite3.rst:971 msgid "" "As described before, SQLite supports only a limited set of types natively. " "To use other Python types with SQLite, you must **adapt** them to one of the " @@ -1087,23 +1088,23 @@ msgid "" "str, bytes." msgstr "" -#: ../../library/sqlite3.rst:974 +#: ../../library/sqlite3.rst:976 msgid "" "There are two ways to enable the :mod:`sqlite3` module to adapt a custom " "Python type to one of the supported ones." msgstr "" -#: ../../library/sqlite3.rst:979 +#: ../../library/sqlite3.rst:981 msgid "Letting your object adapt itself" msgstr "" -#: ../../library/sqlite3.rst:981 +#: ../../library/sqlite3.rst:983 msgid "" "This is a good approach if you write the class yourself. Let's suppose you " "have a class like this::" msgstr "" -#: ../../library/sqlite3.rst:988 +#: ../../library/sqlite3.rst:990 msgid "" "Now you want to store the point in a single SQLite column. First you'll " "have to choose one of the supported types to be used for representing the " @@ -1113,18 +1114,18 @@ msgid "" "class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:998 +#: ../../library/sqlite3.rst:1000 msgid "Registering an adapter callable" msgstr "" -#: ../../library/sqlite3.rst:1000 +#: ../../library/sqlite3.rst:1002 msgid "" "The other possibility is to create a function that converts the type to the " "string representation and register the function with :meth:" "`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1005 +#: ../../library/sqlite3.rst:1007 msgid "" "The :mod:`sqlite3` module has two default adapters for Python's built-in :" "class:`datetime.date` and :class:`datetime.datetime` types. Now let's " @@ -1132,100 +1133,100 @@ msgid "" "representation, but as a Unix timestamp." msgstr "" -#: ../../library/sqlite3.rst:1014 +#: ../../library/sqlite3.rst:1016 msgid "Converting SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1016 +#: ../../library/sqlite3.rst:1018 msgid "" "Writing an adapter lets you send custom Python types to SQLite. But to make " "it really useful we need to make the Python to SQLite to Python roundtrip " "work." msgstr "" -#: ../../library/sqlite3.rst:1019 +#: ../../library/sqlite3.rst:1021 msgid "Enter converters." msgstr "" -#: ../../library/sqlite3.rst:1021 +#: ../../library/sqlite3.rst:1023 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:1024 +#: ../../library/sqlite3.rst:1026 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:1029 +#: ../../library/sqlite3.rst:1031 msgid "" "Converter functions **always** get called with a :class:`bytes` object, no " "matter under which data type you sent the value to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1038 +#: ../../library/sqlite3.rst:1040 msgid "" "Now you need to make the :mod:`sqlite3` module know that what you select " "from the database is actually a point. There are two ways of doing this:" msgstr "" -#: ../../library/sqlite3.rst:1041 +#: ../../library/sqlite3.rst:1043 msgid "Implicitly via the declared type" msgstr "" -#: ../../library/sqlite3.rst:1043 +#: ../../library/sqlite3.rst:1045 msgid "Explicitly via the column name" msgstr "" -#: ../../library/sqlite3.rst:1045 +#: ../../library/sqlite3.rst:1047 msgid "" "Both ways are described in section :ref:`sqlite3-module-contents`, in the " "entries for the constants :const:`PARSE_DECLTYPES` and :const:" "`PARSE_COLNAMES`." msgstr "" -#: ../../library/sqlite3.rst:1048 +#: ../../library/sqlite3.rst:1050 msgid "The following example illustrates both approaches." msgstr "" -#: ../../library/sqlite3.rst:1054 +#: ../../library/sqlite3.rst:1056 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1056 +#: ../../library/sqlite3.rst:1058 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:1059 +#: ../../library/sqlite3.rst:1061 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:1063 +#: ../../library/sqlite3.rst:1065 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:1067 +#: ../../library/sqlite3.rst:1069 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1071 +#: ../../library/sqlite3.rst:1073 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:1077 +#: ../../library/sqlite3.rst:1079 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1233,17 +1234,17 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1085 +#: ../../library/sqlite3.rst:1087 msgid "Controlling Transactions" msgstr "" -#: ../../library/sqlite3.rst:1087 +#: ../../library/sqlite3.rst:1089 msgid "" "The underlying ``sqlite3`` library operates in ``autocommit`` mode by " "default, but the Python :mod:`sqlite3` module by default does not." msgstr "" -#: ../../library/sqlite3.rst:1090 +#: ../../library/sqlite3.rst:1092 msgid "" "``autocommit`` mode means that statements that modify the database take " "effect immediately. A ``BEGIN`` or ``SAVEPOINT`` statement disables " @@ -1251,14 +1252,14 @@ msgid "" "ends the outermost transaction, turns ``autocommit`` mode back on." msgstr "" -#: ../../library/sqlite3.rst:1095 +#: ../../library/sqlite3.rst:1097 msgid "" "The Python :mod:`sqlite3` module by default issues a ``BEGIN`` statement " "implicitly before a Data Modification Language (DML) statement (i.e. " "``INSERT``/``UPDATE``/``DELETE``/``REPLACE``)." msgstr "" -#: ../../library/sqlite3.rst:1099 +#: ../../library/sqlite3.rst:1101 msgid "" "You can control which kind of ``BEGIN`` statements :mod:`sqlite3` implicitly " "executes via the *isolation_level* parameter to the :func:`connect` call, or " @@ -1268,7 +1269,7 @@ msgid "" "``EXCLUSIVE``." msgstr "" -#: ../../library/sqlite3.rst:1106 +#: ../../library/sqlite3.rst:1108 msgid "" "You can disable the :mod:`sqlite3` module's implicit transaction management " "by setting :attr:`isolation_level` to ``None``. This will leave the " @@ -1278,27 +1279,27 @@ msgid "" "code." msgstr "" -#: ../../library/sqlite3.rst:1112 +#: ../../library/sqlite3.rst:1114 msgid "" "Note that :meth:`~Cursor.executescript` disregards :attr:`isolation_level`; " "any transaction control must be added explicitly." msgstr "" -#: ../../library/sqlite3.rst:1115 +#: ../../library/sqlite3.rst:1117 msgid "" ":mod:`sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:1121 +#: ../../library/sqlite3.rst:1123 msgid "Using :mod:`sqlite3` efficiently" msgstr "" -#: ../../library/sqlite3.rst:1125 +#: ../../library/sqlite3.rst:1127 msgid "Using shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:1127 +#: ../../library/sqlite3.rst:1129 msgid "" "Using the nonstandard :meth:`execute`, :meth:`executemany` and :meth:" "`executescript` methods of the :class:`Connection` object, your code can be " @@ -1310,38 +1311,38 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:1139 +#: ../../library/sqlite3.rst:1141 msgid "Accessing columns by name instead of by index" msgstr "" -#: ../../library/sqlite3.rst:1141 +#: ../../library/sqlite3.rst:1143 msgid "" "One useful feature of the :mod:`sqlite3` module is the built-in :class:" "`sqlite3.Row` class designed to be used as a row factory." msgstr "" -#: ../../library/sqlite3.rst:1144 +#: ../../library/sqlite3.rst:1146 msgid "" "Rows wrapped with this class can be accessed both by index (like tuples) and " "case-insensitively by name:" msgstr "" -#: ../../library/sqlite3.rst:1151 +#: ../../library/sqlite3.rst:1153 msgid "Using the connection as a context manager" msgstr "" -#: ../../library/sqlite3.rst:1153 +#: ../../library/sqlite3.rst:1155 msgid "" "Connection objects can be used as context managers that automatically commit " "or rollback transactions. In the event of an exception, the transaction is " "rolled back; otherwise, the transaction is committed:" msgstr "" -#: ../../library/sqlite3.rst:1162 +#: ../../library/sqlite3.rst:1164 msgid "Footnotes" msgstr "註解" -#: ../../library/sqlite3.rst:1163 +#: ../../library/sqlite3.rst:1165 msgid "" "The sqlite3 module is not built with loadable extension support by default, " "because some platforms (notably macOS) have SQLite libraries which are " From 955b050be8632ba4aa24a5f6114c5f3f831648a8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Nov 2021 00:11:04 +0000 Subject: [PATCH 2/4] sync with cpython 5618c81e --- library/asyncio-future.po | 98 +++++++------ library/asyncio-task.po | 300 +++++++++++++++++++------------------- 2 files changed, 205 insertions(+), 193 deletions(-) diff --git a/library/asyncio-future.po b/library/asyncio-future.po index bdba09f52a..fa0539253b 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-17 00:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,52 +88,58 @@ msgid "" msgstr "" #: ../../library/asyncio-future.rst:57 -msgid "The function accepts any :term:`awaitable` object." +msgid "" +"Save a reference to the result of this function, to avoid a task " +"disappearing mid execution." msgstr "" #: ../../library/asyncio-future.rst:60 +msgid "The function accepts any :term:`awaitable` object." +msgstr "" + +#: ../../library/asyncio-future.rst:63 msgid "" "Deprecation warning is emitted if *obj* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" -#: ../../library/asyncio-future.rst:67 +#: ../../library/asyncio-future.rst:70 msgid "" "Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio." "Future` object." msgstr "" -#: ../../library/asyncio-future.rst:70 +#: ../../library/asyncio-future.rst:73 msgid "" "Deprecation warning is emitted if *future* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" -#: ../../library/asyncio-future.rst:76 +#: ../../library/asyncio-future.rst:79 msgid "Future Object" msgstr "" -#: ../../library/asyncio-future.rst:80 +#: ../../library/asyncio-future.rst:83 msgid "" "A Future represents an eventual result of an asynchronous operation. Not " "thread-safe." msgstr "" -#: ../../library/asyncio-future.rst:83 +#: ../../library/asyncio-future.rst:86 msgid "" "Future is an :term:`awaitable` object. Coroutines can await on Future " "objects until they either have a result or an exception set, or until they " "are cancelled." msgstr "" -#: ../../library/asyncio-future.rst:87 +#: ../../library/asyncio-future.rst:90 msgid "" "Typically Futures are used to enable low-level callback-based code (e.g. in " "protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." msgstr "" -#: ../../library/asyncio-future.rst:92 +#: ../../library/asyncio-future.rst:95 msgid "" "The rule of thumb is to never expose Future objects in user-facing APIs, and " "the recommended way to create a Future object is to call :meth:`loop." @@ -141,198 +147,198 @@ msgid "" "their own optimized implementations of a Future object." msgstr "" -#: ../../library/asyncio-future.rst:98 +#: ../../library/asyncio-future.rst:101 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-future.rst:101 +#: ../../library/asyncio-future.rst:104 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-future.rst:107 +#: ../../library/asyncio-future.rst:110 msgid "Return the result of the Future." msgstr "" -#: ../../library/asyncio-future.rst:109 +#: ../../library/asyncio-future.rst:112 msgid "" "If the Future is *done* and has a result set by the :meth:`set_result` " "method, the result value is returned." msgstr "" -#: ../../library/asyncio-future.rst:112 +#: ../../library/asyncio-future.rst:115 msgid "" "If the Future is *done* and has an exception set by the :meth:" "`set_exception` method, this method raises the exception." msgstr "" -#: ../../library/asyncio-future.rst:115 ../../library/asyncio-future.rst:203 +#: ../../library/asyncio-future.rst:118 ../../library/asyncio-future.rst:206 msgid "" "If the Future has been *cancelled*, this method raises a :exc:" "`CancelledError` exception." msgstr "" -#: ../../library/asyncio-future.rst:118 +#: ../../library/asyncio-future.rst:121 msgid "" "If the Future's result isn't yet available, this method raises a :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-future.rst:123 +#: ../../library/asyncio-future.rst:126 msgid "Mark the Future as *done* and set its result." msgstr "" -#: ../../library/asyncio-future.rst:125 ../../library/asyncio-future.rst:132 +#: ../../library/asyncio-future.rst:128 ../../library/asyncio-future.rst:135 msgid "" "Raises a :exc:`InvalidStateError` error if the Future is already *done*." msgstr "" -#: ../../library/asyncio-future.rst:130 +#: ../../library/asyncio-future.rst:133 msgid "Mark the Future as *done* and set an exception." msgstr "" -#: ../../library/asyncio-future.rst:137 +#: ../../library/asyncio-future.rst:140 msgid "Return ``True`` if the Future is *done*." msgstr "" -#: ../../library/asyncio-future.rst:139 +#: ../../library/asyncio-future.rst:142 msgid "" "A Future is *done* if it was *cancelled* or if it has a result or an " "exception set with :meth:`set_result` or :meth:`set_exception` calls." msgstr "" -#: ../../library/asyncio-future.rst:145 +#: ../../library/asyncio-future.rst:148 msgid "Return ``True`` if the Future was *cancelled*." msgstr "" -#: ../../library/asyncio-future.rst:147 +#: ../../library/asyncio-future.rst:150 msgid "" "The method is usually used to check if a Future is not *cancelled* before " "setting a result or an exception for it::" msgstr "" -#: ../../library/asyncio-future.rst:155 +#: ../../library/asyncio-future.rst:158 msgid "Add a callback to be run when the Future is *done*." msgstr "" -#: ../../library/asyncio-future.rst:157 +#: ../../library/asyncio-future.rst:160 msgid "The *callback* is called with the Future object as its only argument." msgstr "" -#: ../../library/asyncio-future.rst:160 +#: ../../library/asyncio-future.rst:163 msgid "" "If the Future is already *done* when this method is called, the callback is " "scheduled with :meth:`loop.call_soon`." msgstr "" -#: ../../library/asyncio-future.rst:163 +#: ../../library/asyncio-future.rst:166 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *callback* to run in. The current " "context is used when no *context* is provided." msgstr "" -#: ../../library/asyncio-future.rst:167 +#: ../../library/asyncio-future.rst:170 msgid "" ":func:`functools.partial` can be used to pass parameters to the callback, e." "g.::" msgstr "" -#: ../../library/asyncio-future.rst:174 +#: ../../library/asyncio-future.rst:177 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "" -#: ../../library/asyncio-future.rst:180 +#: ../../library/asyncio-future.rst:183 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-future.rst:182 +#: ../../library/asyncio-future.rst:185 msgid "" "Returns the number of callbacks removed, which is typically 1, unless a " "callback was added more than once." msgstr "" -#: ../../library/asyncio-future.rst:187 +#: ../../library/asyncio-future.rst:190 msgid "Cancel the Future and schedule callbacks." msgstr "" -#: ../../library/asyncio-future.rst:189 +#: ../../library/asyncio-future.rst:192 msgid "" "If the Future is already *done* or *cancelled*, return ``False``. Otherwise, " "change the Future's state to *cancelled*, schedule the callbacks, and return " "``True``." msgstr "" -#: ../../library/asyncio-future.rst:193 +#: ../../library/asyncio-future.rst:196 msgid "Added the ``msg`` parameter." msgstr "" -#: ../../library/asyncio-future.rst:198 +#: ../../library/asyncio-future.rst:201 msgid "Return the exception that was set on this Future." msgstr "" -#: ../../library/asyncio-future.rst:200 +#: ../../library/asyncio-future.rst:203 msgid "" "The exception (or ``None`` if no exception was set) is returned only if the " "Future is *done*." msgstr "" -#: ../../library/asyncio-future.rst:206 +#: ../../library/asyncio-future.rst:209 msgid "" "If the Future isn't *done* yet, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-future.rst:211 +#: ../../library/asyncio-future.rst:214 msgid "Return the event loop the Future object is bound to." msgstr "" -#: ../../library/asyncio-future.rst:218 +#: ../../library/asyncio-future.rst:221 msgid "" "This example creates a Future object, creates and schedules an asynchronous " "Task to set result for the Future, and waits until the Future has a result::" msgstr "" -#: ../../library/asyncio-future.rst:253 +#: ../../library/asyncio-future.rst:256 msgid "" "The Future object was designed to mimic :class:`concurrent.futures.Future`. " "Key differences include:" msgstr "" -#: ../../library/asyncio-future.rst:256 +#: ../../library/asyncio-future.rst:259 msgid "" "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " "be awaited." msgstr "" -#: ../../library/asyncio-future.rst:259 +#: ../../library/asyncio-future.rst:262 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " "accept the *timeout* argument." msgstr "" -#: ../../library/asyncio-future.rst:262 +#: ../../library/asyncio-future.rst:265 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :" "exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" -#: ../../library/asyncio-future.rst:266 +#: ../../library/asyncio-future.rst:269 msgid "" "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " "called immediately. They are scheduled with :meth:`loop.call_soon` instead." msgstr "" -#: ../../library/asyncio-future.rst:270 +#: ../../library/asyncio-future.rst:273 msgid "" "asyncio Future is not compatible with the :func:`concurrent.futures.wait` " "and :func:`concurrent.futures.as_completed` functions." msgstr "" -#: ../../library/asyncio-future.rst:274 +#: ../../library/asyncio-future.rst:277 msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "func:`concurrent.futures.cancel` does not." diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 4e4c6c2785..03c64783dc 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-17 00:09+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-" @@ -213,8 +213,8 @@ msgid "" "ideally only be called once." msgstr "" -#: ../../library/asyncio-task.rst:230 ../../library/asyncio-task.rst:374 -#: ../../library/asyncio-task.rst:516 ../../library/asyncio-task.rst:665 +#: ../../library/asyncio-task.rst:230 ../../library/asyncio-task.rst:379 +#: ../../library/asyncio-task.rst:521 ../../library/asyncio-task.rst:670 msgid "Example::" msgstr "" @@ -256,77 +256,83 @@ msgid "" "low-level :func:`asyncio.ensure_future` function can be used instead::" msgstr "" -#: ../../library/asyncio-task.rst:279 ../../library/asyncio-task.rst:857 +#: ../../library/asyncio-task.rst:279 +msgid "" +"Save a reference to the result of this function, to avoid a task " +"disappearing mid execution." +msgstr "" + +#: ../../library/asyncio-task.rst:284 ../../library/asyncio-task.rst:862 msgid "Added the ``name`` parameter." msgstr "" -#: ../../library/asyncio-task.rst:284 +#: ../../library/asyncio-task.rst:289 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:288 +#: ../../library/asyncio-task.rst:293 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:290 +#: ../../library/asyncio-task.rst:295 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:293 +#: ../../library/asyncio-task.rst:298 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:296 +#: ../../library/asyncio-task.rst:301 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:305 ../../library/asyncio-task.rst:328 -#: ../../library/asyncio-task.rst:371 ../../library/asyncio-task.rst:428 -#: ../../library/asyncio-task.rst:476 ../../library/asyncio-task.rst:513 -#: ../../library/asyncio-task.rst:545 ../../library/asyncio-task.rst:608 -#: ../../library/asyncio-task.rst:638 ../../library/asyncio-task.rst:664 -#: ../../library/asyncio-task.rst:676 +#: ../../library/asyncio-task.rst:310 ../../library/asyncio-task.rst:333 +#: ../../library/asyncio-task.rst:376 ../../library/asyncio-task.rst:433 +#: ../../library/asyncio-task.rst:481 ../../library/asyncio-task.rst:518 +#: ../../library/asyncio-task.rst:550 ../../library/asyncio-task.rst:613 +#: ../../library/asyncio-task.rst:643 ../../library/asyncio-task.rst:669 +#: ../../library/asyncio-task.rst:681 msgid "" "The ``loop`` parameter. This function has been implicitly getting the " "current running loop since 3.7. See :ref:`What's New in 3.10's Removed " "section ` for more information." msgstr "" -#: ../../library/asyncio-task.rst:308 +#: ../../library/asyncio-task.rst:313 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:335 +#: ../../library/asyncio-task.rst:340 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:339 +#: ../../library/asyncio-task.rst:344 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:342 +#: ../../library/asyncio-task.rst:347 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:345 +#: ../../library/asyncio-task.rst:350 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:349 +#: ../../library/asyncio-task.rst:354 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -334,19 +340,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:354 +#: ../../library/asyncio-task.rst:359 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:357 +#: ../../library/asyncio-task.rst:362 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:360 +#: ../../library/asyncio-task.rst:365 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -354,7 +360,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:412 +#: ../../library/asyncio-task.rst:417 msgid "" "If *return_exceptions* is False, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -363,42 +369,42 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:419 +#: ../../library/asyncio-task.rst:424 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:429 +#: ../../library/asyncio-task.rst:434 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:436 +#: ../../library/asyncio-task.rst:441 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:440 +#: ../../library/asyncio-task.rst:445 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:443 ../../library/asyncio-task.rst:490 +#: ../../library/asyncio-task.rst:448 ../../library/asyncio-task.rst:495 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:445 +#: ../../library/asyncio-task.rst:450 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:449 +#: ../../library/asyncio-task.rst:454 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:453 +#: ../../library/asyncio-task.rst:458 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -407,175 +413,175 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:459 +#: ../../library/asyncio-task.rst:464 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:462 +#: ../../library/asyncio-task.rst:467 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:477 +#: ../../library/asyncio-task.rst:482 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:483 +#: ../../library/asyncio-task.rst:488 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:487 +#: ../../library/asyncio-task.rst:492 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:492 +#: ../../library/asyncio-task.rst:497 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:496 +#: ../../library/asyncio-task.rst:501 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`asyncio." "TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:499 +#: ../../library/asyncio-task.rst:504 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:502 +#: ../../library/asyncio-task.rst:507 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:506 +#: ../../library/asyncio-task.rst:511 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:536 +#: ../../library/asyncio-task.rst:541 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`asyncio.TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:549 +#: ../../library/asyncio-task.rst:554 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:553 +#: ../../library/asyncio-task.rst:558 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently and block until the condition specified by *return_when*." msgstr "" -#: ../../library/asyncio-task.rst:557 +#: ../../library/asyncio-task.rst:562 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:559 +#: ../../library/asyncio-task.rst:564 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:561 +#: ../../library/asyncio-task.rst:566 msgid "Usage::" msgstr "" -#: ../../library/asyncio-task.rst:565 +#: ../../library/asyncio-task.rst:570 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:568 +#: ../../library/asyncio-task.rst:573 msgid "" "Note that this function does not raise :exc:`asyncio.TimeoutError`. Futures " "or Tasks that aren't done when the timeout occurs are simply returned in the " "second set." msgstr "" -#: ../../library/asyncio-task.rst:572 +#: ../../library/asyncio-task.rst:577 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:578 +#: ../../library/asyncio-task.rst:583 msgid "Constant" msgstr "" -#: ../../library/asyncio-task.rst:578 +#: ../../library/asyncio-task.rst:583 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:580 +#: ../../library/asyncio-task.rst:585 msgid ":const:`FIRST_COMPLETED`" msgstr ":const:`FIRST_COMPLETED`" -#: ../../library/asyncio-task.rst:580 +#: ../../library/asyncio-task.rst:585 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:583 +#: ../../library/asyncio-task.rst:588 msgid ":const:`FIRST_EXCEPTION`" msgstr ":const:`FIRST_EXCEPTION`" -#: ../../library/asyncio-task.rst:583 +#: ../../library/asyncio-task.rst:588 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:589 +#: ../../library/asyncio-task.rst:594 msgid ":const:`ALL_COMPLETED`" msgstr ":const:`ALL_COMPLETED`" -#: ../../library/asyncio-task.rst:589 +#: ../../library/asyncio-task.rst:594 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:593 +#: ../../library/asyncio-task.rst:598 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:598 +#: ../../library/asyncio-task.rst:603 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task. Passing coroutines objects to ``wait()`` directly is deprecated as it " "leads to :ref:`confusing behavior `." msgstr "" -#: ../../library/asyncio-task.rst:612 +#: ../../library/asyncio-task.rst:617 msgid "" "``wait()`` schedules coroutines as Tasks automatically and later returns " "those implicitly created Task objects in ``(done, pending)`` sets. " "Therefore the following code won't work as expected::" msgstr "" -#: ../../library/asyncio-task.rst:625 +#: ../../library/asyncio-task.rst:630 msgid "Here is how the above snippet can be fixed::" msgstr "" -#: ../../library/asyncio-task.rst:645 +#: ../../library/asyncio-task.rst:650 msgid "Passing coroutine objects to ``wait()`` directly is deprecated." msgstr "" -#: ../../library/asyncio-task.rst:651 +#: ../../library/asyncio-task.rst:656 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. Return an iterator of coroutines. Each coroutine returned can " @@ -583,27 +589,27 @@ msgid "" "remaining awaitables." msgstr "" -#: ../../library/asyncio-task.rst:656 +#: ../../library/asyncio-task.rst:661 msgid "" "Raises :exc:`asyncio.TimeoutError` if the timeout occurs before all Futures " "are done." msgstr "" -#: ../../library/asyncio-task.rst:677 +#: ../../library/asyncio-task.rst:682 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:683 +#: ../../library/asyncio-task.rst:688 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:687 +#: ../../library/asyncio-task.rst:692 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:689 +#: ../../library/asyncio-task.rst:694 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -611,19 +617,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:694 +#: ../../library/asyncio-task.rst:699 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:696 +#: ../../library/asyncio-task.rst:701 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were ran in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:726 +#: ../../library/asyncio-task.rst:731 msgid "" "Directly calling `blocking_io()` in any coroutine would block the event loop " "for its duration, resulting in an additional 1 second of run time. Instead, " @@ -631,7 +637,7 @@ msgid "" "blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:733 +#: ../../library/asyncio-task.rst:738 msgid "" "Due to the :term:`GIL`, `asyncio.to_thread()` can typically only be used to " "make IO-bound functions non-blocking. However, for extension modules that " @@ -639,81 +645,81 @@ msgid "" "`asyncio.to_thread()` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:742 +#: ../../library/asyncio-task.rst:747 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:746 +#: ../../library/asyncio-task.rst:751 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:748 +#: ../../library/asyncio-task.rst:753 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:751 +#: ../../library/asyncio-task.rst:756 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:763 +#: ../../library/asyncio-task.rst:768 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:777 +#: ../../library/asyncio-task.rst:782 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:780 +#: ../../library/asyncio-task.rst:785 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:787 +#: ../../library/asyncio-task.rst:792 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:792 +#: ../../library/asyncio-task.rst:797 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:795 +#: ../../library/asyncio-task.rst:800 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:803 +#: ../../library/asyncio-task.rst:808 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:806 +#: ../../library/asyncio-task.rst:811 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:813 +#: ../../library/asyncio-task.rst:818 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:817 +#: ../../library/asyncio-task.rst:822 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:820 +#: ../../library/asyncio-task.rst:825 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -721,21 +727,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:826 +#: ../../library/asyncio-task.rst:831 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:831 +#: ../../library/asyncio-task.rst:836 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:836 +#: ../../library/asyncio-task.rst:841 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -743,51 +749,51 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:841 +#: ../../library/asyncio-task.rst:846 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:846 +#: ../../library/asyncio-task.rst:851 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:850 +#: ../../library/asyncio-task.rst:855 msgid "" "Tasks support the :mod:`contextvars` module. When a Task is created it " "copies the current context and later runs its coroutine in the copied " "context." msgstr "" -#: ../../library/asyncio-task.rst:854 +#: ../../library/asyncio-task.rst:859 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:862 +#: ../../library/asyncio-task.rst:867 msgid "The *loop* parameter." msgstr "" -#: ../../library/asyncio-task.rst:863 +#: ../../library/asyncio-task.rst:868 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:869 +#: ../../library/asyncio-task.rst:874 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:871 +#: ../../library/asyncio-task.rst:876 msgid "" "This arranges for a :exc:`CancelledError` exception to be thrown into the " "wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:879 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -797,103 +803,103 @@ msgid "" "is actively discouraged." msgstr "" -#: ../../library/asyncio-task.rst:882 +#: ../../library/asyncio-task.rst:887 msgid "Added the ``msg`` parameter." msgstr "" -#: ../../library/asyncio-task.rst:887 +#: ../../library/asyncio-task.rst:892 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:926 +#: ../../library/asyncio-task.rst:931 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:928 +#: ../../library/asyncio-task.rst:933 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:934 +#: ../../library/asyncio-task.rst:939 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:936 +#: ../../library/asyncio-task.rst:941 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:941 +#: ../../library/asyncio-task.rst:946 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:943 +#: ../../library/asyncio-task.rst:948 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:947 ../../library/asyncio-task.rst:961 +#: ../../library/asyncio-task.rst:952 ../../library/asyncio-task.rst:966 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:950 +#: ../../library/asyncio-task.rst:955 msgid "" "If the Task's result isn't yet available, this method raises a :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:955 +#: ../../library/asyncio-task.rst:960 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:957 +#: ../../library/asyncio-task.rst:962 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:964 +#: ../../library/asyncio-task.rst:969 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:969 +#: ../../library/asyncio-task.rst:974 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:971 ../../library/asyncio-task.rst:980 +#: ../../library/asyncio-task.rst:976 ../../library/asyncio-task.rst:985 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:973 +#: ../../library/asyncio-task.rst:978 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:978 +#: ../../library/asyncio-task.rst:983 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:982 +#: ../../library/asyncio-task.rst:987 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:987 +#: ../../library/asyncio-task.rst:992 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:989 +#: ../../library/asyncio-task.rst:994 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -901,15 +907,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:995 +#: ../../library/asyncio-task.rst:1000 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:997 +#: ../../library/asyncio-task.rst:1002 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:999 +#: ../../library/asyncio-task.rst:1004 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -918,111 +924,111 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1008 +#: ../../library/asyncio-task.rst:1013 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1010 +#: ../../library/asyncio-task.rst:1015 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1013 +#: ../../library/asyncio-task.rst:1018 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1015 +#: ../../library/asyncio-task.rst:1020 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stderr`." msgstr "" -#: ../../library/asyncio-task.rst:1020 +#: ../../library/asyncio-task.rst:1025 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1026 +#: ../../library/asyncio-task.rst:1031 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1028 +#: ../../library/asyncio-task.rst:1033 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1036 +#: ../../library/asyncio-task.rst:1041 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1038 +#: ../../library/asyncio-task.rst:1043 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1041 +#: ../../library/asyncio-task.rst:1046 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1050 +#: ../../library/asyncio-task.rst:1055 msgid "Generator-based Coroutines" msgstr "" -#: ../../library/asyncio-task.rst:1054 +#: ../../library/asyncio-task.rst:1059 msgid "" "Support for generator-based coroutines is **deprecated** and is scheduled " "for removal in Python 3.10." msgstr "" -#: ../../library/asyncio-task.rst:1057 +#: ../../library/asyncio-task.rst:1062 msgid "" "Generator-based coroutines predate async/await syntax. They are Python " "generators that use ``yield from`` expressions to await on Futures and other " "coroutines." msgstr "" -#: ../../library/asyncio-task.rst:1061 +#: ../../library/asyncio-task.rst:1066 msgid "" "Generator-based coroutines should be decorated with :func:`@asyncio." "coroutine `, although this is not enforced." msgstr "" -#: ../../library/asyncio-task.rst:1068 +#: ../../library/asyncio-task.rst:1073 msgid "Decorator to mark generator-based coroutines." msgstr "" -#: ../../library/asyncio-task.rst:1070 +#: ../../library/asyncio-task.rst:1075 msgid "" "This decorator enables legacy generator-based coroutines to be compatible " "with async/await code::" msgstr "" -#: ../../library/asyncio-task.rst:1080 +#: ../../library/asyncio-task.rst:1085 msgid "This decorator should not be used for :keyword:`async def` coroutines." msgstr "" -#: ../../library/asyncio-task.rst:1085 +#: ../../library/asyncio-task.rst:1090 msgid "Use :keyword:`async def` instead." msgstr "" -#: ../../library/asyncio-task.rst:1089 +#: ../../library/asyncio-task.rst:1094 msgid "Return ``True`` if *obj* is a :ref:`coroutine object `." msgstr "" -#: ../../library/asyncio-task.rst:1091 +#: ../../library/asyncio-task.rst:1096 msgid "" "This method is different from :func:`inspect.iscoroutine` because it returns " "``True`` for generator-based coroutines." msgstr "" -#: ../../library/asyncio-task.rst:1096 +#: ../../library/asyncio-task.rst:1101 msgid "Return ``True`` if *func* is a :ref:`coroutine function `." msgstr "" -#: ../../library/asyncio-task.rst:1099 +#: ../../library/asyncio-task.rst:1104 msgid "" "This method is different from :func:`inspect.iscoroutinefunction` because it " "returns ``True`` for generator-based coroutine functions decorated with :" From 6b47199bcd785a9183a33c6e4d1fda03e902cbc8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Nov 2021 00:10:51 +0000 Subject: [PATCH 3/4] sync with cpython 2a630e71 --- library/enum.po | 4 +- library/functools.po | 136 ++++---- library/keyword.po | 10 +- library/sys.po | 249 +++++++------- library/sysconfig.po | 140 ++++---- library/typing.po | 614 +++++++++++++++++----------------- library/unittest.po | 4 +- reference/compound_stmts.po | 387 ++++++++++----------- reference/datamodel.po | 338 +++++++++++++------ reference/expressions.po | 601 ++++++++++++++++----------------- reference/lexical_analysis.po | 11 +- 11 files changed, 1314 insertions(+), 1180 deletions(-) diff --git a/library/enum.po b/library/enum.po index 6053e8460b..c57b08d3a7 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+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-" @@ -1005,7 +1005,7 @@ msgid "" msgstr "" #: ../../library/enum.rst:1155 -msgid "This behavior is deprecated and will be removed in 3.12." +msgid "This behavior is deprecated and will be removed in 3.11." msgstr "" #: ../../library/enum.rst:1161 diff --git a/library/functools.po b/library/functools.po index 99f1798802..aea977d307 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-06 00:08+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,7 +53,7 @@ msgid "" "`lru_cache()` with a size limit." msgstr "" -#: ../../library/functools.rst:39 ../../library/functools.rst:258 +#: ../../library/functools.rst:39 ../../library/functools.rst:264 msgid "For example::" msgstr "" @@ -66,7 +66,7 @@ msgid "" msgstr "" #: ../../library/functools.rst:62 ../../library/functools.rst:127 -#: ../../library/functools.rst:350 +#: ../../library/functools.rst:356 msgid "Example::" msgstr "" @@ -175,21 +175,29 @@ msgstr "" #: ../../library/functools.rst:162 msgid "" "If *typed* is set to true, function arguments of different types will be " -"cached separately. For example, ``f(3)`` and ``f(3.0)`` will always be " -"treated as distinct calls with distinct results. If *typed* is false, the " -"implementation will usually but not always regard them as equivalent calls " -"and only cache a single result." +"cached separately. If *typed* is false, the implementation will usually " +"regard them as equivalent calls and only cache a single result. (Some types " +"such as *str* and *int* may be cached separately even when *typed* is false.)" msgstr "" #: ../../library/functools.rst:168 msgid "" +"Note, type specificity applies only to the function's immediate arguments " +"rather than their contents. The scalar arguments, ``Decimal(42)`` and " +"``Fraction(42)`` are be treated as distinct calls with distinct results. In " +"contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', " +"Fraction(42))`` are treated as equivalent." +msgstr "" + +#: ../../library/functools.rst:174 +msgid "" "The wrapped function is instrumented with a :func:`cache_parameters` " "function that returns a new :class:`dict` showing the values for *maxsize* " "and *typed*. This is for information purposes only. Mutating the values " "has no effect." msgstr "" -#: ../../library/functools.rst:173 +#: ../../library/functools.rst:179 msgid "" "To help measure the effectiveness of the cache and tune the *maxsize* " "parameter, the wrapped function is instrumented with a :func:`cache_info` " @@ -197,26 +205,26 @@ msgid "" "*maxsize* and *currsize*." msgstr "" -#: ../../library/functools.rst:178 +#: ../../library/functools.rst:184 msgid "" "The decorator also provides a :func:`cache_clear` function for clearing or " "invalidating the cache." msgstr "" -#: ../../library/functools.rst:181 +#: ../../library/functools.rst:187 msgid "" "The original underlying function is accessible through the :attr:" "`__wrapped__` attribute. This is useful for introspection, for bypassing " "the cache, or for rewrapping the function with a different cache." msgstr "" -#: ../../library/functools.rst:185 +#: ../../library/functools.rst:191 msgid "" "The cache keeps references to the arguments and return values until they age " "out of the cache or until the cache is cleared." msgstr "" -#: ../../library/functools.rst:188 +#: ../../library/functools.rst:194 msgid "" "An `LRU (least recently used) cache `_ works best when the " @@ -226,7 +234,7 @@ msgid "" "long-running processes such as web servers." msgstr "" -#: ../../library/functools.rst:195 +#: ../../library/functools.rst:201 msgid "" "In general, the LRU cache should only be used when you want to reuse " "previously computed values. Accordingly, it doesn't make sense to cache " @@ -234,44 +242,44 @@ msgid "" "objects on each call, or impure functions such as time() or random()." msgstr "" -#: ../../library/functools.rst:200 +#: ../../library/functools.rst:206 msgid "Example of an LRU cache for static web content::" msgstr "" -#: ../../library/functools.rst:219 +#: ../../library/functools.rst:225 msgid "" "Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " "programming `_ technique::" msgstr "" -#: ../../library/functools.rst:239 +#: ../../library/functools.rst:245 msgid "Added the *typed* option." msgstr "" -#: ../../library/functools.rst:242 +#: ../../library/functools.rst:248 msgid "Added the *user_function* option." msgstr "" -#: ../../library/functools.rst:245 +#: ../../library/functools.rst:251 msgid "Added the function :func:`cache_parameters`" msgstr "" -#: ../../library/functools.rst:250 +#: ../../library/functools.rst:256 msgid "" "Given a class defining one or more rich comparison ordering methods, this " "class decorator supplies the rest. This simplifies the effort involved in " "specifying all of the possible rich comparison operations:" msgstr "" -#: ../../library/functools.rst:254 +#: ../../library/functools.rst:260 msgid "" "The class must define one of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, " "or :meth:`__ge__`. In addition, the class should supply an :meth:`__eq__` " "method." msgstr "" -#: ../../library/functools.rst:278 +#: ../../library/functools.rst:284 msgid "" "While this decorator makes it easy to create well behaved totally ordered " "types, it *does* come at the cost of slower execution and more complex stack " @@ -280,7 +288,7 @@ msgid "" "rich comparison methods instead is likely to provide an easy speed boost." msgstr "" -#: ../../library/functools.rst:287 +#: ../../library/functools.rst:293 msgid "" "This decorator makes no attempt to override methods that have been declared " "in the class *or its superclasses*. Meaning that if a superclass defines a " @@ -288,13 +296,13 @@ msgid "" "the original method is abstract." msgstr "" -#: ../../library/functools.rst:294 +#: ../../library/functools.rst:300 msgid "" "Returning NotImplemented from the underlying comparison function for " "unrecognised types is now supported." msgstr "" -#: ../../library/functools.rst:300 +#: ../../library/functools.rst:306 msgid "" "Return a new :ref:`partial object` which when called will " "behave like *func* called with the positional arguments *args* and keyword " @@ -303,7 +311,7 @@ msgid "" "extend and override *keywords*. Roughly equivalent to::" msgstr "" -#: ../../library/functools.rst:316 +#: ../../library/functools.rst:322 msgid "" "The :func:`partial` is used for partial function application which \"freezes" "\" some portion of a function's arguments and/or keywords resulting in a new " @@ -312,20 +320,20 @@ msgid "" "the *base* argument defaults to two:" msgstr "" -#: ../../library/functools.rst:331 +#: ../../library/functools.rst:337 msgid "" "Return a new :class:`partialmethod` descriptor which behaves like :class:" "`partial` except that it is designed to be used as a method definition " "rather than being directly callable." msgstr "" -#: ../../library/functools.rst:335 +#: ../../library/functools.rst:341 msgid "" "*func* must be a :term:`descriptor` or a callable (objects which are both, " "like normal functions, are handled as descriptors)." msgstr "" -#: ../../library/functools.rst:338 +#: ../../library/functools.rst:344 msgid "" "When *func* is a descriptor (such as a normal Python function, :func:" "`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or another " @@ -334,7 +342,7 @@ msgid "" "objects>` returned as the result." msgstr "" -#: ../../library/functools.rst:344 +#: ../../library/functools.rst:350 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " @@ -343,7 +351,7 @@ msgid "" "`partialmethod` constructor." msgstr "" -#: ../../library/functools.rst:375 +#: ../../library/functools.rst:381 msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " @@ -356,30 +364,30 @@ msgid "" "the first item is returned." msgstr "" -#: ../../library/functools.rst:384 +#: ../../library/functools.rst:390 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/functools.rst:396 +#: ../../library/functools.rst:402 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." msgstr "" -#: ../../library/functools.rst:401 +#: ../../library/functools.rst:407 msgid "" "Transform a function into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: ../../library/functools.rst:404 +#: ../../library/functools.rst:410 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " "dispatch happens on the type of the first argument::" msgstr "" -#: ../../library/functools.rst:415 +#: ../../library/functools.rst:421 msgid "" "To add overloaded implementations to the function, use the :func:`register` " "attribute of the generic function, which can be used as a decorator. For " @@ -387,32 +395,32 @@ msgid "" "first argument automatically::" msgstr "" -#: ../../library/functools.rst:433 +#: ../../library/functools.rst:439 msgid "" "For code which doesn't use type annotations, the appropriate type argument " "can be passed explicitly to the decorator itself::" msgstr "" -#: ../../library/functools.rst:444 +#: ../../library/functools.rst:450 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`register` attribute can also be used in a functional form::" msgstr "" -#: ../../library/functools.rst:452 +#: ../../library/functools.rst:458 msgid "" "The :func:`register` attribute returns the undecorated function. This " "enables decorator stacking, :mod:`pickling`, and the creation of " "unit tests for each variant independently::" msgstr "" -#: ../../library/functools.rst:466 +#: ../../library/functools.rst:472 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "" -#: ../../library/functools.rst:486 +#: ../../library/functools.rst:492 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -421,36 +429,36 @@ msgid "" "found." msgstr "" -#: ../../library/functools.rst:492 +#: ../../library/functools.rst:498 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " "implementation::" msgstr "" -#: ../../library/functools.rst:507 +#: ../../library/functools.rst:513 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" -#: ../../library/functools.rst:515 +#: ../../library/functools.rst:521 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "" -#: ../../library/functools.rst:529 +#: ../../library/functools.rst:535 msgid "The :func:`register` attribute now supports using type annotations." msgstr "" -#: ../../library/functools.rst:535 +#: ../../library/functools.rst:541 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: ../../library/functools.rst:538 +#: ../../library/functools.rst:544 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -458,7 +466,7 @@ msgid "" "argument::" msgstr "" -#: ../../library/functools.rst:556 +#: ../../library/functools.rst:562 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -467,14 +475,14 @@ msgid "" "rather than an instance of the class::" msgstr "" -#: ../../library/functools.rst:578 +#: ../../library/functools.rst:584 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " "and others." msgstr "" -#: ../../library/functools.rst:587 +#: ../../library/functools.rst:593 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -488,7 +496,7 @@ msgid "" "``__dict__``, i.e. the instance dictionary)." msgstr "" -#: ../../library/functools.rst:597 +#: ../../library/functools.rst:603 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -496,7 +504,7 @@ msgid "" "that refers to the function being wrapped." msgstr "" -#: ../../library/functools.rst:602 +#: ../../library/functools.rst:608 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -505,7 +513,7 @@ msgid "" "is typically less than helpful." msgstr "" -#: ../../library/functools.rst:608 +#: ../../library/functools.rst:614 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -514,26 +522,26 @@ msgid "" "wrapper function itself is missing any attributes named in *updated*." msgstr "" -#: ../../library/functools.rst:614 +#: ../../library/functools.rst:620 msgid "Automatic addition of the ``__wrapped__`` attribute." msgstr "" -#: ../../library/functools.rst:617 +#: ../../library/functools.rst:623 msgid "Copying of the ``__annotations__`` attribute by default." msgstr "" -#: ../../library/functools.rst:620 +#: ../../library/functools.rst:626 msgid "Missing attributes no longer trigger an :exc:`AttributeError`." msgstr "" -#: ../../library/functools.rst:623 +#: ../../library/functools.rst:629 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" "`17482`)" msgstr "" -#: ../../library/functools.rst:631 +#: ../../library/functools.rst:637 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -541,42 +549,42 @@ msgid "" "updated=updated)``. For example::" msgstr "" -#: ../../library/functools.rst:657 +#: ../../library/functools.rst:663 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:" "`example` would have been lost." msgstr "" -#: ../../library/functools.rst:665 +#: ../../library/functools.rst:671 msgid ":class:`partial` Objects" msgstr "" -#: ../../library/functools.rst:667 +#: ../../library/functools.rst:673 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" msgstr "" -#: ../../library/functools.rst:673 +#: ../../library/functools.rst:679 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." msgstr "" -#: ../../library/functools.rst:679 +#: ../../library/functools.rst:685 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." msgstr "" -#: ../../library/functools.rst:685 +#: ../../library/functools.rst:691 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "" -#: ../../library/functools.rst:688 +#: ../../library/functools.rst:694 msgid "" ":class:`partial` objects are like :class:`function` objects in that they are " "callable, weak referencable, and can have attributes. There are some " diff --git a/library/keyword.po b/library/keyword.po index aec8007716..bc76095306 100644 --- a/library/keyword.po +++ b/library/keyword.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+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-" @@ -29,7 +29,7 @@ msgstr "" #: ../../library/keyword.rst:11 msgid "" "This module allows a Python program to determine if a string is a :ref:" -"`keyword `." +"`keyword ` or :ref:`soft keyword `." msgstr "" #: ../../library/keyword.rst:17 @@ -44,13 +44,13 @@ msgid "" msgstr "" #: ../../library/keyword.rst:29 -msgid "Return ``True`` if *s* is a Python soft :ref:`keyword `." +msgid "Return ``True`` if *s* is a Python :ref:`soft keyword `." msgstr "" #: ../../library/keyword.rst:36 msgid "" -"Sequence containing all the soft :ref:`keywords ` defined for the " -"interpreter. If any soft keywords are defined to only be active when " +"Sequence containing all the :ref:`soft keywords ` defined for " +"the interpreter. If any soft keywords are defined to only be active when " "particular :mod:`__future__` statements are in effect, these will be " "included as well." msgstr "" diff --git a/library/sys.po b/library/sys.po index 73694cd513..aefdccb7c1 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -335,7 +335,7 @@ msgid "Integer specifying the handle of the Python DLL." msgstr "" #: ../../library/sys.rst:269 ../../library/sys.rst:810 -#: ../../library/sys.rst:1491 ../../library/sys.rst:1721 +#: ../../library/sys.rst:1488 ../../library/sys.rst:1718 msgid ":ref:`Availability `: Windows." msgstr "" @@ -931,7 +931,7 @@ msgid "" "module (``RTLD_xxx`` constants, e.g. :data:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:628 ../../library/sys.rst:1260 +#: ../../library/sys.rst:628 ../../library/sys.rst:1257 msgid ":ref:`Availability `: Unix." msgstr "" @@ -1179,7 +1179,7 @@ msgstr "" msgid "See :pep:`525` for more details." msgstr "" -#: ../../library/sys.rst:832 ../../library/sys.rst:1454 +#: ../../library/sys.rst:832 ../../library/sys.rst:1451 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" @@ -1191,7 +1191,7 @@ msgid "" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:844 ../../library/sys.rst:1475 +#: ../../library/sys.rst:844 ../../library/sys.rst:1472 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." @@ -1354,11 +1354,11 @@ msgid "" "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:956 ../../library/sys.rst:1606 +#: ../../library/sys.rst:956 ../../library/sys.rst:1603 msgid "Attribute" msgstr "" -#: ../../library/sys.rst:956 ../../library/sys.rst:1606 +#: ../../library/sys.rst:956 ../../library/sys.rst:1603 msgid "Explanation" msgstr "" @@ -1718,23 +1718,20 @@ msgstr "" #: ../../library/sys.rst:1218 msgid "" "A string giving the site-specific directory prefix where the platform " -"independent Python files are installed; by default, this is the string ``'/" -"usr/local'``. This can be set at build time with the ``--prefix`` argument " -"to the :program:`configure` script. The main collection of Python library " -"modules is installed in the directory :file:`{prefix}/lib/python{X.Y}` while " -"the platform independent header files (all except :file:`pyconfig.h`) are " -"stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version " -"number of Python, for example ``3.2``." +"independent Python files are installed; on Unix, the default is ``'/usr/" +"local'``. This can be set at build time with the ``--prefix`` argument to " +"the :program:`configure` script. See :ref:`installation_paths` for derived " +"paths." msgstr "" -#: ../../library/sys.rst:1227 +#: ../../library/sys.rst:1224 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1242 +#: ../../library/sys.rst:1239 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1744,7 +1741,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1252 +#: ../../library/sys.rst:1249 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1755,7 +1752,7 @@ msgid "" "data:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1268 +#: ../../library/sys.rst:1265 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1770,7 +1767,7 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1279 +#: ../../library/sys.rst:1276 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1778,71 +1775,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1284 +#: ../../library/sys.rst:1281 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:1286 ../../library/sys.rst:1367 +#: ../../library/sys.rst:1283 ../../library/sys.rst:1364 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1290 ../../library/sys.rst:1372 +#: ../../library/sys.rst:1287 ../../library/sys.rst:1369 msgid "``'call'``" msgstr "" -#: ../../library/sys.rst:1289 +#: ../../library/sys.rst:1286 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1295 ../../library/sys.rst:1387 +#: ../../library/sys.rst:1292 ../../library/sys.rst:1384 msgid "``'return'``" msgstr "" -#: ../../library/sys.rst:1293 +#: ../../library/sys.rst:1290 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1299 +#: ../../library/sys.rst:1296 msgid "``'c_call'``" msgstr "" -#: ../../library/sys.rst:1298 +#: ../../library/sys.rst:1295 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1302 +#: ../../library/sys.rst:1299 msgid "``'c_return'``" msgstr "" -#: ../../library/sys.rst:1302 +#: ../../library/sys.rst:1299 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1304 +#: ../../library/sys.rst:1301 msgid "``'c_exception'``" msgstr "" -#: ../../library/sys.rst:1305 +#: ../../library/sys.rst:1302 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1309 +#: ../../library/sys.rst:1306 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1313 +#: ../../library/sys.rst:1310 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -1850,19 +1847,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1318 +#: ../../library/sys.rst:1315 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1321 +#: ../../library/sys.rst:1318 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1328 +#: ../../library/sys.rst:1325 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -1873,7 +1870,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1345 +#: ../../library/sys.rst:1342 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -1882,7 +1879,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1350 +#: ../../library/sys.rst:1347 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1890,7 +1887,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1355 +#: ../../library/sys.rst:1352 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -1898,31 +1895,31 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1360 +#: ../../library/sys.rst:1357 msgid "" "The local trace function should return a reference to itself (or to another " "function for further tracing in that scope), or ``None`` to turn off tracing " "in that scope." msgstr "" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1361 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1367 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1381 +#: ../../library/sys.rst:1378 msgid "``'line'``" msgstr "" -#: ../../library/sys.rst:1375 +#: ../../library/sys.rst:1372 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -1932,7 +1929,7 @@ msgid "" "const:`False` on that frame." msgstr "" -#: ../../library/sys.rst:1384 +#: ../../library/sys.rst:1381 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -1940,22 +1937,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1389 msgid "``'exception'``" msgstr "" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1387 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1400 +#: ../../library/sys.rst:1397 msgid "``'opcode'``" msgstr "" -#: ../../library/sys.rst:1395 +#: ../../library/sys.rst:1392 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -1964,13 +1961,13 @@ msgid "" "`f_trace_opcodes` to :const:`True` on the frame." msgstr "" -#: ../../library/sys.rst:1402 +#: ../../library/sys.rst:1399 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1405 +#: ../../library/sys.rst:1402 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -1984,17 +1981,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1413 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1415 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1419 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2002,13 +1999,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1429 +#: ../../library/sys.rst:1426 msgid "" "``'opcode'`` event type added; :attr:`f_trace_lines` and :attr:" "`f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1434 +#: ../../library/sys.rst:1431 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2017,32 +2014,32 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1440 +#: ../../library/sys.rst:1437 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -#: ../../library/sys.rst:1442 +#: ../../library/sys.rst:1439 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -#: ../../library/sys.rst:1444 +#: ../../library/sys.rst:1441 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1447 +#: ../../library/sys.rst:1444 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1459 +#: ../../library/sys.rst:1456 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2051,74 +2048,74 @@ msgid "" "disabled, ``cr_origin`` will be None." msgstr "" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1463 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1470 +#: ../../library/sys.rst:1467 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1480 +#: ../../library/sys.rst:1477 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1484 +#: ../../library/sys.rst:1481 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1487 +#: ../../library/sys.rst:1484 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1492 +#: ../../library/sys.rst:1489 msgid "See :pep:`529` for more details." msgstr "" -#: ../../library/sys.rst:1499 +#: ../../library/sys.rst:1496 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1502 +#: ../../library/sys.rst:1499 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1504 +#: ../../library/sys.rst:1501 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1506 +#: ../../library/sys.rst:1503 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1508 +#: ../../library/sys.rst:1505 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1512 +#: ../../library/sys.rst:1509 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1515 +#: ../../library/sys.rst:1512 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2129,14 +2126,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1524 +#: ../../library/sys.rst:1521 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1529 +#: ../../library/sys.rst:1526 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2145,7 +2142,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1536 +#: ../../library/sys.rst:1533 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2154,19 +2151,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1542 +#: ../../library/sys.rst:1539 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1548 +#: ../../library/sys.rst:1545 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1552 +#: ../../library/sys.rst:1549 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2174,7 +2171,7 @@ msgid "" "support the :attr:`~io.BufferedIOBase.buffer` attribute." msgstr "" -#: ../../library/sys.rst:1562 +#: ../../library/sys.rst:1559 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2182,7 +2179,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1567 +#: ../../library/sys.rst:1564 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2190,7 +2187,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1573 +#: ../../library/sys.rst:1570 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2198,12 +2195,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1581 +#: ../../library/sys.rst:1578 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1583 +#: ../../library/sys.rst:1580 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2211,7 +2208,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1588 +#: ../../library/sys.rst:1585 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2219,66 +2216,66 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1593 +#: ../../library/sys.rst:1590 msgid "See also the :attr:`sys.builtin_module_names` list." msgstr "" -#: ../../library/sys.rst:1600 +#: ../../library/sys.rst:1597 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1608 +#: ../../library/sys.rst:1605 msgid ":const:`name`" msgstr "" -#: ../../library/sys.rst:1608 +#: ../../library/sys.rst:1605 msgid "Name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1610 +#: ../../library/sys.rst:1607 msgid "``'nt'``: Windows threads" msgstr "" -#: ../../library/sys.rst:1611 +#: ../../library/sys.rst:1608 msgid "``'pthread'``: POSIX threads" msgstr "" -#: ../../library/sys.rst:1612 +#: ../../library/sys.rst:1609 msgid "``'solaris'``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1614 +#: ../../library/sys.rst:1611 msgid ":const:`lock`" msgstr "" -#: ../../library/sys.rst:1614 +#: ../../library/sys.rst:1611 msgid "Name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1616 +#: ../../library/sys.rst:1613 msgid "``'semaphore'``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1617 +#: ../../library/sys.rst:1614 msgid "``'mutex+cond'``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1619 +#: ../../library/sys.rst:1616 msgid "``None`` if this information is unknown" msgstr "" -#: ../../library/sys.rst:1621 +#: ../../library/sys.rst:1618 msgid ":const:`version`" msgstr "" -#: ../../library/sys.rst:1621 +#: ../../library/sys.rst:1618 msgid "" "Name and version of the thread library. It is a string, or ``None`` if this " "information is unknown." msgstr "" -#: ../../library/sys.rst:1630 +#: ../../library/sys.rst:1627 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2287,78 +2284,78 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1635 msgid "Handle an unraisable exception." msgstr "" -#: ../../library/sys.rst:1640 +#: ../../library/sys.rst:1637 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1644 +#: ../../library/sys.rst:1641 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1643 msgid "*exc_type*: Exception type." msgstr "" -#: ../../library/sys.rst:1647 +#: ../../library/sys.rst:1644 msgid "*exc_value*: Exception value, can be ``None``." msgstr "" -#: ../../library/sys.rst:1648 +#: ../../library/sys.rst:1645 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" -#: ../../library/sys.rst:1649 +#: ../../library/sys.rst:1646 msgid "*err_msg*: Error message, can be ``None``." msgstr "" -#: ../../library/sys.rst:1650 +#: ../../library/sys.rst:1647 msgid "*object*: Object causing the exception, can be ``None``." msgstr "" -#: ../../library/sys.rst:1652 +#: ../../library/sys.rst:1649 msgid "" "The default hook formats *err_msg* and *object* as: ``f'{err_msg}: {object!" "r}'``; use \"Exception ignored in\" error message if *err_msg* is ``None``." msgstr "" -#: ../../library/sys.rst:1656 +#: ../../library/sys.rst:1653 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1659 +#: ../../library/sys.rst:1656 msgid "" "Storing *exc_value* using a custom hook can create a reference cycle. It " "should be cleared explicitly to break the reference cycle when the exception " "is no longer needed." msgstr "" -#: ../../library/sys.rst:1663 +#: ../../library/sys.rst:1660 msgid "" "Storing *object* using a custom hook can resurrect it if it is set to an " "object which is being finalized. Avoid storing *object* after the custom " "hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1664 msgid "See also :func:`excepthook` which handles uncaught exceptions." msgstr "" -#: ../../library/sys.rst:1669 +#: ../../library/sys.rst:1666 msgid "" "Raises an :ref:`auditing event ` ``sys.unraisablehook`` with " "arguments ``hook``, ``unraisable``." msgstr "" -#: ../../library/sys.rst:1671 +#: ../../library/sys.rst:1668 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments ``hook``, " "``unraisable`` when an exception that cannot be handled occurs. The " @@ -2366,7 +2363,7 @@ msgid "" "hook has been set, ``hook`` may be ``None``." msgstr "" -#: ../../library/sys.rst:1680 +#: ../../library/sys.rst:1677 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2375,13 +2372,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1689 +#: ../../library/sys.rst:1686 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:1695 +#: ../../library/sys.rst:1692 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2392,18 +2389,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1703 +#: ../../library/sys.rst:1700 msgid "Added named component attributes." msgstr "" -#: ../../library/sys.rst:1708 +#: ../../library/sys.rst:1705 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:1715 +#: ../../library/sys.rst:1712 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2412,25 +2409,25 @@ msgid "" "on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:1726 +#: ../../library/sys.rst:1723 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:1742 +#: ../../library/sys.rst:1739 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:1750 +#: ../../library/sys.rst:1747 msgid "Citations" msgstr "" -#: ../../library/sys.rst:1751 +#: ../../library/sys.rst:1748 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at http://www.open-std.org/jtc1/sc22/wg14/www/docs/" diff --git a/library/sysconfig.po b/library/sysconfig.po index ed16e62475..a2f855d185 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -85,11 +85,11 @@ msgstr "" msgid "Example of usage::" msgstr "" -#: ../../library/sysconfig.rst:65 +#: ../../library/sysconfig.rst:66 msgid "Installation paths" msgstr "" -#: ../../library/sysconfig.rst:67 +#: ../../library/sysconfig.rst:68 msgid "" "Python uses an installation scheme that differs depending on the platform " "and on the installation options. These schemes are stored in :mod:" @@ -97,124 +97,128 @@ msgid "" "`os.name`." msgstr "" -#: ../../library/sysconfig.rst:71 +#: ../../library/sysconfig.rst:72 msgid "" "Every new component that is installed using :mod:`distutils` or a Distutils-" "based system will follow the same scheme to copy its file in the right " "places." msgstr "" -#: ../../library/sysconfig.rst:75 -msgid "Python currently supports seven schemes:" +#: ../../library/sysconfig.rst:76 +msgid "Python currently supports six schemes:" msgstr "" -#: ../../library/sysconfig.rst:77 +#: ../../library/sysconfig.rst:78 msgid "" "*posix_prefix*: scheme for POSIX platforms like Linux or macOS. This is the " "default scheme used when Python or a component is installed." msgstr "" -#: ../../library/sysconfig.rst:79 +#: ../../library/sysconfig.rst:80 msgid "" "*posix_home*: scheme for POSIX platforms used when a *home* option is used " "upon installation. This scheme is used when a component is installed " "through Distutils with a specific home prefix." msgstr "" -#: ../../library/sysconfig.rst:82 +#: ../../library/sysconfig.rst:83 msgid "" "*posix_user*: scheme for POSIX platforms used when a component is installed " "through Distutils and the *user* option is used. This scheme defines paths " "located under the user home directory." msgstr "" -#: ../../library/sysconfig.rst:85 +#: ../../library/sysconfig.rst:86 msgid "*nt*: scheme for NT platforms like Windows." msgstr "" -#: ../../library/sysconfig.rst:86 +#: ../../library/sysconfig.rst:87 msgid "*nt_user*: scheme for NT platforms, when the *user* option is used." msgstr "" #: ../../library/sysconfig.rst:88 +msgid "*osx_framework_user*: scheme for macOS, when the *user* option is used." +msgstr "" + +#: ../../library/sysconfig.rst:90 msgid "" "Each scheme is itself composed of a series of paths and each path has a " "unique identifier. Python currently uses eight paths:" msgstr "" -#: ../../library/sysconfig.rst:91 +#: ../../library/sysconfig.rst:93 msgid "" "*stdlib*: directory containing the standard Python library files that are " "not platform-specific." msgstr "" -#: ../../library/sysconfig.rst:93 +#: ../../library/sysconfig.rst:95 msgid "" "*platstdlib*: directory containing the standard Python library files that " "are platform-specific." msgstr "" -#: ../../library/sysconfig.rst:95 +#: ../../library/sysconfig.rst:97 msgid "*platlib*: directory for site-specific, platform-specific files." msgstr "" -#: ../../library/sysconfig.rst:96 +#: ../../library/sysconfig.rst:98 msgid "*purelib*: directory for site-specific, non-platform-specific files." msgstr "" -#: ../../library/sysconfig.rst:97 +#: ../../library/sysconfig.rst:99 msgid "*include*: directory for non-platform-specific header files." msgstr "" -#: ../../library/sysconfig.rst:98 +#: ../../library/sysconfig.rst:100 msgid "*platinclude*: directory for platform-specific header files." msgstr "" -#: ../../library/sysconfig.rst:99 +#: ../../library/sysconfig.rst:101 msgid "*scripts*: directory for script files." msgstr "" -#: ../../library/sysconfig.rst:100 +#: ../../library/sysconfig.rst:102 msgid "*data*: directory for data files." msgstr "" -#: ../../library/sysconfig.rst:102 +#: ../../library/sysconfig.rst:104 msgid ":mod:`sysconfig` provides some functions to determine these paths." msgstr "" -#: ../../library/sysconfig.rst:106 +#: ../../library/sysconfig.rst:108 msgid "" "Return a tuple containing all schemes currently supported in :mod:" "`sysconfig`." msgstr "" -#: ../../library/sysconfig.rst:112 +#: ../../library/sysconfig.rst:114 msgid "Return the default scheme name for the current platform." msgstr "" -#: ../../library/sysconfig.rst:114 +#: ../../library/sysconfig.rst:116 msgid "" "This function was previously named ``_get_default_scheme()`` and considered " "an implementation detail." msgstr "" -#: ../../library/sysconfig.rst:121 +#: ../../library/sysconfig.rst:123 msgid "" "Return a preferred scheme name for an installation layout specified by *key*." msgstr "" -#: ../../library/sysconfig.rst:123 +#: ../../library/sysconfig.rst:125 msgid "*key* must be either ``\"prefix\"``, ``\"home\"``, or ``\"user\"``." msgstr "" -#: ../../library/sysconfig.rst:125 +#: ../../library/sysconfig.rst:127 msgid "" "The return value is a scheme name listed in :func:`get_scheme_names`. It can " "be passed to :mod:`sysconfig` functions that take a *scheme* argument, such " "as :func:`get_paths`." msgstr "" -#: ../../library/sysconfig.rst:134 +#: ../../library/sysconfig.rst:136 msgid "" "Return a dict containing preferred scheme names on the current platform. " "Python implementers and redistributors may add their preferred schemes to " @@ -224,109 +228,109 @@ msgid "" "mix with those by the other." msgstr "" -#: ../../library/sysconfig.rst:141 +#: ../../library/sysconfig.rst:143 msgid "" "End users should not use this function, but :func:`get_default_scheme` and :" "func:`get_preferred_scheme()` instead." msgstr "" -#: ../../library/sysconfig.rst:149 +#: ../../library/sysconfig.rst:151 msgid "" "Return a tuple containing all path names currently supported in :mod:" "`sysconfig`." msgstr "" -#: ../../library/sysconfig.rst:155 +#: ../../library/sysconfig.rst:157 msgid "" "Return an installation path corresponding to the path *name*, from the " "install scheme named *scheme*." msgstr "" -#: ../../library/sysconfig.rst:158 +#: ../../library/sysconfig.rst:160 msgid "" "*name* has to be a value from the list returned by :func:`get_path_names`." msgstr "" -#: ../../library/sysconfig.rst:160 +#: ../../library/sysconfig.rst:162 msgid "" ":mod:`sysconfig` stores installation paths corresponding to each path name, " "for each platform, with variables to be expanded. For instance the *stdlib* " "path for the *nt* scheme is: ``{base}/Lib``." msgstr "" -#: ../../library/sysconfig.rst:164 +#: ../../library/sysconfig.rst:166 msgid "" ":func:`get_path` will use the variables returned by :func:`get_config_vars` " "to expand the path. All variables have default values for each platform so " "one may call this function and get the default value." msgstr "" -#: ../../library/sysconfig.rst:168 +#: ../../library/sysconfig.rst:170 msgid "" "If *scheme* is provided, it must be a value from the list returned by :func:" "`get_scheme_names`. Otherwise, the default scheme for the current platform " "is used." msgstr "" -#: ../../library/sysconfig.rst:172 +#: ../../library/sysconfig.rst:174 msgid "" "If *vars* is provided, it must be a dictionary of variables that will update " "the dictionary return by :func:`get_config_vars`." msgstr "" -#: ../../library/sysconfig.rst:175 +#: ../../library/sysconfig.rst:177 msgid "" "If *expand* is set to ``False``, the path will not be expanded using the " "variables." msgstr "" -#: ../../library/sysconfig.rst:178 +#: ../../library/sysconfig.rst:180 msgid "If *name* is not found, raise a :exc:`KeyError`." msgstr "" -#: ../../library/sysconfig.rst:183 +#: ../../library/sysconfig.rst:185 msgid "" "Return a dictionary containing all installation paths corresponding to an " "installation scheme. See :func:`get_path` for more information." msgstr "" -#: ../../library/sysconfig.rst:186 +#: ../../library/sysconfig.rst:188 msgid "" "If *scheme* is not provided, will use the default scheme for the current " "platform." msgstr "" -#: ../../library/sysconfig.rst:189 +#: ../../library/sysconfig.rst:191 msgid "" "If *vars* is provided, it must be a dictionary of variables that will update " "the dictionary used to expand the paths." msgstr "" -#: ../../library/sysconfig.rst:192 +#: ../../library/sysconfig.rst:194 msgid "If *expand* is set to false, the paths will not be expanded." msgstr "" -#: ../../library/sysconfig.rst:194 +#: ../../library/sysconfig.rst:196 msgid "" "If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" "`KeyError`." msgstr "" -#: ../../library/sysconfig.rst:199 +#: ../../library/sysconfig.rst:201 msgid "Other functions" msgstr "" -#: ../../library/sysconfig.rst:203 +#: ../../library/sysconfig.rst:205 msgid "" "Return the ``MAJOR.MINOR`` Python version number as a string. Similar to " "``'%d.%d' % sys.version_info[:2]``." msgstr "" -#: ../../library/sysconfig.rst:209 +#: ../../library/sysconfig.rst:211 msgid "Return a string that identifies the current platform." msgstr "" -#: ../../library/sysconfig.rst:211 +#: ../../library/sysconfig.rst:213 msgid "" "This is used mainly to distinguish platform-specific build directories and " "platform-specific built distributions. Typically includes the OS name and " @@ -335,99 +339,99 @@ msgid "" "version isn't particularly important." msgstr "" -#: ../../library/sysconfig.rst:217 +#: ../../library/sysconfig.rst:219 msgid "Examples of returned values:" msgstr "" -#: ../../library/sysconfig.rst:219 +#: ../../library/sysconfig.rst:221 msgid "linux-i586" msgstr "" -#: ../../library/sysconfig.rst:220 +#: ../../library/sysconfig.rst:222 msgid "linux-alpha (?)" msgstr "" -#: ../../library/sysconfig.rst:221 +#: ../../library/sysconfig.rst:223 msgid "solaris-2.6-sun4u" msgstr "" -#: ../../library/sysconfig.rst:223 +#: ../../library/sysconfig.rst:225 msgid "Windows will return one of:" msgstr "" -#: ../../library/sysconfig.rst:225 +#: ../../library/sysconfig.rst:227 msgid "win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" msgstr "" -#: ../../library/sysconfig.rst:226 +#: ../../library/sysconfig.rst:228 msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" -#: ../../library/sysconfig.rst:228 +#: ../../library/sysconfig.rst:230 msgid "macOS can return:" msgstr "" -#: ../../library/sysconfig.rst:230 +#: ../../library/sysconfig.rst:232 msgid "macosx-10.6-ppc" msgstr "" -#: ../../library/sysconfig.rst:231 +#: ../../library/sysconfig.rst:233 msgid "macosx-10.4-ppc64" msgstr "" -#: ../../library/sysconfig.rst:232 +#: ../../library/sysconfig.rst:234 msgid "macosx-10.3-i386" msgstr "" -#: ../../library/sysconfig.rst:233 +#: ../../library/sysconfig.rst:235 msgid "macosx-10.4-fat" msgstr "" -#: ../../library/sysconfig.rst:235 +#: ../../library/sysconfig.rst:237 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: ../../library/sysconfig.rst:240 +#: ../../library/sysconfig.rst:242 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -#: ../../library/sysconfig.rst:247 +#: ../../library/sysconfig.rst:249 msgid "Parse a :file:`config.h`\\-style file." msgstr "" -#: ../../library/sysconfig.rst:249 +#: ../../library/sysconfig.rst:251 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: ../../library/sysconfig.rst:251 +#: ../../library/sysconfig.rst:253 msgid "" "A dictionary containing name/value pairs is returned. If an optional " "dictionary is passed in as the second argument, it is used instead of a new " "dictionary, and updated with the values read in the file." msgstr "" -#: ../../library/sysconfig.rst:258 +#: ../../library/sysconfig.rst:260 msgid "Return the path of :file:`pyconfig.h`." msgstr "" -#: ../../library/sysconfig.rst:262 +#: ../../library/sysconfig.rst:264 msgid "Return the path of :file:`Makefile`." msgstr "" -#: ../../library/sysconfig.rst:266 +#: ../../library/sysconfig.rst:268 msgid "Using :mod:`sysconfig` as a script" msgstr "" -#: ../../library/sysconfig.rst:268 +#: ../../library/sysconfig.rst:270 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:294 +#: ../../library/sysconfig.rst:296 msgid "" "This call will print in the standard output the information returned by :" "func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" diff --git a/library/typing.po b/library/typing.po index 7887333084..06d6ea167d 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-05 00:08+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+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-" @@ -273,8 +273,8 @@ msgid "" "hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``." msgstr "" -#: ../../library/typing.rst:199 ../../library/typing.rst:1010 -#: ../../library/typing.rst:2088 +#: ../../library/typing.rst:199 ../../library/typing.rst:1011 +#: ../../library/typing.rst:2089 msgid "For example::" msgstr "" @@ -285,7 +285,7 @@ msgid "" "arguments in the type hint: ``Callable[..., ReturnType]``." msgstr "" -#: ../../library/typing.rst:214 ../../library/typing.rst:700 +#: ../../library/typing.rst:214 ../../library/typing.rst:701 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -296,7 +296,7 @@ msgid "" "ReturnType]`` respectively." msgstr "" -#: ../../library/typing.rst:222 ../../library/typing.rst:712 +#: ../../library/typing.rst:222 ../../library/typing.rst:713 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more information." @@ -325,68 +325,68 @@ msgid "" "called :class:`TypeVar`." msgstr "" -#: ../../library/typing.rst:261 +#: ../../library/typing.rst:262 msgid "User-defined generic types" msgstr "" -#: ../../library/typing.rst:263 +#: ../../library/typing.rst:264 msgid "A user-defined class can be defined as a generic class." msgstr "" -#: ../../library/typing.rst:289 +#: ../../library/typing.rst:290 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:293 +#: ../../library/typing.rst:294 msgid "" "The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so " "that ``LoggedVar[t]`` is valid as a type::" msgstr "" -#: ../../library/typing.rst:302 +#: ../../library/typing.rst:303 msgid "" "A generic type can have any number of type variables, and type variables may " "be constrained::" msgstr "" -#: ../../library/typing.rst:314 +#: ../../library/typing.rst:315 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr "" -#: ../../library/typing.rst:325 +#: ../../library/typing.rst:326 msgid "You can use multiple inheritance with :class:`Generic`::" msgstr "" -#: ../../library/typing.rst:335 +#: ../../library/typing.rst:336 msgid "" "When inheriting from generic classes, some type variables could be fixed::" msgstr "" -#: ../../library/typing.rst:345 +#: ../../library/typing.rst:346 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "" -#: ../../library/typing.rst:347 +#: ../../library/typing.rst:348 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:355 +#: ../../library/typing.rst:356 msgid "User defined generic type aliases are also supported. Examples::" msgstr "" -#: ../../library/typing.rst:372 +#: ../../library/typing.rst:373 msgid ":class:`Generic` no longer has a custom metaclass." msgstr "" -#: ../../library/typing.rst:375 +#: ../../library/typing.rst:376 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``Generic[P]``. The behavior " @@ -396,7 +396,7 @@ msgid "" "used to substitute a :class:`ParamSpec`::" msgstr "" -#: ../../library/typing.rst:392 +#: ../../library/typing.rst:393 msgid "" "Furthermore, a generic with only one parameter specification variable will " "accept parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also " @@ -404,20 +404,20 @@ msgid "" "converted to the former and are thus equivalent::" msgstr "" -#: ../../library/typing.rst:404 +#: ../../library/typing.rst:405 msgid "" "Do 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:408 +#: ../../library/typing.rst:409 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:412 +#: ../../library/typing.rst:413 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -425,24 +425,24 @@ msgid "" "hashable and comparable for equality." msgstr "" -#: ../../library/typing.rst:419 +#: ../../library/typing.rst:420 msgid "The :data:`Any` type" msgstr "" -#: ../../library/typing.rst:421 +#: ../../library/typing.rst:422 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:425 +#: ../../library/typing.rst:426 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:443 +#: ../../library/typing.rst:444 msgid "" "Notice that no typechecking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -451,19 +451,19 @@ msgid "" "runtime!" msgstr "" -#: ../../library/typing.rst:449 +#: ../../library/typing.rst:450 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -#: ../../library/typing.rst:462 +#: ../../library/typing.rst:463 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:465 +#: ../../library/typing.rst:466 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, " @@ -471,7 +471,7 @@ msgid "" "subtype of every other type." msgstr "" -#: ../../library/typing.rst:470 +#: ../../library/typing.rst:471 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 " @@ -479,24 +479,24 @@ msgid "" "example::" msgstr "" -#: ../../library/typing.rst:492 +#: ../../library/typing.rst:493 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:497 +#: ../../library/typing.rst:498 msgid "Nominal vs structural subtyping" msgstr "" -#: ../../library/typing.rst:499 +#: ../../library/typing.rst:500 msgid "" "Initially :pep:`484` defined 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:503 +#: ../../library/typing.rst:504 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -505,7 +505,7 @@ msgid "" "code. For example, this conforms to :pep:`484`::" msgstr "" -#: ../../library/typing.rst:516 +#: ../../library/typing.rst:517 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 " @@ -514,22 +514,22 @@ msgid "" "subtyping* (or static duck-typing)::" msgstr "" -#: ../../library/typing.rst:532 +#: ../../library/typing.rst:533 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:537 +#: ../../library/typing.rst:538 msgid "Module contents" msgstr "" -#: ../../library/typing.rst:539 +#: ../../library/typing.rst:540 msgid "The module defines the following classes, functions and decorators." msgstr "" -#: ../../library/typing.rst:543 +#: ../../library/typing.rst:544 msgid "" "This module defines several types that are subclasses of pre-existing " "standard library classes which also extend :class:`Generic` to support type " @@ -537,7 +537,7 @@ msgid "" "corresponding pre-existing classes were enhanced to support ``[]``." msgstr "" -#: ../../library/typing.rst:549 +#: ../../library/typing.rst:550 msgid "" "The redundant types are deprecated as of Python 3.9 but no deprecation " "warnings will be issued by the interpreter. It is expected that type " @@ -545,147 +545,147 @@ msgid "" "Python 3.9 or newer." msgstr "" -#: ../../library/typing.rst:554 +#: ../../library/typing.rst:555 msgid "" "The deprecated types will be removed from the :mod:`typing` module in the " "first Python version released 5 years after the release of Python 3.9.0. See " "details in :pep:`585`—*Type Hinting Generics In Standard Collections*." msgstr "" -#: ../../library/typing.rst:560 +#: ../../library/typing.rst:561 msgid "Special typing primitives" msgstr "" -#: ../../library/typing.rst:563 +#: ../../library/typing.rst:564 msgid "Special types" msgstr "" -#: ../../library/typing.rst:565 +#: ../../library/typing.rst:566 msgid "These can be used as types in annotations and do not support ``[]``." msgstr "" -#: ../../library/typing.rst:569 +#: ../../library/typing.rst:570 msgid "Special type indicating an unconstrained type." msgstr "" -#: ../../library/typing.rst:571 +#: ../../library/typing.rst:572 msgid "Every type is compatible with :data:`Any`." msgstr "" -#: ../../library/typing.rst:572 +#: ../../library/typing.rst:573 msgid ":data:`Any` is compatible with every type." msgstr "" -#: ../../library/typing.rst:576 +#: ../../library/typing.rst:577 msgid "Special type indicating that a function never returns. For example::" msgstr "" -#: ../../library/typing.rst:589 +#: ../../library/typing.rst:590 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `. For example::" msgstr "" -#: ../../library/typing.rst:596 +#: ../../library/typing.rst:597 msgid "See :pep:`613` for more details about explicit type aliases." msgstr "" -#: ../../library/typing.rst:601 +#: ../../library/typing.rst:602 msgid "Special forms" msgstr "" -#: ../../library/typing.rst:603 +#: ../../library/typing.rst:604 msgid "" "These can be used as types in annotations using ``[]``, each having a unique " "syntax." msgstr "" -#: ../../library/typing.rst:607 +#: ../../library/typing.rst:608 msgid "" "Tuple type; ``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:611 +#: ../../library/typing.rst:612 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:615 +#: ../../library/typing.rst:616 msgid "" "To specify a variable-length tuple of homogeneous type, use literal " "ellipsis, e.g. ``Tuple[int, ...]``. A plain :data:`Tuple` is equivalent to " "``Tuple[Any, ...]``, and in turn to :class:`tuple`." msgstr "" -#: ../../library/typing.rst:619 +#: ../../library/typing.rst:620 msgid "" ":class:`builtins.tuple ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:625 +#: ../../library/typing.rst:626 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" -#: ../../library/typing.rst:627 +#: ../../library/typing.rst:628 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Details:" msgstr "" -#: ../../library/typing.rst:629 +#: ../../library/typing.rst:630 msgid "The arguments must be types and there must be at least one." msgstr "" -#: ../../library/typing.rst:631 +#: ../../library/typing.rst:632 msgid "Unions of unions are flattened, e.g.::" msgstr "" -#: ../../library/typing.rst:635 +#: ../../library/typing.rst:636 msgid "Unions of a single argument vanish, e.g.::" msgstr "" -#: ../../library/typing.rst:639 +#: ../../library/typing.rst:640 msgid "Redundant arguments are skipped, e.g.::" msgstr "" -#: ../../library/typing.rst:643 +#: ../../library/typing.rst:644 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "" -#: ../../library/typing.rst:647 +#: ../../library/typing.rst:648 msgid "You cannot subclass or instantiate a ``Union``." msgstr "" -#: ../../library/typing.rst:649 +#: ../../library/typing.rst:650 msgid "You cannot write ``Union[X][Y]``." msgstr "" -#: ../../library/typing.rst:651 +#: ../../library/typing.rst:652 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" -#: ../../library/typing.rst:654 +#: ../../library/typing.rst:655 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:660 +#: ../../library/typing.rst:661 msgid "Optional type." msgstr "" -#: ../../library/typing.rst:662 +#: ../../library/typing.rst:663 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "" -#: ../../library/typing.rst:664 +#: ../../library/typing.rst:665 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 " @@ -693,31 +693,31 @@ msgid "" "optional. For example::" msgstr "" -#: ../../library/typing.rst:672 +#: ../../library/typing.rst:673 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:679 +#: ../../library/typing.rst:680 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:685 +#: ../../library/typing.rst:686 msgid "Callable type; ``Callable[[int], str]`` is a function of (int) -> str." msgstr "" -#: ../../library/typing.rst:687 +#: ../../library/typing.rst:688 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 " "types or an ellipsis; the return type must be a single type." msgstr "" -#: ../../library/typing.rst:692 +#: ../../library/typing.rst:693 msgid "" "There is no syntax to indicate optional or keyword arguments; such function " "types are rarely used as callback types. ``Callable[..., ReturnType]`` " @@ -727,19 +727,19 @@ msgid "" "Callable`." msgstr "" -#: ../../library/typing.rst:708 +#: ../../library/typing.rst:709 msgid "" ":class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:717 +#: ../../library/typing.rst:718 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provide " "examples of usage with ``Callable``." msgstr "" -#: ../../library/typing.rst:722 +#: ../../library/typing.rst:723 msgid "" "Used with :data:`Callable` and :class:`ParamSpec` to type annotate a higher " "order callable which adds, removes, or transforms parameters of another " @@ -749,7 +749,7 @@ msgid "" "``Concatenate`` must be a :class:`ParamSpec`." msgstr "" -#: ../../library/typing.rst:729 +#: ../../library/typing.rst:730 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -760,17 +760,17 @@ msgid "" "passed in::" msgstr "" -#: ../../library/typing.rst:769 ../../library/typing.rst:1189 +#: ../../library/typing.rst:770 ../../library/typing.rst:1190 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)." msgstr "" -#: ../../library/typing.rst:771 +#: ../../library/typing.rst:772 msgid ":class:`ParamSpec` and :class:`Callable`." msgstr "" -#: ../../library/typing.rst:776 +#: ../../library/typing.rst:777 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " "contrast, a variable annotated with ``Type[C]`` may accept values that are " @@ -778,11 +778,11 @@ msgid "" "``C``. For example::" msgstr "" -#: ../../library/typing.rst:785 +#: ../../library/typing.rst:786 msgid "Note that ``Type[C]`` is covariant::" msgstr "" -#: ../../library/typing.rst:797 +#: ../../library/typing.rst:798 msgid "" "The fact that ``Type[C]`` is covariant implies that all subclasses of ``C`` " "should implement the same constructor signature and class method signatures " @@ -792,39 +792,39 @@ msgid "" "particular case may change in future revisions of :pep:`484`." msgstr "" -#: ../../library/typing.rst:805 +#: ../../library/typing.rst:806 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:811 +#: ../../library/typing.rst:812 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:816 +#: ../../library/typing.rst:817 msgid "" ":class:`builtins.type ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:822 +#: ../../library/typing.rst:823 msgid "" "A type that can be used to indicate to type checkers that the corresponding " "variable or function parameter has a value equivalent to the provided " "literal (or one of several literals). For example::" msgstr "" -#: ../../library/typing.rst:836 +#: ../../library/typing.rst:837 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:842 +#: ../../library/typing.rst:843 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -832,22 +832,22 @@ msgid "" "their parameters are not :term:`hashable`." msgstr "" -#: ../../library/typing.rst:850 +#: ../../library/typing.rst:851 msgid "Special type construct to mark class variables." msgstr "" -#: ../../library/typing.rst:852 +#: ../../library/typing.rst:853 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:860 +#: ../../library/typing.rst:861 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr "" -#: ../../library/typing.rst:862 +#: ../../library/typing.rst:863 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 " @@ -855,19 +855,19 @@ msgid "" "example, a type checker might flag the following code as an error::" msgstr "" -#: ../../library/typing.rst:876 +#: ../../library/typing.rst:877 msgid "" "A special typing construct to indicate to type checkers that a name cannot " "be re-assigned or overridden in a subclass. For example::" msgstr "" -#: ../../library/typing.rst:888 ../../library/typing.rst:1983 +#: ../../library/typing.rst:889 ../../library/typing.rst:1984 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -#: ../../library/typing.rst:895 +#: ../../library/typing.rst:896 msgid "" "A type, introduced in :pep:`593` (``Flexible function and variable " "annotations``), to decorate existing types with context-specific metadata " @@ -884,7 +884,7 @@ msgid "" "``x`` within a specific application." msgstr "" -#: ../../library/typing.rst:909 +#: ../../library/typing.rst:910 msgid "" "Ultimately, the responsibility of how to interpret the annotations (if at " "all) is the responsibility of the tool or library encountering the " @@ -893,21 +893,21 @@ msgid "" "using ``isinstance()``)." msgstr "" -#: ../../library/typing.rst:915 +#: ../../library/typing.rst:916 msgid "" "When a tool or a library does not support annotations or encounters an " "unknown annotation it should just ignore it and treat annotated type as the " "underlying type." msgstr "" -#: ../../library/typing.rst:919 +#: ../../library/typing.rst:920 msgid "" "It's up to the tool consuming the annotations to decide whether the client " "is allowed to have several annotations on one type and how to merge those " "annotations." msgstr "" -#: ../../library/typing.rst:923 +#: ../../library/typing.rst:924 msgid "" "Since the ``Annotated`` type allows you to put several annotations of the " "same (or different) type(s) on any node, the tools or libraries consuming " @@ -915,59 +915,59 @@ msgid "" "example, if you are doing value range analysis you might allow this::" msgstr "" -#: ../../library/typing.rst:932 +#: ../../library/typing.rst:933 msgid "" "Passing ``include_extras=True`` to :func:`get_type_hints` lets one access " "the extra annotations at runtime." msgstr "" -#: ../../library/typing.rst:935 +#: ../../library/typing.rst:936 msgid "The details of the syntax:" msgstr "" -#: ../../library/typing.rst:937 +#: ../../library/typing.rst:938 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:939 +#: ../../library/typing.rst:940 msgid "" "Multiple type annotations are supported (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:944 +#: ../../library/typing.rst:945 msgid "" "``Annotated`` must be called with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:947 +#: ../../library/typing.rst:948 msgid "" "The order of the annotations is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:954 +#: ../../library/typing.rst:955 msgid "" "Nested ``Annotated`` types are flattened, with metadata ordered starting " "with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:961 +#: ../../library/typing.rst:962 msgid "Duplicated annotations are not removed::" msgstr "" -#: ../../library/typing.rst:967 +#: ../../library/typing.rst:968 msgid "``Annotated`` can be used with nested and generic aliases::" msgstr "" -#: ../../library/typing.rst:980 +#: ../../library/typing.rst:981 msgid "" "Special typing form 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:984 +#: ../../library/typing.rst:985 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 " @@ -976,44 +976,44 @@ msgid "" "conditional expression here is sometimes referred to as a \"type guard\"::" msgstr "" -#: ../../library/typing.rst:999 +#: ../../library/typing.rst:1000 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:1003 +#: ../../library/typing.rst:1004 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1006 +#: ../../library/typing.rst:1007 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1007 +#: ../../library/typing.rst:1008 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1024 +#: ../../library/typing.rst:1025 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:1028 +#: ../../library/typing.rst:1029 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:1034 +#: ../../library/typing.rst:1035 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]`` " @@ -1022,47 +1022,47 @@ msgid "" "guards is left to the user." msgstr "" -#: ../../library/typing.rst:1040 +#: ../../library/typing.rst:1041 msgid "" "``TypeGuard`` also works with type variables. For more information, see :" "pep:`647` (User-Defined Type Guards)." msgstr "" -#: ../../library/typing.rst:1047 +#: ../../library/typing.rst:1048 msgid "Building generic types" msgstr "" -#: ../../library/typing.rst:1049 +#: ../../library/typing.rst:1050 msgid "" "These are not used in annotations. They are building blocks for creating " "generic types." msgstr "" -#: ../../library/typing.rst:1053 +#: ../../library/typing.rst:1054 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1055 +#: ../../library/typing.rst:1056 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:1064 +#: ../../library/typing.rst:1065 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1077 +#: ../../library/typing.rst:1078 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1079 ../../library/typing.rst:1118 -#: ../../library/typing.rst:1295 +#: ../../library/typing.rst:1080 ../../library/typing.rst:1119 +#: ../../library/typing.rst:1296 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:1084 +#: ../../library/typing.rst:1085 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 " @@ -1070,7 +1070,7 @@ msgid "" "types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1097 +#: ../../library/typing.rst:1098 msgid "" "The latter example's signature is essentially the overloading of ``(str, " "str) -> str`` and ``(bytes, bytes) -> bytes``. Also note that if the " @@ -1078,13 +1078,13 @@ msgid "" "still plain :class:`str`." msgstr "" -#: ../../library/typing.rst:1102 +#: ../../library/typing.rst:1103 msgid "" "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`. In general, :" "func:`isinstance` and :func:`issubclass` should not be used with types." msgstr "" -#: ../../library/typing.rst:1105 +#: ../../library/typing.rst:1106 msgid "" "Type variables may be marked covariant or contravariant by passing " "``covariant=True`` or ``contravariant=True``. See :pep:`484` for more " @@ -1094,13 +1094,13 @@ msgid "" "must be a subclass of the boundary type, see :pep:`484`." msgstr "" -#: ../../library/typing.rst:1115 +#: ../../library/typing.rst:1116 msgid "" "Parameter specification variable. A specialized version of :class:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1122 +#: ../../library/typing.rst:1123 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1110,7 +1110,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1129 +#: ../../library/typing.rst:1130 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 " @@ -1118,27 +1118,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1153 +#: ../../library/typing.rst:1154 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:1157 +#: ../../library/typing.rst:1158 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:1159 +#: ../../library/typing.rst:1160 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:1166 +#: ../../library/typing.rst:1167 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1151,7 +1151,7 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1176 +#: ../../library/typing.rst:1177 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1160,17 +1160,17 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1185 +#: ../../library/typing.rst:1186 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1191 +#: ../../library/typing.rst:1192 msgid ":class:`Callable` and :class:`Concatenate`." msgstr "" -#: ../../library/typing.rst:1196 +#: ../../library/typing.rst:1197 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1178,36 +1178,36 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1201 +#: ../../library/typing.rst:1202 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``::" msgstr "" -#: ../../library/typing.rst:1213 +#: ../../library/typing.rst:1214 msgid "" "``AnyStr`` is a type variable defined as ``AnyStr = TypeVar('AnyStr', str, " "bytes)``." msgstr "" -#: ../../library/typing.rst:1216 +#: ../../library/typing.rst:1217 msgid "" "It is meant to be used for functions that may accept any kind of string " "without allowing different kinds of strings to mix. For example::" msgstr "" -#: ../../library/typing.rst:1228 +#: ../../library/typing.rst:1229 msgid "" "Base class for protocol classes. Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:1234 +#: ../../library/typing.rst:1235 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:1246 +#: ../../library/typing.rst:1247 msgid "" "See :pep:`544` for details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -1215,15 +1215,15 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:1251 +#: ../../library/typing.rst:1252 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:1261 +#: ../../library/typing.rst:1262 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:1263 +#: ../../library/typing.rst:1264 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 " @@ -1232,7 +1232,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/typing.rst:1276 +#: ../../library/typing.rst:1277 msgid "" ":func:`runtime_checkable` will check only the presence of the required " "methods, not their type signatures. For example, :class:`ssl.SSLObject` is a " @@ -1242,35 +1242,35 @@ msgid "" "making it impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:1287 +#: ../../library/typing.rst:1288 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1289 +#: ../../library/typing.rst:1290 msgid "" "These are not used in annotations. They are building blocks for declaring " "types." msgstr "" -#: ../../library/typing.rst:1293 +#: ../../library/typing.rst:1294 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1301 +#: ../../library/typing.rst:1302 msgid "This is equivalent to::" msgstr "" -#: ../../library/typing.rst:1305 +#: ../../library/typing.rst:1306 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1314 +#: ../../library/typing.rst:1315 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1316 +#: ../../library/typing.rst:1317 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 " @@ -1278,52 +1278,52 @@ msgid "" "attribute both of which are part of the namedtuple API.)" msgstr "" -#: ../../library/typing.rst:1322 +#: ../../library/typing.rst:1323 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:1332 +#: ../../library/typing.rst:1333 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:1336 +#: ../../library/typing.rst:1337 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:1339 +#: ../../library/typing.rst:1340 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:1342 +#: ../../library/typing.rst:1343 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:1346 +#: ../../library/typing.rst:1347 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:1352 +#: ../../library/typing.rst:1353 msgid "" "A helper class to indicate a distinct type to a typechecker, see :ref:" "`distinct`. At runtime it returns an object that returns its argument when " "called. Usage::" msgstr "" -#: ../../library/typing.rst:1362 +#: ../../library/typing.rst:1363 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:1367 +#: ../../library/typing.rst:1368 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:1370 +#: ../../library/typing.rst:1371 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 " @@ -1331,7 +1331,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:1386 +#: ../../library/typing.rst:1387 msgid "" "The type info for introspection can be accessed via ``Point2D." "__annotations__``, ``Point2D.__total__``, ``Point2D.__required_keys__``, and " @@ -1340,13 +1340,13 @@ msgid "" "two additional equivalent syntactic forms::" msgstr "" -#: ../../library/typing.rst:1396 +#: ../../library/typing.rst:1397 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "override this by specifying totality. Usage::" msgstr "" -#: ../../library/typing.rst:1404 +#: ../../library/typing.rst:1405 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 " @@ -1354,152 +1354,152 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:1409 +#: ../../library/typing.rst:1410 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:1414 +#: ../../library/typing.rst:1415 msgid "Generic concrete collections" msgstr "" -#: ../../library/typing.rst:1417 +#: ../../library/typing.rst:1418 msgid "Corresponding to built-in types" msgstr "" -#: ../../library/typing.rst:1421 +#: ../../library/typing.rst:1422 msgid "" "A generic version of :class:`dict`. Useful for annotating return types. To " "annotate arguments it is preferred to use an abstract collection type such " "as :class:`Mapping`." msgstr "" -#: ../../library/typing.rst:1425 +#: ../../library/typing.rst:1426 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1431 msgid "" ":class:`builtins.dict ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1436 +#: ../../library/typing.rst:1437 msgid "" "Generic version of :class:`list`. Useful for annotating return types. To " "annotate arguments it is preferred to use an abstract collection type such " "as :class:`Sequence` or :class:`Iterable`." msgstr "" -#: ../../library/typing.rst:1441 +#: ../../library/typing.rst:1442 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:1451 +#: ../../library/typing.rst:1452 msgid "" ":class:`builtins.list ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1457 +#: ../../library/typing.rst:1458 msgid "" "A generic version of :class:`builtins.set `. Useful for annotating " "return types. To annotate arguments it is preferred to use an abstract " "collection type such as :class:`AbstractSet`." msgstr "" -#: ../../library/typing.rst:1461 +#: ../../library/typing.rst:1462 msgid "" ":class:`builtins.set ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1467 +#: ../../library/typing.rst:1468 msgid "A generic version of :class:`builtins.frozenset `." msgstr "" -#: ../../library/typing.rst:1469 +#: ../../library/typing.rst:1470 msgid "" ":class:`builtins.frozenset ` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1474 msgid ":data:`Tuple` is a special form." msgstr "" -#: ../../library/typing.rst:1476 +#: ../../library/typing.rst:1477 msgid "Corresponding to types in :mod:`collections`" msgstr "" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1481 msgid "A generic version of :class:`collections.defaultdict`." msgstr "" -#: ../../library/typing.rst:1484 +#: ../../library/typing.rst:1485 msgid "" ":class:`collections.defaultdict` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1491 msgid "A generic version of :class:`collections.OrderedDict`." msgstr "" -#: ../../library/typing.rst:1494 +#: ../../library/typing.rst:1495 msgid "" ":class:`collections.OrderedDict` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1500 +#: ../../library/typing.rst:1501 msgid "A generic version of :class:`collections.ChainMap`." msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1506 msgid "" ":class:`collections.ChainMap` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1511 +#: ../../library/typing.rst:1512 msgid "A generic version of :class:`collections.Counter`." msgstr "" -#: ../../library/typing.rst:1516 +#: ../../library/typing.rst:1517 msgid "" ":class:`collections.Counter` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1522 +#: ../../library/typing.rst:1523 msgid "A generic version of :class:`collections.deque`." msgstr "" -#: ../../library/typing.rst:1527 +#: ../../library/typing.rst:1528 msgid "" ":class:`collections.deque` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1532 +#: ../../library/typing.rst:1533 msgid "Other concrete types" msgstr "" -#: ../../library/typing.rst:1538 +#: ../../library/typing.rst:1539 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:1545 +#: ../../library/typing.rst:1546 msgid "" "The ``typing.io`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:1550 +#: ../../library/typing.rst:1551 msgid "" "These type aliases correspond to the return types from :func:`re.compile` " "and :func:`re.match`. These types (and the corresponding functions) are " @@ -1507,413 +1507,413 @@ msgid "" "``Pattern[bytes]``, ``Match[str]``, or ``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:1560 +#: ../../library/typing.rst:1561 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:1561 +#: ../../library/typing.rst:1562 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1567 +#: ../../library/typing.rst:1568 msgid "" "``Text`` is an alias for ``str``. It 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:1571 +#: ../../library/typing.rst:1572 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:1580 +#: ../../library/typing.rst:1581 msgid "Abstract Base Classes" msgstr "" -#: ../../library/typing.rst:1583 +#: ../../library/typing.rst:1584 msgid "Corresponding to collections in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:1587 +#: ../../library/typing.rst:1588 msgid "A generic version of :class:`collections.abc.Set`." msgstr "" -#: ../../library/typing.rst:1589 +#: ../../library/typing.rst:1590 msgid "" ":class:`collections.abc.Set` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1595 +#: ../../library/typing.rst:1596 msgid "A generic version of :class:`collections.abc.ByteString`." msgstr "" -#: ../../library/typing.rst:1597 +#: ../../library/typing.rst:1598 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:1600 +#: ../../library/typing.rst:1601 msgid "" "As a shorthand for this type, :class:`bytes` can be used to annotate " "arguments of any of the types mentioned above." msgstr "" -#: ../../library/typing.rst:1603 +#: ../../library/typing.rst:1604 msgid "" ":class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1609 +#: ../../library/typing.rst:1610 msgid "A generic version of :class:`collections.abc.Collection`" msgstr "" -#: ../../library/typing.rst:1613 +#: ../../library/typing.rst:1614 msgid "" ":class:`collections.abc.Collection` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1619 +#: ../../library/typing.rst:1620 msgid "A generic version of :class:`collections.abc.Container`." msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1622 msgid "" ":class:`collections.abc.Container` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1628 msgid "A generic version of :class:`collections.abc.ItemsView`." msgstr "" -#: ../../library/typing.rst:1629 +#: ../../library/typing.rst:1630 msgid "" ":class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1635 +#: ../../library/typing.rst:1636 msgid "A generic version of :class:`collections.abc.KeysView`." msgstr "" -#: ../../library/typing.rst:1637 +#: ../../library/typing.rst:1638 msgid "" ":class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1643 +#: ../../library/typing.rst:1644 msgid "" "A generic version of :class:`collections.abc.Mapping`. This type can be used " "as follows::" msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1650 msgid "" ":class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1655 +#: ../../library/typing.rst:1656 msgid "A generic version of :class:`collections.abc.MappingView`." msgstr "" -#: ../../library/typing.rst:1657 +#: ../../library/typing.rst:1658 msgid "" ":class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1663 +#: ../../library/typing.rst:1664 msgid "A generic version of :class:`collections.abc.MutableMapping`." msgstr "" -#: ../../library/typing.rst:1665 +#: ../../library/typing.rst:1666 msgid "" ":class:`collections.abc.MutableMapping` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1671 +#: ../../library/typing.rst:1672 msgid "A generic version of :class:`collections.abc.MutableSequence`." msgstr "" -#: ../../library/typing.rst:1673 +#: ../../library/typing.rst:1674 msgid "" ":class:`collections.abc.MutableSequence` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1680 msgid "A generic version of :class:`collections.abc.MutableSet`." msgstr "" -#: ../../library/typing.rst:1681 +#: ../../library/typing.rst:1682 msgid "" ":class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1688 msgid "A generic version of :class:`collections.abc.Sequence`." msgstr "" -#: ../../library/typing.rst:1689 +#: ../../library/typing.rst:1690 msgid "" ":class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1695 +#: ../../library/typing.rst:1696 msgid "A generic version of :class:`collections.abc.ValuesView`." msgstr "" -#: ../../library/typing.rst:1697 +#: ../../library/typing.rst:1698 msgid "" ":class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1703 msgid "Corresponding to other types in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:1706 +#: ../../library/typing.rst:1707 msgid "A generic version of :class:`collections.abc.Iterable`." msgstr "" -#: ../../library/typing.rst:1708 +#: ../../library/typing.rst:1709 msgid "" ":class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1714 +#: ../../library/typing.rst:1715 msgid "A generic version of :class:`collections.abc.Iterator`." msgstr "" -#: ../../library/typing.rst:1716 +#: ../../library/typing.rst:1717 msgid "" ":class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1722 +#: ../../library/typing.rst:1723 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:1731 +#: ../../library/typing.rst:1732 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:1735 +#: ../../library/typing.rst:1736 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:1743 +#: ../../library/typing.rst:1744 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:1751 +#: ../../library/typing.rst:1752 msgid "" ":class:`collections.abc.Generator` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1757 +#: ../../library/typing.rst:1758 msgid "An alias to :class:`collections.abc.Hashable`" msgstr "" -#: ../../library/typing.rst:1761 +#: ../../library/typing.rst:1762 msgid "A generic version of :class:`collections.abc.Reversible`." msgstr "" -#: ../../library/typing.rst:1763 +#: ../../library/typing.rst:1764 msgid "" ":class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1770 msgid "An alias to :class:`collections.abc.Sized`" msgstr "" -#: ../../library/typing.rst:1772 +#: ../../library/typing.rst:1773 msgid "Asynchronous programming" msgstr "" -#: ../../library/typing.rst:1776 +#: ../../library/typing.rst:1777 msgid "" "A generic version of :class:`collections.abc.Coroutine`. The variance and " "order of type variables correspond to those of :class:`Generator`, for " "example::" msgstr "" -#: ../../library/typing.rst:1789 +#: ../../library/typing.rst:1790 msgid "" ":class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1796 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:1804 +#: ../../library/typing.rst:1805 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:1808 +#: ../../library/typing.rst:1809 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:1816 +#: ../../library/typing.rst:1817 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:1826 +#: ../../library/typing.rst:1827 msgid "" ":class:`collections.abc.AsyncGenerator` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1832 +#: ../../library/typing.rst:1833 msgid "A generic version of :class:`collections.abc.AsyncIterable`." msgstr "" -#: ../../library/typing.rst:1836 +#: ../../library/typing.rst:1837 msgid "" ":class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1842 +#: ../../library/typing.rst:1843 msgid "A generic version of :class:`collections.abc.AsyncIterator`." msgstr "" -#: ../../library/typing.rst:1846 +#: ../../library/typing.rst:1847 msgid "" ":class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1852 +#: ../../library/typing.rst:1853 msgid "A generic version of :class:`collections.abc.Awaitable`." msgstr "" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:1857 msgid "" ":class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1862 +#: ../../library/typing.rst:1863 msgid "Context manager types" msgstr "" -#: ../../library/typing.rst:1866 +#: ../../library/typing.rst:1867 msgid "A generic version of :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:1871 +#: ../../library/typing.rst:1872 msgid "" ":class:`contextlib.AbstractContextManager` now supports ``[]``. See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1877 +#: ../../library/typing.rst:1878 msgid "A generic version of :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:1882 +#: ../../library/typing.rst:1883 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1887 +#: ../../library/typing.rst:1888 msgid "Protocols" msgstr "" -#: ../../library/typing.rst:1889 +#: ../../library/typing.rst:1890 msgid "These protocols are decorated with :func:`runtime_checkable`." msgstr "" -#: ../../library/typing.rst:1893 +#: ../../library/typing.rst:1894 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:1898 +#: ../../library/typing.rst:1899 msgid "An ABC with one abstract method ``__bytes__``." msgstr "" -#: ../../library/typing.rst:1902 +#: ../../library/typing.rst:1903 msgid "An ABC with one abstract method ``__complex__``." msgstr "" -#: ../../library/typing.rst:1906 +#: ../../library/typing.rst:1907 msgid "An ABC with one abstract method ``__float__``." msgstr "" -#: ../../library/typing.rst:1910 +#: ../../library/typing.rst:1911 msgid "An ABC with one abstract method ``__index__``." msgstr "" -#: ../../library/typing.rst:1916 +#: ../../library/typing.rst:1917 msgid "An ABC with one abstract method ``__int__``." msgstr "" -#: ../../library/typing.rst:1920 +#: ../../library/typing.rst:1921 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:1924 +#: ../../library/typing.rst:1925 msgid "Functions and decorators" msgstr "" -#: ../../library/typing.rst:1928 +#: ../../library/typing.rst:1929 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:1930 +#: ../../library/typing.rst:1931 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:1937 +#: ../../library/typing.rst:1938 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -1928,69 +1928,69 @@ msgid "" "variable::" msgstr "" -#: ../../library/typing.rst:1961 +#: ../../library/typing.rst:1962 msgid "See :pep:`484` for details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:1965 +#: ../../library/typing.rst:1966 msgid "" "A decorator to indicate to type checkers that the decorated method cannot be " "overridden, and the decorated class cannot be subclassed. For example::" msgstr "" -#: ../../library/typing.rst:1990 +#: ../../library/typing.rst:1991 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:1992 +#: ../../library/typing.rst:1993 msgid "" "This works as class or function :term:`decorator`. With a class, it applies " "recursively to all methods defined in that class (but not to methods defined " "in its superclasses or subclasses)." msgstr "" -#: ../../library/typing.rst:1996 +#: ../../library/typing.rst:1997 msgid "This mutates the function(s) in place." msgstr "" -#: ../../library/typing.rst:2000 +#: ../../library/typing.rst:2001 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2002 +#: ../../library/typing.rst:2003 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2007 +#: ../../library/typing.rst:2008 msgid "Decorator to mark a class or function to be unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2009 +#: ../../library/typing.rst:2010 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:2020 +#: ../../library/typing.rst:2021 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2024 +#: ../../library/typing.rst:2025 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2028 +#: ../../library/typing.rst:2029 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2031 +#: ../../library/typing.rst:2032 msgid "" "This is often the same as ``obj.__annotations__``. In addition, forward " "references encoded as string literals are handled by evaluating them in " @@ -2000,29 +2000,29 @@ msgid "" "merging all the ``__annotations__`` along ``C.__mro__`` in reverse order." msgstr "" -#: ../../library/typing.rst:2039 +#: ../../library/typing.rst:2040 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:2054 +#: ../../library/typing.rst:2055 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:2059 +#: ../../library/typing.rst:2060 msgid "Added ``include_extras`` parameter as part of :pep:`593`." msgstr "" -#: ../../library/typing.rst:2065 +#: ../../library/typing.rst:2066 msgid "Provide basic introspection for generic types and special typing forms." msgstr "" -#: ../../library/typing.rst:2067 +#: ../../library/typing.rst:2068 msgid "" "For a typing object of the form ``X[Y, Z, ...]`` these functions return " "``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or :mod:" @@ -2033,11 +2033,11 @@ msgid "" "and ``()`` correspondingly. Examples::" msgstr "" -#: ../../library/typing.rst:2086 +#: ../../library/typing.rst:2087 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2101 +#: ../../library/typing.rst:2102 msgid "" "A class used for internal typing representation of string forward " "references. For example, ``List[\"SomeClass\"]`` is implicitly transformed " @@ -2045,24 +2045,24 @@ msgid "" "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:2107 +#: ../../library/typing.rst:2108 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:2114 +#: ../../library/typing.rst:2115 msgid "Constant" msgstr "" -#: ../../library/typing.rst:2118 +#: ../../library/typing.rst:2119 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime. Usage::" msgstr "" -#: ../../library/typing.rst:2127 +#: ../../library/typing.rst:2128 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2070,7 +2070,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2134 +#: ../../library/typing.rst:2135 msgid "" "If ``from __future__ import annotations`` is used in Python 3.7 or later, " "annotations are not evaluated at function definition time. Instead, they are " diff --git a/library/unittest.po b/library/unittest.po index b940addaf2..5f4c1bcb17 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+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-" @@ -380,7 +380,7 @@ msgstr "在第一次錯誤或是失敗停止執行測試。" msgid "" "Only run test methods and classes that match the pattern or substring. This " "option may be used multiple times, in which case all test cases that match " -"of the given patterns are included." +"any of the given patterns are included." msgstr "" #: ../../library/unittest.rst:228 diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index f85f70b61c..90185fb0be 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -349,8 +349,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:421 msgid "" -"The context expression (the expression given in the :token:`with_item`) is " -"evaluated to obtain a context manager." +"The context expression (the expression given in the :token:`~python-grammar:" +"with_item`) is evaluated to obtain a context manager." msgstr "" #: ../../reference/compound_stmts.rst:424 @@ -408,14 +408,14 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:457 -#: ../../reference/compound_stmts.rst:1446 -#: ../../reference/compound_stmts.rst:1487 +#: ../../reference/compound_stmts.rst:1447 +#: ../../reference/compound_stmts.rst:1488 msgid "The following code::" msgstr "" #: ../../reference/compound_stmts.rst:462 #: ../../reference/compound_stmts.rst:487 -#: ../../reference/compound_stmts.rst:1492 +#: ../../reference/compound_stmts.rst:1493 msgid "is semantically equivalent to::" msgstr "" @@ -488,12 +488,12 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:555 -#: ../../reference/compound_stmts.rst:1109 +#: ../../reference/compound_stmts.rst:1110 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" #: ../../reference/compound_stmts.rst:556 -#: ../../reference/compound_stmts.rst:1110 +#: ../../reference/compound_stmts.rst:1111 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" @@ -784,16 +784,17 @@ msgstr "" #: ../../reference/compound_stmts.rst:799 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " -"expresses). It is instead treated as a :token:`wildcard_pattern`." +"expresses). It is instead treated as a :token:`~python-grammar:" +"wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:802 +#: ../../reference/compound_stmts.rst:803 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: ../../reference/compound_stmts.rst:805 +#: ../../reference/compound_stmts.rst:806 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -801,55 +802,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:810 +#: ../../reference/compound_stmts.rst:811 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "``." msgstr "" -#: ../../reference/compound_stmts.rst:815 +#: ../../reference/compound_stmts.rst:816 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:817 +#: ../../reference/compound_stmts.rst:818 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:823 +#: ../../reference/compound_stmts.rst:824 msgid "" "``_`` is a :ref:`soft keyword ` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: ../../reference/compound_stmts.rst:827 +#: ../../reference/compound_stmts.rst:828 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:832 +#: ../../reference/compound_stmts.rst:833 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:834 +#: ../../reference/compound_stmts.rst:835 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:842 +#: ../../reference/compound_stmts.rst:843 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules `. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: ../../reference/compound_stmts.rst:847 +#: ../../reference/compound_stmts.rst:848 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if `` == NAME1." "NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:851 +#: ../../reference/compound_stmts.rst:852 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -857,44 +858,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:859 +#: ../../reference/compound_stmts.rst:860 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:861 +#: ../../reference/compound_stmts.rst:862 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:868 +#: ../../reference/compound_stmts.rst:869 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:873 +#: ../../reference/compound_stmts.rst:874 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:875 +#: ../../reference/compound_stmts.rst:876 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: ../../reference/compound_stmts.rst:886 +#: ../../reference/compound_stmts.rst:887 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:890 +#: ../../reference/compound_stmts.rst:891 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern `. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:895 +#: ../../reference/compound_stmts.rst:896 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -902,40 +903,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:900 +#: ../../reference/compound_stmts.rst:901 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:903 +#: ../../reference/compound_stmts.rst:904 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:906 +#: ../../reference/compound_stmts.rst:907 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:909 +#: ../../reference/compound_stmts.rst:910 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:912 +#: ../../reference/compound_stmts.rst:913 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:914 +#: ../../reference/compound_stmts.rst:915 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: ../../reference/compound_stmts.rst:917 +#: ../../reference/compound_stmts.rst:918 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -943,118 +944,118 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:922 +#: ../../reference/compound_stmts.rst:923 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:924 +#: ../../reference/compound_stmts.rst:925 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:927 +#: ../../reference/compound_stmts.rst:928 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:930 +#: ../../reference/compound_stmts.rst:931 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: ../../reference/compound_stmts.rst:934 +#: ../../reference/compound_stmts.rst:935 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:937 +#: ../../reference/compound_stmts.rst:938 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " "the :meth:`__len__` protocol). This length may be cached by the interpreter " "in a similar manner as :ref:`value patterns `." msgstr "" -#: ../../reference/compound_stmts.rst:943 +#: ../../reference/compound_stmts.rst:944 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:946 +#: ../../reference/compound_stmts.rst:947 msgid "check ```` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:947 +#: ../../reference/compound_stmts.rst:948 msgid "``len(subject) == ``" msgstr "" -#: ../../reference/compound_stmts.rst:948 +#: ../../reference/compound_stmts.rst:949 msgid "" "``P1`` matches ``[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:949 +#: ../../reference/compound_stmts.rst:950 msgid "" "``P2`` matches ``[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:950 +#: ../../reference/compound_stmts.rst:951 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:955 +#: ../../reference/compound_stmts.rst:956 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:957 +#: ../../reference/compound_stmts.rst:958 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:968 +#: ../../reference/compound_stmts.rst:969 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: ../../reference/compound_stmts.rst:971 +#: ../../reference/compound_stmts.rst:972 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:975 +#: ../../reference/compound_stmts.rst:976 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:978 +#: ../../reference/compound_stmts.rst:979 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:980 +#: ../../reference/compound_stmts.rst:981 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:984 +#: ../../reference/compound_stmts.rst:985 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: ../../reference/compound_stmts.rst:988 +#: ../../reference/compound_stmts.rst:989 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " @@ -1062,210 +1063,210 @@ msgid "" "`__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:993 +#: ../../reference/compound_stmts.rst:994 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:996 +#: ../../reference/compound_stmts.rst:997 msgid "check ```` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:997 +#: ../../reference/compound_stmts.rst:998 msgid "``KEY1 in ``" msgstr "" -#: ../../reference/compound_stmts.rst:998 +#: ../../reference/compound_stmts.rst:999 msgid "``P1`` matches ``[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:999 +#: ../../reference/compound_stmts.rst:1000 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1005 +#: ../../reference/compound_stmts.rst:1006 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1007 +#: ../../reference/compound_stmts.rst:1008 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1018 +#: ../../reference/compound_stmts.rst:1019 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1020 +#: ../../reference/compound_stmts.rst:1021 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1023 +#: ../../reference/compound_stmts.rst:1024 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1026 +#: ../../reference/compound_stmts.rst:1027 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested via :" "func:`isinstance`), the class pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1029 +#: ../../reference/compound_stmts.rst:1030 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: ../../reference/compound_stmts.rst:1033 +#: ../../reference/compound_stmts.rst:1034 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: ../../reference/compound_stmts.rst:1037 +#: ../../reference/compound_stmts.rst:1038 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1040 +#: ../../reference/compound_stmts.rst:1041 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1042 +#: ../../reference/compound_stmts.rst:1043 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1045 +#: ../../reference/compound_stmts.rst:1046 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1047 +#: ../../reference/compound_stmts.rst:1048 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: ../../reference/compound_stmts.rst:1052 +#: ../../reference/compound_stmts.rst:1053 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1054 +#: ../../reference/compound_stmts.rst:1055 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: ../../reference/compound_stmts.rst:1058 +#: ../../reference/compound_stmts.rst:1059 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1060 +#: ../../reference/compound_stmts.rst:1061 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1062 +#: ../../reference/compound_stmts.rst:1063 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1065 +#: ../../reference/compound_stmts.rst:1066 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1068 +#: ../../reference/compound_stmts.rst:1069 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1072 +#: ../../reference/compound_stmts.rst:1073 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1074 +#: ../../reference/compound_stmts.rst:1075 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1077 +#: ../../reference/compound_stmts.rst:1078 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1077 +#: ../../reference/compound_stmts.rst:1078 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1079 +#: ../../reference/compound_stmts.rst:1080 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1082 +#: ../../reference/compound_stmts.rst:1083 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1083 +#: ../../reference/compound_stmts.rst:1084 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1084 +#: ../../reference/compound_stmts.rst:1085 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1085 +#: ../../reference/compound_stmts.rst:1086 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1086 +#: ../../reference/compound_stmts.rst:1087 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1087 +#: ../../reference/compound_stmts.rst:1088 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1088 +#: ../../reference/compound_stmts.rst:1089 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1089 -#: ../../reference/compound_stmts.rst:1540 +#: ../../reference/compound_stmts.rst:1090 +#: ../../reference/compound_stmts.rst:1541 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1090 +#: ../../reference/compound_stmts.rst:1091 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1091 +#: ../../reference/compound_stmts.rst:1092 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1092 -#: ../../reference/compound_stmts.rst:1543 +#: ../../reference/compound_stmts.rst:1093 +#: ../../reference/compound_stmts.rst:1544 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1094 +#: ../../reference/compound_stmts.rst:1095 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " @@ -1273,46 +1274,46 @@ msgid "" "``False``." msgstr "" -#: ../../reference/compound_stmts.rst:1098 +#: ../../reference/compound_stmts.rst:1099 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1100 +#: ../../reference/compound_stmts.rst:1101 msgid "``isinstance(, CLS)``" msgstr "``isinstance(, CLS)``" -#: ../../reference/compound_stmts.rst:1101 +#: ../../reference/compound_stmts.rst:1102 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1103 +#: ../../reference/compound_stmts.rst:1104 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1103 +#: ../../reference/compound_stmts.rst:1104 msgid "``hasattr(, \"attr\")``" msgstr "``hasattr(, \"attr\")``" -#: ../../reference/compound_stmts.rst:1104 +#: ../../reference/compound_stmts.rst:1105 msgid "``P2`` matches ``.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1105 +#: ../../reference/compound_stmts.rst:1106 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1120 +#: ../../reference/compound_stmts.rst:1121 msgid "Function definitions" msgstr "" -#: ../../reference/compound_stmts.rst:1135 +#: ../../reference/compound_stmts.rst:1136 msgid "" "A function definition defines a user-defined function object (see section :" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1154 +#: ../../reference/compound_stmts.rst:1155 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1321,13 +1322,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1161 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1166 +#: ../../reference/compound_stmts.rst:1167 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1338,25 +1339,25 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1177 -#: ../../reference/compound_stmts.rst:1354 +#: ../../reference/compound_stmts.rst:1178 +#: ../../reference/compound_stmts.rst:1355 msgid "is roughly equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1182 +#: ../../reference/compound_stmts.rst:1183 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1184 +#: ../../reference/compound_stmts.rst:1185 msgid "" -"Functions may be decorated with any valid :token:`assignment_expression`. " -"Previously, the grammar was much more restrictive; see :pep:`614` for " -"details." +"Functions may be decorated with any valid :token:`~python-grammar:" +"assignment_expression`. Previously, the grammar was much more restrictive; " +"see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1194 +#: ../../reference/compound_stmts.rst:1195 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1367,7 +1368,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1202 +#: ../../reference/compound_stmts.rst:1203 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1380,7 +1381,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1223 +#: ../../reference/compound_stmts.rst:1224 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1396,13 +1397,13 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1235 +#: ../../reference/compound_stmts.rst:1236 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1244 +#: ../../reference/compound_stmts.rst:1245 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1419,7 +1420,7 @@ msgid "" "different order than they appear in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1259 +#: ../../reference/compound_stmts.rst:1260 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1431,7 +1432,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1267 +#: ../../reference/compound_stmts.rst:1268 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1440,51 +1441,51 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1276 +#: ../../reference/compound_stmts.rst:1277 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1276 +#: ../../reference/compound_stmts.rst:1277 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1279 +#: ../../reference/compound_stmts.rst:1280 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1279 +#: ../../reference/compound_stmts.rst:1280 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1283 +#: ../../reference/compound_stmts.rst:1284 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1282 +#: ../../reference/compound_stmts.rst:1283 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables" msgstr "" -#: ../../reference/compound_stmts.rst:1286 +#: ../../reference/compound_stmts.rst:1287 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1286 +#: ../../reference/compound_stmts.rst:1287 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1293 +#: ../../reference/compound_stmts.rst:1294 msgid "Class definitions" msgstr "" -#: ../../reference/compound_stmts.rst:1308 +#: ../../reference/compound_stmts.rst:1309 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1315 +#: ../../reference/compound_stmts.rst:1316 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1493,11 +1494,11 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1324 +#: ../../reference/compound_stmts.rst:1325 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1329 +#: ../../reference/compound_stmts.rst:1330 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1509,7 +1510,7 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1338 +#: ../../reference/compound_stmts.rst:1339 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's ``__dict__``. Note that this is reliable only right after " @@ -1517,30 +1518,30 @@ msgid "" "definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1343 +#: ../../reference/compound_stmts.rst:1344 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: ../../reference/compound_stmts.rst:1348 +#: ../../reference/compound_stmts.rst:1349 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1359 +#: ../../reference/compound_stmts.rst:1360 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1362 +#: ../../reference/compound_stmts.rst:1363 msgid "" -"Classes may be decorated with any valid :token:`assignment_expression`. " -"Previously, the grammar was much more restrictive; see :pep:`614` for " -"details." +"Classes may be decorated with any valid :token:`~python-grammar:" +"assignment_expression`. Previously, the grammar was much more restrictive; " +"see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1368 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1553,35 +1554,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1382 +#: ../../reference/compound_stmts.rst:1383 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1385 +#: ../../reference/compound_stmts.rst:1386 msgid ":pep:`3129` - Class Decorators" msgstr "" -#: ../../reference/compound_stmts.rst:1385 +#: ../../reference/compound_stmts.rst:1386 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1392 +#: ../../reference/compound_stmts.rst:1393 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1400 +#: ../../reference/compound_stmts.rst:1401 msgid "Coroutine function definition" msgstr "" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1411 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1589,181 +1590,181 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1414 +#: ../../reference/compound_stmts.rst:1415 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1417 +#: ../../reference/compound_stmts.rst:1418 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1420 +#: ../../reference/compound_stmts.rst:1421 msgid "An example of a coroutine function::" msgstr "" -#: ../../reference/compound_stmts.rst:1426 +#: ../../reference/compound_stmts.rst:1427 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1435 msgid "The :keyword:`!async for` statement" msgstr "" -#: ../../reference/compound_stmts.rst:1439 +#: ../../reference/compound_stmts.rst:1440 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1443 +#: ../../reference/compound_stmts.rst:1444 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1453 +#: ../../reference/compound_stmts.rst:1454 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1469 +#: ../../reference/compound_stmts.rst:1470 msgid "See also :meth:`__aiter__` and :meth:`__anext__` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1471 +#: ../../reference/compound_stmts.rst:1472 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1479 +#: ../../reference/compound_stmts.rst:1480 msgid "The :keyword:`!async with` statement" msgstr "" -#: ../../reference/compound_stmts.rst:1484 +#: ../../reference/compound_stmts.rst:1485 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1511 +#: ../../reference/compound_stmts.rst:1512 msgid "See also :meth:`__aenter__` and :meth:`__aexit__` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1513 +#: ../../reference/compound_stmts.rst:1514 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1519 +#: ../../reference/compound_stmts.rst:1520 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1519 +#: ../../reference/compound_stmts.rst:1520 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1524 +#: ../../reference/compound_stmts.rst:1525 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1525 +#: ../../reference/compound_stmts.rst:1526 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1529 +#: ../../reference/compound_stmts.rst:1530 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1532 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1532 +#: ../../reference/compound_stmts.rst:1533 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1533 +#: ../../reference/compound_stmts.rst:1534 msgid "" "a builtin class that has its (CPython) :data:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1534 -#: ../../reference/compound_stmts.rst:1553 +#: ../../reference/compound_stmts.rst:1535 +#: ../../reference/compound_stmts.rst:1554 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1536 +#: ../../reference/compound_stmts.rst:1537 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1538 +#: ../../reference/compound_stmts.rst:1539 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1539 +#: ../../reference/compound_stmts.rst:1540 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1541 +#: ../../reference/compound_stmts.rst:1542 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1542 +#: ../../reference/compound_stmts.rst:1543 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1545 +#: ../../reference/compound_stmts.rst:1546 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1548 +#: ../../reference/compound_stmts.rst:1549 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1550 +#: ../../reference/compound_stmts.rst:1551 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1551 +#: ../../reference/compound_stmts.rst:1552 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1552 +#: ../../reference/compound_stmts.rst:1553 msgid "" "a builtin class that has its (CPython) :data:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1555 +#: ../../reference/compound_stmts.rst:1556 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1558 +#: ../../reference/compound_stmts.rst:1559 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's ``__doc__`` attribute and therefore the " "function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1562 +#: ../../reference/compound_stmts.rst:1563 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's ``__doc__`` item and therefore the class's :" diff --git a/reference/datamodel.po b/reference/datamodel.po index e263849ac3..f7b7539b21 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-29 00:08+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2407,7 +2407,7 @@ msgid "" "such case the original base is ignored." msgstr "" -#: ../../reference/datamodel.rst:2008 ../../reference/datamodel.rst:2198 +#: ../../reference/datamodel.rst:2008 msgid ":pep:`560` - Core support for typing module and generic types" msgstr "" @@ -2649,40 +2649,152 @@ msgstr "" #: ../../reference/datamodel.rst:2183 msgid "" -"One can implement the generic class syntax as specified by :pep:`484` (for " -"example ``List[int]``) by defining a special method:" +"When using :term:`type annotations`, it is often useful to " +"*parameterize* a :term:`generic type` using Python's square-brackets " +"notation. For example, the annotation ``list[int]`` might be used to signify " +"a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2188 +#: ../../reference/datamodel.rst:2191 +msgid ":pep:`484` - Type Hints" +msgstr "" + +#: ../../reference/datamodel.rst:2191 +msgid "Introducing Python's framework for type annotations" +msgstr "" + +#: ../../reference/datamodel.rst:2194 +msgid ":ref:`Generic Alias Types`" +msgstr "" + +#: ../../reference/datamodel.rst:2194 +msgid "Documentation for objects representing parameterized generic classes" +msgstr "" + +#: ../../reference/datamodel.rst:2197 +msgid "" +":ref:`Generics`, :ref:`user-defined generics` and :" +"class:`typing.Generic`" +msgstr "" + +#: ../../reference/datamodel.rst:2197 +msgid "" +"Documentation on how to implement generic classes that can be parameterized " +"at runtime and understood by static type-checkers." +msgstr "" + +#: ../../reference/datamodel.rst:2200 +msgid "" +"A class can *generally* only be parameterized if it defines the special " +"class method ``__class_getitem__()``." +msgstr "" + +#: ../../reference/datamodel.rst:2205 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2191 +#: ../../reference/datamodel.rst:2208 +msgid "" +"When defined on a class, ``__class_getitem__()`` is automatically a class " +"method. As such, there is no need for it to be decorated with :func:" +"`@classmethod` when it is defined." +msgstr "" + +#: ../../reference/datamodel.rst:2214 +msgid "The purpose of *__class_getitem__*" +msgstr "" + +#: ../../reference/datamodel.rst:2216 msgid "" -"This method is looked up on the class object itself, and when defined in the " -"class body, this method is implicitly a class method. Note, this mechanism " -"is primarily reserved for use with static type hints, other usage is " -"discouraged." +"The purpose of :meth:`~object.__class_getitem__` is to allow runtime " +"parameterization of standard-library generic classes in order to more easily " +"apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2204 +#: ../../reference/datamodel.rst:2220 +msgid "" +"To implement custom generic classes that can be parameterized at runtime and " +"understood by static type-checkers, users should either inherit from a " +"standard library class that already implements :meth:`~object." +"__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " +"own implementation of ``__class_getitem__()``." +msgstr "" + +#: ../../reference/datamodel.rst:2226 +msgid "" +"Custom implementations of :meth:`~object.__class_getitem__` on classes " +"defined outside of the standard library may not be understood by third-party " +"type-checkers such as mypy. Using ``__class_getitem__()`` on any class for " +"purposes other than type hinting is discouraged." +msgstr "" + +#: ../../reference/datamodel.rst:2236 +msgid "*__class_getitem__* versus *__getitem__*" +msgstr "" + +#: ../../reference/datamodel.rst:2238 +msgid "" +"Usually, the :ref:`subscription` of an object using square " +"brackets will call the :meth:`~object.__getitem__` instance method defined " +"on the object's class. However, if the object being subscribed is itself a " +"class, the class method :meth:`~object.__class_getitem__` may be called " +"instead. ``__class_getitem__()`` should return a :ref:`GenericAlias` object if it is properly defined." +msgstr "" + +#: ../../reference/datamodel.rst:2245 +msgid "" +"Presented with the :term:`expression` ``obj[x]``, the Python interpreter " +"follows something like the following process to decide whether :meth:" +"`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" +msgstr "" + +#: ../../reference/datamodel.rst:2273 +msgid "" +"In Python, all classes are themselves instances of other classes. The class " +"of a class is known as that class's :term:`metaclass`, and most classes have " +"the :class:`type` class as their metaclass. :class:`type` does not define :" +"meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``, " +"``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." +"__class_getitem__` being called::" +msgstr "" + +#: ../../reference/datamodel.rst:2292 +msgid "" +"However, if a class has a custom metaclass that defines :meth:`~object." +"__getitem__`, subscribing the class may result in different behaviour. An " +"example of this can be found in the :mod:`enum` module::" +msgstr "" + +#: ../../reference/datamodel.rst:2317 +msgid ":pep:`560` - Core Support for typing module and generic types" +msgstr "" + +#: ../../reference/datamodel.rst:2316 +msgid "" +"Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" +"`subscription` results in ``__class_getitem__()`` being " +"called instead of :meth:`~object.__getitem__`" +msgstr "" + +#: ../../reference/datamodel.rst:2324 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2211 +#: ../../reference/datamodel.rst:2331 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2218 +#: ../../reference/datamodel.rst:2338 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2220 +#: ../../reference/datamodel.rst:2340 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are sequences (such as lists or tuples) or mappings (like " @@ -2715,7 +2827,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2255 +#: ../../reference/datamodel.rst:2375 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -2723,7 +2835,7 @@ msgid "" "zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2262 +#: ../../reference/datamodel.rst:2382 msgid "" "In CPython, the length is required to be at most :attr:`sys.maxsize`. If the " "length is larger than :attr:`!sys.maxsize` some features (such as :func:" @@ -2732,7 +2844,7 @@ msgid "" "`__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2271 +#: ../../reference/datamodel.rst:2391 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -2742,38 +2854,46 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2285 +#: ../../reference/datamodel.rst:2405 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2289 +#: ../../reference/datamodel.rst:2409 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2293 +#: ../../reference/datamodel.rst:2413 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2298 +#: ../../reference/datamodel.rst:2418 msgid "" -"Called to implement evaluation of ``self[key]``. For sequence types, the " -"accepted keys should be integers and slice objects. Note that the special " -"interpretation of negative indexes (if the class wishes to emulate a " -"sequence type) is up to the :meth:`__getitem__` method. If *key* is of an " -"inappropriate type, :exc:`TypeError` may be raised; if of a value outside " -"the set of indexes for the sequence (after any special interpretation of " -"negative values), :exc:`IndexError` should be raised. For mapping types, if " -"*key* is missing (not in the container), :exc:`KeyError` should be raised." +"Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " +"the accepted keys should be integers and slice objects. Note that the " +"special interpretation of negative indexes (if the class wishes to emulate " +"a :term:`sequence` type) is up to the :meth:`__getitem__` method. If *key* " +"is of an inappropriate type, :exc:`TypeError` may be raised; if of a value " +"outside the set of indexes for the sequence (after any special " +"interpretation of negative values), :exc:`IndexError` should be raised. For :" +"term:`mapping` types, if *key* is missing (not in the container), :exc:" +"`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2309 +#: ../../reference/datamodel.rst:2430 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2315 +#: ../../reference/datamodel.rst:2435 +msgid "" +"When :ref:`subscripting` a *class*, the special class method :" +"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " +"See :ref:`classgetitem-versus-getitem` for more details." +msgstr "" + +#: ../../reference/datamodel.rst:2443 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -2782,7 +2902,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2324 +#: ../../reference/datamodel.rst:2452 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -2791,13 +2911,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2333 +#: ../../reference/datamodel.rst:2461 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2339 +#: ../../reference/datamodel.rst:2467 msgid "" "This method is called when an iterator is required for a container. This " "method should return a new iterator object that can iterate over all the " @@ -2805,21 +2925,21 @@ msgid "" "the container." msgstr "" -#: ../../reference/datamodel.rst:2343 +#: ../../reference/datamodel.rst:2471 msgid "" "Iterator objects also need to implement this method; they are required to " "return themselves. For more information on iterator objects, see :ref:" "`typeiter`." msgstr "" -#: ../../reference/datamodel.rst:2349 +#: ../../reference/datamodel.rst:2477 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2353 +#: ../../reference/datamodel.rst:2481 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -2828,7 +2948,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2488 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -2836,14 +2956,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2367 +#: ../../reference/datamodel.rst:2495 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2371 +#: ../../reference/datamodel.rst:2499 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -2851,11 +2971,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:2380 +#: ../../reference/datamodel.rst:2508 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2382 +#: ../../reference/datamodel.rst:2510 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -2863,7 +2983,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2408 +#: ../../reference/datamodel.rst:2536 msgid "" "These methods are called to implement the binary arithmetic operations (``" "+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:`pow`, " @@ -2876,13 +2996,13 @@ msgid "" "version of the built-in :func:`pow` function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2419 +#: ../../reference/datamodel.rst:2547 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return ``NotImplemented``." msgstr "" -#: ../../reference/datamodel.rst:2442 +#: ../../reference/datamodel.rst:2570 msgid "" "These methods are called to implement the binary arithmetic operations (``" "+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:`pow`, " @@ -2894,13 +3014,13 @@ msgid "" "__rsub__(x)`` is called if ``x.__sub__(y)`` returns *NotImplemented*." msgstr "" -#: ../../reference/datamodel.rst:2453 +#: ../../reference/datamodel.rst:2581 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:2458 +#: ../../reference/datamodel.rst:2586 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -2909,7 +3029,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:2479 +#: ../../reference/datamodel.rst:2607 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -2925,19 +3045,19 @@ msgid "" "fact part of the data model." msgstr "" -#: ../../reference/datamodel.rst:2500 +#: ../../reference/datamodel.rst:2628 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:2513 +#: ../../reference/datamodel.rst:2641 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:2520 +#: ../../reference/datamodel.rst:2648 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -2946,14 +3066,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2654 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:2538 +#: ../../reference/datamodel.rst:2666 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -2962,17 +3082,17 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:2544 +#: ../../reference/datamodel.rst:2672 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:2551 +#: ../../reference/datamodel.rst:2679 msgid "With Statement Context Managers" msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2681 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -2982,32 +3102,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:2564 +#: ../../reference/datamodel.rst:2692 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2695 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:2572 +#: ../../reference/datamodel.rst:2700 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2707 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:2583 +#: ../../reference/datamodel.rst:2711 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3015,27 +3135,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:2587 +#: ../../reference/datamodel.rst:2715 msgid "" "Note that :meth:`__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:2594 +#: ../../reference/datamodel.rst:2722 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/datamodel.rst:2594 +#: ../../reference/datamodel.rst:2722 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:2601 +#: ../../reference/datamodel.rst:2729 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:2603 +#: ../../reference/datamodel.rst:2731 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3043,7 +3163,7 @@ msgid "" "patterns, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:2610 +#: ../../reference/datamodel.rst:2738 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3052,7 +3172,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:2616 +#: ../../reference/datamodel.rst:2744 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3062,19 +3182,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2626 +#: ../../reference/datamodel.rst:2754 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:2627 +#: ../../reference/datamodel.rst:2755 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:2633 +#: ../../reference/datamodel.rst:2761 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:2635 +#: ../../reference/datamodel.rst:2763 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3082,7 +3202,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:2650 +#: ../../reference/datamodel.rst:2778 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`__hash__` and :meth:`__repr__` that are implemented by all " @@ -3091,21 +3211,21 @@ msgid "" "type object itself::" msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2791 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:2672 +#: ../../reference/datamodel.rst:2800 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:2698 +#: ../../reference/datamodel.rst:2826 msgid "" "Bypassing the :meth:`__getattribute__` machinery in this fashion provides " "significant scope for speed optimisations within the interpreter, at the " @@ -3114,44 +3234,44 @@ msgid "" "invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:2709 +#: ../../reference/datamodel.rst:2837 msgid "Coroutines" msgstr "" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2841 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:2715 +#: ../../reference/datamodel.rst:2843 msgid "" "An :term:`awaitable` object generally implements an :meth:`__await__` " "method. :term:`Coroutine objects ` returned from :keyword:`async " "def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:2721 +#: ../../reference/datamodel.rst:2849 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` or :func:`asyncio.coroutine` are also " "awaitable, but they do not implement :meth:`__await__`." msgstr "" -#: ../../reference/datamodel.rst:2727 +#: ../../reference/datamodel.rst:2855 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:2733 +#: ../../reference/datamodel.rst:2861 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:2739 +#: ../../reference/datamodel.rst:2867 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:2741 +#: ../../reference/datamodel.rst:2869 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`__await__` and " @@ -3162,18 +3282,18 @@ msgid "" "not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:2749 +#: ../../reference/datamodel.rst:2877 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:2753 +#: ../../reference/datamodel.rst:2881 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:2759 +#: ../../reference/datamodel.rst:2887 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`__await__`. If " @@ -3183,7 +3303,7 @@ msgid "" "as when iterating over the :meth:`__await__` return value, described above." msgstr "" -#: ../../reference/datamodel.rst:2769 +#: ../../reference/datamodel.rst:2897 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -3194,7 +3314,7 @@ msgid "" "caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:2780 +#: ../../reference/datamodel.rst:2908 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3204,97 +3324,97 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:2788 +#: ../../reference/datamodel.rst:2916 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:2794 +#: ../../reference/datamodel.rst:2922 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:2796 +#: ../../reference/datamodel.rst:2924 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:2799 +#: ../../reference/datamodel.rst:2927 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:2803 +#: ../../reference/datamodel.rst:2931 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:2807 +#: ../../reference/datamodel.rst:2935 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:2810 +#: ../../reference/datamodel.rst:2938 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:2827 +#: ../../reference/datamodel.rst:2955 msgid "" "Prior to Python 3.7, ``__aiter__`` could return an *awaitable* that would " "resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:2832 +#: ../../reference/datamodel.rst:2960 msgid "" "Starting with Python 3.7, ``__aiter__`` must return an asynchronous iterator " "object. Returning anything else will result in a :exc:`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:2840 +#: ../../reference/datamodel.rst:2968 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:2842 +#: ../../reference/datamodel.rst:2970 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2973 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:2849 +#: ../../reference/datamodel.rst:2977 msgid "" "Semantically similar to :meth:`__enter__`, the only difference being that it " "must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:2982 msgid "" "Semantically similar to :meth:`__exit__`, the only difference being that it " "must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:2857 +#: ../../reference/datamodel.rst:2985 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:2870 +#: ../../reference/datamodel.rst:2998 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:2871 +#: ../../reference/datamodel.rst:2999 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:2875 +#: ../../reference/datamodel.rst:3003 msgid "" "The :meth:`__hash__`, :meth:`__iter__`, :meth:`__reversed__`, and :meth:" "`__contains__` methods have special handling for this; others will still " @@ -3302,7 +3422,7 @@ msgid "" "``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:2880 +#: ../../reference/datamodel.rst:3008 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns ``NotImplemented``. Do not set the method to ``None`` if you " @@ -3310,7 +3430,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:2886 +#: ../../reference/datamodel.rst:3014 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`__add__` -- fails then the overall operation is not " diff --git a/reference/expressions.po b/reference/expressions.po index 6504bfa5f3..da9c95c684 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -462,23 +462,23 @@ msgstr "" msgid "" "When a generator function is called, it returns an iterator known as a " "generator. That generator then controls the execution of the generator " -"function. The execution starts when one of the generator's methods is " -"called. At that time, the execution proceeds to the first yield expression, " -"where it is suspended again, returning the value of :token:`expression_list` " -"to the generator's caller. By suspended, we mean that all local state is " -"retained, including the current bindings of local variables, the instruction " -"pointer, the internal evaluation stack, and the state of any exception " -"handling. When the execution is resumed by calling one of the generator's " -"methods, the function can proceed exactly as if the yield expression were " -"just another external call. The value of the yield expression after " -"resuming depends on the method which resumed the execution. If :meth:" -"`~generator.__next__` is used (typically via either a :keyword:`for` or the :" -"func:`next` builtin) then the result is :const:`None`. Otherwise, if :meth:" -"`~generator.send` is used, then the result will be the value passed in to " -"that method." -msgstr "" - -#: ../../reference/expressions.rst:466 +"function. The execution starts when one of the generator's methods is " +"called. At that time, the execution proceeds to the first yield expression, " +"where it is suspended again, returning the value of :token:`~python-grammar:" +"expression_list` to the generator's caller. By suspended, we mean that all " +"local state is retained, including the current bindings of local variables, " +"the instruction pointer, the internal evaluation stack, and the state of any " +"exception handling. When the execution is resumed by calling one of the " +"generator's methods, the function can proceed exactly as if the yield " +"expression were just another external call. The value of the yield " +"expression after resuming depends on the method which resumed the " +"execution. If :meth:`~generator.__next__` is used (typically via either a :" +"keyword:`for` or the :func:`next` builtin) then the result is :const:" +"`None`. Otherwise, if :meth:`~generator.send` is used, then the result will " +"be the value passed in to that method." +msgstr "" + +#: ../../reference/expressions.rst:465 msgid "" "All of this makes generator functions quite similar to coroutines; they " "yield multiple times, they have more than one entry point and their " @@ -487,7 +487,7 @@ msgid "" "the control is always transferred to the generator's caller." msgstr "" -#: ../../reference/expressions.rst:472 +#: ../../reference/expressions.rst:471 msgid "" "Yield expressions are allowed anywhere in a :keyword:`try` construct. If " "the generator is not resumed before it is finalized (by reaching a zero " @@ -496,7 +496,7 @@ msgid "" "`finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:481 +#: ../../reference/expressions.rst:480 msgid "" "When ``yield from `` is used, the supplied expression must be an " "iterable. The values produced by iterating that iterable are passed directly " @@ -508,7 +508,7 @@ msgid "" "will just raise the passed in exception immediately." msgstr "" -#: ../../reference/expressions.rst:490 +#: ../../reference/expressions.rst:489 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " @@ -517,91 +517,91 @@ msgid "" "returning a value from the subgenerator)." msgstr "" -#: ../../reference/expressions.rst:496 +#: ../../reference/expressions.rst:495 msgid "Added ``yield from `` to delegate control flow to a subiterator." msgstr "" -#: ../../reference/expressions.rst:499 +#: ../../reference/expressions.rst:498 msgid "" "The parentheses may be omitted when the yield expression is the sole " "expression on the right hand side of an assignment statement." msgstr "" -#: ../../reference/expressions.rst:505 +#: ../../reference/expressions.rst:504 msgid ":pep:`255` - Simple Generators" msgstr "" -#: ../../reference/expressions.rst:505 +#: ../../reference/expressions.rst:504 msgid "" "The proposal for adding generators and the :keyword:`yield` statement to " "Python." msgstr "" -#: ../../reference/expressions.rst:509 +#: ../../reference/expressions.rst:508 msgid ":pep:`342` - Coroutines via Enhanced Generators" msgstr "" -#: ../../reference/expressions.rst:508 +#: ../../reference/expressions.rst:507 msgid "" "The proposal to enhance the API and syntax of generators, making them usable " "as simple coroutines." msgstr "" -#: ../../reference/expressions.rst:513 +#: ../../reference/expressions.rst:512 msgid ":pep:`380` - Syntax for Delegating to a Subgenerator" msgstr "" -#: ../../reference/expressions.rst:512 +#: ../../reference/expressions.rst:511 msgid "" -"The proposal to introduce the :token:`yield_from` syntax, making delegation " -"to subgenerators easy." +"The proposal to introduce the :token:`~python-grammar:yield_from` syntax, " +"making delegation to subgenerators easy." msgstr "" -#: ../../reference/expressions.rst:516 +#: ../../reference/expressions.rst:515 msgid ":pep:`525` - Asynchronous Generators" msgstr "" -#: ../../reference/expressions.rst:516 +#: ../../reference/expressions.rst:515 msgid "" "The proposal that expanded on :pep:`492` by adding generator capabilities to " "coroutine functions." msgstr "" -#: ../../reference/expressions.rst:523 +#: ../../reference/expressions.rst:522 msgid "Generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:525 +#: ../../reference/expressions.rst:524 msgid "" "This subsection describes the methods of a generator iterator. They can be " "used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:528 +#: ../../reference/expressions.rst:527 msgid "" "Note that calling any of the generator methods below when the generator is " "already executing raises a :exc:`ValueError` exception." msgstr "" -#: ../../reference/expressions.rst:536 +#: ../../reference/expressions.rst:535 msgid "" "Starts the execution of a generator function or resumes it at the last " "executed yield expression. When a generator function is resumed with a :" "meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " "expression, where the generator is suspended again, and the value of the :" -"token:`expression_list` is returned to :meth:`__next__`'s caller. If the " -"generator exits without yielding another value, a :exc:`StopIteration` " -"exception is raised." +"token:`~python-grammar:expression_list` is returned to :meth:`__next__`'s " +"caller. If the generator exits without yielding another value, a :exc:" +"`StopIteration` exception is raised." msgstr "" -#: ../../reference/expressions.rst:545 +#: ../../reference/expressions.rst:544 msgid "" "This method is normally called implicitly, e.g. by a :keyword:`for` loop, or " "by the built-in :func:`next` function." msgstr "" -#: ../../reference/expressions.rst:551 +#: ../../reference/expressions.rst:550 msgid "" "Resumes the execution and \"sends\" a value into the generator function. " "The *value* argument becomes the result of the current yield expression. " @@ -612,7 +612,7 @@ msgid "" "expression that could receive the value." msgstr "" -#: ../../reference/expressions.rst:562 +#: ../../reference/expressions.rst:561 msgid "" "Raises an exception of type ``type`` at the point where the generator was " "paused, and returns the next value yielded by the generator function. If " @@ -622,7 +622,7 @@ msgid "" "to the caller." msgstr "" -#: ../../reference/expressions.rst:573 +#: ../../reference/expressions.rst:572 msgid "" "Raises a :exc:`GeneratorExit` at the point where the generator function was " "paused. If the generator function then exits gracefully, is already closed, " @@ -633,34 +633,34 @@ msgid "" "has already exited due to an exception or normal exit." msgstr "" -#: ../../reference/expressions.rst:584 +#: ../../reference/expressions.rst:583 msgid "Examples" msgstr "" -#: ../../reference/expressions.rst:586 +#: ../../reference/expressions.rst:585 msgid "" "Here is a simple example that demonstrates the behavior of generators and " "generator functions::" msgstr "" -#: ../../reference/expressions.rst:613 +#: ../../reference/expressions.rst:612 msgid "" "For examples using ``yield from``, see :ref:`pep-380` in \"What's New in " "Python.\"" msgstr "" -#: ../../reference/expressions.rst:619 +#: ../../reference/expressions.rst:618 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/expressions.rst:621 +#: ../../reference/expressions.rst:620 msgid "" "The presence of a yield expression in a function or method defined using :" "keyword:`async def` further defines the function as an :term:`asynchronous " "generator` function." msgstr "" -#: ../../reference/expressions.rst:625 +#: ../../reference/expressions.rst:624 msgid "" "When an asynchronous generator function is called, it returns an " "asynchronous iterator known as an asynchronous generator object. That object " @@ -670,25 +670,26 @@ msgid "" "keyword:`for` statement." msgstr "" -#: ../../reference/expressions.rst:632 +#: ../../reference/expressions.rst:631 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " "At that time, the execution proceeds to the first yield expression, where it " -"is suspended again, returning the value of :token:`expression_list` to the " -"awaiting coroutine. As with a generator, suspension means that all local " -"state is retained, including the current bindings of local variables, the " -"instruction pointer, the internal evaluation stack, and the state of any " -"exception handling. When the execution is resumed by awaiting on the next " -"object returned by the asynchronous generator's methods, the function can " -"proceed exactly as if the yield expression were just another external call. " -"The value of the yield expression after resuming depends on the method which " -"resumed the execution. If :meth:`~agen.__anext__` is used then the result " -"is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, then the result " -"will be the value passed in to that method." +"is suspended again, returning the value of :token:`~python-grammar:" +"expression_list` to the awaiting coroutine. As with a generator, suspension " +"means that all local state is retained, including the current bindings of " +"local variables, the instruction pointer, the internal evaluation stack, and " +"the state of any exception handling. When the execution is resumed by " +"awaiting on the next object returned by the asynchronous generator's " +"methods, the function can proceed exactly as if the yield expression were " +"just another external call. The value of the yield expression after resuming " +"depends on the method which resumed the execution. If :meth:`~agen." +"__anext__` is used then the result is :const:`None`. Otherwise, if :meth:" +"`~agen.asend` is used, then the result will be the value passed in to that " +"method." msgstr "" -#: ../../reference/expressions.rst:648 +#: ../../reference/expressions.rst:646 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -700,7 +701,7 @@ msgid "" "generator and ultimately detach it from the event loop." msgstr "" -#: ../../reference/expressions.rst:658 +#: ../../reference/expressions.rst:656 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -714,7 +715,7 @@ msgid "" "finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:669 +#: ../../reference/expressions.rst:667 msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" @@ -727,42 +728,43 @@ msgid "" "asyncio/base_events.py`." msgstr "" -#: ../../reference/expressions.rst:678 +#: ../../reference/expressions.rst:676 msgid "" "The expression ``yield from `` is a syntax error when used in an " "asynchronous generator function." msgstr "" -#: ../../reference/expressions.rst:685 +#: ../../reference/expressions.rst:683 msgid "Asynchronous generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:687 +#: ../../reference/expressions.rst:685 msgid "" "This subsection describes the methods of an asynchronous generator iterator, " "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:695 +#: ../../reference/expressions.rst:693 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " "asynchronous generator function is resumed with an :meth:`~agen.__anext__` " "method, the current yield expression always evaluates to :const:`None` in " "the returned awaitable, which when run will continue to the next yield " -"expression. The value of the :token:`expression_list` of the yield " -"expression is the value of the :exc:`StopIteration` exception raised by the " -"completing coroutine. If the asynchronous generator exits without yielding " -"another value, the awaitable instead raises a :exc:`StopAsyncIteration` " -"exception, signalling that the asynchronous iteration has completed." +"expression. The value of the :token:`~python-grammar:expression_list` of the " +"yield expression is the value of the :exc:`StopIteration` exception raised " +"by the completing coroutine. If the asynchronous generator exits without " +"yielding another value, the awaitable instead raises a :exc:" +"`StopAsyncIteration` exception, signalling that the asynchronous iteration " +"has completed." msgstr "" -#: ../../reference/expressions.rst:707 +#: ../../reference/expressions.rst:705 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:712 +#: ../../reference/expressions.rst:710 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send()` method for a " @@ -777,7 +779,7 @@ msgid "" "receive the value." msgstr "" -#: ../../reference/expressions.rst:727 +#: ../../reference/expressions.rst:725 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " @@ -789,7 +791,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:742 +#: ../../reference/expressions.rst:740 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -805,25 +807,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:758 +#: ../../reference/expressions.rst:756 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:762 +#: ../../reference/expressions.rst:760 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:772 +#: ../../reference/expressions.rst:770 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:778 +#: ../../reference/expressions.rst:776 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:788 +#: ../../reference/expressions.rst:786 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -834,30 +836,30 @@ msgid "" "evaluations of the same attribute reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:800 +#: ../../reference/expressions.rst:798 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:815 +#: ../../reference/expressions.rst:813 msgid "" "Subscription of a sequence (string, tuple or list) or mapping (dictionary) " "object usually selects an item from the collection:" msgstr "" -#: ../../reference/expressions.rst:821 +#: ../../reference/expressions.rst:819 msgid "" "The primary must evaluate to an object that supports subscription (lists or " "dictionaries for example). User-defined objects can support subscription by " "defining a :meth:`__getitem__` method." msgstr "" -#: ../../reference/expressions.rst:825 +#: ../../reference/expressions.rst:823 msgid "" "For built-in objects, there are two types of objects that support " "subscription:" msgstr "" -#: ../../reference/expressions.rst:827 +#: ../../reference/expressions.rst:825 msgid "" "If the primary is a mapping, the expression list must evaluate to an object " "whose value is one of the keys of the mapping, and the subscription selects " @@ -865,13 +867,13 @@ msgid "" "is a tuple except if it has exactly one item.)" msgstr "" -#: ../../reference/expressions.rst:832 +#: ../../reference/expressions.rst:830 msgid "" "If the primary is a sequence, the expression list must evaluate to an " "integer or a slice (as discussed in the following section)." msgstr "" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:833 msgid "" "The formal syntax makes no special provision for negative indices in " "sequences; however, built-in sequences all provide a :meth:`__getitem__` " @@ -884,13 +886,13 @@ msgid "" "overriding this method will need to explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:849 +#: ../../reference/expressions.rst:847 msgid "" "A string's items are characters. A character is not a separate data type " "but a string of exactly one character." msgstr "" -#: ../../reference/expressions.rst:852 +#: ../../reference/expressions.rst:850 msgid "" "Subscription of certain :term:`classes ` or :term:`types ` " "creates a :ref:`generic alias `. In this case, user-" @@ -898,18 +900,18 @@ msgid "" "`__class_getitem__` classmethod." msgstr "" -#: ../../reference/expressions.rst:861 +#: ../../reference/expressions.rst:859 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:875 +#: ../../reference/expressions.rst:873 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:888 +#: ../../reference/expressions.rst:886 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -919,7 +921,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:900 +#: ../../reference/expressions.rst:898 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`__getitem__` method as normal subscription) with a key that " @@ -934,23 +936,23 @@ msgid "" "expressions." msgstr "" -#: ../../reference/expressions.rst:924 +#: ../../reference/expressions.rst:922 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:926 +#: ../../reference/expressions.rst:924 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: ../../reference/expressions.rst:943 +#: ../../reference/expressions.rst:941 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:949 +#: ../../reference/expressions.rst:947 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -960,7 +962,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:955 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -982,7 +984,7 @@ msgid "" "call." msgstr "" -#: ../../reference/expressions.rst:977 +#: ../../reference/expressions.rst:975 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -991,7 +993,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:981 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1000,7 +1002,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:989 +#: ../../reference/expressions.rst:987 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1010,7 +1012,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1000 +#: ../../reference/expressions.rst:998 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1020,20 +1022,20 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1007 +#: ../../reference/expressions.rst:1005 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1023 +#: ../../reference/expressions.rst:1021 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not arise." msgstr "" -#: ../../reference/expressions.rst:1029 +#: ../../reference/expressions.rst:1027 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1042,35 +1044,35 @@ msgid "" "exception is raised." msgstr "" -#: ../../reference/expressions.rst:1035 +#: ../../reference/expressions.rst:1033 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1038 +#: ../../reference/expressions.rst:1036 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1044 +#: ../../reference/expressions.rst:1042 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1048 +#: ../../reference/expressions.rst:1046 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1061 +#: ../../reference/expressions.rst:1059 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1057 +#: ../../reference/expressions.rst:1055 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1079,73 +1081,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1075 +#: ../../reference/expressions.rst:1073 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1074 +#: ../../reference/expressions.rst:1072 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1082 +#: ../../reference/expressions.rst:1080 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1082 +#: ../../reference/expressions.rst:1080 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1092 +#: ../../reference/expressions.rst:1090 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1090 +#: ../../reference/expressions.rst:1088 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1101 +#: ../../reference/expressions.rst:1099 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1099 +#: ../../reference/expressions.rst:1097 msgid "" "The class must define a :meth:`__call__` method; the effect is then the same " "as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1107 ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:1105 ../../reference/expressions.rst:1871 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1109 +#: ../../reference/expressions.rst:1107 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1121 +#: ../../reference/expressions.rst:1119 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1127 +#: ../../reference/expressions.rst:1125 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1133 +#: ../../reference/expressions.rst:1131 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1137 +#: ../../reference/expressions.rst:1135 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1153,7 +1155,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1142 +#: ../../reference/expressions.rst:1140 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1161,40 +1163,40 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1147 +#: ../../reference/expressions.rst:1145 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1149 msgid "" "This operation can be customized using the special :meth:`__pow__` method." msgstr "" -#: ../../reference/expressions.rst:1156 +#: ../../reference/expressions.rst:1154 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1160 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1173 +#: ../../reference/expressions.rst:1171 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`__neg__` special " "method." msgstr "" -#: ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1179 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1186 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1202,17 +1204,17 @@ msgid "" "meth:`__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1197 +#: ../../reference/expressions.rst:1195 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1204 +#: ../../reference/expressions.rst:1202 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1206 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1220,7 +1222,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1223 +#: ../../reference/expressions.rst:1221 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1230,19 +1232,19 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1229 +#: ../../reference/expressions.rst:1227 msgid "" "This operation can be customized using the special :meth:`__mul__` and :meth:" "`__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1236 +#: ../../reference/expressions.rst:1234 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1247 +#: ../../reference/expressions.rst:1245 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1252,13 +1254,13 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1254 +#: ../../reference/expressions.rst:1252 msgid "" "This operation can be customized using the special :meth:`__truediv__` and :" "meth:`__floordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1261 +#: ../../reference/expressions.rst:1259 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1270,7 +1272,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1270 +#: ../../reference/expressions.rst:1268 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1278,7 +1280,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1275 +#: ../../reference/expressions.rst:1273 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1287,20 +1289,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1280 +#: ../../reference/expressions.rst:1278 msgid "" "The *modulo* operation can be customized using the special :meth:`__mod__` " "method." msgstr "" -#: ../../reference/expressions.rst:1282 +#: ../../reference/expressions.rst:1280 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1291 +#: ../../reference/expressions.rst:1289 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1308,84 +1310,84 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1296 +#: ../../reference/expressions.rst:1294 msgid "" "This operation can be customized using the special :meth:`__add__` and :meth:" "`__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1304 +#: ../../reference/expressions.rst:1302 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1307 +#: ../../reference/expressions.rst:1305 msgid "" "This operation can be customized using the special :meth:`__sub__` method." msgstr "" -#: ../../reference/expressions.rst:1313 +#: ../../reference/expressions.rst:1311 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1318 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1325 +#: ../../reference/expressions.rst:1323 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1328 +#: ../../reference/expressions.rst:1326 msgid "" "This operation can be customized using the special :meth:`__lshift__` and :" "meth:`__rshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1333 +#: ../../reference/expressions.rst:1331 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1340 +#: ../../reference/expressions.rst:1338 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1342 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1355 +#: ../../reference/expressions.rst:1353 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`__and__` " "or :meth:`__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1364 +#: ../../reference/expressions.rst:1362 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`__xor__` or :meth:`__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1373 +#: ../../reference/expressions.rst:1371 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`__or__` or :meth:`__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1381 +#: ../../reference/expressions.rst:1379 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1391 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1393,14 +1395,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1403 +#: ../../reference/expressions.rst:1401 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1409 +#: ../../reference/expressions.rst:1407 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1408,7 +1410,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1413 +#: ../../reference/expressions.rst:1411 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1416,24 +1418,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1418 +#: ../../reference/expressions.rst:1416 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1423 +#: ../../reference/expressions.rst:1421 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1425 +#: ../../reference/expressions.rst:1423 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:1426 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1445,7 +1447,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1437 +#: ../../reference/expressions.rst:1435 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1453,7 +1455,7 @@ msgid "" "methods` like :meth:`__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1443 +#: ../../reference/expressions.rst:1441 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1463,14 +1465,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1450 +#: ../../reference/expressions.rst:1448 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1454 +#: ../../reference/expressions.rst:1452 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1479,13 +1481,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1460 +#: ../../reference/expressions.rst:1458 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1461 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1495,7 +1497,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1470 +#: ../../reference/expressions.rst:1468 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1505,32 +1507,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1475 msgid "" "``None`` and ``NotImplemented`` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1479 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1485 +#: ../../reference/expressions.rst:1483 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1489 +#: ../../reference/expressions.rst:1487 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1489 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1539,7 +1541,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1497 +#: ../../reference/expressions.rst:1495 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1547,19 +1549,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1502 +#: ../../reference/expressions.rst:1500 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1504 +#: ../../reference/expressions.rst:1502 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1509 +#: ../../reference/expressions.rst:1507 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1568,25 +1570,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1515 +#: ../../reference/expressions.rst:1513 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal `(key, value)` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1519 +#: ../../reference/expressions.rst:1517 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1521 +#: ../../reference/expressions.rst:1519 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1524 +#: ../../reference/expressions.rst:1522 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1597,110 +1599,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1532 +#: ../../reference/expressions.rst:1530 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1532 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1537 +#: ../../reference/expressions.rst:1535 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1540 +#: ../../reference/expressions.rst:1538 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1543 +#: ../../reference/expressions.rst:1541 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1545 +#: ../../reference/expressions.rst:1543 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1548 +#: ../../reference/expressions.rst:1546 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1550 +#: ../../reference/expressions.rst:1548 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1552 +#: ../../reference/expressions.rst:1550 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1554 +#: ../../reference/expressions.rst:1552 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1556 +#: ../../reference/expressions.rst:1554 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1559 +#: ../../reference/expressions.rst:1557 msgid "``x > y and y > z`` implies ``x > z``" msgstr "" -#: ../../reference/expressions.rst:1561 +#: ../../reference/expressions.rst:1559 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "" -#: ../../reference/expressions.rst:1563 +#: ../../reference/expressions.rst:1561 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1564 msgid "``x == y`` and ``not x != y``" msgstr "" -#: ../../reference/expressions.rst:1568 +#: ../../reference/expressions.rst:1566 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1570 +#: ../../reference/expressions.rst:1568 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1572 +#: ../../reference/expressions.rst:1570 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1574 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1580 +#: ../../reference/expressions.rst:1578 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1589 +#: ../../reference/expressions.rst:1587 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1591 +#: ../../reference/expressions.rst:1589 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1711,7 +1713,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1599 +#: ../../reference/expressions.rst:1597 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1719,14 +1721,14 @@ msgid "" "\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1604 +#: ../../reference/expressions.rst:1602 msgid "" "For user-defined classes which define the :meth:`__contains__` method, ``x " "in y`` returns ``True`` if ``y.__contains__(x)`` returns a true value, and " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1606 msgid "" "For user-defined classes which do not define :meth:`__contains__` but do " "define :meth:`__iter__`, ``x in y`` is ``True`` if some value ``z``, for " @@ -1735,7 +1737,7 @@ msgid "" "as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1614 +#: ../../reference/expressions.rst:1612 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`__getitem__`, ``x in y`` is ``True`` if and only if there is a non-negative " @@ -1744,17 +1746,17 @@ msgid "" "raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1624 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1639 +#: ../../reference/expressions.rst:1637 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1641 +#: ../../reference/expressions.rst:1639 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1762,11 +1764,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1653 +#: ../../reference/expressions.rst:1651 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1664 +#: ../../reference/expressions.rst:1662 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1777,25 +1779,25 @@ msgid "" "method." msgstr "" -#: ../../reference/expressions.rst:1673 +#: ../../reference/expressions.rst:1671 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1676 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1683 +#: ../../reference/expressions.rst:1681 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1686 +#: ../../reference/expressions.rst:1684 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -1806,55 +1808,56 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1696 +#: ../../reference/expressions.rst:1694 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1701 +#: ../../reference/expressions.rst:1699 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " -"\"walrus\") assigns an :token:`expression` to an :token:`identifier`, while " -"also returning the value of the :token:`expression`." +"\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" +"`~python-grammar:identifier`, while also returning the value of the :token:" +"`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1705 +#: ../../reference/expressions.rst:1704 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1712 +#: ../../reference/expressions.rst:1711 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1718 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1725 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1738 +#: ../../reference/expressions.rst:1737 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1741 +#: ../../reference/expressions.rst:1740 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1745 +#: ../../reference/expressions.rst:1744 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1752 +#: ../../reference/expressions.rst:1751 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1763 +#: ../../reference/expressions.rst:1762 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -1862,25 +1865,25 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1772 +#: ../../reference/expressions.rst:1771 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1780 +#: ../../reference/expressions.rst:1779 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1793 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1803 +#: ../../reference/expressions.rst:1802 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -1888,12 +1891,12 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1808 +#: ../../reference/expressions.rst:1807 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1813 +#: ../../reference/expressions.rst:1812 msgid "" "The trailing comma is required only to create a single tuple (a.k.a. a " "*singleton*); it is optional in all other cases. A single expression " @@ -1902,28 +1905,28 @@ msgid "" "parentheses: ``()``.)" msgstr "" -#: ../../reference/expressions.rst:1823 +#: ../../reference/expressions.rst:1822 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1826 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1830 +#: ../../reference/expressions.rst:1829 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1844 +#: ../../reference/expressions.rst:1843 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1848 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -1932,176 +1935,176 @@ msgid "" "left to right (except for exponentiation, which groups from right to left)." msgstr "" -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:1854 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1861 +#: ../../reference/expressions.rst:1860 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1861 +#: ../../reference/expressions.rst:1860 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1863 +#: ../../reference/expressions.rst:1862 msgid "``(expressions...)``," msgstr "" -#: ../../reference/expressions.rst:1865 +#: ../../reference/expressions.rst:1864 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "" -#: ../../reference/expressions.rst:1863 +#: ../../reference/expressions.rst:1862 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1869 +#: ../../reference/expressions.rst:1868 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "" -#: ../../reference/expressions.rst:1869 +#: ../../reference/expressions.rst:1868 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:1871 msgid ":keyword:`await` ``x``" msgstr ":keyword:`await` ``x``" -#: ../../reference/expressions.rst:1874 +#: ../../reference/expressions.rst:1873 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1874 +#: ../../reference/expressions.rst:1873 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1876 +#: ../../reference/expressions.rst:1875 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1876 +#: ../../reference/expressions.rst:1875 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:1878 +#: ../../reference/expressions.rst:1877 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:1878 +#: ../../reference/expressions.rst:1877 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1881 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1881 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:1884 +#: ../../reference/expressions.rst:1883 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:1884 +#: ../../reference/expressions.rst:1883 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:1886 +#: ../../reference/expressions.rst:1885 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:1886 +#: ../../reference/expressions.rst:1885 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:1888 +#: ../../reference/expressions.rst:1887 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:1888 +#: ../../reference/expressions.rst:1887 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:1890 +#: ../../reference/expressions.rst:1889 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:1890 +#: ../../reference/expressions.rst:1889 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:1892 +#: ../../reference/expressions.rst:1891 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:1892 +#: ../../reference/expressions.rst:1891 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1895 msgid ":keyword:`not` ``x``" msgstr ":keyword:`not` ``x``" -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1895 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:1898 +#: ../../reference/expressions.rst:1897 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:1898 +#: ../../reference/expressions.rst:1897 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:1900 +#: ../../reference/expressions.rst:1899 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:1900 +#: ../../reference/expressions.rst:1899 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:1902 +#: ../../reference/expressions.rst:1901 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:1902 +#: ../../reference/expressions.rst:1901 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:1904 +#: ../../reference/expressions.rst:1903 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:1904 +#: ../../reference/expressions.rst:1903 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:1905 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:1905 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:1910 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:1912 +#: ../../reference/expressions.rst:1911 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2113,7 +2116,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:1921 +#: ../../reference/expressions.rst:1920 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2121,7 +2124,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:1926 +#: ../../reference/expressions.rst:1925 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2135,7 +2138,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:1937 +#: ../../reference/expressions.rst:1936 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2143,13 +2146,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1941 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1944 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2157,13 +2160,13 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:1950 +#: ../../reference/expressions.rst:1949 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:1953 +#: ../../reference/expressions.rst:1952 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 471e4e9e10..d9f1ca0b5f 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -529,10 +529,11 @@ msgstr "" #: ../../reference/lexical_analysis.rst:471 msgid "" "One syntactic restriction not indicated by these productions is that " -"whitespace is not allowed between the :token:`stringprefix` or :token:" -"`bytesprefix` and the rest of the literal. The source character set is " -"defined by the encoding declaration; it is UTF-8 if no encoding declaration " -"is given in the source file; see section :ref:`encodings`." +"whitespace is not allowed between the :token:`~python-grammar:stringprefix` " +"or :token:`~python-grammar:bytesprefix` and the rest of the literal. The " +"source character set is defined by the encoding declaration; it is UTF-8 if " +"no encoding declaration is given in the source file; see section :ref:" +"`encodings`." msgstr "" #: ../../reference/lexical_analysis.rst:481 From 37f0d33bc7bd820dbfb909a4afe223fdcd04f77d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 20 Nov 2021 00:10:28 +0000 Subject: [PATCH 4/4] sync with cpython bbe3c57c --- howto/descriptor.po | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/howto/descriptor.po b/howto/descriptor.po index 1bcf947066..9b5fef610e 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-11-20 00:08+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -929,18 +929,18 @@ msgid "" "`staticmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1285 +#: ../../howto/descriptor.rst:1292 msgid "Class methods" msgstr "" -#: ../../howto/descriptor.rst:1287 +#: ../../howto/descriptor.rst:1294 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class:" msgstr "" -#: ../../howto/descriptor.rst:1305 +#: ../../howto/descriptor.rst:1312 msgid "" "This behavior is useful whenever the method only needs to have a class " "reference and does not rely on data stored in a specific instance. One use " @@ -949,17 +949,17 @@ msgid "" "of keys. The pure Python equivalent is:" msgstr "" -#: ../../howto/descriptor.rst:1322 +#: ../../howto/descriptor.rst:1329 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" -#: ../../howto/descriptor.rst:1332 +#: ../../howto/descriptor.rst:1339 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`classmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1381 +#: ../../howto/descriptor.rst:1388 msgid "" "The code path for ``hasattr(type(self.f), '__get__')`` was added in Python " "3.9 and makes it possible for :func:`classmethod` to support chained " @@ -967,30 +967,30 @@ msgid "" "together:" msgstr "" -#: ../../howto/descriptor.rst:1401 +#: ../../howto/descriptor.rst:1408 msgid "Member objects and __slots__" msgstr "" -#: ../../howto/descriptor.rst:1403 +#: ../../howto/descriptor.rst:1410 msgid "" "When a class defines ``__slots__``, it replaces instance dictionaries with a " "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -#: ../../howto/descriptor.rst:1407 +#: ../../howto/descriptor.rst:1414 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: ../../howto/descriptor.rst:1423 +#: ../../howto/descriptor.rst:1430 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: ../../howto/descriptor.rst:1458 +#: ../../howto/descriptor.rst:1465 msgid "" "3. Saves memory. On a 64-bit Linux build, an instance with two attributes " "takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " @@ -998,19 +998,19 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: ../../howto/descriptor.rst:1463 +#: ../../howto/descriptor.rst:1470 msgid "" "4. Improves speed. Reading instance variables is 35% faster with " "``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -#: ../../howto/descriptor.rst:1466 +#: ../../howto/descriptor.rst:1473 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: ../../howto/descriptor.rst:1488 +#: ../../howto/descriptor.rst:1495 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1020,36 +1020,36 @@ msgid "" "managed by member descriptors:" msgstr "" -#: ../../howto/descriptor.rst:1531 +#: ../../howto/descriptor.rst:1538 msgid "" "The :meth:`type.__new__` method takes care of adding member objects to class " "variables:" msgstr "" -#: ../../howto/descriptor.rst:1547 +#: ../../howto/descriptor.rst:1554 msgid "" "The :meth:`object.__new__` method takes care of creating instances that have " "slots instead of an instance dictionary. Here is a rough simulation in pure " "Python:" msgstr "" -#: ../../howto/descriptor.rst:1582 +#: ../../howto/descriptor.rst:1589 msgid "" "To use the simulation in a real class, just inherit from :class:`Object` and " "set the :term:`metaclass` to :class:`Type`:" msgstr "" -#: ../../howto/descriptor.rst:1596 +#: ../../howto/descriptor.rst:1603 msgid "" "At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: ../../howto/descriptor.rst:1617 +#: ../../howto/descriptor.rst:1624 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: ../../howto/descriptor.rst:1629 +#: ../../howto/descriptor.rst:1636 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr ""