diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index c51ace4386..d2ddcc91bc 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-01-24 22:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -172,6 +172,17 @@ msgstr "" "因此 ``3.4.1a2`` 代表 hexversion ``0x030401a2``\\ 、\\ ``3.10.0`` 代表 " "hexversion ``0x030a00f0``\\ 。" -#: ../../c-api/apiabiversion.rst:62 +#: ../../c-api/apiabiversion.rst:61 +msgid "This version is also available via the symbol :data:`Py_Version`." +msgstr "" + +#: ../../c-api/apiabiversion.rst:65 +msgid "" +"The Python runtime version number encoded in a single constant integer, with " +"the same format as the :c:macro:`PY_VERSION_HEX` macro. This contains the " +"Python version used at run time." +msgstr "" + +#: ../../c-api/apiabiversion.rst:71 msgid "All the given macros are defined in :source:`Include/patchlevel.h`." msgstr "所有提到的巨集都定義在 :source:`Include/patchlevel.h`\\ 。" diff --git a/c-api/buffer.po b/c-api/buffer.po index 26039a1c99..4fdef3e1c6 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -644,33 +644,43 @@ msgstr "" #: ../../c-api/buffer.rst:504 msgid "" +"Copy data from *src* to *dest* buffer. Can convert between C-style and or " +"Fortran-style buffers." +msgstr "" + +#: ../../c-api/buffer.rst:507 +msgid "``0`` is returned on success, ``-1`` on error." +msgstr "" + +#: ../../c-api/buffer.rst:511 +msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:511 +#: ../../c-api/buffer.rst:518 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:515 +#: ../../c-api/buffer.rst:522 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:519 +#: ../../c-api/buffer.rst:526 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :c:data:`PyExc_BufferError`, set ``view->obj`` to ``NULL`` " "and return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:523 +#: ../../c-api/buffer.rst:530 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " diff --git a/c-api/bytearray.po b/c-api/bytearray.po index 928f607f72..9705300c75 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-03 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -93,9 +93,9 @@ msgid "These macros trade safety for speed and they don't check pointers." msgstr "" #: ../../c-api/bytearray.rst:80 -msgid "Macro version of :c:func:`PyByteArray_AsString`." +msgid "Similar to :c:func:`PyByteArray_AsString`, but without error checking." msgstr "" #: ../../c-api/bytearray.rst:85 -msgid "Macro version of :c:func:`PyByteArray_Size`." +msgid "Similar to :c:func:`PyByteArray_Size`, but without error checking." msgstr "" diff --git a/c-api/bytes.po b/c-api/bytes.po index 147b515c22..41d6262d9e 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -251,7 +251,7 @@ msgid "Return the length of the bytes in bytes object *o*." msgstr "" #: ../../c-api/bytes.rst:137 -msgid "Macro form of :c:func:`PyBytes_Size` but without error checking." +msgid "Similar to :c:func:`PyBytes_Size`, but without error checking." msgstr "" #: ../../c-api/bytes.rst:142 @@ -266,7 +266,7 @@ msgid "" msgstr "" #: ../../c-api/bytes.rst:154 -msgid "Macro form of :c:func:`PyBytes_AsString` but without error checking." +msgid "Similar to :c:func:`PyBytes_AsString`, but without error checking." msgstr "" #: ../../c-api/bytes.rst:159 diff --git a/c-api/capsule.po b/c-api/capsule.po index 31dbd2bf80..5f39a543e1 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -141,18 +141,20 @@ msgid "" "Import a pointer to a C object from a capsule attribute in a module. The " "*name* parameter should specify the full name to the attribute, as in " "``module.attribute``. The *name* stored in the capsule must match this " -"string exactly. If *no_block* is true, import the module without blocking " -"(using :c:func:`PyImport_ImportModuleNoBlock`). If *no_block* is false, " -"import the module conventionally (using :c:func:`PyImport_ImportModule`)." +"string exactly." msgstr "" -#: ../../c-api/capsule.rst:110 +#: ../../c-api/capsule.rst:108 msgid "" "Return the capsule's internal *pointer* on success. On failure, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:116 +#: ../../c-api/capsule.rst:111 +msgid "*no_block* has no effect anymore." +msgstr "" + +#: ../../c-api/capsule.rst:117 msgid "" "Determines whether or not *capsule* is a valid capsule. A valid capsule is " "non-``NULL``, passes :c:func:`PyCapsule_CheckExact`, has a non-``NULL`` " @@ -161,41 +163,41 @@ msgid "" "compared.)" msgstr "" -#: ../../c-api/capsule.rst:122 +#: ../../c-api/capsule.rst:123 msgid "" "In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls " "to any of the accessors (any function starting with :c:func:`PyCapsule_Get`) " "are guaranteed to succeed." msgstr "" -#: ../../c-api/capsule.rst:126 +#: ../../c-api/capsule.rst:127 msgid "" "Return a nonzero value if the object is valid and matches the name passed " "in. Return ``0`` otherwise. This function will not fail." msgstr "" -#: ../../c-api/capsule.rst:132 +#: ../../c-api/capsule.rst:133 msgid "Set the context pointer inside *capsule* to *context*." msgstr "" -#: ../../c-api/capsule.rst:134 ../../c-api/capsule.rst:141 -#: ../../c-api/capsule.rst:150 ../../c-api/capsule.rst:158 +#: ../../c-api/capsule.rst:135 ../../c-api/capsule.rst:142 +#: ../../c-api/capsule.rst:151 ../../c-api/capsule.rst:159 msgid "" "Return ``0`` on success. Return nonzero and set an exception on failure." msgstr "" -#: ../../c-api/capsule.rst:139 +#: ../../c-api/capsule.rst:140 msgid "Set the destructor inside *capsule* to *destructor*." msgstr "" -#: ../../c-api/capsule.rst:146 +#: ../../c-api/capsule.rst:147 msgid "" "Set the name inside *capsule* to *name*. If non-``NULL``, the name must " "outlive the capsule. If the previous *name* stored in the capsule was not " "``NULL``, no attempt is made to free it." msgstr "" -#: ../../c-api/capsule.rst:155 +#: ../../c-api/capsule.rst:156 msgid "" "Set the void pointer inside *capsule* to *pointer*. The pointer may not be " "``NULL``." diff --git a/c-api/code.po b/c-api/code.po index 6540766215..73f6f8308f 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -55,33 +55,88 @@ msgstr "" msgid "" "Return a new code object. If you need a dummy code object to create a " "frame, use :c:func:`PyCode_NewEmpty` instead. Calling :c:func:`PyCode_New` " -"directly can bind you to a precise Python version since the definition of " -"the bytecode changes often." +"directly will bind you to a precise Python version since the definition of " +"the bytecode changes often. The many arguments of this function are inter-" +"dependent in complex ways, meaning that subtle changes to values are likely " +"to result in incorrect execution or VM crashes. Use this function only with " +"extreme care." msgstr "" -#: ../../c-api/code.rst:45 +#: ../../c-api/code.rst:45 ../../c-api/code.rst:55 +msgid "Added ``exceptiontable`` parameter." +msgstr "" + +#: ../../c-api/code.rst:50 msgid "" "Similar to :c:func:`PyCode_New`, but with an extra \"posonlyargcount\" for " -"positional-only arguments." +"positional-only arguments. The same caveats that apply to ``PyCode_New`` " +"also apply to this function." msgstr "" -#: ../../c-api/code.rst:51 +#: ../../c-api/code.rst:60 msgid "" "Return a new empty code object with the specified filename, function name, " -"and first line number. It is illegal to :func:`exec` or :func:`eval` the " -"resulting code object." +"and first line number. The resulting code object will raise an ``Exception`` " +"if executed." msgstr "" -#: ../../c-api/code.rst:57 +#: ../../c-api/code.rst:66 msgid "" "Return the line number of the instruction that occurs on or before " "``byte_offset`` and ends after it. If you just need the line number of a " "frame, use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -#: ../../c-api/code.rst:60 +#: ../../c-api/code.rst:69 msgid "" "For efficiently iterating over the line numbers in a code object, use `the " -"API described in PEP 626 `_." +"API described in PEP 626 `_." +msgstr "" + +#: ../../c-api/code.rst:74 +msgid "" +"Sets the passed ``int`` pointers to the source code line and column numbers " +"for the instruction at ``byte_offset``. Sets the value to ``0`` when " +"information is not available for any particular element." +msgstr "" + +#: ../../c-api/code.rst:78 +msgid "Returns ``1`` if the function succeeds and 0 otherwise." +msgstr "" + +#: ../../c-api/code.rst:82 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " +"reference to a :c:type:`PyBytesObject` representing the bytecode in a code " +"object. On error, ``NULL`` is returned and an exception is raised." +msgstr "" + +#: ../../c-api/code.rst:87 +msgid "" +"This ``PyBytesObject`` may be created on-demand by the interpreter and does " +"not necessarily represent the bytecode actually executed by CPython. The " +"primary use case for this function is debuggers and profilers." +msgstr "" + +#: ../../c-api/code.rst:95 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " +"reference to a :c:type:`PyTupleObject` containing the names of the local " +"variables. On error, ``NULL`` is returned and an exception is raised." +msgstr "" + +#: ../../c-api/code.rst:104 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " +"reference to a :c:type:`PyTupleObject` containing the names of the local " +"variables that are referenced by nested functions. On error, ``NULL`` is " +"returned and an exception is raised." +msgstr "" + +#: ../../c-api/code.rst:113 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " +"reference to a :c:type:`PyTupleObject` containing the names of the free " +"variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index e7d1088262..5a9b93c345 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -481,30 +481,64 @@ msgstr "" #: ../../c-api/exceptions.rst:465 msgid "" -"Retrieve the exception info, as known from ``sys.exc_info()``. This refers " -"to an exception that was *already caught*, not to an exception that was " -"freshly raised. Returns new references for the three objects, any of which " -"may be ``NULL``. Does not modify the exception info state." +"Retrieve the active exception instance, as would be returned by :func:`sys." +"exception`. This refers to an exception that was *already caught*, not to an " +"exception that was freshly raised. Returns a new reference to the exception " +"or ``NULL``. Does not modify the interpreter's exception state." msgstr "" #: ../../c-api/exceptions.rst:472 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " +"state temporarily. Use :c:func:`PyErr_SetHandledException` to restore or " +"clear the exception state." +msgstr "" + +#: ../../c-api/exceptions.rst:481 +msgid "" +"Set the active exception, as known from ``sys.exception()``. This refers to " +"an exception that was *already caught*, not to an exception that was freshly " +"raised. To clear the exception state, pass ``NULL``." +msgstr "" + +#: ../../c-api/exceptions.rst:488 +msgid "" +"This function is not normally used by code that wants to handle exceptions. " +"Rather, it can be used when code needs to save and restore the exception " +"state temporarily. Use :c:func:`PyErr_GetHandledException` to get the " +"exception state." +msgstr "" + +#: ../../c-api/exceptions.rst:497 +msgid "" +"Retrieve the old-style representation of the exception info, as known from :" +"func:`sys.exc_info`. This refers to an exception that was *already caught*, " +"not to an exception that was freshly raised. Returns new references for the " +"three objects, any of which may be ``NULL``. Does not modify the exception " +"info state. This function is kept for backwards compatibility. Prefer " +"using :c:func:`PyErr_GetHandledException`." +msgstr "" + +#: ../../c-api/exceptions.rst:506 +msgid "" +"This function is not normally used by code that wants to handle exceptions. " +"Rather, it can be used when code needs to save and restore the exception " "state temporarily. Use :c:func:`PyErr_SetExcInfo` to restore or clear the " "exception state." msgstr "" -#: ../../c-api/exceptions.rst:482 +#: ../../c-api/exceptions.rst:516 msgid "" "Set the exception info, as known from ``sys.exc_info()``. This refers to an " "exception that was *already caught*, not to an exception that was freshly " "raised. This function steals the references of the arguments. To clear the " -"exception state, pass ``NULL`` for all three arguments. For general rules " -"about the three arguments, see :c:func:`PyErr_Restore`." +"exception state, pass ``NULL`` for all three arguments. This function is " +"kept for backwards compatibility. Prefer using :c:func:" +"`PyErr_SetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:490 +#: ../../c-api/exceptions.rst:525 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -512,15 +546,22 @@ msgid "" "state." msgstr "" -#: ../../c-api/exceptions.rst:499 +#: ../../c-api/exceptions.rst:532 +msgid "" +"The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " +"The interpreter now derives them from the exception instance (the ``value`` " +"argument). The function still steals references of all three arguments." +msgstr "" + +#: ../../c-api/exceptions.rst:540 msgid "Signal Handling" msgstr "" -#: ../../c-api/exceptions.rst:509 +#: ../../c-api/exceptions.rst:550 msgid "This function interacts with Python's signal handling." msgstr "" -#: ../../c-api/exceptions.rst:511 +#: ../../c-api/exceptions.rst:552 msgid "" "If the function is called from the main thread and under the main Python " "interpreter, it checks whether a signal has been sent to the processes and " @@ -528,7 +569,7 @@ msgid "" "module is supported, this can invoke a signal handler written in Python." msgstr "" -#: ../../c-api/exceptions.rst:516 +#: ../../c-api/exceptions.rst:557 msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " @@ -537,44 +578,44 @@ msgid "" "`PyErr_CheckSignals()` invocation)." msgstr "" -#: ../../c-api/exceptions.rst:522 +#: ../../c-api/exceptions.rst:563 msgid "" "If the function is called from a non-main thread, or under a non-main Python " "interpreter, it does nothing and returns ``0``." msgstr "" -#: ../../c-api/exceptions.rst:525 +#: ../../c-api/exceptions.rst:566 msgid "" "This function can be called by long-running C code that wants to be " "interruptible by user requests (such as by pressing Ctrl-C)." msgstr "" -#: ../../c-api/exceptions.rst:529 +#: ../../c-api/exceptions.rst:570 msgid "" "The default Python signal handler for :const:`SIGINT` raises the :exc:" "`KeyboardInterrupt` exception." msgstr "" -#: ../../c-api/exceptions.rst:540 +#: ../../c-api/exceptions.rst:581 msgid "" "Simulate the effect of a :const:`SIGINT` signal arriving. This is equivalent " "to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -#: ../../c-api/exceptions.rst:544 ../../c-api/exceptions.rst:571 +#: ../../c-api/exceptions.rst:585 ../../c-api/exceptions.rst:612 msgid "" "This function is async-signal-safe. It can be called without the :term:" "`GIL` and from a C signal handler." msgstr "" -#: ../../c-api/exceptions.rst:554 +#: ../../c-api/exceptions.rst:595 msgid "" "Simulate the effect of a signal arriving. The next time :c:func:" "`PyErr_CheckSignals` is called, the Python signal handler for the given " "signal number will be called." msgstr "" -#: ../../c-api/exceptions.rst:558 +#: ../../c-api/exceptions.rst:599 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " @@ -582,27 +623,27 @@ msgid "" "interrupt an operation)." msgstr "" -#: ../../c-api/exceptions.rst:563 +#: ../../c-api/exceptions.rst:604 msgid "" "If the given signal isn't handled by Python (it was set to :data:`signal." "SIG_DFL` or :data:`signal.SIG_IGN`), it will be ignored." msgstr "" -#: ../../c-api/exceptions.rst:566 +#: ../../c-api/exceptions.rst:607 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" -#: ../../c-api/exceptions.rst:579 +#: ../../c-api/exceptions.rst:620 msgid "" "This utility function specifies a file descriptor to which the signal number " "is written as a single byte whenever a signal is received. *fd* must be non-" "blocking. It returns the previous such file descriptor." msgstr "" -#: ../../c-api/exceptions.rst:583 +#: ../../c-api/exceptions.rst:624 msgid "" "The value ``-1`` disables the feature; this is the initial state. This is " "equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " @@ -610,15 +651,15 @@ msgid "" "be called from the main thread." msgstr "" -#: ../../c-api/exceptions.rst:588 +#: ../../c-api/exceptions.rst:629 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../c-api/exceptions.rst:593 +#: ../../c-api/exceptions.rst:634 msgid "Exception Classes" msgstr "例外類別" -#: ../../c-api/exceptions.rst:597 +#: ../../c-api/exceptions.rst:638 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -627,7 +668,7 @@ msgid "" "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -#: ../../c-api/exceptions.rst:603 +#: ../../c-api/exceptions.rst:644 msgid "" "The :attr:`__module__` attribute of the new class is set to the first part " "(up to the last dot) of the *name* argument, and the class name is set to " @@ -637,31 +678,31 @@ msgid "" "variables and methods." msgstr "" -#: ../../c-api/exceptions.rst:612 +#: ../../c-api/exceptions.rst:653 msgid "" "Same as :c:func:`PyErr_NewException`, except that the new exception class " "can easily be given a docstring: If *doc* is non-``NULL``, it will be used " "as the docstring for the exception class." msgstr "" -#: ../../c-api/exceptions.rst:620 +#: ../../c-api/exceptions.rst:661 msgid "Exception Objects" msgstr "例外物件" -#: ../../c-api/exceptions.rst:624 +#: ../../c-api/exceptions.rst:665 msgid "" "Return the traceback associated with the exception as a new reference, as " "accessible from Python through :attr:`__traceback__`. If there is no " "traceback associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:631 +#: ../../c-api/exceptions.rst:672 msgid "" "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " "clear it." msgstr "" -#: ../../c-api/exceptions.rst:637 +#: ../../c-api/exceptions.rst:678 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " @@ -669,127 +710,98 @@ msgid "" "this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:645 +#: ../../c-api/exceptions.rst:686 msgid "" "Set the context associated with the exception to *ctx*. Use ``NULL`` to " "clear it. There is no type check to make sure that *ctx* is an exception " "instance. This steals a reference to *ctx*." msgstr "" -#: ../../c-api/exceptions.rst:652 +#: ../../c-api/exceptions.rst:693 msgid "" "Return the cause (either an exception instance, or :const:`None`, set by " "``raise ... from ...``) associated with the exception as a new reference, as " "accessible from Python through :attr:`__cause__`." msgstr "" -#: ../../c-api/exceptions.rst:659 +#: ../../c-api/exceptions.rst:700 msgid "" "Set the cause associated with the exception to *cause*. Use ``NULL`` to " "clear it. There is no type check to make sure that *cause* is either an " "exception instance or :const:`None`. This steals a reference to *cause*." msgstr "" -#: ../../c-api/exceptions.rst:663 +#: ../../c-api/exceptions.rst:704 msgid "" ":attr:`__suppress_context__` is implicitly set to ``True`` by this function." msgstr "" -#: ../../c-api/exceptions.rst:669 +#: ../../c-api/exceptions.rst:710 msgid "Unicode Exception Objects" msgstr "" -#: ../../c-api/exceptions.rst:671 +#: ../../c-api/exceptions.rst:712 msgid "" "The following functions are used to create and modify Unicode exceptions " "from C." msgstr "" -#: ../../c-api/exceptions.rst:675 +#: ../../c-api/exceptions.rst:716 msgid "" "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -#: ../../c-api/exceptions.rst:681 -msgid "" -"Create a :class:`UnicodeEncodeError` object with the attributes *encoding*, " -"*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " -"UTF-8 encoded strings." -msgstr "" - -#: ../../c-api/exceptions.rst:685 ../../c-api/exceptions.rst:695 -msgid "3.11" -msgstr "3.11" - -#: ../../c-api/exceptions.rst:687 -msgid "" -"``Py_UNICODE`` is deprecated since Python 3.3. Please migrate to " -"``PyObject_CallFunction(PyExc_UnicodeEncodeError, \"sOnns\", ...)``." -msgstr "" - -#: ../../c-api/exceptions.rst:692 -msgid "" -"Create a :class:`UnicodeTranslateError` object with the attributes *object*, " -"*length*, *start*, *end* and *reason*. *reason* is a UTF-8 encoded string." -msgstr "" - -#: ../../c-api/exceptions.rst:697 -msgid "" -"``Py_UNICODE`` is deprecated since Python 3.3. Please migrate to " -"``PyObject_CallFunction(PyExc_UnicodeTranslateError, \"Onns\", ...)``." -msgstr "" - -#: ../../c-api/exceptions.rst:703 +#: ../../c-api/exceptions.rst:723 msgid "Return the *encoding* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:709 +#: ../../c-api/exceptions.rst:729 msgid "Return the *object* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:715 +#: ../../c-api/exceptions.rst:735 msgid "" "Get the *start* attribute of the given exception object and place it into *" "\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " "on failure." msgstr "" -#: ../../c-api/exceptions.rst:723 +#: ../../c-api/exceptions.rst:743 msgid "" "Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:730 +#: ../../c-api/exceptions.rst:750 msgid "" "Get the *end* attribute of the given exception object and place it into *" "\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: ../../c-api/exceptions.rst:738 +#: ../../c-api/exceptions.rst:758 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:745 +#: ../../c-api/exceptions.rst:765 msgid "Return the *reason* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:751 +#: ../../c-api/exceptions.rst:771 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:758 +#: ../../c-api/exceptions.rst:778 msgid "Recursion Control" msgstr "" -#: ../../c-api/exceptions.rst:760 +#: ../../c-api/exceptions.rst:780 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -799,42 +811,42 @@ msgid "" "recursion handling." msgstr "" -#: ../../c-api/exceptions.rst:769 +#: ../../c-api/exceptions.rst:789 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: ../../c-api/exceptions.rst:771 +#: ../../c-api/exceptions.rst:791 msgid "" "If :const:`USE_STACKCHECK` is defined, this function checks if the OS stack " "overflowed using :c:func:`PyOS_CheckStack`. In this is the case, it sets a :" "exc:`MemoryError` and returns a nonzero value." msgstr "" -#: ../../c-api/exceptions.rst:775 +#: ../../c-api/exceptions.rst:795 msgid "" "The function then checks if the recursion limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: ../../c-api/exceptions.rst:779 +#: ../../c-api/exceptions.rst:799 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: ../../c-api/exceptions.rst:783 ../../c-api/exceptions.rst:791 +#: ../../c-api/exceptions.rst:803 ../../c-api/exceptions.rst:811 msgid "This function is now also available in the limited API." msgstr "" -#: ../../c-api/exceptions.rst:788 +#: ../../c-api/exceptions.rst:808 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: ../../c-api/exceptions.rst:794 +#: ../../c-api/exceptions.rst:814 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " "requires special recursion handling. In addition to protecting the stack, :" @@ -843,13 +855,13 @@ msgid "" "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: ../../c-api/exceptions.rst:802 +#: ../../c-api/exceptions.rst:822 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: ../../c-api/exceptions.rst:805 +#: ../../c-api/exceptions.rst:825 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " @@ -857,30 +869,30 @@ msgid "" "`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." msgstr "" -#: ../../c-api/exceptions.rst:811 +#: ../../c-api/exceptions.rst:831 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:815 +#: ../../c-api/exceptions.rst:835 msgid "" "Otherwise, the function returns zero and the :c:member:`~PyTypeObject." "tp_repr` implementation can continue normally." msgstr "" -#: ../../c-api/exceptions.rst:820 +#: ../../c-api/exceptions.rst:840 msgid "" "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" "c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: ../../c-api/exceptions.rst:827 +#: ../../c-api/exceptions.rst:847 msgid "Standard Exceptions" msgstr "" -#: ../../c-api/exceptions.rst:829 +#: ../../c-api/exceptions.rst:849 msgid "" "All standard Python exceptions are available as global variables whose names " "are ``PyExc_`` followed by the Python exception name. These have the type :" @@ -888,451 +900,451 @@ msgid "" "all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:890 ../../c-api/exceptions.rst:1023 -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:910 ../../c-api/exceptions.rst:1043 +#: ../../c-api/exceptions.rst:1088 msgid "C Name" msgstr "" -#: ../../c-api/exceptions.rst:890 ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:910 ../../c-api/exceptions.rst:1088 msgid "Python Name" msgstr "" -#: ../../c-api/exceptions.rst:890 ../../c-api/exceptions.rst:1023 -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:910 ../../c-api/exceptions.rst:1043 +#: ../../c-api/exceptions.rst:1088 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:892 +#: ../../c-api/exceptions.rst:912 msgid ":c:data:`PyExc_BaseException`" msgstr ":c:data:`PyExc_BaseException`" -#: ../../c-api/exceptions.rst:892 +#: ../../c-api/exceptions.rst:912 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:892 ../../c-api/exceptions.rst:894 -#: ../../c-api/exceptions.rst:896 ../../c-api/exceptions.rst:942 -#: ../../c-api/exceptions.rst:954 +#: ../../c-api/exceptions.rst:912 ../../c-api/exceptions.rst:914 +#: ../../c-api/exceptions.rst:916 ../../c-api/exceptions.rst:962 +#: ../../c-api/exceptions.rst:974 msgid "[1]_" msgstr "[1]_" -#: ../../c-api/exceptions.rst:894 +#: ../../c-api/exceptions.rst:914 msgid ":c:data:`PyExc_Exception`" msgstr ":c:data:`PyExc_Exception`" -#: ../../c-api/exceptions.rst:894 +#: ../../c-api/exceptions.rst:914 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:896 +#: ../../c-api/exceptions.rst:916 msgid ":c:data:`PyExc_ArithmeticError`" msgstr ":c:data:`PyExc_ArithmeticError`" -#: ../../c-api/exceptions.rst:896 +#: ../../c-api/exceptions.rst:916 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:898 +#: ../../c-api/exceptions.rst:918 msgid ":c:data:`PyExc_AssertionError`" msgstr ":c:data:`PyExc_AssertionError`" -#: ../../c-api/exceptions.rst:898 +#: ../../c-api/exceptions.rst:918 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:900 +#: ../../c-api/exceptions.rst:920 msgid ":c:data:`PyExc_AttributeError`" msgstr ":c:data:`PyExc_AttributeError`" -#: ../../c-api/exceptions.rst:900 +#: ../../c-api/exceptions.rst:920 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:902 +#: ../../c-api/exceptions.rst:922 msgid ":c:data:`PyExc_BlockingIOError`" msgstr ":c:data:`PyExc_BlockingIOError`" -#: ../../c-api/exceptions.rst:902 +#: ../../c-api/exceptions.rst:922 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:904 +#: ../../c-api/exceptions.rst:924 msgid ":c:data:`PyExc_BrokenPipeError`" msgstr ":c:data:`PyExc_BrokenPipeError`" -#: ../../c-api/exceptions.rst:904 +#: ../../c-api/exceptions.rst:924 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:906 +#: ../../c-api/exceptions.rst:926 msgid ":c:data:`PyExc_BufferError`" msgstr ":c:data:`PyExc_BufferError`" -#: ../../c-api/exceptions.rst:906 +#: ../../c-api/exceptions.rst:926 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:908 +#: ../../c-api/exceptions.rst:928 msgid ":c:data:`PyExc_ChildProcessError`" msgstr ":c:data:`PyExc_ChildProcessError`" -#: ../../c-api/exceptions.rst:908 +#: ../../c-api/exceptions.rst:928 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:910 +#: ../../c-api/exceptions.rst:930 msgid ":c:data:`PyExc_ConnectionAbortedError`" msgstr ":c:data:`PyExc_ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:910 +#: ../../c-api/exceptions.rst:930 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:912 +#: ../../c-api/exceptions.rst:932 msgid ":c:data:`PyExc_ConnectionError`" msgstr ":c:data:`PyExc_ConnectionError`" -#: ../../c-api/exceptions.rst:912 +#: ../../c-api/exceptions.rst:932 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:914 +#: ../../c-api/exceptions.rst:934 msgid ":c:data:`PyExc_ConnectionRefusedError`" msgstr ":c:data:`PyExc_ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:914 +#: ../../c-api/exceptions.rst:934 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:916 +#: ../../c-api/exceptions.rst:936 msgid ":c:data:`PyExc_ConnectionResetError`" msgstr ":c:data:`PyExc_ConnectionResetError`" -#: ../../c-api/exceptions.rst:916 +#: ../../c-api/exceptions.rst:936 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:918 +#: ../../c-api/exceptions.rst:938 msgid ":c:data:`PyExc_EOFError`" msgstr ":c:data:`PyExc_EOFError`" -#: ../../c-api/exceptions.rst:918 +#: ../../c-api/exceptions.rst:938 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:920 +#: ../../c-api/exceptions.rst:940 msgid ":c:data:`PyExc_FileExistsError`" msgstr ":c:data:`PyExc_FileExistsError`" -#: ../../c-api/exceptions.rst:920 +#: ../../c-api/exceptions.rst:940 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:922 +#: ../../c-api/exceptions.rst:942 msgid ":c:data:`PyExc_FileNotFoundError`" msgstr ":c:data:`PyExc_FileNotFoundError`" -#: ../../c-api/exceptions.rst:922 +#: ../../c-api/exceptions.rst:942 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:924 +#: ../../c-api/exceptions.rst:944 msgid ":c:data:`PyExc_FloatingPointError`" msgstr ":c:data:`PyExc_FloatingPointError`" -#: ../../c-api/exceptions.rst:924 +#: ../../c-api/exceptions.rst:944 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:926 +#: ../../c-api/exceptions.rst:946 msgid ":c:data:`PyExc_GeneratorExit`" msgstr ":c:data:`PyExc_GeneratorExit`" -#: ../../c-api/exceptions.rst:926 +#: ../../c-api/exceptions.rst:946 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:928 +#: ../../c-api/exceptions.rst:948 msgid ":c:data:`PyExc_ImportError`" msgstr ":c:data:`PyExc_ImportError`" -#: ../../c-api/exceptions.rst:928 +#: ../../c-api/exceptions.rst:948 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:930 +#: ../../c-api/exceptions.rst:950 msgid ":c:data:`PyExc_IndentationError`" msgstr ":c:data:`PyExc_IndentationError`" -#: ../../c-api/exceptions.rst:930 +#: ../../c-api/exceptions.rst:950 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:932 +#: ../../c-api/exceptions.rst:952 msgid ":c:data:`PyExc_IndexError`" msgstr ":c:data:`PyExc_IndexError`" -#: ../../c-api/exceptions.rst:932 +#: ../../c-api/exceptions.rst:952 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:934 +#: ../../c-api/exceptions.rst:954 msgid ":c:data:`PyExc_InterruptedError`" msgstr ":c:data:`PyExc_InterruptedError`" -#: ../../c-api/exceptions.rst:934 +#: ../../c-api/exceptions.rst:954 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:936 +#: ../../c-api/exceptions.rst:956 msgid ":c:data:`PyExc_IsADirectoryError`" msgstr ":c:data:`PyExc_IsADirectoryError`" -#: ../../c-api/exceptions.rst:936 +#: ../../c-api/exceptions.rst:956 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:938 +#: ../../c-api/exceptions.rst:958 msgid ":c:data:`PyExc_KeyError`" msgstr ":c:data:`PyExc_KeyError`" -#: ../../c-api/exceptions.rst:938 +#: ../../c-api/exceptions.rst:958 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:940 +#: ../../c-api/exceptions.rst:960 msgid ":c:data:`PyExc_KeyboardInterrupt`" msgstr ":c:data:`PyExc_KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:940 +#: ../../c-api/exceptions.rst:960 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:942 +#: ../../c-api/exceptions.rst:962 msgid ":c:data:`PyExc_LookupError`" msgstr ":c:data:`PyExc_LookupError`" -#: ../../c-api/exceptions.rst:942 +#: ../../c-api/exceptions.rst:962 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:944 +#: ../../c-api/exceptions.rst:964 msgid ":c:data:`PyExc_MemoryError`" msgstr ":c:data:`PyExc_MemoryError`" -#: ../../c-api/exceptions.rst:944 +#: ../../c-api/exceptions.rst:964 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:946 +#: ../../c-api/exceptions.rst:966 msgid ":c:data:`PyExc_ModuleNotFoundError`" msgstr ":c:data:`PyExc_ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:946 +#: ../../c-api/exceptions.rst:966 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:948 +#: ../../c-api/exceptions.rst:968 msgid ":c:data:`PyExc_NameError`" msgstr ":c:data:`PyExc_NameError`" -#: ../../c-api/exceptions.rst:948 +#: ../../c-api/exceptions.rst:968 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:950 +#: ../../c-api/exceptions.rst:970 msgid ":c:data:`PyExc_NotADirectoryError`" msgstr ":c:data:`PyExc_NotADirectoryError`" -#: ../../c-api/exceptions.rst:950 +#: ../../c-api/exceptions.rst:970 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:952 +#: ../../c-api/exceptions.rst:972 msgid ":c:data:`PyExc_NotImplementedError`" msgstr ":c:data:`PyExc_NotImplementedError`" -#: ../../c-api/exceptions.rst:952 +#: ../../c-api/exceptions.rst:972 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:954 +#: ../../c-api/exceptions.rst:974 msgid ":c:data:`PyExc_OSError`" msgstr ":c:data:`PyExc_OSError`" -#: ../../c-api/exceptions.rst:954 +#: ../../c-api/exceptions.rst:974 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:956 +#: ../../c-api/exceptions.rst:976 msgid ":c:data:`PyExc_OverflowError`" msgstr ":c:data:`PyExc_OverflowError`" -#: ../../c-api/exceptions.rst:956 +#: ../../c-api/exceptions.rst:976 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:978 msgid ":c:data:`PyExc_PermissionError`" msgstr ":c:data:`PyExc_PermissionError`" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:978 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:960 +#: ../../c-api/exceptions.rst:980 msgid ":c:data:`PyExc_ProcessLookupError`" msgstr ":c:data:`PyExc_ProcessLookupError`" -#: ../../c-api/exceptions.rst:960 +#: ../../c-api/exceptions.rst:980 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:962 +#: ../../c-api/exceptions.rst:982 msgid ":c:data:`PyExc_RecursionError`" msgstr ":c:data:`PyExc_RecursionError`" -#: ../../c-api/exceptions.rst:962 +#: ../../c-api/exceptions.rst:982 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:964 +#: ../../c-api/exceptions.rst:984 msgid ":c:data:`PyExc_ReferenceError`" msgstr ":c:data:`PyExc_ReferenceError`" -#: ../../c-api/exceptions.rst:964 +#: ../../c-api/exceptions.rst:984 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:966 +#: ../../c-api/exceptions.rst:986 msgid ":c:data:`PyExc_RuntimeError`" msgstr ":c:data:`PyExc_RuntimeError`" -#: ../../c-api/exceptions.rst:966 +#: ../../c-api/exceptions.rst:986 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:968 +#: ../../c-api/exceptions.rst:988 msgid ":c:data:`PyExc_StopAsyncIteration`" msgstr ":c:data:`PyExc_StopAsyncIteration`" -#: ../../c-api/exceptions.rst:968 +#: ../../c-api/exceptions.rst:988 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:970 +#: ../../c-api/exceptions.rst:990 msgid ":c:data:`PyExc_StopIteration`" msgstr ":c:data:`PyExc_StopIteration`" -#: ../../c-api/exceptions.rst:970 +#: ../../c-api/exceptions.rst:990 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:972 +#: ../../c-api/exceptions.rst:992 msgid ":c:data:`PyExc_SyntaxError`" msgstr ":c:data:`PyExc_SyntaxError`" -#: ../../c-api/exceptions.rst:972 +#: ../../c-api/exceptions.rst:992 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:974 +#: ../../c-api/exceptions.rst:994 msgid ":c:data:`PyExc_SystemError`" msgstr ":c:data:`PyExc_SystemError`" -#: ../../c-api/exceptions.rst:974 +#: ../../c-api/exceptions.rst:994 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:976 +#: ../../c-api/exceptions.rst:996 msgid ":c:data:`PyExc_SystemExit`" msgstr ":c:data:`PyExc_SystemExit`" -#: ../../c-api/exceptions.rst:976 +#: ../../c-api/exceptions.rst:996 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:978 +#: ../../c-api/exceptions.rst:998 msgid ":c:data:`PyExc_TabError`" msgstr ":c:data:`PyExc_TabError`" -#: ../../c-api/exceptions.rst:978 +#: ../../c-api/exceptions.rst:998 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:980 +#: ../../c-api/exceptions.rst:1000 msgid ":c:data:`PyExc_TimeoutError`" msgstr ":c:data:`PyExc_TimeoutError`" -#: ../../c-api/exceptions.rst:980 +#: ../../c-api/exceptions.rst:1000 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:982 +#: ../../c-api/exceptions.rst:1002 msgid ":c:data:`PyExc_TypeError`" msgstr ":c:data:`PyExc_TypeError`" -#: ../../c-api/exceptions.rst:982 +#: ../../c-api/exceptions.rst:1002 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:984 +#: ../../c-api/exceptions.rst:1004 msgid ":c:data:`PyExc_UnboundLocalError`" msgstr ":c:data:`PyExc_UnboundLocalError`" -#: ../../c-api/exceptions.rst:984 +#: ../../c-api/exceptions.rst:1004 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:986 +#: ../../c-api/exceptions.rst:1006 msgid ":c:data:`PyExc_UnicodeDecodeError`" msgstr ":c:data:`PyExc_UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:986 +#: ../../c-api/exceptions.rst:1006 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:988 +#: ../../c-api/exceptions.rst:1008 msgid ":c:data:`PyExc_UnicodeEncodeError`" msgstr ":c:data:`PyExc_UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:988 +#: ../../c-api/exceptions.rst:1008 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:990 +#: ../../c-api/exceptions.rst:1010 msgid ":c:data:`PyExc_UnicodeError`" msgstr ":c:data:`PyExc_UnicodeError`" -#: ../../c-api/exceptions.rst:990 +#: ../../c-api/exceptions.rst:1010 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:992 +#: ../../c-api/exceptions.rst:1012 msgid ":c:data:`PyExc_UnicodeTranslateError`" msgstr ":c:data:`PyExc_UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:992 +#: ../../c-api/exceptions.rst:1012 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:994 +#: ../../c-api/exceptions.rst:1014 msgid ":c:data:`PyExc_ValueError`" msgstr ":c:data:`PyExc_ValueError`" -#: ../../c-api/exceptions.rst:994 +#: ../../c-api/exceptions.rst:1014 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:996 +#: ../../c-api/exceptions.rst:1016 msgid ":c:data:`PyExc_ZeroDivisionError`" msgstr ":c:data:`PyExc_ZeroDivisionError`" -#: ../../c-api/exceptions.rst:996 +#: ../../c-api/exceptions.rst:1016 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:999 +#: ../../c-api/exceptions.rst:1019 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1352,58 +1364,58 @@ msgstr "" "`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" "`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1009 +#: ../../c-api/exceptions.rst:1029 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr "" ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`\\ 。" -#: ../../c-api/exceptions.rst:1012 +#: ../../c-api/exceptions.rst:1032 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`\\ 。" -#: ../../c-api/exceptions.rst:1015 +#: ../../c-api/exceptions.rst:1035 msgid "These are compatibility aliases to :c:data:`PyExc_OSError`:" msgstr "" -#: ../../c-api/exceptions.rst:1025 +#: ../../c-api/exceptions.rst:1045 msgid ":c:data:`PyExc_EnvironmentError`" msgstr ":c:data:`PyExc_EnvironmentError`" -#: ../../c-api/exceptions.rst:1027 +#: ../../c-api/exceptions.rst:1047 msgid ":c:data:`PyExc_IOError`" msgstr ":c:data:`PyExc_IOError`" -#: ../../c-api/exceptions.rst:1029 +#: ../../c-api/exceptions.rst:1049 msgid ":c:data:`PyExc_WindowsError`" msgstr ":c:data:`PyExc_WindowsError`" -#: ../../c-api/exceptions.rst:1029 +#: ../../c-api/exceptions.rst:1049 msgid "[2]_" msgstr "[2]_" -#: ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1052 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1035 ../../c-api/exceptions.rst:1096 +#: ../../c-api/exceptions.rst:1055 ../../c-api/exceptions.rst:1116 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1038 +#: ../../c-api/exceptions.rst:1058 msgid "This is a base class for other standard exceptions." msgstr "" -#: ../../c-api/exceptions.rst:1041 +#: ../../c-api/exceptions.rst:1061 msgid "" "Only defined on Windows; protect code that uses this by testing that the " "preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1047 +#: ../../c-api/exceptions.rst:1067 msgid "Standard Warning Categories" msgstr "" -#: ../../c-api/exceptions.rst:1049 +#: ../../c-api/exceptions.rst:1069 msgid "" "All standard Python warning categories are available as global variables " "whose names are ``PyExc_`` followed by the Python exception name. These have " @@ -1411,102 +1423,105 @@ msgid "" "here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1090 msgid ":c:data:`PyExc_Warning`" msgstr ":c:data:`PyExc_Warning`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1090 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1090 msgid "[3]_" msgstr "[3]_" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1092 msgid ":c:data:`PyExc_BytesWarning`" msgstr ":c:data:`PyExc_BytesWarning`" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1092 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1094 msgid ":c:data:`PyExc_DeprecationWarning`" msgstr ":c:data:`PyExc_DeprecationWarning`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1094 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1096 msgid ":c:data:`PyExc_FutureWarning`" msgstr ":c:data:`PyExc_FutureWarning`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1096 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1098 msgid ":c:data:`PyExc_ImportWarning`" msgstr ":c:data:`PyExc_ImportWarning`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1098 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1100 msgid ":c:data:`PyExc_PendingDeprecationWarning`" msgstr ":c:data:`PyExc_PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1100 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1102 msgid ":c:data:`PyExc_ResourceWarning`" msgstr ":c:data:`PyExc_ResourceWarning`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1102 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1104 msgid ":c:data:`PyExc_RuntimeWarning`" msgstr ":c:data:`PyExc_RuntimeWarning`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1104 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1106 msgid ":c:data:`PyExc_SyntaxWarning`" msgstr ":c:data:`PyExc_SyntaxWarning`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1106 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1108 msgid ":c:data:`PyExc_UnicodeWarning`" msgstr ":c:data:`PyExc_UnicodeWarning`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1108 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1090 +#: ../../c-api/exceptions.rst:1110 msgid ":c:data:`PyExc_UserWarning`" msgstr ":c:data:`PyExc_UserWarning`" -#: ../../c-api/exceptions.rst:1090 +#: ../../c-api/exceptions.rst:1110 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1093 +#: ../../c-api/exceptions.rst:1113 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`." -#: ../../c-api/exceptions.rst:1099 +#: ../../c-api/exceptions.rst:1119 msgid "This is a base class for other standard warning categories." msgstr "" + +#~ msgid "3.11" +#~ msgstr "3.11" diff --git a/c-api/float.po b/c-api/float.po index 4b365940b7..3e722bd2ce 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -95,3 +95,119 @@ msgstr "" msgid "" "Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`." msgstr "" + +#: ../../c-api/float.rst:82 +msgid "Pack and Unpack functions" +msgstr "" + +#: ../../c-api/float.rst:84 +msgid "" +"The pack and unpack functions provide an efficient platform-independent way " +"to store floating-point values as byte strings. The Pack routines produce a " +"bytes string from a C :c:expr:`double`, and the Unpack routines produce a C :" +"c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) specifies " +"the number of bytes in the bytes string." +msgstr "" + +#: ../../c-api/float.rst:90 +msgid "" +"On platforms that appear to use IEEE 754 formats these functions work by " +"copying bits. On other platforms, the 2-byte format is identical to the IEEE " +"754 binary16 half-precision format, the 4-byte format (32-bit) is identical " +"to the IEEE 754 binary32 single precision format, and the 8-byte format to " +"the IEEE 754 binary64 double precision format, although the packing of INFs " +"and NaNs (if such things exist on the platform) isn't handled correctly, and " +"attempting to unpack a bytes string containing an IEEE INF or NaN will raise " +"an exception." +msgstr "" + +#: ../../c-api/float.rst:99 +msgid "" +"On non-IEEE platforms with more precision, or larger dynamic range, than " +"IEEE 754 supports, not all values can be packed; on non-IEEE platforms with " +"less precision, or smaller dynamic range, not all values can be unpacked. " +"What happens in such cases is partly accidental (alas)." +msgstr "" + +#: ../../c-api/float.rst:107 +msgid "Pack functions" +msgstr "" + +#: ../../c-api/float.rst:109 +msgid "" +"The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an :c:expr:" +"`int` argument, non-zero if you want the bytes string in little-endian " +"format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero if you " +"want big-endian format (exponent first, at *p*). The :c:data:`PY_BIG_ENDIAN` " +"constant can be used to use the native endian: it is equal to ``1`` on big " +"endian processor, or ``0`` on little endian processor." +msgstr "" + +#: ../../c-api/float.rst:116 +msgid "" +"Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, " +"most likely :exc:`OverflowError`)." +msgstr "" + +#: ../../c-api/float.rst:119 +msgid "There are two problems on non-IEEE platforms:" +msgstr "" + +#: ../../c-api/float.rst:121 +msgid "What this does is undefined if *x* is a NaN or infinity." +msgstr "" + +#: ../../c-api/float.rst:122 +msgid "``-0.0`` and ``+0.0`` produce the same bytes string." +msgstr "" + +#: ../../c-api/float.rst:126 +msgid "Pack a C double as the IEEE 754 binary16 half-precision format." +msgstr "" + +#: ../../c-api/float.rst:130 +msgid "Pack a C double as the IEEE 754 binary32 single precision format." +msgstr "" + +#: ../../c-api/float.rst:134 +msgid "Pack a C double as the IEEE 754 binary64 double precision format." +msgstr "" + +#: ../../c-api/float.rst:138 +msgid "Unpack functions" +msgstr "" + +#: ../../c-api/float.rst:140 +msgid "" +"The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an :c:" +"expr:`int` argument, non-zero if the bytes string is in little-endian format " +"(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-" +"endian (exponent first, at *p*). The :c:data:`PY_BIG_ENDIAN` constant can be " +"used to use the native endian: it is equal to ``1`` on big endian processor, " +"or ``0`` on little endian processor." +msgstr "" + +#: ../../c-api/float.rst:147 +msgid "" +"Return value: The unpacked double. On error, this is ``-1.0`` and :c:func:" +"`PyErr_Occurred` is true (and an exception is set, most likely :exc:" +"`OverflowError`)." +msgstr "" + +#: ../../c-api/float.rst:151 +msgid "" +"Note that on a non-IEEE platform this will refuse to unpack a bytes string " +"that represents a NaN or infinity." +msgstr "" + +#: ../../c-api/float.rst:156 +msgid "Unpack the IEEE 754 binary16 half-precision format as a C double." +msgstr "" + +#: ../../c-api/float.rst:160 +msgid "Unpack the IEEE 754 binary32 single precision format as a C double." +msgstr "" + +#: ../../c-api/float.rst:164 +msgid "Unpack the IEEE 754 binary64 double precision format as a C double." +msgstr "" diff --git a/c-api/frame.po b/c-api/frame.po new file mode 100644 index 0000000000..a4ce337b94 --- /dev/null +++ b/c-api/frame.po @@ -0,0 +1,106 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/frame.rst:4 +msgid "Frame Objects" +msgstr "" + +#: ../../c-api/frame.rst:8 +msgid "The C structure of the objects used to describe frame objects." +msgstr "" + +#: ../../c-api/frame.rst:10 +msgid "There are no public members in this structure." +msgstr "" + +#: ../../c-api/frame.rst:12 +msgid "" +"The members of this structure were removed from the public C API. Refer to " +"the :ref:`What's New entry ` for details." +msgstr "" + +#: ../../c-api/frame.rst:17 +msgid "" +"The :c:func:`PyEval_GetFrame` and :c:func:`PyThreadState_GetFrame` functions " +"can be used to get a frame object." +msgstr "" + +#: ../../c-api/frame.rst:20 +msgid "See also :ref:`Reflection `." +msgstr "" + +#: ../../c-api/frame.rst:25 +msgid "Get the *frame* next outer frame." +msgstr "" + +#: ../../c-api/frame.rst:27 +msgid "" +"Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame." +msgstr "" + +#: ../../c-api/frame.rst:35 +msgid "Get the *frame*'s ``f_builtins`` attribute." +msgstr "" + +#: ../../c-api/frame.rst:37 ../../c-api/frame.rst:68 +msgid "Return a :term:`strong reference`. The result cannot be ``NULL``." +msgstr "" + +#: ../../c-api/frame.rst:44 +msgid "Get the *frame* code." +msgstr "" + +#: ../../c-api/frame.rst:46 ../../c-api/frame.rst:86 +msgid "Return a :term:`strong reference`." +msgstr "" + +#: ../../c-api/frame.rst:48 +msgid "The result (frame code) cannot be ``NULL``." +msgstr "" + +#: ../../c-api/frame.rst:55 +msgid "" +"Get the generator, coroutine, or async generator that owns this frame, or " +"``NULL`` if this frame is not owned by a generator. Does not raise an " +"exception, even if the return value is ``NULL``." +msgstr "" + +#: ../../c-api/frame.rst:59 +msgid "Return a :term:`strong reference`, or ``NULL``." +msgstr "" + +#: ../../c-api/frame.rst:66 +msgid "Get the *frame*'s ``f_globals`` attribute." +msgstr "" + +#: ../../c-api/frame.rst:75 +msgid "Get the *frame*'s ``f_lasti`` attribute." +msgstr "" + +#: ../../c-api/frame.rst:77 +msgid "Returns -1 if ``frame.f_lasti`` is ``None``." +msgstr "" + +#: ../../c-api/frame.rst:84 +msgid "Get the *frame*'s ``f_locals`` attribute (:class:`dict`)." +msgstr "" + +#: ../../c-api/frame.rst:93 +msgid "Return the line number that *frame* is currently executing." +msgstr "" diff --git a/c-api/function.po b/c-api/function.po index 959f12840c..00ac8fe8bd 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -58,45 +58,45 @@ msgid "" "The function's docstring and name are retrieved from the code object. " "*__module__* is retrieved from *globals*. The argument defaults, annotations " "and closure are set to ``NULL``. *__qualname__* is set to the same value as " -"the function's name." +"the code object's ``co_qualname`` field." msgstr "" -#: ../../c-api/function.rst:44 +#: ../../c-api/function.rst:45 msgid "" "As :c:func:`PyFunction_New`, but also allows setting the function object's " "``__qualname__`` attribute. *qualname* should be a unicode object or " "``NULL``; if ``NULL``, the ``__qualname__`` attribute is set to the same " -"value as its ``__name__`` attribute." +"value as the code object's ``co_qualname`` field." msgstr "" -#: ../../c-api/function.rst:54 +#: ../../c-api/function.rst:55 msgid "Return the code object associated with the function object *op*." msgstr "回傳與程式碼物件相關的函數物件 *op*\\ 。" -#: ../../c-api/function.rst:59 +#: ../../c-api/function.rst:60 msgid "Return the globals dictionary associated with the function object *op*." msgstr "回傳與全域函數字典相關的函數物件 *op*\\ 。" -#: ../../c-api/function.rst:64 +#: ../../c-api/function.rst:65 msgid "" "Return a :term:`borrowed reference` to the *__module__* attribute of the " "function object *op*. It can be *NULL*." msgstr "" -#: ../../c-api/function.rst:67 +#: ../../c-api/function.rst:68 msgid "" "This is normally a string containing the module name, but can be set to any " "other object by Python code." msgstr "" -#: ../../c-api/function.rst:73 +#: ../../c-api/function.rst:74 #, fuzzy msgid "" "Return the argument default values of the function object *op*. This can be " "a tuple of arguments or ``NULL``." msgstr "回傳函式物件 *op* 標註。此可以是一個可變動的字典或 *NULL*\\ 。" -#: ../../c-api/function.rst:79 +#: ../../c-api/function.rst:80 #, fuzzy msgid "" "Set the argument default values for the function object *op*. *defaults* " @@ -104,32 +104,32 @@ msgid "" msgstr "" "設定函數物件 *op* 的標註。\\ *annotations* 必須是一個字典或 *Py_None*\\ 。" -#: ../../c-api/function.rst:82 ../../c-api/function.rst:96 -#: ../../c-api/function.rst:110 +#: ../../c-api/function.rst:83 ../../c-api/function.rst:97 +#: ../../c-api/function.rst:111 msgid "Raises :exc:`SystemError` and returns ``-1`` on failure." msgstr "" -#: ../../c-api/function.rst:87 +#: ../../c-api/function.rst:88 #, fuzzy msgid "" "Return the closure associated with the function object *op*. This can be " "``NULL`` or a tuple of cell objects." msgstr "回傳與程式碼物件相關的函數物件 *op*\\ 。" -#: ../../c-api/function.rst:93 +#: ../../c-api/function.rst:94 msgid "" "Set the closure associated with the function object *op*. *closure* must be " "``Py_None`` or a tuple of cell objects." msgstr "" -#: ../../c-api/function.rst:101 +#: ../../c-api/function.rst:102 #, fuzzy msgid "" "Return the annotations of the function object *op*. This can be a mutable " "dictionary or ``NULL``." msgstr "回傳函式物件 *op* 標註。此可以是一個可變動的字典或 *NULL*\\ 。" -#: ../../c-api/function.rst:107 +#: ../../c-api/function.rst:108 #, fuzzy msgid "" "Set the annotations for the function object *op*. *annotations* must be a " diff --git a/c-api/import.po b/c-api/import.po index f91d640aed..164542d5ad 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -275,7 +275,13 @@ msgid "" "h`, is::" msgstr "" -#: ../../c-api/import.rst:264 +#: ../../c-api/import.rst:262 +msgid "" +"The new ``is_package`` field indicates whether the module is a package or " +"not. This replaces setting the ``size`` field to a negative value." +msgstr "" + +#: ../../c-api/import.rst:268 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -284,7 +290,7 @@ msgid "" "frozen modules." msgstr "" -#: ../../c-api/import.rst:272 +#: ../../c-api/import.rst:276 msgid "" "Add a single module to the existing table of built-in modules. This is a " "convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning " @@ -294,7 +300,7 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/import.rst:282 +#: ../../c-api/import.rst:286 msgid "" "Structure describing a single entry in the list of built-in modules. Each " "of these structures gives the name and initialization function for a module " @@ -304,7 +310,7 @@ msgid "" "structure is defined in :file:`Include/import.h` as::" msgstr "" -#: ../../c-api/import.rst:297 +#: ../../c-api/import.rst:301 msgid "" "Add a collection of modules to the table of built-in modules. The *newtab* " "array must end with a sentinel entry which contains ``NULL`` for the :attr:" @@ -315,7 +321,7 @@ msgid "" "`Py_Initialize`." msgstr "" -#: ../../c-api/import.rst:304 +#: ../../c-api/import.rst:308 msgid "" "If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " "or :c:func:`PyImport_ExtendInittab` must be called before each Python " diff --git a/c-api/init.po b/c-api/init.po index 46d04b813d..c1af4d43c7 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -233,7 +233,7 @@ msgid "" msgstr "" #: ../../c-api/init.rst:113 -msgid "Private flag used by ``_freeze_importlib`` and ``frozenmain`` programs." +msgid "Private flag used by ``_freeze_module`` and ``frozenmain`` programs." msgstr "" #: ../../c-api/init.rst:117 @@ -482,42 +482,56 @@ msgstr "" #: ../../c-api/init.rst:326 msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"stdio_encoding` and :c:member:`PyConfig.stdio_errors` should be used " +"instead, see :ref:`Python Initialization Configuration `." +msgstr "" + +#: ../../c-api/init.rst:331 +msgid "" "This function should be called before :c:func:`Py_Initialize`, if it is " "called at all. It specifies which encoding and error handling to use with " "standard IO, with the same meanings as in :func:`str.encode`." msgstr "" -#: ../../c-api/init.rst:330 +#: ../../c-api/init.rst:335 msgid "" "It overrides :envvar:`PYTHONIOENCODING` values, and allows embedding code to " "control IO encoding when the environment variable does not work." msgstr "" -#: ../../c-api/init.rst:333 +#: ../../c-api/init.rst:338 msgid "" "*encoding* and/or *errors* may be ``NULL`` to use :envvar:`PYTHONIOENCODING` " "and/or default values (depending on other settings)." msgstr "" -#: ../../c-api/init.rst:337 +#: ../../c-api/init.rst:342 msgid "" "Note that :data:`sys.stderr` always uses the \"backslashreplace\" error " "handler, regardless of this (or any other) setting." msgstr "" -#: ../../c-api/init.rst:340 +#: ../../c-api/init.rst:345 msgid "" "If :c:func:`Py_FinalizeEx` is called, this function will need to be called " "again in order to affect subsequent calls to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:343 +#: ../../c-api/init.rst:348 msgid "" "Returns ``0`` if successful, a nonzero value on error (e.g. calling after " "the interpreter has already been initialized)." msgstr "" -#: ../../c-api/init.rst:356 +#: ../../c-api/init.rst:363 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"program_name` should be used instead, see :ref:`Python Initialization " +"Configuration `." +msgstr "" + +#: ../../c-api/init.rst:367 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -531,33 +545,33 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:367 ../../c-api/init.rst:511 ../../c-api/init.rst:617 -#: ../../c-api/init.rst:644 ../../c-api/init.rst:661 +#: ../../c-api/init.rst:378 ../../c-api/init.rst:529 ../../c-api/init.rst:644 +#: ../../c-api/init.rst:680 ../../c-api/init.rst:706 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:375 +#: ../../c-api/init.rst:388 msgid "" "Return the program name set with :c:func:`Py_SetProgramName`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:379 ../../c-api/init.rst:398 ../../c-api/init.rst:439 -#: ../../c-api/init.rst:458 ../../c-api/init.rst:482 ../../c-api/init.rst:671 +#: ../../c-api/init.rst:392 ../../c-api/init.rst:411 ../../c-api/init.rst:452 +#: ../../c-api/init.rst:471 ../../c-api/init.rst:495 ../../c-api/init.rst:718 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "" -#: ../../c-api/init.rst:382 ../../c-api/init.rst:401 ../../c-api/init.rst:442 -#: ../../c-api/init.rst:461 ../../c-api/init.rst:487 ../../c-api/init.rst:674 +#: ../../c-api/init.rst:395 ../../c-api/init.rst:414 ../../c-api/init.rst:455 +#: ../../c-api/init.rst:474 ../../c-api/init.rst:500 ../../c-api/init.rst:721 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:388 +#: ../../c-api/init.rst:401 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -571,7 +585,7 @@ msgid "" "function." msgstr "" -#: ../../c-api/init.rst:407 +#: ../../c-api/init.rst:420 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -585,7 +599,7 @@ msgid "" "on Unix." msgstr "" -#: ../../c-api/init.rst:417 +#: ../../c-api/init.rst:430 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -594,7 +608,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:423 +#: ../../c-api/init.rst:436 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -608,7 +622,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:434 +#: ../../c-api/init.rst:447 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -616,7 +630,7 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:452 +#: ../../c-api/init.rst:465 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -625,7 +639,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:472 +#: ../../c-api/init.rst:485 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:func:`Py_SetProgramName` above) and some environment " @@ -638,7 +652,15 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:498 +#: ../../c-api/init.rst:511 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " +"be used instead, see :ref:`Python Initialization Configuration `." +msgstr "" + +#: ../../c-api/init.rst:516 msgid "" "Set the default module search path. If this function is called before :c:" "func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a " @@ -649,7 +671,7 @@ msgid "" "on Windows." msgstr "" -#: ../../c-api/init.rst:506 +#: ../../c-api/init.rst:524 msgid "" "This also causes :data:`sys.executable` to be set to the program full path " "(see :c:func:`Py_GetProgramFullPath`) and for :data:`sys.prefix` and :data:" @@ -657,25 +679,25 @@ msgid "" "required after calling :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:514 +#: ../../c-api/init.rst:532 msgid "" "The path argument is copied internally, so the caller may free it after the " "call completes." msgstr "" -#: ../../c-api/init.rst:517 +#: ../../c-api/init.rst:535 msgid "" "The program full path is now used for :data:`sys.executable`, instead of the " "program name." msgstr "" -#: ../../c-api/init.rst:524 +#: ../../c-api/init.rst:544 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:531 +#: ../../c-api/init.rst:551 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -684,7 +706,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:541 +#: ../../c-api/init.rst:556 +msgid "See also the :c:var:`Py_Version` constant." +msgstr "" + +#: ../../c-api/init.rst:563 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -695,42 +721,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:552 +#: ../../c-api/init.rst:574 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:554 +#: ../../c-api/init.rst:576 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:558 +#: ../../c-api/init.rst:580 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:564 +#: ../../c-api/init.rst:586 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:571 ../../c-api/init.rst:585 +#: ../../c-api/init.rst:593 ../../c-api/init.rst:607 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:578 +#: ../../c-api/init.rst:600 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:597 +#: ../../c-api/init.rst:619 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " +"should be used instead, see :ref:`Python Initialization Configuration `." +msgstr "" + +#: ../../c-api/init.rst:624 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -741,28 +775,34 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:605 +#: ../../c-api/init.rst:632 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:609 +#: ../../c-api/init.rst:636 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:612 +#: ../../c-api/init.rst:639 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:621 +#: ../../c-api/init.rst:647 ../../c-api/init.rst:683 +msgid "" +"See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " +"members of the :ref:`Python Initialization Configuration `." +msgstr "" + +#: ../../c-api/init.rst:651 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " @@ -770,32 +810,46 @@ msgid "" "`_." msgstr "" -#: ../../c-api/init.rst:626 +#: ../../c-api/init.rst:656 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:640 +#: ../../c-api/init.rst:672 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" +"`Python Initialization Configuration `." +msgstr "" + +#: ../../c-api/init.rst:676 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:647 +#: ../../c-api/init.rst:686 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:652 +#: ../../c-api/init.rst:693 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"home` should be used instead, see :ref:`Python Initialization Configuration " +"`." +msgstr "" + +#: ../../c-api/init.rst:697 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:656 +#: ../../c-api/init.rst:701 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -803,18 +857,18 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:667 +#: ../../c-api/init.rst:714 msgid "" "Return the default \"home\", that is, the value set by a previous call to :c:" "func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` " "environment variable if it is set." msgstr "" -#: ../../c-api/init.rst:681 +#: ../../c-api/init.rst:728 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:688 +#: ../../c-api/init.rst:735 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -826,7 +880,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:698 +#: ../../c-api/init.rst:745 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -836,7 +890,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:709 +#: ../../c-api/init.rst:756 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -844,32 +898,32 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:715 +#: ../../c-api/init.rst:762 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:717 +#: ../../c-api/init.rst:764 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:726 +#: ../../c-api/init.rst:773 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:736 +#: ../../c-api/init.rst:783 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:740 +#: ../../c-api/init.rst:787 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:752 +#: ../../c-api/init.rst:799 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -880,7 +934,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:761 +#: ../../c-api/init.rst:808 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -890,11 +944,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:772 +#: ../../c-api/init.rst:819 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:774 +#: ../../c-api/init.rst:821 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -904,7 +958,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:781 +#: ../../c-api/init.rst:828 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -915,14 +969,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:789 +#: ../../c-api/init.rst:836 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:803 +#: ../../c-api/init.rst:850 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -931,11 +985,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:813 +#: ../../c-api/init.rst:860 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:815 +#: ../../c-api/init.rst:862 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -944,7 +998,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:821 +#: ../../c-api/init.rst:868 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -961,7 +1015,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:836 +#: ../../c-api/init.rst:883 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -974,17 +1028,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:849 +#: ../../c-api/init.rst:896 msgid "High-level API" msgstr "" -#: ../../c-api/init.rst:851 +#: ../../c-api/init.rst:898 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:856 +#: ../../c-api/init.rst:903 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -992,7 +1046,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:861 +#: ../../c-api/init.rst:908 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1000,49 +1054,49 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:869 +#: ../../c-api/init.rst:916 msgid "" "This data structure represents the state of a single thread. The only " "public data member is :attr:`interp` (:c:expr:`PyInterpreterState *`), which " "points to this thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:882 +#: ../../c-api/init.rst:929 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:884 +#: ../../c-api/init.rst:931 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:886 +#: ../../c-api/init.rst:933 msgid "The function now does nothing." msgstr "" -#: ../../c-api/init.rst:889 +#: ../../c-api/init.rst:936 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:893 +#: ../../c-api/init.rst:940 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:903 +#: ../../c-api/init.rst:950 msgid "" "Returns a non-zero value if :c:func:`PyEval_InitThreads` has been called. " "This function can be called without holding the GIL, and therefore can be " "used to avoid calls to the locking API when running single-threaded." msgstr "" -#: ../../c-api/init.rst:907 +#: ../../c-api/init.rst:954 msgid "The :term:`GIL` is now initialized by :c:func:`Py_Initialize()`." msgstr "" -#: ../../c-api/init.rst:915 +#: ../../c-api/init.rst:962 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1050,7 +1104,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:923 +#: ../../c-api/init.rst:970 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1058,8 +1112,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:929 ../../c-api/init.rst:975 ../../c-api/init.rst:1234 -#: ../../c-api/init.rst:1272 +#: ../../c-api/init.rst:976 ../../c-api/init.rst:1022 ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1342 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1068,27 +1122,27 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:937 +#: ../../c-api/init.rst:984 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:944 +#: ../../c-api/init.rst:991 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:949 +#: ../../c-api/init.rst:996 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:954 +#: ../../c-api/init.rst:1001 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1101,7 +1155,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:964 +#: ../../c-api/init.rst:1011 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1111,13 +1165,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:971 +#: ../../c-api/init.rst:1018 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:1030 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1125,13 +1179,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:988 +#: ../../c-api/init.rst:1035 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:994 +#: ../../c-api/init.rst:1041 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1139,7 +1193,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1002 +#: ../../c-api/init.rst:1049 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1150,13 +1204,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1014 +#: ../../c-api/init.rst:1061 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1020 +#: ../../c-api/init.rst:1067 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1164,7 +1218,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1028 +#: ../../c-api/init.rst:1075 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1172,91 +1226,91 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1036 +#: ../../c-api/init.rst:1083 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1042 +#: ../../c-api/init.rst:1089 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1048 +#: ../../c-api/init.rst:1095 msgid "Low-level API" msgstr "" -#: ../../c-api/init.rst:1050 +#: ../../c-api/init.rst:1097 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1052 +#: ../../c-api/init.rst:1099 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1058 +#: ../../c-api/init.rst:1105 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1062 +#: ../../c-api/init.rst:1109 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." msgstr "" -#: ../../c-api/init.rst:1067 +#: ../../c-api/init.rst:1114 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1070 +#: ../../c-api/init.rst:1117 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." msgstr "" -#: ../../c-api/init.rst:1075 +#: ../../c-api/init.rst:1122 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1082 +#: ../../c-api/init.rst:1129 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1089 +#: ../../c-api/init.rst:1136 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1092 +#: ../../c-api/init.rst:1139 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1099 +#: ../../c-api/init.rst:1146 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1106 +#: ../../c-api/init.rst:1153 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " @@ -1264,94 +1318,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1161 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1116 +#: ../../c-api/init.rst:1163 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1119 +#: ../../c-api/init.rst:1166 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`\\ 。" -#: ../../c-api/init.rst:1121 ../../c-api/init.rst:1130 -#: ../../c-api/init.rst:1139 +#: ../../c-api/init.rst:1168 ../../c-api/init.rst:1177 +#: ../../c-api/init.rst:1186 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1128 +#: ../../c-api/init.rst:1175 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1137 +#: ../../c-api/init.rst:1184 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1146 +#: ../../c-api/init.rst:1193 +msgid "Suspend tracing and profiling in the Python thread state *tstate*." +msgstr "" + +#: ../../c-api/init.rst:1195 +msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." +msgstr "" + +#: ../../c-api/init.rst:1202 +msgid "" +"Resume tracing and profiling in the Python thread state *tstate* suspended " +"by the :c:func:`PyThreadState_EnterTracing` function." +msgstr "" + +#: ../../c-api/init.rst:1205 +msgid "" +"See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." +msgstr "" + +#: ../../c-api/init.rst:1213 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1148 +#: ../../c-api/init.rst:1215 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1151 ../../c-api/init.rst:1161 +#: ../../c-api/init.rst:1218 ../../c-api/init.rst:1228 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1158 +#: ../../c-api/init.rst:1225 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1168 +#: ../../c-api/init.rst:1235 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1172 +#: ../../c-api/init.rst:1239 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1179 +#: ../../c-api/init.rst:1246 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1181 +#: ../../c-api/init.rst:1248 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1184 +#: ../../c-api/init.rst:1251 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1189 +#: ../../c-api/init.rst:1254 +msgid "" +"The *frame* parameter changed from ``PyFrameObject*`` to " +"``_PyInterpreterFrame*``." +msgstr "" + +#: ../../c-api/init.rst:1259 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1191 ../../c-api/init.rst:1199 +#: ../../c-api/init.rst:1261 ../../c-api/init.rst:1269 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1197 +#: ../../c-api/init.rst:1267 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1206 +#: ../../c-api/init.rst:1276 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1360,7 +1439,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1215 +#: ../../c-api/init.rst:1285 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1372,33 +1451,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1223 +#: ../../c-api/init.rst:1293 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1229 +#: ../../c-api/init.rst:1299 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1240 ../../c-api/init.rst:1278 +#: ../../c-api/init.rst:1310 ../../c-api/init.rst:1348 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1245 +#: ../../c-api/init.rst:1315 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1251 +#: ../../c-api/init.rst:1321 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1407,41 +1486,41 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1257 +#: ../../c-api/init.rst:1327 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1263 +#: ../../c-api/init.rst:1333 msgid "" "Acquire the global interpreter lock. The lock must have been created " "earlier. If this thread already has the lock, a deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1266 +#: ../../c-api/init.rst:1336 msgid "" "This function does not update the current thread state. Please use :c:func:" "`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead." msgstr "" -#: ../../c-api/init.rst:1286 +#: ../../c-api/init.rst:1356 msgid "" "Release the global interpreter lock. The lock must have been created " "earlier." msgstr "" -#: ../../c-api/init.rst:1288 +#: ../../c-api/init.rst:1358 msgid "" "This function does not update the current thread state. Please use :c:func:" "`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead." msgstr "" -#: ../../c-api/init.rst:1297 +#: ../../c-api/init.rst:1367 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1299 +#: ../../c-api/init.rst:1369 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1449,7 +1528,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1374 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1460,14 +1539,14 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1381 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1325 +#: ../../c-api/init.rst:1395 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1480,7 +1559,7 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1335 +#: ../../c-api/init.rst:1405 msgid "" "The return value points to the first thread state created in the new sub-" "interpreter. This thread state is made in the current thread state. Note " @@ -1494,11 +1573,11 @@ msgid "" "state on entry.)" msgstr "" -#: ../../c-api/init.rst:1350 +#: ../../c-api/init.rst:1420 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1352 +#: ../../c-api/init.rst:1422 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -1506,7 +1585,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1358 +#: ../../c-api/init.rst:1428 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -1518,7 +1597,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1369 +#: ../../c-api/init.rst:1439 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -1528,7 +1607,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1383 +#: ../../c-api/init.rst:1453 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -1540,11 +1619,11 @@ msgid "" "point." msgstr "" -#: ../../c-api/init.rst:1393 +#: ../../c-api/init.rst:1463 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1395 +#: ../../c-api/init.rst:1465 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -1557,7 +1636,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1405 +#: ../../c-api/init.rst:1475 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -1566,7 +1645,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1411 +#: ../../c-api/init.rst:1481 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -1578,25 +1657,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1422 +#: ../../c-api/init.rst:1492 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1424 +#: ../../c-api/init.rst:1494 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1433 +#: ../../c-api/init.rst:1503 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1437 +#: ../../c-api/init.rst:1507 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -1604,17 +1683,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1442 +#: ../../c-api/init.rst:1512 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1513 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1446 +#: ../../c-api/init.rst:1516 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -1622,20 +1701,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1451 +#: ../../c-api/init.rst:1521 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1454 +#: ../../c-api/init.rst:1524 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1459 +#: ../../c-api/init.rst:1529 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -1645,7 +1724,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1466 +#: ../../c-api/init.rst:1536 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -1653,18 +1732,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1477 +#: ../../c-api/init.rst:1547 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1482 +#: ../../c-api/init.rst:1552 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1486 +#: ../../c-api/init.rst:1556 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -1674,7 +1753,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1496 +#: ../../c-api/init.rst:1566 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -1685,66 +1764,66 @@ msgid "" "or :const:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1575 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1575 msgid "Meaning of *arg*" msgstr "" -#: ../../c-api/init.rst:1507 +#: ../../c-api/init.rst:1577 msgid ":const:`PyTrace_CALL`" msgstr ":const:`PyTrace_CALL`" -#: ../../c-api/init.rst:1507 ../../c-api/init.rst:1512 -#: ../../c-api/init.rst:1523 +#: ../../c-api/init.rst:1577 ../../c-api/init.rst:1582 +#: ../../c-api/init.rst:1593 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1509 +#: ../../c-api/init.rst:1579 msgid ":const:`PyTrace_EXCEPTION`" msgstr ":const:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1509 +#: ../../c-api/init.rst:1579 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1512 +#: ../../c-api/init.rst:1582 msgid ":const:`PyTrace_LINE`" msgstr ":const:`PyTrace_LINE`" -#: ../../c-api/init.rst:1514 +#: ../../c-api/init.rst:1584 msgid ":const:`PyTrace_RETURN`" msgstr ":const:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1514 +#: ../../c-api/init.rst:1584 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1517 +#: ../../c-api/init.rst:1587 msgid ":const:`PyTrace_C_CALL`" msgstr ":const:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1517 ../../c-api/init.rst:1519 -#: ../../c-api/init.rst:1521 +#: ../../c-api/init.rst:1587 ../../c-api/init.rst:1589 +#: ../../c-api/init.rst:1591 msgid "Function object being called." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1589 msgid ":const:`PyTrace_C_EXCEPTION`" msgstr ":const:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1521 +#: ../../c-api/init.rst:1591 msgid ":const:`PyTrace_C_RETURN`" msgstr ":const:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1523 +#: ../../c-api/init.rst:1593 msgid ":const:`PyTrace_OPCODE`" msgstr ":const:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1528 +#: ../../c-api/init.rst:1598 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -1753,7 +1832,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1537 +#: ../../c-api/init.rst:1607 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -1765,7 +1844,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1548 +#: ../../c-api/init.rst:1618 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -1773,31 +1852,31 @@ msgid "" "*0* on that frame." msgstr "" -#: ../../c-api/init.rst:1555 +#: ../../c-api/init.rst:1625 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1561 +#: ../../c-api/init.rst:1631 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1567 +#: ../../c-api/init.rst:1637 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1573 +#: ../../c-api/init.rst:1643 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1579 +#: ../../c-api/init.rst:1649 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -1805,7 +1884,7 @@ msgid "" "attr:`f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1587 +#: ../../c-api/init.rst:1657 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -1815,11 +1894,15 @@ msgid "" "`PyTrace_LINE` :const:`PyTrace_OPCODE` and :const:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1606 +#: ../../c-api/init.rst:1664 +msgid "See also the :func:`sys.setprofile` function." +msgstr "" + +#: ../../c-api/init.rst:1666 ../../c-api/init.rst:1680 msgid "The caller must hold the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1599 +#: ../../c-api/init.rst:1671 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -1830,48 +1913,52 @@ msgid "" "parameter." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1678 +msgid "See also the :func:`sys.settrace` function." +msgstr "也請見 :func:`sys.settrace` 函式。" + +#: ../../c-api/init.rst:1686 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:1617 +#: ../../c-api/init.rst:1691 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:1622 +#: ../../c-api/init.rst:1696 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:1627 +#: ../../c-api/init.rst:1701 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:1632 +#: ../../c-api/init.rst:1706 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:1638 +#: ../../c-api/init.rst:1712 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:1644 +#: ../../c-api/init.rst:1718 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:1651 +#: ../../c-api/init.rst:1725 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:1655 +#: ../../c-api/init.rst:1729 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -1881,19 +1968,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:1662 +#: ../../c-api/init.rst:1736 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:1665 +#: ../../c-api/init.rst:1739 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:1669 +#: ../../c-api/init.rst:1743 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -1901,22 +1988,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1751 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1753 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:1685 +#: ../../c-api/init.rst:1759 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:1690 +#: ../../c-api/init.rst:1764 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -1924,52 +2011,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:1695 +#: ../../c-api/init.rst:1769 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:1701 +#: ../../c-api/init.rst:1775 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:1706 +#: ../../c-api/init.rst:1780 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1782 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1789 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1796 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is `NULL`." msgstr "" -#: ../../c-api/init.rst:1728 +#: ../../c-api/init.rst:1802 msgid "" "A freed key becomes a dangling pointer. You should reset the key to `NULL`." msgstr "" -#: ../../c-api/init.rst:1733 +#: ../../c-api/init.rst:1807 msgid "Methods" msgstr "" -#: ../../c-api/init.rst:1735 +#: ../../c-api/init.rst:1809 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -1977,13 +2064,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:1743 +#: ../../c-api/init.rst:1817 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:1749 +#: ../../c-api/init.rst:1823 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -1992,7 +2079,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:1758 +#: ../../c-api/init.rst:1832 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2001,31 +2088,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:1767 +#: ../../c-api/init.rst:1841 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:1774 +#: ../../c-api/init.rst:1848 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:1782 +#: ../../c-api/init.rst:1856 msgid "Thread Local Storage (TLS) API" msgstr "" -#: ../../c-api/init.rst:1784 +#: ../../c-api/init.rst:1858 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:1789 +#: ../../c-api/init.rst:1863 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2034,7 +2121,7 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:1794 +#: ../../c-api/init.rst:1868 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." diff --git a/c-api/init_config.po b/c-api/init_config.po index 8a189cdd29..8d85419a05 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-10 00:16+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -109,11 +109,11 @@ msgid "" msgstr "" #: ../../c-api/init_config.rst:100 -msgid "*index* must be greater than or equal to 0." +msgid "*index* must be greater than or equal to ``0``." msgstr "" #: ../../c-api/init_config.rst:104 ../../c-api/init_config.rst:124 -#: ../../c-api/init_config.rst:225 ../../c-api/init_config.rst:519 +#: ../../c-api/init_config.rst:225 ../../c-api/init_config.rst:530 msgid "Structure fields:" msgstr "" @@ -301,8 +301,8 @@ msgstr "" #: ../../c-api/init_config.rst:259 msgid "" -"If equals to 0, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:member:" -"`~PyPreConfig.coerce_c_locale_warn` members to 0." +"If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:" +"member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" #: ../../c-api/init_config.rst:262 ../../c-api/init_config.rst:273 @@ -310,17 +310,18 @@ msgid "See the :term:`locale encoding`." msgstr "請見 :term:`locale encoding`\\ 。" #: ../../c-api/init_config.rst:264 ../../c-api/init_config.rst:319 -#: ../../c-api/init_config.rst:627 +#: ../../c-api/init_config.rst:670 msgid "Default: ``1`` in Python config, ``0`` in isolated config." msgstr "" #: ../../c-api/init_config.rst:268 -msgid "If equals to 2, coerce the C locale." +msgid "If equals to ``2``, coerce the C locale." msgstr "" #: ../../c-api/init_config.rst:270 msgid "" -"If equals to 1, read the LC_CTYPE locale to decide if it should be coerced." +"If equals to ``1``, read the LC_CTYPE locale to decide if it should be " +"coerced." msgstr "" #: ../../c-api/init_config.rst:275 ../../c-api/init_config.rst:281 @@ -333,12 +334,11 @@ msgstr "" #: ../../c-api/init_config.rst:285 msgid "" -"If non-zero, enables the :ref:`Python Development Mode `: see :c:" -"member:`PyConfig.dev_mode`." +":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" -#: ../../c-api/init_config.rst:288 ../../c-api/init_config.rst:633 -#: ../../c-api/init_config.rst:675 ../../c-api/init_config.rst:1093 +#: ../../c-api/init_config.rst:288 ../../c-api/init_config.rst:679 +#: ../../c-api/init_config.rst:721 ../../c-api/init_config.rst:1150 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" @@ -346,7 +346,7 @@ msgstr "" msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:294 ../../c-api/init_config.rst:797 +#: ../../c-api/init_config.rst:294 ../../c-api/init_config.rst:846 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." msgstr "" @@ -372,20 +372,20 @@ msgid "" "variable value." msgstr "" -#: ../../c-api/init_config.rst:307 ../../c-api/init_config.rst:810 +#: ../../c-api/init_config.rst:307 ../../c-api/init_config.rst:859 msgid "" "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " "Windows specific code." msgstr "" -#: ../../c-api/init_config.rst:310 ../../c-api/init_config.rst:588 -#: ../../c-api/init_config.rst:595 ../../c-api/init_config.rst:646 -#: ../../c-api/init_config.rst:755 ../../c-api/init_config.rst:769 -#: ../../c-api/init_config.rst:783 ../../c-api/init_config.rst:813 -#: ../../c-api/init_config.rst:827 ../../c-api/init_config.rst:880 -#: ../../c-api/init_config.rst:929 ../../c-api/init_config.rst:989 -#: ../../c-api/init_config.rst:1028 ../../c-api/init_config.rst:1057 -#: ../../c-api/init_config.rst:1128 +#: ../../c-api/init_config.rst:310 ../../c-api/init_config.rst:618 +#: ../../c-api/init_config.rst:625 ../../c-api/init_config.rst:692 +#: ../../c-api/init_config.rst:801 ../../c-api/init_config.rst:815 +#: ../../c-api/init_config.rst:829 ../../c-api/init_config.rst:862 +#: ../../c-api/init_config.rst:876 ../../c-api/init_config.rst:936 +#: ../../c-api/init_config.rst:985 ../../c-api/init_config.rst:1045 +#: ../../c-api/init_config.rst:1085 ../../c-api/init_config.rst:1114 +#: ../../c-api/init_config.rst:1187 msgid "Default: ``0``." msgstr "預設:\\ ``0``。" @@ -403,7 +403,7 @@ msgid "" "use_environment`." msgstr "" -#: ../../c-api/init_config.rst:326 ../../c-api/init_config.rst:1102 +#: ../../c-api/init_config.rst:326 ../../c-api/init_config.rst:1161 msgid "Default: ``1`` in Python config and ``0`` in isolated config." msgstr "" @@ -413,75 +413,79 @@ msgstr "" #: ../../c-api/init_config.rst:332 msgid "" -"Set by the :option:`-X utf8 <-X>` command line option and the :envvar:" -"`PYTHONUTF8` environment variable." +"Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " +"the :envvar:`PYTHONUTF8` environment variable." msgstr "" #: ../../c-api/init_config.rst:335 +msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." +msgstr "" + +#: ../../c-api/init_config.rst:337 msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:341 +#: ../../c-api/init_config.rst:343 msgid "Preinitialize Python with PyPreConfig" msgstr "" -#: ../../c-api/init_config.rst:343 +#: ../../c-api/init_config.rst:345 msgid "The preinitialization of Python:" msgstr "" -#: ../../c-api/init_config.rst:345 +#: ../../c-api/init_config.rst:347 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" -#: ../../c-api/init_config.rst:346 +#: ../../c-api/init_config.rst:348 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" -#: ../../c-api/init_config.rst:347 +#: ../../c-api/init_config.rst:349 msgid "" "Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig." "utf8_mode`)" msgstr "" -#: ../../c-api/init_config.rst:350 +#: ../../c-api/init_config.rst:352 msgid "" "The current preconfiguration (``PyPreConfig`` type) is stored in " "``_PyRuntime.preconfig``." msgstr "" -#: ../../c-api/init_config.rst:353 +#: ../../c-api/init_config.rst:355 msgid "Functions to preinitialize Python:" msgstr "" -#: ../../c-api/init_config.rst:357 ../../c-api/init_config.rst:363 -#: ../../c-api/init_config.rst:372 +#: ../../c-api/init_config.rst:359 ../../c-api/init_config.rst:365 +#: ../../c-api/init_config.rst:374 msgid "Preinitialize Python from *preconfig* preconfiguration." msgstr "" -#: ../../c-api/init_config.rst:359 ../../c-api/init_config.rst:368 -#: ../../c-api/init_config.rst:377 +#: ../../c-api/init_config.rst:361 ../../c-api/init_config.rst:370 +#: ../../c-api/init_config.rst:379 msgid "*preconfig* must not be ``NULL``." msgstr "*preconfig* 不可為 ``NULL``。" -#: ../../c-api/init_config.rst:365 +#: ../../c-api/init_config.rst:367 msgid "" "Parse *argv* command line arguments (bytes strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:374 +#: ../../c-api/init_config.rst:376 msgid "" "Parse *argv* command line arguments (wide strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:379 ../../c-api/init_config.rst:1190 +#: ../../c-api/init_config.rst:381 ../../c-api/init_config.rst:1249 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" -#: ../../c-api/init_config.rst:382 +#: ../../c-api/init_config.rst:384 msgid "" "For :ref:`Python Configuration ` (:c:func:" "`PyPreConfig_InitPythonConfig`), if Python is initialized with command line " @@ -491,7 +495,7 @@ msgid "" "`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:389 +#: ../../c-api/init_config.rst:391 msgid "" "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " "before :c:func:`Py_InitializeFromConfig` to install a custom memory " @@ -499,7 +503,7 @@ msgid "" "`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -#: ../../c-api/init_config.rst:394 +#: ../../c-api/init_config.rst:396 msgid "" "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " "be used before the Python preinitialization, whereas calling directly " @@ -507,84 +511,90 @@ msgid "" "not be called before the Python preinitialization." msgstr "" -#: ../../c-api/init_config.rst:399 +#: ../../c-api/init_config.rst:401 msgid "" "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " "`::" msgstr "" -#: ../../c-api/init_config.rst:421 +#: ../../c-api/init_config.rst:423 msgid "PyConfig" msgstr "PyConfig" -#: ../../c-api/init_config.rst:425 +#: ../../c-api/init_config.rst:427 msgid "Structure containing most parameters to configure Python." msgstr "" -#: ../../c-api/init_config.rst:427 +#: ../../c-api/init_config.rst:429 msgid "" "When done, the :c:func:`PyConfig_Clear` function must be used to release the " "configuration memory." msgstr "" -#: ../../c-api/init_config.rst:430 +#: ../../c-api/init_config.rst:432 msgid "Structure methods:" msgstr "" -#: ../../c-api/init_config.rst:434 +#: ../../c-api/init_config.rst:436 msgid "" "Initialize configuration with the :ref:`Python Configuration `." msgstr "" -#: ../../c-api/init_config.rst:439 +#: ../../c-api/init_config.rst:441 msgid "" "Initialize configuration with the :ref:`Isolated Configuration `." msgstr "" -#: ../../c-api/init_config.rst:444 +#: ../../c-api/init_config.rst:446 msgid "Copy the wide character string *str* into ``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:446 ../../c-api/init_config.rst:453 -#: ../../c-api/init_config.rst:460 ../../c-api/init_config.rst:468 -#: ../../c-api/init_config.rst:474 ../../c-api/init_config.rst:488 +#: ../../c-api/init_config.rst:448 ../../c-api/init_config.rst:455 +#: ../../c-api/init_config.rst:462 ../../c-api/init_config.rst:470 +#: ../../c-api/init_config.rst:476 ../../c-api/init_config.rst:493 msgid ":ref:`Preinitialize Python ` if needed." msgstr "" -#: ../../c-api/init_config.rst:450 +#: ../../c-api/init_config.rst:452 msgid "" "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " "``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:457 +#: ../../c-api/init_config.rst:459 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of wide character strings." msgstr "" -#: ../../c-api/init_config.rst:464 +#: ../../c-api/init_config.rst:466 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of bytes strings. Decode bytes using :c:func:" "`Py_DecodeLocale`." msgstr "" -#: ../../c-api/init_config.rst:472 +#: ../../c-api/init_config.rst:474 msgid "Set the list of wide strings *list* to *length* and *items*." msgstr "" -#: ../../c-api/init_config.rst:478 +#: ../../c-api/init_config.rst:480 msgid "Read all Python configuration." msgstr "" -#: ../../c-api/init_config.rst:480 +#: ../../c-api/init_config.rst:482 msgid "Fields which are already initialized are left unchanged." msgstr "" -#: ../../c-api/init_config.rst:482 ../../c-api/init_config.rst:909 +#: ../../c-api/init_config.rst:484 +msgid "" +"Fields for :ref:`path configuration ` are no longer " +"calculated or modified when calling this function, as of Python 3.11." +msgstr "" + +#: ../../c-api/init_config.rst:487 ../../c-api/init_config.rst:965 msgid "" "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " "arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " @@ -593,18 +603,25 @@ msgid "" "as Python options." msgstr "" -#: ../../c-api/init_config.rst:490 +#: ../../c-api/init_config.rst:495 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:" "`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and " "arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." msgstr "" -#: ../../c-api/init_config.rst:498 +#: ../../c-api/init_config.rst:501 +msgid "" +":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " +"under :ref:`Python Path Configuration ` may no longer be " +"updated until :c:func:`Py_InitializeFromConfig` is called." +msgstr "" + +#: ../../c-api/init_config.rst:509 msgid "Release configuration memory." msgstr "" -#: ../../c-api/init_config.rst:500 +#: ../../c-api/init_config.rst:511 msgid "" "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " "In that case, the Python preinitialization configuration (:c:type:" @@ -613,23 +630,23 @@ msgid "" "before calling a :c:type:`PyConfig` method:" msgstr "" -#: ../../c-api/init_config.rst:506 +#: ../../c-api/init_config.rst:517 msgid ":c:member:`PyConfig.dev_mode`" msgstr ":c:member:`PyConfig.dev_mode`" -#: ../../c-api/init_config.rst:507 +#: ../../c-api/init_config.rst:518 msgid ":c:member:`PyConfig.isolated`" msgstr ":c:member:`PyConfig.isolated`" -#: ../../c-api/init_config.rst:508 +#: ../../c-api/init_config.rst:519 msgid ":c:member:`PyConfig.parse_argv`" msgstr ":c:member:`PyConfig.parse_argv`" -#: ../../c-api/init_config.rst:509 +#: ../../c-api/init_config.rst:520 msgid ":c:member:`PyConfig.use_environment`" msgstr ":c:member:`PyConfig.use_environment`" -#: ../../c-api/init_config.rst:511 +#: ../../c-api/init_config.rst:522 msgid "" "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " "is used, this method must be called before other methods, since the " @@ -637,518 +654,588 @@ msgid "" "member:`parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:516 +#: ../../c-api/init_config.rst:527 msgid "" "The caller of these methods is responsible to handle exceptions (error or " "exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" -#: ../../c-api/init_config.rst:523 +#: ../../c-api/init_config.rst:534 msgid "Command line arguments: :data:`sys.argv`." msgstr "" -#: ../../c-api/init_config.rst:525 +#: ../../c-api/init_config.rst:536 msgid "" "Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig." "argv` the same way the regular Python parses Python command line arguments " "and then to strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:530 +#: ../../c-api/init_config.rst:541 msgid "" "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " "that :data:`sys.argv` always exists and is never empty." msgstr "" -#: ../../c-api/init_config.rst:533 ../../c-api/init_config.rst:541 -#: ../../c-api/init_config.rst:553 ../../c-api/init_config.rst:561 -#: ../../c-api/init_config.rst:653 ../../c-api/init_config.rst:662 -#: ../../c-api/init_config.rst:744 ../../c-api/init_config.rst:850 -#: ../../c-api/init_config.rst:948 ../../c-api/init_config.rst:966 -#: ../../c-api/init_config.rst:980 ../../c-api/init_config.rst:997 -#: ../../c-api/init_config.rst:1009 ../../c-api/init_config.rst:1017 +#: ../../c-api/init_config.rst:544 ../../c-api/init_config.rst:571 +#: ../../c-api/init_config.rst:583 ../../c-api/init_config.rst:591 +#: ../../c-api/init_config.rst:699 ../../c-api/init_config.rst:708 +#: ../../c-api/init_config.rst:790 ../../c-api/init_config.rst:906 +#: ../../c-api/init_config.rst:1004 ../../c-api/init_config.rst:1022 +#: ../../c-api/init_config.rst:1036 ../../c-api/init_config.rst:1053 +#: ../../c-api/init_config.rst:1066 ../../c-api/init_config.rst:1074 msgid "Default: ``NULL``." msgstr "預設值:\\ ``NULL``\\ 。" -#: ../../c-api/init_config.rst:535 +#: ../../c-api/init_config.rst:546 msgid "See also the :c:member:`~PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:539 +#: ../../c-api/init_config.rst:550 +msgid "" +"If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :" +"data:`sys.path` at startup:" +msgstr "" + +#: ../../c-api/init_config.rst:553 +msgid "" +"If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " +"module``), prepend the current working directory." +msgstr "" + +#: ../../c-api/init_config.rst:555 +msgid "" +"If running a script (``python script.py``), prepend the script's directory. " +"If it's a symbolic link, resolve symbolic links." +msgstr "" + +#: ../../c-api/init_config.rst:557 +msgid "" +"Otherwise (``python -c code`` and ``python``), prepend an empty string, " +"which means the current working directory." +msgstr "" + +#: ../../c-api/init_config.rst:560 +msgid "" +"Set to ``1`` by the :option:`-P` command line option and the :envvar:" +"`PYTHONSAFEPATH` environment variable." +msgstr "" + +#: ../../c-api/init_config.rst:563 +msgid "Default: ``0`` in Python config, ``1`` in isolated config." +msgstr "" + +#: ../../c-api/init_config.rst:569 msgid ":data:`sys.base_exec_prefix`." msgstr ":data:`sys.base_exec_prefix`\\ 。" -#: ../../c-api/init_config.rst:543 ../../c-api/init_config.rst:555 -#: ../../c-api/init_config.rst:563 ../../c-api/init_config.rst:655 -#: ../../c-api/init_config.rst:664 ../../c-api/init_config.rst:867 -#: ../../c-api/init_config.rst:950 +#: ../../c-api/init_config.rst:573 ../../c-api/init_config.rst:585 +#: ../../c-api/init_config.rst:593 ../../c-api/init_config.rst:701 +#: ../../c-api/init_config.rst:710 ../../c-api/init_config.rst:923 +#: ../../c-api/init_config.rst:1006 msgid "Part of the :ref:`Python Path Configuration ` output." msgstr "" -#: ../../c-api/init_config.rst:547 +#: ../../c-api/init_config.rst:577 msgid "Python base executable: :data:`sys._base_executable`." msgstr "" -#: ../../c-api/init_config.rst:549 +#: ../../c-api/init_config.rst:579 msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." msgstr "" -#: ../../c-api/init_config.rst:551 +#: ../../c-api/init_config.rst:581 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:559 +#: ../../c-api/init_config.rst:589 msgid ":data:`sys.base_prefix`." msgstr ":data:`sys.base_prefix`\\ 。" -#: ../../c-api/init_config.rst:567 +#: ../../c-api/init_config.rst:597 msgid "" -"If equals to 0 and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " +"If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " "disable buffering on the C streams stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:570 +#: ../../c-api/init_config.rst:600 msgid "" -"Set to 0 by the :option:`-u` command line option and the :envvar:" +"Set to ``0`` by the :option:`-u` command line option and the :envvar:" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:573 +#: ../../c-api/init_config.rst:603 msgid "stdin is always opened in buffered mode." msgstr "" -#: ../../c-api/init_config.rst:575 ../../c-api/init_config.rst:1045 -#: ../../c-api/init_config.rst:1160 +#: ../../c-api/init_config.rst:605 ../../c-api/init_config.rst:638 +#: ../../c-api/init_config.rst:1102 ../../c-api/init_config.rst:1219 msgid "Default: ``1``." msgstr "預設值:\\ ``1``\\ 。" -#: ../../c-api/init_config.rst:579 +#: ../../c-api/init_config.rst:609 msgid "" -"If equals to 1, issue a warning when comparing :class:`bytes` or :class:" +"If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:" "`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." msgstr "" -#: ../../c-api/init_config.rst:583 +#: ../../c-api/init_config.rst:613 msgid "" -"If equal or greater to 2, raise a :exc:`BytesWarning` exception in these " +"If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " "cases." msgstr "" -#: ../../c-api/init_config.rst:586 +#: ../../c-api/init_config.rst:616 msgid "Incremented by the :option:`-b` command line option." msgstr "" -#: ../../c-api/init_config.rst:592 +#: ../../c-api/init_config.rst:622 msgid "" "If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io." "TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for " "details." msgstr "" -#: ../../c-api/init_config.rst:601 +#: ../../c-api/init_config.rst:631 +msgid "" +"If equals to ``0``, disables the inclusion of the end line and column " +"mappings in code objects. Also disables traceback printing carets to " +"specific error locations." +msgstr "" + +#: ../../c-api/init_config.rst:635 +msgid "" +"Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " +"by the :option:`-X no_debug_ranges <-X>` command line option." +msgstr "" + +#: ../../c-api/init_config.rst:644 msgid "" "Control the validation behavior of hash-based ``.pyc`` files: value of the :" "option:`--check-hash-based-pycs` command line option." msgstr "" -#: ../../c-api/init_config.rst:604 +#: ../../c-api/init_config.rst:647 msgid "Valid values:" msgstr "" -#: ../../c-api/init_config.rst:606 +#: ../../c-api/init_config.rst:649 msgid "" "``L\"always\"``: Hash the source file for invalidation regardless of value " "of the 'check_source' flag." msgstr "" -#: ../../c-api/init_config.rst:608 +#: ../../c-api/init_config.rst:651 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." msgstr "" -#: ../../c-api/init_config.rst:609 +#: ../../c-api/init_config.rst:652 msgid "" "``L\"default\"``: The 'check_source' flag in hash-based pycs determines " "invalidation." msgstr "" -#: ../../c-api/init_config.rst:612 +#: ../../c-api/init_config.rst:655 msgid "Default: ``L\"default\"``." msgstr "預設:\\ ``L\"default\"``。" -#: ../../c-api/init_config.rst:614 +#: ../../c-api/init_config.rst:657 msgid "See also :pep:`552` \"Deterministic pycs\"." msgstr "" -#: ../../c-api/init_config.rst:618 +#: ../../c-api/init_config.rst:661 msgid "If non-zero, configure C standard streams:" msgstr "" -#: ../../c-api/init_config.rst:620 +#: ../../c-api/init_config.rst:663 msgid "" "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:622 +#: ../../c-api/init_config.rst:665 msgid "" "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " "stdin, stdout and stderr streams." msgstr "" -#: ../../c-api/init_config.rst:624 +#: ../../c-api/init_config.rst:667 msgid "" "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " "stdin and stdout (only stdout on Windows)." msgstr "" -#: ../../c-api/init_config.rst:631 +#: ../../c-api/init_config.rst:674 msgid "If non-zero, enable the :ref:`Python Development Mode `." msgstr "" -#: ../../c-api/init_config.rst:637 +#: ../../c-api/init_config.rst:676 +msgid "" +"Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:" +"`PYTHONDEVMODE` environment variable." +msgstr "" + +#: ../../c-api/init_config.rst:683 msgid "Dump Python references?" msgstr "" -#: ../../c-api/init_config.rst:639 +#: ../../c-api/init_config.rst:685 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" -#: ../../c-api/init_config.rst:641 +#: ../../c-api/init_config.rst:687 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:643 +#: ../../c-api/init_config.rst:689 msgid "" "Need a special build of Python with the ``Py_TRACE_REFS`` macro defined: see " "the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" -#: ../../c-api/init_config.rst:650 +#: ../../c-api/init_config.rst:696 msgid "" "The site-specific directory prefix where the platform-dependent Python files " "are installed: :data:`sys.exec_prefix`." msgstr "" -#: ../../c-api/init_config.rst:659 +#: ../../c-api/init_config.rst:705 msgid "" "The absolute path of the executable binary for the Python interpreter: :data:" "`sys.executable`." msgstr "" -#: ../../c-api/init_config.rst:668 +#: ../../c-api/init_config.rst:714 msgid "Enable faulthandler?" msgstr "" -#: ../../c-api/init_config.rst:670 +#: ../../c-api/init_config.rst:716 msgid "If non-zero, call :func:`faulthandler.enable` at startup." msgstr "" -#: ../../c-api/init_config.rst:672 +#: ../../c-api/init_config.rst:718 msgid "" "Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:" "`PYTHONFAULTHANDLER` environment variable." msgstr "" -#: ../../c-api/init_config.rst:679 +#: ../../c-api/init_config.rst:725 msgid "" ":term:`Filesystem encoding `: :func:" "`sys.getfilesystemencoding`." msgstr "" -#: ../../c-api/init_config.rst:682 +#: ../../c-api/init_config.rst:728 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:684 +#: ../../c-api/init_config.rst:730 msgid "" "On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:" "`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-" "zero." msgstr "" -#: ../../c-api/init_config.rst:688 +#: ../../c-api/init_config.rst:734 msgid "Default encoding on other platforms:" msgstr "" -#: ../../c-api/init_config.rst:690 +#: ../../c-api/init_config.rst:736 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:691 +#: ../../c-api/init_config.rst:737 msgid "" "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " "ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " "encoding (usually Latin1)." msgstr "" -#: ../../c-api/init_config.rst:694 +#: ../../c-api/init_config.rst:740 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." msgstr "" -#: ../../c-api/init_config.rst:695 +#: ../../c-api/init_config.rst:741 msgid "" "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" -#: ../../c-api/init_config.rst:698 +#: ../../c-api/init_config.rst:744 msgid "" "At Python startup, the encoding name is normalized to the Python codec name. " "For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" -#: ../../c-api/init_config.rst:701 +#: ../../c-api/init_config.rst:747 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." msgstr "" -#: ../../c-api/init_config.rst:705 +#: ../../c-api/init_config.rst:751 msgid "" ":term:`Filesystem error handler `: :" "func:`sys.getfilesystemencodeerrors`." msgstr "" -#: ../../c-api/init_config.rst:708 +#: ../../c-api/init_config.rst:754 msgid "" "On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:" "member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is " "non-zero." msgstr "" -#: ../../c-api/init_config.rst:712 +#: ../../c-api/init_config.rst:758 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:714 +#: ../../c-api/init_config.rst:760 msgid "Supported error handlers:" msgstr "" -#: ../../c-api/init_config.rst:716 +#: ../../c-api/init_config.rst:762 msgid "``\"strict\"``" msgstr "``\"strict\"``" -#: ../../c-api/init_config.rst:717 +#: ../../c-api/init_config.rst:763 msgid "``\"surrogateescape\"``" msgstr "``\"surrogateescape\"``" -#: ../../c-api/init_config.rst:718 +#: ../../c-api/init_config.rst:764 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" msgstr "" -#: ../../c-api/init_config.rst:720 +#: ../../c-api/init_config.rst:766 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." msgstr "" -#: ../../c-api/init_config.rst:725 +#: ../../c-api/init_config.rst:771 msgid "Randomized hash function seed." msgstr "" -#: ../../c-api/init_config.rst:727 +#: ../../c-api/init_config.rst:773 msgid "" "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " "Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" -#: ../../c-api/init_config.rst:730 +#: ../../c-api/init_config.rst:776 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:732 +#: ../../c-api/init_config.rst:778 msgid "" "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:737 +#: ../../c-api/init_config.rst:783 msgid "Python home directory." msgstr "" -#: ../../c-api/init_config.rst:739 +#: ../../c-api/init_config.rst:785 msgid "" "If :c:func:`Py_SetPythonHome` has been called, use its argument if it is not " "``NULL``." msgstr "" -#: ../../c-api/init_config.rst:742 +#: ../../c-api/init_config.rst:788 msgid "Set by the :envvar:`PYTHONHOME` environment variable." msgstr "" -#: ../../c-api/init_config.rst:746 ../../c-api/init_config.rst:839 -#: ../../c-api/init_config.rst:852 ../../c-api/init_config.rst:941 -#: ../../c-api/init_config.rst:968 +#: ../../c-api/init_config.rst:792 ../../c-api/init_config.rst:888 +#: ../../c-api/init_config.rst:908 ../../c-api/init_config.rst:994 +#: ../../c-api/init_config.rst:1024 msgid "Part of the :ref:`Python Path Configuration ` input." msgstr "" -#: ../../c-api/init_config.rst:750 +#: ../../c-api/init_config.rst:796 msgid "If non-zero, profile import time." msgstr "" -#: ../../c-api/init_config.rst:752 +#: ../../c-api/init_config.rst:798 msgid "" "Set the ``1`` by the :option:`-X importtime <-X>` option and the :envvar:" "`PYTHONPROFILEIMPORTTIME` environment variable." msgstr "" -#: ../../c-api/init_config.rst:759 +#: ../../c-api/init_config.rst:805 msgid "Enter interactive mode after executing a script or a command." msgstr "" -#: ../../c-api/init_config.rst:761 +#: ../../c-api/init_config.rst:807 msgid "" -"If greater than 0, enable inspect: when a script is passed as first argument " -"or the -c option is used, enter interactive mode after executing the script " -"or the command, even when :data:`sys.stdin` does not appear to be a terminal." +"If greater than ``0``, enable inspect: when a script is passed as first " +"argument or the -c option is used, enter interactive mode after executing " +"the script or the command, even when :data:`sys.stdin` does not appear to be " +"a terminal." msgstr "" -#: ../../c-api/init_config.rst:766 +#: ../../c-api/init_config.rst:812 msgid "" "Incremented by the :option:`-i` command line option. Set to ``1`` if the :" "envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" -#: ../../c-api/init_config.rst:773 +#: ../../c-api/init_config.rst:819 msgid "Install Python signal handlers?" msgstr "" -#: ../../c-api/init_config.rst:775 ../../c-api/init_config.rst:915 -#: ../../c-api/init_config.rst:939 ../../c-api/init_config.rst:1112 +#: ../../c-api/init_config.rst:821 ../../c-api/init_config.rst:971 +#: ../../c-api/init_config.rst:992 ../../c-api/init_config.rst:1171 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:779 -msgid "If greater than 0, enable the interactive mode (REPL)." +#: ../../c-api/init_config.rst:825 +msgid "If greater than ``0``, enable the interactive mode (REPL)." msgstr "" -#: ../../c-api/init_config.rst:781 +#: ../../c-api/init_config.rst:827 msgid "Incremented by the :option:`-i` command line option." msgstr "" -#: ../../c-api/init_config.rst:787 -msgid "If greater than 0, enable isolated mode:" +#: ../../c-api/init_config.rst:833 +msgid "If greater than ``0``, enable isolated mode:" msgstr "" -#: ../../c-api/init_config.rst:789 +#: ../../c-api/init_config.rst:835 msgid "" -":data:`sys.path` contains neither the script's directory (computed from " -"``argv[0]`` or the current directory) nor the user's site-packages directory." +"Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " +"unsafe path to :data:`sys.path` at Python startup." msgstr "" -#: ../../c-api/init_config.rst:792 +#: ../../c-api/init_config.rst:838 ../../c-api/init_config.rst:1469 +msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." +msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" + +#: ../../c-api/init_config.rst:839 +msgid "" +"Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " +"site directory to :data:`sys.path`." +msgstr "" + +#: ../../c-api/init_config.rst:841 msgid "" "Python REPL doesn't import :mod:`readline` nor enable default readline " "configuration on interactive prompts." msgstr "" -#: ../../c-api/init_config.rst:794 -msgid "" -"Set :c:member:`~PyConfig.use_environment` and :c:member:`~PyConfig." -"user_site_directory` to 0." +#: ../../c-api/init_config.rst:844 +msgid "Set to ``1`` by the :option:`-I` command line option." msgstr "" -#: ../../c-api/init_config.rst:799 +#: ../../c-api/init_config.rst:848 msgid "See also :c:member:`PyPreConfig.isolated`." msgstr "也請見 :c:member:`PyPreConfig.isolated`\\ 。" -#: ../../c-api/init_config.rst:803 +#: ../../c-api/init_config.rst:852 msgid "" "If non-zero, use :class:`io.FileIO` instead of :class:`io.WindowsConsoleIO` " "for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys.stderr`." msgstr "" -#: ../../c-api/init_config.rst:807 +#: ../../c-api/init_config.rst:856 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init_config.rst:815 +#: ../../c-api/init_config.rst:864 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" -#: ../../c-api/init_config.rst:819 +#: ../../c-api/init_config.rst:868 msgid "" "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " "` at exit." msgstr "" -#: ../../c-api/init_config.rst:822 +#: ../../c-api/init_config.rst:871 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:824 +#: ../../c-api/init_config.rst:873 msgid "" "The option is ignored if Python is :option:`configured using the --without-" "pymalloc option <--without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:831 +#: ../../c-api/init_config.rst:880 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" -#: ../../c-api/init_config.rst:833 +#: ../../c-api/init_config.rst:882 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." msgstr "" -#: ../../c-api/init_config.rst:835 +#: ../../c-api/init_config.rst:884 msgid "" "Default: value of the ``PLATLIBDIR`` macro which is set by the :option:" "`configure --with-platlibdir option <--with-platlibdir>` (default: ``\"lib" -"\"``)." +"\"``, or ``\"DLLs\"`` on Windows)." msgstr "" -#: ../../c-api/init_config.rst:845 +#: ../../c-api/init_config.rst:892 +msgid "" +"This macro is now used on Windows to locate the standard library extension " +"modules, typically under ``DLLs``. However, for compatibility, note that " +"this value is ignored for any non-standard layouts, including in-tree builds " +"and virtual environments." +msgstr "" + +#: ../../c-api/init_config.rst:901 msgid "" "Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:" "data:`os.path.pathsep`)." msgstr "" -#: ../../c-api/init_config.rst:848 +#: ../../c-api/init_config.rst:904 msgid "Set by the :envvar:`PYTHONPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:857 +#: ../../c-api/init_config.rst:913 msgid "Module search paths: :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:859 +#: ../../c-api/init_config.rst:915 msgid "" -"If :c:member:`~PyConfig.module_search_paths_set` is equal to 0, the function " -"calculating the :ref:`Python Path Configuration ` " -"overrides the :c:member:`~PyConfig.module_search_paths` and sets :c:member:" -"`~PyConfig.module_search_paths_set` to ``1``." +"If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:" +"`Py_InitializeFromConfig` will replace :c:member:`~PyConfig." +"module_search_paths` and sets :c:member:`~PyConfig.module_search_paths_set` " +"to ``1``." msgstr "" -#: ../../c-api/init_config.rst:864 +#: ../../c-api/init_config.rst:920 msgid "" "Default: empty list (``module_search_paths``) and ``0`` " "(``module_search_paths_set``)." msgstr "" -#: ../../c-api/init_config.rst:871 +#: ../../c-api/init_config.rst:927 msgid "Compilation optimization level:" msgstr "" -#: ../../c-api/init_config.rst:873 +#: ../../c-api/init_config.rst:929 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." msgstr "" -#: ../../c-api/init_config.rst:874 +#: ../../c-api/init_config.rst:930 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" -#: ../../c-api/init_config.rst:875 +#: ../../c-api/init_config.rst:931 msgid "``2``: Level 1, strip docstrings." msgstr "" -#: ../../c-api/init_config.rst:877 +#: ../../c-api/init_config.rst:933 msgid "" "Incremented by the :option:`-O` command line option. Set to the :envvar:" "`PYTHONOPTIMIZE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:884 +#: ../../c-api/init_config.rst:940 msgid "" "The list of the original command line arguments passed to the Python " "executable: :data:`sys.orig_argv`." msgstr "" -#: ../../c-api/init_config.rst:887 +#: ../../c-api/init_config.rst:943 msgid "" "If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig." "argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` " @@ -1157,356 +1244,362 @@ msgid "" "parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:894 +#: ../../c-api/init_config.rst:950 msgid "" "See also the :c:member:`~PyConfig.argv` member and the :c:func:" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:897 ../../c-api/init_config.rst:1147 -#: ../../c-api/init_config.rst:1166 +#: ../../c-api/init_config.rst:953 ../../c-api/init_config.rst:1206 +#: ../../c-api/init_config.rst:1225 msgid "Default: empty list." msgstr "" -#: ../../c-api/init_config.rst:903 +#: ../../c-api/init_config.rst:959 msgid "Parse command line arguments?" msgstr "" -#: ../../c-api/init_config.rst:905 +#: ../../c-api/init_config.rst:961 msgid "" "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " "regular Python parses :ref:`command line arguments `, and " "strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:917 +#: ../../c-api/init_config.rst:973 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:" "`PyConfig.parse_argv` equals to ``1``." msgstr "" -#: ../../c-api/init_config.rst:923 +#: ../../c-api/init_config.rst:979 msgid "" -"Parser debug mode. If greater than 0, turn on parser debugging output (for " -"expert only, depending on compilation options)." +"Parser debug mode. If greater than ``0``, turn on parser debugging output " +"(for expert only, depending on compilation options)." msgstr "" -#: ../../c-api/init_config.rst:926 +#: ../../c-api/init_config.rst:982 msgid "" "Incremented by the :option:`-d` command line option. Set to the :envvar:" "`PYTHONDEBUG` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:933 +#: ../../c-api/init_config.rst:989 msgid "" -"On Unix, if non-zero, calculating the :ref:`Python Path Configuration ` can log warnings into ``stderr``. If equals to 0, suppress " -"these warnings." +"If non-zero, calculation of path configuration is allowed to log warnings " +"into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" -#: ../../c-api/init_config.rst:937 -msgid "It has no effect on Windows." +#: ../../c-api/init_config.rst:996 +msgid "Now also applies on Windows." msgstr "" -#: ../../c-api/init_config.rst:945 +#: ../../c-api/init_config.rst:1001 msgid "" "The site-specific directory prefix where the platform independent Python " "files are installed: :data:`sys.prefix`." msgstr "" -#: ../../c-api/init_config.rst:954 +#: ../../c-api/init_config.rst:1010 msgid "" "Program name used to initialize :c:member:`~PyConfig.executable` and in " "early error messages during Python initialization." msgstr "" -#: ../../c-api/init_config.rst:957 +#: ../../c-api/init_config.rst:1013 msgid "If :func:`Py_SetProgramName` has been called, use its argument." msgstr "" -#: ../../c-api/init_config.rst:958 +#: ../../c-api/init_config.rst:1014 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:959 +#: ../../c-api/init_config.rst:1015 msgid "" "If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:" "`__PYVENV_LAUNCHER__` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:961 +#: ../../c-api/init_config.rst:1017 msgid "" "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" -#: ../../c-api/init_config.rst:963 +#: ../../c-api/init_config.rst:1019 msgid "" "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " "platforms." msgstr "" -#: ../../c-api/init_config.rst:972 +#: ../../c-api/init_config.rst:1028 msgid "" "Directory where cached ``.pyc`` files are written: :data:`sys." "pycache_prefix`." msgstr "" -#: ../../c-api/init_config.rst:975 +#: ../../c-api/init_config.rst:1031 msgid "" "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " "the :envvar:`PYTHONPYCACHEPREFIX` environment variable." msgstr "" -#: ../../c-api/init_config.rst:978 +#: ../../c-api/init_config.rst:1034 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" -#: ../../c-api/init_config.rst:984 +#: ../../c-api/init_config.rst:1040 msgid "" -"Quiet mode. If greater than 0, don't display the copyright and version at " -"Python startup in interactive mode." +"Quiet mode. If greater than ``0``, don't display the copyright and version " +"at Python startup in interactive mode." msgstr "" -#: ../../c-api/init_config.rst:987 +#: ../../c-api/init_config.rst:1043 msgid "Incremented by the :option:`-q` command line option." msgstr "" -#: ../../c-api/init_config.rst:993 +#: ../../c-api/init_config.rst:1049 msgid "Value of the :option:`-c` command line option." msgstr "" -#: ../../c-api/init_config.rst:995 ../../c-api/init_config.rst:1007 -#: ../../c-api/init_config.rst:1015 +#: ../../c-api/init_config.rst:1051 ../../c-api/init_config.rst:1072 msgid "Used by :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1001 +#: ../../c-api/init_config.rst:1057 msgid "" "Filename passed on the command line: trailing command line argument without :" -"option:`-c` or :option:`-m`." +"option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." msgstr "" -#: ../../c-api/init_config.rst:1004 +#: ../../c-api/init_config.rst:1061 msgid "" "For example, it is set to ``script.py`` by the ``python3 script.py arg`` " -"command." +"command line." msgstr "" -#: ../../c-api/init_config.rst:1013 +#: ../../c-api/init_config.rst:1064 +msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." +msgstr "也請見 :c:member:`PyConfig.skip_source_first_line` 選項。" + +#: ../../c-api/init_config.rst:1070 msgid "Value of the :option:`-m` command line option." msgstr "" -#: ../../c-api/init_config.rst:1021 +#: ../../c-api/init_config.rst:1078 msgid "Show total reference count at exit?" msgstr "" -#: ../../c-api/init_config.rst:1023 -msgid "Set to 1 by :option:`-X showrefcount <-X>` command line option." +#: ../../c-api/init_config.rst:1080 +msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:1025 +#: ../../c-api/init_config.rst:1082 msgid "" "Need a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " "macro must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1032 +#: ../../c-api/init_config.rst:1089 msgid "Import the :mod:`site` module at startup?" msgstr "" -#: ../../c-api/init_config.rst:1034 +#: ../../c-api/init_config.rst:1091 msgid "" "If equal to zero, disable the import of the module site and the site-" "dependent manipulations of :data:`sys.path` that it entails." msgstr "" -#: ../../c-api/init_config.rst:1037 +#: ../../c-api/init_config.rst:1094 msgid "" "Also disable these manipulations if the :mod:`site` module is explicitly " "imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init_config.rst:1040 +#: ../../c-api/init_config.rst:1097 msgid "Set to ``0`` by the :option:`-S` command line option." msgstr "" -#: ../../c-api/init_config.rst:1042 +#: ../../c-api/init_config.rst:1099 msgid "" ":data:`sys.flags.no_site` is set to the inverted value of :c:member:" "`~PyConfig.site_import`." msgstr "" -#: ../../c-api/init_config.rst:1049 +#: ../../c-api/init_config.rst:1106 msgid "" "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " "source." msgstr "" -#: ../../c-api/init_config.rst:1052 +#: ../../c-api/init_config.rst:1109 msgid "" "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " "DOS specific hack only." msgstr "" -#: ../../c-api/init_config.rst:1055 +#: ../../c-api/init_config.rst:1112 msgid "Set to ``1`` by the :option:`-x` command line option." msgstr "" -#: ../../c-api/init_config.rst:1062 +#: ../../c-api/init_config.rst:1119 msgid "" "Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :" "data:`sys.stderr` (but :data:`sys.stderr` always uses ``\"backslashreplace" "\"`` error handler)." msgstr "" -#: ../../c-api/init_config.rst:1066 +#: ../../c-api/init_config.rst:1123 msgid "" "If :c:func:`Py_SetStandardStreamEncoding` has been called, use its *error* " "and *errors* arguments if they are not ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:1069 +#: ../../c-api/init_config.rst:1126 msgid "" "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." msgstr "" -#: ../../c-api/init_config.rst:1072 +#: ../../c-api/init_config.rst:1129 msgid "Default encoding:" msgstr "" -#: ../../c-api/init_config.rst:1074 +#: ../../c-api/init_config.rst:1131 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:1075 +#: ../../c-api/init_config.rst:1132 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" -#: ../../c-api/init_config.rst:1077 +#: ../../c-api/init_config.rst:1134 msgid "Default error handler:" msgstr "" -#: ../../c-api/init_config.rst:1079 +#: ../../c-api/init_config.rst:1136 msgid "On Windows: use ``\"surrogateescape\"``." msgstr "" -#: ../../c-api/init_config.rst:1080 +#: ../../c-api/init_config.rst:1137 msgid "" "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " "if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" -#: ../../c-api/init_config.rst:1082 +#: ../../c-api/init_config.rst:1139 msgid "``\"strict\"`` otherwise." msgstr "" -#: ../../c-api/init_config.rst:1086 +#: ../../c-api/init_config.rst:1143 msgid "Enable tracemalloc?" msgstr "" -#: ../../c-api/init_config.rst:1088 +#: ../../c-api/init_config.rst:1145 msgid "If non-zero, call :func:`tracemalloc.start` at startup." msgstr "" -#: ../../c-api/init_config.rst:1090 +#: ../../c-api/init_config.rst:1147 msgid "" "Set by :option:`-X tracemalloc=N <-X>` command line option and by the :" "envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1097 +#: ../../c-api/init_config.rst:1154 msgid "Use :ref:`environment variables `?" msgstr "" -#: ../../c-api/init_config.rst:1099 +#: ../../c-api/init_config.rst:1156 msgid "" "If equals to zero, ignore the :ref:`environment variables `." msgstr "" -#: ../../c-api/init_config.rst:1106 +#: ../../c-api/init_config.rst:1159 +msgid "Set to ``0`` by the :option:`-E` environment variable." +msgstr "" + +#: ../../c-api/init_config.rst:1165 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1108 +#: ../../c-api/init_config.rst:1167 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1110 +#: ../../c-api/init_config.rst:1169 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1116 +#: ../../c-api/init_config.rst:1175 msgid "" -"Verbose mode. If greater than 0, print a message each time a module is " +"Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1120 +#: ../../c-api/init_config.rst:1179 msgid "" -"If greater or equal to 2, print a message for each file that is checked for " -"when searching for a module. Also provides information on module cleanup at " -"exit." +"If greater or equal to ``2``, print a message for each file that is checked " +"for when searching for a module. Also provides information on module cleanup " +"at exit." msgstr "" -#: ../../c-api/init_config.rst:1124 +#: ../../c-api/init_config.rst:1183 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1126 +#: ../../c-api/init_config.rst:1185 msgid "Set to the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1132 +#: ../../c-api/init_config.rst:1191 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1135 +#: ../../c-api/init_config.rst:1194 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1140 +#: ../../c-api/init_config.rst:1199 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1143 +#: ../../c-api/init_config.rst:1202 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1151 +#: ../../c-api/init_config.rst:1210 msgid "" -"If equal to 0, Python won't try to write ``.pyc`` files on the import of " +"If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1154 +#: ../../c-api/init_config.rst:1213 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1157 +#: ../../c-api/init_config.rst:1216 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1164 +#: ../../c-api/init_config.rst:1223 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1168 +#: ../../c-api/init_config.rst:1227 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1514,29 +1607,29 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1173 +#: ../../c-api/init_config.rst:1232 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1178 +#: ../../c-api/init_config.rst:1237 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1182 +#: ../../c-api/init_config.rst:1241 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1184 +#: ../../c-api/init_config.rst:1243 msgid "Function to initialize Python:" msgstr "" -#: ../../c-api/init_config.rst:1188 +#: ../../c-api/init_config.rst:1247 msgid "Initialize Python from *config* configuration." msgstr "" -#: ../../c-api/init_config.rst:1193 +#: ../../c-api/init_config.rst:1252 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1545,34 +1638,37 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1200 +#: ../../c-api/init_config.rst:1259 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1203 +#: ../../c-api/init_config.rst:1262 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1231 +#: ../../c-api/init_config.rst:1290 msgid "" "More complete example modifying the default configuration, read the " -"configuration, and then override some parameters::" +"configuration, and then override some parameters. Note that since 3.11, many " +"parameters are not calculated until initialization, and so values cannot be " +"read from the configuration structure. Any values set before initialize is " +"called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1282 +#: ../../c-api/init_config.rst:1353 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1284 +#: ../../c-api/init_config.rst:1355 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1289 +#: ../../c-api/init_config.rst:1360 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -1580,116 +1676,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1294 +#: ../../c-api/init_config.rst:1365 msgid "" -"Configuration files are still used with this configuration. Set the :ref:" -"`Python Path Configuration ` (\"output fields\") to ignore " -"these configuration files and avoid the function computing the default path " -"configuration." +"Configuration files are still used with this configuration to determine " +"paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " +"avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1303 +#: ../../c-api/init_config.rst:1373 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1375 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1309 +#: ../../c-api/init_config.rst:1379 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1312 +#: ../../c-api/init_config.rst:1382 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1321 +#: ../../c-api/init_config.rst:1391 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1323 +#: ../../c-api/init_config.rst:1393 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1325 +#: ../../c-api/init_config.rst:1395 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1327 +#: ../../c-api/init_config.rst:1397 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1328 +#: ../../c-api/init_config.rst:1398 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1329 +#: ../../c-api/init_config.rst:1399 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1330 +#: ../../c-api/init_config.rst:1400 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1331 +#: ../../c-api/init_config.rst:1401 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1332 +#: ../../c-api/init_config.rst:1402 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1333 +#: ../../c-api/init_config.rst:1403 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1335 +#: ../../c-api/init_config.rst:1405 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1336 +#: ../../c-api/init_config.rst:1406 msgid "" "(Windows only) Application paths in the registry under \"Software\\Python" "\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE " "(where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1340 +#: ../../c-api/init_config.rst:1410 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1342 +#: ../../c-api/init_config.rst:1412 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1343 +#: ../../c-api/init_config.rst:1413 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1344 +#: ../../c-api/init_config.rst:1414 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1345 +#: ../../c-api/init_config.rst:1415 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1346 +#: ../../c-api/init_config.rst:1416 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1347 +#: ../../c-api/init_config.rst:1417 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -1697,75 +1792,75 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1349 +#: ../../c-api/init_config.rst:1419 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1351 +#: ../../c-api/init_config.rst:1421 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." -"module_search_paths_set` is equal to 0, :c:member:`~PyConfig." +"module_search_paths_set` is equal to ``0``, :c:member:`~PyConfig." "module_search_paths` is overridden and :c:member:`~PyConfig." -"module_search_paths_set` is set to 1." +"module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1357 +#: ../../c-api/init_config.rst:1427 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " "fields listed above. A string is considered as set even if it is non-empty. " "``module_search_paths`` is considered as set if ``module_search_paths_set`` " -"is set to 1. In this case, path configuration input fields are ignored as " -"well." +"is set to ``1``. In this case, ``module_search_paths`` will be used without " +"modification." msgstr "" -#: ../../c-api/init_config.rst:1364 +#: ../../c-api/init_config.rst:1434 msgid "" -"Set :c:member:`~PyConfig.pathconfig_warnings` to 0 to suppress warnings when " -"calculating the path configuration (Unix only, Windows does not log any " +"Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " +"when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1367 +#: ../../c-api/init_config.rst:1437 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1371 +#: ../../c-api/init_config.rst:1441 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1373 +#: ../../c-api/init_config.rst:1443 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1376 +#: ../../c-api/init_config.rst:1446 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -#: ../../c-api/init_config.rst:1378 +#: ../../c-api/init_config.rst:1448 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1380 +#: ../../c-api/init_config.rst:1450 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1382 +#: ../../c-api/init_config.rst:1452 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1384 +#: ../../c-api/init_config.rst:1454 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -1774,156 +1869,172 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1390 +#: ../../c-api/init_config.rst:1460 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1392 +#: ../../c-api/init_config.rst:1462 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1393 -msgid "``python._pth`` (Windows only)" +#: ../../c-api/init_config.rst:1463 +msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1394 +#: ../../c-api/init_config.rst:1464 msgid "``pybuilddir.txt`` (Unix only)" msgstr "" -#: ../../c-api/init_config.rst:1396 +#: ../../c-api/init_config.rst:1466 +msgid "If a ``._pth`` file is present:" +msgstr "" + +#: ../../c-api/init_config.rst:1468 +msgid "Set :c:member:`~PyConfig.isolated` to ``1``." +msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" + +#: ../../c-api/init_config.rst:1470 +msgid "Set :c:member:`~PyConfig.site_import` to ``0``." +msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" + +#: ../../c-api/init_config.rst:1471 +msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." +msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" + +#: ../../c-api/init_config.rst:1473 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`" msgstr "" -#: ../../c-api/init_config.rst:1401 +#: ../../c-api/init_config.rst:1478 msgid "Py_RunMain()" msgstr "Py_RunMain()" -#: ../../c-api/init_config.rst:1405 +#: ../../c-api/init_config.rst:1482 msgid "" "Execute the command (:c:member:`PyConfig.run_command`), the script (:c:" "member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." "run_module`) specified on the command line or in the configuration." msgstr "" -#: ../../c-api/init_config.rst:1410 +#: ../../c-api/init_config.rst:1487 msgid "By default and when if :option:`-i` option is used, run the REPL." msgstr "" -#: ../../c-api/init_config.rst:1412 +#: ../../c-api/init_config.rst:1489 msgid "" "Finally, finalizes Python and returns an exit status that can be passed to " "the ``exit()`` function." msgstr "" -#: ../../c-api/init_config.rst:1415 +#: ../../c-api/init_config.rst:1492 msgid "" "See :ref:`Python Configuration ` for an example of " "customized Python always running in isolated mode using :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1421 +#: ../../c-api/init_config.rst:1498 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1425 +#: ../../c-api/init_config.rst:1502 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1427 +#: ../../c-api/init_config.rst:1504 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:1431 +#: ../../c-api/init_config.rst:1508 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1433 +#: ../../c-api/init_config.rst:1510 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1436 +#: ../../c-api/init_config.rst:1513 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1438 +#: ../../c-api/init_config.rst:1515 msgid "Builtin types;" msgstr "" -#: ../../c-api/init_config.rst:1439 +#: ../../c-api/init_config.rst:1516 msgid "Builtin exceptions;" msgstr "" -#: ../../c-api/init_config.rst:1440 +#: ../../c-api/init_config.rst:1517 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1441 +#: ../../c-api/init_config.rst:1518 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1444 +#: ../../c-api/init_config.rst:1521 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1446 +#: ../../c-api/init_config.rst:1523 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1447 +#: ../../c-api/init_config.rst:1524 msgid "Apply the :ref:`Path Configuration `;" msgstr "" -#: ../../c-api/init_config.rst:1448 +#: ../../c-api/init_config.rst:1525 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1449 +#: ../../c-api/init_config.rst:1526 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1451 +#: ../../c-api/init_config.rst:1528 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1452 +#: ../../c-api/init_config.rst:1529 msgid "Import the :mod:`site` module;" msgstr "" -#: ../../c-api/init_config.rst:1453 +#: ../../c-api/init_config.rst:1530 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1455 +#: ../../c-api/init_config.rst:1532 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1457 +#: ../../c-api/init_config.rst:1534 msgid "" -":c:member:`PyConfig._init_main`: if set to 0, :c:func:" +":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1459 +#: ../../c-api/init_config.rst:1536 msgid "" ":c:member:`PyConfig._isolated_interpreter`: if non-zero, disallow threads, " "subprocesses and fork." msgstr "" -#: ../../c-api/init_config.rst:1464 +#: ../../c-api/init_config.rst:1541 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1466 +#: ../../c-api/init_config.rst:1543 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration ` is only " @@ -1932,14 +2043,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1472 +#: ../../c-api/init_config.rst:1549 msgid "" "It may become possible to calculatin the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1476 +#: ../../c-api/init_config.rst:1553 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -1947,7 +2058,7 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1481 +#: ../../c-api/init_config.rst:1558 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" diff --git a/c-api/intro.po b/c-api/intro.po index c73255efb4..48b53d27da 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -155,121 +155,162 @@ msgid "" msgstr "" #: ../../c-api/intro.rst:110 +msgid "Return the absolute value of ``x``." +msgstr "回傳 ``x`` 的絕對值。" + +#: ../../c-api/intro.rst:116 msgid "" -"Use this when you have a code path that cannot be reached by design. For " -"example, in the ``default:`` clause in a ``switch`` statement for which all " -"possible values are covered in ``case`` statements. Use this in places " -"where you might be tempted to put an ``assert(0)`` or ``abort()`` call." +"Ask the compiler to always inline a static inline function. The compiler can " +"ignore it and decides to not inline the function." msgstr "" -#: ../../c-api/intro.rst:115 +#: ../../c-api/intro.rst:119 msgid "" -"In release mode, the macro helps the compiler to optimize the code, and " -"avoids a warning about unreachable code. For example, the macro is " -"implemented with ``__builtin_unreachable()`` on GCC in release mode." +"It can be used to inline performance critical static inline functions when " +"building Python in debug mode with function inlining disabled. For example, " +"MSC disables function inlining when building in debug mode." msgstr "" -#: ../../c-api/intro.rst:119 +#: ../../c-api/intro.rst:123 msgid "" -"A use for ``Py_UNREACHABLE()`` is following a call a function that never " -"returns but that is not declared :c:macro:`_Py_NO_RETURN`." +"Marking blindly a static inline function with Py_ALWAYS_INLINE can result in " +"worse performances (due to increased code size for example). The compiler is " +"usually smarter than the developer for the cost/benefit analysis." msgstr "" -#: ../../c-api/intro.rst:122 +#: ../../c-api/intro.rst:127 msgid "" -"If a code path is very unlikely code but can be reached under exceptional " -"case, this macro must not be used. For example, under low memory condition " -"or if a system call returns a value out of the expected range. In this " -"case, it's better to report the error to the caller. If the error cannot be " -"reported to caller, :c:func:`Py_FatalError` can be used." +"If Python is :ref:`built in debug mode ` (if the ``Py_DEBUG`` " +"macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does nothing." msgstr "" -#: ../../c-api/intro.rst:132 -msgid "Return the absolute value of ``x``." -msgstr "回傳 ``x`` 的絕對值。" +#: ../../c-api/intro.rst:130 +msgid "It must be specified before the function return type. Usage::" +msgstr "" #: ../../c-api/intro.rst:138 -msgid "Return the minimum value between ``x`` and ``y``." +msgid "" +"Argument must be a character or an integer in the range [-128, 127] or [0, " +"255]. This macro returns ``c`` cast to an ``unsigned char``." msgstr "" -#: ../../c-api/intro.rst:144 -msgid "Return the maximum value between ``x`` and ``y``." +#: ../../c-api/intro.rst:143 +msgid "" +"Use this for deprecated declarations. The macro must be placed before the " +"symbol name." msgstr "" +#: ../../c-api/intro.rst:146 ../../c-api/intro.rst:232 +#: ../../c-api/intro.rst:250 +msgid "Example::" +msgstr "" +"範例:\n" +"\n" +"::" + #: ../../c-api/intro.rst:150 +msgid "MSVC support was added." +msgstr "" + +#: ../../c-api/intro.rst:155 msgid "" -"Convert ``x`` to a C string. E.g. ``Py_STRINGIFY(123)`` returns ``\"123\"``." +"Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the " +"command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set)." msgstr "" -#: ../../c-api/intro.rst:157 +#: ../../c-api/intro.rst:160 +msgid "Return the maximum value between ``x`` and ``y``." +msgstr "" + +#: ../../c-api/intro.rst:166 msgid "Return the size of a structure (``type``) ``member`` in bytes." msgstr "" -#: ../../c-api/intro.rst:163 +#: ../../c-api/intro.rst:172 +msgid "Return the minimum value between ``x`` and ``y``." +msgstr "" + +#: ../../c-api/intro.rst:178 msgid "" -"Argument must be a character or an integer in the range [-128, 127] or [0, " -"255]. This macro returns ``c`` cast to an ``unsigned char``." +"Disable inlining on a function. For example, it reduces the C stack " +"consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" +"`33720`)." msgstr "" -#: ../../c-api/intro.rst:168 +#: ../../c-api/intro.rst:182 +msgid "Usage::" +msgstr "" + +#: ../../c-api/intro.rst:190 msgid "" -"Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the " -"command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set)." +"Convert ``x`` to a C string. E.g. ``Py_STRINGIFY(123)`` returns ``\"123\"``." msgstr "" -#: ../../c-api/intro.rst:173 +#: ../../c-api/intro.rst:197 msgid "" -"Use this for unused arguments in a function definition to silence compiler " -"warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." +"Use this when you have a code path that cannot be reached by design. For " +"example, in the ``default:`` clause in a ``switch`` statement for which all " +"possible values are covered in ``case`` statements. Use this in places " +"where you might be tempted to put an ``assert(0)`` or ``abort()`` call." msgstr "" -#: ../../c-api/intro.rst:180 +#: ../../c-api/intro.rst:202 msgid "" -"Use this for deprecated declarations. The macro must be placed before the " -"symbol name." +"In release mode, the macro helps the compiler to optimize the code, and " +"avoids a warning about unreachable code. For example, the macro is " +"implemented with ``__builtin_unreachable()`` on GCC in release mode." msgstr "" -#: ../../c-api/intro.rst:183 ../../c-api/intro.rst:198 -#: ../../c-api/intro.rst:216 -msgid "Example::" +#: ../../c-api/intro.rst:206 +msgid "" +"A use for ``Py_UNREACHABLE()`` is following a call a function that never " +"returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -"範例:\n" -"\n" -"::" -#: ../../c-api/intro.rst:187 -msgid "MSVC support was added." +#: ../../c-api/intro.rst:209 +msgid "" +"If a code path is very unlikely code but can be reached under exceptional " +"case, this macro must not be used. For example, under low memory condition " +"or if a system call returns a value out of the expected range. In this " +"case, it's better to report the error to the caller. If the error cannot be " +"reported to caller, :c:func:`Py_FatalError` can be used." msgstr "" -#: ../../c-api/intro.rst:192 +#: ../../c-api/intro.rst:219 +msgid "" +"Use this for unused arguments in a function definition to silence compiler " +"warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." +msgstr "" + +#: ../../c-api/intro.rst:226 msgid "" "Creates a variable with name ``name`` that can be used in docstrings. If " "Python is built without docstrings, the value will be empty." msgstr "" -#: ../../c-api/intro.rst:195 +#: ../../c-api/intro.rst:229 msgid "" "Use :c:macro:`PyDoc_STRVAR` for docstrings to support building Python " "without docstrings, as specified in :pep:`7`." msgstr "" -#: ../../c-api/intro.rst:210 +#: ../../c-api/intro.rst:244 msgid "" "Creates a docstring for the given input string or an empty string if " "docstrings are disabled." msgstr "" -#: ../../c-api/intro.rst:213 +#: ../../c-api/intro.rst:247 msgid "" "Use :c:macro:`PyDoc_STR` in specifying docstrings to support building Python " "without docstrings, as specified in :pep:`7`." msgstr "" -#: ../../c-api/intro.rst:227 +#: ../../c-api/intro.rst:262 msgid "Objects, Types and Reference Counts" msgstr "" -#: ../../c-api/intro.rst:231 +#: ../../c-api/intro.rst:266 msgid "" "Most Python/C API functions have one or more arguments as well as a return " "value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " @@ -284,7 +325,7 @@ msgid "" "objects." msgstr "" -#: ../../c-api/intro.rst:242 +#: ../../c-api/intro.rst:277 msgid "" "All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" "`reference count`. An object's type determines what kind of object it is (e." @@ -295,11 +336,11 @@ msgid "" "a Python list." msgstr "" -#: ../../c-api/intro.rst:253 +#: ../../c-api/intro.rst:288 msgid "Reference Counts" msgstr "" -#: ../../c-api/intro.rst:255 +#: ../../c-api/intro.rst:290 msgid "" "The reference count is important because today's computers have a finite " "(and often severely limited) memory size; it counts how many different " @@ -313,7 +354,7 @@ msgid "" "for now, the solution is \"don't do that.\")" msgstr "" -#: ../../c-api/intro.rst:270 +#: ../../c-api/intro.rst:305 msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to increment an object's reference count " @@ -331,7 +372,7 @@ msgid "" "reference count increment is a simple operation." msgstr "" -#: ../../c-api/intro.rst:284 +#: ../../c-api/intro.rst:319 msgid "" "It is not necessary to increment an object's reference count for every " "local variable that contains a pointer to an object. In theory, the " @@ -348,7 +389,7 @@ msgid "" "to hold a reference to every argument for the duration of the call." msgstr "" -#: ../../c-api/intro.rst:298 +#: ../../c-api/intro.rst:333 msgid "" "However, a common pitfall is to extract an object from a list and hold on to " "it for a while without incrementing its reference count. Some other " @@ -359,7 +400,7 @@ msgid "" "from a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" -#: ../../c-api/intro.rst:306 +#: ../../c-api/intro.rst:341 msgid "" "A safe approach is to always use the generic operations (functions whose " "name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " @@ -369,11 +410,11 @@ msgid "" "becomes second nature." msgstr "" -#: ../../c-api/intro.rst:316 +#: ../../c-api/intro.rst:351 msgid "Reference Count Details" msgstr "" -#: ../../c-api/intro.rst:318 +#: ../../c-api/intro.rst:353 msgid "" "The reference count behavior of functions in the Python/C API is best " "explained in terms of *ownership of references*. Ownership pertains to " @@ -390,7 +431,7 @@ msgid "" "`borrowed reference`." msgstr "" -#: ../../c-api/intro.rst:331 +#: ../../c-api/intro.rst:366 msgid "" "Conversely, when a calling function passes in a reference to an object, " "there are two possibilities: the function *steals* a reference to the " @@ -399,7 +440,7 @@ msgid "" "reference, and you are not responsible for it any longer." msgstr "" -#: ../../c-api/intro.rst:341 +#: ../../c-api/intro.rst:376 msgid "" "Few functions steal references; the two notable exceptions are :c:func:" "`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " @@ -411,7 +452,7 @@ msgid "" "below)::" msgstr "" -#: ../../c-api/intro.rst:356 +#: ../../c-api/intro.rst:391 msgid "" "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately " "stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object " @@ -419,7 +460,7 @@ msgid "" "another reference before calling the reference-stealing function." msgstr "" -#: ../../c-api/intro.rst:361 +#: ../../c-api/intro.rst:396 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " @@ -427,13 +468,13 @@ msgid "" "func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -#: ../../c-api/intro.rst:366 +#: ../../c-api/intro.rst:401 msgid "" "Equivalent code for populating a list can be written using :c:func:" "`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" -#: ../../c-api/intro.rst:369 +#: ../../c-api/intro.rst:404 msgid "" "However, in practice, you will rarely use these ways of creating and " "populating a tuple or list. There's a generic function, :c:func:" @@ -442,7 +483,7 @@ msgid "" "be replaced by the following (which also takes care of the error checking)::" msgstr "" -#: ../../c-api/intro.rst:380 +#: ../../c-api/intro.rst:415 msgid "" "It is much more common to use :c:func:`PyObject_SetItem` and friends with " "items whose references you are only borrowing, like arguments that were " @@ -453,7 +494,7 @@ msgid "" "sequence) to a given item::" msgstr "" -#: ../../c-api/intro.rst:410 +#: ../../c-api/intro.rst:445 msgid "" "The situation is slightly different for function return values. While " "passing a reference to most functions does not change your ownership " @@ -466,7 +507,7 @@ msgid "" "becomes the owner of the reference)." msgstr "" -#: ../../c-api/intro.rst:419 +#: ../../c-api/intro.rst:454 msgid "" "It is important to realize that whether you own a reference returned by a " "function depends on which function you call only --- *the plumage* (the type " @@ -477,18 +518,18 @@ msgid "" "the same arguments), you do own a reference to the returned object." msgstr "" -#: ../../c-api/intro.rst:431 +#: ../../c-api/intro.rst:466 msgid "" "Here is an example of how you could write a function that computes the sum " "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " "and once using :c:func:`PySequence_GetItem`. ::" msgstr "" -#: ../../c-api/intro.rst:495 +#: ../../c-api/intro.rst:530 msgid "Types" msgstr "" -#: ../../c-api/intro.rst:497 +#: ../../c-api/intro.rst:532 msgid "" "There are few other data types that play a significant role in the Python/C " "API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" @@ -499,7 +540,7 @@ msgid "" "that use them." msgstr "" -#: ../../c-api/intro.rst:507 +#: ../../c-api/intro.rst:542 msgid "" "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. " "C99 doesn't define such a thing directly (size_t is an unsigned integral " @@ -507,11 +548,11 @@ msgid "" "positive value of type :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/intro.rst:516 +#: ../../c-api/intro.rst:551 msgid "Exceptions" msgstr "例外" -#: ../../c-api/intro.rst:518 +#: ../../c-api/intro.rst:553 msgid "" "The Python programmer only needs to deal with exceptions if specific error " "handling is required; unhandled exceptions are automatically propagated to " @@ -520,7 +561,7 @@ msgid "" "stack traceback." msgstr "" -#: ../../c-api/intro.rst:526 +#: ../../c-api/intro.rst:561 msgid "" "For C programmers, however, error checking always has to be explicit. All " "functions in the Python/C API can raise exceptions, unless an explicit claim " @@ -535,7 +576,7 @@ msgid "" "explicitly documented." msgstr "" -#: ../../c-api/intro.rst:541 +#: ../../c-api/intro.rst:576 msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " @@ -548,7 +589,7 @@ msgid "" "clears the exception state." msgstr "" -#: ../../c-api/intro.rst:551 +#: ../../c-api/intro.rst:586 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " @@ -561,7 +602,7 @@ msgid "" "``sys.exc_info()`` and friends." msgstr "" -#: ../../c-api/intro.rst:563 +#: ../../c-api/intro.rst:598 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " "the exception state from Python code is to call the function :func:`sys." @@ -575,7 +616,7 @@ msgid "" "referenced by the stack frames in the traceback." msgstr "" -#: ../../c-api/intro.rst:574 +#: ../../c-api/intro.rst:609 msgid "" "As a general principle, a function that calls another function to perform " "some task should check whether the called function raised an exception, and " @@ -586,7 +627,7 @@ msgid "" "of the error." msgstr "" -#: ../../c-api/intro.rst:583 +#: ../../c-api/intro.rst:618 msgid "" "A simple example of detecting exceptions and passing them on is shown in " "the :c:func:`sum_sequence` example above. It so happens that this example " @@ -595,11 +636,11 @@ msgid "" "why you like Python, we show the equivalent Python code::" msgstr "" -#: ../../c-api/intro.rst:598 +#: ../../c-api/intro.rst:633 msgid "Here is the corresponding C code, in all its glory::" msgstr "" -#: ../../c-api/intro.rst:650 +#: ../../c-api/intro.rst:685 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " "illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" @@ -612,11 +653,11 @@ msgid "" "success after the final call made is successful." msgstr "" -#: ../../c-api/intro.rst:664 +#: ../../c-api/intro.rst:699 msgid "Embedding Python" msgstr "嵌入式Python" -#: ../../c-api/intro.rst:666 +#: ../../c-api/intro.rst:701 msgid "" "The one important task that only embedders (as opposed to extension writers) " "of the Python interpreter have to worry about is the initialization, and " @@ -624,7 +665,7 @@ msgid "" "the interpreter can only be used after the interpreter has been initialized." msgstr "" -#: ../../c-api/intro.rst:679 +#: ../../c-api/intro.rst:714 msgid "" "The basic initialization function is :c:func:`Py_Initialize`. This " "initializes the table of loaded modules, and creates the fundamental " @@ -632,15 +673,15 @@ msgid "" "initializes the module search path (``sys.path``)." msgstr "" -#: ../../c-api/intro.rst:686 +#: ../../c-api/intro.rst:719 msgid "" ":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." "argv``). If this variable is needed by Python code that will be executed " -"later, it must be set explicitly with a call to ``PySys_SetArgvEx(argc, " -"argv, updatepath)`` after the call to :c:func:`Py_Initialize`." +"later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` " +"must be set: see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/intro.rst:691 +#: ../../c-api/intro.rst:724 msgid "" "On most systems (in particular, on Unix and Windows, although the details " "are slightly different), :c:func:`Py_Initialize` calculates the module " @@ -652,7 +693,7 @@ msgid "" "on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -#: ../../c-api/intro.rst:700 +#: ../../c-api/intro.rst:733 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" @@ -663,7 +704,7 @@ msgid "" "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" -#: ../../c-api/intro.rst:715 +#: ../../c-api/intro.rst:748 msgid "" "The embedding application can steer the search by calling " "``Py_SetProgramName(file)`` *before* calling :c:func:`Py_Initialize`. Note " @@ -674,7 +715,7 @@ msgid "" "func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." msgstr "" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:758 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " "application may want to start over (make another call to :c:func:" @@ -688,18 +729,18 @@ msgid "" "released." msgstr "" -#: ../../c-api/intro.rst:739 +#: ../../c-api/intro.rst:772 msgid "Debugging Builds" msgstr "" -#: ../../c-api/intro.rst:741 +#: ../../c-api/intro.rst:774 msgid "" "Python can be built with several macros to enable extra checks of the " "interpreter and extension modules. These checks tend to add a large amount " "of overhead to the runtime so they are not enabled by default." msgstr "" -#: ../../c-api/intro.rst:745 +#: ../../c-api/intro.rst:778 msgid "" "A full list of the various types of debugging builds is in the file :file:" "`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " @@ -709,7 +750,7 @@ msgid "" "section." msgstr "" -#: ../../c-api/intro.rst:751 +#: ../../c-api/intro.rst:784 msgid "" "Compiling the interpreter with the :c:macro:`Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `." msgstr "" -#: ../../c-api/intro.rst:762 +#: ../../c-api/intro.rst:795 msgid "" "Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" "`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " @@ -736,7 +777,7 @@ msgid "" "this happens after every statement run by the interpreter.)" msgstr "" -#: ../../c-api/intro.rst:769 +#: ../../c-api/intro.rst:802 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." diff --git a/c-api/list.po b/c-api/list.po index cf09e1a79b..4e27de7f5b 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Nkeys Syu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,7 +64,7 @@ msgid "" msgstr "" #: ../../c-api/list.rst:56 -msgid "Macro form of :c:func:`PyList_Size` without error checking." +msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "" #: ../../c-api/list.rst:61 @@ -76,7 +76,7 @@ msgid "" msgstr "" #: ../../c-api/list.rst:69 -msgid "Macro form of :c:func:`PyList_GetItem` without error checking." +msgid "Similar to :c:func:`PyList_GetItem`, but without error checking." msgstr "" #: ../../c-api/list.rst:74 diff --git a/c-api/memory.po b/c-api/memory.po index 7d1d4f0402..20cddf3a97 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -557,19 +557,19 @@ msgid "" "following fields:" msgstr "" -#: ../../c-api/memory.rst:409 ../../c-api/memory.rst:626 +#: ../../c-api/memory.rst:409 ../../c-api/memory.rst:628 msgid "Field" msgstr "" -#: ../../c-api/memory.rst:409 ../../c-api/memory.rst:626 +#: ../../c-api/memory.rst:409 ../../c-api/memory.rst:628 msgid "Meaning" msgstr "" -#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:628 +#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:630 msgid "``void *ctx``" msgstr "``void *ctx``" -#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:628 +#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:630 msgid "user context passed as first argument" msgstr "" @@ -696,17 +696,23 @@ msgid "" "debug hooks on top on the new allocator." msgstr "" -#: ../../c-api/memory.rst:482 +#: ../../c-api/memory.rst:479 +msgid "" +"See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " +"with PyPreConfig `." +msgstr "" + +#: ../../c-api/memory.rst:484 msgid "" "Setup :ref:`debug hooks in the Python memory allocators ` " "to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:489 +#: ../../c-api/memory.rst:491 msgid "Debug hooks on the Python memory allocators" msgstr "" -#: ../../c-api/memory.rst:491 +#: ../../c-api/memory.rst:493 msgid "" "When :ref:`Python is built in debug mode `, the :c:func:" "`PyMem_SetupDebugHooks` function is called at the :ref:`Python " @@ -714,19 +720,19 @@ msgid "" "allocators to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:496 +#: ../../c-api/memory.rst:498 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -#: ../../c-api/memory.rst:499 +#: ../../c-api/memory.rst:501 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" -#: ../../c-api/memory.rst:502 +#: ../../c-api/memory.rst:504 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -736,32 +742,32 @@ msgid "" "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" -#: ../../c-api/memory.rst:509 +#: ../../c-api/memory.rst:511 msgid "Runtime checks:" msgstr "" -#: ../../c-api/memory.rst:511 +#: ../../c-api/memory.rst:513 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:513 +#: ../../c-api/memory.rst:515 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" -#: ../../c-api/memory.rst:514 +#: ../../c-api/memory.rst:516 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -#: ../../c-api/memory.rst:515 +#: ../../c-api/memory.rst:517 msgid "" "Check that the :term:`GIL ` is held when allocator " "functions of :c:data:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and :" "c:data:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called." msgstr "" -#: ../../c-api/memory.rst:520 +#: ../../c-api/memory.rst:522 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " @@ -769,7 +775,7 @@ msgid "" "memory block was traced." msgstr "" -#: ../../c-api/memory.rst:525 +#: ../../c-api/memory.rst:527 msgid "" "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " "block of *N* bytes requested. The memory layout is like so, where p " @@ -779,49 +785,49 @@ msgid "" "Python slice):" msgstr "" -#: ../../c-api/memory.rst:532 +#: ../../c-api/memory.rst:534 msgid "``p[-2*S:-S]``" msgstr "``p[-2*S:-S]``" -#: ../../c-api/memory.rst:532 +#: ../../c-api/memory.rst:534 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" -#: ../../c-api/memory.rst:539 +#: ../../c-api/memory.rst:541 msgid "``p[-S]``" msgstr "``p[-S]``" -#: ../../c-api/memory.rst:535 +#: ../../c-api/memory.rst:537 msgid "API identifier (ASCII character):" msgstr "" -#: ../../c-api/memory.rst:537 +#: ../../c-api/memory.rst:539 msgid "``'r'`` for :c:data:`PYMEM_DOMAIN_RAW`." msgstr "" -#: ../../c-api/memory.rst:538 +#: ../../c-api/memory.rst:540 msgid "``'m'`` for :c:data:`PYMEM_DOMAIN_MEM`." msgstr "" -#: ../../c-api/memory.rst:539 +#: ../../c-api/memory.rst:541 msgid "``'o'`` for :c:data:`PYMEM_DOMAIN_OBJ`." msgstr "" -#: ../../c-api/memory.rst:542 +#: ../../c-api/memory.rst:544 msgid "``p[-S+1:0]``" msgstr "``p[-S+1:0]``" -#: ../../c-api/memory.rst:542 +#: ../../c-api/memory.rst:544 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" -#: ../../c-api/memory.rst:551 +#: ../../c-api/memory.rst:553 msgid "``p[0:N]``" msgstr "``p[0:N]``" -#: ../../c-api/memory.rst:545 +#: ../../c-api/memory.rst:547 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -832,25 +838,25 @@ msgid "" "bytes are also filled with PYMEM_DEADBYTE." msgstr "" -#: ../../c-api/memory.rst:554 +#: ../../c-api/memory.rst:556 msgid "``p[N:N+S]``" msgstr "``p[N:N+S]``" -#: ../../c-api/memory.rst:554 +#: ../../c-api/memory.rst:556 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" -#: ../../c-api/memory.rst:565 +#: ../../c-api/memory.rst:567 msgid "``p[N+S:N+2*S]``" msgstr "``p[N+S:N+2*S]``" -#: ../../c-api/memory.rst:557 +#: ../../c-api/memory.rst:559 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" -#: ../../c-api/memory.rst:560 +#: ../../c-api/memory.rst:562 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian ``size_t``. If \"bad memory\" is detected later, " @@ -860,7 +866,7 @@ msgid "" "incremented, and exists so you can set such a breakpoint easily." msgstr "" -#: ../../c-api/memory.rst:567 +#: ../../c-api/memory.rst:569 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -873,7 +879,7 @@ msgid "" "getting used)." msgstr "" -#: ../../c-api/memory.rst:576 +#: ../../c-api/memory.rst:578 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " "compiled in release mode. On error, the debug hooks now use :mod:" @@ -882,7 +888,7 @@ msgid "" "`PYMEM_DOMAIN_OBJ` and :c:data:`PYMEM_DOMAIN_MEM` domains are called." msgstr "" -#: ../../c-api/memory.rst:584 +#: ../../c-api/memory.rst:586 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " @@ -890,11 +896,11 @@ msgid "" "``malloc()`` and ``free()``." msgstr "" -#: ../../c-api/memory.rst:594 +#: ../../c-api/memory.rst:596 msgid "The pymalloc allocator" msgstr "" -#: ../../c-api/memory.rst:596 +#: ../../c-api/memory.rst:598 msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " @@ -903,114 +909,114 @@ msgid "" "512 bytes." msgstr "" -#: ../../c-api/memory.rst:601 +#: ../../c-api/memory.rst:603 msgid "" "*pymalloc* is the :ref:`default allocator ` of " "the :c:data:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:data:" "`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" -#: ../../c-api/memory.rst:605 +#: ../../c-api/memory.rst:607 msgid "The arena allocator uses the following functions:" msgstr "" -#: ../../c-api/memory.rst:607 +#: ../../c-api/memory.rst:609 msgid ":c:func:`VirtualAlloc` and :c:func:`VirtualFree` on Windows," msgstr "" -#: ../../c-api/memory.rst:608 +#: ../../c-api/memory.rst:610 msgid ":c:func:`mmap` and :c:func:`munmap` if available," msgstr "" -#: ../../c-api/memory.rst:609 +#: ../../c-api/memory.rst:611 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -#: ../../c-api/memory.rst:611 +#: ../../c-api/memory.rst:613 msgid "" "This allocator is disabled if Python is configured with the :option:`--" "without-pymalloc` option. It can also be disabled at runtime using the :" "envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "" -#: ../../c-api/memory.rst:616 +#: ../../c-api/memory.rst:618 msgid "Customize pymalloc Arena Allocator" msgstr "" -#: ../../c-api/memory.rst:622 +#: ../../c-api/memory.rst:624 msgid "" "Structure used to describe an arena allocator. The structure has three " "fields:" msgstr "" -#: ../../c-api/memory.rst:630 +#: ../../c-api/memory.rst:632 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "``void* alloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:630 +#: ../../c-api/memory.rst:632 msgid "allocate an arena of size bytes" msgstr "" -#: ../../c-api/memory.rst:632 +#: ../../c-api/memory.rst:634 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "``void free(void *ctx, void *ptr, size_t size)``" -#: ../../c-api/memory.rst:632 +#: ../../c-api/memory.rst:634 msgid "free an arena" msgstr "" -#: ../../c-api/memory.rst:637 +#: ../../c-api/memory.rst:639 msgid "Get the arena allocator." msgstr "" -#: ../../c-api/memory.rst:641 +#: ../../c-api/memory.rst:643 msgid "Set the arena allocator." msgstr "" -#: ../../c-api/memory.rst:645 +#: ../../c-api/memory.rst:647 msgid "tracemalloc C API" msgstr "" -#: ../../c-api/memory.rst:651 +#: ../../c-api/memory.rst:653 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -#: ../../c-api/memory.rst:653 +#: ../../c-api/memory.rst:655 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" -#: ../../c-api/memory.rst:656 +#: ../../c-api/memory.rst:658 msgid "If memory block is already tracked, update the existing trace." msgstr "" -#: ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:662 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" -#: ../../c-api/memory.rst:663 +#: ../../c-api/memory.rst:665 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" -#: ../../c-api/memory.rst:669 +#: ../../c-api/memory.rst:671 msgid "Examples" msgstr "範例" -#: ../../c-api/memory.rst:671 +#: ../../c-api/memory.rst:673 msgid "" "Here is the example from section :ref:`memoryoverview`, rewritten so that " "the I/O buffer is allocated from the Python heap by using the first function " "set::" msgstr "" -#: ../../c-api/memory.rst:684 +#: ../../c-api/memory.rst:686 msgid "The same code using the type-oriented function set::" msgstr "" -#: ../../c-api/memory.rst:696 +#: ../../c-api/memory.rst:698 msgid "" "Note that in the two examples above, the buffer is always manipulated via " "functions belonging to the same set. Indeed, it is required to use the same " @@ -1020,14 +1026,14 @@ msgid "" "different allocators operating on different heaps. ::" msgstr "" -#: ../../c-api/memory.rst:711 +#: ../../c-api/memory.rst:713 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " "Python heap, objects in Python are allocated and released with :c:func:" "`PyObject_New`, :c:func:`PyObject_NewVar` and :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/memory.rst:715 +#: ../../c-api/memory.rst:717 msgid "" "These will be explained in the next chapter on defining and implementing new " "object types in C." diff --git a/c-api/object.po b/c-api/object.po index e77a15f5fd..81fda35c64 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -133,13 +133,39 @@ msgid "" "creates the dictionary if necessary." msgstr "" -#: ../../c-api/object.rst:134 +#: ../../c-api/object.rst:129 +msgid "" +"This function may also be called to get the :py:attr:`~object.__dict__` of " +"the object *o*. Pass ``NULL`` for *context* when calling it. Since this " +"function may need to allocate memory for the dictionary, it may be more " +"efficient to call :c:func:`PyObject_GetAttr` when accessing an attribute on " +"the object." +msgstr "" + +#: ../../c-api/object.rst:135 +msgid "On failure, returns ``NULL`` with an exception set." +msgstr "" + +#: ../../c-api/object.rst:142 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: ../../c-api/object.rst:142 +#: ../../c-api/object.rst:150 +msgid "" +"Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " +"there is no ``__dict__``, return ``NULL`` without setting an exception." +msgstr "" + +#: ../../c-api/object.rst:153 +msgid "" +"This function may need to allocate memory for the dictionary, so it may be " +"more efficient to call :c:func:`PyObject_GetAttr` when accessing an " +"attribute on the object." +msgstr "" + +#: ../../c-api/object.rst:160 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`, :const:" @@ -150,7 +176,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/object.rst:152 +#: ../../c-api/object.rst:170 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`, :const:" @@ -161,13 +187,13 @@ msgid "" "to *opid*." msgstr "" -#: ../../c-api/object.rst:161 +#: ../../c-api/object.rst:179 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`." msgstr "" -#: ../../c-api/object.rst:168 +#: ../../c-api/object.rst:186 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -175,13 +201,13 @@ msgid "" "function." msgstr "" -#: ../../c-api/object.rst:172 ../../c-api/object.rst:196 +#: ../../c-api/object.rst:190 ../../c-api/object.rst:214 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/object.rst:180 +#: ../../c-api/object.rst:198 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " "but escape the non-ASCII characters in the string returned by :c:func:" @@ -190,7 +216,7 @@ msgid "" "Called by the :func:`ascii` built-in function." msgstr "" -#: ../../c-api/object.rst:191 +#: ../../c-api/object.rst:209 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -198,7 +224,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: ../../c-api/object.rst:205 +#: ../../c-api/object.rst:223 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -207,20 +233,20 @@ msgid "" "bytes object." msgstr "" -#: ../../c-api/object.rst:214 +#: ../../c-api/object.rst:232 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: ../../c-api/object.rst:217 ../../c-api/object.rst:236 +#: ../../c-api/object.rst:235 ../../c-api/object.rst:254 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: ../../c-api/object.rst:221 +#: ../../c-api/object.rst:239 msgid "" "If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " @@ -228,52 +254,52 @@ msgid "" "e. contained in ``cls.__mro__``." msgstr "" -#: ../../c-api/object.rst:226 +#: ../../c-api/object.rst:244 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " "a :attr:`__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:233 +#: ../../c-api/object.rst:251 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: ../../c-api/object.rst:240 +#: ../../c-api/object.rst:258 msgid "" "If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -#: ../../c-api/object.rst:244 +#: ../../c-api/object.rst:262 msgid "" "An instance *inst* can override what is considered its class by having a :" "attr:`__class__` attribute." msgstr "" -#: ../../c-api/object.rst:247 +#: ../../c-api/object.rst:265 msgid "" "An object *cls* can override if it is considered a class, and what its base " "classes are, by having a :attr:`__bases__` attribute (which must be a tuple " "of base classes)." msgstr "" -#: ../../c-api/object.rst:256 +#: ../../c-api/object.rst:274 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: ../../c-api/object.rst:259 +#: ../../c-api/object.rst:277 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/object.rst:266 +#: ../../c-api/object.rst:284 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not hashable and " "return ``-1``. This function receives special treatment when stored in a " @@ -281,21 +307,21 @@ msgid "" "that it is not hashable." msgstr "" -#: ../../c-api/object.rst:274 +#: ../../c-api/object.rst:292 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:281 +#: ../../c-api/object.rst:299 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:290 +#: ../../c-api/object.rst:308 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -306,13 +332,13 @@ msgid "" "incremented reference count is needed." msgstr "" -#: ../../c-api/object.rst:301 +#: ../../c-api/object.rst:319 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: ../../c-api/object.rst:310 +#: ../../c-api/object.rst:328 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -320,7 +346,7 @@ msgid "" "``len(o)``." msgstr "" -#: ../../c-api/object.rst:317 +#: ../../c-api/object.rst:335 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -329,26 +355,26 @@ msgid "" "defaultvalue)``." msgstr "" -#: ../../c-api/object.rst:327 +#: ../../c-api/object.rst:345 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: ../../c-api/object.rst:333 +#: ../../c-api/object.rst:351 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: ../../c-api/object.rst:341 +#: ../../c-api/object.rst:359 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: ../../c-api/object.rst:347 +#: ../../c-api/object.rst:365 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -358,7 +384,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:356 +#: ../../c-api/object.rst:374 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -366,7 +392,7 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:364 +#: ../../c-api/object.rst:382 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " diff --git a/c-api/reflection.po b/c-api/reflection.po index 96086c9256..fb19748a1f 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -51,45 +51,18 @@ msgid "See also :c:func:`PyThreadState_GetFrame`." msgstr "另請見 :c:func:`PyThreadState_GetFrame`\\ 。" #: ../../c-api/reflection.rst:36 -msgid "Get the *frame* next outer frame." -msgstr "" - -#: ../../c-api/reflection.rst:38 -msgid "" -"Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame." -msgstr "" - -#: ../../c-api/reflection.rst:40 ../../c-api/reflection.rst:60 -msgid "*frame* must not be ``NULL``." -msgstr "*frame* 不可為 ``NULL``。" - -#: ../../c-api/reflection.rst:47 -msgid "Get the *frame* code." -msgstr "" - -#: ../../c-api/reflection.rst:49 -msgid "Return a :term:`strong reference`." -msgstr "" - -#: ../../c-api/reflection.rst:51 -msgid "" -"*frame* must not be ``NULL``. The result (frame code) cannot be ``NULL``." -msgstr "" - -#: ../../c-api/reflection.rst:58 -msgid "Return the line number that *frame* is currently executing." -msgstr "" - -#: ../../c-api/reflection.rst:65 msgid "" "Return the name of *func* if it is a function, class or instance object, " "else the name of *func*\\s type." msgstr "" -#: ../../c-api/reflection.rst:71 +#: ../../c-api/reflection.rst:42 msgid "" "Return a description string, depending on the type of *func*. Return values " "include \"()\" for functions and methods, \" constructor\", \" instance\", " "and \" object\". Concatenated with the result of :c:func:" "`PyEval_GetFuncName`, the result will be a description of *func*." msgstr "" + +#~ msgid "*frame* must not be ``NULL``." +#~ msgstr "*frame* 不可為 ``NULL``。" diff --git a/c-api/structures.po b/c-api/structures.po index d61f8cd4c4..1add53e04a 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,60 +119,79 @@ msgstr "" msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." msgstr "" -#: ../../c-api/structures.rst:107 +#: ../../c-api/structures.rst:104 +msgid "" +":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " +"type is no longer :c:expr:`const PyObject*`." +msgstr "" + +#: ../../c-api/structures.rst:111 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -#: ../../c-api/structures.rst:115 +#: ../../c-api/structures.rst:119 msgid "Set the object *o* type to *type*." msgstr "" -#: ../../c-api/structures.rst:122 +#: ../../c-api/structures.rst:126 msgid "Get the reference count of the Python object *o*." msgstr "" -#: ../../c-api/structures.rst:124 +#: ../../c-api/structures.rst:128 msgid "" -":c:func:`Py_REFCNT()` is changed to the inline static function. Use :c:func:" -"`Py_SET_REFCNT()` to set an object reference count." +"Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count." +msgstr "" + +#: ../../c-api/structures.rst:130 +msgid "The parameter type is no longer :c:expr:`const PyObject*`." msgstr "" -#: ../../c-api/structures.rst:131 +#: ../../c-api/structures.rst:133 +msgid ":c:func:`Py_REFCNT()` is changed to the inline static function." +msgstr "" + +#: ../../c-api/structures.rst:139 msgid "Set the object *o* reference counter to *refcnt*." msgstr "" -#: ../../c-api/structures.rst:138 +#: ../../c-api/structures.rst:146 msgid "Get the size of the Python object *o*." msgstr "" -#: ../../c-api/structures.rst:140 +#: ../../c-api/structures.rst:148 msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." msgstr "" -#: ../../c-api/structures.rst:145 +#: ../../c-api/structures.rst:150 +msgid "" +":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " +"type is no longer :c:expr:`const PyVarObject*`." +msgstr "" + +#: ../../c-api/structures.rst:157 msgid "Set the object *o* size to *size*." msgstr "" -#: ../../c-api/structures.rst:152 +#: ../../c-api/structures.rst:164 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyObject` type. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:161 +#: ../../c-api/structures.rst:173 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyVarObject` type, including the :attr:`ob_size` field. This macro expands " "to::" msgstr "" -#: ../../c-api/structures.rst:170 +#: ../../c-api/structures.rst:182 msgid "Implementing functions and methods" msgstr "" -#: ../../c-api/structures.rst:174 +#: ../../c-api/structures.rst:186 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -182,105 +201,105 @@ msgid "" "reference." msgstr "" -#: ../../c-api/structures.rst:181 +#: ../../c-api/structures.rst:193 msgid "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:188 +#: ../../c-api/structures.rst:200 msgid "" "Type of the functions used to implement Python callables in C with " "signature :const:`METH_VARARGS | METH_KEYWORDS`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:199 +#: ../../c-api/structures.rst:211 msgid "" "Type of the functions used to implement Python callables in C with " "signature :const:`METH_FASTCALL`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:209 +#: ../../c-api/structures.rst:221 msgid "" "Type of the functions used to implement Python callables in C with " "signature :const:`METH_FASTCALL | METH_KEYWORDS`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:220 +#: ../../c-api/structures.rst:232 msgid "" "Type of the functions used to implement Python callables in C with " "signature :const:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`. The function " "signature is::" msgstr "" -#: ../../c-api/structures.rst:235 +#: ../../c-api/structures.rst:247 msgid "" "Structure used to describe a method of an extension type. This structure " "has four fields:" msgstr "" -#: ../../c-api/structures.rst:239 ../../c-api/structures.rst:395 -#: ../../c-api/structures.rst:491 +#: ../../c-api/structures.rst:251 ../../c-api/structures.rst:410 +#: ../../c-api/structures.rst:506 msgid "Field" msgstr "" -#: ../../c-api/structures.rst:239 ../../c-api/structures.rst:395 -#: ../../c-api/structures.rst:491 +#: ../../c-api/structures.rst:251 ../../c-api/structures.rst:410 +#: ../../c-api/structures.rst:506 msgid "C Type" msgstr "C Type" -#: ../../c-api/structures.rst:239 ../../c-api/structures.rst:395 -#: ../../c-api/structures.rst:491 +#: ../../c-api/structures.rst:251 ../../c-api/structures.rst:410 +#: ../../c-api/structures.rst:506 msgid "Meaning" msgstr "" -#: ../../c-api/structures.rst:241 +#: ../../c-api/structures.rst:253 msgid ":attr:`ml_name`" msgstr ":attr:`ml_name`" -#: ../../c-api/structures.rst:241 ../../c-api/structures.rst:249 -#: ../../c-api/structures.rst:397 ../../c-api/structures.rst:410 -#: ../../c-api/structures.rst:426 ../../c-api/structures.rst:493 -#: ../../c-api/structures.rst:501 +#: ../../c-api/structures.rst:253 ../../c-api/structures.rst:261 +#: ../../c-api/structures.rst:412 ../../c-api/structures.rst:425 +#: ../../c-api/structures.rst:441 ../../c-api/structures.rst:508 +#: ../../c-api/structures.rst:516 msgid "const char \\*" msgstr "const char \\*" -#: ../../c-api/structures.rst:241 +#: ../../c-api/structures.rst:253 msgid "name of the method" msgstr "" -#: ../../c-api/structures.rst:243 +#: ../../c-api/structures.rst:255 msgid ":attr:`ml_meth`" msgstr ":attr:`ml_meth`" -#: ../../c-api/structures.rst:243 +#: ../../c-api/structures.rst:255 msgid "PyCFunction" msgstr "PyCFunction" -#: ../../c-api/structures.rst:243 +#: ../../c-api/structures.rst:255 msgid "pointer to the C implementation" msgstr "" -#: ../../c-api/structures.rst:246 +#: ../../c-api/structures.rst:258 msgid ":attr:`ml_flags`" msgstr ":attr:`ml_flags`" -#: ../../c-api/structures.rst:246 ../../c-api/structures.rst:399 -#: ../../c-api/structures.rst:406 ../../c-api/structures.rst:422 +#: ../../c-api/structures.rst:258 ../../c-api/structures.rst:414 +#: ../../c-api/structures.rst:421 ../../c-api/structures.rst:437 msgid "int" msgstr "int" -#: ../../c-api/structures.rst:246 +#: ../../c-api/structures.rst:258 msgid "flag bits indicating how the call should be constructed" msgstr "" -#: ../../c-api/structures.rst:249 +#: ../../c-api/structures.rst:261 msgid ":attr:`ml_doc`" msgstr ":attr:`ml_doc`" -#: ../../c-api/structures.rst:249 ../../c-api/structures.rst:410 +#: ../../c-api/structures.rst:261 ../../c-api/structures.rst:425 msgid "points to the contents of the docstring" msgstr "" -#: ../../c-api/structures.rst:253 +#: ../../c-api/structures.rst:265 msgid "" "The :attr:`ml_meth` is a C function pointer. The functions may be of " "different types, but they always return :c:expr:`PyObject*`. If the " @@ -290,18 +309,18 @@ msgid "" "implementation uses the specific C type of the *self* object." msgstr "" -#: ../../c-api/structures.rst:260 +#: ../../c-api/structures.rst:272 msgid "" "The :attr:`ml_flags` field is a bitfield which can include the following " "flags. The individual flags indicate either a calling convention or a " "binding convention." msgstr "" -#: ../../c-api/structures.rst:264 +#: ../../c-api/structures.rst:276 msgid "There are these calling conventions:" msgstr "" -#: ../../c-api/structures.rst:268 +#: ../../c-api/structures.rst:280 msgid "" "This is the typical calling convention, where the methods have the type :c:" "type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The " @@ -311,7 +330,7 @@ msgid "" "func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." msgstr "" -#: ../../c-api/structures.rst:278 +#: ../../c-api/structures.rst:290 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -320,7 +339,7 @@ msgid "" "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -#: ../../c-api/structures.rst:287 +#: ../../c-api/structures.rst:299 msgid "" "Fast calling convention supporting only positional arguments. The methods " "have the type :c:type:`_PyCFunctionFast`. The first parameter is *self*, the " @@ -329,11 +348,11 @@ msgid "" "the array)." msgstr "" -#: ../../c-api/structures.rst:297 +#: ../../c-api/structures.rst:309 msgid "``METH_FASTCALL`` is now part of the stable ABI." msgstr "" -#: ../../c-api/structures.rst:302 +#: ../../c-api/structures.rst:314 msgid "" "Extension of :const:`METH_FASTCALL` supporting also keyword arguments, with " "methods of type :c:type:`_PyCFunctionFastWithKeywords`. Keyword arguments " @@ -345,21 +364,21 @@ msgid "" "arguments." msgstr "" -#: ../../c-api/structures.rst:317 +#: ../../c-api/structures.rst:329 msgid "" "Extension of :const:`METH_FASTCALL | METH_KEYWORDS` supporting the *defining " "class*, that is, the class that contains the method in question. The " "defining class might be a superclass of ``Py_TYPE(self)``." msgstr "" -#: ../../c-api/structures.rst:321 +#: ../../c-api/structures.rst:333 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" -#: ../../c-api/structures.rst:330 +#: ../../c-api/structures.rst:342 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :const:`METH_NOARGS` flag. They need to be of " @@ -368,7 +387,13 @@ msgid "" "the second parameter will be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:339 +#: ../../c-api/structures.rst:348 +msgid "" +"The function must have 2 parameters. Since the second parameter is unused, :" +"c:macro:`Py_UNUSED` can be used to prevent a compiler warning." +msgstr "" + +#: ../../c-api/structures.rst:354 msgid "" "Methods with a single object argument can be listed with the :const:`METH_O` " "flag, instead of invoking :c:func:`PyArg_ParseTuple` with a ``\"O\"`` " @@ -377,7 +402,7 @@ msgid "" "argument." msgstr "" -#: ../../c-api/structures.rst:345 +#: ../../c-api/structures.rst:360 msgid "" "These two constants are not used to indicate the calling convention but the " "binding when use with methods of classes. These may not be used for " @@ -385,27 +410,27 @@ msgid "" "any given method." msgstr "" -#: ../../c-api/structures.rst:355 +#: ../../c-api/structures.rst:370 msgid "" "The method will be passed the type object as the first parameter rather than " "an instance of the type. This is used to create *class methods*, similar to " "what is created when using the :func:`classmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:365 +#: ../../c-api/structures.rst:380 msgid "" "The method will be passed ``NULL`` as the first parameter rather than an " "instance of the type. This is used to create *static methods*, similar to " "what is created when using the :func:`staticmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:369 +#: ../../c-api/structures.rst:384 msgid "" "One other constant controls whether a method is loaded in place of another " "definition with the same method name." msgstr "" -#: ../../c-api/structures.rst:375 +#: ../../c-api/structures.rst:390 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " @@ -418,194 +443,194 @@ msgid "" "calls." msgstr "" -#: ../../c-api/structures.rst:387 +#: ../../c-api/structures.rst:402 msgid "Accessing attributes of extension types" msgstr "" -#: ../../c-api/structures.rst:391 +#: ../../c-api/structures.rst:406 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. Its fields are:" msgstr "" -#: ../../c-api/structures.rst:397 +#: ../../c-api/structures.rst:412 msgid ":attr:`name`" msgstr ":attr:`name`" -#: ../../c-api/structures.rst:397 +#: ../../c-api/structures.rst:412 msgid "name of the member" msgstr "" -#: ../../c-api/structures.rst:399 +#: ../../c-api/structures.rst:414 msgid ":attr:`!type`" msgstr ":attr:`!type`" -#: ../../c-api/structures.rst:399 +#: ../../c-api/structures.rst:414 msgid "the type of the member in the C struct" msgstr "" -#: ../../c-api/structures.rst:402 +#: ../../c-api/structures.rst:417 msgid ":attr:`offset`" msgstr ":attr:`offset`" -#: ../../c-api/structures.rst:402 ../../c-api/structures.rst:438 +#: ../../c-api/structures.rst:417 ../../c-api/structures.rst:453 msgid "Py_ssize_t" msgstr "Py_ssize_t" -#: ../../c-api/structures.rst:402 +#: ../../c-api/structures.rst:417 msgid "" "the offset in bytes that the member is located on the type's object struct" msgstr "" -#: ../../c-api/structures.rst:406 +#: ../../c-api/structures.rst:421 msgid ":attr:`flags`" msgstr ":attr:`flags`" -#: ../../c-api/structures.rst:406 +#: ../../c-api/structures.rst:421 msgid "flag bits indicating if the field should be read-only or writable" msgstr "" -#: ../../c-api/structures.rst:410 +#: ../../c-api/structures.rst:425 msgid ":attr:`doc`" msgstr ":attr:`doc`" -#: ../../c-api/structures.rst:414 +#: ../../c-api/structures.rst:429 msgid "" ":attr:`!type` can be one of many ``T_`` macros corresponding to various C " "types. When the member is accessed in Python, it will be converted to the " "equivalent Python type." msgstr "" -#: ../../c-api/structures.rst:419 +#: ../../c-api/structures.rst:434 msgid "Macro name" msgstr "" -#: ../../c-api/structures.rst:419 +#: ../../c-api/structures.rst:434 msgid "C type" msgstr "" -#: ../../c-api/structures.rst:421 +#: ../../c-api/structures.rst:436 msgid "T_SHORT" msgstr "T_SHORT" -#: ../../c-api/structures.rst:421 +#: ../../c-api/structures.rst:436 msgid "short" msgstr "" -#: ../../c-api/structures.rst:422 +#: ../../c-api/structures.rst:437 msgid "T_INT" msgstr "T_INT" -#: ../../c-api/structures.rst:423 +#: ../../c-api/structures.rst:438 msgid "T_LONG" msgstr "T_LONG" -#: ../../c-api/structures.rst:423 +#: ../../c-api/structures.rst:438 msgid "long" msgstr "long" -#: ../../c-api/structures.rst:424 +#: ../../c-api/structures.rst:439 msgid "T_FLOAT" msgstr "T_FLOAT" -#: ../../c-api/structures.rst:424 +#: ../../c-api/structures.rst:439 msgid "float" msgstr "float" -#: ../../c-api/structures.rst:425 +#: ../../c-api/structures.rst:440 msgid "T_DOUBLE" msgstr "T_DOUBLE" -#: ../../c-api/structures.rst:425 +#: ../../c-api/structures.rst:440 msgid "double" msgstr "double" -#: ../../c-api/structures.rst:426 +#: ../../c-api/structures.rst:441 msgid "T_STRING" msgstr "T_STRING" -#: ../../c-api/structures.rst:427 +#: ../../c-api/structures.rst:442 msgid "T_OBJECT" msgstr "T_OBJECT" -#: ../../c-api/structures.rst:427 ../../c-api/structures.rst:428 +#: ../../c-api/structures.rst:442 ../../c-api/structures.rst:443 msgid "PyObject \\*" msgstr "PyObject \\*" -#: ../../c-api/structures.rst:428 +#: ../../c-api/structures.rst:443 msgid "T_OBJECT_EX" msgstr "T_OBJECT_EX" -#: ../../c-api/structures.rst:429 +#: ../../c-api/structures.rst:444 msgid "T_CHAR" msgstr "T_CHAR" -#: ../../c-api/structures.rst:429 ../../c-api/structures.rst:430 -#: ../../c-api/structures.rst:435 +#: ../../c-api/structures.rst:444 ../../c-api/structures.rst:445 +#: ../../c-api/structures.rst:450 msgid "char" msgstr "char" -#: ../../c-api/structures.rst:430 +#: ../../c-api/structures.rst:445 msgid "T_BYTE" msgstr "T_BYTE" -#: ../../c-api/structures.rst:431 +#: ../../c-api/structures.rst:446 msgid "T_UBYTE" msgstr "T_UBYTE" -#: ../../c-api/structures.rst:431 +#: ../../c-api/structures.rst:446 msgid "unsigned char" msgstr "unsigned char" -#: ../../c-api/structures.rst:432 +#: ../../c-api/structures.rst:447 msgid "T_UINT" msgstr "T_UINT" -#: ../../c-api/structures.rst:432 +#: ../../c-api/structures.rst:447 msgid "unsigned int" msgstr "unsigned int" -#: ../../c-api/structures.rst:433 +#: ../../c-api/structures.rst:448 msgid "T_USHORT" msgstr "T_USHORT" -#: ../../c-api/structures.rst:433 +#: ../../c-api/structures.rst:448 msgid "unsigned short" msgstr "unsigned short" -#: ../../c-api/structures.rst:434 +#: ../../c-api/structures.rst:449 msgid "T_ULONG" msgstr "T_ULONG" -#: ../../c-api/structures.rst:434 +#: ../../c-api/structures.rst:449 msgid "unsigned long" msgstr "unsigned long" -#: ../../c-api/structures.rst:435 +#: ../../c-api/structures.rst:450 msgid "T_BOOL" msgstr "T_BOOL" -#: ../../c-api/structures.rst:436 +#: ../../c-api/structures.rst:451 msgid "T_LONGLONG" msgstr "T_LONGLONG" -#: ../../c-api/structures.rst:436 +#: ../../c-api/structures.rst:451 msgid "long long" msgstr "long long" -#: ../../c-api/structures.rst:437 +#: ../../c-api/structures.rst:452 msgid "T_ULONGLONG" msgstr "T_ULONGLONG" -#: ../../c-api/structures.rst:437 +#: ../../c-api/structures.rst:452 msgid "unsigned long long" msgstr "unsigned long long" -#: ../../c-api/structures.rst:438 +#: ../../c-api/structures.rst:453 msgid "T_PYSSIZET" msgstr "T_PYSSIZET" -#: ../../c-api/structures.rst:441 +#: ../../c-api/structures.rst:456 msgid "" ":c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` differ in that :c:macro:" "`T_OBJECT` returns ``None`` if the member is ``NULL`` and :c:macro:" @@ -615,7 +640,7 @@ msgid "" "than :c:macro:`T_OBJECT`." msgstr "" -#: ../../c-api/structures.rst:448 +#: ../../c-api/structures.rst:463 msgid "" ":attr:`flags` can be ``0`` for write and read access or :c:macro:`READONLY` " "for read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies :c:" @@ -624,7 +649,7 @@ msgid "" "are set to ``NULL``)." msgstr "" -#: ../../c-api/structures.rst:456 +#: ../../c-api/structures.rst:471 msgid "" "Heap allocated types (created using :c:func:`PyType_FromSpec` or similar), " "``PyMemberDef`` may contain definitions for the special members " @@ -635,99 +660,99 @@ msgid "" "``T_PYSSIZET`` and ``READONLY``, for example::" msgstr "" -#: ../../c-api/structures.rst:473 +#: ../../c-api/structures.rst:488 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -#: ../../c-api/structures.rst:480 +#: ../../c-api/structures.rst:495 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" -#: ../../c-api/structures.rst:487 +#: ../../c-api/structures.rst:502 msgid "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -#: ../../c-api/structures.rst:493 +#: ../../c-api/structures.rst:508 msgid "name" msgstr "" -#: ../../c-api/structures.rst:493 +#: ../../c-api/structures.rst:508 msgid "attribute name" msgstr "" -#: ../../c-api/structures.rst:495 +#: ../../c-api/structures.rst:510 msgid "get" msgstr "" -#: ../../c-api/structures.rst:495 +#: ../../c-api/structures.rst:510 msgid "getter" msgstr "" -#: ../../c-api/structures.rst:495 +#: ../../c-api/structures.rst:510 msgid "C function to get the attribute" msgstr "" -#: ../../c-api/structures.rst:497 +#: ../../c-api/structures.rst:512 msgid "set" msgstr "" -#: ../../c-api/structures.rst:497 +#: ../../c-api/structures.rst:512 msgid "setter" msgstr "" -#: ../../c-api/structures.rst:497 +#: ../../c-api/structures.rst:512 msgid "" "optional C function to set or delete the attribute, if omitted the attribute " "is readonly" msgstr "" -#: ../../c-api/structures.rst:501 +#: ../../c-api/structures.rst:516 msgid "doc" msgstr "" -#: ../../c-api/structures.rst:501 +#: ../../c-api/structures.rst:516 msgid "optional docstring" msgstr "" -#: ../../c-api/structures.rst:503 +#: ../../c-api/structures.rst:518 msgid "closure" msgstr "" -#: ../../c-api/structures.rst:503 +#: ../../c-api/structures.rst:518 msgid "void \\*" msgstr "void \\*" -#: ../../c-api/structures.rst:503 +#: ../../c-api/structures.rst:518 msgid "" "optional function pointer, providing additional data for getter and setter" msgstr "" -#: ../../c-api/structures.rst:508 +#: ../../c-api/structures.rst:523 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a function pointer (the associated ``closure``)::" msgstr "" -#: ../../c-api/structures.rst:513 +#: ../../c-api/structures.rst:528 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -#: ../../c-api/structures.rst:516 +#: ../../c-api/structures.rst:531 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a function pointer (the associated ``closure``)::" msgstr "" -#: ../../c-api/structures.rst:521 +#: ../../c-api/structures.rst:536 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." diff --git a/c-api/sys.po b/c-api/sys.po index dbaa5e3caa..b74b46459b 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -115,9 +115,9 @@ msgstr "" msgid "" "Return true when the interpreter runs out of stack space. This is a " "reliable check, but is only available when :const:`USE_STACKCHECK` is " -"defined (currently on Windows using the Microsoft Visual C++ compiler). :" -"const:`USE_STACKCHECK` will be defined automatically; you should never " -"change the definition in your own code." +"defined (currently on certain versions of Windows using the Microsoft Visual " +"C++ compiler). :const:`USE_STACKCHECK` will be defined automatically; you " +"should never change the definition in your own code." msgstr "" #: ../../c-api/sys.rst:106 @@ -280,17 +280,24 @@ msgid "" "prior to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/sys.rst:240 +#: ../../c-api/sys.rst:240 ../../c-api/sys.rst:251 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"warnoptions` should be used instead, see :ref:`Python Initialization " +"Configuration `." +msgstr "" + +#: ../../c-api/sys.rst:244 msgid "" "Append *s* to :data:`sys.warnoptions`. This function must be called prior " "to :c:func:`Py_Initialize` in order to affect the warnings filter list." msgstr "" -#: ../../c-api/sys.rst:245 +#: ../../c-api/sys.rst:255 msgid "Append *unicode* to :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/sys.rst:247 +#: ../../c-api/sys.rst:257 msgid "" "Note: this function is not currently usable from outside the CPython " "implementation, as it must be called prior to the implicit import of :mod:" @@ -299,20 +306,28 @@ msgid "" "Unicode objects." msgstr "" -#: ../../c-api/sys.rst:255 +#: ../../c-api/sys.rst:267 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " +"be used instead, see :ref:`Python Initialization Configuration `." +msgstr "" + +#: ../../c-api/sys.rst:272 msgid "" "Set :data:`sys.path` to a list object of paths found in *path* which should " "be a list of paths separated with the platform's search path delimiter (``:" "`` on Unix, ``;`` on Windows)." msgstr "" -#: ../../c-api/sys.rst:261 +#: ../../c-api/sys.rst:280 msgid "" "Write the output string described by *format* to :data:`sys.stdout`. No " "exceptions are raised, even if truncation occurs (see below)." msgstr "" -#: ../../c-api/sys.rst:264 +#: ../../c-api/sys.rst:283 msgid "" "*format* should limit the total size of the formatted output string to 1000 " "bytes or less -- after 1000 bytes, the output string is truncated. In " @@ -323,51 +338,58 @@ msgid "" "of digits for very large numbers." msgstr "" -#: ../../c-api/sys.rst:272 +#: ../../c-api/sys.rst:291 msgid "" "If a problem occurs, or :data:`sys.stdout` is unset, the formatted message " "is written to the real (C level) *stdout*." msgstr "" -#: ../../c-api/sys.rst:277 +#: ../../c-api/sys.rst:296 msgid "" "As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:282 +#: ../../c-api/sys.rst:301 msgid "" "Function similar to PySys_WriteStdout() but format the message using :c:func:" "`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary " "length." msgstr "" -#: ../../c-api/sys.rst:290 +#: ../../c-api/sys.rst:309 msgid "" "As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:297 +#: ../../c-api/sys.rst:316 +msgid "" +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"xoptions` should be used instead, see :ref:`Python Initialization " +"Configuration `." +msgstr "" + +#: ../../c-api/sys.rst:320 msgid "" "Parse *s* as a set of :option:`-X` options and add them to the current " "options mapping as returned by :c:func:`PySys_GetXOptions`. This function " "may be called prior to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/sys.rst:305 +#: ../../c-api/sys.rst:330 msgid "" "Return the current dictionary of :option:`-X` options, similarly to :data:" "`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." msgstr "" -#: ../../c-api/sys.rst:314 +#: ../../c-api/sys.rst:339 msgid "" "Raise an auditing event with any active hooks. Return zero for success and " "non-zero with an exception set on failure." msgstr "" -#: ../../c-api/sys.rst:317 +#: ../../c-api/sys.rst:342 msgid "" "If any hooks have been added, *format* and other arguments will be used to " "construct a tuple to pass. Apart from ``N``, the same format characters as " @@ -378,23 +400,23 @@ msgid "" "leaks.)" msgstr "" -#: ../../c-api/sys.rst:325 +#: ../../c-api/sys.rst:350 msgid "" "Note that ``#`` format characters should always be treated as :c:type:" "`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." msgstr "" -#: ../../c-api/sys.rst:328 +#: ../../c-api/sys.rst:353 msgid ":func:`sys.audit` performs the same function from Python code." msgstr "" -#: ../../c-api/sys.rst:334 +#: ../../c-api/sys.rst:359 msgid "" "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " "unavoidable deprecation warning was raised." msgstr "" -#: ../../c-api/sys.rst:340 +#: ../../c-api/sys.rst:365 msgid "" "Append the callable *hook* to the list of active auditing hooks. Return zero " "on success and non-zero on failure. If the runtime has been initialized, " @@ -402,14 +424,14 @@ msgid "" "all interpreters created by the runtime." msgstr "" -#: ../../c-api/sys.rst:346 +#: ../../c-api/sys.rst:371 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " "refer directly to Python state." msgstr "" -#: ../../c-api/sys.rst:350 +#: ../../c-api/sys.rst:375 msgid "" "This function is safe to call before :c:func:`Py_Initialize`. When called " "after runtime initialization, existing audit hooks are notified and may " @@ -417,7 +439,7 @@ msgid "" "`Exception` (other errors will not be silenced)." msgstr "" -#: ../../c-api/sys.rst:355 +#: ../../c-api/sys.rst:380 msgid "" "The hook function is of type :c:expr:`int (*)(const char *event, PyObject " "*args, void *userData)`, where *args* is guaranteed to be a :c:type:" @@ -425,20 +447,20 @@ msgid "" "Python interpreter that raised the event." msgstr "" -#: ../../c-api/sys.rst:360 +#: ../../c-api/sys.rst:385 msgid "" "See :pep:`578` for a detailed description of auditing. Functions in the " "runtime and standard library that raise events are listed in the :ref:`audit " "events table `. Details are in each function's documentation." msgstr "" -#: ../../c-api/sys.rst:365 +#: ../../c-api/sys.rst:390 msgid "" "Raises an :ref:`auditing event ` ``sys.addaudithook`` with no " "arguments." msgstr "" -#: ../../c-api/sys.rst:367 +#: ../../c-api/sys.rst:392 msgid "" "If the interpreter is initialized, this function raises a auditing event " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -447,11 +469,11 @@ msgid "" "hook has been added unless they control all existing hooks." msgstr "" -#: ../../c-api/sys.rst:379 +#: ../../c-api/sys.rst:404 msgid "Process Control" msgstr "行程(Process)控制" -#: ../../c-api/sys.rst:386 +#: ../../c-api/sys.rst:411 msgid "" "Print a fatal error message and kill the process. No cleanup is performed. " "This function should only be invoked when a condition is detected that would " @@ -461,29 +483,29 @@ msgid "" "file:`core` file." msgstr "" -#: ../../c-api/sys.rst:393 +#: ../../c-api/sys.rst:418 msgid "" "The ``Py_FatalError()`` function is replaced with a macro which logs " "automatically the name of the current function, unless the " "``Py_LIMITED_API`` macro is defined." msgstr "" -#: ../../c-api/sys.rst:397 +#: ../../c-api/sys.rst:422 msgid "Log the function name automatically." msgstr "" -#: ../../c-api/sys.rst:407 +#: ../../c-api/sys.rst:432 msgid "" "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " "the standard C library function ``exit(status)``. If :c:func:" "`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" -#: ../../c-api/sys.rst:411 +#: ../../c-api/sys.rst:436 msgid "Errors from finalization no longer ignored." msgstr "" -#: ../../c-api/sys.rst:421 +#: ../../c-api/sys.rst:446 msgid "" "Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The " "cleanup function will be called with no arguments and should return no " diff --git a/c-api/tuple.po b/c-api/tuple.po index a113f980a3..15522c3b93 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -106,7 +106,7 @@ msgstr "" #: ../../c-api/tuple.rst:94 msgid "" -"This macro \"steals\" a reference to *o*, and, unlike :c:func:" +"This function \"steals\" a reference to *o*, and, unlike :c:func:" "`PyTuple_SetItem`, does *not* discard a reference to any item that is being " "replaced; any reference in the tuple at position *pos* will be leaked." msgstr "" @@ -265,10 +265,12 @@ msgid "" "new instances." msgstr "" -#: ../../c-api/tuple.rst:213 ../../c-api/tuple.rst:222 +#: ../../c-api/tuple.rst:213 ../../c-api/tuple.rst:223 msgid "This function \"steals\" a reference to *o*." msgstr "" #: ../../c-api/tuple.rst:218 -msgid "Macro equivalent of :c:func:`PyStructSequence_SetItem`." +msgid "" +"Similar to :c:func:`PyStructSequence_SetItem`, but implemented as a static " +"inlined function." msgstr "" diff --git a/c-api/type.po b/c-api/type.po index 51648a15a2..ee278c4caa 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-03 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -126,75 +126,108 @@ msgstr "" #: ../../c-api/type.rst:111 msgid "" +"Return the type's name. Equivalent to getting the type's ``__name__`` " +"attribute." +msgstr "" + +#: ../../c-api/type.rst:117 +msgid "" +"Return the type's qualified name. Equivalent to getting the type's " +"``__qualname__`` attribute." +msgstr "" + +#: ../../c-api/type.rst:124 +msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " "function was called with invalid parameters. Callers will typically cast the " "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:117 +#: ../../c-api/type.rst:130 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:121 +#: ../../c-api/type.rst:134 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:127 +#: ../../c-api/type.rst:140 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:130 ../../c-api/type.rst:148 +#: ../../c-api/type.rst:143 ../../c-api/type.rst:163 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:133 +#: ../../c-api/type.rst:146 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " "not return the intended result. ``Py_TYPE(self)`` may be a *subclass* of the " "intended class, and subclasses are not necessarily defined in the same " "module as their superclass. See :c:type:`PyCMethod` to get the class that " -"defines the method." +"defines the method. See :c:func:`PyType_GetModuleByDef` for cases when " +"``PyCMethod`` cannot be used." msgstr "" -#: ../../c-api/type.rst:144 +#: ../../c-api/type.rst:159 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:151 +#: ../../c-api/type.rst:166 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:158 +#: ../../c-api/type.rst:173 +msgid "" +"Find the first superclass whose module was created from the given :c:type:" +"`PyModuleDef` *def*, and return that module." +msgstr "" + +#: ../../c-api/type.rst:176 +msgid "" +"If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." +msgstr "" + +#: ../../c-api/type.rst:178 +msgid "" +"This function is intended to be used together with :c:func:" +"`PyModule_GetState()` to get module state from slot methods (such as :c:" +"member:`~PyTypeObject.tp_init` or :c:member:`~PyNumberMethods.nb_add`) and " +"other places where a method's defining class cannot be passed using the :c:" +"type:`PyCMethod` calling convention." +msgstr "" + +#: ../../c-api/type.rst:188 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:160 +#: ../../c-api/type.rst:190 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:165 +#: ../../c-api/type.rst:195 msgid "" "Creates and returns a :ref:`heap type ` from the *spec* (:const:" "`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:168 +#: ../../c-api/type.rst:198 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -203,7 +236,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:174 +#: ../../c-api/type.rst:204 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -212,65 +245,65 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:181 +#: ../../c-api/type.rst:211 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:187 +#: ../../c-api/type.rst:217 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:192 +#: ../../c-api/type.rst:222 msgid "Equivalent to ``PyType_FromModuleAndSpec(NULL, spec, bases)``." msgstr "等價於 ``PyType_FromModuleAndSpec(NULL, spec, bases)``\\ 。" -#: ../../c-api/type.rst:198 +#: ../../c-api/type.rst:228 msgid "Equivalent to ``PyType_FromSpecWithBases(spec, NULL)``." msgstr "等價於 ``PyType_FromSpecWithBases(spec, NULL)``\\ 。" -#: ../../c-api/type.rst:202 +#: ../../c-api/type.rst:232 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:206 +#: ../../c-api/type.rst:236 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:211 +#: ../../c-api/type.rst:241 msgid "" "Size of the instance in bytes, used to set :c:member:`PyTypeObject." "tp_basicsize` and :c:member:`PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/type.rst:217 +#: ../../c-api/type.rst:247 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:219 +#: ../../c-api/type.rst:249 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:224 +#: ../../c-api/type.rst:254 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:229 +#: ../../c-api/type.rst:259 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:234 +#: ../../c-api/type.rst:264 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:236 +#: ../../c-api/type.rst:266 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -278,97 +311,95 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:242 +#: ../../c-api/type.rst:272 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:243 +#: ../../c-api/type.rst:273 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:244 +#: ../../c-api/type.rst:274 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:246 +#: ../../c-api/type.rst:276 msgid "" "The following fields cannot be set at all using :c:type:`PyType_Spec` and :c:" "type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:249 +#: ../../c-api/type.rst:279 msgid ":c:member:`~PyTypeObject.tp_dict`" msgstr ":c:member:`~PyTypeObject.tp_dict`" -#: ../../c-api/type.rst:250 +#: ../../c-api/type.rst:280 msgid ":c:member:`~PyTypeObject.tp_mro`" msgstr ":c:member:`~PyTypeObject.tp_mro`" -#: ../../c-api/type.rst:251 +#: ../../c-api/type.rst:281 msgid ":c:member:`~PyTypeObject.tp_cache`" msgstr ":c:member:`~PyTypeObject.tp_cache`" -#: ../../c-api/type.rst:252 +#: ../../c-api/type.rst:282 msgid ":c:member:`~PyTypeObject.tp_subclasses`" msgstr ":c:member:`~PyTypeObject.tp_subclasses`" -#: ../../c-api/type.rst:253 +#: ../../c-api/type.rst:283 msgid ":c:member:`~PyTypeObject.tp_weaklist`" msgstr ":c:member:`~PyTypeObject.tp_weaklist`" -#: ../../c-api/type.rst:254 +#: ../../c-api/type.rst:284 msgid ":c:member:`~PyTypeObject.tp_vectorcall`" msgstr ":c:member:`~PyTypeObject.tp_vectorcall`" -#: ../../c-api/type.rst:255 +#: ../../c-api/type.rst:285 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (see :ref:`PyMemberDef " "`)" msgstr "" -#: ../../c-api/type.rst:257 +#: ../../c-api/type.rst:287 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (see :ref:`PyMemberDef `)" msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:289 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (see :ref:`PyMemberDef " "`)" msgstr "" -#: ../../c-api/type.rst:262 -msgid "" -"The following fields cannot be set using :c:type:`PyType_Spec` and :c:type:" -"`PyType_Slot` under the limited API:" -msgstr "" - -#: ../../c-api/type.rst:265 -msgid ":c:member:`~PyBufferProcs.bf_getbuffer`" -msgstr ":c:member:`~PyBufferProcs.bf_getbuffer`" - -#: ../../c-api/type.rst:266 -msgid ":c:member:`~PyBufferProcs.bf_releasebuffer`" -msgstr ":c:member:`~PyBufferProcs.bf_releasebuffer`" - -#: ../../c-api/type.rst:268 +#: ../../c-api/type.rst:292 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :py:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:275 +#: ../../c-api/type.rst:299 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:279 +#: ../../c-api/type.rst:301 +msgid "" +":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." +"bf_releasebuffer` are now available under the limited API." +msgstr "" + +#: ../../c-api/type.rst:308 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:282 +#: ../../c-api/type.rst:311 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" + +#~ msgid ":c:member:`~PyBufferProcs.bf_getbuffer`" +#~ msgstr ":c:member:`~PyBufferProcs.bf_getbuffer`" + +#~ msgid ":c:member:`~PyBufferProcs.bf_releasebuffer`" +#~ msgstr ":c:member:`~PyBufferProcs.bf_releasebuffer`" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 2fd0967cd1..5d99ff9e0c 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1165,33 +1165,33 @@ msgstr "" #: ../../c-api/typeobj.rst:539 ../../c-api/typeobj.rst:553 #: ../../c-api/typeobj.rst:597 ../../c-api/typeobj.rst:640 #: ../../c-api/typeobj.rst:698 ../../c-api/typeobj.rst:736 -#: ../../c-api/typeobj.rst:755 ../../c-api/typeobj.rst:772 -#: ../../c-api/typeobj.rst:790 ../../c-api/typeobj.rst:814 -#: ../../c-api/typeobj.rst:831 ../../c-api/typeobj.rst:843 -#: ../../c-api/typeobj.rst:855 ../../c-api/typeobj.rst:888 -#: ../../c-api/typeobj.rst:906 ../../c-api/typeobj.rst:926 -#: ../../c-api/typeobj.rst:947 ../../c-api/typeobj.rst:973 -#: ../../c-api/typeobj.rst:992 ../../c-api/typeobj.rst:1008 -#: ../../c-api/typeobj.rst:1045 ../../c-api/typeobj.rst:1056 -#: ../../c-api/typeobj.rst:1066 ../../c-api/typeobj.rst:1076 -#: ../../c-api/typeobj.rst:1090 ../../c-api/typeobj.rst:1108 -#: ../../c-api/typeobj.rst:1131 ../../c-api/typeobj.rst:1178 -#: ../../c-api/typeobj.rst:1193 ../../c-api/typeobj.rst:1212 -#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1253 -#: ../../c-api/typeobj.rst:1269 ../../c-api/typeobj.rst:1337 -#: ../../c-api/typeobj.rst:1404 ../../c-api/typeobj.rst:1463 -#: ../../c-api/typeobj.rst:1493 ../../c-api/typeobj.rst:1525 -#: ../../c-api/typeobj.rst:1548 ../../c-api/typeobj.rst:1561 -#: ../../c-api/typeobj.rst:1576 ../../c-api/typeobj.rst:1590 -#: ../../c-api/typeobj.rst:1620 ../../c-api/typeobj.rst:1640 -#: ../../c-api/typeobj.rst:1666 ../../c-api/typeobj.rst:1684 -#: ../../c-api/typeobj.rst:1724 ../../c-api/typeobj.rst:1775 -#: ../../c-api/typeobj.rst:1792 ../../c-api/typeobj.rst:1833 -#: ../../c-api/typeobj.rst:1855 ../../c-api/typeobj.rst:1887 -#: ../../c-api/typeobj.rst:1904 ../../c-api/typeobj.rst:1915 -#: ../../c-api/typeobj.rst:1925 ../../c-api/typeobj.rst:1934 -#: ../../c-api/typeobj.rst:1944 ../../c-api/typeobj.rst:1958 -#: ../../c-api/typeobj.rst:2004 ../../c-api/typeobj.rst:2027 +#: ../../c-api/typeobj.rst:756 ../../c-api/typeobj.rst:773 +#: ../../c-api/typeobj.rst:791 ../../c-api/typeobj.rst:815 +#: ../../c-api/typeobj.rst:832 ../../c-api/typeobj.rst:844 +#: ../../c-api/typeobj.rst:856 ../../c-api/typeobj.rst:889 +#: ../../c-api/typeobj.rst:907 ../../c-api/typeobj.rst:927 +#: ../../c-api/typeobj.rst:948 ../../c-api/typeobj.rst:974 +#: ../../c-api/typeobj.rst:993 ../../c-api/typeobj.rst:1009 +#: ../../c-api/typeobj.rst:1046 ../../c-api/typeobj.rst:1057 +#: ../../c-api/typeobj.rst:1067 ../../c-api/typeobj.rst:1077 +#: ../../c-api/typeobj.rst:1091 ../../c-api/typeobj.rst:1109 +#: ../../c-api/typeobj.rst:1132 ../../c-api/typeobj.rst:1179 +#: ../../c-api/typeobj.rst:1194 ../../c-api/typeobj.rst:1213 +#: ../../c-api/typeobj.rst:1232 ../../c-api/typeobj.rst:1254 +#: ../../c-api/typeobj.rst:1270 ../../c-api/typeobj.rst:1338 +#: ../../c-api/typeobj.rst:1405 ../../c-api/typeobj.rst:1464 +#: ../../c-api/typeobj.rst:1494 ../../c-api/typeobj.rst:1526 +#: ../../c-api/typeobj.rst:1549 ../../c-api/typeobj.rst:1562 +#: ../../c-api/typeobj.rst:1577 ../../c-api/typeobj.rst:1591 +#: ../../c-api/typeobj.rst:1621 ../../c-api/typeobj.rst:1641 +#: ../../c-api/typeobj.rst:1667 ../../c-api/typeobj.rst:1685 +#: ../../c-api/typeobj.rst:1718 ../../c-api/typeobj.rst:1769 +#: ../../c-api/typeobj.rst:1786 ../../c-api/typeobj.rst:1827 +#: ../../c-api/typeobj.rst:1849 ../../c-api/typeobj.rst:1881 +#: ../../c-api/typeobj.rst:1898 ../../c-api/typeobj.rst:1909 +#: ../../c-api/typeobj.rst:1919 ../../c-api/typeobj.rst:1928 +#: ../../c-api/typeobj.rst:1938 ../../c-api/typeobj.rst:1952 +#: ../../c-api/typeobj.rst:1998 ../../c-api/typeobj.rst:2021 msgid "**Inheritance:**" msgstr "" @@ -1221,11 +1221,11 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:519 ../../c-api/typeobj.rst:700 -#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:908 -#: ../../c-api/typeobj.rst:928 ../../c-api/typeobj.rst:1527 -#: ../../c-api/typeobj.rst:1550 ../../c-api/typeobj.rst:1668 -#: ../../c-api/typeobj.rst:1686 ../../c-api/typeobj.rst:1777 -#: ../../c-api/typeobj.rst:1889 ../../c-api/typeobj.rst:2006 +#: ../../c-api/typeobj.rst:817 ../../c-api/typeobj.rst:909 +#: ../../c-api/typeobj.rst:929 ../../c-api/typeobj.rst:1528 +#: ../../c-api/typeobj.rst:1551 ../../c-api/typeobj.rst:1669 +#: ../../c-api/typeobj.rst:1687 ../../c-api/typeobj.rst:1771 +#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:2000 msgid "This field is inherited by subtypes." msgstr "" @@ -1459,10 +1459,10 @@ msgstr "" #: ../../c-api/typeobj.rst:725 msgid "" -"It is not recommended for :ref:`heap types ` to implement the " -"vectorcall protocol. When a user sets :attr:`__call__` in Python code, only " -"*tp_call* is updated, likely making it inconsistent with the vectorcall " -"function." +"It is not recommended for :ref:`mutable heap types ` to " +"implement the vectorcall protocol. When a user sets :attr:`__call__` in " +"Python code, only *tp_call* is updated, likely making it inconsistent with " +"the vectorcall function." msgstr "" #: ../../c-api/typeobj.rst:732 @@ -1476,15 +1476,16 @@ msgid "" "This field is always inherited. However, the :const:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not, then " "the subclass won't use :ref:`vectorcall `, except when :c:func:" -"`PyVectorcall_Call` is explicitly called. This is in particular the case " -"for :ref:`heap types ` (including subclasses defined in Python)." +"`PyVectorcall_Call` is explicitly called. This is in particular the case for " +"types without the :const:`Py_TPFLAGS_IMMUTABLETYPE` flag set (including " +"subclasses defined in Python)." msgstr "" -#: ../../c-api/typeobj.rst:749 +#: ../../c-api/typeobj.rst:750 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:751 +#: ../../c-api/typeobj.rst:752 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1492,11 +1493,11 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:757 ../../c-api/typeobj.rst:949 +#: ../../c-api/typeobj.rst:758 ../../c-api/typeobj.rst:950 msgid "Group: :attr:`tp_getattr`, :attr:`tp_getattro`" msgstr "" -#: ../../c-api/typeobj.rst:759 +#: ../../c-api/typeobj.rst:760 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1505,12 +1506,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:766 ../../c-api/typeobj.rst:962 +#: ../../c-api/typeobj.rst:767 ../../c-api/typeobj.rst:963 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:768 +#: ../../c-api/typeobj.rst:769 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1518,11 +1519,11 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:774 ../../c-api/typeobj.rst:975 +#: ../../c-api/typeobj.rst:775 ../../c-api/typeobj.rst:976 msgid "Group: :attr:`tp_setattr`, :attr:`tp_setattro`" msgstr "" -#: ../../c-api/typeobj.rst:776 +#: ../../c-api/typeobj.rst:777 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1531,34 +1532,34 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:783 +#: ../../c-api/typeobj.rst:784 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:787 +#: ../../c-api/typeobj.rst:788 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:792 +#: ../../c-api/typeobj.rst:793 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:800 +#: ../../c-api/typeobj.rst:801 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:803 +#: ../../c-api/typeobj.rst:804 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:807 +#: ../../c-api/typeobj.rst:808 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1567,87 +1568,87 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:930 -#: ../../c-api/typeobj.rst:955 ../../c-api/typeobj.rst:981 -#: ../../c-api/typeobj.rst:1023 ../../c-api/typeobj.rst:1472 -#: ../../c-api/typeobj.rst:1624 ../../c-api/typeobj.rst:1645 -#: ../../c-api/typeobj.rst:1743 ../../c-api/typeobj.rst:1779 -#: ../../c-api/typeobj.rst:1797 ../../c-api/typeobj.rst:1839 -#: ../../c-api/typeobj.rst:1860 ../../c-api/typeobj.rst:1891 +#: ../../c-api/typeobj.rst:819 ../../c-api/typeobj.rst:931 +#: ../../c-api/typeobj.rst:956 ../../c-api/typeobj.rst:982 +#: ../../c-api/typeobj.rst:1024 ../../c-api/typeobj.rst:1473 +#: ../../c-api/typeobj.rst:1625 ../../c-api/typeobj.rst:1646 +#: ../../c-api/typeobj.rst:1737 ../../c-api/typeobj.rst:1773 +#: ../../c-api/typeobj.rst:1791 ../../c-api/typeobj.rst:1833 +#: ../../c-api/typeobj.rst:1854 ../../c-api/typeobj.rst:1885 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:820 +#: ../../c-api/typeobj.rst:821 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:827 +#: ../../c-api/typeobj.rst:828 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:833 +#: ../../c-api/typeobj.rst:834 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:839 +#: ../../c-api/typeobj.rst:840 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:845 +#: ../../c-api/typeobj.rst:846 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:851 +#: ../../c-api/typeobj.rst:852 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:857 +#: ../../c-api/typeobj.rst:858 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:866 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:868 +#: ../../c-api/typeobj.rst:869 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:872 +#: ../../c-api/typeobj.rst:873 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:876 +#: ../../c-api/typeobj.rst:877 msgid "" "When this field is not set (*and* :attr:`tp_richcompare` is not set), an " "attempt to take the hash of the object raises :exc:`TypeError`. This is the " "same as setting it to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:880 +#: ../../c-api/typeobj.rst:881 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1658,11 +1659,11 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:890 ../../c-api/typeobj.rst:1465 +#: ../../c-api/typeobj.rst:891 ../../c-api/typeobj.rst:1466 msgid "Group: :attr:`tp_hash`, :attr:`tp_richcompare`" msgstr "" -#: ../../c-api/typeobj.rst:892 +#: ../../c-api/typeobj.rst:893 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1671,14 +1672,14 @@ msgid "" "are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:900 +#: ../../c-api/typeobj.rst:901 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:913 +#: ../../c-api/typeobj.rst:914 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1687,11 +1688,11 @@ msgid "" "this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:918 +#: ../../c-api/typeobj.rst:919 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:922 +#: ../../c-api/typeobj.rst:923 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1699,28 +1700,28 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:932 +#: ../../c-api/typeobj.rst:933 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:938 +#: ../../c-api/typeobj.rst:939 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:940 +#: ../../c-api/typeobj.rst:941 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:945 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: ../../c-api/typeobj.rst:951 +#: ../../c-api/typeobj.rst:952 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1729,15 +1730,15 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:958 msgid ":c:type:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:964 +#: ../../c-api/typeobj.rst:965 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:969 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1745,7 +1746,7 @@ msgid "" "attributes." msgstr "" -#: ../../c-api/typeobj.rst:977 +#: ../../c-api/typeobj.rst:978 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1754,24 +1755,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:983 +#: ../../c-api/typeobj.rst:984 msgid ":c:type:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:988 +#: ../../c-api/typeobj.rst:989 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:994 +#: ../../c-api/typeobj.rst:995 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1000 +#: ../../c-api/typeobj.rst:1001 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1783,7 +1784,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1010 +#: ../../c-api/typeobj.rst:1011 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1798,17 +1799,17 @@ msgid "" "the subtype exist and have ``NULL`` values." msgstr "" -#: ../../c-api/typeobj.rst:1025 +#: ../../c-api/typeobj.rst:1026 msgid "" ":c:type:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." msgstr "" -#: ../../c-api/typeobj.rst:1028 +#: ../../c-api/typeobj.rst:1029 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1030 +#: ../../c-api/typeobj.rst:1031 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -1817,7 +1818,7 @@ msgid "" "zero." msgstr "" -#: ../../c-api/typeobj.rst:1037 +#: ../../c-api/typeobj.rst:1038 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -1828,32 +1829,32 @@ msgid "" "gets INCREF'ed or DECREF'ed)." msgstr "" -#: ../../c-api/typeobj.rst:1047 ../../c-api/typeobj.rst:1058 -#: ../../c-api/typeobj.rst:1068 ../../c-api/typeobj.rst:1078 -#: ../../c-api/typeobj.rst:1110 +#: ../../c-api/typeobj.rst:1048 ../../c-api/typeobj.rst:1059 +#: ../../c-api/typeobj.rst:1069 ../../c-api/typeobj.rst:1079 +#: ../../c-api/typeobj.rst:1111 msgid "???" msgstr "" -#: ../../c-api/typeobj.rst:1052 +#: ../../c-api/typeobj.rst:1053 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1063 +#: ../../c-api/typeobj.rst:1064 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1073 +#: ../../c-api/typeobj.rst:1074 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1083 +#: ../../c-api/typeobj.rst:1084 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:func:`PyObject_GC_New` and destroyed " @@ -1863,13 +1864,13 @@ msgid "" "tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1092 ../../c-api/typeobj.rst:1339 -#: ../../c-api/typeobj.rst:1406 +#: ../../c-api/typeobj.rst:1093 ../../c-api/typeobj.rst:1340 +#: ../../c-api/typeobj.rst:1407 msgid "" "Group: :const:`Py_TPFLAGS_HAVE_GC`, :attr:`tp_traverse`, :attr:`tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1094 +#: ../../c-api/typeobj.rst:1095 msgid "" "The :const:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :" "attr:`tp_traverse` and :attr:`tp_clear` fields, i.e. if the :const:" @@ -1878,48 +1879,48 @@ msgid "" "``NULL`` values." msgstr "" -#: ../../c-api/typeobj.rst:1104 +#: ../../c-api/typeobj.rst:1105 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :const:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1115 +#: ../../c-api/typeobj.rst:1116 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1117 +#: ../../c-api/typeobj.rst:1118 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1119 +#: ../../c-api/typeobj.rst:1120 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1122 +#: ../../c-api/typeobj.rst:1123 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1125 +#: ../../c-api/typeobj.rst:1126 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: ../../c-api/typeobj.rst:1133 +#: ../../c-api/typeobj.rst:1134 msgid "" -"This flag is never inherited by :ref:`heap types `. For " -"extension types, it is inherited whenever :c:member:`~PyTypeObject." -"tp_descr_get` is inherited." +"This flag is never inherited by types without the :const:" +"`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " +"whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1150 +#: ../../c-api/typeobj.rst:1151 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " @@ -1929,68 +1930,67 @@ msgid "" "behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1161 +#: ../../c-api/typeobj.rst:1162 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1166 +#: ../../c-api/typeobj.rst:1167 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1174 +#: ../../c-api/typeobj.rst:1175 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1180 +#: ../../c-api/typeobj.rst:1181 msgid "" -"This bit is inherited for :ref:`static subtypes ` if :c:member:" -"`~PyTypeObject.tp_call` is also inherited. :ref:`Heap types ` do " -"not inherit ``Py_TPFLAGS_HAVE_VECTORCALL``." +"This bit is inherited for types with the :const:`Py_TPFLAGS_IMMUTABLETYPE` " +"flag set, if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1188 +#: ../../c-api/typeobj.rst:1189 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1190 +#: ../../c-api/typeobj.rst:1191 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1195 ../../c-api/typeobj.rst:1214 +#: ../../c-api/typeobj.rst:1196 ../../c-api/typeobj.rst:1215 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1201 +#: ../../c-api/typeobj.rst:1202 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1205 +#: ../../c-api/typeobj.rst:1206 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1208 +#: ../../c-api/typeobj.rst:1209 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1221 +#: ../../c-api/typeobj.rst:1222 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -1998,23 +1998,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1228 ../../c-api/typeobj.rst:1250 +#: ../../c-api/typeobj.rst:1229 ../../c-api/typeobj.rst:1251 msgid "" ":const:`Py_TPFLAGS_MAPPING` and :const:`Py_TPFLAGS_SEQUENCE` are mutually " "exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1233 +#: ../../c-api/typeobj.rst:1234 msgid "" "This flag is inherited by types that do not already set :const:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1236 ../../c-api/typeobj.rst:1258 +#: ../../c-api/typeobj.rst:1237 ../../c-api/typeobj.rst:1259 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1243 +#: ../../c-api/typeobj.rst:1244 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2022,37 +2022,37 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1255 +#: ../../c-api/typeobj.rst:1256 msgid "" "This flag is inherited by types that do not already set :const:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1265 +#: ../../c-api/typeobj.rst:1266 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`__doc__` attribute on the " "type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1271 +#: ../../c-api/typeobj.rst:1272 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1276 +#: ../../c-api/typeobj.rst:1277 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1281 ../../c-api/typeobj.rst:1401 +#: ../../c-api/typeobj.rst:1282 ../../c-api/typeobj.rst:1402 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1284 +#: ../../c-api/typeobj.rst:1285 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2062,7 +2062,7 @@ msgid "" "`_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1299 +#: ../../c-api/typeobj.rst:1300 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2070,14 +2070,14 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1303 +#: ../../c-api/typeobj.rst:1304 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1308 +#: ../../c-api/typeobj.rst:1309 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2106,14 +2106,14 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1332 +#: ../../c-api/typeobj.rst:1333 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1341 +#: ../../c-api/typeobj.rst:1342 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :const:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2121,14 +2121,14 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1349 +#: ../../c-api/typeobj.rst:1350 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is set. The signature " "is::" msgstr "" -#: ../../c-api/typeobj.rst:1354 +#: ../../c-api/typeobj.rst:1355 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2143,7 +2143,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1364 +#: ../../c-api/typeobj.rst:1365 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2151,7 +2151,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1378 +#: ../../c-api/typeobj.rst:1379 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be decremented " @@ -2166,7 +2166,7 @@ msgid "" "in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1389 +#: ../../c-api/typeobj.rst:1390 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2174,7 +2174,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1395 +#: ../../c-api/typeobj.rst:1396 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2184,7 +2184,7 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1408 +#: ../../c-api/typeobj.rst:1409 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :const:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2192,18 +2192,18 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1416 +#: ../../c-api/typeobj.rst:1417 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1420 +#: ../../c-api/typeobj.rst:1421 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1423 +#: ../../c-api/typeobj.rst:1424 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2211,74 +2211,74 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1428 +#: ../../c-api/typeobj.rst:1429 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1432 +#: ../../c-api/typeobj.rst:1433 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1432 +#: ../../c-api/typeobj.rst:1433 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1434 +#: ../../c-api/typeobj.rst:1435 msgid ":const:`Py_LT`" msgstr ":const:`Py_LT`" -#: ../../c-api/typeobj.rst:1434 +#: ../../c-api/typeobj.rst:1435 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1436 +#: ../../c-api/typeobj.rst:1437 msgid ":const:`Py_LE`" msgstr ":const:`Py_LE`" -#: ../../c-api/typeobj.rst:1436 +#: ../../c-api/typeobj.rst:1437 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1438 +#: ../../c-api/typeobj.rst:1439 msgid ":const:`Py_EQ`" msgstr ":const:`Py_EQ`" -#: ../../c-api/typeobj.rst:1438 +#: ../../c-api/typeobj.rst:1439 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1440 +#: ../../c-api/typeobj.rst:1441 msgid ":const:`Py_NE`" msgstr ":const:`Py_NE`" -#: ../../c-api/typeobj.rst:1440 +#: ../../c-api/typeobj.rst:1441 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1442 +#: ../../c-api/typeobj.rst:1443 msgid ":const:`Py_GT`" msgstr ":const:`Py_GT`" -#: ../../c-api/typeobj.rst:1442 +#: ../../c-api/typeobj.rst:1443 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1444 +#: ../../c-api/typeobj.rst:1445 msgid ":const:`Py_GE`" msgstr ":const:`Py_GE`" -#: ../../c-api/typeobj.rst:1444 +#: ../../c-api/typeobj.rst:1445 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1447 +#: ../../c-api/typeobj.rst:1448 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1451 +#: ../../c-api/typeobj.rst:1452 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2286,15 +2286,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1457 +#: ../../c-api/typeobj.rst:1458 msgid "The return value's reference count is properly incremented." msgstr "" -#: ../../c-api/typeobj.rst:1459 +#: ../../c-api/typeobj.rst:1460 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1467 +#: ../../c-api/typeobj.rst:1468 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2302,7 +2302,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1474 +#: ../../c-api/typeobj.rst:1475 msgid "" ":c:type:`PyBaseObject_Type` provides a :attr:`tp_richcompare` " "implementation, which may be inherited. However, if only :attr:`tp_hash` is " @@ -2310,7 +2310,7 @@ msgid "" "will not be able to participate in any comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1483 +#: ../../c-api/typeobj.rst:1484 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -2320,13 +2320,13 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1490 +#: ../../c-api/typeobj.rst:1491 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1495 +#: ../../c-api/typeobj.rst:1496 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2335,7 +2335,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1500 +#: ../../c-api/typeobj.rst:1501 msgid "" "When a type defined by a class statement has no :attr:`~object.__slots__` " "declaration, and none of its base types are weakly referenceable, the type " @@ -2344,7 +2344,7 @@ msgid "" "tp_weaklistoffset` of that slot's offset." msgstr "" -#: ../../c-api/typeobj.rst:1505 +#: ../../c-api/typeobj.rst:1506 msgid "" "When a type's :attr:`__slots__` declaration contains a slot named :attr:" "`__weakref__`, that slot becomes the weak reference list head for instances " @@ -2352,31 +2352,31 @@ msgid "" "`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1510 +#: ../../c-api/typeobj.rst:1511 msgid "" "When a type's :attr:`__slots__` declaration does not contain a slot named :" "attr:`__weakref__`, the type inherits its :c:member:`~PyTypeObject." "tp_weaklistoffset` from its base type." msgstr "" -#: ../../c-api/typeobj.rst:1517 +#: ../../c-api/typeobj.rst:1518 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1521 +#: ../../c-api/typeobj.rst:1522 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1533 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1537 +#: ../../c-api/typeobj.rst:1538 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2384,74 +2384,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1542 +#: ../../c-api/typeobj.rst:1543 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1546 +#: ../../c-api/typeobj.rst:1547 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:1556 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1558 +#: ../../c-api/typeobj.rst:1559 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1563 +#: ../../c-api/typeobj.rst:1564 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1569 +#: ../../c-api/typeobj.rst:1570 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1573 +#: ../../c-api/typeobj.rst:1574 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1578 +#: ../../c-api/typeobj.rst:1579 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1584 +#: ../../c-api/typeobj.rst:1585 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1587 +#: ../../c-api/typeobj.rst:1588 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1592 +#: ../../c-api/typeobj.rst:1593 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1598 +#: ../../c-api/typeobj.rst:1599 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2459,7 +2459,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1606 +#: ../../c-api/typeobj.rst:1607 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2467,7 +2467,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1611 +#: ../../c-api/typeobj.rst:1612 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "func:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2475,27 +2475,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1617 +#: ../../c-api/typeobj.rst:1618 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1622 +#: ../../c-api/typeobj.rst:1623 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1626 +#: ../../c-api/typeobj.rst:1627 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1632 +#: ../../c-api/typeobj.rst:1633 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1634 +#: ../../c-api/typeobj.rst:1635 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2504,45 +2504,45 @@ msgid "" "they don't correspond to overloaded operations (like :meth:`__add__`)." msgstr "" -#: ../../c-api/typeobj.rst:1642 +#: ../../c-api/typeobj.rst:1643 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1648 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1653 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1659 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1660 ../../c-api/typeobj.rst:1676 -#: ../../c-api/typeobj.rst:1758 ../../c-api/typeobj.rst:1788 -#: ../../c-api/typeobj.rst:1812 +#: ../../c-api/typeobj.rst:1661 ../../c-api/typeobj.rst:1677 +#: ../../c-api/typeobj.rst:1752 ../../c-api/typeobj.rst:1782 +#: ../../c-api/typeobj.rst:1806 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1674 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1680 +#: ../../c-api/typeobj.rst:1681 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1691 +#: ../../c-api/typeobj.rst:1692 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -2550,13 +2550,13 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1696 +#: ../../c-api/typeobj.rst:1697 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1699 +#: ../../c-api/typeobj.rst:1700 msgid "" "If the value of this field is greater than zero, it specifies the offset " "from the start of the instance structure. If the value is less than zero, " @@ -2572,23 +2572,16 @@ msgid "" "the very end of the structure." msgstr "" -#: ../../c-api/typeobj.rst:1711 -msgid "" -"The real dictionary offset in an instance can be computed from a negative :c:" -"member:`~PyTypeObject.tp_dictoffset` as follows::" -msgstr "" - -#: ../../c-api/typeobj.rst:1718 +#: ../../c-api/typeobj.rst:1712 msgid "" -"where :c:member:`~PyTypeObject.tp_basicsize`, :c:member:`~PyTypeObject." -"tp_itemsize` and :c:member:`~PyTypeObject.tp_dictoffset` are taken from the " -"type object, and :attr:`ob_size` is taken from the instance. The absolute " -"value is taken because ints use the sign of :attr:`ob_size` to store the " -"sign of the number. (There's never a need to do this calculation yourself; " -"it is done for you by :c:func:`_PyObject_GetDictPtr`.)" +"The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" +"only. To get the pointer to the dictionary call :c:func:" +"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " +"need to allocate memory for the dictionary, so it is may be more efficient " +"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1726 +#: ../../c-api/typeobj.rst:1720 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype instances " @@ -2597,7 +2590,7 @@ msgid "" "should not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1731 +#: ../../c-api/typeobj.rst:1725 msgid "" "When a type defined by a class statement has no :attr:`~object.__slots__` " "declaration, and none of its base types has an instance variable dictionary, " @@ -2605,14 +2598,14 @@ msgid "" "`~PyTypeObject.tp_dictoffset` is set to that slot's offset." msgstr "" -#: ../../c-api/typeobj.rst:1736 +#: ../../c-api/typeobj.rst:1730 msgid "" "When a type defined by a class statement has a :attr:`__slots__` " "declaration, the type inherits its :c:member:`~PyTypeObject.tp_dictoffset` " "from its base type." msgstr "" -#: ../../c-api/typeobj.rst:1739 +#: ../../c-api/typeobj.rst:1733 msgid "" "(Adding a slot named :attr:`~object.__dict__` to the :attr:`__slots__` " "declaration does not have the expected effect, it just causes confusion. " @@ -2620,17 +2613,17 @@ msgid "" "though.)" msgstr "" -#: ../../c-api/typeobj.rst:1745 +#: ../../c-api/typeobj.rst:1739 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`__dict__` gets created for instances." msgstr "" -#: ../../c-api/typeobj.rst:1751 +#: ../../c-api/typeobj.rst:1745 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1753 +#: ../../c-api/typeobj.rst:1747 msgid "" "This function corresponds to the :meth:`__init__` method of classes. Like :" "meth:`__init__`, it is possible to create an instance without calling :meth:" @@ -2638,14 +2631,14 @@ msgid "" "meth:`__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1756 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1766 +#: ../../c-api/typeobj.rst:1760 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -2657,43 +2650,43 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1773 +#: ../../c-api/typeobj.rst:1767 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1781 +#: ../../c-api/typeobj.rst:1775 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1786 +#: ../../c-api/typeobj.rst:1780 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1794 +#: ../../c-api/typeobj.rst:1788 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1799 +#: ../../c-api/typeobj.rst:1793 msgid "" "For dynamic subtypes, this field is always set to :c:func:" "`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1803 +#: ../../c-api/typeobj.rst:1797 msgid "" "For static subtypes, :c:type:`PyBaseObject_Type` uses :c:func:" "`PyType_GenericAlloc`. That is the recommended value for all statically " "defined types." msgstr "" -#: ../../c-api/typeobj.rst:1810 +#: ../../c-api/typeobj.rst:1804 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1810 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -2702,7 +2695,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1822 +#: ../../c-api/typeobj.rst:1816 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -2714,20 +2707,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1830 +#: ../../c-api/typeobj.rst:1824 msgid "" "Set the :const:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow creating " "instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1835 +#: ../../c-api/typeobj.rst:1829 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1841 +#: ../../c-api/typeobj.rst:1835 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -2735,39 +2728,39 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1849 +#: ../../c-api/typeobj.rst:1843 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1853 +#: ../../c-api/typeobj.rst:1847 msgid "" "An initializer that is compatible with this signature is :c:func:" "`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1857 +#: ../../c-api/typeobj.rst:1851 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1862 +#: ../../c-api/typeobj.rst:1856 msgid "" "In dynamic subtypes, this field is set to a deallocator suitable to match :c:" "func:`PyType_GenericAlloc` and the value of the :const:`Py_TPFLAGS_HAVE_GC` " "flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1860 msgid "For static subtypes, :c:type:`PyBaseObject_Type` uses PyObject_Del." msgstr "" -#: ../../c-api/typeobj.rst:1871 +#: ../../c-api/typeobj.rst:1865 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1873 +#: ../../c-api/typeobj.rst:1867 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -2779,76 +2772,76 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1883 +#: ../../c-api/typeobj.rst:1877 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:1893 +#: ../../c-api/typeobj.rst:1887 msgid "" "This slot has no default. If this field is ``NULL``, :const:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:1899 +#: ../../c-api/typeobj.rst:1893 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:1901 +#: ../../c-api/typeobj.rst:1895 msgid "" "This is set for types created by a class statement. It should be ``NULL`` " "for statically defined types." msgstr "" -#: ../../c-api/typeobj.rst:1906 ../../c-api/typeobj.rst:1927 -#: ../../c-api/typeobj.rst:1936 ../../c-api/typeobj.rst:1946 -#: ../../c-api/typeobj.rst:1960 +#: ../../c-api/typeobj.rst:1900 ../../c-api/typeobj.rst:1921 +#: ../../c-api/typeobj.rst:1930 ../../c-api/typeobj.rst:1940 +#: ../../c-api/typeobj.rst:1954 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1911 +#: ../../c-api/typeobj.rst:1905 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:1917 +#: ../../c-api/typeobj.rst:1911 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:1917 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:1932 +#: ../../c-api/typeobj.rst:1926 msgid "List of weak references to subclasses. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:1941 +#: ../../c-api/typeobj.rst:1935 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:1951 +#: ../../c-api/typeobj.rst:1945 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:1956 +#: ../../c-api/typeobj.rst:1950 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:1965 +#: ../../c-api/typeobj.rst:1959 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1969 +#: ../../c-api/typeobj.rst:1963 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -2858,14 +2851,14 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:1976 +#: ../../c-api/typeobj.rst:1970 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:1993 +#: ../../c-api/typeobj.rst:1987 msgid "" "Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject." "tp_dealloc` may be called from any Python thread, not just the thread which " @@ -2878,18 +2871,18 @@ msgid "" "which called tp_dealloc will not violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:2012 +#: ../../c-api/typeobj.rst:2006 msgid "" "Before version 3.8 it was necessary to set the :const:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2016 +#: ../../c-api/typeobj.rst:2010 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2021 +#: ../../c-api/typeobj.rst:2015 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " @@ -2897,61 +2890,61 @@ msgid "" "attr:`__new__` and :attr:`__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2029 +#: ../../c-api/typeobj.rst:2023 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2031 +#: ../../c-api/typeobj.rst:2025 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2037 +#: ../../c-api/typeobj.rst:2031 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2039 +#: ../../c-api/typeobj.rst:2033 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2043 +#: ../../c-api/typeobj.rst:2037 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2045 +#: ../../c-api/typeobj.rst:2039 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2047 +#: ../../c-api/typeobj.rst:2041 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2049 +#: ../../c-api/typeobj.rst:2043 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2053 +#: ../../c-api/typeobj.rst:2047 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static types must " "be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2061 +#: ../../c-api/typeobj.rst:2055 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2063 +#: ../../c-api/typeobj.rst:2057 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -2959,29 +2952,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2068 +#: ../../c-api/typeobj.rst:2062 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, or :c:func:" "`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/typeobj.rst:2076 +#: ../../c-api/typeobj.rst:2070 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2083 +#: ../../c-api/typeobj.rst:2077 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2089 ../../c-api/typeobj.rst:2413 +#: ../../c-api/typeobj.rst:2083 ../../c-api/typeobj.rst:2407 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2136 +#: ../../c-api/typeobj.rst:2130 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -2991,30 +2984,30 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2145 +#: ../../c-api/typeobj.rst:2139 msgid "" "The :c:data:`nb_reserved` field should always be ``NULL``. It was " "previously called :c:data:`nb_long`, and was renamed in Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2190 +#: ../../c-api/typeobj.rst:2184 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2197 +#: ../../c-api/typeobj.rst:2191 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2202 +#: ../../c-api/typeobj.rst:2196 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2208 +#: ../../c-api/typeobj.rst:2202 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3022,7 +3015,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2216 +#: ../../c-api/typeobj.rst:2210 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PyObject_SetSlice` and :c:func:" @@ -3032,17 +3025,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2227 +#: ../../c-api/typeobj.rst:2221 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2234 +#: ../../c-api/typeobj.rst:2228 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2239 +#: ../../c-api/typeobj.rst:2233 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -3050,21 +3043,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2246 +#: ../../c-api/typeobj.rst:2240 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2252 +#: ../../c-api/typeobj.rst:2246 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2258 +#: ../../c-api/typeobj.rst:2252 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3073,7 +3066,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2264 +#: ../../c-api/typeobj.rst:2258 msgid "" "Negative indexes are handled as follows: if the :attr:`sq_length` slot is " "filled, it is called and the sequence length is used to compute a positive " @@ -3081,7 +3074,7 @@ msgid "" "the index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2271 +#: ../../c-api/typeobj.rst:2265 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -3090,14 +3083,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2280 +#: ../../c-api/typeobj.rst:2274 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2287 +#: ../../c-api/typeobj.rst:2281 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3107,7 +3100,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2296 +#: ../../c-api/typeobj.rst:2290 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3117,72 +3110,72 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2307 +#: ../../c-api/typeobj.rst:2301 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2315 +#: ../../c-api/typeobj.rst:2309 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2321 ../../c-api/typeobj.rst:2370 -#: ../../c-api/typeobj.rst:2424 ../../c-api/typeobj.rst:2435 -#: ../../c-api/typeobj.rst:2447 ../../c-api/typeobj.rst:2456 +#: ../../c-api/typeobj.rst:2315 ../../c-api/typeobj.rst:2364 +#: ../../c-api/typeobj.rst:2418 ../../c-api/typeobj.rst:2429 +#: ../../c-api/typeobj.rst:2441 ../../c-api/typeobj.rst:2450 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2325 +#: ../../c-api/typeobj.rst:2319 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2329 +#: ../../c-api/typeobj.rst:2323 msgid "" "Check if the request can be met. If not, raise :c:data:`PyExc_BufferError`, " "set :c:expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2332 +#: ../../c-api/typeobj.rst:2326 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2334 +#: ../../c-api/typeobj.rst:2328 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2336 +#: ../../c-api/typeobj.rst:2330 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2338 +#: ../../c-api/typeobj.rst:2332 msgid "Return ``0``." msgstr "" -#: ../../c-api/typeobj.rst:2340 +#: ../../c-api/typeobj.rst:2334 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2343 +#: ../../c-api/typeobj.rst:2337 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2346 +#: ../../c-api/typeobj.rst:2340 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2350 +#: ../../c-api/typeobj.rst:2344 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3190,7 +3183,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2355 +#: ../../c-api/typeobj.rst:2349 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -3199,19 +3192,19 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2362 +#: ../../c-api/typeobj.rst:2356 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2365 +#: ../../c-api/typeobj.rst:2359 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2374 +#: ../../c-api/typeobj.rst:2368 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3219,15 +3212,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2379 +#: ../../c-api/typeobj.rst:2373 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2381 +#: ../../c-api/typeobj.rst:2375 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2383 +#: ../../c-api/typeobj.rst:2377 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3235,68 +3228,68 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2389 +#: ../../c-api/typeobj.rst:2383 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2394 +#: ../../c-api/typeobj.rst:2388 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2402 +#: ../../c-api/typeobj.rst:2396 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2410 +#: ../../c-api/typeobj.rst:2404 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2428 +#: ../../c-api/typeobj.rst:2422 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2431 +#: ../../c-api/typeobj.rst:2425 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2439 +#: ../../c-api/typeobj.rst:2433 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`__anext__` " "for details." msgstr "" -#: ../../c-api/typeobj.rst:2442 +#: ../../c-api/typeobj.rst:2436 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2445 msgid "" "Must return an :term:`awaitable` object. See :meth:`__anext__` for details. " "This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2454 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2469 +#: ../../c-api/typeobj.rst:2463 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2473 +#: ../../c-api/typeobj.rst:2467 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -3310,80 +3303,80 @@ msgid "" "member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2477 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2490 +#: ../../c-api/typeobj.rst:2484 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2494 +#: ../../c-api/typeobj.rst:2488 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2498 +#: ../../c-api/typeobj.rst:2492 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2502 +#: ../../c-api/typeobj.rst:2496 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2506 ../../c-api/typeobj.rst:2515 +#: ../../c-api/typeobj.rst:2500 ../../c-api/typeobj.rst:2509 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2510 ../../c-api/typeobj.rst:2521 +#: ../../c-api/typeobj.rst:2504 ../../c-api/typeobj.rst:2515 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2517 +#: ../../c-api/typeobj.rst:2511 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2524 +#: ../../c-api/typeobj.rst:2518 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2528 +#: ../../c-api/typeobj.rst:2522 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2532 +#: ../../c-api/typeobj.rst:2526 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2536 +#: ../../c-api/typeobj.rst:2530 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2540 +#: ../../c-api/typeobj.rst:2534 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2544 +#: ../../c-api/typeobj.rst:2538 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2548 +#: ../../c-api/typeobj.rst:2542 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2562 +#: ../../c-api/typeobj.rst:2556 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2578 +#: ../../c-api/typeobj.rst:2572 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2580 +#: ../../c-api/typeobj.rst:2574 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3391,33 +3384,33 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2585 +#: ../../c-api/typeobj.rst:2579 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2602 +#: ../../c-api/typeobj.rst:2596 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2646 +#: ../../c-api/typeobj.rst:2640 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2673 +#: ../../c-api/typeobj.rst:2667 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:data:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2692 +#: ../../c-api/typeobj.rst:2686 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2703 +#: ../../c-api/typeobj.rst:2697 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" diff --git a/c-api/unicode.po b/c-api/unicode.po index 7d76c05eda..1abe565e63 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-07 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -118,8 +118,8 @@ msgstr "" #: ../../c-api/unicode.rst:87 msgid "" -"The following APIs are really C macros and can be used to do fast checks and " -"to access internal read-only data of Unicode objects:" +"The following APIs are C macros and static inlined functions for fast checks " +"and access to internal read-only data of Unicode objects:" msgstr "" #: ../../c-api/unicode.rst:92 @@ -189,54 +189,54 @@ msgstr "" #: ../../c-api/unicode.rst:174 msgid "" "Write into a canonical representation *data* (as obtained with :c:func:" -"`PyUnicode_DATA`). This macro does not do any sanity checks and is intended " +"`PyUnicode_DATA`). This function performs no sanity checks, and is intended " "for usage in loops. The caller should cache the *kind* value and *data* " -"pointer as obtained from other macro calls. *index* is the index in the " -"string (starts at 0) and *value* is the new code point value which should be " +"pointer as obtained from other calls. *index* is the index in the string " +"(starts at 0) and *value* is the new code point value which should be " "written to that location." msgstr "" -#: ../../c-api/unicode.rst:186 +#: ../../c-api/unicode.rst:187 msgid "" "Read a code point from a canonical representation *data* (as obtained with :" "c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -#: ../../c-api/unicode.rst:194 +#: ../../c-api/unicode.rst:195 msgid "" "Read a character from a Unicode object *o*, which must be in the \"canonical" "\" representation. This is less efficient than :c:func:`PyUnicode_READ` if " "you do multiple consecutive reads." msgstr "" -#: ../../c-api/unicode.rst:203 +#: ../../c-api/unicode.rst:204 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *o*, which must be in the \"canonical\" representation. This is " "always an approximation but more efficient than iterating over the string." msgstr "" -#: ../../c-api/unicode.rst:212 +#: ../../c-api/unicode.rst:213 msgid "" "Return the size of the deprecated :c:type:`Py_UNICODE` representation, in " "code units (this includes surrogate pairs as 2 units). *o* has to be a " "Unicode object (not checked)." msgstr "" -#: ../../c-api/unicode.rst:218 ../../c-api/unicode.rst:228 -#: ../../c-api/unicode.rst:756 +#: ../../c-api/unicode.rst:219 ../../c-api/unicode.rst:229 +#: ../../c-api/unicode.rst:752 msgid "" "Part of the old-style Unicode API, please migrate to using :c:func:" "`PyUnicode_GET_LENGTH`." msgstr "" -#: ../../c-api/unicode.rst:223 +#: ../../c-api/unicode.rst:224 msgid "" "Return the size of the deprecated :c:type:`Py_UNICODE` representation in " "bytes. *o* has to be a Unicode object (not checked)." msgstr "" -#: ../../c-api/unicode.rst:234 +#: ../../c-api/unicode.rst:235 msgid "" "Return a pointer to a :c:type:`Py_UNICODE` representation of the object. " "The returned buffer is always terminated with an extra null code point. It " @@ -246,92 +246,92 @@ msgid "" "object (not checked)." msgstr "" -#: ../../c-api/unicode.rst:241 +#: ../../c-api/unicode.rst:242 msgid "" -"This macro is now inefficient -- because in many cases the :c:type:" +"This function is now inefficient -- because in many cases the :c:type:" "`Py_UNICODE` representation does not exist and needs to be created -- and " "can fail (return ``NULL`` with an exception set). Try to port the code to " "use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use :c:func:" "`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`." msgstr "" -#: ../../c-api/unicode.rst:250 +#: ../../c-api/unicode.rst:251 msgid "" "Part of the old-style Unicode API, please migrate to using the :c:func:" "`PyUnicode_nBYTE_DATA` family of macros." msgstr "" -#: ../../c-api/unicode.rst:255 +#: ../../c-api/unicode.rst:256 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: ../../c-api/unicode.rst:258 +#: ../../c-api/unicode.rst:259 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: ../../c-api/unicode.rst:264 +#: ../../c-api/unicode.rst:265 msgid "Unicode Character Properties" msgstr "" -#: ../../c-api/unicode.rst:266 +#: ../../c-api/unicode.rst:267 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: ../../c-api/unicode.rst:273 +#: ../../c-api/unicode.rst:274 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "" -#: ../../c-api/unicode.rst:278 +#: ../../c-api/unicode.rst:279 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "" -#: ../../c-api/unicode.rst:283 +#: ../../c-api/unicode.rst:284 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "" -#: ../../c-api/unicode.rst:288 +#: ../../c-api/unicode.rst:289 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "" -#: ../../c-api/unicode.rst:293 +#: ../../c-api/unicode.rst:294 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "" -#: ../../c-api/unicode.rst:298 +#: ../../c-api/unicode.rst:299 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "" -#: ../../c-api/unicode.rst:303 +#: ../../c-api/unicode.rst:304 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "" -#: ../../c-api/unicode.rst:308 +#: ../../c-api/unicode.rst:309 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "" -#: ../../c-api/unicode.rst:313 +#: ../../c-api/unicode.rst:314 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "" -#: ../../c-api/unicode.rst:318 +#: ../../c-api/unicode.rst:319 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "" -#: ../../c-api/unicode.rst:323 +#: ../../c-api/unicode.rst:324 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a printable character. " "Nonprintable characters are those characters defined in the Unicode " @@ -342,92 +342,92 @@ msgid "" "to :data:`sys.stdout` or :data:`sys.stderr`.)" msgstr "" -#: ../../c-api/unicode.rst:332 +#: ../../c-api/unicode.rst:333 msgid "These APIs can be used for fast direct character conversions:" msgstr "" -#: ../../c-api/unicode.rst:337 +#: ../../c-api/unicode.rst:338 msgid "Return the character *ch* converted to lower case." msgstr "" -#: ../../c-api/unicode.rst:339 ../../c-api/unicode.rst:347 -#: ../../c-api/unicode.rst:355 +#: ../../c-api/unicode.rst:340 ../../c-api/unicode.rst:348 +#: ../../c-api/unicode.rst:356 msgid "This function uses simple case mappings." msgstr "" -#: ../../c-api/unicode.rst:345 +#: ../../c-api/unicode.rst:346 msgid "Return the character *ch* converted to upper case." msgstr "" -#: ../../c-api/unicode.rst:353 +#: ../../c-api/unicode.rst:354 msgid "Return the character *ch* converted to title case." msgstr "" -#: ../../c-api/unicode.rst:361 +#: ../../c-api/unicode.rst:362 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This macro does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:367 +#: ../../c-api/unicode.rst:368 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This macro does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:373 +#: ../../c-api/unicode.rst:374 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This macro does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:377 +#: ../../c-api/unicode.rst:378 msgid "These APIs can be used to work with surrogates:" msgstr "" -#: ../../c-api/unicode.rst:381 +#: ../../c-api/unicode.rst:382 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "" -#: ../../c-api/unicode.rst:385 +#: ../../c-api/unicode.rst:386 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" -#: ../../c-api/unicode.rst:389 +#: ../../c-api/unicode.rst:390 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" -#: ../../c-api/unicode.rst:393 +#: ../../c-api/unicode.rst:394 msgid "" "Join two surrogate characters and return a single Py_UCS4 value. *high* and " "*low* are respectively the leading and trailing surrogates in a surrogate " "pair." msgstr "" -#: ../../c-api/unicode.rst:399 +#: ../../c-api/unicode.rst:400 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:401 +#: ../../c-api/unicode.rst:402 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:406 +#: ../../c-api/unicode.rst:407 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:410 +#: ../../c-api/unicode.rst:411 msgid "" "This is the recommended way to allocate a new Unicode object. Objects " "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:420 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -435,7 +435,15 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:429 +#: ../../c-api/unicode.rst:425 +msgid "" +"If necessary, the input *buffer* is copied and transformed into the " +"canonical representation. For example, if the *buffer* is a UCS4 string (:c:" +"macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " +"range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." +msgstr "" + +#: ../../c-api/unicode.rst:436 msgid "" "Create a Unicode object from the char buffer *u*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -443,7 +451,7 @@ msgid "" "object, i.e. modification of the data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:441 msgid "" "If *u* is ``NULL``, this function behaves like :c:func:" "`PyUnicode_FromUnicode` with the buffer set to ``NULL``. This usage is " @@ -451,12 +459,12 @@ msgid "" "Python 3.12." msgstr "" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:448 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer *u*." msgstr "" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:454 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -465,261 +473,261 @@ msgid "" "*format* ASCII-encoded string. The following format characters are allowed:" msgstr "" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:469 msgid "Format Characters" msgstr "" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:469 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:469 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:471 msgid ":attr:`%%`" msgstr ":attr:`%%`" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:471 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:471 msgid "The literal % character." msgstr "" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:473 msgid ":attr:`%c`" msgstr ":attr:`%c`" -#: ../../c-api/unicode.rst:466 ../../c-api/unicode.rst:469 -#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:473 ../../c-api/unicode.rst:476 +#: ../../c-api/unicode.rst:509 ../../c-api/unicode.rst:512 msgid "int" msgstr "int" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:473 msgid "A single character, represented as a C int." msgstr "" -#: ../../c-api/unicode.rst:469 +#: ../../c-api/unicode.rst:476 msgid ":attr:`%d`" msgstr ":attr:`%d`" -#: ../../c-api/unicode.rst:469 +#: ../../c-api/unicode.rst:476 msgid "Equivalent to ``printf(\"%d\")``. [1]_" msgstr "等價於 ``printf(\"%d\")``. [1]_" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:479 msgid ":attr:`%u`" msgstr ":attr:`%u`" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:479 msgid "unsigned int" msgstr "unsigned int" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:479 msgid "Equivalent to ``printf(\"%u\")``. [1]_" msgstr "等價於 ``printf(\"%u\")``. [1]_" -#: ../../c-api/unicode.rst:475 +#: ../../c-api/unicode.rst:482 msgid ":attr:`%ld`" msgstr ":attr:`%ld`" -#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:482 ../../c-api/unicode.rst:485 msgid "long" msgstr "long" -#: ../../c-api/unicode.rst:475 +#: ../../c-api/unicode.rst:482 msgid "Equivalent to ``printf(\"%ld\")``. [1]_" msgstr "等價於 ``printf(\"%ld\")``. [1]_" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:485 msgid ":attr:`%li`" msgstr ":attr:`%li`" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:485 msgid "Equivalent to ``printf(\"%li\")``. [1]_" msgstr "等價於 ``printf(\"%li\")``. [1]_" -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:488 msgid ":attr:`%lu`" msgstr ":attr:`%lu`" -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:488 msgid "unsigned long" msgstr "unsigned long" -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:488 msgid "Equivalent to ``printf(\"%lu\")``. [1]_" msgstr "等價於 ``printf(\"%lu\")``. [1]_" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:491 msgid ":attr:`%lld`" msgstr ":attr:`%lld`" -#: ../../c-api/unicode.rst:484 ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:491 ../../c-api/unicode.rst:494 msgid "long long" msgstr "long long" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:491 msgid "Equivalent to ``printf(\"%lld\")``. [1]_" msgstr "等價於 ``printf(\"%lld\")``. [1]_" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:494 msgid ":attr:`%lli`" msgstr ":attr:`%lli`" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:494 msgid "Equivalent to ``printf(\"%lli\")``. [1]_" msgstr "等價於 ``printf(\"%lli\")``. [1]_" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:497 msgid ":attr:`%llu`" msgstr ":attr:`%llu`" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:497 msgid "unsigned long long" msgstr "unsigned long long" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:497 msgid "Equivalent to ``printf(\"%llu\")``. [1]_" msgstr "等價於 ``printf(\"%llu\")``. [1]_" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:500 msgid ":attr:`%zd`" msgstr ":attr:`%zd`" -#: ../../c-api/unicode.rst:493 ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:500 ../../c-api/unicode.rst:503 msgid ":c:type:`\\ Py_ssize_t`" msgstr ":c:type:`\\ Py_ssize_t`" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:500 msgid "Equivalent to ``printf(\"%zd\")``. [1]_" msgstr "等價於 ``printf(\"%zd\")``. [1]_" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:503 msgid ":attr:`%zi`" msgstr ":attr:`%zi`" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:503 msgid "Equivalent to ``printf(\"%zi\")``. [1]_" msgstr "等價於 ``printf(\"%zi\")``. [1]_" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:506 msgid ":attr:`%zu`" msgstr ":attr:`%zu`" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:506 msgid "size_t" msgstr "size_t" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:506 msgid "Equivalent to ``printf(\"%zu\")``. [1]_" msgstr "等價於 ``printf(\"%zu\")``. [1]_" -#: ../../c-api/unicode.rst:502 +#: ../../c-api/unicode.rst:509 msgid ":attr:`%i`" msgstr ":attr:`%i`" -#: ../../c-api/unicode.rst:502 +#: ../../c-api/unicode.rst:509 msgid "Equivalent to ``printf(\"%i\")``. [1]_" msgstr "等價於 ``printf(\"%i\")``. [1]_" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:512 msgid ":attr:`%x`" msgstr ":attr:`%x`" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:512 msgid "Equivalent to ``printf(\"%x\")``. [1]_" msgstr "等價於 ``printf(\"%x\")``. [1]_" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:515 msgid ":attr:`%s`" msgstr ":attr:`%s`" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:515 msgid "const char\\*" msgstr "const char\\*" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:515 msgid "A null-terminated C character array." msgstr "" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:518 msgid ":attr:`%p`" msgstr ":attr:`%p`" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:518 msgid "const void\\*" msgstr "const void\\*" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:518 msgid "" "The hex representation of a C pointer. Mostly equivalent to ``printf(\"%p" "\")`` except that it is guaranteed to start with the literal ``0x`` " "regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:526 msgid ":attr:`%A`" msgstr ":attr:`%A`" -#: ../../c-api/unicode.rst:519 ../../c-api/unicode.rst:522 -#: ../../c-api/unicode.rst:531 ../../c-api/unicode.rst:534 +#: ../../c-api/unicode.rst:526 ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:538 ../../c-api/unicode.rst:541 msgid "PyObject\\*" msgstr "PyObject\\*" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:526 msgid "The result of calling :func:`ascii`." msgstr "" -#: ../../c-api/unicode.rst:522 +#: ../../c-api/unicode.rst:529 msgid ":attr:`%U`" msgstr ":attr:`%U`" -#: ../../c-api/unicode.rst:522 +#: ../../c-api/unicode.rst:529 msgid "A Unicode object." msgstr "一 Unicode 物件。" -#: ../../c-api/unicode.rst:524 +#: ../../c-api/unicode.rst:531 msgid ":attr:`%V`" msgstr ":attr:`%V`" -#: ../../c-api/unicode.rst:524 +#: ../../c-api/unicode.rst:531 msgid "PyObject\\*, const char\\*" msgstr "PyObject\\*, const char\\*" -#: ../../c-api/unicode.rst:524 +#: ../../c-api/unicode.rst:531 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:531 +#: ../../c-api/unicode.rst:538 msgid ":attr:`%S`" msgstr ":attr:`%S`" -#: ../../c-api/unicode.rst:531 +#: ../../c-api/unicode.rst:538 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" -#: ../../c-api/unicode.rst:534 +#: ../../c-api/unicode.rst:541 msgid ":attr:`%R`" msgstr ":attr:`%R`" -#: ../../c-api/unicode.rst:534 +#: ../../c-api/unicode.rst:541 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" -#: ../../c-api/unicode.rst:538 +#: ../../c-api/unicode.rst:545 msgid "" "An unrecognized format character causes all the rest of the format string to " "be copied as-is to the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:542 +#: ../../c-api/unicode.rst:549 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes for ``\"%s\"`` and ``\"%V\"`` " @@ -728,37 +736,37 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:548 +#: ../../c-api/unicode.rst:555 msgid "" "For integer specifiers (d, u, ld, li, lu, lld, lli, llu, zd, zi, zu, i, x): " "the 0-conversion flag has effect even when a precision is given." msgstr "" -#: ../../c-api/unicode.rst:551 +#: ../../c-api/unicode.rst:558 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" -#: ../../c-api/unicode.rst:554 +#: ../../c-api/unicode.rst:561 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -#: ../../c-api/unicode.rst:557 +#: ../../c-api/unicode.rst:564 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, ``\"%U" "\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -#: ../../c-api/unicode.rst:564 +#: ../../c-api/unicode.rst:571 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:571 +#: ../../c-api/unicode.rst:578 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:573 +#: ../../c-api/unicode.rst:580 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -766,23 +774,23 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:579 +#: ../../c-api/unicode.rst:586 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:582 +#: ../../c-api/unicode.rst:589 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:588 +#: ../../c-api/unicode.rst:595 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:599 +#: ../../c-api/unicode.rst:606 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:" @@ -790,52 +798,52 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:610 +#: ../../c-api/unicode.rst:617 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:start" "+length]``." msgstr "" -#: ../../c-api/unicode.rst:613 +#: ../../c-api/unicode.rst:620 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:616 +#: ../../c-api/unicode.rst:623 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:625 +#: ../../c-api/unicode.rst:632 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:629 +#: ../../c-api/unicode.rst:636 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:638 +#: ../../c-api/unicode.rst:645 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast to the macro " -"version :c:func:`PyUnicode_READ_CHAR`." +"Unicode object and the index is not out of bounds, in contrast to :c:func:" +"`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:648 +#: ../../c-api/unicode.rst:655 msgid "" "Return a substring of *str*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported." msgstr "" -#: ../../c-api/unicode.rst:657 +#: ../../c-api/unicode.rst:664 msgid "" "Copy the string *u* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -843,7 +851,7 @@ msgid "" "*u*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:667 +#: ../../c-api/unicode.rst:674 msgid "" "Copy the string *u* into a new UCS4 buffer that is allocated using :c:func:" "`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -851,11 +859,11 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:676 +#: ../../c-api/unicode.rst:683 msgid "Deprecated Py_UNICODE APIs" msgstr "" -#: ../../c-api/unicode.rst:680 +#: ../../c-api/unicode.rst:687 msgid "" "These API functions are deprecated with the implementation of :pep:`393`. " "Extension modules can continue using them, as they will not be removed in " @@ -863,7 +871,7 @@ msgid "" "and memory hits." msgstr "" -#: ../../c-api/unicode.rst:687 +#: ../../c-api/unicode.rst:694 msgid "" "Create a Unicode object from the Py_UNICODE buffer *u* of the given size. " "*u* may be ``NULL`` which causes the contents to be undefined. It is the " @@ -871,28 +879,28 @@ msgid "" "the new object." msgstr "" -#: ../../c-api/unicode.rst:692 +#: ../../c-api/unicode.rst:699 msgid "" "If the buffer is not ``NULL``, the return value might be a shared object. " "Therefore, modification of the resulting Unicode object is only allowed when " "*u* is ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:696 +#: ../../c-api/unicode.rst:703 msgid "" "If the buffer is ``NULL``, :c:func:`PyUnicode_READY` must be called once the " "string content has been filled before using any of the access macros such " "as :c:func:`PyUnicode_KIND`." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:710 msgid "" "Part of the old-style Unicode API, please migrate to using :c:func:" "`PyUnicode_FromKindAndData`, :c:func:`PyUnicode_FromWideChar`, or :c:func:" "`PyUnicode_New`." msgstr "" -#: ../../c-api/unicode.rst:708 +#: ../../c-api/unicode.rst:715 msgid "" "Return a read-only pointer to the Unicode object's internal :c:type:" "`Py_UNICODE` buffer, or ``NULL`` on error. This will create the :c:expr:" @@ -903,27 +911,14 @@ msgid "" "functions." msgstr "" -#: ../../c-api/unicode.rst:719 ../../c-api/unicode.rst:746 +#: ../../c-api/unicode.rst:726 ../../c-api/unicode.rst:742 msgid "" "Part of the old-style Unicode API, please migrate to using :c:func:" "`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsWideChar`, :c:func:" "`PyUnicode_ReadChar` or similar new APIs." msgstr "" -#: ../../c-api/unicode.rst:724 -msgid "" -"Create a Unicode object by replacing all decimal digits in :c:type:" -"`Py_UNICODE` buffer of the given *size* by ASCII digits 0--9 according to " -"their decimal value. Return ``NULL`` if an exception occurs." -msgstr "" - -#: ../../c-api/unicode.rst:730 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`Py_UNICODE_TODECIMAL`." -msgstr "" - -#: ../../c-api/unicode.rst:735 +#: ../../c-api/unicode.rst:731 msgid "" "Like :c:func:`PyUnicode_AsUnicode`, but also saves the :c:func:`Py_UNICODE` " "array length (excluding the extra null terminator) in *size*. Note that the " @@ -932,35 +927,35 @@ msgid "" "functions." msgstr "" -#: ../../c-api/unicode.rst:751 +#: ../../c-api/unicode.rst:747 msgid "" "Return the size of the deprecated :c:type:`Py_UNICODE` representation, in " "code units (this includes surrogate pairs as 2 units)." msgstr "" -#: ../../c-api/unicode.rst:761 +#: ../../c-api/unicode.rst:757 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "the reference with incremented refcount." msgstr "" -#: ../../c-api/unicode.rst:765 +#: ../../c-api/unicode.rst:761 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:769 +#: ../../c-api/unicode.rst:765 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:771 +#: ../../c-api/unicode.rst:767 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:778 +#: ../../c-api/unicode.rst:774 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are ``" @@ -969,22 +964,22 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:785 +#: ../../c-api/unicode.rst:781 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from :c:" "data:`Py_FileSystemDefaultEncoding` (the locale encoding read at Python " "startup)." msgstr "" -#: ../../c-api/unicode.rst:789 ../../c-api/unicode.rst:825 +#: ../../c-api/unicode.rst:785 ../../c-api/unicode.rst:821 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/unicode.rst:793 ../../c-api/unicode.rst:896 +#: ../../c-api/unicode.rst:789 ../../c-api/unicode.rst:892 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:797 +#: ../../c-api/unicode.rst:793 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -992,13 +987,13 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:806 +#: ../../c-api/unicode.rst:802 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`strlen`." msgstr "" -#: ../../c-api/unicode.rst:814 +#: ../../c-api/unicode.rst:810 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are ``" @@ -1007,17 +1002,17 @@ msgid "" "object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:821 +#: ../../c-api/unicode.rst:817 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to :c:data:" "`Py_FileSystemDefaultEncoding` (the locale encoding read at Python startup)." msgstr "" -#: ../../c-api/unicode.rst:829 ../../c-api/unicode.rst:932 +#: ../../c-api/unicode.rst:825 ../../c-api/unicode.rst:928 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:833 +#: ../../c-api/unicode.rst:829 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -1025,11 +1020,11 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:842 +#: ../../c-api/unicode.rst:838 msgid "File System Encoding" msgstr "" -#: ../../c-api/unicode.rst:844 +#: ../../c-api/unicode.rst:840 msgid "" "To encode and decode file names and other environment strings, :c:data:" "`Py_FileSystemDefaultEncoding` should be used as the encoding, and :c:data:" @@ -1039,7 +1034,7 @@ msgid "" "`PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:853 +#: ../../c-api/unicode.rst:849 msgid "" "ParseTuple converter: encode :class:`str` objects -- obtained directly or " "through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" @@ -1048,18 +1043,18 @@ msgid "" "is no longer used." msgstr "" -#: ../../c-api/unicode.rst:861 ../../c-api/unicode.rst:878 +#: ../../c-api/unicode.rst:857 ../../c-api/unicode.rst:874 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../c-api/unicode.rst:864 +#: ../../c-api/unicode.rst:860 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:870 +#: ../../c-api/unicode.rst:866 msgid "" "ParseTuple converter: decode :class:`bytes` objects -- obtained either " "directly or indirectly through the :class:`os.PathLike` interface -- to :" @@ -1068,18 +1063,18 @@ msgid "" "which must be released when it is no longer used." msgstr "" -#: ../../c-api/unicode.rst:884 +#: ../../c-api/unicode.rst:880 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:886 ../../c-api/unicode.rst:907 -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:882 ../../c-api/unicode.rst:903 +#: ../../c-api/unicode.rst:919 msgid "" "If :c:data:`Py_FileSystemDefaultEncoding` is not set, fall back to the " "locale encoding." msgstr "" -#: ../../c-api/unicode.rst:889 +#: ../../c-api/unicode.rst:885 msgid "" ":c:data:`Py_FileSystemDefaultEncoding` is initialized at startup from the " "locale encoding and cannot be modified later. If you need to decode a string " @@ -1087,23 +1082,23 @@ msgid "" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:898 ../../c-api/unicode.rst:912 -#: ../../c-api/unicode.rst:936 +#: ../../c-api/unicode.rst:894 ../../c-api/unicode.rst:908 +#: ../../c-api/unicode.rst:932 msgid "Use :c:data:`Py_FileSystemDefaultEncodeErrors` error handler." msgstr "" -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:900 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:910 +#: ../../c-api/unicode.rst:906 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` if you know the string length." msgstr "" -#: ../../c-api/unicode.rst:918 +#: ../../c-api/unicode.rst:914 msgid "" "Encode a Unicode object to :c:data:`Py_FileSystemDefaultEncoding` with the :" "c:data:`Py_FileSystemDefaultEncodeErrors` error handler, and return :class:" @@ -1111,29 +1106,29 @@ msgid "" "bytes." msgstr "" -#: ../../c-api/unicode.rst:926 +#: ../../c-api/unicode.rst:922 msgid "" ":c:data:`Py_FileSystemDefaultEncoding` is initialized at startup from the " "locale encoding and cannot be modified later. If you need to encode a string " "to the current locale encoding, use :c:func:`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:940 +#: ../../c-api/unicode.rst:936 msgid "wchar_t Support" msgstr "" -#: ../../c-api/unicode.rst:942 +#: ../../c-api/unicode.rst:938 msgid ":c:expr:`wchar_t` support for platforms which support it:" msgstr "" -#: ../../c-api/unicode.rst:946 +#: ../../c-api/unicode.rst:942 msgid "" "Create a Unicode object from the :c:expr:`wchar_t` buffer *w* of the given " "*size*. Passing ``-1`` as the *size* indicates that the function must itself " "compute the length, using wcslen. Return ``NULL`` on failure." msgstr "" -#: ../../c-api/unicode.rst:954 +#: ../../c-api/unicode.rst:950 msgid "" "Copy the Unicode object contents into the :c:expr:`wchar_t` buffer *w*. At " "most *size* :c:expr:`wchar_t` characters are copied (excluding a possibly " @@ -1146,7 +1141,7 @@ msgid "" "would cause the string to be truncated when used with most C functions." msgstr "" -#: ../../c-api/unicode.rst:967 +#: ../../c-api/unicode.rst:963 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1157,7 +1152,7 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:975 +#: ../../c-api/unicode.rst:971 msgid "" "Returns a buffer allocated by :c:func:`PyMem_Alloc` (use :c:func:" "`PyMem_Free` to free it) on success. On error, returns ``NULL`` and *" @@ -1165,30 +1160,30 @@ msgid "" "failed." msgstr "" -#: ../../c-api/unicode.rst:982 +#: ../../c-api/unicode.rst:978 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:990 +#: ../../c-api/unicode.rst:986 msgid "Built-in Codecs" msgstr "" -#: ../../c-api/unicode.rst:992 +#: ../../c-api/unicode.rst:988 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:995 +#: ../../c-api/unicode.rst:991 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:999 +#: ../../c-api/unicode.rst:995 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1199,28 +1194,28 @@ msgid "" "setlocale)." msgstr "" -#: ../../c-api/unicode.rst:1007 +#: ../../c-api/unicode.rst:1003 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:1011 +#: ../../c-api/unicode.rst:1007 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:1016 +#: ../../c-api/unicode.rst:1012 msgid "Generic Codecs" msgstr "" -#: ../../c-api/unicode.rst:1018 +#: ../../c-api/unicode.rst:1014 msgid "These are the generic codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1024 +#: ../../c-api/unicode.rst:1020 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *s*. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1229,7 +1224,7 @@ msgid "" "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1034 +#: ../../c-api/unicode.rst:1030 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1238,36 +1233,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1044 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* and return a " -"Python bytes object. *encoding* and *errors* have the same meaning as the " -"parameters of the same name in the Unicode :meth:`~str.encode` method. The " -"codec to be used is looked up using the Python codec registry. Return " -"``NULL`` if an exception was raised by the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1052 ../../c-api/unicode.rst:1313 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1056 +#: ../../c-api/unicode.rst:1038 msgid "UTF-8 Codecs" msgstr "" -#: ../../c-api/unicode.rst:1058 +#: ../../c-api/unicode.rst:1040 msgid "These are the UTF-8 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1063 +#: ../../c-api/unicode.rst:1045 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1070 +#: ../../c-api/unicode.rst:1052 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1275,14 +1255,14 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1078 +#: ../../c-api/unicode.rst:1060 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1085 +#: ../../c-api/unicode.rst:1067 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1291,13 +1271,13 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1091 +#: ../../c-api/unicode.rst:1073 msgid "" "In the case of an error, ``NULL`` is returned with an exception set and no " "*size* is stored." msgstr "" -#: ../../c-api/unicode.rst:1094 +#: ../../c-api/unicode.rst:1076 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1306,54 +1286,40 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1101 ../../c-api/unicode.rst:1114 +#: ../../c-api/unicode.rst:1083 ../../c-api/unicode.rst:1096 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "" -#: ../../c-api/unicode.rst:1104 +#: ../../c-api/unicode.rst:1086 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1092 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -#: ../../c-api/unicode.rst:1120 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 " -"and return a Python bytes object. Return ``NULL`` if an exception was " -"raised by the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1127 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsUTF8String`, :c:func:`PyUnicode_AsUTF8AndSize` or :c:func:" -"`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1101 msgid "UTF-32 Codecs" msgstr "" -#: ../../c-api/unicode.rst:1133 +#: ../../c-api/unicode.rst:1103 msgid "These are the UTF-32 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1139 +#: ../../c-api/unicode.rst:1109 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1143 ../../c-api/unicode.rst:1216 +#: ../../c-api/unicode.rst:1113 ../../c-api/unicode.rst:1163 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1150 +#: ../../c-api/unicode.rst:1120 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1361,22 +1327,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1155 +#: ../../c-api/unicode.rst:1125 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1158 ../../c-api/unicode.rst:1232 +#: ../../c-api/unicode.rst:1128 ../../c-api/unicode.rst:1179 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1160 ../../c-api/unicode.rst:1196 -#: ../../c-api/unicode.rst:1234 ../../c-api/unicode.rst:1271 +#: ../../c-api/unicode.rst:1130 ../../c-api/unicode.rst:1181 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1166 +#: ../../c-api/unicode.rst:1136 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1385,53 +1350,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1175 +#: ../../c-api/unicode.rst:1145 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1183 -msgid "" -"Return a Python bytes object holding the UTF-32 encoded value of the Unicode " -"data in *s*. Output is written according to the following byte order::" -msgstr "" - -#: ../../c-api/unicode.rst:1190 ../../c-api/unicode.rst:1264 -msgid "" -"If byteorder is ``0``, the output string will always start with the Unicode " -"BOM mark (U+FEFF). In the other two modes, no BOM mark is prepended." -msgstr "" - -#: ../../c-api/unicode.rst:1193 -msgid "" -"If ``Py_UNICODE_WIDE`` is not defined, surrogate pairs will be output as a " -"single code point." -msgstr "" - -#: ../../c-api/unicode.rst:1200 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsUTF32String` or :c:func:`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1204 +#: ../../c-api/unicode.rst:1151 msgid "UTF-16 Codecs" msgstr "" -#: ../../c-api/unicode.rst:1206 +#: ../../c-api/unicode.rst:1153 msgid "These are the UTF-16 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1212 +#: ../../c-api/unicode.rst:1159 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1223 +#: ../../c-api/unicode.rst:1170 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1440,13 +1381,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1176 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1240 +#: ../../c-api/unicode.rst:1187 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1456,47 +1397,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1196 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1257 -msgid "" -"Return a Python bytes object holding the UTF-16 encoded value of the Unicode " -"data in *s*. Output is written according to the following byte order::" -msgstr "" - -#: ../../c-api/unicode.rst:1267 -msgid "" -"If ``Py_UNICODE_WIDE`` is defined, a single :c:type:`Py_UNICODE` value may " -"get represented as a surrogate pair. If it is not defined, each :c:type:" -"`Py_UNICODE` values is interpreted as a UCS-2 character." -msgstr "" - -#: ../../c-api/unicode.rst:1275 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsUTF16String` or :c:func:`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1279 +#: ../../c-api/unicode.rst:1202 msgid "UTF-7 Codecs" msgstr "" -#: ../../c-api/unicode.rst:1281 +#: ../../c-api/unicode.rst:1204 msgid "These are the UTF-7 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1286 +#: ../../c-api/unicode.rst:1209 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1293 +#: ../../c-api/unicode.rst:1216 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1504,167 +1426,99 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1302 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given size using UTF-7 and " -"return a Python bytes object. Return ``NULL`` if an exception was raised by " -"the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1306 -msgid "" -"If *base64SetO* is nonzero, \"Set O\" (punctuation that has no otherwise " -"special meaning) will be encoded in base-64. If *base64WhiteSpace* is " -"nonzero, whitespace will be encoded in base-64. Both are set to zero for " -"the Python \"utf-7\" codec." -msgstr "" - -#: ../../c-api/unicode.rst:1317 +#: ../../c-api/unicode.rst:1223 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1319 +#: ../../c-api/unicode.rst:1225 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1325 +#: ../../c-api/unicode.rst:1231 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1331 +#: ../../c-api/unicode.rst:1237 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1338 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-" -"Escape and return a bytes object. Return ``NULL`` if an exception was " -"raised by the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1343 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsUnicodeEscapeString`." -msgstr "" - -#: ../../c-api/unicode.rst:1347 +#: ../../c-api/unicode.rst:1243 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1349 +#: ../../c-api/unicode.rst:1245 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1355 +#: ../../c-api/unicode.rst:1251 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1361 +#: ../../c-api/unicode.rst:1257 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1369 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-" -"Escape and return a bytes object. Return ``NULL`` if an exception was " -"raised by the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1375 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsRawUnicodeEscapeString` or :c:func:" -"`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1379 +#: ../../c-api/unicode.rst:1263 msgid "Latin-1 Codecs" msgstr "" -#: ../../c-api/unicode.rst:1381 +#: ../../c-api/unicode.rst:1265 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1387 +#: ../../c-api/unicode.rst:1271 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1393 +#: ../../c-api/unicode.rst:1277 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1400 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Latin-1 and " -"return a Python bytes object. Return ``NULL`` if an exception was raised by " -"the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1407 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsLatin1String` or :c:func:`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1411 +#: ../../c-api/unicode.rst:1283 msgid "ASCII Codecs" msgstr "" -#: ../../c-api/unicode.rst:1413 +#: ../../c-api/unicode.rst:1285 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1419 +#: ../../c-api/unicode.rst:1291 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1425 +#: ../../c-api/unicode.rst:1297 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1432 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given *size* using ASCII and " -"return a Python bytes object. Return ``NULL`` if an exception was raised by " -"the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1439 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsASCIIString` or :c:func:`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1443 +#: ../../c-api/unicode.rst:1303 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1445 +#: ../../c-api/unicode.rst:1305 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1674,18 +1528,18 @@ msgid "" "well." msgstr "" -#: ../../c-api/unicode.rst:1451 +#: ../../c-api/unicode.rst:1311 msgid "These are the mapping codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1456 +#: ../../c-api/unicode.rst:1316 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *s* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1460 +#: ../../c-api/unicode.rst:1320 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1695,14 +1549,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1471 +#: ../../c-api/unicode.rst:1331 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1475 +#: ../../c-api/unicode.rst:1335 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1710,68 +1564,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1484 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given " -"*mapping* object and return the result as a bytes object. Return ``NULL`` " -"if an exception was raised by the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1491 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsCharmapString` or :c:func:`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1494 +#: ../../c-api/unicode.rst:1341 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1498 +#: ../../c-api/unicode.rst:1345 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1502 +#: ../../c-api/unicode.rst:1349 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1505 +#: ../../c-api/unicode.rst:1352 msgid "" "Mapping tables need only provide the :meth:`__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1509 +#: ../../c-api/unicode.rst:1356 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1516 -msgid "" -"Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a " -"character *mapping* table to it and return the resulting Unicode object. " -"Return ``NULL`` when an exception was raised by the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1523 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_Translate`. or :ref:`generic codec based API `" -msgstr "" - -#: ../../c-api/unicode.rst:1527 +#: ../../c-api/unicode.rst:1361 msgid "MBCS codecs for Windows" msgstr "" -#: ../../c-api/unicode.rst:1529 +#: ../../c-api/unicode.rst:1363 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1779,13 +1606,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1536 +#: ../../c-api/unicode.rst:1370 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*s*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1543 +#: ../../c-api/unicode.rst:1377 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1793,58 +1620,44 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1551 +#: ../../c-api/unicode.rst:1385 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1558 +#: ../../c-api/unicode.rst:1392 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:data:`CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1567 -msgid "" -"Encode the :c:type:`Py_UNICODE` buffer of the given *size* using MBCS and " -"return a Python bytes object. Return ``NULL`` if an exception was raised by " -"the codec." -msgstr "" - -#: ../../c-api/unicode.rst:1574 -msgid "" -"Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" -"func:`PyUnicode_AsMBCSString`, :c:func:`PyUnicode_EncodeCodePage` or :c:func:" -"`PyUnicode_AsEncodedString`." -msgstr "" - -#: ../../c-api/unicode.rst:1578 +#: ../../c-api/unicode.rst:1400 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1584 +#: ../../c-api/unicode.rst:1406 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1586 +#: ../../c-api/unicode.rst:1408 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1590 +#: ../../c-api/unicode.rst:1412 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: ../../c-api/unicode.rst:1595 +#: ../../c-api/unicode.rst:1417 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1600 +#: ../../c-api/unicode.rst:1422 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1853,27 +1666,27 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1608 +#: ../../c-api/unicode.rst:1430 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepend* is ``0``, the line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1615 +#: ../../c-api/unicode.rst:1437 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1622 +#: ../../c-api/unicode.rst:1444 msgid "" "Return ``1`` if *substr* matches ``str[start:end]`` at the given tail end " "(*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` a " "suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1630 +#: ../../c-api/unicode.rst:1452 msgid "" "Return the first position of *substr* in ``str[start:end]`` using the given " "*direction* (*direction* == ``1`` means to do a forward search, *direction* " @@ -1882,7 +1695,7 @@ msgid "" "indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1640 +#: ../../c-api/unicode.rst:1462 msgid "" "Return the first position of the character *ch* in ``str[start:end]`` using " "the given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1891,36 +1704,36 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1648 +#: ../../c-api/unicode.rst:1470 msgid "*start* and *end* are now adjusted to behave like ``str[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1655 +#: ../../c-api/unicode.rst:1477 msgid "" "Return the number of non-overlapping occurrences of *substr* in ``str[start:" "end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1662 +#: ../../c-api/unicode.rst:1484 msgid "" "Replace at most *maxcount* occurrences of *substr* in *str* with *replstr* " "and return the resulting Unicode object. *maxcount* == ``-1`` means replace " "all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1669 +#: ../../c-api/unicode.rst:1491 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1672 +#: ../../c-api/unicode.rst:1494 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1678 +#: ../../c-api/unicode.rst:1500 msgid "" "Compare a Unicode object, *uni*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1928,51 +1741,51 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1683 +#: ../../c-api/unicode.rst:1505 msgid "This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:1688 +#: ../../c-api/unicode.rst:1510 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1690 +#: ../../c-api/unicode.rst:1512 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1691 +#: ../../c-api/unicode.rst:1513 msgid ":const:`Py_True` or :const:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1692 +#: ../../c-api/unicode.rst:1514 msgid ":const:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1694 +#: ../../c-api/unicode.rst:1516 msgid "" "Possible values for *op* are :const:`Py_GT`, :const:`Py_GE`, :const:" "`Py_EQ`, :const:`Py_NE`, :const:`Py_LT`, and :const:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1700 +#: ../../c-api/unicode.rst:1522 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1706 +#: ../../c-api/unicode.rst:1528 msgid "" "Check whether *element* is contained in *container* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1709 +#: ../../c-api/unicode.rst:1531 msgid "" "*element* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1715 +#: ../../c-api/unicode.rst:1537 msgid "" "Intern the argument *\\*string* in place. The argument must be the address " "of a pointer variable pointing to a Python Unicode string object. If there " @@ -1985,7 +1798,7 @@ msgid "" "the object after the call if and only if you owned it before the call.)" msgstr "" -#: ../../c-api/unicode.rst:1728 +#: ../../c-api/unicode.rst:1550 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, returning either a new Unicode string object that " diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index aff976f40f..260c29dcf4 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -327,17 +327,11 @@ msgstr "" #: ../../c-api/veryhigh.rst:291 msgid "" -"The C structure of the objects used to describe frame objects. The fields of " -"this type are subject to change at any time." -msgstr "" - -#: ../../c-api/veryhigh.rst:297 -msgid "" "Evaluate an execution frame. This is a simplified interface to :c:func:" "`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" -#: ../../c-api/veryhigh.rst:303 +#: ../../c-api/veryhigh.rst:297 msgid "" "This is the main, unvarnished function of Python interpretation. The code " "object associated with the execution frame *f* is executed, interpreting " @@ -347,39 +341,39 @@ msgid "" "of generator objects." msgstr "" -#: ../../c-api/veryhigh.rst:310 +#: ../../c-api/veryhigh.rst:304 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/veryhigh.rst:317 +#: ../../c-api/veryhigh.rst:311 msgid "" "This function changes the flags of the current evaluation frame, and returns " "true on success, false on failure." msgstr "" -#: ../../c-api/veryhigh.rst:325 +#: ../../c-api/veryhigh.rst:319 msgid "" "The start symbol from the Python grammar for isolated expressions; for use " "with :c:func:`Py_CompileString`." msgstr "" -#: ../../c-api/veryhigh.rst:333 +#: ../../c-api/veryhigh.rst:327 msgid "" "The start symbol from the Python grammar for sequences of statements as read " "from a file or other source; for use with :c:func:`Py_CompileString`. This " "is the symbol to use when compiling arbitrarily long Python source code." msgstr "" -#: ../../c-api/veryhigh.rst:342 +#: ../../c-api/veryhigh.rst:336 msgid "" "The start symbol from the Python grammar for a single statement; for use " "with :c:func:`Py_CompileString`. This is the symbol used for the interactive " "interpreter loop." msgstr "" -#: ../../c-api/veryhigh.rst:349 +#: ../../c-api/veryhigh.rst:343 msgid "" "This is the structure used to hold compiler flags. In cases where code is " "only being compiled, it is passed as ``int flags``, and in cases where code " @@ -387,34 +381,34 @@ msgid "" "case, ``from __future__ import`` can modify *flags*." msgstr "" -#: ../../c-api/veryhigh.rst:354 +#: ../../c-api/veryhigh.rst:348 msgid "" "Whenever ``PyCompilerFlags *flags`` is ``NULL``, :attr:`cf_flags` is treated " "as equal to ``0``, and any modification due to ``from __future__ import`` is " "discarded." msgstr "" -#: ../../c-api/veryhigh.rst:360 +#: ../../c-api/veryhigh.rst:354 msgid "Compiler flags." msgstr "" -#: ../../c-api/veryhigh.rst:364 +#: ../../c-api/veryhigh.rst:358 msgid "" "*cf_feature_version* is the minor Python version. It should be initialized " "to ``PY_MINOR_VERSION``." msgstr "" -#: ../../c-api/veryhigh.rst:367 +#: ../../c-api/veryhigh.rst:361 msgid "" "The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " "flag is set in *cf_flags*." msgstr "" -#: ../../c-api/veryhigh.rst:370 +#: ../../c-api/veryhigh.rst:364 msgid "Added *cf_feature_version* field." msgstr "新增 *cf_feature_version* 欄位。" -#: ../../c-api/veryhigh.rst:376 +#: ../../c-api/veryhigh.rst:370 msgid "" "This bit can be set in *flags* to cause division operator ``/`` to be " "interpreted as \"true division\" according to :pep:`238`." diff --git a/c-api/weakref.po b/c-api/weakref.po index b01531ff42..6536863d9d 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -85,7 +85,5 @@ msgid "" msgstr "" #: ../../c-api/weakref.rst:69 -msgid "" -"Similar to :c:func:`PyWeakref_GetObject`, but implemented as a macro that " -"does no error checking." +msgid "Similar to :c:func:`PyWeakref_GetObject`, but does no error checking." msgstr "" diff --git a/distutils/apiref.po b/distutils/apiref.po index 5426862d26..5ae418e732 100644 --- a/distutils/apiref.po +++ b/distutils/apiref.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2380,48 +2380,34 @@ msgstr "" #: ../../distutils/apiref.rst:1856 msgid "" -":mod:`distutils.command.bdist_msi` --- Build a Microsoft Installer binary " -"package" -msgstr "" - -#: ../../distutils/apiref.rst:1863 -msgid "Use bdist_wheel (wheel packages) instead." -msgstr "" - -#: ../../distutils/apiref.rst:1866 -msgid "Builds a `Windows Installer`_ (.msi) binary package." -msgstr "" - -#: ../../distutils/apiref.rst:1872 -msgid "" ":mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a " "Redhat RPM and SRPM" msgstr "" -#: ../../distutils/apiref.rst:1882 +#: ../../distutils/apiref.rst:1866 msgid ":mod:`distutils.command.sdist` --- Build a source distribution" msgstr "" -#: ../../distutils/apiref.rst:1892 +#: ../../distutils/apiref.rst:1876 msgid ":mod:`distutils.command.build` --- Build all files of a package" msgstr "" -#: ../../distutils/apiref.rst:1902 +#: ../../distutils/apiref.rst:1886 msgid "" ":mod:`distutils.command.build_clib` --- Build any C libraries in a package" msgstr "" -#: ../../distutils/apiref.rst:1912 +#: ../../distutils/apiref.rst:1896 msgid "" ":mod:`distutils.command.build_ext` --- Build any extensions in a package" msgstr "" -#: ../../distutils/apiref.rst:1922 +#: ../../distutils/apiref.rst:1906 msgid "" ":mod:`distutils.command.build_py` --- Build the .py/.pyc files of a package" msgstr "" -#: ../../distutils/apiref.rst:1932 +#: ../../distutils/apiref.rst:1916 msgid "" "Alternative implementation of build_py which also runs the 2to3 conversion " "library on each .py file that is going to be installed. To use this in a " @@ -2429,83 +2415,83 @@ msgid "" "x and 3.x, add::" msgstr "" -#: ../../distutils/apiref.rst:1942 +#: ../../distutils/apiref.rst:1926 msgid "to your setup.py, and later::" msgstr "" -#: ../../distutils/apiref.rst:1946 +#: ../../distutils/apiref.rst:1930 msgid "to the invocation of setup()." msgstr "" -#: ../../distutils/apiref.rst:1950 +#: ../../distutils/apiref.rst:1934 msgid "" ":mod:`distutils.command.build_scripts` --- Build the scripts of a package" msgstr "" -#: ../../distutils/apiref.rst:1960 +#: ../../distutils/apiref.rst:1944 msgid ":mod:`distutils.command.clean` --- Clean a package build area" msgstr "" -#: ../../distutils/apiref.rst:1965 +#: ../../distutils/apiref.rst:1949 msgid "" "This command removes the temporary files created by :command:`build` and its " "subcommands, like intermediary compiled object files. With the ``--all`` " "option, the complete build directory will be removed." msgstr "" -#: ../../distutils/apiref.rst:1969 +#: ../../distutils/apiref.rst:1953 msgid "" "Extension modules built :ref:`in place ` will " "not be cleaned, as they are not in the build directory." msgstr "" -#: ../../distutils/apiref.rst:1974 +#: ../../distutils/apiref.rst:1958 msgid ":mod:`distutils.command.config` --- Perform package configuration" msgstr "" -#: ../../distutils/apiref.rst:1984 +#: ../../distutils/apiref.rst:1968 msgid ":mod:`distutils.command.install` --- Install a package" msgstr "" -#: ../../distutils/apiref.rst:1994 +#: ../../distutils/apiref.rst:1978 msgid "" ":mod:`distutils.command.install_data` --- Install data files from a package" msgstr "" -#: ../../distutils/apiref.rst:2004 +#: ../../distutils/apiref.rst:1988 msgid "" ":mod:`distutils.command.install_headers` --- Install C/C++ header files from " "a package" msgstr "" -#: ../../distutils/apiref.rst:2014 +#: ../../distutils/apiref.rst:1998 msgid "" ":mod:`distutils.command.install_lib` --- Install library files from a package" msgstr "" -#: ../../distutils/apiref.rst:2024 +#: ../../distutils/apiref.rst:2008 msgid "" ":mod:`distutils.command.install_scripts` --- Install script files from a " "package" msgstr "" -#: ../../distutils/apiref.rst:2034 +#: ../../distutils/apiref.rst:2018 msgid "" ":mod:`distutils.command.register` --- Register a module with the Python " "Package Index" msgstr "" -#: ../../distutils/apiref.rst:2040 +#: ../../distutils/apiref.rst:2024 msgid "" "The ``register`` command registers the package with the Python Package " "Index. This is described in more detail in :pep:`301`." msgstr "" -#: ../../distutils/apiref.rst:2047 +#: ../../distutils/apiref.rst:2031 msgid ":mod:`distutils.command.check` --- Check the meta-data of a package" msgstr "" -#: ../../distutils/apiref.rst:2053 +#: ../../distutils/apiref.rst:2037 msgid "" "The ``check`` command performs some tests on the meta-data of a package. For " "example, it verifies that all required meta-data are provided as the " diff --git a/distutils/builtdist.po b/distutils/builtdist.po index e54e45088d..3560b71e0e 100644 --- a/distutils/builtdist.po +++ b/distutils/builtdist.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -297,29 +297,17 @@ msgstr ":command:`bdist_rpm`" msgid "rpm, srpm" msgstr "rpm, srpm" -#: ../../distutils/builtdist.rst:141 -msgid ":command:`bdist_msi`" -msgstr ":command:`bdist_msi`" - -#: ../../distutils/builtdist.rst:141 -msgid "msi" -msgstr "msi" - -#: ../../distutils/builtdist.rst:145 -msgid "bdist_msi is deprecated since Python 3.9." -msgstr "" - -#: ../../distutils/builtdist.rst:147 +#: ../../distutils/builtdist.rst:142 msgid "" "The following sections give details on the individual :command:`bdist_\\*` " "commands." msgstr "" -#: ../../distutils/builtdist.rst:163 +#: ../../distutils/builtdist.rst:158 msgid "Creating RPM packages" msgstr "" -#: ../../distutils/builtdist.rst:165 +#: ../../distutils/builtdist.rst:160 msgid "" "The RPM format is used by many popular Linux distributions, including Red " "Hat, SuSE, and Mandrake. If one of these (or any of the other RPM-based " @@ -330,17 +318,17 @@ msgid "" "RPM-based distributions." msgstr "" -#: ../../distutils/builtdist.rst:172 +#: ../../distutils/builtdist.rst:167 msgid "" "The usual way to create an RPM of your module distribution is to run the :" "command:`bdist_rpm` command::" msgstr "" -#: ../../distutils/builtdist.rst:177 +#: ../../distutils/builtdist.rst:172 msgid "or the :command:`bdist` command with the :option:`!--format` option::" msgstr "" -#: ../../distutils/builtdist.rst:181 +#: ../../distutils/builtdist.rst:176 msgid "" "The former allows you to specify RPM-specific options; the latter allows " "you to easily specify multiple formats in one run. If you need to do both, " @@ -348,7 +336,7 @@ msgid "" "options::" msgstr "" -#: ../../distutils/builtdist.rst:187 +#: ../../distutils/builtdist.rst:182 msgid "" "Creating RPM packages is driven by a :file:`.spec` file, much as using the " "Distutils is driven by the setup script. To make your life easier, the :" @@ -358,191 +346,191 @@ msgid "" "file:`.spec` file are derived from options in the setup script as follows:" msgstr "" -#: ../../distutils/builtdist.rst:195 ../../distutils/builtdist.rst:219 +#: ../../distutils/builtdist.rst:190 ../../distutils/builtdist.rst:214 msgid "RPM :file:`.spec` file option or section" msgstr "" -#: ../../distutils/builtdist.rst:195 +#: ../../distutils/builtdist.rst:190 msgid "Distutils setup script option" msgstr "" -#: ../../distutils/builtdist.rst:197 +#: ../../distutils/builtdist.rst:192 msgid "Name" msgstr "" -#: ../../distutils/builtdist.rst:197 +#: ../../distutils/builtdist.rst:192 msgid "``name``" msgstr "``name``" -#: ../../distutils/builtdist.rst:199 +#: ../../distutils/builtdist.rst:194 msgid "Summary (in preamble)" msgstr "" -#: ../../distutils/builtdist.rst:199 +#: ../../distutils/builtdist.rst:194 msgid "``description``" msgstr "``description``" -#: ../../distutils/builtdist.rst:201 +#: ../../distutils/builtdist.rst:196 msgid "Version" msgstr "" -#: ../../distutils/builtdist.rst:201 +#: ../../distutils/builtdist.rst:196 msgid "``version``" msgstr "``version``" -#: ../../distutils/builtdist.rst:203 ../../distutils/builtdist.rst:226 +#: ../../distutils/builtdist.rst:198 ../../distutils/builtdist.rst:221 msgid "Vendor" msgstr "" -#: ../../distutils/builtdist.rst:203 +#: ../../distutils/builtdist.rst:198 msgid "" "``author`` and ``author_email``, or --- & ``maintainer`` and " "``maintainer_email``" msgstr "" -#: ../../distutils/builtdist.rst:207 +#: ../../distutils/builtdist.rst:202 msgid "Copyright" msgstr "版權宣告" -#: ../../distutils/builtdist.rst:207 +#: ../../distutils/builtdist.rst:202 msgid "``license``" msgstr "``license``" -#: ../../distutils/builtdist.rst:209 +#: ../../distutils/builtdist.rst:204 msgid "Url" msgstr "" -#: ../../distutils/builtdist.rst:209 +#: ../../distutils/builtdist.rst:204 msgid "``url``" msgstr "``url``" -#: ../../distutils/builtdist.rst:211 +#: ../../distutils/builtdist.rst:206 msgid "%description (section)" msgstr "" -#: ../../distutils/builtdist.rst:211 +#: ../../distutils/builtdist.rst:206 msgid "``long_description``" msgstr "``long_description``" -#: ../../distutils/builtdist.rst:214 +#: ../../distutils/builtdist.rst:209 msgid "" "Additionally, there are many options in :file:`.spec` files that don't have " "corresponding options in the setup script. Most of these are handled " "through options to the :command:`bdist_rpm` command as follows:" msgstr "" -#: ../../distutils/builtdist.rst:219 +#: ../../distutils/builtdist.rst:214 msgid ":command:`bdist_rpm` option" msgstr "" -#: ../../distutils/builtdist.rst:219 +#: ../../distutils/builtdist.rst:214 msgid "default value" msgstr "" -#: ../../distutils/builtdist.rst:222 +#: ../../distutils/builtdist.rst:217 msgid "Release" msgstr "" -#: ../../distutils/builtdist.rst:222 +#: ../../distutils/builtdist.rst:217 msgid "``release``" msgstr "``release``" -#: ../../distutils/builtdist.rst:222 +#: ../../distutils/builtdist.rst:217 msgid "\"1\"" msgstr "\"1\"" -#: ../../distutils/builtdist.rst:224 +#: ../../distutils/builtdist.rst:219 msgid "Group" msgstr "" -#: ../../distutils/builtdist.rst:224 +#: ../../distutils/builtdist.rst:219 msgid "``group``" msgstr "``group``" -#: ../../distutils/builtdist.rst:224 +#: ../../distutils/builtdist.rst:219 msgid "\"Development/Libraries\"" msgstr "" -#: ../../distutils/builtdist.rst:226 +#: ../../distutils/builtdist.rst:221 msgid "``vendor``" msgstr "``vendor``" -#: ../../distutils/builtdist.rst:226 +#: ../../distutils/builtdist.rst:221 msgid "(see above)" msgstr "" -#: ../../distutils/builtdist.rst:228 +#: ../../distutils/builtdist.rst:223 msgid "Packager" msgstr "" -#: ../../distutils/builtdist.rst:228 +#: ../../distutils/builtdist.rst:223 msgid "``packager``" msgstr "``packager``" -#: ../../distutils/builtdist.rst:228 ../../distutils/builtdist.rst:230 -#: ../../distutils/builtdist.rst:232 ../../distutils/builtdist.rst:234 -#: ../../distutils/builtdist.rst:236 ../../distutils/builtdist.rst:238 -#: ../../distutils/builtdist.rst:240 ../../distutils/builtdist.rst:242 +#: ../../distutils/builtdist.rst:223 ../../distutils/builtdist.rst:225 +#: ../../distutils/builtdist.rst:227 ../../distutils/builtdist.rst:229 +#: ../../distutils/builtdist.rst:231 ../../distutils/builtdist.rst:233 +#: ../../distutils/builtdist.rst:235 ../../distutils/builtdist.rst:237 msgid "(none)" msgstr "" -#: ../../distutils/builtdist.rst:230 +#: ../../distutils/builtdist.rst:225 msgid "Provides" msgstr "" -#: ../../distutils/builtdist.rst:230 +#: ../../distutils/builtdist.rst:225 msgid "``provides``" msgstr "``provides``" -#: ../../distutils/builtdist.rst:232 +#: ../../distutils/builtdist.rst:227 msgid "Requires" msgstr "" -#: ../../distutils/builtdist.rst:232 +#: ../../distutils/builtdist.rst:227 msgid "``requires``" msgstr "``requires``" -#: ../../distutils/builtdist.rst:234 +#: ../../distutils/builtdist.rst:229 msgid "Conflicts" msgstr "" -#: ../../distutils/builtdist.rst:234 +#: ../../distutils/builtdist.rst:229 msgid "``conflicts``" msgstr "``conflicts``" -#: ../../distutils/builtdist.rst:236 +#: ../../distutils/builtdist.rst:231 msgid "Obsoletes" msgstr "" -#: ../../distutils/builtdist.rst:236 +#: ../../distutils/builtdist.rst:231 msgid "``obsoletes``" msgstr "``obsoletes``" -#: ../../distutils/builtdist.rst:238 +#: ../../distutils/builtdist.rst:233 msgid "Distribution" msgstr "" -#: ../../distutils/builtdist.rst:238 +#: ../../distutils/builtdist.rst:233 msgid "``distribution_name``" msgstr "``distribution_name``" -#: ../../distutils/builtdist.rst:240 +#: ../../distutils/builtdist.rst:235 msgid "BuildRequires" msgstr "BuildRequires" -#: ../../distutils/builtdist.rst:240 +#: ../../distutils/builtdist.rst:235 msgid "``build_requires``" msgstr "``build_requires``" -#: ../../distutils/builtdist.rst:242 +#: ../../distutils/builtdist.rst:237 msgid "Icon" msgstr "" -#: ../../distutils/builtdist.rst:242 +#: ../../distutils/builtdist.rst:237 msgid "``icon``" msgstr "``icon``" -#: ../../distutils/builtdist.rst:245 +#: ../../distutils/builtdist.rst:240 msgid "" "Obviously, supplying even a few of these options on the command-line would " "be tedious and error-prone, so it's usually best to put them in the setup " @@ -554,36 +542,36 @@ msgid "" "`setup.py`." msgstr "" -#: ../../distutils/builtdist.rst:253 +#: ../../distutils/builtdist.rst:248 msgid "" "There are three steps to building a binary RPM package, all of which are " "handled automatically by the Distutils:" msgstr "" -#: ../../distutils/builtdist.rst:256 +#: ../../distutils/builtdist.rst:251 msgid "" "create a :file:`.spec` file, which describes the package (analogous to the " "Distutils setup script; in fact, much of the information in the setup " "script winds up in the :file:`.spec` file)" msgstr "" -#: ../../distutils/builtdist.rst:260 +#: ../../distutils/builtdist.rst:255 msgid "create the source RPM" msgstr "" -#: ../../distutils/builtdist.rst:262 +#: ../../distutils/builtdist.rst:257 msgid "" "create the \"binary\" RPM (which may or may not contain binary code, " "depending on whether your module distribution contains Python extensions)" msgstr "" -#: ../../distutils/builtdist.rst:265 +#: ../../distutils/builtdist.rst:260 msgid "" "Normally, RPM bundles the last two steps together; when you use the " "Distutils, all three steps are typically bundled together." msgstr "" -#: ../../distutils/builtdist.rst:268 +#: ../../distutils/builtdist.rst:263 msgid "" "If you wish, you can separate these three steps. You can use the :option:" "`!--spec-only` option to make :command:`bdist_rpm` just create the :file:`." @@ -594,11 +582,11 @@ msgid "" "command:`bdist_rpm`.)" msgstr "" -#: ../../distutils/builtdist.rst:296 +#: ../../distutils/builtdist.rst:291 msgid "Cross-compiling on Windows" msgstr "" -#: ../../distutils/builtdist.rst:298 +#: ../../distutils/builtdist.rst:293 msgid "" "Starting with Python 2.6, distutils is capable of cross-compiling between " "Windows platforms. In practice, this means that with the correct tools " @@ -606,24 +594,24 @@ msgid "" "and vice-versa." msgstr "" -#: ../../distutils/builtdist.rst:303 +#: ../../distutils/builtdist.rst:298 msgid "" "To build for an alternate platform, specify the :option:`!--plat-name` " "option to the build command. Valid values are currently 'win32', and 'win-" "amd64'. For example, on a 32bit version of Windows, you could execute::" msgstr "" -#: ../../distutils/builtdist.rst:309 +#: ../../distutils/builtdist.rst:304 msgid "to build a 64bit version of your extension." msgstr "" -#: ../../distutils/builtdist.rst:311 +#: ../../distutils/builtdist.rst:306 msgid "" "would create a 64bit installation executable on your 32bit version of " "Windows." msgstr "" -#: ../../distutils/builtdist.rst:313 +#: ../../distutils/builtdist.rst:308 msgid "" "To cross-compile, you must download the Python source code and cross-compile " "Python itself for the platform you are targeting - it is not possible from a " @@ -635,7 +623,7 @@ msgid "" "is possible." msgstr "" -#: ../../distutils/builtdist.rst:322 +#: ../../distutils/builtdist.rst:317 msgid "" "Note that by default, Visual Studio 2008 does not install 64bit compilers or " "tools. You may need to reexecute the Visual Studio setup process and select " @@ -643,11 +631,11 @@ msgid "" "to check or modify your existing install.)" msgstr "" -#: ../../distutils/builtdist.rst:330 +#: ../../distutils/builtdist.rst:325 msgid "The Postinstallation script" msgstr "" -#: ../../distutils/builtdist.rst:332 +#: ../../distutils/builtdist.rst:327 msgid "" "Starting with Python 2.3, a postinstallation script can be specified with " "the :option:`!--install-script` option. The basename of the script must be " @@ -655,7 +643,7 @@ msgid "" "argument to the setup function." msgstr "" -#: ../../distutils/builtdist.rst:337 +#: ../../distutils/builtdist.rst:332 msgid "" "This script will be run at installation time on the target system after all " "the files have been copied, with ``argv[1]`` set to :option:`!-install`, and " @@ -663,20 +651,20 @@ msgid "" "set to :option:`!-remove`." msgstr "" -#: ../../distutils/builtdist.rst:342 +#: ../../distutils/builtdist.rst:337 msgid "" "The installation script runs embedded in the windows installer, every output " "(``sys.stdout``, ``sys.stderr``) is redirected into a buffer and will be " "displayed in the GUI after the script has finished." msgstr "" -#: ../../distutils/builtdist.rst:346 +#: ../../distutils/builtdist.rst:341 msgid "" "Some functions especially useful in this context are available as additional " "built-in functions in the installation script." msgstr "" -#: ../../distutils/builtdist.rst:353 +#: ../../distutils/builtdist.rst:348 msgid "" "These functions should be called when a directory or file is created by the " "postinstall script at installation time. It will register *path* with the " @@ -684,25 +672,25 @@ msgid "" "uninstalled. To be safe, directories are only removed if they are empty." msgstr "" -#: ../../distutils/builtdist.rst:361 +#: ../../distutils/builtdist.rst:356 msgid "" "This function can be used to retrieve special folder locations on Windows " "like the Start Menu or the Desktop. It returns the full path to the folder. " "*csidl_string* must be one of the following strings::" msgstr "" -#: ../../distutils/builtdist.rst:381 +#: ../../distutils/builtdist.rst:376 msgid "If the folder cannot be retrieved, :exc:`OSError` is raised." msgstr "" -#: ../../distutils/builtdist.rst:383 +#: ../../distutils/builtdist.rst:378 msgid "" "Which folders are available depends on the exact Windows version, and " "probably also the configuration. For details refer to Microsoft's " "documentation of the :c:func:`SHGetSpecialFolderPath` function." msgstr "" -#: ../../distutils/builtdist.rst:390 +#: ../../distutils/builtdist.rst:385 msgid "" "This function creates a shortcut. *target* is the path to the program to be " "started by the shortcut. *description* is the description of the shortcut. " @@ -713,3 +701,9 @@ msgid "" "*iconpath*. Again, for details consult the Microsoft documentation for the :" "class:`IShellLink` interface." msgstr "" + +#~ msgid ":command:`bdist_msi`" +#~ msgstr ":command:`bdist_msi`" + +#~ msgid "msi" +#~ msgstr "msi" diff --git a/distutils/sourcedist.po b/distutils/sourcedist.po index 743636a6b6..2d25cf2305 100644 --- a/distutils/sourcedist.po +++ b/distutils/sourcedist.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-18 00:09+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -160,8 +160,8 @@ msgstr "" #: ../../distutils/sourcedist.rst:65 msgid "" -"deprecated by `PEP 527 `_; `PyPI " -"`_ only accepts ``.zip`` and ``.tar.gz`` files." +"deprecated by `PEP 527 `_; `PyPI `_ only accepts ``.zip`` and ``.tar.gz`` files." msgstr "" #: ../../distutils/sourcedist.rst:68 diff --git a/faq/general.po b/faq/general.po index 31ab0d6d00..c87261f00d 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" -"PO-Revision-Date: 2022-10-16 03:39+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 06:51+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -231,21 +231,20 @@ msgstr "" msgid "" "The language comes with a large standard library that covers areas such as " "string processing (regular expressions, Unicode, calculating differences " -"between files), internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGI " -"programming), software engineering (unit testing, logging, profiling, " -"parsing Python code), and operating system interfaces (system calls, " -"filesystems, TCP/IP sockets). Look at the table of contents for :ref:" -"`library-index` to get an idea of what's available. A wide variety of third-" -"party extensions are also available. Consult `the Python Package Index " -"`_ to find packages of interest to you." +"between files), internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP), " +"software engineering (unit testing, logging, profiling, parsing Python " +"code), and operating system interfaces (system calls, filesystems, TCP/IP " +"sockets). Look at the table of contents for :ref:`library-index` to get an " +"idea of what's available. A wide variety of third-party extensions are also " +"available. Consult `the Python Package Index `_ to find " +"packages of interest to you." msgstr "" "這個語言提供了一個大型的標準函式庫,涵蓋了字串處理(正規表示式、Unicode、檔案" -"之間的差異計算)、網際網路協定(HTTP、FTP、SMTP、XML-RPC、POP、IMAP、CGI 程式" -"設計)、軟體工程(單元測試、日誌記錄、效能分析、剖析 Python 程式碼)以及作業" -"系統介面(系統呼叫、檔案系統、TCP/IP 插座 (socket))等領域。請查看 :ref:" -"`library-index` 的目錄,以了解可用的函式。此外,還有各式各樣的第三方擴充。請" -"查詢 `Python 套件索引 (Python Package Index) `_ 來尋找你有" -"興趣的套件。" +"之間的差異計算)、網際網路協定(HTTP、FTP、SMTP、XML-RPC、POP、IMAP)、軟體工" +"程(單元測試、日誌記錄、效能分析、剖析 Python 程式碼)以及作業系統介面(系統" +"呼叫、檔案系統、TCP/IP 插座 (socket))等領域。請查看 :ref:`library-index` 的" +"目錄,以了解可用的函式。此外,還有各式各樣的第三方擴充。請查詢 `Python 套件索" +"引 (Python Package Index) `_ 來尋找你有興趣的套件。" #: ../../faq/general.rst:126 msgid "How does the Python version numbering scheme work?" @@ -484,50 +483,35 @@ msgstr "如何提交 Python 的錯誤報告和修補程式?" #: ../../faq/general.rst:239 msgid "" -"To report a bug or submit a patch, please use the Roundup installation at " -"https://bugs.python.org/." +"To report a bug or submit a patch, use the issue tracker at https://github." +"com/python/cpython/issues." msgstr "" -"要回報一個錯誤 (bug) 或提交一個修補程式 (patch),請使用 https://bugs.python." -"org/ 的 Roundup 安裝。" +"要回報一個錯誤 (bug) 或提交一個修補程式 (patch),請使用於 https://github.com/" +"python/cpython/issues 的問題追蹤系統。" #: ../../faq/general.rst:242 msgid "" -"You must have a Roundup account to report bugs; this makes it possible for " -"us to contact you if we have follow-up questions. It will also enable " -"Roundup to send you updates as we act on your bug. If you had previously " -"used SourceForge to report bugs to Python, you can obtain your Roundup " -"password through Roundup's `password reset procedure `_." -msgstr "" -"你必須擁有一個 Roundup 帳號才能回報錯誤;如果我們有後續的問題,我們才可以與你" -"聯繫。這樣也能讓 Roundup 在我們處理你回報的錯誤時,為你發送最新消息。如果你以" -"前使用過 SourceForge 來向 Python 回報錯誤,則可以透過 Roundup 的\\ `密碼重設" -"過程 `_,取得你的 Roundup " -"密碼。" - -#: ../../faq/general.rst:248 -msgid "" "For more information on how Python is developed, consult `the Python " "Developer's Guide `_." msgstr "" "關於如何開發 Python 的更多資訊,請參閱 `Python 開發人員指南 `_。" -#: ../../faq/general.rst:253 +#: ../../faq/general.rst:247 msgid "Are there any published articles about Python that I can reference?" msgstr "是否有關於 Python 的任何已出版文章可供參考?" -#: ../../faq/general.rst:255 +#: ../../faq/general.rst:249 msgid "It's probably best to cite your favorite book about Python." msgstr "也許最好是引用你最喜歡的關於 Python 的書。" -#: ../../faq/general.rst:257 +#: ../../faq/general.rst:251 msgid "" "The very first article about Python was written in 1991 and is now quite " "outdated." msgstr "最早討論 Python 的文章是在 1991 年寫的,但現在來看已經過時了。" -#: ../../faq/general.rst:260 +#: ../../faq/general.rst:254 msgid "" "Guido van Rossum and Jelke de Boer, \"Interactively Testing Remote Servers " "Using the Python Programming Language\", CWI Quarterly, Volume 4, Issue 4 " @@ -537,11 +521,11 @@ msgstr "" "服器」,CWI 季刊,第 4 卷,第 4 期(1991 年 12 月),阿姆斯特丹,第 283–303 " "頁。" -#: ../../faq/general.rst:266 +#: ../../faq/general.rst:260 msgid "Are there any books on Python?" msgstr "有沒有關於 Python 的書?" -#: ../../faq/general.rst:268 +#: ../../faq/general.rst:262 msgid "" "Yes, there are many, and more are being published. See the python.org wiki " "at https://wiki.python.org/moin/PythonBooks for a list." @@ -549,7 +533,7 @@ msgstr "" "有,很多書已經出版,也有更多正在出版中的書。請參閱 python.org 的 wiki 在 " "https://wiki.python.org/moin/PythonBooks 頁面中的書目清單。" -#: ../../faq/general.rst:271 +#: ../../faq/general.rst:265 msgid "" "You can also search online bookstores for \"Python\" and filter out the " "Monty Python references; or perhaps search for \"Python\" and \"language\"." @@ -557,11 +541,11 @@ msgstr "" "你也可以在網路書店搜尋關鍵字「Python」,並過濾掉 Monty Python 的結果;或者可" "以搜尋「Python」和「語言」。" -#: ../../faq/general.rst:276 +#: ../../faq/general.rst:270 msgid "Where in the world is www.python.org located?" msgstr "www.python.org 的真實位置在哪裡?" -#: ../../faq/general.rst:278 +#: ../../faq/general.rst:272 msgid "" "The Python project's infrastructure is located all over the world and is " "managed by the Python Infrastructure Team. Details `here `__。" -#: ../../faq/general.rst:283 +#: ../../faq/general.rst:277 msgid "Why is it called Python?" msgstr "為什麼要取名為 Python?" -#: ../../faq/general.rst:285 +#: ../../faq/general.rst:279 msgid "" "When he began implementing Python, Guido van Rossum was also reading the " "published scripts from `\"Monty Python's Flying Circus\" `__\\ 的出版劇本。Van Rossum 認為他需要一個簡短、獨特且略帶神秘" "的名字,因此他決定將該語言稱為 Python。" -#: ../../faq/general.rst:293 +#: ../../faq/general.rst:287 msgid "Do I have to like \"Monty Python's Flying Circus\"?" msgstr "我需要喜歡「Monty Python 的飛行馬戲團」嗎?" -#: ../../faq/general.rst:295 +#: ../../faq/general.rst:289 msgid "No, but it helps. :)" msgstr "不需要,但它有幫助。:)" -#: ../../faq/general.rst:299 +#: ../../faq/general.rst:293 msgid "Python in the real world" msgstr "在真實世界中的 Python" -#: ../../faq/general.rst:302 +#: ../../faq/general.rst:296 msgid "How stable is Python?" msgstr "Python 的穩定性如何?" -#: ../../faq/general.rst:304 +#: ../../faq/general.rst:298 msgid "" "Very stable. New, stable releases have been coming out roughly every 6 to " "18 months since 1991, and this seems likely to continue. As of version 3.9, " @@ -613,7 +597,7 @@ msgstr "" "看起來會繼續進行。從 3.9 版開始,Python 每隔 12 個月將會釋出一個主要的發行版" "本 (:pep:`602`)。" -#: ../../faq/general.rst:308 +#: ../../faq/general.rst:302 msgid "" "The developers issue \"bugfix\" releases of older versions, so the stability " "of existing releases gradually improves. Bugfix releases, indicated by a " @@ -627,31 +611,30 @@ msgstr "" "這些版本會被用於改善穩定性;在錯誤修正發布版本中,只會包含針對已知問題的修" "正,並且會保證介面在一系列的錯誤修正發布版本中維持不變。" -#: ../../faq/general.rst:315 +#: ../../faq/general.rst:309 msgid "" "The latest stable releases can always be found on the `Python download page " "`_. There are two production-ready " "versions of Python: 2.x and 3.x. The recommended version is 3.x, which is " "supported by most widely used libraries. Although 2.x is still widely used, " -"`it is not maintained anymore `_." +"`it is not maintained anymore `_." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 `_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " "和 3.x。推薦的版本是 3.x,此版本能被那些最為廣泛使用的函式庫所支援。雖然 2.x " -"仍然被廣泛使用,但\\ `它已不再被維護 `_。" +"仍然被廣泛使用,但\\ `它已不再被維護 `_。" -#: ../../faq/general.rst:322 +#: ../../faq/general.rst:316 msgid "How many people are using Python?" msgstr "有多少人在使用 Python?" -#: ../../faq/general.rst:324 +#: ../../faq/general.rst:318 msgid "" "There are probably millions of users, though it's difficult to obtain an " "exact count." msgstr "可能有幾百萬個使用者,但實際的數量是難以確定的。" -#: ../../faq/general.rst:327 +#: ../../faq/general.rst:321 msgid "" "Python is available for free download, so there are no sales figures, and " "it's available from many different sites and packaged with many Linux " @@ -660,7 +643,7 @@ msgstr "" "Python 是可以免費下載的,所以不會有銷售數據,而且它可以從許多不同的網站取得," "並與許多 Linux 發行版套裝在一起,所以下載次數的統計也無法反映完整的情況。" -#: ../../faq/general.rst:331 +#: ../../faq/general.rst:325 msgid "" "The comp.lang.python newsgroup is very active, but not all Python users post " "to the group or even read it." @@ -668,11 +651,11 @@ msgstr "" "comp.lang.python 新聞群組非常活躍,但並非所有 Python 使用者都會在該群組發表文" "章或甚至閱讀它。" -#: ../../faq/general.rst:336 +#: ../../faq/general.rst:330 msgid "Have any significant projects been done in Python?" msgstr "有沒有任何重要的專案使用 Python 完成開發?" -#: ../../faq/general.rst:338 +#: ../../faq/general.rst:332 msgid "" "See https://www.python.org/about/success for a list of projects that use " "Python. Consulting the proceedings for `past Python conferences `_\\ 可以看見來自許多不同公司和組織的貢獻。" -#: ../../faq/general.rst:343 +#: ../../faq/general.rst:337 msgid "" "High-profile Python projects include `the Mailman mailing list manager " "`_ and `the Zope application server `_." @@ -723,11 +706,11 @@ msgstr "" "新的開發會在 `python-dev 郵件討論群 `_\\ 中討論。" -#: ../../faq/general.rst:365 +#: ../../faq/general.rst:359 msgid "Is it reasonable to propose incompatible changes to Python?" msgstr "對 Python 提出不相容的變更建議是否適當?" -#: ../../faq/general.rst:367 +#: ../../faq/general.rst:361 msgid "" "In general, no. There are already millions of lines of Python code around " "the world, so any change in the language that invalidates more than a very " @@ -741,7 +724,7 @@ msgstr "" "式,仍然會有需要更新全部說明文件的問題;市面上已經有很多介紹 Python 的書,而" "我們不想一下子就把它們都變為無效。" -#: ../../faq/general.rst:374 +#: ../../faq/general.rst:368 msgid "" "Providing a gradual upgrade path is necessary if a feature has to be " "changed. :pep:`5` describes the procedure followed for introducing backward-" @@ -751,15 +734,15 @@ msgstr "" "進反向不相容 (backward-incompatible) 的變更,同時也要對使用者的擾亂最小化,所" "需遵循的程序。" -#: ../../faq/general.rst:380 +#: ../../faq/general.rst:374 msgid "Is Python a good language for beginning programmers?" msgstr "Python 對於入門的程式設計師而言是否為好的語言?" -#: ../../faq/general.rst:382 +#: ../../faq/general.rst:376 msgid "Yes." msgstr "是的。" -#: ../../faq/general.rst:384 +#: ../../faq/general.rst:378 msgid "" "It is still common to start students with a procedural and statically typed " "language such as Pascal, C, or a subset of C++ or Java. Students may be " @@ -779,7 +762,7 @@ msgstr "" "速地向學生介紹基本觀念,例如迴圈和程序。他們甚至可能在第一堂課中就學到使用者" "自訂的物件。" -#: ../../faq/general.rst:394 +#: ../../faq/general.rst:388 msgid "" "For a student who has never programmed before, using a statically typed " "language seems unnatural. It presents additional complexity that the " @@ -795,7 +778,7 @@ msgstr "" "考、分解問題、設計一致的介面,並封裝資料。雖然從長遠來看,學習使用靜態型別語" "言很重要,但在學生的第一堂程式設計課程中,它不一定是最好的課程主題。" -#: ../../faq/general.rst:402 +#: ../../faq/general.rst:396 msgid "" "Many other aspects of Python make it a good first language. Like Java, " "Python has a large standard library so that students can be assigned " @@ -814,7 +797,7 @@ msgstr "" "用程式的滿足感。使用標準函式庫還可以教導學生程式碼再使用 (code reuse) 的課" "題。像是 PyGame 等第三方模組也有助於延伸學生的學習領域。" -#: ../../faq/general.rst:411 +#: ../../faq/general.rst:405 msgid "" "Python's interactive interpreter enables students to test language features " "while they're programming. They can keep a window with the interpreter " @@ -827,13 +810,13 @@ msgstr "" "\n" "::" -#: ../../faq/general.rst:440 +#: ../../faq/general.rst:434 msgid "" "With the interpreter, documentation is never far from the student as they " "are programming." msgstr "有了直譯器,當學生正在程式設計時,說明文件永遠都不會遠離他們。" -#: ../../faq/general.rst:443 +#: ../../faq/general.rst:437 msgid "" "There are also good IDEs for Python. IDLE is a cross-platform IDE for " "Python that is written in Python using Tkinter. Emacs users will be happy to " @@ -849,7 +832,7 @@ msgstr "" "式時存取互動式直譯器。要查看 Python 編輯環境的完整清單,請參閱 `Python wiki " "`_。" -#: ../../faq/general.rst:451 +#: ../../faq/general.rst:445 msgid "" "If you want to discuss Python's use in education, you may be interested in " "joining `the edu-sig mailing list `_。" + +#~ msgid "" +#~ "You must have a Roundup account to report bugs; this makes it possible " +#~ "for us to contact you if we have follow-up questions. It will also " +#~ "enable Roundup to send you updates as we act on your bug. If you had " +#~ "previously used SourceForge to report bugs to Python, you can obtain your " +#~ "Roundup password through Roundup's `password reset procedure `_." +#~ msgstr "" +#~ "你必須擁有一個 Roundup 帳號才能回報錯誤;如果我們有後續的問題,我們才可以" +#~ "與你聯繫。這樣也能讓 Roundup 在我們處理你回報的錯誤時,為你發送最新消息。" +#~ "如果你以前使用過 SourceForge 來向 Python 回報錯誤,則可以透過 Roundup 的" +#~ "\\ `密碼重設過程 `_,取" +#~ "得你的 Roundup 密碼。" diff --git a/faq/programming.po b/faq/programming.po index 4ce660efc0..dc4cdad257 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-05 00:24+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:35+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2031,25 +2031,25 @@ msgstr "" msgid "The classes can be used like this:" msgstr "" -#: ../../faq/programming.rst:1901 +#: ../../faq/programming.rst:1903 msgid "How do I cache method calls?" msgstr "" -#: ../../faq/programming.rst:1903 +#: ../../faq/programming.rst:1905 msgid "" "The two principal tools for caching methods are :func:`functools." "cached_property` and :func:`functools.lru_cache`. The former stores results " "at the instance level and the latter at the class level." msgstr "" -#: ../../faq/programming.rst:1908 +#: ../../faq/programming.rst:1910 msgid "" "The *cached_property* approach only works with methods that do not take any " "arguments. It does not create a reference to the instance. The cached " "method result will be kept only as long as the instance is alive." msgstr "" -#: ../../faq/programming.rst:1912 +#: ../../faq/programming.rst:1914 msgid "" "The advantage is that when an instance is no longer used, the cached method " "result will be released right away. The disadvantage is that if instances " @@ -2057,47 +2057,47 @@ msgid "" "without bound." msgstr "" -#: ../../faq/programming.rst:1917 +#: ../../faq/programming.rst:1919 msgid "" "The *lru_cache* approach works with methods that have hashable arguments. " "It creates a reference to the instance unless special efforts are made to " "pass in weak references." msgstr "" -#: ../../faq/programming.rst:1921 +#: ../../faq/programming.rst:1923 msgid "" "The advantage of the least recently used algorithm is that the cache is " "bounded by the specified *maxsize*. The disadvantage is that instances are " "kept alive until they age out of the cache or until the cache is cleared." msgstr "" -#: ../../faq/programming.rst:1926 +#: ../../faq/programming.rst:1928 msgid "This example shows the various techniques::" msgstr "" -#: ../../faq/programming.rst:1950 +#: ../../faq/programming.rst:1952 msgid "" "The above example assumes that the *station_id* never changes. If the " "relevant instance attributes are mutable, the *cached_property* approach " "can't be made to work because it cannot detect changes to the attributes." msgstr "" -#: ../../faq/programming.rst:1955 +#: ../../faq/programming.rst:1957 msgid "" -"The *lru_cache* approach can be made to work, but the class needs to define " -"the *__eq__* and *__hash__* methods so the cache can detect relevant " -"attribute updates::" +"To make the *lru_cache* approach work when the *station_id* is mutable, the " +"class needs to define the *__eq__* and *__hash__* methods so that the cache " +"can detect relevant attribute updates::" msgstr "" -#: ../../faq/programming.rst:1981 +#: ../../faq/programming.rst:1983 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:1984 +#: ../../faq/programming.rst:1986 msgid "How do I create a .pyc file?" msgstr "" -#: ../../faq/programming.rst:1986 +#: ../../faq/programming.rst:1988 msgid "" "When a module is imported for the first time (or when the source file has " "changed since the current compiled file was created) a ``.pyc`` file " @@ -2108,7 +2108,7 @@ msgid "" "particular ``python`` binary that created it. (See :pep:`3147` for details.)" msgstr "" -#: ../../faq/programming.rst:1994 +#: ../../faq/programming.rst:1996 msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " "with the directory containing the source file, meaning that the " @@ -2117,7 +2117,7 @@ msgid "" "testing with a web server." msgstr "" -#: ../../faq/programming.rst:1999 +#: ../../faq/programming.rst:2001 msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " "creation of a .pyc file is automatic if you're importing a module and Python " @@ -2126,7 +2126,7 @@ msgid "" "subdirectory." msgstr "" -#: ../../faq/programming.rst:2004 +#: ../../faq/programming.rst:2006 msgid "" "Running Python on a top level script is not considered an import and no ``." "pyc`` will be created. For example, if you have a top-level module ``foo." @@ -2136,27 +2136,27 @@ msgid "" "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" -#: ../../faq/programming.rst:2011 +#: ../../faq/programming.rst:2013 msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." "pyc`` file for a module that is not imported -- you can, using the :mod:" "`py_compile` and :mod:`compileall` modules." msgstr "" -#: ../../faq/programming.rst:2015 +#: ../../faq/programming.rst:2017 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" msgstr "" -#: ../../faq/programming.rst:2021 +#: ../../faq/programming.rst:2023 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " "``cfile``)." msgstr "" -#: ../../faq/programming.rst:2025 +#: ../../faq/programming.rst:2027 msgid "" "You can also automatically compile all files in a directory or directories " "using the :mod:`compileall` module. You can do it from the shell prompt by " @@ -2164,11 +2164,11 @@ msgid "" "Python files to compile::" msgstr "" -#: ../../faq/programming.rst:2034 +#: ../../faq/programming.rst:2036 msgid "How do I find the current module name?" msgstr "" -#: ../../faq/programming.rst:2036 +#: ../../faq/programming.rst:2038 msgid "" "A module can find out its own module name by looking at the predefined " "global variable ``__name__``. If this has the value ``'__main__'``, the " @@ -2177,85 +2177,85 @@ msgid "" "only execute this code after checking ``__name__``::" msgstr "" -#: ../../faq/programming.rst:2051 +#: ../../faq/programming.rst:2053 msgid "How can I have modules that mutually import each other?" msgstr "" -#: ../../faq/programming.rst:2053 +#: ../../faq/programming.rst:2055 msgid "Suppose you have the following modules:" msgstr "" -#: ../../faq/programming.rst:2055 +#: ../../faq/programming.rst:2057 msgid ":file:`foo.py`::" msgstr "" ":file:`foo.py`:\n" "\n" "::" -#: ../../faq/programming.rst:2060 +#: ../../faq/programming.rst:2062 msgid ":file:`bar.py`::" msgstr "" ":file:`bar.py`:\n" "\n" "::" -#: ../../faq/programming.rst:2065 +#: ../../faq/programming.rst:2067 msgid "The problem is that the interpreter will perform the following steps:" msgstr "" -#: ../../faq/programming.rst:2067 +#: ../../faq/programming.rst:2069 msgid "main imports ``foo``" msgstr "" -#: ../../faq/programming.rst:2068 +#: ../../faq/programming.rst:2070 msgid "Empty globals for ``foo`` are created" msgstr "" -#: ../../faq/programming.rst:2069 +#: ../../faq/programming.rst:2071 msgid "``foo`` is compiled and starts executing" msgstr "" -#: ../../faq/programming.rst:2070 +#: ../../faq/programming.rst:2072 msgid "``foo`` imports ``bar``" msgstr "" -#: ../../faq/programming.rst:2071 +#: ../../faq/programming.rst:2073 msgid "Empty globals for ``bar`` are created" msgstr "" -#: ../../faq/programming.rst:2072 +#: ../../faq/programming.rst:2074 msgid "``bar`` is compiled and starts executing" msgstr "" -#: ../../faq/programming.rst:2073 +#: ../../faq/programming.rst:2075 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" msgstr "" -#: ../../faq/programming.rst:2074 +#: ../../faq/programming.rst:2076 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" msgstr "" -#: ../../faq/programming.rst:2076 +#: ../../faq/programming.rst:2078 msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " "and the global symbol dictionary for ``foo`` is still empty." msgstr "" -#: ../../faq/programming.rst:2079 +#: ../../faq/programming.rst:2081 msgid "" "The same thing happens when you use ``import foo``, and then try to access " "``foo.foo_var`` in global code." msgstr "" -#: ../../faq/programming.rst:2082 +#: ../../faq/programming.rst:2084 msgid "There are (at least) three possible workarounds for this problem." msgstr "" -#: ../../faq/programming.rst:2084 +#: ../../faq/programming.rst:2086 msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." "``, and placing all code inside functions. Initializations of global " @@ -2264,59 +2264,59 @@ msgid "" "``.``." msgstr "" -#: ../../faq/programming.rst:2089 +#: ../../faq/programming.rst:2091 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "" -#: ../../faq/programming.rst:2091 +#: ../../faq/programming.rst:2093 msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" msgstr "" -#: ../../faq/programming.rst:2093 +#: ../../faq/programming.rst:2095 msgid "``import`` statements" msgstr "" -#: ../../faq/programming.rst:2094 +#: ../../faq/programming.rst:2096 msgid "" "active code (including globals that are initialized from imported values)." msgstr "" -#: ../../faq/programming.rst:2096 +#: ../../faq/programming.rst:2098 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." msgstr "" -#: ../../faq/programming.rst:2099 +#: ../../faq/programming.rst:2101 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." msgstr "" -#: ../../faq/programming.rst:2102 +#: ../../faq/programming.rst:2104 msgid "These solutions are not mutually exclusive." msgstr "" -#: ../../faq/programming.rst:2106 +#: ../../faq/programming.rst:2108 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "" -#: ../../faq/programming.rst:2108 +#: ../../faq/programming.rst:2110 msgid "" "Consider using the convenience function :func:`~importlib.import_module` " "from :mod:`importlib` instead::" msgstr "" -#: ../../faq/programming.rst:2115 +#: ../../faq/programming.rst:2117 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "" -#: ../../faq/programming.rst:2117 +#: ../../faq/programming.rst:2119 msgid "" "For reasons of efficiency as well as consistency, Python only reads the " "module file on the first time a module is imported. If it didn't, in a " @@ -2325,13 +2325,13 @@ msgid "" "re-reading of a changed module, do this::" msgstr "" -#: ../../faq/programming.rst:2127 +#: ../../faq/programming.rst:2129 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" msgstr "" -#: ../../faq/programming.rst:2132 +#: ../../faq/programming.rst:2134 msgid "" "will continue to work with the old version of the imported objects. If the " "module contains class definitions, existing class instances will *not* be " @@ -2339,7 +2339,7 @@ msgid "" "paradoxical behaviour::" msgstr "" -#: ../../faq/programming.rst:2145 +#: ../../faq/programming.rst:2147 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" diff --git a/glossary.po b/glossary.po index 87580ab3cb..74ece5922d 100644 --- a/glossary.po +++ b/glossary.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" -"PO-Revision-Date: 2022-10-16 03:48+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 07:29+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -491,8 +491,8 @@ msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" -"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請" -"見 :term:`argument`):\n" +"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" +"term:`argument`):\n" "\n" "::" @@ -541,32 +541,10 @@ msgstr "" "修改的變數。" #: ../../glossary.rst:235 -msgid "coercion" -msgstr "coercion(強制轉型)" - -#: ../../glossary.rst:237 -msgid "" -"The implicit conversion of an instance of one type to another during an " -"operation which involves two arguments of the same type. For example, " -"``int(3.15)`` converts the floating point number to the integer ``3``, but " -"in ``3+4.5``, each argument is of a different type (one int, one float), and " -"both must be converted to the same type before they can be added or it will " -"raise a :exc:`TypeError`. Without coercion, all arguments of even " -"compatible types would have to be normalized to the same value by the " -"programmer, e.g., ``float(3)+4.5`` rather than just ``3+4.5``." -msgstr "" -"在涉及兩個不同型別引數的操作過程中,將某一種型別的實例換為另一種型別的隱式轉" -"換 (implicit conversion) 過程。例如,``int(3.15)`` 會將浮點數轉換為整數 " -"``3``,但在 ``3+4.5`` 中,每個引數是不同的型別(一個 int,一個 float),而這" -"兩個引數必須在被轉換為相同的型別之後才能相加,否則就會引發 :exc:`TypeError`" -"\\ 。如果沒有強制轉型,即使所有的引數型別皆相容,它們都必須要由程式設計師正規" -"化 (normalize) 為相同的值,例如,要用 ``float(3)+4.5`` 而不能只是 ``3+4.5``。" - -#: ../../glossary.rst:245 msgid "complex number" msgstr "complex number(複數)" -#: ../../glossary.rst:247 +#: ../../glossary.rst:237 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -586,11 +564,11 @@ msgstr "" "相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" "忽略它們。" -#: ../../glossary.rst:257 +#: ../../glossary.rst:247 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../glossary.rst:259 +#: ../../glossary.rst:249 msgid "" "An object which controls the environment seen in a :keyword:`with` statement " "by defining :meth:`__enter__` and :meth:`__exit__` methods. See :pep:`343`." @@ -598,11 +576,11 @@ msgstr "" "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" "`__enter__` 和 :meth:`__exit__` method 來控制的。請參閱 :pep:`343`\\ 。" -#: ../../glossary.rst:262 +#: ../../glossary.rst:252 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:264 +#: ../../glossary.rst:254 msgid "" "A variable which can have different values depending on its context. This is " "similar to Thread-Local Storage in which each execution thread may have a " @@ -617,11 +595,11 @@ msgstr "" "任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。請參閱 :mod:" "`contextvars`\\ 。" -#: ../../glossary.rst:271 +#: ../../glossary.rst:261 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:275 +#: ../../glossary.rst:265 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -638,11 +616,11 @@ msgstr "" "的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:283 +#: ../../glossary.rst:273 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:285 +#: ../../glossary.rst:275 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -653,11 +631,11 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`\\ 。" -#: ../../glossary.rst:290 +#: ../../glossary.rst:280 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:292 +#: ../../glossary.rst:282 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -668,11 +646,11 @@ msgstr "" "`async def` 陳述式被定義,並可能會包含 :keyword:`await`\\ 、\\ :keyword:" "`async for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:297 +#: ../../glossary.rst:287 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:299 +#: ../../glossary.rst:289 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -683,11 +661,11 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:303 +#: ../../glossary.rst:293 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:305 +#: ../../glossary.rst:295 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -697,7 +675,7 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`\\ 。" -#: ../../glossary.rst:309 +#: ../../glossary.rst:299 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" @@ -706,7 +684,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:320 +#: ../../glossary.rst:310 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -715,11 +693,11 @@ msgstr "" "Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" "ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:323 +#: ../../glossary.rst:313 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:325 +#: ../../glossary.rst:315 msgid "" "Any object which defines the methods :meth:`__get__`, :meth:`__set__`, or :" "meth:`__delete__`. When a class attribute is a descriptor, its special " @@ -739,7 +717,7 @@ msgstr "" "這些功能包括函式、method、屬性 (property)、class method、靜態 method,以及對 " "super class(父類別)的參照。" -#: ../../glossary.rst:335 +#: ../../glossary.rst:325 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -747,11 +725,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `\\ 。" -#: ../../glossary.rst:337 +#: ../../glossary.rst:327 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:339 +#: ../../glossary.rst:329 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`__hash__` and :meth:`__eq__` methods. Called a " @@ -761,11 +739,11 @@ msgstr "" "有 :meth:`__hash__` 和 :meth:`__eq__` method 的物件。在 Perl 中被稱為雜湊 " "(hash)。" -#: ../../glossary.rst:342 +#: ../../glossary.rst:332 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:344 +#: ../../glossary.rst:334 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -776,11 +754,11 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 映射到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`\\ 。" -#: ../../glossary.rst:348 +#: ../../glossary.rst:338 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:350 +#: ../../glossary.rst:340 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -793,11 +771,11 @@ msgstr "" "檢視會反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`\\ 。" -#: ../../glossary.rst:356 +#: ../../glossary.rst:346 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:358 +#: ../../glossary.rst:348 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -810,11 +788,11 @@ msgstr "" "`__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏覽,因此它是物" "件的說明文件存放的標準位置。" -#: ../../glossary.rst:364 +#: ../../glossary.rst:354 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:366 +#: ../../glossary.rst:356 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -835,11 +813,11 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:375 +#: ../../glossary.rst:365 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:377 +#: ../../glossary.rst:367 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -854,11 +832,11 @@ msgstr "" "keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" "格形成了對比。" -#: ../../glossary.rst:383 +#: ../../glossary.rst:373 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:385 +#: ../../glossary.rst:375 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -874,11 +852,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`\\ 。賦值 (assignment) 也是" "陳述式,而不是運算式。" -#: ../../glossary.rst:392 +#: ../../glossary.rst:382 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:394 +#: ../../glossary.rst:384 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -886,11 +864,11 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:396 +#: ../../glossary.rst:386 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:398 +#: ../../glossary.rst:388 msgid "" "String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " @@ -899,11 +877,11 @@ msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`\\ 。" -#: ../../glossary.rst:401 +#: ../../glossary.rst:391 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:403 +#: ../../glossary.rst:393 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`read()` " "or :meth:`write()`) to an underlying resource. Depending on the way it was " @@ -918,7 +896,7 @@ msgstr "" "緩衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔" "案物件 (file-like object)` 或\\ :dfn:`串流 (stream)`\\ 。" -#: ../../glossary.rst:411 +#: ../../glossary.rst:401 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -931,19 +909,19 @@ msgstr "" "它們的介面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:" "`open` 函式。" -#: ../../glossary.rst:416 +#: ../../glossary.rst:406 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:418 +#: ../../glossary.rst:408 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:419 +#: ../../glossary.rst:409 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:421 +#: ../../glossary.rst:411 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -951,7 +929,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:424 +#: ../../glossary.rst:414 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -960,7 +938,7 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`\\ 。" -#: ../../glossary.rst:428 +#: ../../glossary.rst:418 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -969,7 +947,7 @@ msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:432 +#: ../../glossary.rst:422 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -981,22 +959,22 @@ msgstr "" "member:`~PyConfig.filesystem_encoding`\\ ,以及 :c:type:`PyConfig` 的成員 :c:" "member:`~PyConfig.filesystem_errors`\\ 。" -#: ../../glossary.rst:437 +#: ../../glossary.rst:427 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:438 +#: ../../glossary.rst:428 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:440 +#: ../../glossary.rst:430 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:443 +#: ../../glossary.rst:433 msgid "" "Since Python 3.3, there are two types of finder: :term:`meta path finders " "` for use with :data:`sys.meta_path`, and :term:`path " @@ -1007,15 +985,15 @@ msgstr "" "項目尋檢器 (path entry finder) ` 會使用 :data:`sys." "path_hooks`\\ 。" -#: ../../glossary.rst:447 +#: ../../glossary.rst:437 msgid "See :pep:`302`, :pep:`420` and :pep:`451` for much more detail." msgstr "請參閱 :pep:`302`\\ 、\\ :pep:`420` 和 :pep:`451` 以了解更多細節。" -#: ../../glossary.rst:448 +#: ../../glossary.rst:438 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:450 +#: ../../glossary.rst:440 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1028,11 +1006,11 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`\\ 。" -#: ../../glossary.rst:455 +#: ../../glossary.rst:445 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:457 +#: ../../glossary.rst:447 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1044,15 +1022,15 @@ msgstr "" "`parameter`\\ (參數)、\\ :term:`method`\\ (方法),以及\\ :ref:`function`" "\\ 章節。" -#: ../../glossary.rst:461 +#: ../../glossary.rst:451 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:463 +#: ../../glossary.rst:453 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:465 +#: ../../glossary.rst:455 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1063,11 +1041,11 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:473 +#: ../../glossary.rst:463 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:475 +#: ../../glossary.rst:465 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1076,11 +1054,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`\\ ,皆有此功能的描述。關於註" "釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`\\ 。" -#: ../../glossary.rst:479 +#: ../../glossary.rst:469 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:481 +#: ../../glossary.rst:471 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1098,11 +1076,11 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:492 +#: ../../glossary.rst:482 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:494 +#: ../../glossary.rst:484 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1114,11 +1092,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:500 +#: ../../glossary.rst:490 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:502 +#: ../../glossary.rst:492 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1129,7 +1107,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:507 +#: ../../glossary.rst:497 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1138,15 +1116,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*\\ 。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:510 +#: ../../glossary.rst:500 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:512 +#: ../../glossary.rst:502 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:514 +#: ../../glossary.rst:504 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -1157,11 +1135,11 @@ msgstr "" "中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" "那些每次調用時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:521 +#: ../../glossary.rst:511 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:523 +#: ../../glossary.rst:513 msgid "" "An expression that returns an iterator. It looks like a normal expression " "followed by a :keyword:`!for` clause defining a loop variable, range, and an " @@ -1174,11 +1152,11 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:530 +#: ../../glossary.rst:520 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:532 +#: ../../glossary.rst:522 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1187,7 +1165,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:536 +#: ../../glossary.rst:526 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1195,11 +1173,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、\\ :func:" "`functools.singledispatch` 裝飾器和 :pep:`443`\\ 。" -#: ../../glossary.rst:538 +#: ../../glossary.rst:528 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:540 +#: ../../glossary.rst:530 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1209,7 +1187,7 @@ msgstr "" "`容器型別 `\\ ,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `\\ 。" -#: ../../glossary.rst:545 +#: ../../glossary.rst:535 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1217,19 +1195,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `\\ 、\\ :pep:`483`" "\\ 、\\ :pep:`484`\\ 、\\ :pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:547 +#: ../../glossary.rst:537 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:549 +#: ../../glossary.rst:539 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:550 +#: ../../glossary.rst:540 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:552 +#: ../../glossary.rst:542 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1246,7 +1224,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:561 +#: ../../glossary.rst:551 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1257,7 +1235,7 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:566 +#: ../../glossary.rst:556 msgid "" "Past efforts to create a \"free-threaded\" interpreter (one which locks " "shared data at a much finer granularity) have not been successful because " @@ -1269,11 +1247,11 @@ msgstr "" "力並未成功,因為在一般的單一處理器情況下,效能會有所損失。一般認為,若要克服" "這個效能問題,會使實作變得複雜許多,進而付出更高的維護成本。" -#: ../../glossary.rst:572 +#: ../../glossary.rst:562 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:574 +#: ../../glossary.rst:564 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1282,11 +1260,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`\\ 。" -#: ../../glossary.rst:577 +#: ../../glossary.rst:567 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:579 +#: ../../glossary.rst:569 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`__hash__` method), and can be compared to " @@ -1298,7 +1276,7 @@ msgstr "" "method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的多個可雜湊物件," "它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:584 +#: ../../glossary.rst:574 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1306,7 +1284,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:587 +#: ../../glossary.rst:577 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1321,11 +1299,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`\\ 。" -#: ../../glossary.rst:594 +#: ../../glossary.rst:584 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:596 +#: ../../glossary.rst:586 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1335,11 +1313,11 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:599 +#: ../../glossary.rst:589 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:601 +#: ../../glossary.rst:591 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1351,11 +1329,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:606 +#: ../../glossary.rst:596 msgid "import path" msgstr "import path(匯入路徑)" -#: ../../glossary.rst:608 +#: ../../glossary.rst:598 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1367,11 +1345,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`\\ ,但對於子套" "件 (subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:613 +#: ../../glossary.rst:603 msgid "importing" msgstr "importing(匯入)" -#: ../../glossary.rst:615 +#: ../../glossary.rst:605 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1379,11 +1357,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:617 +#: ../../glossary.rst:607 msgid "importer" msgstr "importer(匯入器)" -#: ../../glossary.rst:619 +#: ../../glossary.rst:609 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1391,11 +1369,11 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:621 +#: ../../glossary.rst:611 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:623 +#: ../../glossary.rst:613 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1408,11 +1386,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" "記住help(x))。" -#: ../../glossary.rst:629 +#: ../../glossary.rst:619 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:631 +#: ../../glossary.rst:621 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1426,11 +1404,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:638 +#: ../../glossary.rst:628 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:640 +#: ../../glossary.rst:630 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1448,34 +1426,34 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:649 +#: ../../glossary.rst:639 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:651 +#: ../../glossary.rst:641 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:653 +#: ../../glossary.rst:643 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " "and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" "`file objects `, and objects of any classes you define with an :" "meth:`__iter__` method or with a :meth:`__getitem__` method that implements :" -"term:`Sequence ` semantics." +"term:`sequence` semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" "是 :class:`list`\\ 、\\ :class:`str` 和 :class:`tuple`\\ )和某些非序列型別," "像是 :class:`dict`\\ 、\\ :term:`檔案物件 `\\ ,以及你所定義的任" "何 class 物件,只要那些 class 有 :meth:`__iter__` method 或是實作 :term:" -"`Sequence `\\ (序列)語意的 :meth:`__getitem__` method,該物件就是" -"可疊代物件。" +"`sequence`\\ (序列)語意的 :meth:`__getitem__` method,該物件就是可疊代物" +"件。" -#: ../../glossary.rst:660 +#: ../../glossary.rst:650 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1495,11 +1473,11 @@ msgstr "" "於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、\\ :term:" "`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:670 +#: ../../glossary.rst:660 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:672 +#: ../../glossary.rst:662 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1528,11 +1506,11 @@ msgstr "" "事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:687 +#: ../../glossary.rst:677 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:691 +#: ../../glossary.rst:681 msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`__iter__`." @@ -1540,11 +1518,11 @@ msgstr "" "CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`__iter__`\\ 」這個規" "定。" -#: ../../glossary.rst:693 +#: ../../glossary.rst:683 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:695 +#: ../../glossary.rst:685 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1554,7 +1532,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,\\ :func:`locale." "strxfrm` 被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:700 +#: ../../glossary.rst:690 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1566,37 +1544,36 @@ msgstr "" "\\ 、\\ :func:`heapq.merge`\\ 、\\ :func:`heapq.nsmallest`\\ 、\\ :func:" "`heapq.nlargest` 和 :func:`itertools.groupby`\\ 。" -#: ../../glossary.rst:706 +#: ../../glossary.rst:696 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " "Alternatively, a key function can be built from a :keyword:`lambda` " -"expression such as ``lambda r: (r[0], r[2])``. Also, the :mod:`operator` " -"module provides three key function constructors: :func:`~operator." -"attrgetter`, :func:`~operator.itemgetter`, and :func:`~operator." -"methodcaller`. See the :ref:`Sorting HOW TO ` for examples of " -"how to create and use key functions." +"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." +"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " +"are three key function constructors. See the :ref:`Sorting HOW TO " +"` for examples of how to create and use key functions." msgstr "" "有幾種方法可以建立一個鍵函式。例如,\\ :meth:`str.lower` method 可以作為不分" "大小寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造," -"例如 ``lambda r: (r[0], r[2])``。另外,\\ :mod:`operator` 模組提供了三個鍵函" -"式的建構函式 (constructor):\\ :func:`~operator.attrgetter`\\ 、\\ :func:" -"`~operator.itemgetter` 和 :func:`~operator.methodcaller`\\ 。關於如何建立和使" -"用鍵函式的範例,請參閱\\ :ref:`如何排序 `\\ 。" +"例如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`\\ 、\\ :" +"func:`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建" +"構函式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排" +"序 `\\ 。" -#: ../../glossary.rst:714 +#: ../../glossary.rst:703 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:716 ../../glossary.rst:1005 +#: ../../glossary.rst:705 ../../glossary.rst:994 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:717 +#: ../../glossary.rst:706 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:719 +#: ../../glossary.rst:708 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1606,11 +1583,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:722 +#: ../../glossary.rst:711 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:724 +#: ../../glossary.rst:713 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1621,7 +1598,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:729 +#: ../../glossary.rst:718 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1635,41 +1612,40 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:734 +#: ../../glossary.rst:723 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:736 +#: ../../glossary.rst:725 msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with " -"``locale.setlocale(locale.LC_CTYPE, new_locale)``." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" +"`locale.setlocale(locale.LC_CTYPE, new_locale) `." msgstr "" -"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 ``locale.setlocale(locale." -"LC_CTYPE, new_locale)`` 來設定。" - -#: ../../glossary.rst:739 -msgid "On Windows, it is the ANSI code page (ex: ``cp1252``)." -msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``cp1252``\\ )。" +"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." +"setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:741 -msgid "" -"``locale.getpreferredencoding(False)`` can be used to get the locale " -"encoding." -msgstr "``locale.getpreferredencoding(False)`` 可以用來取得區域編碼。" +#: ../../glossary.rst:728 +msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." +msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:744 +#: ../../glossary.rst:730 msgid "" -"Python uses the :term:`filesystem encoding and error handler` to convert " -"between Unicode filenames and bytes filenames." +"On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "" -"Python 使用 :term:`filesystem encoding and error handler`\\ (檔案系統編碼和" -"錯誤處理函式)在 Unicode 檔案名稱和位元組檔案名稱之間進行轉換。" -#: ../../glossary.rst:746 +#: ../../glossary.rst:732 +msgid "``locale.getencoding()`` can be used to get the locale encoding." +msgstr "``locale.getencoding()`` 可以用來取得區域編碼。" + +#: ../../glossary.rst:734 +msgid "See also the :term:`filesystem encoding and error handler`." +msgstr "也請參考 :term:`filesystem encoding and error handler`。" + +#: ../../glossary.rst:735 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:748 +#: ../../glossary.rst:737 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1679,11 +1655,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 O(1)。" -#: ../../glossary.rst:751 +#: ../../glossary.rst:740 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:753 +#: ../../glossary.rst:742 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1697,11 +1673,11 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:759 +#: ../../glossary.rst:748 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:761 +#: ../../glossary.rst:750 msgid "" "An object that loads a module. It must define a method named :meth:" "`load_module`. A loader is typically returned by a :term:`finder`. See :pep:" @@ -1713,38 +1689,38 @@ msgstr "" "`302`,關於 :term:`abstract base class`\\ (抽象基底類別),請參閱 :class:" "`importlib.abc.Loader`\\ 。" -#: ../../glossary.rst:765 +#: ../../glossary.rst:754 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:769 +#: ../../glossary.rst:758 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:770 +#: ../../glossary.rst:759 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:772 +#: ../../glossary.rst:761 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`~collections.abc.Mapping` or :class:" -"`~collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:" "`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" "`collections.Counter`." msgstr "" "一個容器物件,它支援任意鍵的查找,且能實作 :ref:`abstract base classes(抽象" -"基底類別) `\\ 中,\\ :class:" -"`~collections.abc.Mapping` 或 :class:`~collections.abc.MutableMapping` 所指定" -"的 method。範例包括 :class:`dict`\\ 、\\ :class:`collections.defaultdict`" -"\\ 、\\ :class:`collections.OrderedDict` 和 :class:`collections.Counter`\\ 。" +"基底類別) `\\ 中,\\ :class:`collections." +"abc.Mapping` 或 :class:`collections.abc.MutableMapping` 所指定的 method。範例" +"包括 :class:`dict`\\ 、\\ :class:`collections.defaultdict`\\ 、\\ :class:" +"`collections.OrderedDict` 和 :class:`collections.Counter`\\ 。" -#: ../../glossary.rst:778 +#: ../../glossary.rst:767 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:780 +#: ../../glossary.rst:769 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:784 +#: ../../glossary.rst:773 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." @@ -1762,11 +1738,11 @@ msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`" "\\ 。" -#: ../../glossary.rst:786 +#: ../../glossary.rst:775 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:788 +#: ../../glossary.rst:777 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1786,15 +1762,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:798 +#: ../../glossary.rst:787 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:799 +#: ../../glossary.rst:788 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:801 +#: ../../glossary.rst:790 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1806,11 +1782,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:805 +#: ../../glossary.rst:794 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:807 +#: ../../glossary.rst:796 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See `The Python 2.3 Method Resolution Order `_\\ 。" -#: ../../glossary.rst:811 +#: ../../glossary.rst:800 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:813 +#: ../../glossary.rst:802 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1835,15 +1811,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:817 +#: ../../glossary.rst:806 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:807 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:820 +#: ../../glossary.rst:809 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1851,19 +1827,19 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:811 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:824 +#: ../../glossary.rst:813 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:825 +#: ../../glossary.rst:814 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:827 +#: ../../glossary.rst:816 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1871,11 +1847,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`\\ 。另請參閱 :term:" "`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:829 +#: ../../glossary.rst:818 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:831 +#: ../../glossary.rst:820 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -1885,7 +1861,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:835 +#: ../../glossary.rst:824 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -1896,7 +1872,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:846 +#: ../../glossary.rst:835 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -1912,11 +1888,11 @@ msgstr "" "些額外的 method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到" "的。" -#: ../../glossary.rst:853 +#: ../../glossary.rst:842 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:855 +#: ../../glossary.rst:844 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -1936,11 +1912,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:865 +#: ../../glossary.rst:854 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:867 +#: ../../glossary.rst:856 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -1951,15 +1927,15 @@ msgstr "" "一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" "`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:872 +#: ../../glossary.rst:861 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:873 +#: ../../glossary.rst:862 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:875 +#: ../../glossary.rst:864 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -1974,11 +1950,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。\\ :keyword:`nonlocal` 容" "許對外層作用域進行寫入。" -#: ../../glossary.rst:882 +#: ../../glossary.rst:871 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:884 +#: ../../glossary.rst:873 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -1990,11 +1966,11 @@ msgstr "" "__slots__`\\ 、描述器 (descriptor)、屬性 (property)、\\ :meth:" "`__getattribute__`\\ 、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:888 +#: ../../glossary.rst:877 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:890 +#: ../../glossary.rst:879 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2002,11 +1978,11 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:893 +#: ../../glossary.rst:882 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:895 +#: ../../glossary.rst:884 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with an ``__path__`` " @@ -2016,17 +1992,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:899 +#: ../../glossary.rst:888 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace package`" "\\ (命名空間套件)。" -#: ../../glossary.rst:900 +#: ../../glossary.rst:889 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:902 +#: ../../glossary.rst:891 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2036,7 +2012,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:906 +#: ../../glossary.rst:895 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2049,7 +2025,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:915 +#: ../../glossary.rst:904 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2062,7 +2038,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:924 +#: ../../glossary.rst:913 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2077,7 +2053,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:932 +#: ../../glossary.rst:921 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2091,7 +2067,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:940 +#: ../../glossary.rst:929 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2102,14 +2078,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:946 +#: ../../glossary.rst:935 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:949 +#: ../../glossary.rst:938 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2120,11 +2096,11 @@ msgstr "" "參數之間的差異 `\\ 、\\ :class:`inspect." "Parameter` class、\\ :ref:`function`\\ 章節,以及 :pep:`362`\\ 。" -#: ../../glossary.rst:953 +#: ../../glossary.rst:942 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:955 +#: ../../glossary.rst:944 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2132,11 +2108,11 @@ msgstr "" "在 :term:`import path`\\ (匯入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:957 +#: ../../glossary.rst:946 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:959 +#: ../../glossary.rst:948 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2146,7 +2122,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`\\ ,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:963 +#: ../../glossary.rst:952 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2154,11 +2130,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`\\ 。" -#: ../../glossary.rst:965 +#: ../../glossary.rst:954 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:967 +#: ../../glossary.rst:956 msgid "" "A callable on the :data:`sys.path_hook` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2168,11 +2144,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:970 +#: ../../glossary.rst:959 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:972 +#: ../../glossary.rst:961 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2180,11 +2156,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:974 +#: ../../glossary.rst:963 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:976 +#: ../../glossary.rst:965 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2202,11 +2178,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:984 +#: ../../glossary.rst:973 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:986 +#: ../../glossary.rst:975 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2217,7 +2193,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:992 +#: ../../glossary.rst:981 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2229,15 +2205,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:998 +#: ../../glossary.rst:987 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`\\ 。" -#: ../../glossary.rst:999 +#: ../../glossary.rst:988 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1001 +#: ../../glossary.rst:990 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2245,15 +2221,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1003 +#: ../../glossary.rst:992 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1006 +#: ../../glossary.rst:995 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1008 +#: ../../glossary.rst:997 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2269,7 +2245,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1017 +#: ../../glossary.rst:1006 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2278,7 +2254,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1021 +#: ../../glossary.rst:1010 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2287,19 +2263,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1024 +#: ../../glossary.rst:1013 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1026 +#: ../../glossary.rst:1015 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1016 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1018 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2308,11 +2284,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1021 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1034 +#: ../../glossary.rst:1023 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2328,18 +2304,18 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1033 msgid "As opposed to the cleaner, Pythonic method::" msgstr "" "相較之下,以下方法更簡潔、更具有 Python 風格:\n" "\n" "::" -#: ../../glossary.rst:1048 +#: ../../glossary.rst:1037 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1050 +#: ../../glossary.rst:1039 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2352,7 +2328,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:1067 +#: ../../glossary.rst:1056 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2363,29 +2339,28 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:1074 +#: ../../glossary.rst:1063 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1076 +#: ../../glossary.rst:1065 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Reference counting is generally " "not visible to Python code, but it is a key element of the :term:`CPython` " -"implementation. The :mod:`sys` module defines a :func:`~sys.getrefcount` " -"function that programmers can call to return the reference count for a " -"particular object." +"implementation. Programmers can call the :func:`sys.getrefcount` function " +"to return the reference count for a particular object." msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " "(deallocated)。參照計數通常在 Python 程式碼中看不到,但它卻是 :term:" -"`CPython` 實作的一個關鍵元素。\\ :mod:`sys` 模組定義了一個 :func:`~sys." -"getrefcount` 函式,程序設計師可以呼叫該函式來回傳一個特定物件的參照計數。" +"`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :func:`~sys.getrefcount` 函" +"式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1082 +#: ../../glossary.rst:1071 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1084 +#: ../../glossary.rst:1073 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2393,15 +2368,15 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1076 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1088 +#: ../../glossary.rst:1077 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1090 +#: ../../glossary.rst:1079 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2414,11 +2389,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1095 +#: ../../glossary.rst:1084 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1097 +#: ../../glossary.rst:1086 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`__getitem__` special method and defines a :meth:" @@ -2436,7 +2411,7 @@ msgstr "" "對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`immutable` 鍵," "而不是整數。" -#: ../../glossary.rst:1106 +#: ../../glossary.rst:1095 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`__getitem__` and :meth:" @@ -2450,11 +2425,11 @@ msgstr "" "`__reversed__`\\ 。實作此擴充介面的型別,可以使用 :func:`~abc.ABCMeta." "register` 被明確地註冊。" -#: ../../glossary.rst:1113 +#: ../../glossary.rst:1102 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1115 +#: ../../glossary.rst:1104 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2465,11 +2440,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`\\ 。" -#: ../../glossary.rst:1119 +#: ../../glossary.rst:1108 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1121 +#: ../../glossary.rst:1110 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2477,11 +2452,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1123 +#: ../../glossary.rst:1112 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1125 +#: ../../glossary.rst:1114 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2493,11 +2468,11 @@ msgstr "" "字之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1129 +#: ../../glossary.rst:1118 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1133 +#: ../../glossary.rst:1122 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2508,11 +2483,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1137 +#: ../../glossary.rst:1126 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1139 +#: ../../glossary.rst:1128 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2522,11 +2497,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`\\ 、\\ :" "keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1142 +#: ../../glossary.rst:1131 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1133 msgid "" "In Python's C API, a strong reference is a reference to an object which " "increments the object's reference count when it is created and decrements " @@ -2535,7 +2510,7 @@ msgstr "" "在 Python 的 C API 中,強參照是一個對物件的參照,在它被建立時會增加該物件的參" "照計數 (reference count),在它被刪除時則會減少該物件的參照計數。" -#: ../../glossary.rst:1148 +#: ../../glossary.rst:1137 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2545,15 +2520,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1153 +#: ../../glossary.rst:1142 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1154 +#: ../../glossary.rst:1143 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1145 msgid "" "A string in Python is a sequence of Unicode code points (in range ``U" "+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2562,7 +2537,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1160 +#: ../../glossary.rst:1149 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2570,7 +2545,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1163 +#: ../../glossary.rst:1152 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2578,11 +2553,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1155 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1168 +#: ../../glossary.rst:1157 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2596,7 +2571,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、\\ :data:`sys.stdin`\\ 、\\ :" "data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1164 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2604,11 +2579,11 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進制檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1177 +#: ../../glossary.rst:1166 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1179 +#: ../../glossary.rst:1168 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2623,11 +2598,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1186 +#: ../../glossary.rst:1175 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1188 +#: ../../glossary.rst:1177 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~instance." @@ -2637,15 +2612,15 @@ msgstr "" "件的型別可以用它的 :attr:`~instance.__class__` 屬性來存取,或以 " "``type(obj)`` 來檢索。" -#: ../../glossary.rst:1192 +#: ../../glossary.rst:1181 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1194 +#: ../../glossary.rst:1183 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1196 +#: ../../glossary.rst:1185 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" @@ -2654,22 +2629,22 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1192 msgid "could be made more readable like this::" msgstr "" "可以寫成這樣,更具有可讀性:\n" "\n" "::" -#: ../../glossary.rst:1210 ../../glossary.rst:1224 +#: ../../glossary.rst:1199 ../../glossary.rst:1213 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`\\ ,有此功能的描述。" -#: ../../glossary.rst:1211 +#: ../../glossary.rst:1200 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1213 +#: ../../glossary.rst:1202 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2677,7 +2652,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1216 +#: ../../glossary.rst:1205 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to static type analysis tools, and aid IDEs with code completion and " @@ -2686,7 +2661,7 @@ msgstr "" "型別提示是選擇性的,而不是被 Python 強制的,但它們對靜態型別分析工具很有用," "並能協助 IDE 完成程式碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1220 +#: ../../glossary.rst:1209 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2694,11 +2669,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1225 +#: ../../glossary.rst:1214 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1216 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2711,15 +2686,15 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`\\ ,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1232 +#: ../../glossary.rst:1221 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1234 +#: ../../glossary.rst:1223 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1236 +#: ../../glossary.rst:1225 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "" @@ -2727,7 +2702,7 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:1241 +#: ../../glossary.rst:1230 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -2737,11 +2712,11 @@ msgstr "" "\n" "::" -#: ../../glossary.rst:1247 +#: ../../glossary.rst:1236 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1238 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -2751,11 +2726,11 @@ msgstr "" "`526`\\ ,皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:" "`annotations-howto`\\ 。" -#: ../../glossary.rst:1253 +#: ../../glossary.rst:1242 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1255 +#: ../../glossary.rst:1244 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -2766,15 +2741,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1260 +#: ../../glossary.rst:1249 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`\\ 。" -#: ../../glossary.rst:1261 +#: ../../glossary.rst:1250 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1263 +#: ../../glossary.rst:1252 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -2782,11 +2757,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1265 +#: ../../glossary.rst:1254 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1267 +#: ../../glossary.rst:1256 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -2795,5 +2770,34 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" +#~ msgid "coercion" +#~ msgstr "coercion(強制轉型)" + +#~ msgid "" +#~ "The implicit conversion of an instance of one type to another during an " +#~ "operation which involves two arguments of the same type. For example, " +#~ "``int(3.15)`` converts the floating point number to the integer ``3``, " +#~ "but in ``3+4.5``, each argument is of a different type (one int, one " +#~ "float), and both must be converted to the same type before they can be " +#~ "added or it will raise a :exc:`TypeError`. Without coercion, all " +#~ "arguments of even compatible types would have to be normalized to the " +#~ "same value by the programmer, e.g., ``float(3)+4.5`` rather than just " +#~ "``3+4.5``." +#~ msgstr "" +#~ "在涉及兩個不同型別引數的操作過程中,將某一種型別的實例換為另一種型別的隱式" +#~ "轉換 (implicit conversion) 過程。例如,``int(3.15)`` 會將浮點數轉換為整數 " +#~ "``3``,但在 ``3+4.5`` 中,每個引數是不同的型別(一個 int,一個 float),而" +#~ "這兩個引數必須在被轉換為相同的型別之後才能相加,否則就會引發 :exc:" +#~ "`TypeError`\\ 。如果沒有強制轉型,即使所有的引數型別皆相容,它們都必須要由" +#~ "程式設計師正規化 (normalize) 為相同的值,例如,要用 ``float(3)+4.5`` 而不" +#~ "能只是 ``3+4.5``。" + +#~ msgid "" +#~ "Python uses the :term:`filesystem encoding and error handler` to convert " +#~ "between Unicode filenames and bytes filenames." +#~ msgstr "" +#~ "Python 使用 :term:`filesystem encoding and error handler`\\ (檔案系統編碼" +#~ "和錯誤處理函式)在 Unicode 檔案名稱和位元組檔案名稱之間進行轉換。" + #~ msgid "A codec which encodes Unicode strings to bytes." #~ msgstr "將 Unicode 字串編碼為位元組的一個編解碼器 (codec)。" diff --git a/howto/clinic.po b/howto/clinic.po index 3f250eaa54..84e7d1e542 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -619,21 +619,15 @@ msgstr "" #: ../../howto/clinic.rst:570 msgid "" -"In case you're curious, this is implemented in ``from_builtin()`` in ``Lib/" -"inspect.py``." -msgstr "" - -#: ../../howto/clinic.rst:573 -msgid "" "(In the future, this may need to get even more elaborate, to allow full " "expressions like ``CONSTANT - 1``.)" msgstr "" -#: ../../howto/clinic.rst:578 +#: ../../howto/clinic.rst:575 msgid "Renaming the C functions and variables generated by Argument Clinic" msgstr "" -#: ../../howto/clinic.rst:580 +#: ../../howto/clinic.rst:577 msgid "" "Argument Clinic automatically names the functions it generates for you. " "Occasionally this may cause a problem, if the generated name collides with " @@ -645,19 +639,19 @@ msgid "" "impl function." msgstr "" -#: ../../howto/clinic.rst:588 +#: ../../howto/clinic.rst:585 msgid "" "For example, if we wanted to rename the C function names generated for " "``pickle.Pickler.dump``, it'd look like this::" msgstr "" -#: ../../howto/clinic.rst:596 +#: ../../howto/clinic.rst:593 msgid "" "The base function would now be named ``pickler_dumper()``, and the impl " "function would now be named ``pickler_dumper_impl()``." msgstr "" -#: ../../howto/clinic.rst:600 +#: ../../howto/clinic.rst:597 msgid "" "Similarly, you may have a problem where you want to give a parameter a " "specific Python name, but that name may be inconvenient in C. Argument " @@ -665,21 +659,21 @@ msgid "" "using the same ``\"as\"`` syntax::" msgstr "" -#: ../../howto/clinic.rst:614 +#: ../../howto/clinic.rst:611 msgid "" "Here, the name used in Python (in the signature and the ``keywords`` array) " "would be ``file``, but the C variable would be named ``file_obj``." msgstr "" -#: ../../howto/clinic.rst:617 +#: ../../howto/clinic.rst:614 msgid "You can use this to rename the ``self`` parameter too!" msgstr "" -#: ../../howto/clinic.rst:621 +#: ../../howto/clinic.rst:618 msgid "Converting functions using PyArg_UnpackTuple" msgstr "" -#: ../../howto/clinic.rst:623 +#: ../../howto/clinic.rst:620 msgid "" "To convert a function parsing its arguments with :c:func:" "`PyArg_UnpackTuple`, simply write out all the arguments, specifying each as " @@ -688,17 +682,17 @@ msgid "" "a line by itself after the last argument)." msgstr "" -#: ../../howto/clinic.rst:629 +#: ../../howto/clinic.rst:626 msgid "" "Currently the generated code will use :c:func:`PyArg_ParseTuple`, but this " "will change soon." msgstr "" -#: ../../howto/clinic.rst:633 +#: ../../howto/clinic.rst:630 msgid "Optional Groups" msgstr "" -#: ../../howto/clinic.rst:635 +#: ../../howto/clinic.rst:632 msgid "" "Some legacy functions have a tricky approach to parsing their arguments: " "they count the number of positional arguments, then use a ``switch`` " @@ -709,7 +703,7 @@ msgid "" "created." msgstr "" -#: ../../howto/clinic.rst:642 +#: ../../howto/clinic.rst:639 msgid "" "While functions using this approach can often be converted to use :c:func:" "`PyArg_ParseTupleAndKeywords`, optional arguments, and default values, it's " @@ -723,7 +717,7 @@ msgid "" "pass in ``x`` you may not pass in ``y`` either.)" msgstr "" -#: ../../howto/clinic.rst:654 +#: ../../howto/clinic.rst:651 msgid "" "In any case, the goal of Argument Clinic is to support argument parsing for " "all existing CPython builtins without changing their semantics. Therefore " @@ -733,7 +727,7 @@ msgid "" "required arguments. They can *only* be used with positional-only parameters." msgstr "" -#: ../../howto/clinic.rst:662 +#: ../../howto/clinic.rst:659 msgid "" "Optional groups are *only* intended for use when converting functions that " "make multiple calls to :c:func:`PyArg_ParseTuple`! Functions that use *any* " @@ -744,7 +738,7 @@ msgid "" "possible." msgstr "" -#: ../../howto/clinic.rst:671 +#: ../../howto/clinic.rst:668 msgid "" "To specify an optional group, add a ``[`` on a line by itself before the " "parameters you wish to group together, and a ``]`` on a line by itself after " @@ -753,11 +747,11 @@ msgid "" "optional::" msgstr "" -#: ../../howto/clinic.rst:700 +#: ../../howto/clinic.rst:697 msgid "Notes:" msgstr "註解:" -#: ../../howto/clinic.rst:702 +#: ../../howto/clinic.rst:699 msgid "" "For every optional group, one additional parameter will be passed into the " "impl function representing the group. The parameter will be an int named " @@ -770,33 +764,33 @@ msgid "" "I mean whether or not the parameters received arguments in this invocation.)" msgstr "" -#: ../../howto/clinic.rst:713 +#: ../../howto/clinic.rst:710 msgid "" "If there are no required arguments, the optional groups will behave as if " "they're to the right of the required arguments." msgstr "" -#: ../../howto/clinic.rst:716 +#: ../../howto/clinic.rst:713 msgid "" "In the case of ambiguity, the argument parsing code favors parameters on the " "left (before the required parameters)." msgstr "" -#: ../../howto/clinic.rst:719 +#: ../../howto/clinic.rst:716 msgid "Optional groups can only contain positional-only parameters." msgstr "" -#: ../../howto/clinic.rst:721 +#: ../../howto/clinic.rst:718 msgid "" "Optional groups are *only* intended for legacy code. Please do not use " "optional groups for new code." msgstr "" -#: ../../howto/clinic.rst:726 +#: ../../howto/clinic.rst:723 msgid "Using real Argument Clinic converters, instead of \"legacy converters\"" msgstr "" -#: ../../howto/clinic.rst:728 +#: ../../howto/clinic.rst:725 msgid "" "To save time, and to minimize how much you need to learn to achieve your " "first port to Argument Clinic, the walkthrough above tells you to use " @@ -805,38 +799,38 @@ msgid "" "be clear, their use is acceptable when porting code for Python 3.4." msgstr "" -#: ../../howto/clinic.rst:735 +#: ../../howto/clinic.rst:732 msgid "" "However, in the long term we probably want all our blocks to use Argument " "Clinic's real syntax for converters. Why? A couple reasons:" msgstr "" -#: ../../howto/clinic.rst:739 +#: ../../howto/clinic.rst:736 msgid "" "The proper converters are far easier to read and clearer in their intent." msgstr "" -#: ../../howto/clinic.rst:740 +#: ../../howto/clinic.rst:737 msgid "" "There are some format units that are unsupported as \"legacy converters\", " "because they require arguments, and the legacy converter syntax doesn't " "support specifying arguments." msgstr "" -#: ../../howto/clinic.rst:743 +#: ../../howto/clinic.rst:740 msgid "" "In the future we may have a new argument parsing library that isn't " "restricted to what :c:func:`PyArg_ParseTuple` supports; this flexibility " "won't be available to parameters using legacy converters." msgstr "" -#: ../../howto/clinic.rst:747 +#: ../../howto/clinic.rst:744 msgid "" "Therefore, if you don't mind a little extra effort, please use the normal " "converters instead of legacy converters." msgstr "" -#: ../../howto/clinic.rst:750 +#: ../../howto/clinic.rst:747 msgid "" "In a nutshell, the syntax for Argument Clinic (non-legacy) converters looks " "like a Python function call. However, if there are no explicit arguments to " @@ -844,17 +838,17 @@ msgid "" "parentheses. Thus ``bool`` and ``bool()`` are exactly the same converters." msgstr "" -#: ../../howto/clinic.rst:756 +#: ../../howto/clinic.rst:753 msgid "" "All arguments to Argument Clinic converters are keyword-only. All Argument " "Clinic converters accept the following arguments:" msgstr "" -#: ../../howto/clinic.rst:764 ../../howto/clinic.rst:1314 +#: ../../howto/clinic.rst:761 ../../howto/clinic.rst:1311 msgid "``c_default``" msgstr "``c_default``" -#: ../../howto/clinic.rst:760 +#: ../../howto/clinic.rst:757 msgid "" "The default value for this parameter when defined in C. Specifically, this " "will be the initializer for the variable declared in the \"parse function" @@ -862,27 +856,27 @@ msgid "" "use this. Specified as a string." msgstr "" -#: ../../howto/clinic.rst:769 +#: ../../howto/clinic.rst:766 msgid "``annotation``" msgstr "``annotation``" -#: ../../howto/clinic.rst:767 +#: ../../howto/clinic.rst:764 msgid "" "The annotation value for this parameter. Not currently supported, because :" "pep:`8` mandates that the Python library may not use annotations." msgstr "" -#: ../../howto/clinic.rst:771 +#: ../../howto/clinic.rst:768 msgid "" "In addition, some converters accept additional arguments. Here is a list of " "these arguments, along with their meanings:" msgstr "" -#: ../../howto/clinic.rst:780 +#: ../../howto/clinic.rst:777 msgid "``accept``" msgstr "``accept``" -#: ../../howto/clinic.rst:775 +#: ../../howto/clinic.rst:772 msgid "" "A set of Python types (and possibly pseudo-types); this restricts the " "allowable Python argument to values of these types. (This is not a general-" @@ -890,68 +884,68 @@ msgid "" "shown in the legacy converter table.)" msgstr "" -#: ../../howto/clinic.rst:780 +#: ../../howto/clinic.rst:777 msgid "To accept ``None``, add ``NoneType`` to this set." msgstr "" -#: ../../howto/clinic.rst:785 +#: ../../howto/clinic.rst:782 msgid "``bitwise``" msgstr "``bitwise``" -#: ../../howto/clinic.rst:783 +#: ../../howto/clinic.rst:780 msgid "" "Only supported for unsigned integers. The native integer value of this " "Python argument will be written to the parameter without any range checking, " "even for negative values." msgstr "" -#: ../../howto/clinic.rst:790 ../../howto/clinic.rst:1328 +#: ../../howto/clinic.rst:787 ../../howto/clinic.rst:1325 msgid "``converter``" msgstr "``converter``" -#: ../../howto/clinic.rst:788 +#: ../../howto/clinic.rst:785 msgid "" "Only supported by the ``object`` converter. Specifies the name of a :ref:`C " "\"converter function\" ` to use to convert this object to a " "native type." msgstr "" -#: ../../howto/clinic.rst:795 +#: ../../howto/clinic.rst:792 msgid "``encoding``" msgstr "``encoding``" -#: ../../howto/clinic.rst:793 +#: ../../howto/clinic.rst:790 msgid "" "Only supported for strings. Specifies the encoding to use when converting " "this string from a Python str (Unicode) value into a C ``char *`` value." msgstr "" -#: ../../howto/clinic.rst:799 +#: ../../howto/clinic.rst:796 msgid "``subclass_of``" msgstr "``subclass_of``" -#: ../../howto/clinic.rst:798 +#: ../../howto/clinic.rst:795 msgid "" "Only supported for the ``object`` converter. Requires that the Python value " "be a subclass of a Python type, as expressed in C." msgstr "" -#: ../../howto/clinic.rst:804 ../../howto/clinic.rst:1300 +#: ../../howto/clinic.rst:801 ../../howto/clinic.rst:1297 msgid "``type``" msgstr "``type``" -#: ../../howto/clinic.rst:802 +#: ../../howto/clinic.rst:799 msgid "" "Only supported for the ``object`` and ``self`` converters. Specifies the C " "type that will be used to declare the variable. Default value is ``" "\"PyObject *\"``." msgstr "" -#: ../../howto/clinic.rst:810 +#: ../../howto/clinic.rst:807 msgid "``zeroes``" msgstr "``zeroes``" -#: ../../howto/clinic.rst:807 +#: ../../howto/clinic.rst:804 msgid "" "Only supported for strings. If true, embedded NUL bytes (``'\\\\0'``) are " "permitted inside the value. The length of the string will be passed in to " @@ -959,7 +953,7 @@ msgid "" "``_length``." msgstr "" -#: ../../howto/clinic.rst:812 +#: ../../howto/clinic.rst:809 msgid "" "Please note, not every possible combination of arguments will work. Usually " "these arguments are implemented by specific ``PyArg_ParseTuple`` *format " @@ -970,350 +964,350 @@ msgid "" "least, not yet.)" msgstr "" -#: ../../howto/clinic.rst:820 +#: ../../howto/clinic.rst:817 msgid "" "Below is a table showing the mapping of legacy converters into real Argument " "Clinic converters. On the left is the legacy converter, on the right is the " "text you'd replace it with." msgstr "" -#: ../../howto/clinic.rst:825 +#: ../../howto/clinic.rst:822 msgid "``'B'``" msgstr "``'B'``" -#: ../../howto/clinic.rst:825 +#: ../../howto/clinic.rst:822 msgid "``unsigned_char(bitwise=True)``" msgstr "``unsigned_char(bitwise=True)``" -#: ../../howto/clinic.rst:826 +#: ../../howto/clinic.rst:823 msgid "``'b'``" msgstr "``'b'``" -#: ../../howto/clinic.rst:826 +#: ../../howto/clinic.rst:823 msgid "``unsigned_char``" msgstr "``unsigned_char``" -#: ../../howto/clinic.rst:827 +#: ../../howto/clinic.rst:824 msgid "``'c'``" msgstr "``'c'``" -#: ../../howto/clinic.rst:827 +#: ../../howto/clinic.rst:824 msgid "``char``" msgstr "``char``" -#: ../../howto/clinic.rst:828 +#: ../../howto/clinic.rst:825 msgid "``'C'``" msgstr "``'C'``" -#: ../../howto/clinic.rst:828 +#: ../../howto/clinic.rst:825 msgid "``int(accept={str})``" msgstr "``int(accept={str})``" -#: ../../howto/clinic.rst:829 +#: ../../howto/clinic.rst:826 msgid "``'d'``" msgstr "``'d'``" -#: ../../howto/clinic.rst:829 +#: ../../howto/clinic.rst:826 msgid "``double``" msgstr "``double``" -#: ../../howto/clinic.rst:830 +#: ../../howto/clinic.rst:827 msgid "``'D'``" msgstr "``'D'``" -#: ../../howto/clinic.rst:830 +#: ../../howto/clinic.rst:827 msgid "``Py_complex``" msgstr "``Py_complex``" -#: ../../howto/clinic.rst:831 +#: ../../howto/clinic.rst:828 msgid "``'es'``" msgstr "``'es'``" -#: ../../howto/clinic.rst:831 +#: ../../howto/clinic.rst:828 msgid "``str(encoding='name_of_encoding')``" msgstr "``str(encoding='name_of_encoding')``" -#: ../../howto/clinic.rst:832 +#: ../../howto/clinic.rst:829 msgid "``'es#'``" msgstr "``'es#'``" -#: ../../howto/clinic.rst:832 +#: ../../howto/clinic.rst:829 msgid "``str(encoding='name_of_encoding', zeroes=True)``" msgstr "``str(encoding='name_of_encoding', zeroes=True)``" -#: ../../howto/clinic.rst:833 +#: ../../howto/clinic.rst:830 msgid "``'et'``" msgstr "``'et'``" -#: ../../howto/clinic.rst:833 +#: ../../howto/clinic.rst:830 msgid "``str(encoding='name_of_encoding', accept={bytes, bytearray, str})``" msgstr "``str(encoding='name_of_encoding', accept={bytes, bytearray, str})``" -#: ../../howto/clinic.rst:834 +#: ../../howto/clinic.rst:831 msgid "``'et#'``" msgstr "``'et#'``" -#: ../../howto/clinic.rst:834 +#: ../../howto/clinic.rst:831 msgid "" "``str(encoding='name_of_encoding', accept={bytes, bytearray, str}, " "zeroes=True)``" msgstr "" -#: ../../howto/clinic.rst:835 +#: ../../howto/clinic.rst:832 msgid "``'f'``" msgstr "``'f'``" -#: ../../howto/clinic.rst:835 +#: ../../howto/clinic.rst:832 msgid "``float``" msgstr "``float``" -#: ../../howto/clinic.rst:836 +#: ../../howto/clinic.rst:833 msgid "``'h'``" msgstr "``'h'``" -#: ../../howto/clinic.rst:836 +#: ../../howto/clinic.rst:833 msgid "``short``" msgstr "``short``" -#: ../../howto/clinic.rst:837 +#: ../../howto/clinic.rst:834 msgid "``'H'``" msgstr "``'H'``" -#: ../../howto/clinic.rst:837 +#: ../../howto/clinic.rst:834 msgid "``unsigned_short(bitwise=True)``" msgstr "``unsigned_short(bitwise=True)``" -#: ../../howto/clinic.rst:838 +#: ../../howto/clinic.rst:835 msgid "``'i'``" msgstr "``'i'``" -#: ../../howto/clinic.rst:838 +#: ../../howto/clinic.rst:835 msgid "``int``" msgstr "``int``" -#: ../../howto/clinic.rst:839 +#: ../../howto/clinic.rst:836 msgid "``'I'``" msgstr "``'I'``" -#: ../../howto/clinic.rst:839 +#: ../../howto/clinic.rst:836 msgid "``unsigned_int(bitwise=True)``" msgstr "``unsigned_int(bitwise=True)``" -#: ../../howto/clinic.rst:840 +#: ../../howto/clinic.rst:837 msgid "``'k'``" msgstr "``'k'``" -#: ../../howto/clinic.rst:840 +#: ../../howto/clinic.rst:837 msgid "``unsigned_long(bitwise=True)``" msgstr "``unsigned_long(bitwise=True)``" -#: ../../howto/clinic.rst:841 +#: ../../howto/clinic.rst:838 msgid "``'K'``" msgstr "``'K'``" -#: ../../howto/clinic.rst:841 +#: ../../howto/clinic.rst:838 msgid "``unsigned_long_long(bitwise=True)``" msgstr "``unsigned_long_long(bitwise=True)``" -#: ../../howto/clinic.rst:842 +#: ../../howto/clinic.rst:839 msgid "``'l'``" msgstr "``'l'``" -#: ../../howto/clinic.rst:842 +#: ../../howto/clinic.rst:839 msgid "``long``" msgstr "``long``" -#: ../../howto/clinic.rst:843 +#: ../../howto/clinic.rst:840 msgid "``'L'``" msgstr "``'L'``" -#: ../../howto/clinic.rst:843 +#: ../../howto/clinic.rst:840 msgid "``long long``" msgstr "``long long``" -#: ../../howto/clinic.rst:844 +#: ../../howto/clinic.rst:841 msgid "``'n'``" msgstr "``'n'``" -#: ../../howto/clinic.rst:844 +#: ../../howto/clinic.rst:841 msgid "``Py_ssize_t``" msgstr "``Py_ssize_t``" -#: ../../howto/clinic.rst:845 +#: ../../howto/clinic.rst:842 msgid "``'O'``" msgstr "``'O'``" -#: ../../howto/clinic.rst:845 +#: ../../howto/clinic.rst:842 msgid "``object``" msgstr "``object``" -#: ../../howto/clinic.rst:846 +#: ../../howto/clinic.rst:843 msgid "``'O!'``" msgstr "``'O!'``" -#: ../../howto/clinic.rst:846 +#: ../../howto/clinic.rst:843 msgid "``object(subclass_of='&PySomething_Type')``" msgstr "``object(subclass_of='&PySomething_Type')``" -#: ../../howto/clinic.rst:847 +#: ../../howto/clinic.rst:844 msgid "``'O&'``" msgstr "``'O&'``" -#: ../../howto/clinic.rst:847 +#: ../../howto/clinic.rst:844 msgid "``object(converter='name_of_c_function')``" msgstr "``object(converter='name_of_c_function')``" -#: ../../howto/clinic.rst:848 +#: ../../howto/clinic.rst:845 msgid "``'p'``" msgstr "``'p'``" -#: ../../howto/clinic.rst:848 +#: ../../howto/clinic.rst:845 msgid "``bool``" msgstr "``bool``" -#: ../../howto/clinic.rst:849 +#: ../../howto/clinic.rst:846 msgid "``'S'``" msgstr "``'S'``" -#: ../../howto/clinic.rst:849 +#: ../../howto/clinic.rst:846 msgid "``PyBytesObject``" msgstr "``PyBytesObject``" -#: ../../howto/clinic.rst:850 +#: ../../howto/clinic.rst:847 msgid "``'s'``" msgstr "``'s'``" -#: ../../howto/clinic.rst:850 +#: ../../howto/clinic.rst:847 msgid "``str``" msgstr "``str``" -#: ../../howto/clinic.rst:851 +#: ../../howto/clinic.rst:848 msgid "``'s#'``" msgstr "``'s#'``" -#: ../../howto/clinic.rst:851 +#: ../../howto/clinic.rst:848 msgid "``str(zeroes=True)``" msgstr "``str(zeroes=True)``" -#: ../../howto/clinic.rst:852 +#: ../../howto/clinic.rst:849 msgid "``'s*'``" msgstr "``'s*'``" -#: ../../howto/clinic.rst:852 +#: ../../howto/clinic.rst:849 msgid "``Py_buffer(accept={buffer, str})``" msgstr "``Py_buffer(accept={buffer, str})``" -#: ../../howto/clinic.rst:853 +#: ../../howto/clinic.rst:850 msgid "``'U'``" msgstr "``'U'``" -#: ../../howto/clinic.rst:853 +#: ../../howto/clinic.rst:850 msgid "``unicode``" msgstr "``unicode``" -#: ../../howto/clinic.rst:854 +#: ../../howto/clinic.rst:851 msgid "``'u'``" msgstr "``'u'``" -#: ../../howto/clinic.rst:854 +#: ../../howto/clinic.rst:851 msgid "``Py_UNICODE``" msgstr "``Py_UNICODE``" -#: ../../howto/clinic.rst:855 +#: ../../howto/clinic.rst:852 msgid "``'u#'``" msgstr "``'u#'``" -#: ../../howto/clinic.rst:855 +#: ../../howto/clinic.rst:852 msgid "``Py_UNICODE(zeroes=True)``" msgstr "``Py_UNICODE(zeroes=True)``" -#: ../../howto/clinic.rst:856 +#: ../../howto/clinic.rst:853 msgid "``'w*'``" msgstr "``'w*'``" -#: ../../howto/clinic.rst:856 +#: ../../howto/clinic.rst:853 msgid "``Py_buffer(accept={rwbuffer})``" msgstr "``Py_buffer(accept={rwbuffer})``" -#: ../../howto/clinic.rst:857 +#: ../../howto/clinic.rst:854 msgid "``'Y'``" msgstr "``'Y'``" -#: ../../howto/clinic.rst:857 +#: ../../howto/clinic.rst:854 msgid "``PyByteArrayObject``" msgstr "``PyByteArrayObject``" -#: ../../howto/clinic.rst:858 +#: ../../howto/clinic.rst:855 msgid "``'y'``" msgstr "``'y'``" -#: ../../howto/clinic.rst:858 +#: ../../howto/clinic.rst:855 msgid "``str(accept={bytes})``" msgstr "``str(accept={bytes})``" -#: ../../howto/clinic.rst:859 +#: ../../howto/clinic.rst:856 msgid "``'y#'``" msgstr "``'y#'``" -#: ../../howto/clinic.rst:859 +#: ../../howto/clinic.rst:856 msgid "``str(accept={robuffer}, zeroes=True)``" msgstr "``str(accept={robuffer}, zeroes=True)``" -#: ../../howto/clinic.rst:860 +#: ../../howto/clinic.rst:857 msgid "``'y*'``" msgstr "``'y*'``" -#: ../../howto/clinic.rst:860 +#: ../../howto/clinic.rst:857 msgid "``Py_buffer``" msgstr "``Py_buffer``" -#: ../../howto/clinic.rst:861 +#: ../../howto/clinic.rst:858 msgid "``'Z'``" msgstr "``'Z'``" -#: ../../howto/clinic.rst:861 +#: ../../howto/clinic.rst:858 msgid "``Py_UNICODE(accept={str, NoneType})``" msgstr "``Py_UNICODE(accept={str, NoneType})``" -#: ../../howto/clinic.rst:862 +#: ../../howto/clinic.rst:859 msgid "``'Z#'``" msgstr "``'Z#'``" -#: ../../howto/clinic.rst:862 +#: ../../howto/clinic.rst:859 msgid "``Py_UNICODE(accept={str, NoneType}, zeroes=True)``" msgstr "``Py_UNICODE(accept={str, NoneType}, zeroes=True)``" -#: ../../howto/clinic.rst:863 +#: ../../howto/clinic.rst:860 msgid "``'z'``" msgstr "``'z'``" -#: ../../howto/clinic.rst:863 +#: ../../howto/clinic.rst:860 msgid "``str(accept={str, NoneType})``" msgstr "``str(accept={str, NoneType})``" -#: ../../howto/clinic.rst:864 +#: ../../howto/clinic.rst:861 msgid "``'z#'``" msgstr "``'z#'``" -#: ../../howto/clinic.rst:864 +#: ../../howto/clinic.rst:861 msgid "``str(accept={str, NoneType}, zeroes=True)``" msgstr "``str(accept={str, NoneType}, zeroes=True)``" -#: ../../howto/clinic.rst:865 +#: ../../howto/clinic.rst:862 msgid "``'z*'``" msgstr "``'z*'``" -#: ../../howto/clinic.rst:865 +#: ../../howto/clinic.rst:862 msgid "``Py_buffer(accept={buffer, str, NoneType})``" msgstr "``Py_buffer(accept={buffer, str, NoneType})``" -#: ../../howto/clinic.rst:868 +#: ../../howto/clinic.rst:865 msgid "" "As an example, here's our sample ``pickle.Pickler.dump`` using the proper " "converter::" msgstr "" -#: ../../howto/clinic.rst:881 +#: ../../howto/clinic.rst:878 msgid "" "One advantage of real converters is that they're more flexible than legacy " "converters. For example, the ``unsigned_int`` converter (and all the " @@ -1322,7 +1316,7 @@ msgid "" "negative numbers. You just can't do that with a legacy converter!" msgstr "" -#: ../../howto/clinic.rst:887 +#: ../../howto/clinic.rst:884 msgid "" "Argument Clinic will show you all the converters it has available. For each " "converter it'll show you all the parameters it accepts, along with the " @@ -1330,11 +1324,11 @@ msgid "" "converters`` to see the full list." msgstr "" -#: ../../howto/clinic.rst:893 +#: ../../howto/clinic.rst:890 msgid "Py_buffer" msgstr "Py_buffer" -#: ../../howto/clinic.rst:895 +#: ../../howto/clinic.rst:892 msgid "" "When using the ``Py_buffer`` converter (or the ``'s*'``, ``'w*'``, ``'*y'``, " "or ``'z*'`` legacy converters), you *must* not call :c:func:" @@ -1342,17 +1336,17 @@ msgid "" "that does it for you (in the parsing function)." msgstr "" -#: ../../howto/clinic.rst:903 +#: ../../howto/clinic.rst:900 msgid "Advanced converters" msgstr "" -#: ../../howto/clinic.rst:905 +#: ../../howto/clinic.rst:902 msgid "" "Remember those format units you skipped for your first time because they " "were advanced? Here's how to handle those too." msgstr "" -#: ../../howto/clinic.rst:908 +#: ../../howto/clinic.rst:905 msgid "" "The trick is, all those format units take arguments—either conversion " "functions, or types, or strings specifying an encoding. (But \"legacy " @@ -1363,7 +1357,7 @@ msgid "" "units that start with ``e``)." msgstr "" -#: ../../howto/clinic.rst:916 +#: ../../howto/clinic.rst:913 msgid "" "When using ``subclass_of``, you may also want to use the other custom " "argument for ``object()``: ``type``, which lets you set the type actually " @@ -1372,7 +1366,7 @@ msgid "" "``object(type='PyUnicodeObject *', subclass_of='&PyUnicode_Type')``." msgstr "" -#: ../../howto/clinic.rst:922 +#: ../../howto/clinic.rst:919 msgid "" "One possible problem with using Argument Clinic: it takes away some possible " "flexibility for the format units starting with ``e``. When writing a " @@ -1385,31 +1379,31 @@ msgid "" "strings for parameters whose format units start with ``e``." msgstr "" -#: ../../howto/clinic.rst:935 +#: ../../howto/clinic.rst:932 msgid "Parameter default values" msgstr "" -#: ../../howto/clinic.rst:937 +#: ../../howto/clinic.rst:934 msgid "" "Default values for parameters can be any of a number of values. At their " "simplest, they can be string, int, or float literals:" msgstr "" -#: ../../howto/clinic.rst:946 +#: ../../howto/clinic.rst:943 msgid "They can also use any of Python's built-in constants:" msgstr "" -#: ../../howto/clinic.rst:954 +#: ../../howto/clinic.rst:951 msgid "" "There's also special support for a default value of ``NULL``, and for simple " "expressions, documented in the following sections." msgstr "" -#: ../../howto/clinic.rst:959 +#: ../../howto/clinic.rst:956 msgid "The ``NULL`` default value" msgstr "" -#: ../../howto/clinic.rst:961 +#: ../../howto/clinic.rst:958 msgid "" "For string and object parameters, you can set them to ``None`` to indicate " "that there's no default. However, that means the C variable will be " @@ -1419,11 +1413,11 @@ msgid "" "with ``NULL``." msgstr "" -#: ../../howto/clinic.rst:969 +#: ../../howto/clinic.rst:966 msgid "Expressions specified as default values" msgstr "" -#: ../../howto/clinic.rst:971 +#: ../../howto/clinic.rst:968 msgid "" "The default value for a parameter can be more than just a literal value. It " "can be an entire expression, using math operators and looking up attributes " @@ -1431,11 +1425,11 @@ msgid "" "obvious semantics." msgstr "" -#: ../../howto/clinic.rst:976 +#: ../../howto/clinic.rst:973 msgid "Consider the following example:" msgstr "" -#: ../../howto/clinic.rst:982 +#: ../../howto/clinic.rst:979 msgid "" "``sys.maxsize`` can have different values on different platforms. Therefore " "Argument Clinic can't simply evaluate that expression locally and hard-code " @@ -1443,14 +1437,14 @@ msgid "" "at runtime, when the user asks for the function's signature." msgstr "" -#: ../../howto/clinic.rst:987 +#: ../../howto/clinic.rst:984 msgid "" "What namespace is available when the expression is evaluated? It's " "evaluated in the context of the module the builtin came from. So, if your " "module has an attribute called \"``max_widgets``\", you may simply use it:" msgstr "" -#: ../../howto/clinic.rst:995 +#: ../../howto/clinic.rst:992 msgid "" "If the symbol isn't found in the current module, it fails over to looking in " "``sys.modules``. That's how it can find ``sys.maxsize`` for example. " @@ -1459,7 +1453,7 @@ msgid "" "Python itself.)" msgstr "" -#: ../../howto/clinic.rst:1000 +#: ../../howto/clinic.rst:997 msgid "" "Evaluating default values only at runtime means Argument Clinic can't " "compute the correct equivalent C default value. So you need to tell it " @@ -1467,7 +1461,7 @@ msgid "" "expression in C, using the ``c_default`` parameter to the converter:" msgstr "" -#: ../../howto/clinic.rst:1009 +#: ../../howto/clinic.rst:1006 msgid "" "Another complication: Argument Clinic can't know in advance whether or not " "the expression you supply is valid. It parses it to make sure it looks " @@ -1475,38 +1469,38 @@ msgid "" "expressions to specify values that are guaranteed to be valid at runtime!" msgstr "" -#: ../../howto/clinic.rst:1014 +#: ../../howto/clinic.rst:1011 msgid "" "Finally, because expressions must be representable as static C values, there " "are many restrictions on legal expressions. Here's a list of Python " "features you're not permitted to use:" msgstr "" -#: ../../howto/clinic.rst:1018 +#: ../../howto/clinic.rst:1015 msgid "Function calls." msgstr "" -#: ../../howto/clinic.rst:1019 +#: ../../howto/clinic.rst:1016 msgid "Inline if statements (``3 if foo else 5``)." msgstr "" -#: ../../howto/clinic.rst:1020 +#: ../../howto/clinic.rst:1017 msgid "Automatic sequence unpacking (``*[1, 2, 3]``)." msgstr "" -#: ../../howto/clinic.rst:1021 +#: ../../howto/clinic.rst:1018 msgid "List/set/dict comprehensions and generator expressions." msgstr "" -#: ../../howto/clinic.rst:1022 +#: ../../howto/clinic.rst:1019 msgid "Tuple/list/set/dict literals." msgstr "" -#: ../../howto/clinic.rst:1027 +#: ../../howto/clinic.rst:1024 msgid "Using a return converter" msgstr "" -#: ../../howto/clinic.rst:1029 +#: ../../howto/clinic.rst:1026 msgid "" "By default the impl function Argument Clinic generates for you returns " "``PyObject *``. But your C function often computes some C type, then " @@ -1516,14 +1510,14 @@ msgid "" "too?" msgstr "" -#: ../../howto/clinic.rst:1035 +#: ../../howto/clinic.rst:1032 msgid "" "That's what a \"return converter\" does. It changes your impl function to " "return some C type, then adds code to the generated (non-impl) function to " "handle converting that value into the appropriate ``PyObject *``." msgstr "" -#: ../../howto/clinic.rst:1039 +#: ../../howto/clinic.rst:1036 msgid "" "The syntax for return converters is similar to that of parameter converters. " "You specify the return converter like it was a return annotation on the " @@ -1533,13 +1527,13 @@ msgid "" "parentheses." msgstr "" -#: ../../howto/clinic.rst:1045 +#: ../../howto/clinic.rst:1042 msgid "" "(If you use both ``\"as\"`` *and* a return converter for your function, the " "``\"as\"`` should come before the return converter.)" msgstr "" -#: ../../howto/clinic.rst:1048 +#: ../../howto/clinic.rst:1045 msgid "" "There's one additional complication when using return converters: how do you " "indicate an error has occurred? Normally, a function returns a valid (non-" @@ -1552,18 +1546,18 @@ msgid "" "you return like normal." msgstr "" -#: ../../howto/clinic.rst:1057 +#: ../../howto/clinic.rst:1054 msgid "Currently Argument Clinic supports only a few return converters:" msgstr "" -#: ../../howto/clinic.rst:1072 +#: ../../howto/clinic.rst:1069 msgid "" "None of these take parameters. For the first three, return -1 to indicate " "error. For ``DecodeFSDefault``, the return type is ``const char *``; return " "a ``NULL`` pointer to indicate an error." msgstr "" -#: ../../howto/clinic.rst:1076 +#: ../../howto/clinic.rst:1073 msgid "" "(There's also an experimental ``NoneType`` converter, which lets you return " "``Py_None`` on success or ``NULL`` on failure, without having to increment " @@ -1571,117 +1565,117 @@ msgid "" "be worth using.)" msgstr "" -#: ../../howto/clinic.rst:1081 +#: ../../howto/clinic.rst:1078 msgid "" "To see all the return converters Argument Clinic supports, along with their " "parameters (if any), just run ``Tools/clinic/clinic.py --converters`` for " "the full list." msgstr "" -#: ../../howto/clinic.rst:1087 +#: ../../howto/clinic.rst:1084 msgid "Cloning existing functions" msgstr "" -#: ../../howto/clinic.rst:1089 +#: ../../howto/clinic.rst:1086 msgid "" "If you have a number of functions that look similar, you may be able to use " "Clinic's \"clone\" feature. When you clone an existing function, you reuse:" msgstr "" -#: ../../howto/clinic.rst:1093 +#: ../../howto/clinic.rst:1090 msgid "its parameters, including" msgstr "" -#: ../../howto/clinic.rst:1095 +#: ../../howto/clinic.rst:1092 msgid "their names," msgstr "" -#: ../../howto/clinic.rst:1097 +#: ../../howto/clinic.rst:1094 msgid "their converters, with all parameters," msgstr "" -#: ../../howto/clinic.rst:1099 +#: ../../howto/clinic.rst:1096 msgid "their default values," msgstr "" -#: ../../howto/clinic.rst:1101 +#: ../../howto/clinic.rst:1098 msgid "their per-parameter docstrings," msgstr "" -#: ../../howto/clinic.rst:1103 +#: ../../howto/clinic.rst:1100 msgid "" "their *kind* (whether they're positional only, positional or keyword, or " "keyword only), and" msgstr "" -#: ../../howto/clinic.rst:1106 +#: ../../howto/clinic.rst:1103 msgid "its return converter." msgstr "" -#: ../../howto/clinic.rst:1108 +#: ../../howto/clinic.rst:1105 msgid "" "The only thing not copied from the original function is its docstring; the " "syntax allows you to specify a new docstring." msgstr "" -#: ../../howto/clinic.rst:1111 +#: ../../howto/clinic.rst:1108 msgid "Here's the syntax for cloning a function::" msgstr "" -#: ../../howto/clinic.rst:1119 +#: ../../howto/clinic.rst:1116 msgid "" "(The functions can be in different modules or classes. I wrote ``module." "class`` in the sample just to illustrate that you must use the full path to " "*both* functions.)" msgstr "" -#: ../../howto/clinic.rst:1123 +#: ../../howto/clinic.rst:1120 msgid "" "Sorry, there's no syntax for partially cloning a function, or cloning a " "function then modifying it. Cloning is an all-or nothing proposition." msgstr "" -#: ../../howto/clinic.rst:1126 +#: ../../howto/clinic.rst:1123 msgid "" "Also, the function you are cloning from must have been previously defined in " "the current file." msgstr "" -#: ../../howto/clinic.rst:1130 +#: ../../howto/clinic.rst:1127 msgid "Calling Python code" msgstr "" -#: ../../howto/clinic.rst:1132 +#: ../../howto/clinic.rst:1129 msgid "" "The rest of the advanced topics require you to write Python code which lives " "inside your C file and modifies Argument Clinic's runtime state. This is " "simple: you simply define a Python block." msgstr "" -#: ../../howto/clinic.rst:1136 +#: ../../howto/clinic.rst:1133 msgid "" "A Python block uses different delimiter lines than an Argument Clinic " "function block. It looks like this::" msgstr "" -#: ../../howto/clinic.rst:1143 +#: ../../howto/clinic.rst:1140 msgid "" "All the code inside the Python block is executed at the time it's parsed. " "All text written to stdout inside the block is redirected into the \"output" "\" after the block." msgstr "" -#: ../../howto/clinic.rst:1147 +#: ../../howto/clinic.rst:1144 msgid "" "As an example, here's a Python block that adds a static integer variable to " "the C code::" msgstr "" -#: ../../howto/clinic.rst:1158 +#: ../../howto/clinic.rst:1155 msgid "Using a \"self converter\"" msgstr "" -#: ../../howto/clinic.rst:1160 +#: ../../howto/clinic.rst:1157 msgid "" "Argument Clinic automatically adds a \"self\" parameter for you using a " "default converter. It automatically sets the ``type`` of this parameter to " @@ -1692,13 +1686,13 @@ msgid "" "a subclass thereof." msgstr "" -#: ../../howto/clinic.rst:1169 +#: ../../howto/clinic.rst:1166 msgid "" "What's the point? This lets you override the type of ``self``, or give it a " "different default name." msgstr "" -#: ../../howto/clinic.rst:1172 +#: ../../howto/clinic.rst:1169 msgid "" "How do you specify the custom type you want to cast ``self`` to? If you only " "have one or two functions with the same type for ``self``, you can directly " @@ -1706,18 +1700,18 @@ msgid "" "want to use as the ``type`` parameter::" msgstr "" -#: ../../howto/clinic.rst:1188 +#: ../../howto/clinic.rst:1185 msgid "" "On the other hand, if you have a lot of functions that will use the same " "type for ``self``, it's best to create your own converter, subclassing " "``self_converter`` but overwriting the ``type`` member::" msgstr "" -#: ../../howto/clinic.rst:1210 +#: ../../howto/clinic.rst:1207 msgid "Using a \"defining class\" converter" msgstr "" -#: ../../howto/clinic.rst:1212 +#: ../../howto/clinic.rst:1209 msgid "" "Argument Clinic facilitates gaining access to the defining class of a " "method. This is useful for :ref:`heap type ` methods that need " @@ -1727,25 +1721,25 @@ msgid "" "example from a module method." msgstr "" -#: ../../howto/clinic.rst:1218 +#: ../../howto/clinic.rst:1215 msgid "" "Example from ``Modules/zlibmodule.c``. First, ``defining_class`` is added " "to the clinic input::" msgstr "" -#: ../../howto/clinic.rst:1230 +#: ../../howto/clinic.rst:1227 msgid "" "After running the Argument Clinic tool, the following function signature is " "generated::" msgstr "" -#: ../../howto/clinic.rst:1240 +#: ../../howto/clinic.rst:1237 msgid "" "The following code can now use ``PyType_GetModuleState(cls)`` to fetch the " "module state::" msgstr "" -#: ../../howto/clinic.rst:1246 +#: ../../howto/clinic.rst:1243 msgid "" "Each method may only have one argument using this converter, and it must " "appear after ``self``, or, if ``self`` is not used, as the first argument. " @@ -1753,30 +1747,30 @@ msgid "" "appear in the ``__text_signature__``." msgstr "" -#: ../../howto/clinic.rst:1251 +#: ../../howto/clinic.rst:1248 msgid "" "The ``defining_class`` converter is not compatible with ``__init__`` and " "``__new__`` methods, which cannot use the ``METH_METHOD`` convention." msgstr "" -#: ../../howto/clinic.rst:1254 +#: ../../howto/clinic.rst:1251 msgid "" "It is not possible to use ``defining_class`` with slot methods. In order to " -"fetch the module state from such methods, use ``_PyType_GetModuleByDef`` to " -"look up the module and then :c:func:`PyModule_GetState` to fetch the module " -"state. Example from the ``setattro`` slot method in ``Modules/_threadmodule." -"c``::" +"fetch the module state from such methods, use :c:func:" +"`PyType_GetModuleByDef` to look up the module and then :c:func:" +"`PyModule_GetState` to fetch the module state. Example from the " +"``setattro`` slot method in ``Modules/_threadmodule.c``::" msgstr "" -#: ../../howto/clinic.rst:1269 +#: ../../howto/clinic.rst:1266 msgid "See also :pep:`573`." msgstr "也請見 :pep:`573`\\ 。" -#: ../../howto/clinic.rst:1273 +#: ../../howto/clinic.rst:1270 msgid "Writing a custom converter" msgstr "" -#: ../../howto/clinic.rst:1275 +#: ../../howto/clinic.rst:1272 msgid "" "As we hinted at in the previous section... you can write your own " "converters! A converter is simply a Python class that inherits from " @@ -1785,7 +1779,7 @@ msgid "" "a :c:func:`PyArg_ParseTuple` \"converter function\"." msgstr "" -#: ../../howto/clinic.rst:1281 +#: ../../howto/clinic.rst:1278 msgid "" "Your converter class should be named ``*something*_converter``. If the name " "follows this convention, then your converter class will be automatically " @@ -1794,7 +1788,7 @@ msgid "" "metaclass.)" msgstr "" -#: ../../howto/clinic.rst:1287 +#: ../../howto/clinic.rst:1284 msgid "" "You shouldn't subclass ``CConverter.__init__``. Instead, you should write a " "``converter_init()`` function. ``converter_init()`` always accepts a " @@ -1803,50 +1797,50 @@ msgid "" "passed along to your ``converter_init()``." msgstr "" -#: ../../howto/clinic.rst:1294 +#: ../../howto/clinic.rst:1291 msgid "" "There are some additional members of ``CConverter`` you may wish to specify " "in your subclass. Here's the current list:" msgstr "" -#: ../../howto/clinic.rst:1298 +#: ../../howto/clinic.rst:1295 msgid "" "The C type to use for this variable. ``type`` should be a Python string " "specifying the type, e.g. ``int``. If this is a pointer type, the type " "string should end with ``' *'``." msgstr "" -#: ../../howto/clinic.rst:1304 +#: ../../howto/clinic.rst:1301 msgid "``default``" msgstr "``default``" -#: ../../howto/clinic.rst:1303 +#: ../../howto/clinic.rst:1300 msgid "" "The Python default value for this parameter, as a Python value. Or the magic " "value ``unspecified`` if there is no default." msgstr "" -#: ../../howto/clinic.rst:1309 +#: ../../howto/clinic.rst:1306 msgid "``py_default``" msgstr "``py_default``" -#: ../../howto/clinic.rst:1307 +#: ../../howto/clinic.rst:1304 msgid "" "``default`` as it should appear in Python code, as a string. Or ``None`` if " "there is no default." msgstr "" -#: ../../howto/clinic.rst:1312 +#: ../../howto/clinic.rst:1309 msgid "" "``default`` as it should appear in C code, as a string. Or ``None`` if there " "is no default." msgstr "" -#: ../../howto/clinic.rst:1325 +#: ../../howto/clinic.rst:1322 msgid "``c_ignored_default``" msgstr "``c_ignored_default``" -#: ../../howto/clinic.rst:1317 +#: ../../howto/clinic.rst:1314 msgid "" "The default value used to initialize the C variable when there is no " "default, but not specifying a default may result in an \"uninitialized " @@ -1857,37 +1851,37 @@ msgid "" "non-empty string." msgstr "" -#: ../../howto/clinic.rst:1328 +#: ../../howto/clinic.rst:1325 msgid "The name of the C converter function, as a string." msgstr "" -#: ../../howto/clinic.rst:1333 +#: ../../howto/clinic.rst:1330 msgid "``impl_by_reference``" msgstr "``impl_by_reference``" -#: ../../howto/clinic.rst:1331 +#: ../../howto/clinic.rst:1328 msgid "" "A boolean value. If true, Argument Clinic will add a ``&`` in front of the " "name of the variable when passing it into the impl function." msgstr "" -#: ../../howto/clinic.rst:1339 +#: ../../howto/clinic.rst:1336 msgid "``parse_by_reference``" msgstr "``parse_by_reference``" -#: ../../howto/clinic.rst:1336 +#: ../../howto/clinic.rst:1333 msgid "" "A boolean value. If true, Argument Clinic will add a ``&`` in front of the " "name of the variable when passing it into :c:func:`PyArg_ParseTuple`." msgstr "" -#: ../../howto/clinic.rst:1341 +#: ../../howto/clinic.rst:1338 msgid "" "Here's the simplest example of a custom converter, from ``Modules/zlibmodule." "c``::" msgstr "" -#: ../../howto/clinic.rst:1352 +#: ../../howto/clinic.rst:1349 msgid "" "This block adds a converter to Argument Clinic named ``ssize_t``. " "Parameters declared as ``ssize_t`` will be declared as type :c:type:" @@ -1896,25 +1890,25 @@ msgid "" "automatically support default values." msgstr "" -#: ../../howto/clinic.rst:1358 +#: ../../howto/clinic.rst:1355 msgid "" "More sophisticated custom converters can insert custom C code to handle " "initialization and cleanup. You can see more examples of custom converters " "in the CPython source tree; grep the C files for the string ``CConverter``." msgstr "" -#: ../../howto/clinic.rst:1364 +#: ../../howto/clinic.rst:1361 msgid "Writing a custom return converter" msgstr "" -#: ../../howto/clinic.rst:1366 +#: ../../howto/clinic.rst:1363 msgid "" "Writing a custom return converter is much like writing a custom converter. " "Except it's somewhat simpler, because return converters are themselves much " "simpler." msgstr "" -#: ../../howto/clinic.rst:1370 +#: ../../howto/clinic.rst:1367 msgid "" "Return converters must subclass ``CReturnConverter``. There are no examples " "yet of custom return converters, because they are not widely used yet. If " @@ -1923,59 +1917,59 @@ msgid "" "its subclasses." msgstr "" -#: ../../howto/clinic.rst:1378 +#: ../../howto/clinic.rst:1375 msgid "METH_O and METH_NOARGS" msgstr "" -#: ../../howto/clinic.rst:1380 +#: ../../howto/clinic.rst:1377 msgid "" "To convert a function using ``METH_O``, make sure the function's single " "argument is using the ``object`` converter, and mark the arguments as " "positional-only::" msgstr "" -#: ../../howto/clinic.rst:1392 +#: ../../howto/clinic.rst:1389 msgid "" "To convert a function using ``METH_NOARGS``, just don't specify any " "arguments." msgstr "" -#: ../../howto/clinic.rst:1395 +#: ../../howto/clinic.rst:1392 msgid "" "You can still use a self converter, a return converter, and specify a " "``type`` argument to the object converter for ``METH_O``." msgstr "" -#: ../../howto/clinic.rst:1399 +#: ../../howto/clinic.rst:1396 msgid "tp_new and tp_init functions" msgstr "" -#: ../../howto/clinic.rst:1401 +#: ../../howto/clinic.rst:1398 msgid "" "You can convert ``tp_new`` and ``tp_init`` functions. Just name them " "``__new__`` or ``__init__`` as appropriate. Notes:" msgstr "" -#: ../../howto/clinic.rst:1404 +#: ../../howto/clinic.rst:1401 msgid "" "The function name generated for ``__new__`` doesn't end in ``__new__`` like " "it would by default. It's just the name of the class, converted into a " "valid C identifier." msgstr "" -#: ../../howto/clinic.rst:1408 +#: ../../howto/clinic.rst:1405 msgid "No ``PyMethodDef`` ``#define`` is generated for these functions." msgstr "" -#: ../../howto/clinic.rst:1410 +#: ../../howto/clinic.rst:1407 msgid "``__init__`` functions return ``int``, not ``PyObject *``." msgstr "" -#: ../../howto/clinic.rst:1412 +#: ../../howto/clinic.rst:1409 msgid "Use the docstring as the class docstring." msgstr "" -#: ../../howto/clinic.rst:1414 +#: ../../howto/clinic.rst:1411 msgid "" "Although ``__new__`` and ``__init__`` functions must always accept both the " "``args`` and ``kwargs`` objects, when converting you may specify any " @@ -1984,11 +1978,11 @@ msgid "" "it receives any.)" msgstr "" -#: ../../howto/clinic.rst:1421 +#: ../../howto/clinic.rst:1418 msgid "Changing and redirecting Clinic's output" msgstr "" -#: ../../howto/clinic.rst:1423 +#: ../../howto/clinic.rst:1420 msgid "" "It can be inconvenient to have Clinic's output interspersed with your " "conventional hand-edited C code. Luckily, Clinic is configurable: you can " @@ -1997,7 +1991,7 @@ msgid "" "Clinic's generated output." msgstr "" -#: ../../howto/clinic.rst:1429 +#: ../../howto/clinic.rst:1426 msgid "" "While changing Clinic's output in this manner can be a boon to readability, " "it may result in Clinic code using types before they are defined, or your " @@ -2009,15 +2003,15 @@ msgid "" "rearranging your code to fix definition-before-use problems.)" msgstr "" -#: ../../howto/clinic.rst:1438 +#: ../../howto/clinic.rst:1435 msgid "Let's start with defining some terminology:" msgstr "" -#: ../../howto/clinic.rst:1465 +#: ../../howto/clinic.rst:1462 msgid "*field*" msgstr "" -#: ../../howto/clinic.rst:1441 +#: ../../howto/clinic.rst:1438 msgid "" "A field, in this context, is a subsection of Clinic's output. For example, " "the ``#define`` for the ``PyMethodDef`` structure is a field, called " @@ -2025,7 +2019,7 @@ msgid "" "function definition:" msgstr "" -#: ../../howto/clinic.rst:1456 +#: ../../howto/clinic.rst:1453 msgid "" "All the names are of the form ``\"_\"``, where ``\"\"`` is the " "semantic object represented (the parsing function, the impl function, the " @@ -2038,45 +2032,45 @@ msgid "" "\"``, representing that it's a preprocessor #define.)" msgstr "" -#: ../../howto/clinic.rst:1499 +#: ../../howto/clinic.rst:1496 msgid "*destination*" msgstr "" -#: ../../howto/clinic.rst:1468 +#: ../../howto/clinic.rst:1465 msgid "" "A destination is a place Clinic can write output to. There are five built-" "in destinations:" msgstr "" -#: ../../howto/clinic.rst:1473 ../../howto/clinic.rst:1548 -#: ../../howto/clinic.rst:1626 +#: ../../howto/clinic.rst:1470 ../../howto/clinic.rst:1545 +#: ../../howto/clinic.rst:1623 msgid "``block``" msgstr "``block``" -#: ../../howto/clinic.rst:1472 +#: ../../howto/clinic.rst:1469 msgid "" "The default destination: printed in the output section of the current Clinic " "block." msgstr "" -#: ../../howto/clinic.rst:1479 ../../howto/clinic.rst:1575 -#: ../../howto/clinic.rst:1629 +#: ../../howto/clinic.rst:1476 ../../howto/clinic.rst:1572 +#: ../../howto/clinic.rst:1626 msgid "``buffer``" msgstr "``buffer``" -#: ../../howto/clinic.rst:1476 +#: ../../howto/clinic.rst:1473 msgid "" "A text buffer where you can save text for later. Text sent here is appended " "to the end of any existing text. It's an error to have any text left in the " "buffer when Clinic finishes processing a file." msgstr "" -#: ../../howto/clinic.rst:1490 ../../howto/clinic.rst:1561 -#: ../../howto/clinic.rst:1655 +#: ../../howto/clinic.rst:1487 ../../howto/clinic.rst:1558 +#: ../../howto/clinic.rst:1652 msgid "``file``" msgstr "``file``" -#: ../../howto/clinic.rst:1482 +#: ../../howto/clinic.rst:1479 msgid "" "A separate \"clinic file\" that will be created automatically by Clinic. The " "filename chosen for the file is ``{basename}.clinic{extension}``, where " @@ -2085,65 +2079,65 @@ msgid "" "for ``_pickle.c`` would be written to ``_pickle.clinic.c``.)" msgstr "" -#: ../../howto/clinic.rst:1489 +#: ../../howto/clinic.rst:1486 msgid "" "**Important: When using a** ``file`` **destination, you** *must check in* " "**the generated file!**" msgstr "" -#: ../../howto/clinic.rst:1495 ../../howto/clinic.rst:1588 -#: ../../howto/clinic.rst:1659 +#: ../../howto/clinic.rst:1492 ../../howto/clinic.rst:1585 +#: ../../howto/clinic.rst:1656 msgid "``two-pass``" msgstr "``two-pass``" -#: ../../howto/clinic.rst:1493 +#: ../../howto/clinic.rst:1490 msgid "" "A buffer like ``buffer``. However, a two-pass buffer can only be dumped " "once, and it prints out all text sent to it during all processing, even from " "Clinic blocks *after* the dumping point." msgstr "" -#: ../../howto/clinic.rst:1499 ../../howto/clinic.rst:1622 +#: ../../howto/clinic.rst:1496 ../../howto/clinic.rst:1619 msgid "``suppress``" msgstr "``suppress``" -#: ../../howto/clinic.rst:1498 +#: ../../howto/clinic.rst:1495 msgid "The text is suppressed—thrown away." msgstr "" -#: ../../howto/clinic.rst:1501 +#: ../../howto/clinic.rst:1498 msgid "Clinic defines five new directives that let you reconfigure its output." msgstr "" -#: ../../howto/clinic.rst:1503 +#: ../../howto/clinic.rst:1500 msgid "The first new directive is ``dump``:" msgstr "" -#: ../../howto/clinic.rst:1509 +#: ../../howto/clinic.rst:1506 msgid "" "This dumps the current contents of the named destination into the output of " "the current block, and empties it. This only works with ``buffer`` and " "``two-pass`` destinations." msgstr "" -#: ../../howto/clinic.rst:1513 +#: ../../howto/clinic.rst:1510 msgid "" "The second new directive is ``output``. The most basic form of ``output`` " "is like this:" msgstr "" -#: ../../howto/clinic.rst:1520 +#: ../../howto/clinic.rst:1517 msgid "" "This tells Clinic to output *field* to *destination*. ``output`` also " "supports a special meta-destination, called ``everything``, which tells " "Clinic to output *all* fields to that *destination*." msgstr "" -#: ../../howto/clinic.rst:1524 +#: ../../howto/clinic.rst:1521 msgid "``output`` has a number of other functions:" msgstr "" -#: ../../howto/clinic.rst:1533 +#: ../../howto/clinic.rst:1530 msgid "" "``output push`` and ``output pop`` allow you to push and pop configurations " "on an internal configuration stack, so that you can temporarily modify the " @@ -2152,25 +2146,25 @@ msgid "" "when you wish to restore the previous configuration." msgstr "" -#: ../../howto/clinic.rst:1540 +#: ../../howto/clinic.rst:1537 msgid "" "``output preset`` sets Clinic's output to one of several built-in preset " "configurations, as follows:" msgstr "" -#: ../../howto/clinic.rst:1544 +#: ../../howto/clinic.rst:1541 msgid "" "Clinic's original starting configuration. Writes everything immediately " "after the input block." msgstr "" -#: ../../howto/clinic.rst:1547 +#: ../../howto/clinic.rst:1544 msgid "" "Suppress the ``parser_prototype`` and ``docstring_prototype``, write " "everything else to ``block``." msgstr "" -#: ../../howto/clinic.rst:1551 +#: ../../howto/clinic.rst:1548 msgid "" "Designed to write everything to the \"clinic file\" that it can. You then " "``#include`` this file near the top of your file. You may need to rearrange " @@ -2178,17 +2172,17 @@ msgid "" "declarations for various ``typedef`` and ``PyTypeObject`` definitions." msgstr "" -#: ../../howto/clinic.rst:1557 +#: ../../howto/clinic.rst:1554 msgid "" "Suppress the ``parser_prototype`` and ``docstring_prototype``, write the " "``impl_definition`` to ``block``, and write everything else to ``file``." msgstr "" -#: ../../howto/clinic.rst:1561 +#: ../../howto/clinic.rst:1558 msgid "The default filename is ``\"{dirname}/clinic/{basename}.h\"``." msgstr "" -#: ../../howto/clinic.rst:1564 +#: ../../howto/clinic.rst:1561 msgid "" "Save up most of the output from Clinic, to be written into your file near " "the end. For Python files implementing modules or builtin types, it's " @@ -2198,14 +2192,14 @@ msgid "" "static ``PyMethodDef`` arrays defined in the middle of the file." msgstr "" -#: ../../howto/clinic.rst:1573 +#: ../../howto/clinic.rst:1570 msgid "" "Suppress the ``parser_prototype``, ``impl_prototype``, and " "``docstring_prototype``, write the ``impl_definition`` to ``block``, and " "write everything else to ``file``." msgstr "" -#: ../../howto/clinic.rst:1578 +#: ../../howto/clinic.rst:1575 msgid "" "Similar to the ``buffer`` preset, but writes forward declarations to the " "``two-pass`` buffer, and definitions to the ``buffer``. This is similar to " @@ -2214,18 +2208,18 @@ msgid "" "near the end just like you would when using the ``buffer`` preset." msgstr "" -#: ../../howto/clinic.rst:1585 +#: ../../howto/clinic.rst:1582 msgid "" "Suppresses the ``impl_prototype``, write the ``impl_definition`` to " "``block``, write ``docstring_prototype``, ``methoddef_define``, and " "``parser_prototype`` to ``two-pass``, write everything else to ``buffer``." msgstr "" -#: ../../howto/clinic.rst:1599 +#: ../../howto/clinic.rst:1596 msgid "``partial-buffer``" msgstr "``partial-buffer``" -#: ../../howto/clinic.rst:1591 +#: ../../howto/clinic.rst:1588 msgid "" "Similar to the ``buffer`` preset, but writes more things to ``block``, only " "writing the really big chunks of generated code to ``buffer``. This avoids " @@ -2235,137 +2229,137 @@ msgid "" "preset." msgstr "" -#: ../../howto/clinic.rst:1598 +#: ../../howto/clinic.rst:1595 msgid "" "Suppresses the ``impl_prototype``, write the ``docstring_definition`` and " "``parser_definition`` to ``buffer``, write everything else to ``block``." msgstr "" -#: ../../howto/clinic.rst:1601 +#: ../../howto/clinic.rst:1598 msgid "The third new directive is ``destination``:" msgstr "" -#: ../../howto/clinic.rst:1607 +#: ../../howto/clinic.rst:1604 msgid "This performs an operation on the destination named ``name``." msgstr "" -#: ../../howto/clinic.rst:1609 +#: ../../howto/clinic.rst:1606 msgid "There are two defined subcommands: ``new`` and ``clear``." msgstr "" -#: ../../howto/clinic.rst:1611 +#: ../../howto/clinic.rst:1608 msgid "The ``new`` subcommand works like this:" msgstr "" -#: ../../howto/clinic.rst:1617 +#: ../../howto/clinic.rst:1614 msgid "" "This creates a new destination with name ```` and type ````." msgstr "" -#: ../../howto/clinic.rst:1619 +#: ../../howto/clinic.rst:1616 msgid "There are five destination types:" msgstr "" -#: ../../howto/clinic.rst:1622 +#: ../../howto/clinic.rst:1619 msgid "Throws the text away." msgstr "" -#: ../../howto/clinic.rst:1625 +#: ../../howto/clinic.rst:1622 msgid "" "Writes the text to the current block. This is what Clinic originally did." msgstr "" -#: ../../howto/clinic.rst:1629 +#: ../../howto/clinic.rst:1626 msgid "A simple text buffer, like the \"buffer\" builtin destination above." msgstr "" -#: ../../howto/clinic.rst:1632 +#: ../../howto/clinic.rst:1629 msgid "" "A text file. The file destination takes an extra argument, a template to " "use for building the filename, like so:" msgstr "" -#: ../../howto/clinic.rst:1635 +#: ../../howto/clinic.rst:1632 msgid "destination new " msgstr "" -#: ../../howto/clinic.rst:1637 +#: ../../howto/clinic.rst:1634 msgid "" "The template can use three strings internally that will be replaced by bits " "of the filename:" msgstr "" -#: ../../howto/clinic.rst:1640 +#: ../../howto/clinic.rst:1637 msgid "{path}" msgstr "" -#: ../../howto/clinic.rst:1641 +#: ../../howto/clinic.rst:1638 msgid "The full path to the file, including directory and full filename." msgstr "" -#: ../../howto/clinic.rst:1642 +#: ../../howto/clinic.rst:1639 msgid "{dirname}" msgstr "" -#: ../../howto/clinic.rst:1643 +#: ../../howto/clinic.rst:1640 msgid "The name of the directory the file is in." msgstr "" -#: ../../howto/clinic.rst:1644 +#: ../../howto/clinic.rst:1641 msgid "{basename}" msgstr "" -#: ../../howto/clinic.rst:1645 +#: ../../howto/clinic.rst:1642 msgid "Just the name of the file, not including the directory." msgstr "" -#: ../../howto/clinic.rst:1647 +#: ../../howto/clinic.rst:1644 msgid "{basename_root}" msgstr "" -#: ../../howto/clinic.rst:1647 +#: ../../howto/clinic.rst:1644 msgid "" "Basename with the extension clipped off (everything up to but not including " "the last '.')." msgstr "" -#: ../../howto/clinic.rst:1651 +#: ../../howto/clinic.rst:1648 msgid "{basename_extension}" msgstr "" -#: ../../howto/clinic.rst:1650 +#: ../../howto/clinic.rst:1647 msgid "" "The last '.' and everything after it. If the basename does not contain a " "period, this will be the empty string." msgstr "" -#: ../../howto/clinic.rst:1653 +#: ../../howto/clinic.rst:1650 msgid "" "If there are no periods in the filename, {basename} and {filename} are the " "same, and {extension} is empty. \"{basename}{extension}\" is always exactly " "the same as \"{filename}\".\"" msgstr "" -#: ../../howto/clinic.rst:1658 +#: ../../howto/clinic.rst:1655 msgid "A two-pass buffer, like the \"two-pass\" builtin destination above." msgstr "" -#: ../../howto/clinic.rst:1661 +#: ../../howto/clinic.rst:1658 msgid "The ``clear`` subcommand works like this:" msgstr "" -#: ../../howto/clinic.rst:1667 +#: ../../howto/clinic.rst:1664 msgid "" "It removes all the accumulated text up to this point in the destination. (I " "don't know what you'd need this for, but I thought maybe it'd be useful " "while someone's experimenting.)" msgstr "" -#: ../../howto/clinic.rst:1671 +#: ../../howto/clinic.rst:1668 msgid "The fourth new directive is ``set``:" msgstr "" -#: ../../howto/clinic.rst:1678 +#: ../../howto/clinic.rst:1675 msgid "" "``set`` lets you set two internal variables in Clinic. ``line_prefix`` is a " "string that will be prepended to every line of Clinic's output; " @@ -2373,35 +2367,35 @@ msgid "" "output." msgstr "" -#: ../../howto/clinic.rst:1682 +#: ../../howto/clinic.rst:1679 msgid "Both of these support two format strings:" msgstr "" -#: ../../howto/clinic.rst:1685 +#: ../../howto/clinic.rst:1682 msgid "``{block comment start}``" msgstr "``{block comment start}``" -#: ../../howto/clinic.rst:1685 +#: ../../howto/clinic.rst:1682 msgid "" "Turns into the string ``/*``, the start-comment text sequence for C files." msgstr "" -#: ../../howto/clinic.rst:1688 +#: ../../howto/clinic.rst:1685 msgid "``{block comment end}``" msgstr "``{block comment end}``" -#: ../../howto/clinic.rst:1688 +#: ../../howto/clinic.rst:1685 msgid "" "Turns into the string ``*/``, the end-comment text sequence for C files." msgstr "" -#: ../../howto/clinic.rst:1690 +#: ../../howto/clinic.rst:1687 msgid "" "The final new directive is one you shouldn't need to use directly, called " "``preserve``:" msgstr "" -#: ../../howto/clinic.rst:1697 +#: ../../howto/clinic.rst:1694 msgid "" "This tells Clinic that the current contents of the output should be kept, " "unmodified. This is used internally by Clinic when dumping output into " @@ -2410,36 +2404,36 @@ msgid "" "gets overwritten." msgstr "" -#: ../../howto/clinic.rst:1704 +#: ../../howto/clinic.rst:1701 msgid "The #ifdef trick" msgstr "" -#: ../../howto/clinic.rst:1706 +#: ../../howto/clinic.rst:1703 msgid "" "If you're converting a function that isn't available on all platforms, " "there's a trick you can use to make life a little easier. The existing code " "probably looks like this::" msgstr "" -#: ../../howto/clinic.rst:1717 +#: ../../howto/clinic.rst:1714 msgid "" "And then in the ``PyMethodDef`` structure at the bottom the existing code " "will have:" msgstr "" -#: ../../howto/clinic.rst:1726 +#: ../../howto/clinic.rst:1723 msgid "" "In this scenario, you should enclose the body of your impl function inside " "the ``#ifdef``, like so::" msgstr "" -#: ../../howto/clinic.rst:1740 +#: ../../howto/clinic.rst:1737 msgid "" "Then, remove those three lines from the ``PyMethodDef`` structure, replacing " "them with the macro Argument Clinic generated:" msgstr "" -#: ../../howto/clinic.rst:1747 +#: ../../howto/clinic.rst:1744 msgid "" "(You can find the real name for this macro inside the generated code. Or you " "can calculate it yourself: it's the name of your function as defined on the " @@ -2447,27 +2441,27 @@ msgid "" "uppercased, and ``\"_METHODDEF\"`` added to the end.)" msgstr "" -#: ../../howto/clinic.rst:1752 +#: ../../howto/clinic.rst:1749 msgid "" "Perhaps you're wondering: what if ``HAVE_FUNCTIONNAME`` isn't defined? The " "``MODULE_FUNCTIONNAME_METHODDEF`` macro won't be defined either!" msgstr "" -#: ../../howto/clinic.rst:1755 +#: ../../howto/clinic.rst:1752 msgid "" "Here's where Argument Clinic gets very clever. It actually detects that the " "Argument Clinic block might be deactivated by the ``#ifdef``. When that " "happens, it generates a little extra code that looks like this::" msgstr "" -#: ../../howto/clinic.rst:1763 +#: ../../howto/clinic.rst:1760 msgid "" "That means the macro always works. If the function is defined, this turns " "into the correct structure, including the trailing comma. If the function " "is undefined, this turns into nothing." msgstr "" -#: ../../howto/clinic.rst:1767 +#: ../../howto/clinic.rst:1764 msgid "" "However, this causes one ticklish problem: where should Argument Clinic put " "this extra code when using the \"block\" output preset? It can't go in the " @@ -2475,24 +2469,24 @@ msgid "" "the whole point!)" msgstr "" -#: ../../howto/clinic.rst:1771 +#: ../../howto/clinic.rst:1768 msgid "" "In this situation, Argument Clinic writes the extra code to the \"buffer\" " "destination. This may mean that you get a complaint from Argument Clinic:" msgstr "" -#: ../../howto/clinic.rst:1779 +#: ../../howto/clinic.rst:1776 msgid "" "When this happens, just open your file, find the ``dump buffer`` block that " "Argument Clinic added to your file (it'll be at the very bottom), then move " "it above the ``PyMethodDef`` structure where that macro is used." msgstr "" -#: ../../howto/clinic.rst:1786 +#: ../../howto/clinic.rst:1783 msgid "Using Argument Clinic in Python files" msgstr "" -#: ../../howto/clinic.rst:1788 +#: ../../howto/clinic.rst:1785 msgid "" "It's actually possible to use Argument Clinic to preprocess Python files. " "There's no point to using Argument Clinic blocks, of course, as the output " @@ -2500,7 +2494,7 @@ msgid "" "Clinic to run Python blocks lets you use Python as a Python preprocessor!" msgstr "" -#: ../../howto/clinic.rst:1793 +#: ../../howto/clinic.rst:1790 msgid "" "Since Python comments are different from C comments, Argument Clinic blocks " "embedded in Python files look slightly different. They look like this:" diff --git a/howto/curses.po b/howto/curses.po index 47aa7c69ac..186af6bdda 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -345,7 +345,7 @@ msgstr "" msgid "Form" msgstr "" -#: ../../howto/curses.rst:277 ../../howto/curses.rst:346 +#: ../../howto/curses.rst:277 ../../howto/curses.rst:345 msgid "Description" msgstr "描述" @@ -398,16 +398,16 @@ msgid "" "as the value to be displayed. The contents of bytestrings are sent to the " "terminal as-is. Strings are encoded to bytes using the value of the " "window's :attr:`encoding` attribute; this defaults to the default system " -"encoding as returned by :func:`locale.getpreferredencoding`." +"encoding as returned by :func:`locale.getencoding`." msgstr "" -#: ../../howto/curses.rst:305 +#: ../../howto/curses.rst:304 msgid "" "The :meth:`~curses.window.addch` methods take a character, which can be " "either a string of length 1, a bytestring of length 1, or an integer." msgstr "" -#: ../../howto/curses.rst:308 +#: ../../howto/curses.rst:307 msgid "" "Constants are provided for extension characters; these constants are " "integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/- " @@ -415,7 +415,7 @@ msgid "" "for drawing borders). You can also use the appropriate Unicode character." msgstr "" -#: ../../howto/curses.rst:314 +#: ../../howto/curses.rst:313 msgid "" "Windows remember where the cursor was left after the last operation, so if " "you leave out the *y,x* coordinates, the string or character will be " @@ -426,7 +426,7 @@ msgid "" "cursor blinking at some apparently random location." msgstr "" -#: ../../howto/curses.rst:322 +#: ../../howto/curses.rst:321 msgid "" "If your application doesn't need a blinking cursor at all, you can call " "``curs_set(False)`` to make it invisible. For compatibility with older " @@ -436,11 +436,11 @@ msgid "" "leaving it in odd locations." msgstr "" -#: ../../howto/curses.rst:331 +#: ../../howto/curses.rst:330 msgid "Attributes and Color" msgstr "" -#: ../../howto/curses.rst:333 +#: ../../howto/curses.rst:332 msgid "" "Characters can be displayed in different ways. Status lines in a text-based " "application are commonly shown in reverse video, or a text viewer may need " @@ -448,7 +448,7 @@ msgid "" "an attribute for each cell on the screen." msgstr "" -#: ../../howto/curses.rst:338 +#: ../../howto/curses.rst:337 msgid "" "An attribute is an integer, each bit representing a different attribute. " "You can try to display text with multiple attribute bits set, but curses " @@ -458,72 +458,72 @@ msgid "" "attributes, listed here." msgstr "" -#: ../../howto/curses.rst:346 +#: ../../howto/curses.rst:345 msgid "Attribute" msgstr "屬性" -#: ../../howto/curses.rst:348 +#: ../../howto/curses.rst:347 msgid ":const:`A_BLINK`" msgstr ":const:`A_BLINK`" -#: ../../howto/curses.rst:348 +#: ../../howto/curses.rst:347 msgid "Blinking text" msgstr "" -#: ../../howto/curses.rst:350 +#: ../../howto/curses.rst:349 msgid ":const:`A_BOLD`" msgstr ":const:`A_BOLD`" -#: ../../howto/curses.rst:350 +#: ../../howto/curses.rst:349 msgid "Extra bright or bold text" msgstr "" -#: ../../howto/curses.rst:352 +#: ../../howto/curses.rst:351 msgid ":const:`A_DIM`" msgstr ":const:`A_DIM`" -#: ../../howto/curses.rst:352 +#: ../../howto/curses.rst:351 msgid "Half bright text" msgstr "" -#: ../../howto/curses.rst:354 +#: ../../howto/curses.rst:353 msgid ":const:`A_REVERSE`" msgstr ":const:`A_REVERSE`" -#: ../../howto/curses.rst:354 +#: ../../howto/curses.rst:353 msgid "Reverse-video text" msgstr "" -#: ../../howto/curses.rst:356 +#: ../../howto/curses.rst:355 msgid ":const:`A_STANDOUT`" msgstr ":const:`A_STANDOUT`" -#: ../../howto/curses.rst:356 +#: ../../howto/curses.rst:355 msgid "The best highlighting mode available" msgstr "" -#: ../../howto/curses.rst:358 +#: ../../howto/curses.rst:357 msgid ":const:`A_UNDERLINE`" msgstr ":const:`A_UNDERLINE`" -#: ../../howto/curses.rst:358 +#: ../../howto/curses.rst:357 msgid "Underlined text" msgstr "" -#: ../../howto/curses.rst:361 +#: ../../howto/curses.rst:360 msgid "" "So, to display a reverse-video status line on the top line of the screen, " "you could code::" msgstr "" -#: ../../howto/curses.rst:368 +#: ../../howto/curses.rst:367 msgid "" "The curses library also supports color on those terminals that provide it. " "The most common such terminal is probably the Linux console, followed by " "color xterms." msgstr "" -#: ../../howto/curses.rst:372 +#: ../../howto/curses.rst:371 msgid "" "To use color, you must call the :func:`~curses.start_color` function soon " "after calling :func:`~curses.initscr`, to initialize the default color set " @@ -535,7 +535,7 @@ msgid "" "for the sake of these functions.)" msgstr "" -#: ../../howto/curses.rst:382 +#: ../../howto/curses.rst:381 msgid "" "The curses library maintains a finite number of color pairs, containing a " "foreground (or text) color and a background color. You can get the " @@ -545,11 +545,11 @@ msgid "" "work on all terminals." msgstr "" -#: ../../howto/curses.rst:389 +#: ../../howto/curses.rst:388 msgid "An example, which displays a line of text using color pair 1::" msgstr "" -#: ../../howto/curses.rst:394 +#: ../../howto/curses.rst:393 msgid "" "As I said before, a color pair consists of a foreground and background " "color. The ``init_pair(n, f, b)`` function changes the definition of color " @@ -557,7 +557,7 @@ msgid "" "hard-wired to white on black, and cannot be changed." msgstr "" -#: ../../howto/curses.rst:399 +#: ../../howto/curses.rst:398 msgid "" "Colors are numbered, and :func:`start_color` initializes 8 basic colors when " "it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:" @@ -566,20 +566,20 @@ msgid "" "const:`curses.COLOR_RED`, and so forth." msgstr "" -#: ../../howto/curses.rst:405 +#: ../../howto/curses.rst:404 msgid "" "Let's put all this together. To change color 1 to red text on a white " "background, you would call::" msgstr "" -#: ../../howto/curses.rst:410 +#: ../../howto/curses.rst:409 msgid "" "When you change a color pair, any text already displayed using that color " "pair will change to the new colors. You can also display new text in this " "color with::" msgstr "" -#: ../../howto/curses.rst:416 +#: ../../howto/curses.rst:415 msgid "" "Very fancy terminals can change the definitions of the actual colors to a " "given RGB value. This lets you change color 1, which is usually red, to " @@ -591,11 +591,11 @@ msgid "" "your system's man pages for more information." msgstr "" -#: ../../howto/curses.rst:427 +#: ../../howto/curses.rst:426 msgid "User Input" msgstr "" -#: ../../howto/curses.rst:429 +#: ../../howto/curses.rst:428 msgid "" "The C curses library offers only very simple input mechanisms. Python's :mod:" "`curses` module adds a basic text-input widget. (Other libraries such as " @@ -603,11 +603,11 @@ msgid "" "of widgets.)" msgstr "" -#: ../../howto/curses.rst:434 +#: ../../howto/curses.rst:433 msgid "There are two methods for getting input from a window:" msgstr "" -#: ../../howto/curses.rst:436 +#: ../../howto/curses.rst:435 msgid "" ":meth:`~curses.window.getch` refreshes the screen and then waits for the " "user to hit a key, displaying the key if :func:`~curses.echo` has been " @@ -615,7 +615,7 @@ msgid "" "should be moved before pausing." msgstr "" -#: ../../howto/curses.rst:441 +#: ../../howto/curses.rst:440 msgid "" ":meth:`~curses.window.getkey` does the same thing but converts the integer " "to a string. Individual characters are returned as 1-character strings, and " @@ -623,7 +623,7 @@ msgid "" "name such as ``KEY_UP`` or ``^G``." msgstr "" -#: ../../howto/curses.rst:446 +#: ../../howto/curses.rst:445 msgid "" "It's possible to not wait for the user using the :meth:`~curses.window." "nodelay` window method. After ``nodelay(True)``, :meth:`getch` and :meth:" @@ -635,7 +635,7 @@ msgid "" "tenths of a second), curses raises an exception." msgstr "" -#: ../../howto/curses.rst:456 +#: ../../howto/curses.rst:455 msgid "" "The :meth:`getch` method returns an integer; if it's between 0 and 255, it " "represents the ASCII code of the key pressed. Values greater than 255 are " @@ -645,7 +645,7 @@ msgid "" "program may look something like this::" msgstr "" -#: ../../howto/curses.rst:472 +#: ../../howto/curses.rst:471 msgid "" "The :mod:`curses.ascii` module supplies ASCII class membership functions " "that take either integer or 1-character string arguments; these may be " @@ -655,7 +655,7 @@ msgid "" "returns the control character corresponding to its argument." msgstr "" -#: ../../howto/curses.rst:479 +#: ../../howto/curses.rst:478 msgid "" "There's also a method to retrieve an entire string, :meth:`~curses.window." "getstr`. It isn't used very often, because its functionality is quite " @@ -664,7 +664,7 @@ msgid "" "number of characters. ::" msgstr "" -#: ../../howto/curses.rst:490 +#: ../../howto/curses.rst:489 msgid "" "The :mod:`curses.textpad` module supplies a text box that supports an Emacs-" "like set of keybindings. Various methods of the :class:`~curses.textpad." @@ -672,16 +672,16 @@ msgid "" "results either with or without trailing spaces. Here's an example::" msgstr "" -#: ../../howto/curses.rst:514 +#: ../../howto/curses.rst:513 msgid "" "See the library documentation on :mod:`curses.textpad` for more details." msgstr "" -#: ../../howto/curses.rst:518 +#: ../../howto/curses.rst:517 msgid "For More Information" msgstr "" -#: ../../howto/curses.rst:520 +#: ../../howto/curses.rst:519 msgid "" "This HOWTO doesn't cover some advanced topics, such as reading the contents " "of the screen or capturing mouse events from an xterm instance, but the " @@ -689,7 +689,7 @@ msgid "" "complete. You should browse it next." msgstr "" -#: ../../howto/curses.rst:525 +#: ../../howto/curses.rst:524 msgid "" "If you're in doubt about the detailed behavior of the curses functions, " "consult the manual pages for your curses implementation, whether it's " @@ -698,7 +698,7 @@ msgid "" "const:`ACS_\\*` characters available to you." msgstr "" -#: ../../howto/curses.rst:532 +#: ../../howto/curses.rst:531 msgid "" "Because the curses API is so large, some functions aren't supported in the " "Python interface. Often this isn't because they're difficult to implement, " @@ -708,30 +708,30 @@ msgid "" "org/>`_ to learn more about submitting patches to Python." msgstr "" -#: ../../howto/curses.rst:540 +#: ../../howto/curses.rst:539 msgid "" "`Writing Programs with NCURSES `_: a lengthy tutorial for C programmers." msgstr "" -#: ../../howto/curses.rst:542 +#: ../../howto/curses.rst:541 msgid "`The ncurses man page `_" msgstr "`ncurses 使用者手冊 `_" -#: ../../howto/curses.rst:543 +#: ../../howto/curses.rst:542 msgid "" "`The ncurses FAQ `_" msgstr "" "`ncurses 問答集 `_" -#: ../../howto/curses.rst:544 +#: ../../howto/curses.rst:543 msgid "" "`\"Use curses... don't swear\" `_: video of a PyCon 2013 talk on controlling terminals using " "curses or Urwid." msgstr "" -#: ../../howto/curses.rst:546 +#: ../../howto/curses.rst:545 msgid "" "`\"Console Applications with Urwid\" `_: video of a PyCon CA 2012 talk demonstrating some " diff --git a/howto/descriptor.po b/howto/descriptor.po index d8dbdbed46..ec495bab26 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-10 00:22+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -954,38 +954,38 @@ msgid "" "`classmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1406 +#: ../../howto/descriptor.rst:1408 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 " "decorators. For example, a classmethod and property could be chained " -"together:" +"together. In Python 3.11, this functionality was deprecated." msgstr "" -#: ../../howto/descriptor.rst:1426 +#: ../../howto/descriptor.rst:1428 msgid "Member objects and __slots__" msgstr "" -#: ../../howto/descriptor.rst:1428 +#: ../../howto/descriptor.rst:1430 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:1432 +#: ../../howto/descriptor.rst:1434 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: ../../howto/descriptor.rst:1448 +#: ../../howto/descriptor.rst:1450 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: ../../howto/descriptor.rst:1483 +#: ../../howto/descriptor.rst:1485 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 " @@ -993,19 +993,19 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: ../../howto/descriptor.rst:1488 +#: ../../howto/descriptor.rst:1490 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:1491 +#: ../../howto/descriptor.rst:1493 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: ../../howto/descriptor.rst:1513 +#: ../../howto/descriptor.rst:1515 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 " @@ -1015,36 +1015,36 @@ msgid "" "managed by member descriptors:" msgstr "" -#: ../../howto/descriptor.rst:1558 +#: ../../howto/descriptor.rst:1560 msgid "" "The :meth:`type.__new__` method takes care of adding member objects to class " "variables:" msgstr "" -#: ../../howto/descriptor.rst:1574 +#: ../../howto/descriptor.rst:1576 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:1609 +#: ../../howto/descriptor.rst:1611 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:1623 +#: ../../howto/descriptor.rst:1625 msgid "" "At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: ../../howto/descriptor.rst:1644 +#: ../../howto/descriptor.rst:1646 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: ../../howto/descriptor.rst:1656 +#: ../../howto/descriptor.rst:1658 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" diff --git a/howto/enum.po b/howto/enum.po new file mode 100644 index 0000000000..f86fd27338 --- /dev/null +++ b/howto/enum.po @@ -0,0 +1,1177 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/enum.rst:3 +msgid "Enum HOWTO" +msgstr "" + +#: ../../howto/enum.rst:9 +msgid "" +"An :class:`Enum` is a set of symbolic names bound to unique values. They " +"are similar to global variables, but they offer a more useful :func:" +"`repr()`, grouping, type-safety, and a few other features." +msgstr "" + +#: ../../howto/enum.rst:13 +msgid "" +"They are most useful when you have a variable that can take one of a limited " +"selection of values. For example, the days of the week::" +msgstr "" + +#: ../../howto/enum.rst:26 +msgid "Or perhaps the RGB primary colors::" +msgstr "" + +#: ../../howto/enum.rst:34 +msgid "" +"As you can see, creating an :class:`Enum` is as simple as writing a class " +"that inherits from :class:`Enum` itself." +msgstr "" + +#: ../../howto/enum.rst:37 +msgid "Case of Enum Members" +msgstr "" + +#: ../../howto/enum.rst:39 +msgid "" +"Because Enums are used to represent constants we recommend using UPPER_CASE " +"names for members, and will be using that style in our examples." +msgstr "" + +#: ../../howto/enum.rst:42 +msgid "" +"Depending on the nature of the enum a member's value may or may not be " +"important, but either way that value can be used to get the corresponding " +"member::" +msgstr "" + +#: ../../howto/enum.rst:49 +msgid "" +"As you can see, the ``repr()`` of a member shows the enum name, the member " +"name, and the value. The ``str()`` of a member shows only the enum name and " +"member name::" +msgstr "" + +#: ../../howto/enum.rst:56 +msgid "The *type* of an enumeration member is the enum it belongs to::" +msgstr "" + +#: ../../howto/enum.rst:63 +msgid "Enum members have an attribute that contains just their :attr:`name`::" +msgstr "" + +#: ../../howto/enum.rst:68 +msgid "Likewise, they have an attribute for their :attr:`value`::" +msgstr "" + +#: ../../howto/enum.rst:74 +msgid "" +"Unlike many languages that treat enumerations solely as name/value pairs, " +"Python Enums can have behavior added. For example, :class:`datetime.date` " +"has two methods for returning the weekday: :meth:`weekday` and :meth:" +"`isoweekday`. The difference is that one of them counts from 0-6 and the " +"other from 1-7. Rather than keep track of that ourselves we can add a method " +"to the :class:`Weekday` enum to extract the day from the :class:`date` " +"instance and return the matching enum member::" +msgstr "" + +#: ../../howto/enum.rst:86 +msgid "The complete :class:`Weekday` enum now looks like this::" +msgstr "" + +#: ../../howto/enum.rst:101 +msgid "Now we can find out what today is! Observe::" +msgstr "" + +#: ../../howto/enum.rst:107 +msgid "" +"Of course, if you're reading this on some other day, you'll see that day " +"instead." +msgstr "" + +#: ../../howto/enum.rst:109 +msgid "" +"This :class:`Weekday` enum is great if our variable only needs one day, but " +"what if we need several? Maybe we're writing a function to plot chores " +"during a week, and don't want to use a :class:`list` -- we could use a " +"different type of :class:`Enum`::" +msgstr "" + +#: ../../howto/enum.rst:124 +msgid "" +"We've changed two things: we're inherited from :class:`Flag`, and the values " +"are all powers of 2." +msgstr "" + +#: ../../howto/enum.rst:127 +msgid "" +"Just like the original :class:`Weekday` enum above, we can have a single " +"selection::" +msgstr "" + +#: ../../howto/enum.rst:133 +msgid "" +"But :class:`Flag` also allows us to combine several members into a single " +"variable::" +msgstr "" + +#: ../../howto/enum.rst:140 +msgid "You can even iterate over a :class:`Flag` variable::" +msgstr "" + +#: ../../howto/enum.rst:147 +msgid "Okay, let's get some chores set up::" +msgstr "" + +#: ../../howto/enum.rst:155 +msgid "And a function to display the chores for a given day::" +msgstr "" + +#: ../../howto/enum.rst:164 +msgid "" +"In cases where the actual values of the members do not matter, you can save " +"yourself some work and use :func:`auto()` for the values::" +msgstr "" + +#: ../../howto/enum.rst:182 +msgid "Programmatic access to enumeration members and their attributes" +msgstr "" + +#: ../../howto/enum.rst:184 +msgid "" +"Sometimes it's useful to access members in enumerations programmatically (i." +"e. situations where ``Color.RED`` won't do because the exact color is not " +"known at program-writing time). ``Enum`` allows such access::" +msgstr "" + +#: ../../howto/enum.rst:193 +msgid "If you want to access enum members by *name*, use item access::" +msgstr "" + +#: ../../howto/enum.rst:200 +msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::" +msgstr "" + +#: ../../howto/enum.rst:210 +msgid "Duplicating enum members and values" +msgstr "" + +#: ../../howto/enum.rst:212 +msgid "Having two enum members with the same name is invalid::" +msgstr "" + +#: ../../howto/enum.rst:222 +msgid "" +"However, an enum member can have other names associated with it. Given two " +"entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " +"is an alias for the member ``A``. By-value lookup of the value of ``A`` " +"will return the member ``A``. By-name lookup of ``A`` will return the " +"member ``A``. By-name lookup of ``B`` will also return the member ``A``::" +msgstr "" + +#: ../../howto/enum.rst:243 +msgid "" +"Attempting to create a member with the same name as an already defined " +"attribute (another member, a method, etc.) or attempting to create an " +"attribute with the same name as a member is not allowed." +msgstr "" + +#: ../../howto/enum.rst:249 +msgid "Ensuring unique enumeration values" +msgstr "" + +#: ../../howto/enum.rst:251 +msgid "" +"By default, enumerations allow multiple names as aliases for the same value. " +"When this behavior isn't desired, you can use the :func:`unique` decorator::" +msgstr "" + +#: ../../howto/enum.rst:268 +msgid "Using automatic values" +msgstr "" + +#: ../../howto/enum.rst:270 +msgid "If the exact value is unimportant you can use :class:`auto`::" +msgstr "" + +#: ../../howto/enum.rst:281 +msgid "" +"The values are chosen by :func:`_generate_next_value_`, which can be " +"overridden::" +msgstr "" + +#: ../../howto/enum.rst:299 +msgid "" +"The :meth:`_generate_next_value_` method must be defined before any members." +msgstr "" + +#: ../../howto/enum.rst:302 +msgid "Iteration" +msgstr "" + +#: ../../howto/enum.rst:304 +msgid "Iterating over the members of an enum does not provide the aliases::" +msgstr "" + +#: ../../howto/enum.rst:309 +msgid "" +"The special attribute ``__members__`` is a read-only ordered mapping of " +"names to members. It includes all names defined in the enumeration, " +"including the aliases::" +msgstr "" + +#: ../../howto/enum.rst:321 +msgid "" +"The ``__members__`` attribute can be used for detailed programmatic access " +"to the enumeration members. For example, finding all the aliases::" +msgstr "" + +#: ../../howto/enum.rst:329 +msgid "Comparisons" +msgstr "" + +#: ../../howto/enum.rst:331 +msgid "Enumeration members are compared by identity::" +msgstr "" + +#: ../../howto/enum.rst:340 +msgid "" +"Ordered comparisons between enumeration values are *not* supported. Enum " +"members are not integers (but see `IntEnum`_ below)::" +msgstr "" + +#: ../../howto/enum.rst:348 +msgid "Equality comparisons are defined though::" +msgstr "" + +#: ../../howto/enum.rst:357 +msgid "" +"Comparisons against non-enumeration values will always compare not equal " +"(again, :class:`IntEnum` was explicitly designed to behave differently, see " +"below)::" +msgstr "" + +#: ../../howto/enum.rst:366 +msgid "Allowed members and attributes of enumerations" +msgstr "" + +#: ../../howto/enum.rst:368 +msgid "" +"Most of the examples above use integers for enumeration values. Using " +"integers is short and handy (and provided by default by the `Functional " +"API`_), but not strictly enforced. In the vast majority of use-cases, one " +"doesn't care what the actual value of an enumeration is. But if the value " +"*is* important, enumerations can have arbitrary values." +msgstr "" + +#: ../../howto/enum.rst:374 +msgid "" +"Enumerations are Python classes, and can have methods and special methods as " +"usual. If we have this enumeration::" +msgstr "" + +#: ../../howto/enum.rst:394 +msgid "Then::" +msgstr "" + +#: ../../howto/enum.rst:403 +msgid "" +"The rules for what is allowed are as follows: names that start and end with " +"a single underscore are reserved by enum and cannot be used; all other " +"attributes defined within an enumeration will become members of this " +"enumeration, with the exception of special methods (:meth:`__str__`, :meth:" +"`__add__`, etc.), descriptors (methods are also descriptors), and variable " +"names listed in :attr:`_ignore_`." +msgstr "" + +#: ../../howto/enum.rst:410 +msgid "" +"Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` " +"then any value(s) given to the enum member will be passed into those " +"methods. See `Planet`_ for an example." +msgstr "" + +#: ../../howto/enum.rst:416 +msgid "Restricted Enum subclassing" +msgstr "" + +#: ../../howto/enum.rst:418 +msgid "" +"A new :class:`Enum` class must have one base enum class, up to one concrete " +"data type, and as many :class:`object`-based mixin classes as needed. The " +"order of these base classes is::" +msgstr "" + +#: ../../howto/enum.rst:425 +msgid "" +"Also, subclassing an enumeration is allowed only if the enumeration does not " +"define any members. So this is forbidden::" +msgstr "" + +#: ../../howto/enum.rst:435 +msgid "But this is allowed::" +msgstr "" + +#: ../../howto/enum.rst:446 +msgid "" +"Allowing subclassing of enums that define members would lead to a violation " +"of some important invariants of types and instances. On the other hand, it " +"makes sense to allow sharing some common behavior between a group of " +"enumerations. (See `OrderedEnum`_ for an example.)" +msgstr "" + +#: ../../howto/enum.rst:453 +msgid "Pickling" +msgstr "" + +#: ../../howto/enum.rst:455 +msgid "Enumerations can be pickled and unpickled::" +msgstr "" + +#: ../../howto/enum.rst:462 +msgid "" +"The usual restrictions for pickling apply: picklable enums must be defined " +"in the top level of a module, since unpickling requires them to be " +"importable from that module." +msgstr "" + +#: ../../howto/enum.rst:468 +msgid "" +"With pickle protocol version 4 it is possible to easily pickle enums nested " +"in other classes." +msgstr "" + +#: ../../howto/enum.rst:471 +msgid "" +"It is possible to modify how enum members are pickled/unpickled by defining :" +"meth:`__reduce_ex__` in the enumeration class." +msgstr "" + +#: ../../howto/enum.rst:476 +msgid "Functional API" +msgstr "" + +#: ../../howto/enum.rst:478 +msgid "" +"The :class:`Enum` class is callable, providing the following functional API::" +msgstr "" + +#: ../../howto/enum.rst:488 +msgid "" +"The semantics of this API resemble :class:`~collections.namedtuple`. The " +"first argument of the call to :class:`Enum` is the name of the enumeration." +msgstr "" + +#: ../../howto/enum.rst:491 +msgid "" +"The second argument is the *source* of enumeration member names. It can be " +"a whitespace-separated string of names, a sequence of names, a sequence of 2-" +"tuples with key/value pairs, or a mapping (e.g. dictionary) of names to " +"values. The last two options enable assigning arbitrary values to " +"enumerations; the others auto-assign increasing integers starting with 1 " +"(use the ``start`` parameter to specify a different starting value). A new " +"class derived from :class:`Enum` is returned. In other words, the above " +"assignment to :class:`Animal` is equivalent to::" +msgstr "" + +#: ../../howto/enum.rst:507 +msgid "" +"The reason for defaulting to ``1`` as the starting number and not ``0`` is " +"that ``0`` is ``False`` in a boolean sense, but by default enum members all " +"evaluate to ``True``." +msgstr "" + +#: ../../howto/enum.rst:511 +msgid "" +"Pickling enums created with the functional API can be tricky as frame stack " +"implementation details are used to try and figure out which module the " +"enumeration is being created in (e.g. it will fail if you use a utility " +"function in a separate module, and also may not work on IronPython or " +"Jython). The solution is to specify the module name explicitly as follows::" +msgstr "" + +#: ../../howto/enum.rst:521 +msgid "" +"If ``module`` is not supplied, and Enum cannot determine what it is, the new " +"Enum members will not be unpicklable; to keep errors closer to the source, " +"pickling will be disabled." +msgstr "" + +#: ../../howto/enum.rst:525 +msgid "" +"The new pickle protocol 4 also, in some circumstances, relies on :attr:" +"`~definition.__qualname__` being set to the location where pickle will be " +"able to find the class. For example, if the class was made available in " +"class SomeData in the global scope::" +msgstr "" + +#: ../../howto/enum.rst:532 +msgid "The complete signature is::" +msgstr "" + +#: ../../howto/enum.rst:0 +msgid "value" +msgstr "" + +#: ../../howto/enum.rst:544 +msgid "What the new enum class will record as its name." +msgstr "" + +#: ../../howto/enum.rst:0 +msgid "names" +msgstr "" + +#: ../../howto/enum.rst:546 +msgid "" +"The enum members. This can be a whitespace- or comma-separated string " +"(values will start at 1 unless otherwise specified)::" +msgstr "" + +#: ../../howto/enum.rst:551 +msgid "or an iterator of names::" +msgstr "" + +#: ../../howto/enum.rst:555 +msgid "or an iterator of (name, value) pairs::" +msgstr "" + +#: ../../howto/enum.rst:559 +msgid "or a mapping::" +msgstr "" + +#: ../../howto/enum.rst:0 +msgid "module" +msgstr "" + +#: ../../howto/enum.rst:563 +msgid "name of module where new enum class can be found." +msgstr "" + +#: ../../howto/enum.rst:0 +msgid "qualname" +msgstr "" + +#: ../../howto/enum.rst:565 +msgid "where in module new enum class can be found." +msgstr "" + +#: ../../howto/enum.rst:0 +msgid "type" +msgstr "" + +#: ../../howto/enum.rst:567 +msgid "type to mix in to new enum class." +msgstr "" + +#: ../../howto/enum.rst:0 +msgid "start" +msgstr "" + +#: ../../howto/enum.rst:569 +msgid "number to start counting at if only names are passed in." +msgstr "" + +#: ../../howto/enum.rst:571 +msgid "The *start* parameter was added." +msgstr "" + +#: ../../howto/enum.rst:576 +msgid "Derived Enumerations" +msgstr "" + +#: ../../howto/enum.rst:579 +msgid "IntEnum" +msgstr "" + +#: ../../howto/enum.rst:581 +msgid "" +"The first variation of :class:`Enum` that is provided is also a subclass of :" +"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " +"extension, integer enumerations of different types can also be compared to " +"each other::" +msgstr "" + +#: ../../howto/enum.rst:602 +msgid "" +"However, they still can't be compared to standard :class:`Enum` " +"enumerations::" +msgstr "" + +#: ../../howto/enum.rst:615 +msgid "" +":class:`IntEnum` values behave like integers in other ways you'd expect::" +msgstr "" + +#: ../../howto/enum.rst:626 +msgid "StrEnum" +msgstr "" + +#: ../../howto/enum.rst:628 +msgid "" +"The second variation of :class:`Enum` that is provided is also a subclass " +"of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; " +"by extension, string enumerations of different types can also be compared to " +"each other." +msgstr "" + +#: ../../howto/enum.rst:637 +msgid "IntFlag" +msgstr "" + +#: ../../howto/enum.rst:639 +msgid "" +"The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " +"based on :class:`int`. The difference being :class:`IntFlag` members can be " +"combined using the bitwise operators (&, \\|, ^, ~) and the result is still " +"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" +"`IntFlag` members are also integers and can be used wherever an :class:`int` " +"is used." +msgstr "" + +#: ../../howto/enum.rst:647 +msgid "" +"Any operation on an :class:`IntFlag` member besides the bit-wise operations " +"will lose the :class:`IntFlag` membership." +msgstr "" + +#: ../../howto/enum.rst:650 +msgid "" +"Bit-wise operations that result in invalid :class:`IntFlag` values will lose " +"the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." +msgstr "" + +#: ../../howto/enum.rst:657 +msgid "Sample :class:`IntFlag` class::" +msgstr "" + +#: ../../howto/enum.rst:673 +msgid "It is also possible to name the combinations::" +msgstr "" + +#: ../../howto/enum.rst:689 +msgid "" +"Named combinations are considered aliases. Aliases do not show up during " +"iteration, but can be returned from by-value lookups." +msgstr "" + +#: ../../howto/enum.rst:694 +msgid "" +"Another important difference between :class:`IntFlag` and :class:`Enum` is " +"that if no flags are set (the value is 0), its boolean evaluation is :data:" +"`False`::" +msgstr "" + +#: ../../howto/enum.rst:702 +msgid "" +"Because :class:`IntFlag` members are also subclasses of :class:`int` they " +"can be combined with them (but may lose :class:`IntFlag` membership::" +msgstr "" + +#: ../../howto/enum.rst:713 +msgid "" +"The negation operator, ``~``, always returns an :class:`IntFlag` member with " +"a positive value::" +msgstr "" + +#: ../../howto/enum.rst:719 +msgid ":class:`IntFlag` members can also be iterated over::" +msgstr "" + +#: ../../howto/enum.rst:728 +msgid "Flag" +msgstr "" + +#: ../../howto/enum.rst:730 +msgid "" +"The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " +"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" +"class:`IntFlag`, they cannot be combined with, nor compared against, any " +"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " +"specify the values directly it is recommended to use :class:`auto` as the " +"value and let :class:`Flag` select an appropriate value." +msgstr "" + +#: ../../howto/enum.rst:739 +msgid "" +"Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " +"no flags being set, the boolean evaluation is :data:`False`::" +msgstr "" + +#: ../../howto/enum.rst:753 +msgid "" +"Individual flags should have values that are powers of two (1, 2, 4, " +"8, ...), while combinations of flags won't::" +msgstr "" + +#: ../../howto/enum.rst:765 +msgid "" +"Giving a name to the \"no flags set\" condition does not change its boolean " +"value::" +msgstr "" + +#: ../../howto/enum.rst:779 +msgid ":class:`Flag` members can also be iterated over::" +msgstr "" + +#: ../../howto/enum.rst:789 +msgid "" +"For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " +"recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " +"promises of an enumeration (by being comparable to integers, and thus by " +"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" +"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " +"will not do; for example, when integer constants are replaced with " +"enumerations, or for interoperability with other systems." +msgstr "" + +#: ../../howto/enum.rst:799 +msgid "Others" +msgstr "" + +#: ../../howto/enum.rst:801 +msgid "" +"While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " +"simple to implement independently::" +msgstr "" + +#: ../../howto/enum.rst:807 +msgid "" +"This demonstrates how similar derived enumerations can be defined; for " +"example a :class:`FloatEnum` that mixes in :class:`float` instead of :class:" +"`int`." +msgstr "" + +#: ../../howto/enum.rst:810 +msgid "Some rules:" +msgstr "" + +#: ../../howto/enum.rst:812 +msgid "" +"When subclassing :class:`Enum`, mix-in types must appear before :class:" +"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example " +"above." +msgstr "" + +#: ../../howto/enum.rst:815 +msgid "" +"Mix-in types must be subclassable. For example, :class:`bool` and :class:" +"`range` are not subclassable and will throw an error during Enum creation if " +"used as the mix-in type." +msgstr "" + +#: ../../howto/enum.rst:818 +msgid "" +"While :class:`Enum` can have members of any type, once you mix in an " +"additional type, all the members must have values of that type, e.g. :class:" +"`int` above. This restriction does not apply to mix-ins which only add " +"methods and don't specify another type." +msgstr "" + +#: ../../howto/enum.rst:822 +msgid "" +"When another data type is mixed in, the :attr:`value` attribute is *not the " +"same* as the enum member itself, although it is equivalent and will compare " +"equal." +msgstr "" + +#: ../../howto/enum.rst:825 +msgid "" +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" +"`__str__` and :meth:`__repr__` respectively; other codes (such as ``%i`` or " +"``%h`` for IntEnum) treat the enum member as its mixed-in type." +msgstr "" + +#: ../../howto/enum.rst:828 +msgid "" +":ref:`Formatted string literals `, :meth:`str.format`, and :func:" +"`format` will use the enum's :meth:`__str__` method." +msgstr "" + +#: ../../howto/enum.rst:833 +msgid "" +"Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " +"designed to be drop-in replacements for existing constants, their :meth:" +"`__str__` method has been reset to their data types :meth:`__str__` method." +msgstr "" + +#: ../../howto/enum.rst:839 +msgid "When to use :meth:`__new__` vs. :meth:`__init__`" +msgstr "" + +#: ../../howto/enum.rst:841 +msgid "" +":meth:`__new__` must be used whenever you want to customize the actual value " +"of the :class:`Enum` member. Any other modifications may go in either :meth:" +"`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred." +msgstr "" + +#: ../../howto/enum.rst:845 +msgid "" +"For example, if you want to pass several items to the constructor, but only " +"want one of them to be the value::" +msgstr "" + +#: ../../howto/enum.rst:872 +msgid "Finer Points" +msgstr "" + +#: ../../howto/enum.rst:875 +msgid "Supported ``__dunder__`` names" +msgstr "" + +#: ../../howto/enum.rst:877 +msgid "" +":attr:`__members__` is a read-only ordered mapping of ``member_name``:" +"``member`` items. It is only available on the class." +msgstr "" + +#: ../../howto/enum.rst:880 +msgid "" +":meth:`__new__`, if specified, must create and return the enum members; it " +"is also a very good idea to set the member's :attr:`_value_` appropriately. " +"Once all the members are created it is no longer used." +msgstr "" + +#: ../../howto/enum.rst:886 +msgid "Supported ``_sunder_`` names" +msgstr "" + +#: ../../howto/enum.rst:888 +msgid "``_name_`` -- name of the member" +msgstr "" + +#: ../../howto/enum.rst:889 +msgid "" +"``_value_`` -- value of the member; can be set / modified in ``__new__``" +msgstr "" + +#: ../../howto/enum.rst:891 +msgid "" +"``_missing_`` -- a lookup function used when a value is not found; may be " +"overridden" +msgstr "" + +#: ../../howto/enum.rst:893 +msgid "" +"``_ignore_`` -- a list of names, either as a :class:`list` or a :class:" +"`str`, that will not be transformed into members, and will be removed from " +"the final class" +msgstr "" + +#: ../../howto/enum.rst:896 +msgid "" +"``_order_`` -- used in Python 2/3 code to ensure member order is consistent " +"(class attribute, removed during class creation)" +msgstr "" + +#: ../../howto/enum.rst:898 +msgid "" +"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:" +"`auto` to get an appropriate value for an enum member; may be overridden" +msgstr "" + +#: ../../howto/enum.rst:904 +msgid "" +"For standard :class:`Enum` classes the next value chosen is the last value " +"seen incremented by one." +msgstr "" + +#: ../../howto/enum.rst:907 +msgid "" +"For :class:`Flag` classes the next value chosen will be the next highest " +"power-of-two, regardless of the last value seen." +msgstr "" + +#: ../../howto/enum.rst:910 +msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" +msgstr "" + +#: ../../howto/enum.rst:911 +msgid "``_ignore_``" +msgstr "" + +#: ../../howto/enum.rst:913 +msgid "" +"To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute " +"can be provided. It will be checked against the actual order of the " +"enumeration and raise an error if the two do not match::" +msgstr "" + +#: ../../howto/enum.rst:931 +msgid "" +"In Python 2 code the :attr:`_order_` attribute is necessary as definition " +"order is lost before it can be recorded." +msgstr "" + +#: ../../howto/enum.rst:936 +msgid "_Private__names" +msgstr "" + +#: ../../howto/enum.rst:938 +msgid "" +":ref:`Private names ` are not converted to enum " +"members, but remain normal attributes." +msgstr "" + +#: ../../howto/enum.rst:945 +msgid "``Enum`` member type" +msgstr "" + +#: ../../howto/enum.rst:947 +msgid "" +"Enum members are instances of their enum class, and are normally accessed as " +"``EnumClass.member``. In Python versions ``3.5`` to ``3.10`` you could " +"access members from other members -- this practice was discouraged, and in " +"``3.11`` :class:`Enum` returns to not allowing it::" +msgstr "" + +#: ../../howto/enum.rst:968 +msgid "Creating members that are mixed with other data types" +msgstr "" + +#: ../../howto/enum.rst:970 +msgid "" +"When subclassing other data types, such as :class:`int` or :class:`str`, " +"with an :class:`Enum`, all values after the ``=`` are passed to that data " +"type's constructor. For example::" +msgstr "" + +#: ../../howto/enum.rst:982 +msgid "Boolean value of ``Enum`` classes and members" +msgstr "" + +#: ../../howto/enum.rst:984 +msgid "" +"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" +"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " +"rules; otherwise, all members evaluate as :data:`True`. To make your own " +"enum's boolean evaluation depend on the member's value add the following to " +"your class::" +msgstr "" + +#: ../../howto/enum.rst:993 +msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." +msgstr "" + +#: ../../howto/enum.rst:997 +msgid "``Enum`` classes with methods" +msgstr "" + +#: ../../howto/enum.rst:999 +msgid "" +"If you give your enum subclass extra methods, like the `Planet`_ class " +"below, those methods will show up in a :func:`dir` of the member, but not of " +"the class::" +msgstr "" + +#: ../../howto/enum.rst:1010 +msgid "Combining members of ``Flag``" +msgstr "" + +#: ../../howto/enum.rst:1012 +msgid "" +"Iterating over a combination of :class:`Flag` members will only return the " +"members that are comprised of a single bit::" +msgstr "" + +#: ../../howto/enum.rst:1030 +msgid "``Flag`` and ``IntFlag`` minutia" +msgstr "" + +#: ../../howto/enum.rst:1032 +msgid "Using the following snippet for our examples::" +msgstr "" + +#: ../../howto/enum.rst:1043 +msgid "the following are true:" +msgstr "" + +#: ../../howto/enum.rst:1045 +msgid "single-bit flags are canonical" +msgstr "" + +#: ../../howto/enum.rst:1046 +msgid "multi-bit and zero-bit flags are aliases" +msgstr "" + +#: ../../howto/enum.rst:1047 +msgid "only canonical flags are returned during iteration::" +msgstr "" + +#: ../../howto/enum.rst:1052 +msgid "" +"negating a flag or flag set returns a new flag/flag set with the " +"corresponding positive integer value::" +msgstr "" + +#: ../../howto/enum.rst:1061 +msgid "names of pseudo-flags are constructed from their members' names::" +msgstr "" + +#: ../../howto/enum.rst:1066 +msgid "multi-bit flags, aka aliases, can be returned from operations::" +msgstr "" + +#: ../../howto/enum.rst:1077 +msgid "" +"membership / containment checking: zero-valued flags are always considered " +"to be contained::" +msgstr "" + +#: ../../howto/enum.rst:1083 +msgid "" +"otherwise, only if all bits of one flag are in the other flag will True be " +"returned::" +msgstr "" + +#: ../../howto/enum.rst:1092 +msgid "" +"There is a new boundary mechanism that controls how out-of-range / invalid " +"bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" +msgstr "" + +#: ../../howto/enum.rst:1095 +msgid "STRICT --> raises an exception when presented with invalid values" +msgstr "" + +#: ../../howto/enum.rst:1096 +msgid "CONFORM --> discards any invalid bits" +msgstr "" + +#: ../../howto/enum.rst:1097 +msgid "EJECT --> lose Flag status and become a normal int with the given value" +msgstr "" + +#: ../../howto/enum.rst:1101 +msgid "KEEP --> keep the extra bits" +msgstr "" + +#: ../../howto/enum.rst:1099 +msgid "keeps Flag status and extra bits" +msgstr "" + +#: ../../howto/enum.rst:1100 +msgid "extra bits do not show up in iteration" +msgstr "" + +#: ../../howto/enum.rst:1101 +msgid "extra bits do show up in repr() and str()" +msgstr "" + +#: ../../howto/enum.rst:1103 +msgid "" +"The default for Flag is ``STRICT``, the default for ``IntFlag`` is " +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." +"Options`` for an example of when ``KEEP`` is needed)." +msgstr "" + +#: ../../howto/enum.rst:1111 +msgid "How are Enums different?" +msgstr "" + +#: ../../howto/enum.rst:1113 +msgid "" +"Enums have a custom metaclass that affects many aspects of both derived :" +"class:`Enum` classes and their instances (members)." +msgstr "" + +#: ../../howto/enum.rst:1118 +msgid "Enum Classes" +msgstr "" + +#: ../../howto/enum.rst:1120 +msgid "" +"The :class:`EnumType` metaclass is responsible for providing the :meth:" +"`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " +"allow one to do things with an :class:`Enum` class that fail on a typical " +"class, such as `list(Color)` or `some_enum_var in Color`. :class:`EnumType` " +"is responsible for ensuring that various other methods on the final :class:" +"`Enum` class are correct (such as :meth:`__new__`, :meth:`__getnewargs__`, :" +"meth:`__str__` and :meth:`__repr__`)." +msgstr "" + +#: ../../howto/enum.rst:1130 +msgid "Enum Members (aka instances)" +msgstr "" + +#: ../../howto/enum.rst:1132 +msgid "" +"The most interesting thing about enum members is that they are singletons. :" +"class:`EnumType` creates them all while it is creating the enum class " +"itself, and then puts a custom :meth:`__new__` in place to ensure that no " +"new ones are ever instantiated by returning only the existing member " +"instances." +msgstr "" + +#: ../../howto/enum.rst:1141 +msgid "" +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" +"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " +"cover them all. Here are recipes for some different types of enumerations " +"that can be used directly, or as examples for creating one's own." +msgstr "" + +#: ../../howto/enum.rst:1148 +msgid "Omitting values" +msgstr "" + +#: ../../howto/enum.rst:1150 +msgid "" +"In many use-cases, one doesn't care what the actual value of an enumeration " +"is. There are several ways to define this type of simple enumeration:" +msgstr "" + +#: ../../howto/enum.rst:1153 +msgid "use instances of :class:`auto` for the value" +msgstr "" + +#: ../../howto/enum.rst:1154 +msgid "use instances of :class:`object` as the value" +msgstr "" + +#: ../../howto/enum.rst:1155 +msgid "use a descriptive string as the value" +msgstr "" + +#: ../../howto/enum.rst:1156 +msgid "" +"use a tuple as the value and a custom :meth:`__new__` to replace the tuple " +"with an :class:`int` value" +msgstr "" + +#: ../../howto/enum.rst:1159 +msgid "" +"Using any of these methods signifies to the user that these values are not " +"important, and also enables one to add, remove, or reorder members without " +"having to renumber the remaining members." +msgstr "" + +#: ../../howto/enum.rst:1165 +msgid "Using :class:`auto`" +msgstr "" + +#: ../../howto/enum.rst:1167 +msgid "Using :class:`auto` would look like::" +msgstr "" + +#: ../../howto/enum.rst:1179 +msgid "Using :class:`object`" +msgstr "" + +#: ../../howto/enum.rst:1181 +msgid "Using :class:`object` would look like::" +msgstr "" + +#: ../../howto/enum.rst:1191 +msgid "" +"This is also a good example of why you might want to write your own :meth:" +"`__repr__`::" +msgstr "" + +#: ../../howto/enum.rst:1207 +msgid "Using a descriptive string" +msgstr "" + +#: ../../howto/enum.rst:1209 +msgid "Using a string as the value would look like::" +msgstr "" + +#: ../../howto/enum.rst:1221 +msgid "Using a custom :meth:`__new__`" +msgstr "" + +#: ../../howto/enum.rst:1223 +msgid "Using an auto-numbering :meth:`__new__` would look like::" +msgstr "" + +#: ../../howto/enum.rst:1240 +msgid "" +"To make a more general purpose ``AutoNumber``, add ``*args`` to the " +"signature::" +msgstr "" + +#: ../../howto/enum.rst:1250 +msgid "" +"Then when you inherit from ``AutoNumber`` you can write your own " +"``__init__`` to handle any extra arguments::" +msgstr "" + +#: ../../howto/enum.rst:1269 +msgid "" +"The :meth:`__new__` method, if defined, is used during creation of the Enum " +"members; it is then replaced by Enum's :meth:`__new__` which is used after " +"class creation for lookup of existing members." +msgstr "" + +#: ../../howto/enum.rst:1275 +msgid "OrderedEnum" +msgstr "" + +#: ../../howto/enum.rst:1277 +msgid "" +"An ordered enumeration that is not based on :class:`IntEnum` and so " +"maintains the normal :class:`Enum` invariants (such as not being comparable " +"to other enumerations)::" +msgstr "" + +#: ../../howto/enum.rst:1311 +msgid "DuplicateFreeEnum" +msgstr "" + +#: ../../howto/enum.rst:1313 +msgid "" +"Raises an error if a duplicate member name is found instead of creating an " +"alias::" +msgstr "" + +#: ../../howto/enum.rst:1338 +msgid "" +"This is a useful example for subclassing Enum to add or change other " +"behaviors as well as disallowing aliases. If the only desired change is " +"disallowing aliases, the :func:`unique` decorator can be used instead." +msgstr "" + +#: ../../howto/enum.rst:1344 +msgid "Planet" +msgstr "" + +#: ../../howto/enum.rst:1346 +msgid "" +"If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum " +"member will be passed to those methods::" +msgstr "" + +#: ../../howto/enum.rst:1375 +msgid "TimePeriod" +msgstr "" + +#: ../../howto/enum.rst:1377 +msgid "An example to show the :attr:`_ignore_` attribute in use::" +msgstr "" + +#: ../../howto/enum.rst:1396 +msgid "Subclassing EnumType" +msgstr "" + +#: ../../howto/enum.rst:1398 +msgid "" +"While most enum needs can be met by customizing :class:`Enum` subclasses, " +"either with class decorators or custom functions, :class:`EnumType` can be " +"subclassed to provide a different Enum experience." +msgstr "" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po new file mode 100644 index 0000000000..4b6128f27b --- /dev/null +++ b/howto/isolating-extensions.po @@ -0,0 +1,633 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/isolating-extensions.rst:5 +msgid "Isolating Extension Modules" +msgstr "" + +#: ../../howto/isolating-extensions.rst:-1 +msgid "Abstract" +msgstr "" + +#: ../../howto/isolating-extensions.rst:9 +msgid "" +"Traditionally, state belonging to Python extension modules was kept in C " +"``static`` variables, which have process-wide scope. This document describes " +"problems of such per-process state and shows a safer way: per-module state." +msgstr "" + +#: ../../howto/isolating-extensions.rst:14 +msgid "" +"The document also describes how to switch to per-module state where " +"possible. This transition involves allocating space for that state, " +"potentially switching from static types to heap types, and—perhaps most " +"importantly—accessing per-module state from code." +msgstr "" + +#: ../../howto/isolating-extensions.rst:21 +msgid "Who should read this" +msgstr "" + +#: ../../howto/isolating-extensions.rst:23 +msgid "" +"This guide is written for maintainers of :ref:`C-API ` " +"extensions who would like to make that extension safer to use in " +"applications where Python itself is used as a library." +msgstr "" + +#: ../../howto/isolating-extensions.rst:29 +msgid "Background" +msgstr "" + +#: ../../howto/isolating-extensions.rst:31 +msgid "" +"An *interpreter* is the context in which Python code runs. It contains " +"configuration (e.g. the import path) and runtime state (e.g. the set of " +"imported modules)." +msgstr "" + +#: ../../howto/isolating-extensions.rst:35 +msgid "" +"Python supports running multiple interpreters in one process. There are two " +"cases to think about—users may run interpreters:" +msgstr "" + +#: ../../howto/isolating-extensions.rst:38 +msgid "" +"in sequence, with several :c:func:`Py_InitializeEx`/:c:func:`Py_FinalizeEx` " +"cycles, and" +msgstr "" + +#: ../../howto/isolating-extensions.rst:40 +msgid "" +"in parallel, managing \"sub-interpreters\" using :c:func:" +"`Py_NewInterpreter`/:c:func:`Py_EndInterpreter`." +msgstr "" + +#: ../../howto/isolating-extensions.rst:43 +msgid "" +"Both cases (and combinations of them) would be most useful when embedding " +"Python within a library. Libraries generally shouldn't make assumptions " +"about the application that uses them, which include assuming a process-wide " +"\"main Python interpreter\"." +msgstr "" + +#: ../../howto/isolating-extensions.rst:48 +msgid "" +"Historically, Python extension modules don't handle this use case well. Many " +"extension modules (and even some stdlib modules) use *per-process* global " +"state, because C ``static`` variables are extremely easy to use. Thus, data " +"that should be specific to an interpreter ends up being shared between " +"interpreters. Unless the extension developer is careful, it is very easy to " +"introduce edge cases that lead to crashes when a module is loaded in more " +"than one interpreter in the same process." +msgstr "" + +#: ../../howto/isolating-extensions.rst:56 +msgid "" +"Unfortunately, *per-interpreter* state is not easy to achieve. Extension " +"authors tend to not keep multiple interpreters in mind when developing, and " +"it is currently cumbersome to test the behavior." +msgstr "" + +#: ../../howto/isolating-extensions.rst:61 +msgid "Enter Per-Module State" +msgstr "" + +#: ../../howto/isolating-extensions.rst:63 +msgid "" +"Instead of focusing on per-interpreter state, Python's C API is evolving to " +"better support the more granular *per-module* state. This means that C-level " +"data is be attached to a *module object*. Each interpreter creates its own " +"module object, keeping the data separate. For testing the isolation, " +"multiple module objects corresponding to a single extension can even be " +"loaded in a single interpreter." +msgstr "" + +#: ../../howto/isolating-extensions.rst:70 +msgid "" +"Per-module state provides an easy way to think about lifetime and resource " +"ownership: the extension module will initialize when a module object is " +"created, and clean up when it's freed. In this regard, a module is just like " +"any other :c:expr:`PyObject *`; there are no \"on interpreter shutdown\" " +"hooks to think—or forget—about." +msgstr "" + +#: ../../howto/isolating-extensions.rst:76 +msgid "" +"Note that there are use cases for different kinds of \"globals\": per-" +"process, per-interpreter, per-thread or per-task state. With per-module " +"state as the default, these are still possible, but you should treat them as " +"exceptional cases: if you need them, you should give them additional care " +"and testing. (Note that this guide does not cover them.)" +msgstr "" + +#: ../../howto/isolating-extensions.rst:85 +msgid "Isolated Module Objects" +msgstr "" + +#: ../../howto/isolating-extensions.rst:87 +msgid "" +"The key point to keep in mind when developing an extension module is that " +"several module objects can be created from a single shared library. For " +"example:" +msgstr "" + +#: ../../howto/isolating-extensions.rst:101 +msgid "" +"As a rule of thumb, the two modules should be completely independent. All " +"objects and state specific to the module should be encapsulated within the " +"module object, not shared with other module objects, and cleaned up when the " +"module object is deallocated. Since this just is a rule of thumb, exceptions " +"are possible (see `Managing Global State`_), but they will need more thought " +"and attention to edge cases." +msgstr "" + +#: ../../howto/isolating-extensions.rst:109 +msgid "" +"While some modules could do with less stringent restrictions, isolated " +"modules make it easier to set clear expectations and guidelines that work " +"across a variety of use cases." +msgstr "" + +#: ../../howto/isolating-extensions.rst:115 +msgid "Surprising Edge Cases" +msgstr "" + +#: ../../howto/isolating-extensions.rst:117 +msgid "" +"Note that isolated modules do create some surprising edge cases. Most " +"notably, each module object will typically not share its classes and " +"exceptions with other similar modules. Continuing from the `example above " +"`__, note that ``old_binascii.Error`` and " +"``binascii.Error`` are separate objects. In the following code, the " +"exception is *not* caught:" +msgstr "" + +#: ../../howto/isolating-extensions.rst:137 +msgid "" +"This is expected. Notice that pure-Python modules behave the same way: it is " +"a part of how Python works." +msgstr "" + +#: ../../howto/isolating-extensions.rst:140 +msgid "" +"The goal is to make extension modules safe at the C level, not to make hacks " +"behave intuitively. Mutating ``sys.modules`` \"manually\" counts as a hack." +msgstr "" + +#: ../../howto/isolating-extensions.rst:146 +msgid "Making Modules Safe with Multiple Interpreters" +msgstr "" + +#: ../../howto/isolating-extensions.rst:150 +msgid "Managing Global State" +msgstr "" + +#: ../../howto/isolating-extensions.rst:152 +msgid "" +"Sometimes, the state associated with a Python module is not specific to that " +"module, but to the entire process (or something else \"more global\" than a " +"module). For example:" +msgstr "" + +#: ../../howto/isolating-extensions.rst:156 +msgid "The ``readline`` module manages *the* terminal." +msgstr "" + +#: ../../howto/isolating-extensions.rst:157 +msgid "" +"A module running on a circuit board wants to control *the* on-board LED." +msgstr "" + +#: ../../howto/isolating-extensions.rst:160 +msgid "" +"In these cases, the Python module should provide *access* to the global " +"state, rather than *own* it. If possible, write the module so that multiple " +"copies of it can access the state independently (along with other libraries, " +"whether for Python or other languages). If that is not possible, consider " +"explicit locking." +msgstr "" + +#: ../../howto/isolating-extensions.rst:166 +msgid "" +"If it is necessary to use process-global state, the simplest way to avoid " +"issues with multiple interpreters is to explicitly prevent a module from " +"being loaded more than once per process—see `Opt-Out: Limiting to One Module " +"Object per Process`_." +msgstr "" + +#: ../../howto/isolating-extensions.rst:173 +msgid "Managing Per-Module State" +msgstr "" + +#: ../../howto/isolating-extensions.rst:175 +msgid "" +"To use per-module state, use :ref:`multi-phase extension module " +"initialization `. This signals that your module " +"supports multiple interpreters correctly." +msgstr "" + +#: ../../howto/isolating-extensions.rst:179 +msgid "" +"Set ``PyModuleDef.m_size`` to a positive number to request that many bytes " +"of storage local to the module. Usually, this will be set to the size of " +"some module-specific ``struct``, which can store all of the module's C-level " +"state. In particular, it is where you should put pointers to classes " +"(including exceptions, but excluding static types) and settings (e.g. " +"``csv``'s :py:data:`~csv.field_size_limit`) which the C code needs to " +"function." +msgstr "" + +#: ../../howto/isolating-extensions.rst:188 +msgid "" +"Another option is to store state in the module's ``__dict__``, but you must " +"avoid crashing when users modify ``__dict__`` from Python code. This usually " +"means error- and type-checking at the C level, which is easy to get wrong " +"and hard to test sufficiently." +msgstr "" + +#: ../../howto/isolating-extensions.rst:193 +msgid "" +"However, if module state is not needed in C code, storing it in ``__dict__`` " +"only is a good idea." +msgstr "" + +#: ../../howto/isolating-extensions.rst:196 +msgid "" +"If the module state includes ``PyObject`` pointers, the module object must " +"hold references to those objects and implement the module-level hooks " +"``m_traverse``, ``m_clear`` and ``m_free``. These work like ``tp_traverse``, " +"``tp_clear`` and ``tp_free`` of a class. Adding them will require some work " +"and make the code longer; this is the price for modules which can be " +"unloaded cleanly." +msgstr "" + +#: ../../howto/isolating-extensions.rst:203 +msgid "" +"An example of a module with per-module state is currently available as " +"`xxlimited `__; example module initialization shown at the bottom of the file." +msgstr "" + +#: ../../howto/isolating-extensions.rst:209 +msgid "Opt-Out: Limiting to One Module Object per Process" +msgstr "" + +#: ../../howto/isolating-extensions.rst:211 +msgid "" +"A non-negative ``PyModuleDef.m_size`` signals that a module supports " +"multiple interpreters correctly. If this is not yet the case for your " +"module, you can explicitly make your module loadable only once per process. " +"For example::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:232 +msgid "Module State Access from Functions" +msgstr "" + +#: ../../howto/isolating-extensions.rst:234 +msgid "" +"Accessing the state from module-level functions is straightforward. " +"Functions get the module object as their first argument; for extracting the " +"state, you can use ``PyModule_GetState``::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:249 +msgid "" +"``PyModule_GetState`` may return ``NULL`` without setting an exception if " +"there is no module state, i.e. ``PyModuleDef.m_size`` was zero. In your own " +"module, you're in control of ``m_size``, so this is easy to prevent." +msgstr "" + +#: ../../howto/isolating-extensions.rst:256 +msgid "Heap Types" +msgstr "" + +#: ../../howto/isolating-extensions.rst:258 +msgid "" +"Traditionally, types defined in C code are *static*; that is, ``static " +"PyTypeObject`` structures defined directly in code and initialized using " +"``PyType_Ready()``." +msgstr "" + +#: ../../howto/isolating-extensions.rst:262 +msgid "" +"Such types are necessarily shared across the process. Sharing them between " +"module objects requires paying attention to any state they own or access. To " +"limit the possible issues, static types are immutable at the Python level: " +"for example, you can't set ``str.myattribute = 123``." +msgstr "" + +#: ../../howto/isolating-extensions.rst:268 +msgid "" +"Sharing truly immutable objects between interpreters is fine, as long as " +"they don't provide access to mutable objects. However, in CPython, every " +"Python object has a mutable implementation detail: the reference count. " +"Changes to the refcount are guarded by the GIL. Thus, code that shares any " +"Python objects across interpreters implicitly depends on CPython's current, " +"process-wide GIL." +msgstr "" + +#: ../../howto/isolating-extensions.rst:275 +msgid "" +"Because they are immutable and process-global, static types cannot access " +"\"their\" module state. If any method of such a type requires access to " +"module state, the type must be converted to a *heap-allocated type*, or " +"*heap type* for short. These correspond more closely to classes created by " +"Python's ``class`` statement." +msgstr "" + +#: ../../howto/isolating-extensions.rst:282 +msgid "For new modules, using heap types by default is a good rule of thumb." +msgstr "" + +#: ../../howto/isolating-extensions.rst:286 +msgid "Changing Static Types to Heap Types" +msgstr "" + +#: ../../howto/isolating-extensions.rst:288 +msgid "" +"Static types can be converted to heap types, but note that the heap type API " +"was not designed for \"lossless\" conversion from static types—that is, " +"creating a type that works exactly like a given static type. So, when " +"rewriting the class definition in a new API, you are likely to " +"unintentionally change a few details (e.g. pickleability or inherited " +"slots). Always test the details that are important to you." +msgstr "" + +#: ../../howto/isolating-extensions.rst:297 +msgid "" +"Watch out for the following two points in particular (but note that this is " +"not a comprehensive list):" +msgstr "" + +#: ../../howto/isolating-extensions.rst:300 +msgid "" +"Unlike static types, heap type objects are mutable by default. Use the :c:" +"data:`Py_TPFLAGS_IMMUTABLETYPE` flag to prevent mutability." +msgstr "" + +#: ../../howto/isolating-extensions.rst:302 +msgid "" +"Heap types inherit :c:member:`~PyTypeObject.tp_new` by default, so it may " +"become possible to instantiate them from Python code. You can prevent this " +"with the :c:data:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag." +msgstr "" + +#: ../../howto/isolating-extensions.rst:308 +msgid "Defining Heap Types" +msgstr "" + +#: ../../howto/isolating-extensions.rst:310 +msgid "" +"Heap types can be created by filling a :c:struct:`PyType_Spec` structure, a " +"description or \"blueprint\" of a class, and calling :c:func:" +"`PyType_FromModuleAndSpec` to construct a new class object." +msgstr "" + +#: ../../howto/isolating-extensions.rst:315 +msgid "" +"Other functions, like :c:func:`PyType_FromSpec`, can also create heap types, " +"but :c:func:`PyType_FromModuleAndSpec` associates the module with the class, " +"allowing access to the module state from methods." +msgstr "" + +#: ../../howto/isolating-extensions.rst:319 +msgid "" +"The class should generally be stored in *both* the module state (for safe " +"access from C) and the module's ``__dict__`` (for access from Python code)." +msgstr "" + +#: ../../howto/isolating-extensions.rst:325 +msgid "Garbage-Collection Protocol" +msgstr "" + +#: ../../howto/isolating-extensions.rst:327 +msgid "" +"Instances of heap types hold a reference to their type. This ensures that " +"the type isn't destroyed before all its instances are, but may result in " +"reference cycles that need to be broken by the garbage collector." +msgstr "" + +#: ../../howto/isolating-extensions.rst:332 +msgid "" +"To avoid memory leaks, instances of heap types must implement the garbage " +"collection protocol. That is, heap types should:" +msgstr "" + +#: ../../howto/isolating-extensions.rst:336 +msgid "Have the :c:data:`Py_TPFLAGS_HAVE_GC` flag." +msgstr "" + +#: ../../howto/isolating-extensions.rst:337 +msgid "" +"Define a traverse function using ``Py_tp_traverse``, which visits the type " +"(e.g. using :c:expr:`Py_VISIT(Py_TYPE(self))`)." +msgstr "" + +#: ../../howto/isolating-extensions.rst:340 +msgid "" +"Please refer to the :ref:`the documentation ` of :c:data:" +"`Py_TPFLAGS_HAVE_GC` and :c:member:`~PyTypeObject.tp_traverse` for " +"additional considerations." +msgstr "" + +#: ../../howto/isolating-extensions.rst:344 +msgid "" +"If your traverse function delegates to the ``tp_traverse`` of its base class " +"(or another type), ensure that ``Py_TYPE(self)`` is visited only once. Note " +"that only heap type are expected to visit the type in ``tp_traverse``." +msgstr "" + +#: ../../howto/isolating-extensions.rst:348 +msgid "For example, if your traverse function includes::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:352 +msgid "...and ``base`` may be a static type, then it should also include::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:360 +msgid "" +"It is not necessary to handle the type's reference count in ``tp_new`` and " +"``tp_clear``." +msgstr "" + +#: ../../howto/isolating-extensions.rst:365 +msgid "Module State Access from Classes" +msgstr "" + +#: ../../howto/isolating-extensions.rst:367 +msgid "" +"If you have a type object defined with :c:func:`PyType_FromModuleAndSpec`, " +"you can call :c:func:`PyType_GetModule` to get the associated module, and " +"then :c:func:`PyModule_GetState` to get the module's state." +msgstr "" + +#: ../../howto/isolating-extensions.rst:371 +msgid "" +"To save a some tedious error-handling boilerplate code, you can combine " +"these two steps with :c:func:`PyType_GetModuleState`, resulting in::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:381 +msgid "Module State Access from Regular Methods" +msgstr "" + +#: ../../howto/isolating-extensions.rst:383 +msgid "" +"Accessing the module-level state from methods of a class is somewhat more " +"complicated, but is possible thanks to API introduced in Python 3.9. To get " +"the state, you need to first get the *defining class*, and then get the " +"module state from it." +msgstr "" + +#: ../../howto/isolating-extensions.rst:388 +msgid "" +"The largest roadblock is getting *the class a method was defined in*, or " +"that method's \"defining class\" for short. The defining class can have a " +"reference to the module it is part of." +msgstr "" + +#: ../../howto/isolating-extensions.rst:392 +msgid "" +"Do not confuse the defining class with :c:expr:`Py_TYPE(self)`. If the " +"method is called on a *subclass* of your type, ``Py_TYPE(self)`` will refer " +"to that subclass, which may be defined in different module than yours." +msgstr "" + +#: ../../howto/isolating-extensions.rst:397 +msgid "" +"The following Python code can illustrate the concept. ``Base." +"get_defining_class`` returns ``Base`` even if ``type(self) == Sub``:" +msgstr "" + +#: ../../howto/isolating-extensions.rst:413 +msgid "" +"For a method to get its \"defining class\", it must use the :data:" +"`METH_METHOD | METH_FASTCALL | METH_KEYWORDS` :c:type:`calling convention " +"` and the corresponding :c:type:`PyCMethod` signature::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:425 +msgid "" +"Once you have the defining class, call :c:func:`PyType_GetModuleState` to " +"get the state of its associated module." +msgstr "" + +#: ../../howto/isolating-extensions.rst:428 +msgid "For example::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:456 +msgid "Module State Access from Slot Methods, Getters and Setters" +msgstr "" + +#: ../../howto/isolating-extensions.rst:460 +msgid "This is new in Python 3.11." +msgstr "" + +#: ../../howto/isolating-extensions.rst:468 +msgid "" +"Slot methods—the fast C equivalents for special methods, such as :c:member:" +"`~PyNumberMethods.nb_add` for :py:attr:`~object.__add__` or :c:member:" +"`~PyType.tp_new` for initialization—have a very simple API that doesn't " +"allow passing in the defining class, unlike with :c:type:`PyCMethod`. The " +"same goes for getters and setters defined with :c:type:`PyGetSetDef`." +msgstr "" + +#: ../../howto/isolating-extensions.rst:475 +msgid "" +"To access the module state in these cases, use the :c:func:" +"`PyType_GetModuleByDef` function, and pass in the module definition. Once " +"you have the module, call :c:func:`PyModule_GetState` to get the state::" +msgstr "" + +#: ../../howto/isolating-extensions.rst:486 +msgid "" +"``PyType_GetModuleByDef`` works by searching the :term:`method resolution " +"order` (i.e. all superclasses) for the first superclass that has a " +"corresponding module." +msgstr "" + +#: ../../howto/isolating-extensions.rst:492 +msgid "" +"In very exotic cases (inheritance chains spanning multiple modules created " +"from the same definition), ``PyType_GetModuleByDef`` might not return the " +"module of the true defining class. However, it will always return a module " +"with the same definition, ensuring a compatible C memory layout." +msgstr "" + +#: ../../howto/isolating-extensions.rst:500 +msgid "Lifetime of the Module State" +msgstr "" + +#: ../../howto/isolating-extensions.rst:502 +msgid "" +"When a module object is garbage-collected, its module state is freed. For " +"each pointer to (a part of) the module state, you must hold a reference to " +"the module object." +msgstr "" + +#: ../../howto/isolating-extensions.rst:506 +msgid "" +"Usually this is not an issue, because types created with :c:func:" +"`PyType_FromModuleAndSpec`, and their instances, hold a reference to the " +"module. However, you must be careful in reference counting when you " +"reference module state from other places, such as callbacks for external " +"libraries." +msgstr "" + +#: ../../howto/isolating-extensions.rst:515 +msgid "Open Issues" +msgstr "" + +#: ../../howto/isolating-extensions.rst:517 +msgid "Several issues around per-module state and heap types are still open." +msgstr "" + +#: ../../howto/isolating-extensions.rst:519 +msgid "" +"Discussions about improving the situation are best held on the `capi-sig " +"mailing list `__." +msgstr "" + +#: ../../howto/isolating-extensions.rst:524 +msgid "Per-Class Scope" +msgstr "" + +#: ../../howto/isolating-extensions.rst:526 +msgid "" +"It is currently (as of Python 3.11) not possible to attach state to " +"individual *types* without relying on CPython implementation details (which " +"may change in the future—perhaps, ironically, to allow a proper solution for " +"per-class scope)." +msgstr "" + +#: ../../howto/isolating-extensions.rst:533 +msgid "Lossless Conversion to Heap Types" +msgstr "" + +#: ../../howto/isolating-extensions.rst:535 +msgid "" +"The heap type API was not designed for \"lossless\" conversion from static " +"types; that is, creating a type that works exactly like a given static type." +msgstr "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 2352c5cf9d..c7001bc070 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" +"POT-Creation-Date: 2022-10-16 07:36+0800\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-" @@ -158,33 +158,103 @@ msgid "" "files in it." msgstr "" -#: ../../howto/logging-cookbook.rst:280 +#: ../../howto/logging-cookbook.rst:282 +msgid "Custom handling of levels" +msgstr "" + +#: ../../howto/logging-cookbook.rst:284 +msgid "" +"Sometimes, you might want to do something slightly different from the " +"standard handling of levels in handlers, where all levels above a threshold " +"get processed by a handler. To do this, you need to use filters. Let's look " +"at a scenario where you want to arrange things as follows:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:289 +msgid "Send messages of severity ``INFO`` and ``WARNING`` to ``sys.stdout``" +msgstr "" + +#: ../../howto/logging-cookbook.rst:290 +msgid "Send messages of severity ``ERROR`` and above to ``sys.stderr``" +msgstr "" + +#: ../../howto/logging-cookbook.rst:291 +msgid "Send messages of severity ``DEBUG`` and above to file ``app.log``" +msgstr "" + +#: ../../howto/logging-cookbook.rst:293 +msgid "Suppose you configure logging with the following JSON:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:335 +msgid "" +"This configuration does *almost* what we want, except that ``sys.stdout`` " +"would show messages of severity ``ERROR`` and above as well as ``INFO`` and " +"``WARNING`` messages. To prevent this, we can set up a filter which excludes " +"those messages and add it to the relevant handler. This can be configured by " +"adding a ``filters`` section parallel to ``formatters`` and ``handlers``:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:350 +msgid "and changing the section on the ``stdout`` handler to add it:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:362 +msgid "" +"A filter is just a function, so we can define the ``filter_maker`` (a " +"factory function) as follows:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:375 +msgid "" +"This converts the string argument passed in to a numeric level, and returns " +"a function which only returns ``True`` if the level of the passed in record " +"is at or below the specified level. Note that in this example I have defined " +"the ``filter_maker`` in a test script ``main.py`` that I run from the " +"command line, so its module will be ``__main__`` - hence the ``__main__." +"filter_maker`` in the filter configuration. You will need to change that if " +"you define it in a different module." +msgstr "" + +#: ../../howto/logging-cookbook.rst:383 +msgid "With the filter added, we can run ``main.py``, which in full is:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:453 +msgid "And after running it like this:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:459 +msgid "We can see the results are as expected:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:485 msgid "Configuration server example" msgstr "" -#: ../../howto/logging-cookbook.rst:282 +#: ../../howto/logging-cookbook.rst:487 msgid "Here is an example of a module using the logging configuration server::" msgstr "" -#: ../../howto/logging-cookbook.rst:313 +#: ../../howto/logging-cookbook.rst:518 msgid "" "And here is a script that takes a filename and sends that file to the " "server, properly preceded with the binary-encoded length, as the new logging " "configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:338 +#: ../../howto/logging-cookbook.rst:543 msgid "Dealing with handlers that block" msgstr "" -#: ../../howto/logging-cookbook.rst:342 +#: ../../howto/logging-cookbook.rst:547 msgid "" "Sometimes you have to get your logging handlers to do their work without " "blocking the thread you're logging from. This is common in web applications, " "though of course it also occurs in other scenarios." msgstr "" -#: ../../howto/logging-cookbook.rst:346 +#: ../../howto/logging-cookbook.rst:551 msgid "" "A common culprit which demonstrates sluggish behaviour is the :class:" "`SMTPHandler`: sending emails can take a long time, for a number of reasons " @@ -195,7 +265,7 @@ msgid "" "below the Python layer, and outside your control)." msgstr "" -#: ../../howto/logging-cookbook.rst:354 +#: ../../howto/logging-cookbook.rst:559 msgid "" "One solution is to use a two-part approach. For the first part, attach only " "a :class:`QueueHandler` to those loggers which are accessed from performance-" @@ -209,7 +279,7 @@ msgid "" "developers who will use your code." msgstr "" -#: ../../howto/logging-cookbook.rst:365 +#: ../../howto/logging-cookbook.rst:570 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " "designed as the counterpart to :class:`QueueHandler`. A :class:" @@ -220,7 +290,7 @@ msgid "" "handlers for processing." msgstr "" -#: ../../howto/logging-cookbook.rst:373 +#: ../../howto/logging-cookbook.rst:578 msgid "" "The advantage of having a separate :class:`QueueListener` class is that you " "can use the same instance to service multiple ``QueueHandlers``. This is " @@ -229,15 +299,15 @@ msgid "" "benefit." msgstr "" -#: ../../howto/logging-cookbook.rst:378 +#: ../../howto/logging-cookbook.rst:583 msgid "An example of using these two classes follows (imports omitted)::" msgstr "" -#: ../../howto/logging-cookbook.rst:396 +#: ../../howto/logging-cookbook.rst:601 msgid "which, when run, will produce:" msgstr "" -#: ../../howto/logging-cookbook.rst:402 +#: ../../howto/logging-cookbook.rst:607 msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " @@ -248,7 +318,7 @@ msgid "" "code runs only in the ``QueueListener`` thread." msgstr "" -#: ../../howto/logging-cookbook.rst:410 +#: ../../howto/logging-cookbook.rst:615 msgid "" "Prior to Python 3.5, the :class:`QueueListener` always passed every message " "received from the queue to every handler it was initialized with. (This was " @@ -260,30 +330,30 @@ msgid "" "handler if it's appropriate to do so." msgstr "" -#: ../../howto/logging-cookbook.rst:423 +#: ../../howto/logging-cookbook.rst:628 msgid "Sending and receiving logging events across a network" msgstr "" -#: ../../howto/logging-cookbook.rst:425 +#: ../../howto/logging-cookbook.rst:630 msgid "" "Let's say you want to send logging events across a network, and handle them " "at the receiving end. A simple way of doing this is attaching a :class:" "`SocketHandler` instance to the root logger at the sending end::" msgstr "" -#: ../../howto/logging-cookbook.rst:453 +#: ../../howto/logging-cookbook.rst:658 msgid "" "At the receiving end, you can set up a receiver using the :mod:" "`socketserver` module. Here is a basic working example::" msgstr "" -#: ../../howto/logging-cookbook.rst:541 +#: ../../howto/logging-cookbook.rst:746 msgid "" "First run the server, and then the client. On the client side, nothing is " "printed on the console; on the server side, you should see something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:553 +#: ../../howto/logging-cookbook.rst:758 msgid "" "Note that there are some security issues with pickle in some scenarios. If " "these affect you, you can use an alternative serialization scheme by " @@ -292,11 +362,11 @@ msgid "" "use your alternative serialization." msgstr "" -#: ../../howto/logging-cookbook.rst:561 +#: ../../howto/logging-cookbook.rst:766 msgid "Running a logging socket listener in production" msgstr "" -#: ../../howto/logging-cookbook.rst:563 +#: ../../howto/logging-cookbook.rst:768 msgid "" "To run a logging listener in production, you may need to use a process-" "management tool such as `Supervisor `_. `Here " @@ -306,11 +376,11 @@ msgid "" "to reflect the actual paths you want to use." msgstr "" -#: ../../howto/logging-cookbook.rst:574 +#: ../../howto/logging-cookbook.rst:779 msgid "Adding contextual information to your logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:576 +#: ../../howto/logging-cookbook.rst:781 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -326,11 +396,11 @@ msgid "" "`Logger` instances becomes effectively unbounded." msgstr "" -#: ../../howto/logging-cookbook.rst:591 +#: ../../howto/logging-cookbook.rst:796 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:593 +#: ../../howto/logging-cookbook.rst:798 msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " @@ -341,7 +411,7 @@ msgid "" "types of instances interchangeably." msgstr "" -#: ../../howto/logging-cookbook.rst:601 +#: ../../howto/logging-cookbook.rst:806 msgid "" "When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" "`Logger` instance and a dict-like object which contains your contextual " @@ -352,7 +422,7 @@ msgid "" "of :class:`LoggerAdapter`::" msgstr "" -#: ../../howto/logging-cookbook.rst:617 +#: ../../howto/logging-cookbook.rst:822 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -365,7 +435,7 @@ msgid "" "be silently overwritten." msgstr "" -#: ../../howto/logging-cookbook.rst:626 +#: ../../howto/logging-cookbook.rst:831 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " @@ -376,21 +446,21 @@ msgid "" "`~LoggerAdapter.process` to do what you need. Here is a simple example::" msgstr "" -#: ../../howto/logging-cookbook.rst:642 +#: ../../howto/logging-cookbook.rst:847 msgid "which you can use like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:647 +#: ../../howto/logging-cookbook.rst:852 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: ../../howto/logging-cookbook.rst:651 +#: ../../howto/logging-cookbook.rst:856 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:653 +#: ../../howto/logging-cookbook.rst:858 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -399,11 +469,11 @@ msgid "" "would be constant)." msgstr "" -#: ../../howto/logging-cookbook.rst:662 +#: ../../howto/logging-cookbook.rst:867 msgid "Using Filters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:664 +#: ../../howto/logging-cookbook.rst:869 msgid "" "You can also add contextual information to log output using a user-defined :" "class:`Filter`. ``Filter`` instances are allowed to modify the " @@ -412,7 +482,7 @@ msgid "" "class:`Formatter`." msgstr "" -#: ../../howto/logging-cookbook.rst:669 +#: ../../howto/logging-cookbook.rst:874 msgid "" "For example in a web application, the request being processed (or at least, " "the interesting parts of it) can be stored in a threadlocal (:class:" @@ -424,15 +494,15 @@ msgid "" "an example script::" msgstr "" -#: ../../howto/logging-cookbook.rst:715 +#: ../../howto/logging-cookbook.rst:920 msgid "which, when run, produces something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:733 +#: ../../howto/logging-cookbook.rst:938 msgid "Use of ``contextvars``" msgstr "" -#: ../../howto/logging-cookbook.rst:735 +#: ../../howto/logging-cookbook.rst:940 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -442,7 +512,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: ../../howto/logging-cookbook.rst:741 +#: ../../howto/logging-cookbook.rst:946 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -453,18 +523,18 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: ../../howto/logging-cookbook.rst:748 +#: ../../howto/logging-cookbook.rst:953 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: ../../howto/logging-cookbook.rst:764 +#: ../../howto/logging-cookbook.rst:969 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: ../../howto/logging-cookbook.rst:908 +#: ../../howto/logging-cookbook.rst:1113 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -475,11 +545,11 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: ../../howto/logging-cookbook.rst:955 +#: ../../howto/logging-cookbook.rst:1160 msgid "Imparting contextual information in handlers" msgstr "" -#: ../../howto/logging-cookbook.rst:957 +#: ../../howto/logging-cookbook.rst:1162 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -487,11 +557,11 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: ../../howto/logging-cookbook.rst:984 +#: ../../howto/logging-cookbook.rst:1189 msgid "Logging to a single file from multiple processes" msgstr "" -#: ../../howto/logging-cookbook.rst:986 +#: ../../howto/logging-cookbook.rst:1191 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -507,7 +577,7 @@ msgid "" "you to adapt in your own applications." msgstr "" -#: ../../howto/logging-cookbook.rst:999 +#: ../../howto/logging-cookbook.rst:1204 msgid "" "You could also write your own handler which uses the :class:" "`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " @@ -518,7 +588,7 @@ msgid "" "platforms (see https://bugs.python.org/issue3770)." msgstr "" -#: ../../howto/logging-cookbook.rst:1009 +#: ../../howto/logging-cookbook.rst:1214 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -533,13 +603,13 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1125 +#: ../../howto/logging-cookbook.rst:1330 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1220 +#: ../../howto/logging-cookbook.rst:1425 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -549,34 +619,34 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1227 +#: ../../howto/logging-cookbook.rst:1432 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "" -#: ../../howto/logging-cookbook.rst:1229 +#: ../../howto/logging-cookbook.rst:1434 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1237 +#: ../../howto/logging-cookbook.rst:1442 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1243 +#: ../../howto/logging-cookbook.rst:1448 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1254 +#: ../../howto/logging-cookbook.rst:1459 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1261 +#: ../../howto/logging-cookbook.rst:1466 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1263 +#: ../../howto/logging-cookbook.rst:1468 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -588,11 +658,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1273 +#: ../../howto/logging-cookbook.rst:1478 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1278 +#: ../../howto/logging-cookbook.rst:1483 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -602,13 +672,13 @@ msgid "" "RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1310 +#: ../../howto/logging-cookbook.rst:1515 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1322 +#: ../../howto/logging-cookbook.rst:1527 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -616,17 +686,17 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1327 +#: ../../howto/logging-cookbook.rst:1532 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1333 +#: ../../howto/logging-cookbook.rst:1538 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1335 +#: ../../howto/logging-cookbook.rst:1540 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " @@ -635,7 +705,7 @@ msgid "" "Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1341 +#: ../../howto/logging-cookbook.rst:1546 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -648,14 +718,14 @@ msgid "" "session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1375 +#: ../../howto/logging-cookbook.rst:1580 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1383 +#: ../../howto/logging-cookbook.rst:1588 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -671,7 +741,7 @@ msgid "" "strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1396 +#: ../../howto/logging-cookbook.rst:1601 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -680,7 +750,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1420 +#: ../../howto/logging-cookbook.rst:1625 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -691,21 +761,21 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1428 +#: ../../howto/logging-cookbook.rst:1633 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1450 +#: ../../howto/logging-cookbook.rst:1655 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1454 +#: ../../howto/logging-cookbook.rst:1659 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -716,23 +786,23 @@ msgid "" "sugar for a constructor call to one of the XXXMessage classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1462 +#: ../../howto/logging-cookbook.rst:1667 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1493 +#: ../../howto/logging-cookbook.rst:1698 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.2 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1502 +#: ../../howto/logging-cookbook.rst:1707 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1504 +#: ../../howto/logging-cookbook.rst:1709 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " "event is logged and not filtered out by a logger's level, a :class:" @@ -743,13 +813,13 @@ msgid "" "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1511 +#: ../../howto/logging-cookbook.rst:1716 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1514 +#: ../../howto/logging-cookbook.rst:1719 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " @@ -758,27 +828,27 @@ msgid "" "`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1520 +#: ../../howto/logging-cookbook.rst:1725 msgid "" "This has usually meant that if you need to do anything special with a :class:" "`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1523 +#: ../../howto/logging-cookbook.rst:1728 msgid "" "Create your own :class:`Logger` subclass, which overrides :meth:`Logger." "makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " "loggers that you care about are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1526 +#: ../../howto/logging-cookbook.rst:1731 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1530 +#: ../../howto/logging-cookbook.rst:1735 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -786,7 +856,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1535 +#: ../../howto/logging-cookbook.rst:1740 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -795,7 +865,7 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1543 +#: ../../howto/logging-cookbook.rst:1748 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -805,7 +875,7 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1549 +#: ../../howto/logging-cookbook.rst:1754 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " @@ -815,7 +885,7 @@ msgid "" "`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1556 +#: ../../howto/logging-cookbook.rst:1761 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -823,7 +893,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1569 +#: ../../howto/logging-cookbook.rst:1774 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -833,70 +903,70 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1580 +#: ../../howto/logging-cookbook.rst:1785 msgid "Subclassing QueueHandler - a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1582 +#: ../../howto/logging-cookbook.rst:1787 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1601 +#: ../../howto/logging-cookbook.rst:1806 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1619 +#: ../../howto/logging-cookbook.rst:1824 msgid "Subclassing QueueListener - a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1621 +#: ../../howto/logging-cookbook.rst:1826 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1640 ../../howto/logging-cookbook.rst:3522 +#: ../../howto/logging-cookbook.rst:1845 ../../howto/logging-cookbook.rst:3800 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:1640 ../../howto/logging-cookbook.rst:3522 +#: ../../howto/logging-cookbook.rst:1845 ../../howto/logging-cookbook.rst:3800 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:1643 ../../howto/logging-cookbook.rst:3525 +#: ../../howto/logging-cookbook.rst:1848 ../../howto/logging-cookbook.rst:3803 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:1643 ../../howto/logging-cookbook.rst:3525 +#: ../../howto/logging-cookbook.rst:1848 ../../howto/logging-cookbook.rst:3803 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:1646 ../../howto/logging-cookbook.rst:3528 +#: ../../howto/logging-cookbook.rst:1851 ../../howto/logging-cookbook.rst:3806 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:1646 ../../howto/logging-cookbook.rst:3528 +#: ../../howto/logging-cookbook.rst:1851 ../../howto/logging-cookbook.rst:3806 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:1648 +#: ../../howto/logging-cookbook.rst:1853 msgid ":ref:`A basic logging tutorial `" msgstr "" -#: ../../howto/logging-cookbook.rst:1650 +#: ../../howto/logging-cookbook.rst:1855 msgid ":ref:`A more advanced logging tutorial `" msgstr "" -#: ../../howto/logging-cookbook.rst:1654 +#: ../../howto/logging-cookbook.rst:1859 msgid "An example dictionary-based configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:1656 +#: ../../howto/logging-cookbook.rst:1861 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:1719 +#: ../../howto/logging-cookbook.rst:1924 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:1721 +#: ../../howto/logging-cookbook.rst:1926 msgid "" "An example of how you can define a namer and rotator is given in the " "following snippet, which shows zlib-based compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:1739 +#: ../../howto/logging-cookbook.rst:1944 msgid "" "These are not \"true\" .gz files, as they are bare compressed data, with no " "\"container\" such as you’d find in an actual gzip file. This snippet is " "just for illustration purposes." msgstr "" -#: ../../howto/logging-cookbook.rst:1744 +#: ../../howto/logging-cookbook.rst:1949 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:1746 +#: ../../howto/logging-cookbook.rst:1951 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -940,7 +1010,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:1751 +#: ../../howto/logging-cookbook.rst:1956 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -953,17 +1023,17 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:1761 +#: ../../howto/logging-cookbook.rst:1966 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:1973 +#: ../../howto/logging-cookbook.rst:2178 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:1975 +#: ../../howto/logging-cookbook.rst:2180 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -972,7 +1042,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:1981 +#: ../../howto/logging-cookbook.rst:2186 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -980,7 +1050,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:1987 +#: ../../howto/logging-cookbook.rst:2192 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -989,33 +1059,33 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:1993 +#: ../../howto/logging-cookbook.rst:2198 msgid "" "Attach a :class:`~logging.Formatter` instance to your :class:`~logging." "handlers.SysLogHandler` instance, with a format string such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:1999 +#: ../../howto/logging-cookbook.rst:2204 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2002 +#: ../../howto/logging-cookbook.rst:2207 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2006 +#: ../../howto/logging-cookbook.rst:2211 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2010 +#: ../../howto/logging-cookbook.rst:2215 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -1024,11 +1094,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2017 +#: ../../howto/logging-cookbook.rst:2222 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2019 +#: ../../howto/logging-cookbook.rst:2224 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -1040,31 +1110,31 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2043 +#: ../../howto/logging-cookbook.rst:2248 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2049 ../../howto/logging-cookbook.rst:2091 +#: ../../howto/logging-cookbook.rst:2254 ../../howto/logging-cookbook.rst:2296 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2052 +#: ../../howto/logging-cookbook.rst:2257 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2085 +#: ../../howto/logging-cookbook.rst:2290 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2100 +#: ../../howto/logging-cookbook.rst:2305 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2102 +#: ../../howto/logging-cookbook.rst:2307 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -1074,24 +1144,24 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2116 +#: ../../howto/logging-cookbook.rst:2321 msgid "" "You can then specify, in a logging configuration passed to :func:" "`dictConfig`, that a logging handler be created by calling this function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2149 +#: ../../howto/logging-cookbook.rst:2354 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2196 +#: ../../howto/logging-cookbook.rst:2401 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2206 +#: ../../howto/logging-cookbook.rst:2411 msgid "" "Note that this example uses Python 3.3 because that's where :func:`shutil." "chown` makes an appearance. This approach should work with any Python " @@ -1100,17 +1170,17 @@ msgid "" "change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2212 +#: ../../howto/logging-cookbook.rst:2417 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2217 +#: ../../howto/logging-cookbook.rst:2422 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2221 +#: ../../howto/logging-cookbook.rst:2426 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -1118,25 +1188,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2226 +#: ../../howto/logging-cookbook.rst:2431 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2230 +#: ../../howto/logging-cookbook.rst:2435 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2240 +#: ../../howto/logging-cookbook.rst:2445 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2242 +#: ../../howto/logging-cookbook.rst:2447 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -1147,7 +1217,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2249 +#: ../../howto/logging-cookbook.rst:2454 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -1162,7 +1232,7 @@ msgid "" "calls which are out there in existing code will be using %-format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2261 +#: ../../howto/logging-cookbook.rst:2466 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -1170,7 +1240,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2265 +#: ../../howto/logging-cookbook.rst:2470 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -1178,11 +1248,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2272 +#: ../../howto/logging-cookbook.rst:2477 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2274 +#: ../../howto/logging-cookbook.rst:2479 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -1197,17 +1267,17 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2285 +#: ../../howto/logging-cookbook.rst:2490 msgid "" "Refer to the reference documentation on :func:`setLogRecordFactory` and :" "class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2290 +#: ../../howto/logging-cookbook.rst:2495 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2292 +#: ../../howto/logging-cookbook.rst:2497 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " "to construct your individual log messages. You may recall (from :ref:" @@ -1217,7 +1287,7 @@ msgid "" "following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2317 +#: ../../howto/logging-cookbook.rst:2522 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -1228,17 +1298,17 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2325 +#: ../../howto/logging-cookbook.rst:2530 msgid "" "Examples of this approach are given below. Firstly, formatting with :meth:" "`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2339 +#: ../../howto/logging-cookbook.rst:2544 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2346 +#: ../../howto/logging-cookbook.rst:2551 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -1250,11 +1320,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2360 +#: ../../howto/logging-cookbook.rst:2565 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2362 +#: ../../howto/logging-cookbook.rst:2567 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " @@ -1269,22 +1339,22 @@ msgid "" "complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2415 +#: ../../howto/logging-cookbook.rst:2620 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2423 +#: ../../howto/logging-cookbook.rst:2628 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2425 +#: ../../howto/logging-cookbook.rst:2630 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2427 +#: ../../howto/logging-cookbook.rst:2632 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -1294,7 +1364,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2434 +#: ../../howto/logging-cookbook.rst:2639 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -1303,11 +1373,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2443 +#: ../../howto/logging-cookbook.rst:2648 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2445 +#: ../../howto/logging-cookbook.rst:2650 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -1315,22 +1385,22 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2486 +#: ../../howto/logging-cookbook.rst:2691 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2493 +#: ../../howto/logging-cookbook.rst:2698 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2500 +#: ../../howto/logging-cookbook.rst:2705 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2502 +#: ../../howto/logging-cookbook.rst:2707 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " @@ -1347,24 +1417,24 @@ msgid "" "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2544 +#: ../../howto/logging-cookbook.rst:2749 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:2546 +#: ../../howto/logging-cookbook.rst:2751 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:2554 +#: ../../howto/logging-cookbook.rst:2759 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:2556 +#: ../../howto/logging-cookbook.rst:2761 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -1374,7 +1444,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:2563 +#: ../../howto/logging-cookbook.rst:2768 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -1387,7 +1457,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:2573 +#: ../../howto/logging-cookbook.rst:2778 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -1396,7 +1466,7 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:2579 +#: ../../howto/logging-cookbook.rst:2784 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " @@ -1408,30 +1478,30 @@ msgid "" "respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:2587 +#: ../../howto/logging-cookbook.rst:2792 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:2650 +#: ../../howto/logging-cookbook.rst:2855 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2680 +#: ../../howto/logging-cookbook.rst:2885 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:2684 +#: ../../howto/logging-cookbook.rst:2889 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2694 +#: ../../howto/logging-cookbook.rst:2899 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:2696 +#: ../../howto/logging-cookbook.rst:2901 msgid "" "To illustrate how you can send log messages via email, so that a set number " "of messages are sent per email, you can subclass :class:`~logging.handlers." @@ -1442,7 +1512,7 @@ msgid "" "argument to see the required and optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2768 +#: ../../howto/logging-cookbook.rst:2973 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -1450,17 +1520,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:2776 +#: ../../howto/logging-cookbook.rst:2981 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2778 +#: ../../howto/logging-cookbook.rst:2983 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as `UTCFormatter`, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:2787 +#: ../../howto/logging-cookbook.rst:2992 msgid "" "and you can then use the ``UTCFormatter`` in your code instead of :class:" "`~logging.Formatter`. If you want to do that via configuration, you can use " @@ -1468,21 +1538,21 @@ msgid "" "the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2830 +#: ../../howto/logging-cookbook.rst:3035 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:2837 +#: ../../howto/logging-cookbook.rst:3042 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:2844 +#: ../../howto/logging-cookbook.rst:3049 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2846 +#: ../../howto/logging-cookbook.rst:3051 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -1492,7 +1562,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:2879 +#: ../../howto/logging-cookbook.rst:3084 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -1501,13 +1571,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:2885 +#: ../../howto/logging-cookbook.rst:3090 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:2903 +#: ../../howto/logging-cookbook.rst:3108 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -1520,56 +1590,56 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:2913 +#: ../../howto/logging-cookbook.rst:3118 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:2924 +#: ../../howto/logging-cookbook.rst:3129 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2932 +#: ../../howto/logging-cookbook.rst:3137 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:2942 +#: ../../howto/logging-cookbook.rst:3147 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:2944 +#: ../../howto/logging-cookbook.rst:3149 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:2952 +#: ../../howto/logging-cookbook.rst:3157 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:2954 +#: ../../howto/logging-cookbook.rst:3159 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:2956 +#: ../../howto/logging-cookbook.rst:3161 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:2957 +#: ../../howto/logging-cookbook.rst:3162 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:2959 +#: ../../howto/logging-cookbook.rst:3164 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2961 +#: ../../howto/logging-cookbook.rst:3166 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " @@ -1580,53 +1650,53 @@ msgid "" "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3010 +#: ../../howto/logging-cookbook.rst:3215 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3023 +#: ../../howto/logging-cookbook.rst:3228 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3044 +#: ../../howto/logging-cookbook.rst:3249 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3065 +#: ../../howto/logging-cookbook.rst:3270 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3078 +#: ../../howto/logging-cookbook.rst:3283 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3081 +#: ../../howto/logging-cookbook.rst:3286 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3098 +#: ../../howto/logging-cookbook.rst:3303 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3106 +#: ../../howto/logging-cookbook.rst:3311 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3112 +#: ../../howto/logging-cookbook.rst:3317 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3114 +#: ../../howto/logging-cookbook.rst:3319 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" @@ -1634,7 +1704,7 @@ msgid "" "project/PySide2/>`_ or `PyQt5 `_ libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3120 +#: ../../howto/logging-cookbook.rst:3325 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -1644,14 +1714,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3127 +#: ../../howto/logging-cookbook.rst:3332 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3131 +#: ../../howto/logging-cookbook.rst:3336 msgid "" "The code should work with recent releases of either ``PySide2`` or " "``PyQt5``. You should be able to adapt the approach to earlier versions of " @@ -1659,11 +1729,11 @@ msgid "" "information." msgstr "" -#: ../../howto/logging-cookbook.rst:3345 +#: ../../howto/logging-cookbook.rst:3550 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3347 +#: ../../howto/logging-cookbook.rst:3552 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "detault to use the older :rfc:`3164`, which hails from 2001. When " @@ -1673,14 +1743,14 @@ msgid "" "handlers.SysLogHandler` functionality has not been updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3354 +#: ../../howto/logging-cookbook.rst:3559 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3420 +#: ../../howto/logging-cookbook.rst:3625 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -1689,11 +1759,48 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3437 +#: ../../howto/logging-cookbook.rst:3639 +msgid "How to treat a logger like an output stream" +msgstr "" + +#: ../../howto/logging-cookbook.rst:3641 +msgid "" +"Sometimes, you need to interface to a third-party API which expects a file-" +"like object to write to, but you want to direct the API's output to a " +"logger. You can do this using a class which wraps a logger with a file-like " +"API. Here's a short script illustrating such a class:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:3681 +msgid "When this script is run, it prints" +msgstr "" + +#: ../../howto/logging-cookbook.rst:3688 +msgid "" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." +"stderr`` by doing something like this:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:3698 +msgid "" +"You should do this *after* configuring logging for your needs. In the above " +"example, the :func:`~logging.basicConfig` call does this (using the ``sys." +"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " +"Then, you'd get this kind of result:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:3711 +msgid "" +"Of course, the examples above show output according to the format used by :" +"func:`~logging.basicConfig`, but you can use a different formatter when you " +"configure logging." +msgstr "" + +#: ../../howto/logging-cookbook.rst:3718 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:3439 +#: ../../howto/logging-cookbook.rst:3720 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -1701,11 +1808,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:3446 +#: ../../howto/logging-cookbook.rst:3726 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:3448 +#: ../../howto/logging-cookbook.rst:3728 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -1713,32 +1820,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:3453 +#: ../../howto/logging-cookbook.rst:3733 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:3456 +#: ../../howto/logging-cookbook.rst:3736 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:3459 +#: ../../howto/logging-cookbook.rst:3739 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:3463 +#: ../../howto/logging-cookbook.rst:3743 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:3466 +#: ../../howto/logging-cookbook.rst:3746 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -1747,7 +1854,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:3472 +#: ../../howto/logging-cookbook.rst:3752 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -1757,17 +1864,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:3479 +#: ../../howto/logging-cookbook.rst:3759 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:3483 +#: ../../howto/logging-cookbook.rst:3763 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:3485 +#: ../../howto/logging-cookbook.rst:3765 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -1778,12 +1885,12 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:3495 +#: ../../howto/logging-cookbook.rst:3774 msgid "" "Adding handlers other than :class:`NullHandler` to a logger in a library" msgstr "" -#: ../../howto/logging-cookbook.rst:3497 +#: ../../howto/logging-cookbook.rst:3776 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -1791,11 +1898,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:3504 +#: ../../howto/logging-cookbook.rst:3782 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:3506 +#: ../../howto/logging-cookbook.rst:3784 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -1806,14 +1913,14 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:3517 +#: ../../howto/logging-cookbook.rst:3795 msgid "Other resources" msgstr "" -#: ../../howto/logging-cookbook.rst:3530 +#: ../../howto/logging-cookbook.rst:3808 msgid ":ref:`Basic Tutorial `" msgstr "" -#: ../../howto/logging-cookbook.rst:3532 +#: ../../howto/logging-cookbook.rst:3810 msgid ":ref:`Advanced Tutorial `" msgstr "" diff --git a/howto/logging.po b/howto/logging.po index 5b8f19bf26..e6bf7b7391 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -134,7 +134,7 @@ msgid "" "described below (in increasing order of severity):" msgstr "" -#: ../../howto/logging.rst:69 ../../howto/logging.rst:855 +#: ../../howto/logging.rst:69 ../../howto/logging.rst:862 msgid "Level" msgstr "" @@ -142,7 +142,7 @@ msgstr "" msgid "When it's used" msgstr "" -#: ../../howto/logging.rst:71 ../../howto/logging.rst:865 +#: ../../howto/logging.rst:71 ../../howto/logging.rst:872 msgid "``DEBUG``" msgstr "``DEBUG``" @@ -151,7 +151,7 @@ msgid "" "Detailed information, typically of interest only when diagnosing problems." msgstr "" -#: ../../howto/logging.rst:74 ../../howto/logging.rst:863 +#: ../../howto/logging.rst:74 ../../howto/logging.rst:870 msgid "``INFO``" msgstr "``INFO``" @@ -159,7 +159,7 @@ msgstr "``INFO``" msgid "Confirmation that things are working as expected." msgstr "" -#: ../../howto/logging.rst:77 ../../howto/logging.rst:861 +#: ../../howto/logging.rst:77 ../../howto/logging.rst:868 msgid "``WARNING``" msgstr "``WARNING``" @@ -170,7 +170,7 @@ msgid "" "working as expected." msgstr "" -#: ../../howto/logging.rst:82 ../../howto/logging.rst:859 +#: ../../howto/logging.rst:82 ../../howto/logging.rst:866 msgid "``ERROR``" msgstr "``ERROR``" @@ -180,7 +180,7 @@ msgid "" "some function." msgstr "" -#: ../../howto/logging.rst:85 ../../howto/logging.rst:857 +#: ../../howto/logging.rst:85 ../../howto/logging.rst:864 msgid "``CRITICAL``" msgstr "``CRITICAL``" @@ -1005,6 +1005,16 @@ msgstr "" #: ../../howto/logging.rst:835 msgid "" +"It is strongly advised that you *do not log to the root logger* in your " +"library. Instead, use a logger with a unique and easily identifiable name, " +"such as the ``__name__`` for your library's top-level package or module. " +"Logging to the root logger will make it difficult or impossible for the " +"application developer to configure the logging verbosity or handlers of your " +"library as they wish." +msgstr "" + +#: ../../howto/logging.rst:842 +msgid "" "It is strongly advised that you *do not add any handlers other than* :class:" "`~logging.NullHandler` *to your library's loggers*. This is because the " "configuration of handlers is the prerogative of the application developer " @@ -1014,11 +1024,11 @@ msgid "" "carry out unit tests and deliver logs which suit their requirements." msgstr "" -#: ../../howto/logging.rst:846 +#: ../../howto/logging.rst:853 msgid "Logging Levels" msgstr "" -#: ../../howto/logging.rst:848 +#: ../../howto/logging.rst:855 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -1027,39 +1037,39 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../howto/logging.rst:855 +#: ../../howto/logging.rst:862 msgid "Numeric value" msgstr "" -#: ../../howto/logging.rst:857 +#: ../../howto/logging.rst:864 msgid "50" msgstr "50" -#: ../../howto/logging.rst:859 +#: ../../howto/logging.rst:866 msgid "40" msgstr "40" -#: ../../howto/logging.rst:861 +#: ../../howto/logging.rst:868 msgid "30" msgstr "30" -#: ../../howto/logging.rst:863 +#: ../../howto/logging.rst:870 msgid "20" msgstr "20" -#: ../../howto/logging.rst:865 +#: ../../howto/logging.rst:872 msgid "10" msgstr "10" -#: ../../howto/logging.rst:867 +#: ../../howto/logging.rst:874 msgid "``NOTSET``" msgstr "``NOTSET``" -#: ../../howto/logging.rst:867 +#: ../../howto/logging.rst:874 msgid "0" msgstr "0" -#: ../../howto/logging.rst:870 +#: ../../howto/logging.rst:877 msgid "" "Levels can also be associated with loggers, being set either by the " "developer or through loading a saved logging configuration. When a logging " @@ -1069,14 +1079,14 @@ msgid "" "basic mechanism controlling the verbosity of logging output." msgstr "" -#: ../../howto/logging.rst:877 +#: ../../howto/logging.rst:884 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " "class. When a logger decides to actually log an event, a :class:`~logging." "LogRecord` instance is created from the logging message." msgstr "" -#: ../../howto/logging.rst:881 +#: ../../howto/logging.rst:888 msgid "" "Logging messages are subjected to a dispatch mechanism through the use of :" "dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " @@ -1093,7 +1103,7 @@ msgid "" "at which point the passing to ancestor handlers stops)." msgstr "" -#: ../../howto/logging.rst:895 +#: ../../howto/logging.rst:902 msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " @@ -1103,11 +1113,11 @@ msgid "" "`~Handler.emit`." msgstr "" -#: ../../howto/logging.rst:904 +#: ../../howto/logging.rst:911 msgid "Custom Levels" msgstr "" -#: ../../howto/logging.rst:906 +#: ../../howto/logging.rst:913 msgid "" "Defining your own levels is possible, but should not be necessary, as the " "existing levels have been chosen on the basis of practical experience. " @@ -1120,27 +1130,27 @@ msgid "" "given numeric value might mean different things for different libraries." msgstr "" -#: ../../howto/logging.rst:919 +#: ../../howto/logging.rst:926 msgid "Useful Handlers" msgstr "" -#: ../../howto/logging.rst:921 +#: ../../howto/logging.rst:928 msgid "" "In addition to the base :class:`Handler` class, many useful subclasses are " "provided:" msgstr "" -#: ../../howto/logging.rst:924 +#: ../../howto/logging.rst:931 msgid "" ":class:`StreamHandler` instances send messages to streams (file-like " "objects)." msgstr "" -#: ../../howto/logging.rst:927 +#: ../../howto/logging.rst:934 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" -#: ../../howto/logging.rst:929 +#: ../../howto/logging.rst:936 msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " @@ -1148,61 +1158,61 @@ msgid "" "`~handlers.TimedRotatingFileHandler`." msgstr "" -#: ../../howto/logging.rst:934 +#: ../../howto/logging.rst:941 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" -#: ../../howto/logging.rst:937 +#: ../../howto/logging.rst:944 msgid "" ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " "files, rotating the log file at certain timed intervals." msgstr "" -#: ../../howto/logging.rst:940 +#: ../../howto/logging.rst:947 msgid "" ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:943 +#: ../../howto/logging.rst:950 msgid "" ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:946 +#: ../../howto/logging.rst:953 msgid "" ":class:`~handlers.SMTPHandler` instances send messages to a designated email " "address." msgstr "" -#: ../../howto/logging.rst:949 +#: ../../howto/logging.rst:956 msgid "" ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " "daemon, possibly on a remote machine." msgstr "" -#: ../../howto/logging.rst:952 +#: ../../howto/logging.rst:959 msgid "" ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " "NT/2000/XP event log." msgstr "" -#: ../../howto/logging.rst:955 +#: ../../howto/logging.rst:962 msgid "" ":class:`~handlers.MemoryHandler` instances send messages to a buffer in " "memory, which is flushed whenever specific criteria are met." msgstr "" -#: ../../howto/logging.rst:958 +#: ../../howto/logging.rst:965 msgid "" ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " "using either ``GET`` or ``POST`` semantics." msgstr "" -#: ../../howto/logging.rst:961 +#: ../../howto/logging.rst:968 msgid "" ":class:`~handlers.WatchedFileHandler` instances watch the file they are " "logging to. If the file changes, it is closed and reopened using the file " @@ -1210,13 +1220,13 @@ msgid "" "support the underlying mechanism used." msgstr "" -#: ../../howto/logging.rst:966 +#: ../../howto/logging.rst:973 msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: ../../howto/logging.rst:969 +#: ../../howto/logging.rst:976 msgid "" ":class:`NullHandler` instances do nothing with error messages. They are used " "by library developers who want to use logging, but want to avoid the 'No " @@ -1225,15 +1235,15 @@ msgid "" "more information." msgstr "" -#: ../../howto/logging.rst:975 +#: ../../howto/logging.rst:982 msgid "The :class:`NullHandler` class." msgstr "" -#: ../../howto/logging.rst:978 +#: ../../howto/logging.rst:985 msgid "The :class:`~handlers.QueueHandler` class." msgstr "" -#: ../../howto/logging.rst:981 +#: ../../howto/logging.rst:988 msgid "" "The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` " "classes are defined in the core logging package. The other handlers are " @@ -1241,14 +1251,14 @@ msgid "" "module, :mod:`logging.config`, for configuration functionality.)" msgstr "" -#: ../../howto/logging.rst:986 +#: ../../howto/logging.rst:993 msgid "" "Logged messages are formatted for presentation through instances of the :" "class:`Formatter` class. They are initialized with a format string suitable " "for use with the % operator and a dictionary." msgstr "" -#: ../../howto/logging.rst:990 +#: ../../howto/logging.rst:997 msgid "" "For formatting multiple messages in a batch, instances of :class:`~handlers." "BufferingFormatter` can be used. In addition to the format string (which is " @@ -1256,7 +1266,7 @@ msgid "" "trailer format strings." msgstr "" -#: ../../howto/logging.rst:995 +#: ../../howto/logging.rst:1002 msgid "" "When filtering based on logger level and/or handler level is not enough, " "instances of :class:`Filter` can be added to both :class:`Logger` and :class:" @@ -1266,18 +1276,18 @@ msgid "" "value, the message is not processed further." msgstr "" -#: ../../howto/logging.rst:1002 +#: ../../howto/logging.rst:1009 msgid "" "The basic :class:`Filter` functionality allows filtering by specific logger " "name. If this feature is used, messages sent to the named logger and its " "children are allowed through the filter, and all others dropped." msgstr "" -#: ../../howto/logging.rst:1010 +#: ../../howto/logging.rst:1017 msgid "Exceptions raised during logging" msgstr "" -#: ../../howto/logging.rst:1012 +#: ../../howto/logging.rst:1019 msgid "" "The logging package is designed to swallow exceptions which occur while " "logging in production. This is so that errors which occur while handling " @@ -1285,7 +1295,7 @@ msgid "" "errors - do not cause the application using logging to terminate prematurely." msgstr "" -#: ../../howto/logging.rst:1017 +#: ../../howto/logging.rst:1024 msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " @@ -1293,7 +1303,7 @@ msgid "" "handleError` method." msgstr "" -#: ../../howto/logging.rst:1022 +#: ../../howto/logging.rst:1029 msgid "" "The default implementation of :meth:`~Handler.handleError` in :class:" "`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " @@ -1301,7 +1311,7 @@ msgid "" "the exception is swallowed." msgstr "" -#: ../../howto/logging.rst:1027 +#: ../../howto/logging.rst:1034 msgid "" "The default value of :data:`raiseExceptions` is ``True``. This is because " "during development, you typically want to be notified of any exceptions that " @@ -1309,11 +1319,11 @@ msgid "" "production usage." msgstr "" -#: ../../howto/logging.rst:1037 +#: ../../howto/logging.rst:1044 msgid "Using arbitrary objects as messages" msgstr "" -#: ../../howto/logging.rst:1039 +#: ../../howto/logging.rst:1046 msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " @@ -1325,11 +1335,11 @@ msgid "" "the wire." msgstr "" -#: ../../howto/logging.rst:1050 +#: ../../howto/logging.rst:1057 msgid "Optimization" msgstr "" -#: ../../howto/logging.rst:1052 +#: ../../howto/logging.rst:1059 msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " @@ -1340,13 +1350,13 @@ msgid "" "code like this::" msgstr "" -#: ../../howto/logging.rst:1064 +#: ../../howto/logging.rst:1071 msgid "" "so that if the logger's threshold is set above ``DEBUG``, the calls to :func:" "`expensive_func1` and :func:`expensive_func2` are never made." msgstr "" -#: ../../howto/logging.rst:1067 +#: ../../howto/logging.rst:1074 msgid "" "In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive " "than you'd like (e.g. for deeply nested loggers where an explicit level is " @@ -1358,7 +1368,7 @@ msgid "" "while the application is running (which is not all that common)." msgstr "" -#: ../../howto/logging.rst:1076 +#: ../../howto/logging.rst:1083 msgid "" "There are other optimizations which can be made for specific applications " "which need more precise control over what logging information is collected. " @@ -1366,82 +1376,82 @@ msgid "" "you don't need:" msgstr "" -#: ../../howto/logging.rst:1082 +#: ../../howto/logging.rst:1089 msgid "What you don't want to collect" msgstr "" -#: ../../howto/logging.rst:1082 +#: ../../howto/logging.rst:1089 msgid "How to avoid collecting it" msgstr "" -#: ../../howto/logging.rst:1084 +#: ../../howto/logging.rst:1091 msgid "Information about where calls were made from." msgstr "" -#: ../../howto/logging.rst:1084 +#: ../../howto/logging.rst:1091 msgid "" "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." "_getframe`, which may help to speed up your code in environments like PyPy " "(which can't speed up code that uses :func:`sys._getframe`)." msgstr "" -#: ../../howto/logging.rst:1090 +#: ../../howto/logging.rst:1097 msgid "Threading information." msgstr "" -#: ../../howto/logging.rst:1090 +#: ../../howto/logging.rst:1097 msgid "Set ``logging.logThreads`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1092 +#: ../../howto/logging.rst:1099 msgid "Current process ID (:func:`os.getpid`)" msgstr "" -#: ../../howto/logging.rst:1092 +#: ../../howto/logging.rst:1099 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1094 +#: ../../howto/logging.rst:1101 msgid "" "Current process name when using ``multiprocessing`` to manage multiple " "processes." msgstr "" -#: ../../howto/logging.rst:1094 +#: ../../howto/logging.rst:1101 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1098 +#: ../../howto/logging.rst:1105 msgid "" "Also note that the core logging module only includes the basic handlers. If " "you don't import :mod:`logging.handlers` and :mod:`logging.config`, they " "won't take up any memory." msgstr "" -#: ../../howto/logging.rst:1105 +#: ../../howto/logging.rst:1112 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging.rst:1105 +#: ../../howto/logging.rst:1112 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging.rst:1108 +#: ../../howto/logging.rst:1115 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging.rst:1108 +#: ../../howto/logging.rst:1115 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging.rst:1111 +#: ../../howto/logging.rst:1118 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging.rst:1111 +#: ../../howto/logging.rst:1118 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging.rst:1113 +#: ../../howto/logging.rst:1120 msgid ":ref:`A logging cookbook `" msgstr "" diff --git a/howto/regex.po b/howto/regex.po index ec505d230a..8790db2968 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -431,19 +431,19 @@ msgstr "" #: ../../howto/regex.rst:233 msgid "" -"There are two more repeating qualifiers. The question mark character, ``?" -"``, matches either once or zero times; you can think of it as marking " -"something as being optional. For example, ``home-?brew`` matches either " -"``'homebrew'`` or ``'home-brew'``." +"There are two more repeating operators or quantifiers. The question mark " +"character, ``?``, matches either once or zero times; you can think of it as " +"marking something as being optional. For example, ``home-?brew`` matches " +"either ``'homebrew'`` or ``'home-brew'``." msgstr "" #: ../../howto/regex.rst:238 msgid "" -"The most complicated repeated qualifier is ``{m,n}``, where *m* and *n* are " -"decimal integers. This qualifier means there must be at least *m* " -"repetitions, and at most *n*. For example, ``a/{1,3}b`` will match ``'a/" -"b'``, ``'a//b'``, and ``'a///b'``. It won't match ``'ab'``, which has no " -"slashes, or ``'a////b'``, which has four." +"The most complicated quantifier is ``{m,n}``, where *m* and *n* are decimal " +"integers. This quantifier means there must be at least *m* repetitions, and " +"at most *n*. For example, ``a/{1,3}b`` will match ``'a/b'``, ``'a//b'``, " +"and ``'a///b'``. It won't match ``'ab'``, which has no slashes, or ``'a////" +"b'``, which has four." msgstr "" #: ../../howto/regex.rst:244 @@ -455,7 +455,7 @@ msgstr "" #: ../../howto/regex.rst:248 msgid "" -"Readers of a reductionist bent may notice that the three other qualifiers " +"Readers of a reductionist bent may notice that the three other quantifiers " "can all be expressed using this notation. ``{0,}`` is the same as ``*``, " "``{1,}`` is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's " "better to use ``*``, ``+``, or ``?`` when you can, simply because they're " @@ -1196,8 +1196,8 @@ msgid "" "Groups are marked by the ``'('``, ``')'`` metacharacters. ``'('`` and " "``')'`` have much the same meaning as they do in mathematical expressions; " "they group together the expressions contained inside them, and you can " -"repeat the contents of a group with a repeating qualifier, such as ``*``, ``" -"+``, ``?``, or ``{m,n}``. For example, ``(ab)*`` will match zero or more " +"repeat the contents of a group with a quantifier, such as ``*``, ``+``, ``?" +"``, or ``{m,n}``. For example, ``(ab)*`` will match zero or more " "repetitions of ``ab``. ::" msgstr "" @@ -1809,7 +1809,7 @@ msgstr "" #: ../../howto/regex.rst:1329 msgid "" -"In this case, the solution is to use the non-greedy qualifiers ``*?``, ``+?" +"In this case, the solution is to use the non-greedy quantifiers ``*?``, ``+?" "``, ``??``, or ``{m,n}?``, which match as *little* text as possible. In the " "above example, the ``'>'`` is tried immediately after the first ``'<'`` " "matches, and when it fails, the engine advances a character at a time, " diff --git a/howto/sorting.po b/howto/sorting.po index e02b7559b0..ace4f698fe 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -298,7 +298,7 @@ msgid "" msgstr "" #: ../../howto/sorting.rst:309 -msgid "Odd and Ends" +msgid "Odds and Ends" msgstr "" #: ../../howto/sorting.rst:311 diff --git a/includes/wasm-notavail.po b/includes/wasm-notavail.po new file mode 100644 index 0000000000..99bfe4fbb7 --- /dev/null +++ b/includes/wasm-notavail.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 07:40+0800\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.1.1\n" + +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" diff --git a/library/2to3.po b/library/2to3.po index 546b49b386..6da4d344a6 100644 --- a/library/2to3.po +++ b/library/2to3.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-09 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,31 +32,39 @@ msgid "" "library, so it is possible to write your own fixers for 2to3." msgstr "" -#: ../../library/2to3.rst:18 +#: ../../library/2to3.rst:19 +msgid "" +"The ``lib2to3`` module was marked pending for deprecation in Python 3.9 " +"(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated in " +"Python 3.11 (raising :exc:`DeprecationWarning`). The ``2to3`` tool is part " +"of that. It will be removed in Python 3.13." +msgstr "" + +#: ../../library/2to3.rst:23 msgid "Using 2to3" msgstr "使用 2to3" -#: ../../library/2to3.rst:20 +#: ../../library/2to3.rst:25 msgid "" "2to3 will usually be installed with the Python interpreter as a script. It " "is also located in the :file:`Tools/scripts` directory of the Python root." msgstr "" -#: ../../library/2to3.rst:23 +#: ../../library/2to3.rst:28 msgid "" "2to3's basic arguments are a list of files or directories to transform. The " "directories are recursively traversed for Python sources." msgstr "" -#: ../../library/2to3.rst:26 +#: ../../library/2to3.rst:31 msgid "Here is a sample Python 2.x source file, :file:`example.py`::" msgstr "這邊有簡單的 Python 2的原始檔案 :file:`example.py`::" -#: ../../library/2to3.rst:34 +#: ../../library/2to3.rst:39 msgid "It can be converted to Python 3.x code via 2to3 on the command line:" msgstr "" -#: ../../library/2to3.rst:40 +#: ../../library/2to3.rst:45 msgid "" "A diff against the original source file is printed. 2to3 can also write the " "needed modifications right back to the source file. (A backup of the " @@ -64,17 +72,17 @@ msgid "" "changes back is enabled with the :option:`!-w` flag:" msgstr "" -#: ../../library/2to3.rst:49 +#: ../../library/2to3.rst:54 msgid "After transformation, :file:`example.py` looks like this::" msgstr "" -#: ../../library/2to3.rst:57 +#: ../../library/2to3.rst:62 msgid "" "Comments and exact indentation are preserved throughout the translation " "process." msgstr "" -#: ../../library/2to3.rst:59 +#: ../../library/2to3.rst:64 msgid "" "By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The :" "option:`!-l` flag lists all available fixers. An explicit set of fixers to " @@ -83,22 +91,22 @@ msgid "" "``has_key`` fixers:" msgstr "" -#: ../../library/2to3.rst:68 +#: ../../library/2to3.rst:73 msgid "This command runs every fixer except the ``apply`` fixer:" msgstr "" -#: ../../library/2to3.rst:74 +#: ../../library/2to3.rst:79 msgid "" "Some fixers are *explicit*, meaning they aren't run by default and must be " "listed on the command line to be run. Here, in addition to the default " "fixers, the ``idioms`` fixer is run:" msgstr "" -#: ../../library/2to3.rst:82 +#: ../../library/2to3.rst:87 msgid "Notice how passing ``all`` enables all default fixers." msgstr "" -#: ../../library/2to3.rst:84 +#: ../../library/2to3.rst:89 msgid "" "Sometimes 2to3 will find a place in your source code that needs to be " "changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a " @@ -106,7 +114,7 @@ msgid "" "order to have compliant 3.x code." msgstr "" -#: ../../library/2to3.rst:89 +#: ../../library/2to3.rst:94 msgid "" "2to3 can also refactor doctests. To enable this mode, use the :option:`!-d` " "flag. Note that *only* doctests will be refactored. This also doesn't " @@ -114,13 +122,13 @@ msgid "" "in a reST document could also be refactored with this option." msgstr "" -#: ../../library/2to3.rst:94 +#: ../../library/2to3.rst:99 msgid "" "The :option:`!-v` option enables output of more information on the " "translation process." msgstr "" -#: ../../library/2to3.rst:97 +#: ../../library/2to3.rst:102 msgid "" "Since some print statements can be parsed as function calls or statements, " "2to3 cannot always read files containing the print function. When 2to3 " @@ -132,7 +140,7 @@ msgid "" "func:`exec` a function." msgstr "" -#: ../../library/2to3.rst:105 +#: ../../library/2to3.rst:110 msgid "" "The :option:`!-o` or :option:`!--output-dir` option allows specification of " "an alternate directory for processed output files to be written to. The :" @@ -140,11 +148,11 @@ msgid "" "sense when not overwriting the input files." msgstr "" -#: ../../library/2to3.rst:110 +#: ../../library/2to3.rst:115 msgid "The :option:`!-o` option was added." msgstr "新增 :option:`!-o` 選項。" -#: ../../library/2to3.rst:113 +#: ../../library/2to3.rst:118 msgid "" "The :option:`!-W` or :option:`!--write-unchanged-files` flag tells 2to3 to " "always write output files even if no changes were required to the file. " @@ -153,147 +161,147 @@ msgid "" "implies the :option:`!-w` flag as it would not make sense otherwise." msgstr "" -#: ../../library/2to3.rst:119 +#: ../../library/2to3.rst:124 msgid "The :option:`!-W` flag was added." msgstr "" -#: ../../library/2to3.rst:122 +#: ../../library/2to3.rst:127 msgid "" "The :option:`!--add-suffix` option specifies a string to append to all " "output filenames. The :option:`!-n` flag is required when specifying this " "as backups are not necessary when writing to different filenames. Example:" msgstr "" -#: ../../library/2to3.rst:130 +#: ../../library/2to3.rst:135 msgid "Will cause a converted file named ``example.py3`` to be written." msgstr "" -#: ../../library/2to3.rst:132 +#: ../../library/2to3.rst:137 msgid "The :option:`!--add-suffix` option was added." msgstr "" -#: ../../library/2to3.rst:135 +#: ../../library/2to3.rst:140 msgid "To translate an entire project from one directory tree to another use:" msgstr "" -#: ../../library/2to3.rst:145 +#: ../../library/2to3.rst:150 msgid "Fixers" msgstr "" -#: ../../library/2to3.rst:147 +#: ../../library/2to3.rst:152 msgid "" "Each step of transforming code is encapsulated in a fixer. The command " "``2to3 -l`` lists them. As :ref:`documented above <2to3-using>`, each can " "be turned on and off individually. They are described here in more detail." msgstr "" -#: ../../library/2to3.rst:154 +#: ../../library/2to3.rst:159 msgid "" "Removes usage of :func:`apply`. For example ``apply(function, *args, " "**kwargs)`` is converted to ``function(*args, **kwargs)``." msgstr "" -#: ../../library/2to3.rst:159 +#: ../../library/2to3.rst:164 msgid "Replaces deprecated :mod:`unittest` method names with the correct ones." msgstr "" -#: ../../library/2to3.rst:162 ../../library/2to3.rst:351 +#: ../../library/2to3.rst:167 ../../library/2to3.rst:356 msgid "From" msgstr "從" -#: ../../library/2to3.rst:162 ../../library/2to3.rst:351 +#: ../../library/2to3.rst:167 ../../library/2to3.rst:356 msgid "To" msgstr "到" -#: ../../library/2to3.rst:164 +#: ../../library/2to3.rst:169 msgid "``failUnlessEqual(a, b)``" msgstr "``failUnlessEqual(a, b)``" -#: ../../library/2to3.rst:164 ../../library/2to3.rst:166 +#: ../../library/2to3.rst:169 ../../library/2to3.rst:171 msgid ":meth:`assertEqual(a, b) `" msgstr ":meth:`assertEqual(a, b) `" -#: ../../library/2to3.rst:166 +#: ../../library/2to3.rst:171 msgid "``assertEquals(a, b)``" msgstr "``assertEquals(a, b)``" -#: ../../library/2to3.rst:168 +#: ../../library/2to3.rst:173 msgid "``failIfEqual(a, b)``" msgstr "``failIfEqual(a, b)``" -#: ../../library/2to3.rst:168 ../../library/2to3.rst:170 +#: ../../library/2to3.rst:173 ../../library/2to3.rst:175 msgid ":meth:`assertNotEqual(a, b) `" msgstr ":meth:`assertNotEqual(a, b) `" -#: ../../library/2to3.rst:170 +#: ../../library/2to3.rst:175 msgid "``assertNotEquals(a, b)``" msgstr "``assertNotEquals(a, b)``" -#: ../../library/2to3.rst:172 +#: ../../library/2to3.rst:177 msgid "``failUnless(a)``" msgstr "``failUnless(a)``" -#: ../../library/2to3.rst:172 ../../library/2to3.rst:174 +#: ../../library/2to3.rst:177 ../../library/2to3.rst:179 msgid ":meth:`assertTrue(a) `" msgstr ":meth:`assertTrue(a) `" -#: ../../library/2to3.rst:174 +#: ../../library/2to3.rst:179 msgid "``assert_(a)``" msgstr "``assert_(a)``" -#: ../../library/2to3.rst:176 +#: ../../library/2to3.rst:181 msgid "``failIf(a)``" msgstr "``failIf(a)``" -#: ../../library/2to3.rst:176 +#: ../../library/2to3.rst:181 msgid ":meth:`assertFalse(a) `" msgstr ":meth:`assertFalse(a) `" -#: ../../library/2to3.rst:178 +#: ../../library/2to3.rst:183 msgid "``failUnlessRaises(exc, cal)``" msgstr "``failUnlessRaises(exc, cal)``" -#: ../../library/2to3.rst:178 +#: ../../library/2to3.rst:183 msgid ":meth:`assertRaises(exc, cal) `" msgstr ":meth:`assertRaises(exc, cal) `" -#: ../../library/2to3.rst:180 +#: ../../library/2to3.rst:185 msgid "``failUnlessAlmostEqual(a, b)``" msgstr "``failUnlessAlmostEqual(a, b)``" -#: ../../library/2to3.rst:180 ../../library/2to3.rst:182 +#: ../../library/2to3.rst:185 ../../library/2to3.rst:187 msgid ":meth:`assertAlmostEqual(a, b) `" msgstr ":meth:`assertAlmostEqual(a, b) `" -#: ../../library/2to3.rst:182 +#: ../../library/2to3.rst:187 msgid "``assertAlmostEquals(a, b)``" msgstr "``assertAlmostEquals(a, b)``" -#: ../../library/2to3.rst:184 +#: ../../library/2to3.rst:189 msgid "``failIfAlmostEqual(a, b)``" msgstr "``failIfAlmostEqual(a, b)``" -#: ../../library/2to3.rst:184 ../../library/2to3.rst:186 +#: ../../library/2to3.rst:189 ../../library/2to3.rst:191 msgid "" ":meth:`assertNotAlmostEqual(a, b) `" msgstr "" -#: ../../library/2to3.rst:186 +#: ../../library/2to3.rst:191 msgid "``assertNotAlmostEquals(a, b)``" msgstr "``assertNotAlmostEquals(a, b)``" -#: ../../library/2to3.rst:192 +#: ../../library/2to3.rst:197 msgid "Converts :class:`basestring` to :class:`str`." msgstr "" -#: ../../library/2to3.rst:196 +#: ../../library/2to3.rst:201 msgid "" "Converts :class:`buffer` to :class:`memoryview`. This fixer is optional " "because the :class:`memoryview` API is similar but not exactly the same as " "that of :class:`buffer`." msgstr "" -#: ../../library/2to3.rst:202 +#: ../../library/2to3.rst:207 msgid "" "Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to :" "meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and :meth:" @@ -304,49 +312,49 @@ msgid "" "keys`, and :meth:`dict.values` in a call to :class:`list`." msgstr "" -#: ../../library/2to3.rst:212 +#: ../../library/2to3.rst:217 msgid "Converts ``except X, T`` to ``except X as T``." msgstr "" -#: ../../library/2to3.rst:216 +#: ../../library/2to3.rst:221 msgid "Converts the ``exec`` statement to the :func:`exec` function." msgstr "" -#: ../../library/2to3.rst:220 +#: ../../library/2to3.rst:225 msgid "" "Removes usage of :func:`execfile`. The argument to :func:`execfile` is " "wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`." msgstr "" -#: ../../library/2to3.rst:225 +#: ../../library/2to3.rst:230 msgid "" "Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit` " "module." msgstr "" -#: ../../library/2to3.rst:230 +#: ../../library/2to3.rst:235 msgid "Wraps :func:`filter` usage in a :class:`list` call." msgstr "" -#: ../../library/2to3.rst:234 +#: ../../library/2to3.rst:239 msgid "" "Fixes function attributes that have been renamed. For example, " "``my_function.func_closure`` is converted to ``my_function.__closure__``." msgstr "" -#: ../../library/2to3.rst:239 +#: ../../library/2to3.rst:244 msgid "Removes ``from __future__ import new_feature`` statements." msgstr "" -#: ../../library/2to3.rst:243 +#: ../../library/2to3.rst:248 msgid "Renames :func:`os.getcwdu` to :func:`os.getcwd`." msgstr "" -#: ../../library/2to3.rst:247 +#: ../../library/2to3.rst:252 msgid "Changes ``dict.has_key(key)`` to ``key in dict``." msgstr "" -#: ../../library/2to3.rst:251 +#: ../../library/2to3.rst:256 msgid "" "This optional fixer performs several transformations that make Python code " "more idiomatic. Type comparisons like ``type(x) is SomeClass`` and " @@ -355,33 +363,33 @@ msgid "" "func:`sorted` in appropriate places. For example, this block ::" msgstr "" -#: ../../library/2to3.rst:260 +#: ../../library/2to3.rst:265 msgid "is changed to ::" msgstr "" -#: ../../library/2to3.rst:266 +#: ../../library/2to3.rst:271 msgid "Detects sibling imports and converts them to relative imports." msgstr "" -#: ../../library/2to3.rst:270 +#: ../../library/2to3.rst:275 msgid "Handles module renames in the standard library." msgstr "" -#: ../../library/2to3.rst:274 +#: ../../library/2to3.rst:279 msgid "" "Handles other modules renames in the standard library. It is separate from " "the :2to3fixer:`imports` fixer only because of technical limitations." msgstr "" -#: ../../library/2to3.rst:279 +#: ../../library/2to3.rst:284 msgid "Converts ``input(prompt)`` to ``eval(input(prompt))``." msgstr "" -#: ../../library/2to3.rst:283 +#: ../../library/2to3.rst:288 msgid "Converts :func:`intern` to :func:`sys.intern`." msgstr "" -#: ../../library/2to3.rst:287 +#: ../../library/2to3.rst:292 msgid "" "Fixes duplicate types in the second argument of :func:`isinstance`. For " "example, ``isinstance(x, (int, int))`` is converted to ``isinstance(x, " @@ -389,65 +397,65 @@ msgid "" "``isinstance(x, (int, float))``." msgstr "" -#: ../../library/2to3.rst:294 +#: ../../library/2to3.rst:299 msgid "" "Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" "func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are also " "changed to :func:`itertools.filterfalse`." msgstr "" -#: ../../library/2to3.rst:300 +#: ../../library/2to3.rst:305 msgid "" "Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" "func:`itertools.imap` to their built-in equivalents. :func:`itertools." "ifilterfalse` is changed to :func:`itertools.filterfalse`." msgstr "" -#: ../../library/2to3.rst:306 +#: ../../library/2to3.rst:311 msgid "Renames :class:`long` to :class:`int`." msgstr "" -#: ../../library/2to3.rst:310 +#: ../../library/2to3.rst:315 msgid "" "Wraps :func:`map` in a :class:`list` call. It also changes ``map(None, x)`` " "to ``list(x)``. Using ``from future_builtins import map`` disables this " "fixer." msgstr "" -#: ../../library/2to3.rst:316 +#: ../../library/2to3.rst:321 msgid "" "Converts the old metaclass syntax (``__metaclass__ = Meta`` in the class " "body) to the new (``class X(metaclass=Meta)``)." msgstr "" -#: ../../library/2to3.rst:321 +#: ../../library/2to3.rst:326 msgid "" "Fixes old method attribute names. For example, ``meth.im_func`` is " "converted to ``meth.__func__``." msgstr "" -#: ../../library/2to3.rst:326 +#: ../../library/2to3.rst:331 msgid "Converts the old not-equal syntax, ``<>``, to ``!=``." msgstr "" -#: ../../library/2to3.rst:330 +#: ../../library/2to3.rst:335 msgid "" "Converts the use of iterator's :meth:`~iterator.next` methods to the :func:" "`next` function. It also renames :meth:`next` methods to :meth:`~iterator." "__next__`." msgstr "" -#: ../../library/2to3.rst:336 +#: ../../library/2to3.rst:341 msgid "" "Renames definitions of methods called :meth:`__nonzero__` to :meth:`~object." "__bool__`." msgstr "" -#: ../../library/2to3.rst:341 +#: ../../library/2to3.rst:346 msgid "Converts octal literals into the new syntax." msgstr "" -#: ../../library/2to3.rst:345 +#: ../../library/2to3.rst:350 msgid "" "Converts calls to various functions in the :mod:`operator` module to other, " "but equivalent, function calls. When needed, the appropriate ``import`` " @@ -455,172 +463,172 @@ msgid "" "mapping are made:" msgstr "" -#: ../../library/2to3.rst:353 +#: ../../library/2to3.rst:358 msgid "``operator.isCallable(obj)``" msgstr "``operator.isCallable(obj)``" -#: ../../library/2to3.rst:353 +#: ../../library/2to3.rst:358 msgid "``callable(obj)``" msgstr "``callable(obj)``" -#: ../../library/2to3.rst:354 +#: ../../library/2to3.rst:359 msgid "``operator.sequenceIncludes(obj)``" msgstr "``operator.sequenceIncludes(obj)``" -#: ../../library/2to3.rst:354 +#: ../../library/2to3.rst:359 msgid "``operator.contains(obj)``" msgstr "``operator.contains(obj)``" -#: ../../library/2to3.rst:355 +#: ../../library/2to3.rst:360 msgid "``operator.isSequenceType(obj)``" msgstr "``operator.isSequenceType(obj)``" -#: ../../library/2to3.rst:355 +#: ../../library/2to3.rst:360 msgid "``isinstance(obj, collections.abc.Sequence)``" msgstr "``isinstance(obj, collections.abc.Sequence)``" -#: ../../library/2to3.rst:356 +#: ../../library/2to3.rst:361 msgid "``operator.isMappingType(obj)``" msgstr "``operator.isMappingType(obj)``" -#: ../../library/2to3.rst:356 +#: ../../library/2to3.rst:361 msgid "``isinstance(obj, collections.abc.Mapping)``" msgstr "``isinstance(obj, collections.abc.Mapping)``" -#: ../../library/2to3.rst:357 +#: ../../library/2to3.rst:362 msgid "``operator.isNumberType(obj)``" msgstr "``operator.isNumberType(obj)``" -#: ../../library/2to3.rst:357 +#: ../../library/2to3.rst:362 msgid "``isinstance(obj, numbers.Number)``" msgstr "``isinstance(obj, numbers.Number)``" -#: ../../library/2to3.rst:358 +#: ../../library/2to3.rst:363 msgid "``operator.repeat(obj, n)``" msgstr "``operator.repeat(obj, n)``" -#: ../../library/2to3.rst:358 +#: ../../library/2to3.rst:363 msgid "``operator.mul(obj, n)``" msgstr "``operator.mul(obj, n)``" -#: ../../library/2to3.rst:359 +#: ../../library/2to3.rst:364 msgid "``operator.irepeat(obj, n)``" msgstr "``operator.irepeat(obj, n)``" -#: ../../library/2to3.rst:359 +#: ../../library/2to3.rst:364 msgid "``operator.imul(obj, n)``" msgstr "``operator.imul(obj, n)``" -#: ../../library/2to3.rst:364 +#: ../../library/2to3.rst:369 msgid "" "Add extra parenthesis where they are required in list comprehensions. For " "example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``." msgstr "" -#: ../../library/2to3.rst:369 +#: ../../library/2to3.rst:374 msgid "Converts the ``print`` statement to the :func:`print` function." msgstr "" -#: ../../library/2to3.rst:373 +#: ../../library/2to3.rst:378 msgid "" "Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise " "E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be " "incorrect because substituting tuples for exceptions has been removed in 3.0." msgstr "" -#: ../../library/2to3.rst:379 +#: ../../library/2to3.rst:384 msgid "Converts :func:`raw_input` to :func:`input`." msgstr "" -#: ../../library/2to3.rst:383 +#: ../../library/2to3.rst:388 msgid "Handles the move of :func:`reduce` to :func:`functools.reduce`." msgstr "" -#: ../../library/2to3.rst:387 +#: ../../library/2to3.rst:392 msgid "Converts :func:`reload` to :func:`importlib.reload`." msgstr "" -#: ../../library/2to3.rst:391 +#: ../../library/2to3.rst:396 msgid "Changes :data:`sys.maxint` to :data:`sys.maxsize`." msgstr "" -#: ../../library/2to3.rst:395 +#: ../../library/2to3.rst:400 msgid "Replaces backtick repr with the :func:`repr` function." msgstr "" -#: ../../library/2to3.rst:399 +#: ../../library/2to3.rst:404 msgid "" "Replaces use of the :class:`set` constructor with set literals. This fixer " "is optional." msgstr "" -#: ../../library/2to3.rst:404 +#: ../../library/2to3.rst:409 msgid "Renames :exc:`StandardError` to :exc:`Exception`." msgstr "" -#: ../../library/2to3.rst:408 +#: ../../library/2to3.rst:413 msgid "" "Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, :data:" "`sys.exc_traceback` to use :func:`sys.exc_info`." msgstr "" -#: ../../library/2to3.rst:413 +#: ../../library/2to3.rst:418 msgid "Fixes the API change in generator's :meth:`throw` method." msgstr "" -#: ../../library/2to3.rst:417 +#: ../../library/2to3.rst:422 msgid "" "Removes implicit tuple parameter unpacking. This fixer inserts temporary " "variables." msgstr "" -#: ../../library/2to3.rst:422 +#: ../../library/2to3.rst:427 msgid "" "Fixes code broken from the removal of some members in the :mod:`types` " "module." msgstr "" -#: ../../library/2to3.rst:427 +#: ../../library/2to3.rst:432 msgid "Renames :class:`unicode` to :class:`str`." msgstr "" -#: ../../library/2to3.rst:431 +#: ../../library/2to3.rst:436 msgid "" "Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib` " "package." msgstr "" -#: ../../library/2to3.rst:436 +#: ../../library/2to3.rst:441 msgid "" "Removes excess whitespace from comma separated items. This fixer is " "optional." msgstr "" -#: ../../library/2to3.rst:441 +#: ../../library/2to3.rst:446 msgid "" "Renames :func:`xrange` to :func:`range` and wraps existing :func:`range` " "calls with :class:`list`." msgstr "" -#: ../../library/2to3.rst:446 +#: ../../library/2to3.rst:451 msgid "Changes ``for x in file.xreadlines()`` to ``for x in file``." msgstr "" -#: ../../library/2to3.rst:450 +#: ../../library/2to3.rst:455 msgid "" "Wraps :func:`zip` usage in a :class:`list` call. This is disabled when " "``from future_builtins import zip`` appears." msgstr "" -#: ../../library/2to3.rst:455 +#: ../../library/2to3.rst:460 msgid ":mod:`lib2to3` --- 2to3's library" msgstr "" -#: ../../library/2to3.rst:464 +#: ../../library/2to3.rst:469 msgid "**Source code:** :source:`Lib/lib2to3/`" msgstr "**原始碼:**\\ :source:`Lib/lib2to3/`" -#: ../../library/2to3.rst:477 +#: ../../library/2to3.rst:482 msgid "" "Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is using " "a less flexible LL(1) parser. Python 3.10 includes new language syntax that " @@ -632,7 +640,7 @@ msgid "" "or `parso`_." msgstr "" -#: ../../library/2to3.rst:480 +#: ../../library/2to3.rst:485 msgid "" "The :mod:`lib2to3` API should be considered unstable and may change " "drastically in the future." diff --git a/library/_thread.po b/library/_thread.po index 5212a3d1a7..7294764fc7 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-05 00:24+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -165,23 +165,26 @@ msgid "" "information)." msgstr "" -#: ../../library/_thread.rst:143 -msgid "" -":ref:`Availability `: Windows, systems with POSIX threads." +#: ../../library/_thread.rst:-1 +msgid ":ref:`Availability `: Windows, pthreads." +msgstr ":ref:`適用 `:Windows, pthreads。" + +#: ../../library/_thread.rst:145 +msgid "Unix platforms with POSIX threads support." msgstr "" -#: ../../library/_thread.rst:148 +#: ../../library/_thread.rst:150 msgid "" "The maximum value allowed for the *timeout* parameter of :meth:`Lock." "acquire`. Specifying a timeout greater than this value will raise an :exc:" "`OverflowError`." msgstr "" -#: ../../library/_thread.rst:155 +#: ../../library/_thread.rst:157 msgid "Lock objects have the following methods:" msgstr "" -#: ../../library/_thread.rst:160 +#: ../../library/_thread.rst:162 msgid "" "Without any optional argument, this method acquires the lock " "unconditionally, if necessary waiting until it is released by another thread " @@ -189,7 +192,7 @@ msgid "" "existence)." msgstr "" -#: ../../library/_thread.rst:164 +#: ../../library/_thread.rst:166 msgid "" "If the *blocking* argument is present, the action depends on its value: if " "it is False, the lock is only acquired if it can be acquired immediately " @@ -197,7 +200,7 @@ msgid "" "as above." msgstr "" -#: ../../library/_thread.rst:169 +#: ../../library/_thread.rst:171 msgid "" "If the floating-point *timeout* argument is present and positive, it " "specifies the maximum wait time in seconds before returning. A negative " @@ -205,70 +208,70 @@ msgid "" "*timeout* if *blocking* is False." msgstr "" -#: ../../library/_thread.rst:174 +#: ../../library/_thread.rst:176 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not." msgstr "" -#: ../../library/_thread.rst:177 +#: ../../library/_thread.rst:179 msgid "The *timeout* parameter is new." msgstr "" -#: ../../library/_thread.rst:180 +#: ../../library/_thread.rst:182 msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "" -#: ../../library/_thread.rst:186 +#: ../../library/_thread.rst:188 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." msgstr "" -#: ../../library/_thread.rst:192 +#: ../../library/_thread.rst:194 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" -#: ../../library/_thread.rst:195 +#: ../../library/_thread.rst:197 msgid "" "In addition to these methods, lock objects can also be used via the :keyword:" "`with` statement, e.g.::" msgstr "" -#: ../../library/_thread.rst:205 +#: ../../library/_thread.rst:207 msgid "**Caveats:**" msgstr "" -#: ../../library/_thread.rst:209 +#: ../../library/_thread.rst:211 msgid "" "Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` " "exception will be received by an arbitrary thread. (When the :mod:`signal` " "module is available, interrupts always go to the main thread.)" msgstr "" -#: ../../library/_thread.rst:213 +#: ../../library/_thread.rst:215 msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." msgstr "" -#: ../../library/_thread.rst:216 +#: ../../library/_thread.rst:218 msgid "" "It is not possible to interrupt the :meth:`acquire` method on a lock --- " "the :exc:`KeyboardInterrupt` exception will happen after the lock has been " "acquired." msgstr "" -#: ../../library/_thread.rst:219 +#: ../../library/_thread.rst:221 msgid "" "When the main thread exits, it is system defined whether the other threads " "survive. On most systems, they are killed without executing :keyword:" "`try` ... :keyword:`finally` clauses or executing object destructors." msgstr "" -#: ../../library/_thread.rst:224 +#: ../../library/_thread.rst:226 msgid "" "When the main thread exits, it does not do any of its usual cleanup (except " "that :keyword:`try` ... :keyword:`finally` clauses are honored), and the " diff --git a/library/aifc.po b/library/aifc.po index 49fd0f0bd2..26db513174 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 01:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`aifc` --- 讀寫 AIFF 與 AIFC 檔案" msgid "**Source code:** :source:`Lib/aifc.py`" msgstr "**原始碼:**\\ :source:`Lib/aifc.py`" -#: ../../library/aifc.rst:16 +#: ../../library/aifc.rst:19 msgid "" "The :mod:`aifc` module is deprecated (see :pep:`PEP 594 <594#aifc>` for " "details)." diff --git a/library/argparse.po b/library/argparse.po index e08e269840..63025e57ca 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-03 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,61 +44,214 @@ msgid "" "The :mod:`argparse` module makes it easy to write user-friendly command-line " "interfaces. The program defines what arguments it requires, and :mod:" "`argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`argparse` module also automatically generates help and usage messages " -"and issues errors when users give the program invalid arguments." +"mod:`argparse` module also automatically generates help and usage messages. " +"The module will also issue errors when users give the program invalid " +"arguments." msgstr "" #: ../../library/argparse.rst:30 +msgid "Core Functionality" +msgstr "" + +#: ../../library/argparse.rst:32 +msgid "" +"The :mod:`argparse` module's support for command-line interfaces is built " +"around an instance of :class:`argparse.ArgumentParser`. It is a container " +"for argument specifications and has options that apply the parser as whole::" +msgstr "" + +#: ../../library/argparse.rst:41 +msgid "" +"The :meth:`ArgumentParser.add_argument` method attaches individual argument " +"specifications to the parser. It supports positional arguments, options " +"that accept values, and on/off flags::" +msgstr "" + +#: ../../library/argparse.rst:50 +msgid "" +"The :meth:`ArgumentParser.parse_args` method runs the parser and places the " +"extracted data in a :class:`argparse.Namespace` object::" +msgstr "" + +#: ../../library/argparse.rst:58 +msgid "Quick Links for add_argument()" +msgstr "" + +#: ../../library/argparse.rst:61 +msgid "Name" +msgstr "名稱" + +#: ../../library/argparse.rst:61 +msgid "Description" +msgstr "描述" + +#: ../../library/argparse.rst:61 +msgid "Values" +msgstr "數值" + +#: ../../library/argparse.rst:63 +msgid "action_" +msgstr "action_" + +#: ../../library/argparse.rst:63 +msgid "Specify how an argument should be handled" +msgstr "" + +#: ../../library/argparse.rst:63 +msgid "" +"``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " +"``'append_const'``, ``'count'``, ``'help'``, ``'version'``" +msgstr "" +"``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " +"``'append_const'``, ``'count'``, ``'help'``, ``'version'``" + +#: ../../library/argparse.rst:64 +msgid "choices_" +msgstr "choices_" + +#: ../../library/argparse.rst:64 +msgid "Limit values to a specific set of choices" +msgstr "" + +#: ../../library/argparse.rst:64 +msgid "" +"``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` " +"instance" +msgstr "" + +#: ../../library/argparse.rst:65 +msgid "const_" +msgstr "const_" + +#: ../../library/argparse.rst:65 +msgid "Store a constant value" +msgstr "" + +#: ../../library/argparse.rst:66 +msgid "default_" +msgstr "default_" + +#: ../../library/argparse.rst:66 +msgid "Default value used when an argument is not provided" +msgstr "" + +#: ../../library/argparse.rst:66 +msgid "Defaults to *None*" +msgstr "" + +#: ../../library/argparse.rst:67 +msgid "dest_" +msgstr "dest_" + +#: ../../library/argparse.rst:67 +msgid "Specify the attribute name used in the result namespace" +msgstr "" + +#: ../../library/argparse.rst:68 +msgid "help_" +msgstr "help_" + +#: ../../library/argparse.rst:68 +msgid "Help message for an argument" +msgstr "" + +#: ../../library/argparse.rst:69 +msgid "metavar_" +msgstr "metavar_" + +#: ../../library/argparse.rst:69 +msgid "Alternate display name for the argument as shown in help" +msgstr "" + +#: ../../library/argparse.rst:70 +msgid "nargs_" +msgstr "nargs_" + +#: ../../library/argparse.rst:70 +msgid "Number of times the argument can be used" +msgstr "" + +#: ../../library/argparse.rst:70 +msgid ":class:`int`, ``'?'``, ``'*'``, ``'+'``, or ``argparse.REMAINDER``" +msgstr "" + +#: ../../library/argparse.rst:71 +msgid "required_" +msgstr "required_" + +#: ../../library/argparse.rst:71 +msgid "Indicate whether an argument is required or optional" +msgstr "" + +#: ../../library/argparse.rst:71 +msgid "``True`` or ``False``" +msgstr "``True`` 或 ``False``" + +#: ../../library/argparse.rst:72 +msgid "type_" +msgstr "type_" + +#: ../../library/argparse.rst:72 +msgid "Automatically convert an argument to the given type" +msgstr "" + +#: ../../library/argparse.rst:72 +msgid "" +":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " +"function" +msgstr "" + +#: ../../library/argparse.rst:77 msgid "Example" msgstr "範例" -#: ../../library/argparse.rst:32 +#: ../../library/argparse.rst:79 msgid "" "The following code is a Python program that takes a list of integers and " "produces either the sum or the max::" msgstr "" -#: ../../library/argparse.rst:47 +#: ../../library/argparse.rst:94 msgid "" -"Assuming the Python code above is saved into a file called ``prog.py``, it " -"can be run at the command line and provides useful help messages:" +"Assuming the above Python code is saved into a file called ``prog.py``, it " +"can be run at the command line and it provides useful help messages:" msgstr "" -#: ../../library/argparse.rst:64 +#: ../../library/argparse.rst:111 msgid "" "When run with the appropriate arguments, it prints either the sum or the max " "of the command-line integers:" msgstr "" -#: ../../library/argparse.rst:75 -msgid "If invalid arguments are passed in, it will issue an error:" +#: ../../library/argparse.rst:122 +msgid "If invalid arguments are passed in, an error will be displayed:" msgstr "" -#: ../../library/argparse.rst:83 +#: ../../library/argparse.rst:130 msgid "The following sections walk you through this example." msgstr "" -#: ../../library/argparse.rst:87 +#: ../../library/argparse.rst:134 msgid "Creating a parser" msgstr "" -#: ../../library/argparse.rst:89 +#: ../../library/argparse.rst:136 msgid "" "The first step in using the :mod:`argparse` is creating an :class:" "`ArgumentParser` object::" msgstr "" -#: ../../library/argparse.rst:94 +#: ../../library/argparse.rst:141 msgid "" "The :class:`ArgumentParser` object will hold all the information necessary " "to parse the command line into Python data types." msgstr "" -#: ../../library/argparse.rst:99 +#: ../../library/argparse.rst:146 msgid "Adding arguments" msgstr "增加引數" -#: ../../library/argparse.rst:101 +#: ../../library/argparse.rst:148 msgid "" "Filling an :class:`ArgumentParser` with information about program arguments " "is done by making calls to the :meth:`~ArgumentParser.add_argument` method. " @@ -108,20 +261,20 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:113 +#: ../../library/argparse.rst:160 msgid "" "Later, calling :meth:`~ArgumentParser.parse_args` will return an object with " "two attributes, ``integers`` and ``accumulate``. The ``integers`` attribute " -"will be a list of one or more ints, and the ``accumulate`` attribute will be " -"either the :func:`sum` function, if ``--sum`` was specified at the command " -"line, or the :func:`max` function if it was not." +"will be a list of one or more integers, and the ``accumulate`` attribute " +"will be either the :func:`sum` function, if ``--sum`` was specified at the " +"command line, or the :func:`max` function if it was not." msgstr "" -#: ../../library/argparse.rst:121 +#: ../../library/argparse.rst:168 msgid "Parsing arguments" msgstr "" -#: ../../library/argparse.rst:123 +#: ../../library/argparse.rst:170 msgid "" ":class:`ArgumentParser` parses arguments through the :meth:`~ArgumentParser." "parse_args` method. This will inspect the command line, convert each " @@ -130,117 +283,117 @@ msgid "" "from attributes parsed out of the command line::" msgstr "" -#: ../../library/argparse.rst:132 +#: ../../library/argparse.rst:179 msgid "" "In a script, :meth:`~ArgumentParser.parse_args` will typically be called " "with no arguments, and the :class:`ArgumentParser` will automatically " "determine the command-line arguments from :data:`sys.argv`." msgstr "" -#: ../../library/argparse.rst:138 +#: ../../library/argparse.rst:185 msgid "ArgumentParser objects" msgstr "ArgumentParser 物件" -#: ../../library/argparse.rst:147 +#: ../../library/argparse.rst:194 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:151 +#: ../../library/argparse.rst:198 msgid "" "prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" msgstr "" -#: ../../library/argparse.rst:154 +#: ../../library/argparse.rst:201 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" msgstr "" -#: ../../library/argparse.rst:157 +#: ../../library/argparse.rst:204 msgid "description_ - Text to display before the argument help (default: none)" msgstr "" -#: ../../library/argparse.rst:159 +#: ../../library/argparse.rst:206 msgid "epilog_ - Text to display after the argument help (default: none)" msgstr "" -#: ../../library/argparse.rst:161 +#: ../../library/argparse.rst:208 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" msgstr "" -#: ../../library/argparse.rst:164 +#: ../../library/argparse.rst:211 msgid "formatter_class_ - A class for customizing the help output" msgstr "" -#: ../../library/argparse.rst:166 +#: ../../library/argparse.rst:213 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" msgstr "" -#: ../../library/argparse.rst:169 +#: ../../library/argparse.rst:216 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" -#: ../../library/argparse.rst:172 +#: ../../library/argparse.rst:219 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" -#: ../../library/argparse.rst:175 +#: ../../library/argparse.rst:222 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" -#: ../../library/argparse.rst:178 +#: ../../library/argparse.rst:225 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:180 +#: ../../library/argparse.rst:227 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:183 +#: ../../library/argparse.rst:230 msgid "" "exit_on_error_ - Determines whether or not ArgumentParser exits with error " "info when an error occurs. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:186 +#: ../../library/argparse.rst:233 msgid "*allow_abbrev* parameter was added." msgstr "新增 *allow_abbrev* 參數。" -#: ../../library/argparse.rst:189 +#: ../../library/argparse.rst:236 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" -#: ../../library/argparse.rst:193 +#: ../../library/argparse.rst:240 msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:196 ../../library/argparse.rst:716 +#: ../../library/argparse.rst:243 ../../library/argparse.rst:769 msgid "The following sections describe how each of these are used." msgstr "" -#: ../../library/argparse.rst:200 +#: ../../library/argparse.rst:249 msgid "prog" msgstr "" -#: ../../library/argparse.rst:202 +#: ../../library/argparse.rst:251 msgid "" "By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine " "how to display the name of the program in help messages. This default is " @@ -249,51 +402,51 @@ msgid "" "``myprogram.py`` with the following code::" msgstr "" -#: ../../library/argparse.rst:213 +#: ../../library/argparse.rst:262 msgid "" "The help for this program will display ``myprogram.py`` as the program name " "(regardless of where the program was invoked from):" msgstr "" -#: ../../library/argparse.rst:232 +#: ../../library/argparse.rst:281 msgid "" "To change this default behavior, another value can be supplied using the " "``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:242 +#: ../../library/argparse.rst:291 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:259 +#: ../../library/argparse.rst:308 msgid "usage" msgstr "" -#: ../../library/argparse.rst:261 +#: ../../library/argparse.rst:310 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains::" msgstr "" -#: ../../library/argparse.rst:277 +#: ../../library/argparse.rst:326 msgid "" "The default message can be overridden with the ``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:292 +#: ../../library/argparse.rst:341 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:297 +#: ../../library/argparse.rst:348 msgid "description" msgstr "描述" -#: ../../library/argparse.rst:299 +#: ../../library/argparse.rst:350 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -302,35 +455,35 @@ msgid "" "messages for the various arguments::" msgstr "" -#: ../../library/argparse.rst:314 +#: ../../library/argparse.rst:365 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:319 +#: ../../library/argparse.rst:370 msgid "epilog" msgstr "" -#: ../../library/argparse.rst:321 +#: ../../library/argparse.rst:372 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:338 +#: ../../library/argparse.rst:389 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:344 +#: ../../library/argparse.rst:395 msgid "parents" msgstr "" -#: ../../library/argparse.rst:346 +#: ../../library/argparse.rst:397 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -341,32 +494,32 @@ msgid "" "object being constructed::" msgstr "" -#: ../../library/argparse.rst:366 +#: ../../library/argparse.rst:417 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:371 +#: ../../library/argparse.rst:422 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:377 +#: ../../library/argparse.rst:430 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:379 +#: ../../library/argparse.rst:432 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:388 +#: ../../library/argparse.rst:441 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -374,14 +527,14 @@ msgid "" "command-line help messages::" msgstr "" -#: ../../library/argparse.rst:413 +#: ../../library/argparse.rst:466 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:439 +#: ../../library/argparse.rst:492 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple new lines are " @@ -389,24 +542,24 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:444 +#: ../../library/argparse.rst:497 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:462 +#: ../../library/argparse.rst:515 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:483 +#: ../../library/argparse.rst:536 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:485 +#: ../../library/argparse.rst:538 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -414,28 +567,28 @@ msgid "" "``prefix_chars=`` argument to the ArgumentParser constructor::" msgstr "" -#: ../../library/argparse.rst:497 +#: ../../library/argparse.rst:550 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:503 +#: ../../library/argparse.rst:556 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:505 +#: ../../library/argparse.rst:558 msgid "" -"Sometimes, for example when dealing with a particularly long argument list, " -"it may make sense to keep the list of arguments in a file rather than typing " -"it out at the command line. If the ``fromfile_prefix_chars=`` argument is " -"given to the :class:`ArgumentParser` constructor, then arguments that start " -"with any of the specified characters will be treated as files, and will be " -"replaced by the arguments they contain. For example::" +"Sometimes, when dealing with a particularly long argument list, it may make " +"sense to keep the list of arguments in a file rather than typing it out at " +"the command line. If the ``fromfile_prefix_chars=`` argument is given to " +"the :class:`ArgumentParser` constructor, then arguments that start with any " +"of the specified characters will be treated as files, and will be replaced " +"by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:519 +#: ../../library/argparse.rst:572 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " @@ -445,17 +598,17 @@ msgid "" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:525 +#: ../../library/argparse.rst:578 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:530 +#: ../../library/argparse.rst:583 msgid "argument_default" msgstr "argument_default" -#: ../../library/argparse.rst:532 +#: ../../library/argparse.rst:585 msgid "" "Generally, argument defaults are specified either by passing a default to :" "meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." @@ -467,26 +620,26 @@ msgid "" "supply ``argument_default=SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:552 +#: ../../library/argparse.rst:605 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:554 +#: ../../library/argparse.rst:607 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:558 +#: ../../library/argparse.rst:611 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:571 +#: ../../library/argparse.rst:624 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:573 +#: ../../library/argparse.rst:626 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -494,7 +647,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:585 +#: ../../library/argparse.rst:638 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -502,7 +655,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:601 +#: ../../library/argparse.rst:654 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -510,31 +663,31 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:608 +#: ../../library/argparse.rst:661 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:610 +#: ../../library/argparse.rst:663 msgid "" "By default, ArgumentParser objects add an option which simply displays the " "parser's help message. For example, consider a file named ``myprogram.py`` " "containing the following code::" msgstr "" -#: ../../library/argparse.rst:619 +#: ../../library/argparse.rst:672 msgid "" "If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " "help will be printed:" msgstr "" -#: ../../library/argparse.rst:631 +#: ../../library/argparse.rst:684 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:643 +#: ../../library/argparse.rst:696 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -542,119 +695,122 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:658 +#: ../../library/argparse.rst:711 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:660 +#: ../../library/argparse.rst:713 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "exit with error info." msgstr "" -#: ../../library/argparse.rst:663 +#: ../../library/argparse.rst:716 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:680 +#: ../../library/argparse.rst:733 msgid "The add_argument() method" msgstr "" -#: ../../library/argparse.rst:686 +#: ../../library/argparse.rst:739 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:689 +#: ../../library/argparse.rst:742 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " "or ``-f, --foo``." msgstr "" -#: ../../library/argparse.rst:692 +#: ../../library/argparse.rst:745 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:748 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:697 +#: ../../library/argparse.rst:750 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:699 +#: ../../library/argparse.rst:752 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:702 +#: ../../library/argparse.rst:755 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:704 +#: ../../library/argparse.rst:757 msgid "choices_ - A container of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:706 +#: ../../library/argparse.rst:759 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:709 +#: ../../library/argparse.rst:762 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:711 +#: ../../library/argparse.rst:764 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:766 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:720 +#: ../../library/argparse.rst:775 msgid "name or flags" msgstr "" -#: ../../library/argparse.rst:722 +#: ../../library/argparse.rst:777 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " "a list of filenames, is expected. The first arguments passed to :meth:" "`~ArgumentParser.add_argument` must therefore be either a series of flags, " -"or a simple argument name. For example, an optional argument could be " -"created like::" +"or a simple argument name." msgstr "" -#: ../../library/argparse.rst:731 +#: ../../library/argparse.rst:783 +msgid "For example, an optional argument could be created like::" +msgstr "" + +#: ../../library/argparse.rst:787 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:735 +#: ../../library/argparse.rst:791 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:752 +#: ../../library/argparse.rst:810 msgid "action" msgstr "" -#: ../../library/argparse.rst:754 +#: ../../library/argparse.rst:812 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -664,20 +820,21 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:760 +#: ../../library/argparse.rst:818 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action. For example::" msgstr "" -#: ../../library/argparse.rst:768 +#: ../../library/argparse.rst:826 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " -"argument. The ``'store_const'`` action is most commonly used with optional " -"arguments that specify some sort of flag. For example::" +"argument; note that the const_ keyword argument defaults to ``None``. The " +"``'store_const'`` action is most commonly used with optional arguments that " +"specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:836 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -685,33 +842,35 @@ msgid "" "``True`` respectively. For example::" msgstr "" -#: ../../library/argparse.rst:789 +#: ../../library/argparse.rst:848 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " -"list. This is useful to allow an option to be specified multiple times. " -"Example usage::" +"list. It is useful to allow an option to be specified multiple times. If the " +"default value is non-empty, the default elements will be present in the " +"parsed value for the option, with any values from the command line appended " +"after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:798 +#: ../../library/argparse.rst:859 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " -"the const_ keyword argument to the list. (Note that the const_ keyword " -"argument defaults to ``None``.) The ``'append_const'`` action is typically " +"the const_ keyword argument to the list; note that the const_ keyword " +"argument defaults to ``None``. The ``'append_const'`` action is typically " "useful when multiple arguments need to store constants to the same list. For " "example::" msgstr "" -#: ../../library/argparse.rst:810 +#: ../../library/argparse.rst:871 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:818 +#: ../../library/argparse.rst:879 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:820 +#: ../../library/argparse.rst:881 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -719,20 +878,20 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:825 +#: ../../library/argparse.rst:886 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:835 +#: ../../library/argparse.rst:896 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" -#: ../../library/argparse.rst:846 +#: ../../library/argparse.rst:907 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " @@ -740,26 +899,26 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:859 +#: ../../library/argparse.rst:920 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" -#: ../../library/argparse.rst:863 +#: ../../library/argparse.rst:924 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:883 +#: ../../library/argparse.rst:944 msgid "For more details, see :class:`Action`." msgstr "" -#: ../../library/argparse.rst:886 +#: ../../library/argparse.rst:950 msgid "nargs" msgstr "" -#: ../../library/argparse.rst:888 +#: ../../library/argparse.rst:952 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " @@ -767,19 +926,19 @@ msgid "" "supported values are:" msgstr "" -#: ../../library/argparse.rst:893 +#: ../../library/argparse.rst:957 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:902 +#: ../../library/argparse.rst:966 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:907 +#: ../../library/argparse.rst:971 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -789,13 +948,13 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:924 +#: ../../library/argparse.rst:988 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:941 +#: ../../library/argparse.rst:1005 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -803,14 +962,14 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:955 +#: ../../library/argparse.rst:1019 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:967 +#: ../../library/argparse.rst:1031 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -818,11 +977,11 @@ msgid "" "be produced." msgstr "" -#: ../../library/argparse.rst:973 +#: ../../library/argparse.rst:1039 msgid "const" msgstr "" -#: ../../library/argparse.rst:975 +#: ../../library/argparse.rst:1041 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -830,35 +989,37 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:979 +#: ../../library/argparse.rst:1045 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " "the ``const`` value to one of the attributes of the object returned by :meth:" -"`~ArgumentParser.parse_args`. See the action_ description for examples." +"`~ArgumentParser.parse_args`. See the action_ description for examples. If " +"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " +"receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:984 +#: ../../library/argparse.rst:1053 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " "argument that can be followed by zero or one command-line arguments. When " "parsing the command line, if the option string is encountered with no " "command-line argument following it, the value of ``const`` will be assumed " -"instead. See the nargs_ description for examples." +"to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:991 +#: ../../library/argparse.rst:1060 msgid "" -"With the ``'store_const'`` and ``'append_const'`` actions, the ``const`` " -"keyword argument must be given. For other actions, it defaults to ``None``." +"``const=None`` by default, including when ``action='append_const'`` or " +"``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:996 +#: ../../library/argparse.rst:1067 msgid "default" msgstr "" -#: ../../library/argparse.rst:998 +#: ../../library/argparse.rst:1069 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -868,13 +1029,13 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1012 +#: ../../library/argparse.rst:1083 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not over write it::" msgstr "" -#: ../../library/argparse.rst:1020 +#: ../../library/argparse.rst:1091 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -882,23 +1043,23 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1031 +#: ../../library/argparse.rst:1102 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1042 +#: ../../library/argparse.rst:1113 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1054 +#: ../../library/argparse.rst:1127 msgid "type" msgstr "" -#: ../../library/argparse.rst:1056 +#: ../../library/argparse.rst:1129 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -907,13 +1068,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1062 +#: ../../library/argparse.rst:1135 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1065 +#: ../../library/argparse.rst:1138 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -921,22 +1082,22 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:1070 +#: ../../library/argparse.rst:1143 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1086 +#: ../../library/argparse.rst:1159 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1098 +#: ../../library/argparse.rst:1171 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1175 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -944,7 +1105,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1107 +#: ../../library/argparse.rst:1180 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -952,7 +1113,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1112 +#: ../../library/argparse.rst:1185 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses *FileType* and then a subsequent " @@ -961,17 +1122,17 @@ msgid "" "run and then use the :keyword:`with`-statement to manage the files." msgstr "" -#: ../../library/argparse.rst:1118 +#: ../../library/argparse.rst:1191 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1123 +#: ../../library/argparse.rst:1198 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1125 +#: ../../library/argparse.rst:1200 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a container object as the *choices* " @@ -980,38 +1141,38 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1140 +#: ../../library/argparse.rst:1215 msgid "" "Note that inclusion in the *choices* container is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "container should match the type_ specified::" msgstr "" -#: ../../library/argparse.rst:1152 +#: ../../library/argparse.rst:1227 msgid "" "Any container can be passed as the *choices* value, so :class:`list` " "objects, :class:`set` objects, and custom containers are all supported." msgstr "" -#: ../../library/argparse.rst:1155 +#: ../../library/argparse.rst:1230 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1158 +#: ../../library/argparse.rst:1233 msgid "" -"Formatted choices overrides the default *metavar* which is normally derived " +"Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " "*dest* parameter. If this display isn't desirable (perhaps because there " "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1165 +#: ../../library/argparse.rst:1242 msgid "required" msgstr "" -#: ../../library/argparse.rst:1167 +#: ../../library/argparse.rst:1244 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -1019,24 +1180,24 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1180 +#: ../../library/argparse.rst:1257 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1186 +#: ../../library/argparse.rst:1263 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1191 +#: ../../library/argparse.rst:1270 msgid "help" msgstr "" -#: ../../library/argparse.rst:1193 +#: ../../library/argparse.rst:1272 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -1044,7 +1205,7 @@ msgid "" "each argument::" msgstr "" -#: ../../library/argparse.rst:1213 +#: ../../library/argparse.rst:1292 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -1053,23 +1214,23 @@ msgid "" "%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1230 +#: ../../library/argparse.rst:1309 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1233 +#: ../../library/argparse.rst:1312 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1246 +#: ../../library/argparse.rst:1327 msgid "metavar" msgstr "" -#: ../../library/argparse.rst:1248 +#: ../../library/argparse.rst:1329 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " @@ -1081,29 +1242,29 @@ msgid "" "argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1272 +#: ../../library/argparse.rst:1353 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1289 +#: ../../library/argparse.rst:1370 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1293 +#: ../../library/argparse.rst:1374 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1310 +#: ../../library/argparse.rst:1393 msgid "dest" msgstr "" -#: ../../library/argparse.rst:1312 +#: ../../library/argparse.rst:1395 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -1113,7 +1274,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1324 +#: ../../library/argparse.rst:1407 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -1125,22 +1286,22 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1341 +#: ../../library/argparse.rst:1424 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1349 +#: ../../library/argparse.rst:1432 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1351 +#: ../../library/argparse.rst:1434 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " "this API may be passed as the ``action`` parameter to :meth:`add_argument`." msgstr "" -#: ../../library/argparse.rst:1360 +#: ../../library/argparse.rst:1443 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " @@ -1149,7 +1310,7 @@ msgid "" "the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1366 +#: ../../library/argparse.rst:1449 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " @@ -1157,114 +1318,114 @@ msgid "" "these attributes are defined is to call ``Action.__init__``." msgstr "" -#: ../../library/argparse.rst:1371 +#: ../../library/argparse.rst:1454 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1374 +#: ../../library/argparse.rst:1457 msgid "``parser`` - The ArgumentParser object which contains this action." msgstr "" -#: ../../library/argparse.rst:1376 +#: ../../library/argparse.rst:1459 msgid "" "``namespace`` - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1380 +#: ../../library/argparse.rst:1463 msgid "" "``values`` - The associated command-line arguments, with any type " "conversions applied. Type conversions are specified with the type_ keyword " "argument to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1384 +#: ../../library/argparse.rst:1467 msgid "" "``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1388 +#: ../../library/argparse.rst:1471 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" -#: ../../library/argparse.rst:1391 +#: ../../library/argparse.rst:1474 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" -#: ../../library/argparse.rst:1396 +#: ../../library/argparse.rst:1479 msgid "The parse_args() method" msgstr "" -#: ../../library/argparse.rst:1400 +#: ../../library/argparse.rst:1483 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1403 +#: ../../library/argparse.rst:1486 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1407 +#: ../../library/argparse.rst:1490 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1410 +#: ../../library/argparse.rst:1493 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1415 +#: ../../library/argparse.rst:1498 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1417 +#: ../../library/argparse.rst:1500 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1429 +#: ../../library/argparse.rst:1512 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1436 +#: ../../library/argparse.rst:1519 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1442 +#: ../../library/argparse.rst:1525 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1454 +#: ../../library/argparse.rst:1537 msgid "Invalid arguments" msgstr "" -#: ../../library/argparse.rst:1456 +#: ../../library/argparse.rst:1539 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -1272,11 +1433,11 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1565 msgid "Arguments containing ``-``" msgstr "" -#: ../../library/argparse.rst:1484 +#: ../../library/argparse.rst:1567 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -1288,7 +1449,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1522 +#: ../../library/argparse.rst:1605 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -1296,28 +1457,28 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1533 +#: ../../library/argparse.rst:1616 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1535 +#: ../../library/argparse.rst:1618 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1550 +#: ../../library/argparse.rst:1633 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1556 +#: ../../library/argparse.rst:1639 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1558 +#: ../../library/argparse.rst:1641 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " @@ -1325,39 +1486,39 @@ msgid "" "testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1578 +#: ../../library/argparse.rst:1661 msgid "The Namespace object" msgstr "" -#: ../../library/argparse.rst:1582 +#: ../../library/argparse.rst:1665 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1585 +#: ../../library/argparse.rst:1668 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1595 +#: ../../library/argparse.rst:1678 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1611 +#: ../../library/argparse.rst:1694 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1614 +#: ../../library/argparse.rst:1697 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1621 +#: ../../library/argparse.rst:1704 msgid "" "Many programs split up their functionality into a number of sub-commands, " "for example, the ``svn`` program can invoke sub-commands like ``svn " @@ -1373,72 +1534,72 @@ msgid "" "can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1633 +#: ../../library/argparse.rst:1716 msgid "Description of parameters:" msgstr "" -#: ../../library/argparse.rst:1635 +#: ../../library/argparse.rst:1718 msgid "" "title - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1639 +#: ../../library/argparse.rst:1722 msgid "" "description - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1642 +#: ../../library/argparse.rst:1725 msgid "" "prog - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1646 +#: ../../library/argparse.rst:1729 msgid "" "parser_class - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" -#: ../../library/argparse.rst:1649 +#: ../../library/argparse.rst:1732 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1652 +#: ../../library/argparse.rst:1735 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1655 +#: ../../library/argparse.rst:1738 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1658 +#: ../../library/argparse.rst:1741 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1660 +#: ../../library/argparse.rst:1743 msgid "" "metavar_ - string presenting available sub-commands in help; by default it " "is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1663 +#: ../../library/argparse.rst:1746 msgid "Some example usage::" msgstr "" "一些使用範例:\n" "\n" "::" -#: ../../library/argparse.rst:1684 +#: ../../library/argparse.rst:1767 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -1448,7 +1609,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1691 +#: ../../library/argparse.rst:1774 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -1457,21 +1618,21 @@ msgid "" "to :meth:`add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1727 +#: ../../library/argparse.rst:1810 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1748 +#: ../../library/argparse.rst:1831 msgid "" "Furthermore, ``add_parser`` supports an additional ``aliases`` argument, " "which allows multiple strings to refer to the same subparser. This example, " "like ``svn``, aliases ``co`` as a shorthand for ``checkout``::" msgstr "" -#: ../../library/argparse.rst:1759 +#: ../../library/argparse.rst:1842 msgid "" "One particularly effective way of handling sub-commands is to combine the " "use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " @@ -1479,7 +1640,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1796 +#: ../../library/argparse.rst:1879 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -1489,15 +1650,15 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1812 +#: ../../library/argparse.rst:1895 msgid "New *required* keyword argument." msgstr "" -#: ../../library/argparse.rst:1817 +#: ../../library/argparse.rst:1900 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1821 +#: ../../library/argparse.rst:1904 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -1506,22 +1667,22 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1833 +#: ../../library/argparse.rst:1916 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into ``sys.stdin`` for readable :class:`FileType` objects and " "``sys.stdout`` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1842 +#: ../../library/argparse.rst:1925 msgid "The *encodings* and *errors* keyword arguments." msgstr "" -#: ../../library/argparse.rst:1847 +#: ../../library/argparse.rst:1930 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1851 +#: ../../library/argparse.rst:1934 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"optional arguments\" when displaying help " @@ -1530,7 +1691,7 @@ msgid "" "`add_argument_group` method::" msgstr "" -#: ../../library/argparse.rst:1868 +#: ../../library/argparse.rst:1951 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -1541,42 +1702,58 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:1894 +#: ../../library/argparse.rst:1977 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1899 +#: ../../library/argparse.rst:1980 +msgid "" +"Calling :meth:`add_argument_group` on an argument group is deprecated. This " +"feature was never supported and does not always work correctly. The function " +"exists on the API by accident through inheritance and will be removed in the " +"future." +msgstr "" + +#: ../../library/argparse.rst:1988 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1903 +#: ../../library/argparse.rst:1992 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1919 +#: ../../library/argparse.rst:2008 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:1931 +#: ../../library/argparse.rst:2020 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." "add_argument_group`." msgstr "" -#: ../../library/argparse.rst:1937 +#: ../../library/argparse.rst:2024 +msgid "" +"Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " +"on a mutually exclusive group is deprecated. These features were never " +"supported and do not always work correctly. The functions exist on the API " +"by accident through inheritance and will be removed in the future." +msgstr "" + +#: ../../library/argparse.rst:2032 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1941 +#: ../../library/argparse.rst:2036 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -1585,72 +1762,72 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1953 +#: ../../library/argparse.rst:2048 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1961 +#: ../../library/argparse.rst:2056 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:1967 +#: ../../library/argparse.rst:2062 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:1978 +#: ../../library/argparse.rst:2073 msgid "Printing help" msgstr "" -#: ../../library/argparse.rst:1980 +#: ../../library/argparse.rst:2075 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:1986 +#: ../../library/argparse.rst:2081 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:1992 +#: ../../library/argparse.rst:2087 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:1996 +#: ../../library/argparse.rst:2091 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2001 +#: ../../library/argparse.rst:2096 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2006 +#: ../../library/argparse.rst:2101 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2011 +#: ../../library/argparse.rst:2106 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2015 +#: ../../library/argparse.rst:2110 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -1661,7 +1838,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2031 +#: ../../library/argparse.rst:2126 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`parse_known_args`. The parser may consume an option even if it's just a " @@ -1669,11 +1846,11 @@ msgid "" "arguments list." msgstr "" -#: ../../library/argparse.rst:2038 +#: ../../library/argparse.rst:2133 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2042 +#: ../../library/argparse.rst:2137 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -1681,41 +1858,41 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2047 +#: ../../library/argparse.rst:2142 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:2146 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2060 +#: ../../library/argparse.rst:2155 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2064 +#: ../../library/argparse.rst:2159 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* before that. The user can override this " "method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2076 +#: ../../library/argparse.rst:2171 msgid "" "This method prints a usage message including the *message* to the standard " "error and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2081 +#: ../../library/argparse.rst:2176 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2086 +#: ../../library/argparse.rst:2181 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -1723,7 +1900,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2091 +#: ../../library/argparse.rst:2186 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, " @@ -1731,7 +1908,7 @@ msgid "" "optionals and positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2096 +#: ../../library/argparse.rst:2191 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -1739,7 +1916,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2111 +#: ../../library/argparse.rst:2206 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -1747,11 +1924,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2121 +#: ../../library/argparse.rst:2216 msgid "Upgrading optparse code" msgstr "" -#: ../../library/argparse.rst:2123 +#: ../../library/argparse.rst:2218 msgid "" "Originally, the :mod:`argparse` module had attempted to maintain " "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " @@ -1762,47 +1939,47 @@ msgid "" "compatibility." msgstr "" -#: ../../library/argparse.rst:2130 +#: ../../library/argparse.rst:2225 msgid "" "The :mod:`argparse` module improves on the standard library :mod:`optparse` " "module in a number of ways including:" msgstr "" -#: ../../library/argparse.rst:2133 +#: ../../library/argparse.rst:2228 msgid "Handling positional arguments." msgstr "" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2229 msgid "Supporting sub-commands." msgstr "" -#: ../../library/argparse.rst:2135 +#: ../../library/argparse.rst:2230 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "" -#: ../../library/argparse.rst:2136 +#: ../../library/argparse.rst:2231 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" -#: ../../library/argparse.rst:2137 +#: ../../library/argparse.rst:2232 msgid "Producing more informative usage messages." msgstr "" -#: ../../library/argparse.rst:2138 +#: ../../library/argparse.rst:2233 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" -#: ../../library/argparse.rst:2140 +#: ../../library/argparse.rst:2235 msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" msgstr "" -#: ../../library/argparse.rst:2142 +#: ../../library/argparse.rst:2237 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" -#: ../../library/argparse.rst:2145 +#: ../../library/argparse.rst:2240 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " @@ -1810,39 +1987,39 @@ msgid "" "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" -#: ../../library/argparse.rst:2150 +#: ../../library/argparse.rst:2245 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" -#: ../../library/argparse.rst:2154 +#: ../../library/argparse.rst:2249 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" -#: ../../library/argparse.rst:2157 +#: ../../library/argparse.rst:2252 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" -#: ../../library/argparse.rst:2160 +#: ../../library/argparse.rst:2255 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" -#: ../../library/argparse.rst:2164 +#: ../../library/argparse.rst:2259 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" -#: ../../library/argparse.rst:2168 +#: ../../library/argparse.rst:2263 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='version', version='\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -462,7 +462,7 @@ msgid "" msgstr "" #: ../../library/ast.rst:751 ../../library/ast.rst:1038 -#: ../../library/ast.rst:1211 ../../library/ast.rst:1632 +#: ../../library/ast.rst:1242 ../../library/ast.rst:1663 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "" @@ -592,20 +592,27 @@ msgstr "" #: ../../library/ast.rst:1172 msgid "" +"``try`` blocks which are followed by ``except*`` clauses. The attributes are " +"the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " +"``handlers`` are interpreted as ``except*`` blocks rather then ``except``." +msgstr "" + +#: ../../library/ast.rst:1203 +msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " "clause). ``name`` is a raw string for the name to hold the exception, or " "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -#: ../../library/ast.rst:1206 +#: ../../library/ast.rst:1237 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " "the context." msgstr "" -#: ../../library/ast.rst:1216 +#: ../../library/ast.rst:1247 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " "context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" @@ -613,18 +620,18 @@ msgid "" "if that isn't used." msgstr "" -#: ../../library/ast.rst:1249 +#: ../../library/ast.rst:1280 msgid "Pattern matching" msgstr "" -#: ../../library/ast.rst:1254 +#: ../../library/ast.rst:1285 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " "iterable of :class:`match_case` nodes with the different cases." msgstr "" -#: ../../library/ast.rst:1260 +#: ../../library/ast.rst:1291 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" @@ -632,19 +639,19 @@ msgid "" "expressions, even when they share the same syntax." msgstr "" -#: ../../library/ast.rst:1265 +#: ../../library/ast.rst:1296 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "" -#: ../../library/ast.rst:1268 +#: ../../library/ast.rst:1299 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." msgstr "" -#: ../../library/ast.rst:1311 +#: ../../library/ast.rst:1342 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -652,14 +659,14 @@ msgid "" "equal to the evaluated value." msgstr "" -#: ../../library/ast.rst:1338 +#: ../../library/ast.rst:1369 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " "pattern succeeds if the match subject is the given constant." msgstr "" -#: ../../library/ast.rst:1363 +#: ../../library/ast.rst:1394 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -667,7 +674,7 @@ msgid "" "otherwise matches a fixed length sequence." msgstr "" -#: ../../library/ast.rst:1394 +#: ../../library/ast.rst:1425 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -675,7 +682,7 @@ msgid "" "successful." msgstr "" -#: ../../library/ast.rst:1434 +#: ../../library/ast.rst:1465 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -684,7 +691,7 @@ msgid "" "statement documentation." msgstr "" -#: ../../library/ast.rst:1440 +#: ../../library/ast.rst:1471 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -693,7 +700,7 @@ msgid "" "overall mapping pattern is successful." msgstr "" -#: ../../library/ast.rst:1480 +#: ../../library/ast.rst:1511 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -704,21 +711,21 @@ msgid "" "pattern)." msgstr "" -#: ../../library/ast.rst:1487 +#: ../../library/ast.rst:1518 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " "and any specified keyword attributes match their corresponding pattern." msgstr "" -#: ../../library/ast.rst:1491 +#: ../../library/ast.rst:1522 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " "also matched that way, as described in the match statement documentation." msgstr "" -#: ../../library/ast.rst:1544 +#: ../../library/ast.rst:1575 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -726,14 +733,14 @@ msgid "" "and will always succeed." msgstr "" -#: ../../library/ast.rst:1549 +#: ../../library/ast.rst:1580 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " "and the node represents the wildcard pattern." msgstr "" -#: ../../library/ast.rst:1585 +#: ../../library/ast.rst:1616 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -742,158 +749,158 @@ msgid "" "matched against the subject." msgstr "" -#: ../../library/ast.rst:1617 +#: ../../library/ast.rst:1648 msgid "Function and class definitions" msgstr "" -#: ../../library/ast.rst:1621 +#: ../../library/ast.rst:1652 msgid "A function definition." msgstr "" -#: ../../library/ast.rst:1623 +#: ../../library/ast.rst:1654 msgid "``name`` is a raw string of the function name." msgstr "" -#: ../../library/ast.rst:1624 +#: ../../library/ast.rst:1655 msgid "``args`` is an :class:`arguments` node." msgstr "" -#: ../../library/ast.rst:1625 +#: ../../library/ast.rst:1656 msgid "``body`` is the list of nodes inside the function." msgstr "" -#: ../../library/ast.rst:1626 +#: ../../library/ast.rst:1657 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." msgstr "" -#: ../../library/ast.rst:1628 +#: ../../library/ast.rst:1659 msgid "``returns`` is the return annotation." msgstr "" -#: ../../library/ast.rst:1637 +#: ../../library/ast.rst:1668 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." msgstr "" -#: ../../library/ast.rst:1661 +#: ../../library/ast.rst:1692 msgid "The arguments for a function." msgstr "" -#: ../../library/ast.rst:1663 +#: ../../library/ast.rst:1694 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" -#: ../../library/ast.rst:1664 +#: ../../library/ast.rst:1695 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." msgstr "" -#: ../../library/ast.rst:1666 +#: ../../library/ast.rst:1697 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." msgstr "" -#: ../../library/ast.rst:1668 +#: ../../library/ast.rst:1699 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " "arguments." msgstr "" -#: ../../library/ast.rst:1675 +#: ../../library/ast.rst:1706 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name, " "``annotation`` is its annotation, such as a :class:`Str` or :class:`Name` " "node." msgstr "" -#: ../../library/ast.rst:1681 +#: ../../library/ast.rst:1712 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "" -#: ../../library/ast.rst:1725 +#: ../../library/ast.rst:1756 msgid "A ``return`` statement." msgstr "" -#: ../../library/ast.rst:1740 +#: ../../library/ast.rst:1771 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in a :class:`Expr` node if the value sent back is not " "used." msgstr "" -#: ../../library/ast.rst:1765 +#: ../../library/ast.rst:1796 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "" -#: ../../library/ast.rst:1792 +#: ../../library/ast.rst:1823 msgid "A class definition." msgstr "" -#: ../../library/ast.rst:1794 +#: ../../library/ast.rst:1825 msgid "``name`` is a raw string for the class name" msgstr "" -#: ../../library/ast.rst:1795 +#: ../../library/ast.rst:1826 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "" -#: ../../library/ast.rst:1796 +#: ../../library/ast.rst:1827 msgid "" "``keywords`` is a list of :class:`keyword` nodes, principally for " "'metaclass'. Other keywords will be passed to the metaclass, as per " -"`PEP-3115 `_." +"`PEP-3115 `_." msgstr "" -#: ../../library/ast.rst:1799 +#: ../../library/ast.rst:1830 msgid "" "``starargs`` and ``kwargs`` are each a single node, as in a function call. " "starargs will be expanded to join the list of base classes, and kwargs will " "be passed to the metaclass." msgstr "" -#: ../../library/ast.rst:1802 +#: ../../library/ast.rst:1833 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "" -#: ../../library/ast.rst:1804 +#: ../../library/ast.rst:1835 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "" -#: ../../library/ast.rst:1833 +#: ../../library/ast.rst:1864 msgid "Async and await" msgstr "" -#: ../../library/ast.rst:1837 +#: ../../library/ast.rst:1868 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "" -#: ../../library/ast.rst:1843 +#: ../../library/ast.rst:1874 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -#: ../../library/ast.rst:1876 +#: ../../library/ast.rst:1907 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -#: ../../library/ast.rst:1881 +#: ../../library/ast.rst:1912 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -902,23 +909,23 @@ msgid "" "same value (e.g. :class:`ast.Add`)." msgstr "" -#: ../../library/ast.rst:1889 +#: ../../library/ast.rst:1920 msgid ":mod:`ast` Helpers" msgstr "" -#: ../../library/ast.rst:1891 +#: ../../library/ast.rst:1922 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" msgstr "" -#: ../../library/ast.rst:1896 +#: ../../library/ast.rst:1927 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, ast.PyCF_ONLY_AST)``." msgstr "" -#: ../../library/ast.rst:1899 +#: ../../library/ast.rst:1930 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -931,14 +938,14 @@ msgid "" "empty list)." msgstr "" -#: ../../library/ast.rst:1909 +#: ../../library/ast.rst:1940 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " "List[str]``." msgstr "" -#: ../../library/ast.rst:1913 +#: ../../library/ast.rst:1944 msgid "" "Also, setting ``feature_version`` to a tuple ``(major, minor)`` will attempt " "to parse using that Python version's grammar. Currently ``major`` must equal " @@ -947,12 +954,12 @@ msgid "" "version is ``(3, 4)``; the highest is ``sys.version_info[0:2]``." msgstr "" -#: ../../library/ast.rst:1920 +#: ../../library/ast.rst:1951 msgid "" "If source contains a null character ('\\0'), :exc:`ValueError` is raised." msgstr "" -#: ../../library/ast.rst:1923 +#: ../../library/ast.rst:1954 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -962,45 +969,45 @@ msgid "" "inside a function node)." msgstr "" -#: ../../library/ast.rst:1930 +#: ../../library/ast.rst:1961 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" -#: ../../library/ast.rst:1934 +#: ../../library/ast.rst:1965 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." msgstr "" -#: ../../library/ast.rst:1938 +#: ../../library/ast.rst:1969 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "" "新增 ``type_comments``\\ 、\\ ``mode='func_type'`` 與 ``feature_version``" "\\ 。" -#: ../../library/ast.rst:1944 +#: ../../library/ast.rst:1975 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" "func:`ast.parse`." msgstr "" -#: ../../library/ast.rst:1949 +#: ../../library/ast.rst:1980 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " "optimizations, such as constant tuples/frozensets)." msgstr "" -#: ../../library/ast.rst:1954 +#: ../../library/ast.rst:1985 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "" -#: ../../library/ast.rst:1962 +#: ../../library/ast.rst:1993 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -1008,14 +1015,14 @@ msgid "" "dicts, sets, booleans, ``None`` and ``Ellipsis``." msgstr "" -#: ../../library/ast.rst:1967 +#: ../../library/ast.rst:1998 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " "arbitrarily complex expressions, for example involving operators or indexing." msgstr "" -#: ../../library/ast.rst:1972 +#: ../../library/ast.rst:2003 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -1027,31 +1034,31 @@ msgid "" "untrusted data is thus not recommended." msgstr "" -#: ../../library/ast.rst:1982 +#: ../../library/ast.rst:2013 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "" -#: ../../library/ast.rst:1985 +#: ../../library/ast.rst:2016 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "" -#: ../../library/ast.rst:1989 +#: ../../library/ast.rst:2020 msgid "Now allows bytes and set literals." msgstr "" -#: ../../library/ast.rst:1992 +#: ../../library/ast.rst:2023 msgid "Now supports creating empty sets with ``'set()'``." msgstr "" -#: ../../library/ast.rst:1995 +#: ../../library/ast.rst:2026 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "" -#: ../../library/ast.rst:2001 +#: ../../library/ast.rst:2032 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -1059,24 +1066,24 @@ msgid "" "clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -#: ../../library/ast.rst:2007 +#: ../../library/ast.rst:2038 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`\\ 。" -#: ../../library/ast.rst:2013 +#: ../../library/ast.rst:2044 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`lineno`, :attr:`end_lineno`, :attr:" "`col_offset`, or :attr:`end_col_offset`) is missing, return ``None``." msgstr "" -#: ../../library/ast.rst:2017 +#: ../../library/ast.rst:2048 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." msgstr "" -#: ../../library/ast.rst:2025 +#: ../../library/ast.rst:2056 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`lineno` and :attr:`col_offset` attributes for every node that supports " @@ -1085,77 +1092,77 @@ msgid "" "the values of the parent node. It works recursively starting at *node*." msgstr "" -#: ../../library/ast.rst:2034 +#: ../../library/ast.rst:2065 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " "location in a file." msgstr "" -#: ../../library/ast.rst:2041 +#: ../../library/ast.rst:2072 msgid "" "Copy source location (:attr:`lineno`, :attr:`col_offset`, :attr:" "`end_lineno`, and :attr:`end_col_offset`) from *old_node* to *new_node* if " "possible, and return *new_node*." msgstr "" -#: ../../library/ast.rst:2048 +#: ../../library/ast.rst:2079 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." msgstr "" -#: ../../library/ast.rst:2054 +#: ../../library/ast.rst:2085 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." msgstr "" -#: ../../library/ast.rst:2060 +#: ../../library/ast.rst:2091 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " "only want to modify nodes in place and don't care about the context." msgstr "" -#: ../../library/ast.rst:2067 +#: ../../library/ast.rst:2098 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " "which is forwarded by the :meth:`visit` method." msgstr "" -#: ../../library/ast.rst:2071 +#: ../../library/ast.rst:2102 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "" -#: ../../library/ast.rst:2076 +#: ../../library/ast.rst:2107 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " "or :meth:`generic_visit` if that method doesn't exist." msgstr "" -#: ../../library/ast.rst:2082 +#: ../../library/ast.rst:2113 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "" -#: ../../library/ast.rst:2084 +#: ../../library/ast.rst:2115 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." msgstr "" -#: ../../library/ast.rst:2088 +#: ../../library/ast.rst:2119 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" "`NodeTransformer`) that allows modifications." msgstr "" -#: ../../library/ast.rst:2094 +#: ../../library/ast.rst:2125 msgid "" "Methods :meth:`visit_Num`, :meth:`visit_Str`, :meth:`visit_Bytes`, :meth:" "`visit_NameConstant` and :meth:`visit_Ellipsis` are deprecated now and will " @@ -1163,13 +1170,13 @@ msgid "" "method to handle all constant nodes." msgstr "" -#: ../../library/ast.rst:2102 +#: ../../library/ast.rst:2133 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "" -#: ../../library/ast.rst:2105 +#: ../../library/ast.rst:2136 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -1178,27 +1185,27 @@ msgid "" "may be the original node in which case no replacement takes place." msgstr "" -#: ../../library/ast.rst:2111 +#: ../../library/ast.rst:2142 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" msgstr "" -#: ../../library/ast.rst:2123 +#: ../../library/ast.rst:2154 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`generic_visit` " "method for the node first." msgstr "" -#: ../../library/ast.rst:2127 +#: ../../library/ast.rst:2158 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " "just a single node." msgstr "" -#: ../../library/ast.rst:2131 +#: ../../library/ast.rst:2162 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:" @@ -1206,11 +1213,11 @@ msgid "" "tree to recalculate the location information::" msgstr "" -#: ../../library/ast.rst:2139 +#: ../../library/ast.rst:2170 msgid "Usually you use the transformer like this::" msgstr "" -#: ../../library/ast.rst:2146 +#: ../../library/ast.rst:2177 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -1221,7 +1228,7 @@ msgid "" "true." msgstr "" -#: ../../library/ast.rst:2154 +#: ../../library/ast.rst:2185 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or ``" @@ -1231,87 +1238,87 @@ msgid "" "string is used to indent each level." msgstr "" -#: ../../library/ast.rst:2161 +#: ../../library/ast.rst:2192 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2168 +#: ../../library/ast.rst:2199 msgid "Compiler Flags" msgstr "" -#: ../../library/ast.rst:2170 +#: ../../library/ast.rst:2201 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "" -#: ../../library/ast.rst:2175 +#: ../../library/ast.rst:2206 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." msgstr "" -#: ../../library/ast.rst:2182 +#: ../../library/ast.rst:2213 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "" -#: ../../library/ast.rst:2187 +#: ../../library/ast.rst:2218 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." msgstr "" -#: ../../library/ast.rst:2196 +#: ../../library/ast.rst:2227 msgid "Command-Line Usage" msgstr "" -#: ../../library/ast.rst:2200 +#: ../../library/ast.rst:2231 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr "" -#: ../../library/ast.rst:2207 +#: ../../library/ast.rst:2238 msgid "The following options are accepted:" msgstr "" -#: ../../library/ast.rst:2213 +#: ../../library/ast.rst:2244 msgid "Show the help message and exit." msgstr "" -#: ../../library/ast.rst:2218 +#: ../../library/ast.rst:2249 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "" -#: ../../library/ast.rst:2223 +#: ../../library/ast.rst:2254 msgid "Don't parse type comments." msgstr "" -#: ../../library/ast.rst:2227 +#: ../../library/ast.rst:2258 msgid "Include attributes such as line numbers and column offsets." msgstr "" -#: ../../library/ast.rst:2232 +#: ../../library/ast.rst:2263 msgid "Indentation of nodes in AST (number of spaces)." msgstr "" -#: ../../library/ast.rst:2234 +#: ../../library/ast.rst:2265 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." msgstr "" -#: ../../library/ast.rst:2240 +#: ../../library/ast.rst:2271 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." msgstr "" -#: ../../library/ast.rst:2243 +#: ../../library/ast.rst:2274 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -1319,21 +1326,21 @@ msgid "" "transformations." msgstr "" -#: ../../library/ast.rst:2248 +#: ../../library/ast.rst:2279 msgid "" "`leoAst.py `_ unifies the " "token-based and parse-tree-based views of python programs by inserting two-" "way links between tokens and ast nodes." msgstr "" -#: ../../library/ast.rst:2252 +#: ../../library/ast.rst:2283 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " "useful for building automated refactoring (codemod) applications and linters." msgstr "" -#: ../../library/ast.rst:2257 +#: ../../library/ast.rst:2288 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/asynchat.po b/library/asynchat.po index f45aafa740..91a4fdc536 100644 --- a/library/asynchat.po +++ b/library/asynchat.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" -"PO-Revision-Date: 2022-05-22 01:58+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 04:51+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/asynchat.rst:2 msgid ":mod:`asynchat` --- Asynchronous socket command/response handler" @@ -27,13 +27,13 @@ msgstr ":mod:`asynchat` --- 非同步 socket 指令/回應處理函式" msgid "**Source code:** :source:`Lib/asynchat.py`" msgstr "**原始碼:**\\ :source:`Lib/asynchat.py`" -#: ../../library/asynchat.rst:13 +#: ../../library/asynchat.rst:17 msgid "" -":mod:`asynchat` will be removed in Python 3.12 (see :pep:`PEP 594 " -"<594#asynchat>` for details). Please use :mod:`asyncio` instead." +"The :mod:`asynchat` module is deprecated (see :pep:`PEP 594 <594#asynchat>` " +"for details). Please use :mod:`asyncio` instead." msgstr "" -":mod:`asynchat` 將於 Python 3.12 中移除(詳情請見:pep:`PEP 594 " -"<594#asynchat>`\\ )。請改用 :mod:`asyncio`\\ 。" +":mod:`asynchat` 已被棄用(詳情請見:pep:`PEP 594 <594#asynchat>`\\ )。請改" +"用 :mod:`asyncio`\\ 。" #: ../../library/asynchat.rst:22 msgid "" @@ -56,7 +56,18 @@ msgid "" "connection requests." msgstr "" -#: ../../library/asynchat.rst:40 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/asynchat.rst:41 msgid "" "This class is an abstract subclass of :class:`asyncore.dispatcher`. To make " "practical use of the code you must subclass :class:`async_chat`, providing " @@ -65,7 +76,7 @@ msgid "" "all make sense in a message/response context." msgstr "" -#: ../../library/asynchat.rst:47 +#: ../../library/asynchat.rst:48 msgid "" "Like :class:`asyncore.dispatcher`, :class:`async_chat` defines a set of " "events that are generated by an analysis of socket conditions after a :c:" @@ -74,21 +85,21 @@ msgid "" "with no action on the part of the programmer." msgstr "" -#: ../../library/asynchat.rst:53 +#: ../../library/asynchat.rst:54 msgid "" "Two class attributes can be modified, to improve performance, or possibly " "even to conserve memory." msgstr "" -#: ../../library/asynchat.rst:59 +#: ../../library/asynchat.rst:60 msgid "The asynchronous input buffer size (default ``4096``)." msgstr "" -#: ../../library/asynchat.rst:64 +#: ../../library/asynchat.rst:65 msgid "The asynchronous output buffer size (default ``4096``)." msgstr "" -#: ../../library/asynchat.rst:66 +#: ../../library/asynchat.rst:67 msgid "" "Unlike :class:`asyncore.dispatcher`, :class:`async_chat` allows you to " "define a :abbr:`FIFO (first-in, first-out)` queue of *producers*. A producer " @@ -103,7 +114,7 @@ msgid "" "transmission from the remote endpoint." msgstr "" -#: ../../library/asynchat.rst:79 +#: ../../library/asynchat.rst:80 msgid "" "To build a functioning :class:`async_chat` subclass your input methods :" "meth:`collect_incoming_data` and :meth:`found_terminator` must handle the " @@ -111,26 +122,26 @@ msgid "" "below." msgstr "" -#: ../../library/asynchat.rst:87 +#: ../../library/asynchat.rst:88 msgid "" "Pushes a ``None`` on to the producer queue. When this producer is popped off " "the queue it causes the channel to be closed." msgstr "" -#: ../../library/asynchat.rst:93 +#: ../../library/asynchat.rst:94 msgid "" "Called with *data* holding an arbitrary amount of received data. The " "default method, which must be overridden, raises a :exc:" "`NotImplementedError` exception." msgstr "" -#: ../../library/asynchat.rst:100 +#: ../../library/asynchat.rst:101 msgid "" "In emergencies this method will discard any data held in the input and/or " "output buffers and the producer queue." msgstr "" -#: ../../library/asynchat.rst:106 +#: ../../library/asynchat.rst:107 msgid "" "Called when the incoming data stream matches the termination condition set " "by :meth:`set_terminator`. The default method, which must be overridden, " @@ -138,11 +149,11 @@ msgid "" "should be available via an instance attribute." msgstr "" -#: ../../library/asynchat.rst:114 +#: ../../library/asynchat.rst:115 msgid "Returns the current terminator for the channel." msgstr "" -#: ../../library/asynchat.rst:119 +#: ../../library/asynchat.rst:120 msgid "" "Pushes data on to the channel's queue to ensure its transmission. This is " "all you need to do to have the channel write the data out to the network, " @@ -150,7 +161,7 @@ msgid "" "implement encryption and chunking, for example." msgstr "" -#: ../../library/asynchat.rst:127 +#: ../../library/asynchat.rst:128 msgid "" "Takes a producer object and adds it to the producer queue associated with " "the channel. When all currently pushed producers have been exhausted the " @@ -158,60 +169,60 @@ msgid "" "and send the data to the remote endpoint." msgstr "" -#: ../../library/asynchat.rst:135 +#: ../../library/asynchat.rst:136 msgid "" "Sets the terminating condition to be recognized on the channel. ``term`` " "may be any of three types of value, corresponding to three different ways to " "handle incoming protocol data." msgstr "" -#: ../../library/asynchat.rst:140 +#: ../../library/asynchat.rst:141 msgid "term" msgstr "" -#: ../../library/asynchat.rst:140 +#: ../../library/asynchat.rst:141 msgid "Description" msgstr "描述" -#: ../../library/asynchat.rst:142 +#: ../../library/asynchat.rst:143 msgid "*string*" msgstr "" -#: ../../library/asynchat.rst:142 +#: ../../library/asynchat.rst:143 msgid "" "Will call :meth:`found_terminator` when the string is found in the input " "stream" msgstr "" -#: ../../library/asynchat.rst:145 +#: ../../library/asynchat.rst:146 msgid "*integer*" msgstr "" -#: ../../library/asynchat.rst:145 +#: ../../library/asynchat.rst:146 msgid "" "Will call :meth:`found_terminator` when the indicated number of characters " "have been received" msgstr "" -#: ../../library/asynchat.rst:149 +#: ../../library/asynchat.rst:150 msgid "``None``" msgstr "``None``" -#: ../../library/asynchat.rst:149 +#: ../../library/asynchat.rst:150 msgid "The channel continues to collect data forever" msgstr "" -#: ../../library/asynchat.rst:153 +#: ../../library/asynchat.rst:154 msgid "" "Note that any data following the terminator will be available for reading by " "the channel after :meth:`found_terminator` is called." msgstr "" -#: ../../library/asynchat.rst:160 +#: ../../library/asynchat.rst:161 msgid "asynchat Example" msgstr "" -#: ../../library/asynchat.rst:162 +#: ../../library/asynchat.rst:163 msgid "" "The following partial example shows how HTTP requests can be read with :" "class:`async_chat`. A web server might create an :class:" @@ -221,7 +232,7 @@ msgid "" "read." msgstr "" -#: ../../library/asynchat.rst:169 +#: ../../library/asynchat.rst:170 msgid "" "Once the headers have been read, if the request is of type POST (indicating " "that further data are present in the input stream) then the ``Content-Length:" @@ -229,7 +240,7 @@ msgid "" "data from the channel." msgstr "" -#: ../../library/asynchat.rst:174 +#: ../../library/asynchat.rst:175 msgid "" "The :meth:`handle_request` method is called once all relevant input has been " "marshalled, after setting the channel terminator to ``None`` to ensure that " diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index bfd31c75d0..4a100fa9b4 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-01-27 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,111 +48,137 @@ msgid "Create event loop, run a coroutine, close the loop." msgstr "建立事件迴圈 (event loop)、執行一個協程 (coroutine)、關閉事件迴圈。" #: ../../library/asyncio-api-index.rst:24 -msgid ":func:`create_task`" -msgstr ":func:`create_task`" +msgid ":class:`Runner`" +msgstr ":class:`Runner`" #: ../../library/asyncio-api-index.rst:25 -msgid "Start an asyncio Task." -msgstr "啟動一個 asyncio 的 Task 物件。" +msgid "A context manager that simplifies multiple async function calls." +msgstr "" #: ../../library/asyncio-api-index.rst:27 +msgid ":class:`Task`" +msgstr ":class:`Task`" + +#: ../../library/asyncio-api-index.rst:28 +msgid "Task object." +msgstr "Task 物件。" + +#: ../../library/asyncio-api-index.rst:30 +msgid ":class:`TaskGroup`" +msgstr ":class:`TaskGroup`" + +#: ../../library/asyncio-api-index.rst:31 +msgid "" +"A context manager that holds a group of tasks. Provides a convenient and " +"reliable way to wait for all tasks in the group to finish." +msgstr "" + +#: ../../library/asyncio-api-index.rst:35 +msgid ":func:`create_task`" +msgstr ":func:`create_task`" + +#: ../../library/asyncio-api-index.rst:36 +msgid "Start an asyncio Task, then returns it." +msgstr "啟動一個 asyncio 的 Task 物件,然後回傳它。" + +#: ../../library/asyncio-api-index.rst:38 +msgid ":func:`current_task`" +msgstr ":func:`current_task`" + +#: ../../library/asyncio-api-index.rst:39 +msgid "Return the current Task." +msgstr "回傳當前 Task 物件。" + +#: ../../library/asyncio-api-index.rst:41 +msgid ":func:`all_tasks`" +msgstr ":func:`all_tasks`" + +#: ../../library/asyncio-api-index.rst:42 +msgid "Return all tasks that are not yet finished for an event loop." +msgstr "回傳事件迴圈中所有未完成的 task 物件。" + +#: ../../library/asyncio-api-index.rst:44 msgid "``await`` :func:`sleep`" msgstr "``await`` :func:`sleep`" -#: ../../library/asyncio-api-index.rst:28 +#: ../../library/asyncio-api-index.rst:45 msgid "Sleep for a number of seconds." msgstr "休眠數秒鐘。" -#: ../../library/asyncio-api-index.rst:30 +#: ../../library/asyncio-api-index.rst:47 msgid "``await`` :func:`gather`" msgstr "``await`` :func:`gather`" -#: ../../library/asyncio-api-index.rst:31 +#: ../../library/asyncio-api-index.rst:48 msgid "Schedule and wait for things concurrently." msgstr "並行 (concurrent) 地執行事件的排程與等待。" -#: ../../library/asyncio-api-index.rst:33 +#: ../../library/asyncio-api-index.rst:50 msgid "``await`` :func:`wait_for`" msgstr "``await`` :func:`wait_for`" -#: ../../library/asyncio-api-index.rst:34 +#: ../../library/asyncio-api-index.rst:51 msgid "Run with a timeout." msgstr "有超時設置的執行。" -#: ../../library/asyncio-api-index.rst:36 +#: ../../library/asyncio-api-index.rst:53 msgid "``await`` :func:`shield`" msgstr "``await`` :func:`shield`" -#: ../../library/asyncio-api-index.rst:37 +#: ../../library/asyncio-api-index.rst:54 msgid "Shield from cancellation." msgstr "屏蔽取消操作。" -#: ../../library/asyncio-api-index.rst:39 +#: ../../library/asyncio-api-index.rst:56 msgid "``await`` :func:`wait`" msgstr "``await`` :func:`wait`" -#: ../../library/asyncio-api-index.rst:40 +#: ../../library/asyncio-api-index.rst:57 msgid "Monitor for completion." msgstr "監控完成情況。" -#: ../../library/asyncio-api-index.rst:42 -msgid ":func:`current_task`" -msgstr ":func:`current_task`" +#: ../../library/asyncio-api-index.rst:59 +msgid ":func:`timeout`" +msgstr ":func:`timeout`" -#: ../../library/asyncio-api-index.rst:43 -msgid "Return the current Task." -msgstr "回傳當前 Task 物件。" - -#: ../../library/asyncio-api-index.rst:45 -msgid ":func:`all_tasks`" -msgstr ":func:`all_tasks`" - -#: ../../library/asyncio-api-index.rst:46 -msgid "Return all tasks for an event loop." -msgstr "回傳事件迴圈中所有的 task 物件。" - -#: ../../library/asyncio-api-index.rst:48 -msgid ":class:`Task`" -msgstr ":class:`Task`" - -#: ../../library/asyncio-api-index.rst:49 -msgid "Task object." -msgstr "Task 物件。" +#: ../../library/asyncio-api-index.rst:60 +msgid "Run with a timeout. Useful in cases when `wait_for` is not suitable." +msgstr "" -#: ../../library/asyncio-api-index.rst:51 +#: ../../library/asyncio-api-index.rst:62 msgid ":func:`to_thread`" msgstr ":func:`to_thread`" -#: ../../library/asyncio-api-index.rst:52 +#: ../../library/asyncio-api-index.rst:63 msgid "Asynchronously run a function in a separate OS thread." msgstr "在不同的 OS 執行緒 (thread) 中非同步地執行一個函式。" -#: ../../library/asyncio-api-index.rst:54 +#: ../../library/asyncio-api-index.rst:65 msgid ":func:`run_coroutine_threadsafe`" msgstr ":func:`run_coroutine_threadsafe`" -#: ../../library/asyncio-api-index.rst:55 +#: ../../library/asyncio-api-index.rst:66 msgid "Schedule a coroutine from another OS thread." msgstr "從其他 OS 執行緒中為一個協程排程。" -#: ../../library/asyncio-api-index.rst:57 +#: ../../library/asyncio-api-index.rst:68 msgid "``for in`` :func:`as_completed`" msgstr "``for in`` :func:`as_completed`" -#: ../../library/asyncio-api-index.rst:58 +#: ../../library/asyncio-api-index.rst:69 msgid "Monitor for completion with a ``for`` loop." msgstr "用 ``for`` 迴圈來監控完成情況。" -#: ../../library/asyncio-api-index.rst:62 -#: ../../library/asyncio-api-index.rst:98 -#: ../../library/asyncio-api-index.rst:122 -#: ../../library/asyncio-api-index.rst:158 -#: ../../library/asyncio-api-index.rst:191 -#: ../../library/asyncio-api-index.rst:216 +#: ../../library/asyncio-api-index.rst:73 +#: ../../library/asyncio-api-index.rst:109 +#: ../../library/asyncio-api-index.rst:133 +#: ../../library/asyncio-api-index.rst:169 +#: ../../library/asyncio-api-index.rst:205 +#: ../../library/asyncio-api-index.rst:230 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-api-index.rst:63 +#: ../../library/asyncio-api-index.rst:74 msgid "" ":ref:`Using asyncio.gather() to run things in parallel " "`." @@ -160,30 +186,30 @@ msgstr "" ":ref:`使用 asyncio.gather() 平行 (parallel) 執行 `" "\\ 。" -#: ../../library/asyncio-api-index.rst:66 +#: ../../library/asyncio-api-index.rst:77 msgid "" ":ref:`Using asyncio.wait_for() to enforce a timeout " "`." msgstr "" ":ref:`使用 asyncio.wait_for() 強制設置超時 `\\ 。" -#: ../../library/asyncio-api-index.rst:69 +#: ../../library/asyncio-api-index.rst:80 msgid ":ref:`Cancellation `." msgstr ":ref:`取消任務 `\\ 。" -#: ../../library/asyncio-api-index.rst:71 +#: ../../library/asyncio-api-index.rst:82 msgid ":ref:`Using asyncio.sleep() `." msgstr ":ref:`使用 asyncio.sleep() `\\ 。" -#: ../../library/asyncio-api-index.rst:73 +#: ../../library/asyncio-api-index.rst:84 msgid "See also the main :ref:`Tasks documentation page `." msgstr "請參閱 :ref:`Tasks 文件頁面 `\\ 。" -#: ../../library/asyncio-api-index.rst:77 +#: ../../library/asyncio-api-index.rst:88 msgid "Queues" msgstr "佇列 (Queues)" -#: ../../library/asyncio-api-index.rst:79 +#: ../../library/asyncio-api-index.rst:90 msgid "" "Queues should be used to distribute work amongst multiple asyncio Tasks, " "implement connection pools, and pub/sub patterns." @@ -191,31 +217,31 @@ msgstr "" "佇列應被用於為多個 asyncio Task 物件分配工作、實作 connection pools(連線池)" "以及 pub/sub(發行/訂閱)模式。" -#: ../../library/asyncio-api-index.rst:87 +#: ../../library/asyncio-api-index.rst:98 msgid ":class:`Queue`" msgstr ":class:`Queue`" -#: ../../library/asyncio-api-index.rst:88 +#: ../../library/asyncio-api-index.rst:99 msgid "A FIFO queue." msgstr "一個先進先出 (FIFO) 佇列。" -#: ../../library/asyncio-api-index.rst:90 +#: ../../library/asyncio-api-index.rst:101 msgid ":class:`PriorityQueue`" msgstr ":class:`PriorityQueue`" -#: ../../library/asyncio-api-index.rst:91 +#: ../../library/asyncio-api-index.rst:102 msgid "A priority queue." msgstr "一個優先佇列 (priority queue)。" -#: ../../library/asyncio-api-index.rst:93 +#: ../../library/asyncio-api-index.rst:104 msgid ":class:`LifoQueue`" msgstr ":class:`LifoQueue`" -#: ../../library/asyncio-api-index.rst:94 +#: ../../library/asyncio-api-index.rst:105 msgid "A LIFO queue." msgstr "一個後進先出 (LIFO) 佇列。" -#: ../../library/asyncio-api-index.rst:99 +#: ../../library/asyncio-api-index.rst:110 msgid "" ":ref:`Using asyncio.Queue to distribute workload between several Tasks " "`." @@ -223,190 +249,197 @@ msgstr "" ":ref:`使用 asyncio.Queue 為多個 Task 分配工作 `" "\\ 。" -#: ../../library/asyncio-api-index.rst:102 +#: ../../library/asyncio-api-index.rst:113 msgid "See also the :ref:`Queues documentation page `." msgstr "請參閱\\ :ref:`佇列文件頁面 `\\ 。" -#: ../../library/asyncio-api-index.rst:106 +#: ../../library/asyncio-api-index.rst:117 msgid "Subprocesses" msgstr "子行程 (Subprocesses)" -#: ../../library/asyncio-api-index.rst:108 +#: ../../library/asyncio-api-index.rst:119 msgid "Utilities to spawn subprocesses and run shell commands." msgstr "用於衍生(spawn)子行程和執行 shell 指令的工具程式。" -#: ../../library/asyncio-api-index.rst:114 +#: ../../library/asyncio-api-index.rst:125 msgid "``await`` :func:`create_subprocess_exec`" msgstr "``await`` :func:`create_subprocess_exec`" -#: ../../library/asyncio-api-index.rst:115 +#: ../../library/asyncio-api-index.rst:126 msgid "Create a subprocess." msgstr "建立一個子行程。" -#: ../../library/asyncio-api-index.rst:117 +#: ../../library/asyncio-api-index.rst:128 msgid "``await`` :func:`create_subprocess_shell`" msgstr "``await`` :func:`create_subprocess_shell`" -#: ../../library/asyncio-api-index.rst:118 +#: ../../library/asyncio-api-index.rst:129 msgid "Run a shell command." msgstr "執行一個 shell 命令。" -#: ../../library/asyncio-api-index.rst:123 +#: ../../library/asyncio-api-index.rst:134 msgid ":ref:`Executing a shell command `." msgstr ":ref:`執行一個 shell 指令 `\\ 。" -#: ../../library/asyncio-api-index.rst:125 +#: ../../library/asyncio-api-index.rst:136 msgid "See also the :ref:`subprocess APIs ` documentation." msgstr "請參閱\\ :ref:`子行程 APIs ` 相關文件。" -#: ../../library/asyncio-api-index.rst:130 +#: ../../library/asyncio-api-index.rst:141 msgid "Streams" msgstr "串流 (Streams)" -#: ../../library/asyncio-api-index.rst:132 +#: ../../library/asyncio-api-index.rst:143 msgid "High-level APIs to work with network IO." msgstr "用於網路 IO 處理的高階 API。" -#: ../../library/asyncio-api-index.rst:138 +#: ../../library/asyncio-api-index.rst:149 msgid "``await`` :func:`open_connection`" msgstr "``await`` :func:`open_connection`" -#: ../../library/asyncio-api-index.rst:139 +#: ../../library/asyncio-api-index.rst:150 msgid "Establish a TCP connection." msgstr "建立一個 TCP 連線。" -#: ../../library/asyncio-api-index.rst:141 +#: ../../library/asyncio-api-index.rst:152 msgid "``await`` :func:`open_unix_connection`" msgstr "``await`` :func:`open_unix_connection`" -#: ../../library/asyncio-api-index.rst:142 +#: ../../library/asyncio-api-index.rst:153 msgid "Establish a Unix socket connection." msgstr "建立一個 Unix socket 連線。" -#: ../../library/asyncio-api-index.rst:144 +#: ../../library/asyncio-api-index.rst:155 msgid "``await`` :func:`start_server`" msgstr "``await`` :func:`start_server`" -#: ../../library/asyncio-api-index.rst:145 +#: ../../library/asyncio-api-index.rst:156 msgid "Start a TCP server." msgstr "啟動一個 TCP 伺服器。" -#: ../../library/asyncio-api-index.rst:147 +#: ../../library/asyncio-api-index.rst:158 msgid "``await`` :func:`start_unix_server`" msgstr "``await`` :func:`start_unix_server`" -#: ../../library/asyncio-api-index.rst:148 +#: ../../library/asyncio-api-index.rst:159 msgid "Start a Unix socket server." msgstr "啟動一個 Unix socket 伺服器。" -#: ../../library/asyncio-api-index.rst:150 +#: ../../library/asyncio-api-index.rst:161 msgid ":class:`StreamReader`" msgstr ":class:`StreamReader`" -#: ../../library/asyncio-api-index.rst:151 +#: ../../library/asyncio-api-index.rst:162 msgid "High-level async/await object to receive network data." msgstr "接收網路資料的高階 async/await 物件。" -#: ../../library/asyncio-api-index.rst:153 +#: ../../library/asyncio-api-index.rst:164 msgid ":class:`StreamWriter`" msgstr ":class:`StreamWriter`" -#: ../../library/asyncio-api-index.rst:154 +#: ../../library/asyncio-api-index.rst:165 msgid "High-level async/await object to send network data." msgstr "傳送網路資料的高階 async/await 物件。" -#: ../../library/asyncio-api-index.rst:159 +#: ../../library/asyncio-api-index.rst:170 msgid ":ref:`Example TCP client `." msgstr ":ref:`TCP 客戶端範例 `\\ 。" -#: ../../library/asyncio-api-index.rst:161 +#: ../../library/asyncio-api-index.rst:172 msgid "See also the :ref:`streams APIs ` documentation." msgstr "請參閱\\ :ref:`串流 APIs ` 文件。" -#: ../../library/asyncio-api-index.rst:166 +#: ../../library/asyncio-api-index.rst:177 msgid "Synchronization" msgstr "同步化 (Synchronization)" -#: ../../library/asyncio-api-index.rst:168 +#: ../../library/asyncio-api-index.rst:179 msgid "Threading-like synchronization primitives that can be used in Tasks." msgstr "類似執行緒且能被用於 Task 中的同步化原始物件 (primitive)。" -#: ../../library/asyncio-api-index.rst:174 +#: ../../library/asyncio-api-index.rst:185 msgid ":class:`Lock`" msgstr ":class:`Lock`" -#: ../../library/asyncio-api-index.rst:175 +#: ../../library/asyncio-api-index.rst:186 msgid "A mutex lock." msgstr "一個互斥鎖 (mutex lock)。" -#: ../../library/asyncio-api-index.rst:177 +#: ../../library/asyncio-api-index.rst:188 msgid ":class:`Event`" msgstr ":class:`Event`" -#: ../../library/asyncio-api-index.rst:178 +#: ../../library/asyncio-api-index.rst:189 msgid "An event object." msgstr "一個事件物件。" -#: ../../library/asyncio-api-index.rst:180 +#: ../../library/asyncio-api-index.rst:191 msgid ":class:`Condition`" msgstr ":class:`Condition`" -#: ../../library/asyncio-api-index.rst:181 +#: ../../library/asyncio-api-index.rst:192 msgid "A condition object." msgstr "一個條件物件。" -#: ../../library/asyncio-api-index.rst:183 +#: ../../library/asyncio-api-index.rst:194 msgid ":class:`Semaphore`" msgstr ":class:`Semaphore`" -#: ../../library/asyncio-api-index.rst:184 +#: ../../library/asyncio-api-index.rst:195 msgid "A semaphore." msgstr "一個旗號 (semaphore) 物件。" -#: ../../library/asyncio-api-index.rst:186 +#: ../../library/asyncio-api-index.rst:197 msgid ":class:`BoundedSemaphore`" msgstr ":class:`BoundedSemaphore`" -#: ../../library/asyncio-api-index.rst:187 +#: ../../library/asyncio-api-index.rst:198 msgid "A bounded semaphore." msgstr "一個有界的旗號物件。" -#: ../../library/asyncio-api-index.rst:192 +#: ../../library/asyncio-api-index.rst:200 +msgid ":class:`Barrier`" +msgstr ":class:`Barrier`" + +#: ../../library/asyncio-api-index.rst:201 +msgid "A barrier object." +msgstr "一個屏障物件。" + +#: ../../library/asyncio-api-index.rst:206 msgid ":ref:`Using asyncio.Event `." msgstr ":ref:`使用 asyncio.Event `。" -#: ../../library/asyncio-api-index.rst:194 +#: ../../library/asyncio-api-index.rst:208 +msgid ":ref:`Using asyncio.Barrier `." +msgstr ":ref:`使用 asyncio.Barrier `。" + +#: ../../library/asyncio-api-index.rst:210 msgid "" "See also the documentation of asyncio :ref:`synchronization primitives " "`." msgstr "請參閱 asyncio 關於\\ :ref:`同步化原始物件 `\\ 的文件。" -#: ../../library/asyncio-api-index.rst:199 +#: ../../library/asyncio-api-index.rst:215 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-api-index.rst:206 -msgid ":exc:`asyncio.TimeoutError`" -msgstr ":exc:`asyncio.TimeoutError`" - -#: ../../library/asyncio-api-index.rst:207 -msgid "" -"Raised on timeout by functions like :func:`wait_for`. Keep in mind that " -"``asyncio.TimeoutError`` is **unrelated** to the built-in :exc:" -"`TimeoutError` exception." -msgstr "" -"在像是 :func:`wait_for` 等函式超時的時候被引發。請注意 ``asyncio." -"TimeoutError`` 與內建例外 :exc:`TimeoutError` **無關**\\ 。" - -#: ../../library/asyncio-api-index.rst:211 +#: ../../library/asyncio-api-index.rst:222 msgid ":exc:`asyncio.CancelledError`" msgstr ":exc:`asyncio.CancelledError`" -#: ../../library/asyncio-api-index.rst:212 +#: ../../library/asyncio-api-index.rst:223 msgid "Raised when a Task is cancelled. See also :meth:`Task.cancel`." msgstr "當一 Task 物件被取消時被引發。請參閱 :meth:`Task.cancel`\\ 。" -#: ../../library/asyncio-api-index.rst:217 +#: ../../library/asyncio-api-index.rst:225 +msgid ":exc:`asyncio.BrokenBarrierError`" +msgstr ":exc:`asyncio.BrokenBarrierError`" + +#: ../../library/asyncio-api-index.rst:226 +msgid "Raised when a Barrier is broken. See also :meth:`Barrier.wait`." +msgstr "當一 Barrier 物件損壞時被引發。請參閱 :meth:`Barrier.wait`。" + +#: ../../library/asyncio-api-index.rst:231 msgid "" ":ref:`Handling CancelledError to run code on cancellation request " "`." @@ -414,8 +447,16 @@ msgstr "" ":ref:`在取消請求發生的程式中處理 CancelledError 例外 " "`\\ 。" -#: ../../library/asyncio-api-index.rst:220 +#: ../../library/asyncio-api-index.rst:234 msgid "" "See also the full list of :ref:`asyncio-specific exceptions `." msgstr "請參閱 :ref:`asyncio 專用例外 `\\ 完整列表。" + +#~ msgid "" +#~ "Raised on timeout by functions like :func:`wait_for`. Keep in mind that " +#~ "``asyncio.TimeoutError`` is **unrelated** to the built-in :exc:" +#~ "`TimeoutError` exception." +#~ msgstr "" +#~ "在像是 :func:`wait_for` 等函式超時的時候被引發。請注意 ``asyncio." +#~ "TimeoutError`` 與內建例外 :exc:`TimeoutError` **無關**\\ 。" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index cdc8b6e99f..f5335f0b4b 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-06-11 15:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -126,7 +126,7 @@ msgstr "" #: ../../library/asyncio-dev.rst:60 msgid "" -"Callbacks taking longer than 100ms are logged. The :attr:`loop." +"Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop." "slow_callback_duration` attribute can be used to set the minimum execution " "duration in seconds that is considered \"slow\"." msgstr "" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index ba7e27a36e..3da5edb11a 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -251,8 +251,8 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:173 -#: ../../library/asyncio-eventloop.rst:1104 -#: ../../library/asyncio-eventloop.rst:1490 +#: ../../library/asyncio-eventloop.rst:1196 +#: ../../library/asyncio-eventloop.rst:1578 msgid "Example::" msgstr "" "範例:\n" @@ -449,98 +449,109 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:347 +msgid "" +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *coro* to run in. The current context " +"copy is created when no *context* is provided." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:351 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:352 +#: ../../library/asyncio-eventloop.rst:354 +msgid "Added the *context* parameter." +msgstr "加入 *context* 參數。" + +#: ../../library/asyncio-eventloop.rst:359 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "" -#: ../../library/asyncio-eventloop.rst:355 +#: ../../library/asyncio-eventloop.rst:362 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " -"*factory* must be a *callable* with the signature matching ``(loop, coro)``, " -"where *loop* is a reference to the active event loop, and *coro* is a " -"coroutine object. The callable must return a :class:`asyncio.Future`-" -"compatible object." +"*factory* must be a *callable* with the signature matching ``(loop, coro, " +"context=None)``, where *loop* is a reference to the active event loop, and " +"*coro* is a coroutine object. The callable must return a :class:`asyncio." +"Future`-compatible object." msgstr "" -#: ../../library/asyncio-eventloop.rst:363 +#: ../../library/asyncio-eventloop.rst:370 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "" -#: ../../library/asyncio-eventloop.rst:367 +#: ../../library/asyncio-eventloop.rst:374 msgid "Opening network connections" msgstr "" -#: ../../library/asyncio-eventloop.rst:376 +#: ../../library/asyncio-eventloop.rst:384 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "" -#: ../../library/asyncio-eventloop.rst:379 +#: ../../library/asyncio-eventloop.rst:387 msgid "" "The socket family can be either :py:data:`~socket.AF_INET` or :py:data:" "`~socket.AF_INET6` depending on *host* (or the *family* argument, if " "provided)." msgstr "" -#: ../../library/asyncio-eventloop.rst:383 +#: ../../library/asyncio-eventloop.rst:391 msgid "The socket type will be :py:data:`~socket.SOCK_STREAM`." msgstr "" -#: ../../library/asyncio-eventloop.rst:385 -#: ../../library/asyncio-eventloop.rst:1020 -#: ../../library/asyncio-eventloop.rst:1036 +#: ../../library/asyncio-eventloop.rst:393 +#: ../../library/asyncio-eventloop.rst:1112 +#: ../../library/asyncio-eventloop.rst:1128 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." msgstr "" -#: ../../library/asyncio-eventloop.rst:388 +#: ../../library/asyncio-eventloop.rst:396 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" -#: ../../library/asyncio-eventloop.rst:391 +#: ../../library/asyncio-eventloop.rst:399 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "" -#: ../../library/asyncio-eventloop.rst:393 +#: ../../library/asyncio-eventloop.rst:401 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "" -#: ../../library/asyncio-eventloop.rst:396 +#: ../../library/asyncio-eventloop.rst:404 msgid "" "*protocol_factory* is called without arguments and is expected to return a :" "ref:`protocol ` instance." msgstr "" -#: ../../library/asyncio-eventloop.rst:399 +#: ../../library/asyncio-eventloop.rst:407 msgid "" "The protocol instance is coupled with the transport by calling its :meth:" "`~BaseProtocol.connection_made` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:402 +#: ../../library/asyncio-eventloop.rst:410 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "" -#: ../../library/asyncio-eventloop.rst:404 +#: ../../library/asyncio-eventloop.rst:412 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "" -#: ../../library/asyncio-eventloop.rst:407 -#: ../../library/asyncio-eventloop.rst:535 +#: ../../library/asyncio-eventloop.rst:415 +#: ../../library/asyncio-eventloop.rst:536 msgid "Other arguments:" msgstr "" -#: ../../library/asyncio-eventloop.rst:409 +#: ../../library/asyncio-eventloop.rst:417 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " @@ -549,11 +560,11 @@ msgid "" "is used." msgstr "" -#: ../../library/asyncio-eventloop.rst:415 +#: ../../library/asyncio-eventloop.rst:423 msgid ":ref:`SSL/TLS security considerations `" msgstr "" -#: ../../library/asyncio-eventloop.rst:417 +#: ../../library/asyncio-eventloop.rst:425 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -564,7 +575,7 @@ msgid "" "potential man-in-the-middle attacks)." msgstr "" -#: ../../library/asyncio-eventloop.rst:425 +#: ../../library/asyncio-eventloop.rst:433 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -572,7 +583,7 @@ msgid "" "constants." msgstr "" -#: ../../library/asyncio-eventloop.rst:430 +#: ../../library/asyncio-eventloop.rst:438 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -582,7 +593,7 @@ msgid "" "RFC is ``0.25`` (250 milliseconds)." msgstr "" -#: ../../library/asyncio-eventloop.rst:438 +#: ../../library/asyncio-eventloop.rst:446 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -593,7 +604,7 @@ msgid "" "is not specified, and ``1`` if it is." msgstr "" -#: ../../library/asyncio-eventloop.rst:447 +#: ../../library/asyncio-eventloop.rst:455 msgid "" "*sock*, if given, should be an existing, already connected :class:`socket." "socket` object to be used by the transport. If *sock* is given, none of " @@ -601,51 +612,61 @@ msgid "" "*interleave* and *local_addr* should be specified." msgstr "" -#: ../../library/asyncio-eventloop.rst:455 -#: ../../library/asyncio-eventloop.rst:566 -#: ../../library/asyncio-eventloop.rst:752 +#: ../../library/asyncio-eventloop.rst:463 +#: ../../library/asyncio-eventloop.rst:567 +#: ../../library/asyncio-eventloop.rst:791 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." "BaseTransport.close` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:459 +#: ../../library/asyncio-eventloop.rst:467 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " "``getaddrinfo()``, similarly to *host* and *port*." msgstr "" -#: ../../library/asyncio-eventloop.rst:463 -#: ../../library/asyncio-eventloop.rst:829 +#: ../../library/asyncio-eventloop.rst:471 +#: ../../library/asyncio-eventloop.rst:877 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " "``60.0`` seconds if ``None`` (default)." msgstr "" -#: ../../library/asyncio-eventloop.rst:469 -#: ../../library/asyncio-eventloop.rst:693 +#: ../../library/asyncio-eventloop.rst:475 +#: ../../library/asyncio-eventloop.rst:708 +#: ../../library/asyncio-eventloop.rst:802 +#: ../../library/asyncio-eventloop.rst:881 +msgid "" +"*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " +"to complete before aborting the connection. ``30.0`` seconds if ``None`` " +"(default)." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:481 +#: ../../library/asyncio-eventloop.rst:720 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "" -#: ../../library/asyncio-eventloop.rst:473 +#: ../../library/asyncio-eventloop.rst:485 msgid "" "The socket option :py:data:`~socket.TCP_NODELAY` is set by default for all " "TCP connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:478 -#: ../../library/asyncio-eventloop.rst:769 +#: ../../library/asyncio-eventloop.rst:490 +#: ../../library/asyncio-eventloop.rst:812 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:482 +#: ../../library/asyncio-eventloop.rst:494 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:484 +#: ../../library/asyncio-eventloop.rst:496 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -656,82 +677,69 @@ msgid "" "visible delay and provides an algorithm." msgstr "" -#: ../../library/asyncio-eventloop.rst:493 +#: ../../library/asyncio-eventloop.rst:505 msgid "For more information: https://tools.ietf.org/html/rfc6555" msgstr "更多資訊請見:\\ https://tools.ietf.org/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:497 +#: ../../library/asyncio-eventloop.rst:509 +#: ../../library/asyncio-eventloop.rst:628 +#: ../../library/asyncio-eventloop.rst:734 +#: ../../library/asyncio-eventloop.rst:769 +#: ../../library/asyncio-eventloop.rst:816 +#: ../../library/asyncio-eventloop.rst:889 +msgid "Added the *ssl_shutdown_timeout* parameter." +msgstr "增加 *ssl_shutdown_timeout* 參數。" + +#: ../../library/asyncio-eventloop.rst:513 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -#: ../../library/asyncio-eventloop.rst:508 -msgid "" -"The parameter *reuse_address* is no longer supported, as using :py:data:" -"`~sockets.SO_REUSEADDR` poses a significant security concern for UDP. " -"Explicitly passing ``reuse_address=True`` will raise an exception." -msgstr "" - -#: ../../library/asyncio-eventloop.rst:512 -msgid "" -"When multiple processes with differing UIDs assign sockets to an identical " -"UDP socket address with ``SO_REUSEADDR``, incoming packets can become " -"randomly distributed among the sockets." -msgstr "" - -#: ../../library/asyncio-eventloop.rst:516 -msgid "" -"For supported platforms, *reuse_port* can be used as a replacement for " -"similar functionality. With *reuse_port*, :py:data:`~sockets.SO_REUSEPORT` " -"is used instead, which specifically prevents processes with differing UIDs " -"from assigning sockets to the same socket address." -msgstr "" - -#: ../../library/asyncio-eventloop.rst:522 +#: ../../library/asyncio-eventloop.rst:523 msgid "Create a datagram connection." msgstr "" -#: ../../library/asyncio-eventloop.rst:524 +#: ../../library/asyncio-eventloop.rst:525 msgid "" "The socket family can be either :py:data:`~socket.AF_INET`, :py:data:" "`~socket.AF_INET6`, or :py:data:`~socket.AF_UNIX`, depending on *host* (or " "the *family* argument, if provided)." msgstr "" -#: ../../library/asyncio-eventloop.rst:528 +#: ../../library/asyncio-eventloop.rst:529 msgid "The socket type will be :py:data:`~socket.SOCK_DGRAM`." msgstr "" -#: ../../library/asyncio-eventloop.rst:530 -#: ../../library/asyncio-eventloop.rst:628 -#: ../../library/asyncio-eventloop.rst:744 +#: ../../library/asyncio-eventloop.rst:531 +#: ../../library/asyncio-eventloop.rst:651 +#: ../../library/asyncio-eventloop.rst:783 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." msgstr "" -#: ../../library/asyncio-eventloop.rst:533 -#: ../../library/asyncio-eventloop.rst:593 +#: ../../library/asyncio-eventloop.rst:534 +#: ../../library/asyncio-eventloop.rst:610 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "" -#: ../../library/asyncio-eventloop.rst:537 +#: ../../library/asyncio-eventloop.rst:538 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using :" "meth:`getaddrinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:541 +#: ../../library/asyncio-eventloop.rst:542 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:545 +#: ../../library/asyncio-eventloop.rst:546 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -739,7 +747,7 @@ msgid "" "module constants." msgstr "" -#: ../../library/asyncio-eventloop.rst:550 +#: ../../library/asyncio-eventloop.rst:551 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -748,13 +756,13 @@ msgid "" "this capability is unsupported." msgstr "" -#: ../../library/asyncio-eventloop.rst:556 +#: ../../library/asyncio-eventloop.rst:557 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "" -#: ../../library/asyncio-eventloop.rst:559 +#: ../../library/asyncio-eventloop.rst:560 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " @@ -762,107 +770,129 @@ msgid "" "`None`)." msgstr "" -#: ../../library/asyncio-eventloop.rst:570 +#: ../../library/asyncio-eventloop.rst:571 msgid "" "See :ref:`UDP echo client protocol ` and :" "ref:`UDP echo server protocol ` examples." msgstr "" -#: ../../library/asyncio-eventloop.rst:573 +#: ../../library/asyncio-eventloop.rst:574 msgid "" -"The *family*, *proto*, *flags*, *reuse_address*, *reuse_port, " +"The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." msgstr "" -#: ../../library/asyncio-eventloop.rst:577 +#: ../../library/asyncio-eventloop.rst:578 msgid "" -"The *reuse_address* parameter is no longer supported due to security " -"concerns." +"The *reuse_address* parameter is no longer supported, as using :py:data:" +"`~sockets.SO_REUSEADDR` poses a significant security concern for UDP. " +"Explicitly passing ``reuse_address=True`` will raise an exception." msgstr "" -#: ../../library/asyncio-eventloop.rst:581 +#: ../../library/asyncio-eventloop.rst:583 +msgid "" +"When multiple processes with differing UIDs assign sockets to an identical " +"UDP socket address with ``SO_REUSEADDR``, incoming packets can become " +"randomly distributed among the sockets." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:587 +msgid "" +"For supported platforms, *reuse_port* can be used as a replacement for " +"similar functionality. With *reuse_port*, :py:data:`~sockets.SO_REUSEPORT` " +"is used instead, which specifically prevents processes with differing UIDs " +"from assigning sockets to the same socket address." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:593 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:588 +#: ../../library/asyncio-eventloop.rst:596 +msgid "" +"The *reuse_address* parameter, disabled since Python 3.9.0, 3.8.1, 3.7.6 and " +"3.6.10, has been entirely removed." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:605 msgid "Create a Unix connection." msgstr "" -#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:607 msgid "" "The socket family will be :py:data:`~socket.AF_UNIX`; socket type will be :" "py:data:`~socket.SOCK_STREAM`." msgstr "" -#: ../../library/asyncio-eventloop.rst:595 +#: ../../library/asyncio-eventloop.rst:612 msgid "" "*path* is the name of a Unix domain socket and is required, unless a *sock* " "parameter is specified. Abstract Unix sockets, :class:`str`, :class:" "`bytes`, and :class:`~pathlib.Path` paths are supported." msgstr "" -#: ../../library/asyncio-eventloop.rst:600 +#: ../../library/asyncio-eventloop.rst:617 msgid "" "See the documentation of the :meth:`loop.create_connection` method for " "information about arguments to this method." msgstr "" -#: ../../library/asyncio-eventloop.rst:604 -#: ../../library/asyncio-eventloop.rst:728 -#: ../../library/asyncio-eventloop.rst:1087 +#: ../../library/asyncio-eventloop.rst:621 +#: ../../library/asyncio-eventloop.rst:761 +#: ../../library/asyncio-eventloop.rst:1179 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/asyncio-eventloop.rst:605 +#: ../../library/asyncio-eventloop.rst:622 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`." msgstr "" -#: ../../library/asyncio-eventloop.rst:611 +#: ../../library/asyncio-eventloop.rst:632 msgid "Creating network servers" msgstr "" -#: ../../library/asyncio-eventloop.rst:621 +#: ../../library/asyncio-eventloop.rst:644 msgid "" "Create a TCP server (socket type :data:`~socket.SOCK_STREAM`) listening on " "*port* of the *host* address." msgstr "" -#: ../../library/asyncio-eventloop.rst:624 +#: ../../library/asyncio-eventloop.rst:647 msgid "Returns a :class:`Server` object." msgstr "" -#: ../../library/asyncio-eventloop.rst:626 +#: ../../library/asyncio-eventloop.rst:649 msgid "Arguments:" msgstr "引數:" -#: ../../library/asyncio-eventloop.rst:631 +#: ../../library/asyncio-eventloop.rst:654 msgid "" "The *host* parameter can be set to several types which determine where the " "server would be listening:" msgstr "" -#: ../../library/asyncio-eventloop.rst:634 +#: ../../library/asyncio-eventloop.rst:657 msgid "" "If *host* is a string, the TCP server is bound to a single network interface " "specified by *host*." msgstr "" -#: ../../library/asyncio-eventloop.rst:637 +#: ../../library/asyncio-eventloop.rst:660 msgid "" "If *host* is a sequence of strings, the TCP server is bound to all network " "interfaces specified by the sequence." msgstr "" -#: ../../library/asyncio-eventloop.rst:640 +#: ../../library/asyncio-eventloop.rst:663 msgid "" "If *host* is an empty string or ``None``, all interfaces are assumed and a " "list of multiple sockets will be returned (most likely one for IPv4 and " "another one for IPv6)." msgstr "" -#: ../../library/asyncio-eventloop.rst:644 +#: ../../library/asyncio-eventloop.rst:667 msgid "" "The *port* parameter can be set to specify which port the server should " "listen on. If ``0`` or ``None`` (the default), a random unused port will be " @@ -870,63 +900,63 @@ msgid "" "different random port will be selected for each interface)." msgstr "" -#: ../../library/asyncio-eventloop.rst:649 +#: ../../library/asyncio-eventloop.rst:672 msgid "" "*family* can be set to either :data:`socket.AF_INET` or :data:`~socket." "AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* " "will be determined from host name (defaults to :data:`~socket.AF_UNSPEC`)." msgstr "" -#: ../../library/asyncio-eventloop.rst:654 +#: ../../library/asyncio-eventloop.rst:677 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:656 +#: ../../library/asyncio-eventloop.rst:679 msgid "" "*sock* can optionally be specified in order to use a preexisting socket " "object. If specified, *host* and *port* must not be specified." msgstr "" -#: ../../library/asyncio-eventloop.rst:661 +#: ../../library/asyncio-eventloop.rst:684 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:665 +#: ../../library/asyncio-eventloop.rst:688 msgid "" "*backlog* is the maximum number of queued connections passed to :meth:" "`~socket.socket.listen` (defaults to 100)." msgstr "" -#: ../../library/asyncio-eventloop.rst:668 +#: ../../library/asyncio-eventloop.rst:691 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " "the accepted connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:671 +#: ../../library/asyncio-eventloop.rst:694 msgid "" "*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` " "state, without waiting for its natural timeout to expire. If not specified " "will automatically be set to ``True`` on Unix." msgstr "" -#: ../../library/asyncio-eventloop.rst:676 +#: ../../library/asyncio-eventloop.rst:699 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " "flag when being created. This option is not supported on Windows." msgstr "" -#: ../../library/asyncio-eventloop.rst:681 +#: ../../library/asyncio-eventloop.rst:704 msgid "" "*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait " "for the TLS handshake to complete before aborting the connection. ``60.0`` " "seconds if ``None`` (default)." msgstr "" -#: ../../library/asyncio-eventloop.rst:685 +#: ../../library/asyncio-eventloop.rst:712 msgid "" "*start_serving* set to ``True`` (the default) causes the created server to " "start accepting connections immediately. When set to ``False``, the user " @@ -934,44 +964,44 @@ msgid "" "to make the server to start accepting connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:697 +#: ../../library/asyncio-eventloop.rst:724 msgid "The *host* parameter can be a sequence of strings." msgstr "" -#: ../../library/asyncio-eventloop.rst:701 +#: ../../library/asyncio-eventloop.rst:728 msgid "" "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " "option :py:data:`~socket.TCP_NODELAY` is set by default for all TCP " "connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:707 +#: ../../library/asyncio-eventloop.rst:738 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -#: ../../library/asyncio-eventloop.rst:716 +#: ../../library/asyncio-eventloop.rst:749 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:data:`~socket." "AF_UNIX` socket family." msgstr "" -#: ../../library/asyncio-eventloop.rst:719 +#: ../../library/asyncio-eventloop.rst:752 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " "and :class:`~pathlib.Path` paths are supported." msgstr "" -#: ../../library/asyncio-eventloop.rst:724 +#: ../../library/asyncio-eventloop.rst:757 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "" -#: ../../library/asyncio-eventloop.rst:731 +#: ../../library/asyncio-eventloop.rst:764 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -979,63 +1009,63 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。\\ *path* 參數現在可為" "一個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:737 +#: ../../library/asyncio-eventloop.rst:776 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "" -#: ../../library/asyncio-eventloop.rst:739 +#: ../../library/asyncio-eventloop.rst:778 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "" -#: ../../library/asyncio-eventloop.rst:742 -#: ../../library/asyncio-eventloop.rst:815 +#: ../../library/asyncio-eventloop.rst:781 +#: ../../library/asyncio-eventloop.rst:863 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:747 +#: ../../library/asyncio-eventloop.rst:786 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." msgstr "" -#: ../../library/asyncio-eventloop.rst:756 +#: ../../library/asyncio-eventloop.rst:795 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:759 +#: ../../library/asyncio-eventloop.rst:798 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " "``60.0`` seconds if ``None`` (default)." msgstr "" -#: ../../library/asyncio-eventloop.rst:763 +#: ../../library/asyncio-eventloop.rst:806 msgid "Returns a ``(transport, protocol)`` pair." msgstr "" -#: ../../library/asyncio-eventloop.rst:773 +#: ../../library/asyncio-eventloop.rst:820 msgid "Transferring files" msgstr "" -#: ../../library/asyncio-eventloop.rst:778 +#: ../../library/asyncio-eventloop.rst:825 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "" -#: ../../library/asyncio-eventloop.rst:781 +#: ../../library/asyncio-eventloop.rst:828 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "" -#: ../../library/asyncio-eventloop.rst:783 +#: ../../library/asyncio-eventloop.rst:830 msgid "*file* must be a regular file object opened in binary mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:785 -#: ../../library/asyncio-eventloop.rst:975 +#: ../../library/asyncio-eventloop.rst:832 +#: ../../library/asyncio-eventloop.rst:1067 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1044,98 +1074,98 @@ msgid "" "obtain the actual number of bytes sent." msgstr "" -#: ../../library/asyncio-eventloop.rst:792 +#: ../../library/asyncio-eventloop.rst:839 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " "SSL socket on Unix)." msgstr "" -#: ../../library/asyncio-eventloop.rst:796 +#: ../../library/asyncio-eventloop.rst:843 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -#: ../../library/asyncio-eventloop.rst:803 +#: ../../library/asyncio-eventloop.rst:850 msgid "TLS Upgrade" msgstr "" -#: ../../library/asyncio-eventloop.rst:809 +#: ../../library/asyncio-eventloop.rst:857 msgid "Upgrade an existing transport-based connection to TLS." msgstr "" -#: ../../library/asyncio-eventloop.rst:811 +#: ../../library/asyncio-eventloop.rst:859 msgid "" "Return a new transport instance, that the *protocol* must start using " "immediately after the *await*. The *transport* instance passed to the " "*start_tls* method should never be used again." msgstr "" -#: ../../library/asyncio-eventloop.rst:817 +#: ../../library/asyncio-eventloop.rst:865 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." msgstr "" -#: ../../library/asyncio-eventloop.rst:821 +#: ../../library/asyncio-eventloop.rst:869 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -#: ../../library/asyncio-eventloop.rst:823 +#: ../../library/asyncio-eventloop.rst:871 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." msgstr "" -#: ../../library/asyncio-eventloop.rst:826 +#: ../../library/asyncio-eventloop.rst:874 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "" -#: ../../library/asyncio-eventloop.rst:837 +#: ../../library/asyncio-eventloop.rst:894 msgid "Watching file descriptors" msgstr "" -#: ../../library/asyncio-eventloop.rst:841 +#: ../../library/asyncio-eventloop.rst:898 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." msgstr "" -#: ../../library/asyncio-eventloop.rst:847 +#: ../../library/asyncio-eventloop.rst:904 msgid "Stop monitoring the *fd* file descriptor for read availability." msgstr "" -#: ../../library/asyncio-eventloop.rst:851 +#: ../../library/asyncio-eventloop.rst:908 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." msgstr "" -#: ../../library/asyncio-eventloop.rst:855 -#: ../../library/asyncio-eventloop.rst:1074 +#: ../../library/asyncio-eventloop.rst:912 +#: ../../library/asyncio-eventloop.rst:1166 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." msgstr "" -#: ../../library/asyncio-eventloop.rst:860 +#: ../../library/asyncio-eventloop.rst:917 msgid "Stop monitoring the *fd* file descriptor for write availability." msgstr "" -#: ../../library/asyncio-eventloop.rst:862 +#: ../../library/asyncio-eventloop.rst:919 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." msgstr "" -#: ../../library/asyncio-eventloop.rst:867 +#: ../../library/asyncio-eventloop.rst:924 msgid "Working with socket objects directly" msgstr "" -#: ../../library/asyncio-eventloop.rst:869 +#: ../../library/asyncio-eventloop.rst:926 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1144,49 +1174,72 @@ msgid "" "socket` objects directly is more convenient." msgstr "" -#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:935 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:881 +#: ../../library/asyncio-eventloop.rst:938 msgid "Return the received data as a bytes object." msgstr "" -#: ../../library/asyncio-eventloop.rst:883 -#: ../../library/asyncio-eventloop.rst:897 -#: ../../library/asyncio-eventloop.rst:912 -#: ../../library/asyncio-eventloop.rst:925 -#: ../../library/asyncio-eventloop.rst:951 -#: ../../library/asyncio-eventloop.rst:989 +#: ../../library/asyncio-eventloop.rst:940 +#: ../../library/asyncio-eventloop.rst:954 +#: ../../library/asyncio-eventloop.rst:965 +#: ../../library/asyncio-eventloop.rst:977 +#: ../../library/asyncio-eventloop.rst:992 +#: ../../library/asyncio-eventloop.rst:1007 +#: ../../library/asyncio-eventloop.rst:1017 +#: ../../library/asyncio-eventloop.rst:1043 +#: ../../library/asyncio-eventloop.rst:1081 msgid "*sock* must be a non-blocking socket." msgstr "" -#: ../../library/asyncio-eventloop.rst:885 +#: ../../library/asyncio-eventloop.rst:942 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " "is an ``async def`` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:892 +#: ../../library/asyncio-eventloop.rst:949 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:895 +#: ../../library/asyncio-eventloop.rst:952 msgid "Return the number of bytes written to the buffer." msgstr "" -#: ../../library/asyncio-eventloop.rst:903 +#: ../../library/asyncio-eventloop.rst:960 +msgid "" +"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" +"meth:`socket.recvfrom() `." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:963 +msgid "Return a tuple of (received data, remote address)." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:971 +msgid "" +"Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " +"version of :meth:`socket.recvfrom_into() `." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:975 +msgid "Return a tuple of (number of bytes received, remote address)." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:983 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:906 +#: ../../library/asyncio-eventloop.rst:986 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1195,23 +1248,34 @@ msgid "" "the connection." msgstr "" -#: ../../library/asyncio-eventloop.rst:914 +#: ../../library/asyncio-eventloop.rst:994 +#: ../../library/asyncio-eventloop.rst:1045 msgid "" "Even though the method was always documented as a coroutine method, before " -"Python 3.7 it returned an :class:`Future`. Since Python 3.7, this is an " +"Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " "``async def`` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:921 +#: ../../library/asyncio-eventloop.rst:1001 +msgid "" +"Send a datagram from *sock* to *address*. Asynchronous version of :meth:" +"`socket.sendto() `." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1005 +msgid "Return the number of bytes sent." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1013 msgid "Connect *sock* to a remote socket at *address*." msgstr "" -#: ../../library/asyncio-eventloop.rst:923 +#: ../../library/asyncio-eventloop.rst:1015 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:927 +#: ../../library/asyncio-eventloop.rst:1019 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1219,19 +1283,19 @@ msgid "" "*address*." msgstr "" -#: ../../library/asyncio-eventloop.rst:936 +#: ../../library/asyncio-eventloop.rst:1028 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." msgstr "" -#: ../../library/asyncio-eventloop.rst:942 +#: ../../library/asyncio-eventloop.rst:1034 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:945 +#: ../../library/asyncio-eventloop.rst:1037 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1239,64 +1303,57 @@ msgid "" "the address bound to the socket on the other end of the connection." msgstr "" -#: ../../library/asyncio-eventloop.rst:953 -msgid "" -"Even though the method was always documented as a coroutine method, before " -"Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " -"``async def`` method." -msgstr "" - -#: ../../library/asyncio-eventloop.rst:960 +#: ../../library/asyncio-eventloop.rst:1052 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`\\ 。" -#: ../../library/asyncio-eventloop.rst:965 +#: ../../library/asyncio-eventloop.rst:1057 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" -#: ../../library/asyncio-eventloop.rst:968 +#: ../../library/asyncio-eventloop.rst:1060 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr "" -#: ../../library/asyncio-eventloop.rst:970 +#: ../../library/asyncio-eventloop.rst:1062 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" -#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:1065 msgid "*file* must be a regular file object open in binary mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:982 +#: ../../library/asyncio-eventloop.rst:1074 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " "or SSL socket on Unix)." msgstr "" -#: ../../library/asyncio-eventloop.rst:986 +#: ../../library/asyncio-eventloop.rst:1078 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:1087 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1000 +#: ../../library/asyncio-eventloop.rst:1092 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1004 +#: ../../library/asyncio-eventloop.rst:1096 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1006 +#: ../../library/asyncio-eventloop.rst:1098 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1304,67 +1361,67 @@ msgid "" "coroutines." msgstr "" -#: ../../library/asyncio-eventloop.rst:1014 +#: ../../library/asyncio-eventloop.rst:1106 msgid "Working with pipes" msgstr "" -#: ../../library/asyncio-eventloop.rst:1018 +#: ../../library/asyncio-eventloop.rst:1110 msgid "Register the read end of *pipe* in the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1023 +#: ../../library/asyncio-eventloop.rst:1115 msgid "*pipe* is a :term:`file-like object `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1025 +#: ../../library/asyncio-eventloop.rst:1117 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " "*protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1029 -#: ../../library/asyncio-eventloop.rst:1045 +#: ../../library/asyncio-eventloop.rst:1121 +#: ../../library/asyncio-eventloop.rst:1137 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:1034 +#: ../../library/asyncio-eventloop.rst:1126 msgid "Register the write end of *pipe* in the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1039 +#: ../../library/asyncio-eventloop.rst:1131 msgid "*pipe* is :term:`file-like object `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1041 +#: ../../library/asyncio-eventloop.rst:1133 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " "*protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1050 +#: ../../library/asyncio-eventloop.rst:1142 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -#: ../../library/asyncio-eventloop.rst:1055 +#: ../../library/asyncio-eventloop.rst:1147 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr "" -#: ../../library/asyncio-eventloop.rst:1060 +#: ../../library/asyncio-eventloop.rst:1152 msgid "Unix signals" msgstr "" -#: ../../library/asyncio-eventloop.rst:1064 +#: ../../library/asyncio-eventloop.rst:1156 msgid "Set *callback* as the handler for the *signum* signal." msgstr "" -#: ../../library/asyncio-eventloop.rst:1066 +#: ../../library/asyncio-eventloop.rst:1158 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1372,56 +1429,56 @@ msgid "" "function is allowed to interact with the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1071 +#: ../../library/asyncio-eventloop.rst:1163 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1077 +#: ../../library/asyncio-eventloop.rst:1169 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "" -#: ../../library/asyncio-eventloop.rst:1082 +#: ../../library/asyncio-eventloop.rst:1174 msgid "Remove the handler for the *sig* signal." msgstr "" -#: ../../library/asyncio-eventloop.rst:1084 +#: ../../library/asyncio-eventloop.rst:1176 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." msgstr "" -#: ../../library/asyncio-eventloop.rst:1091 +#: ../../library/asyncio-eventloop.rst:1183 msgid "The :mod:`signal` module." msgstr "" -#: ../../library/asyncio-eventloop.rst:1095 +#: ../../library/asyncio-eventloop.rst:1187 msgid "Executing code in thread or process pools" msgstr "" -#: ../../library/asyncio-eventloop.rst:1099 +#: ../../library/asyncio-eventloop.rst:1191 msgid "Arrange for *func* to be called in the specified executor." msgstr "" -#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:1193 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1145 +#: ../../library/asyncio-eventloop.rst:1237 msgid "This method returns a :class:`asyncio.Future` object." msgstr "" -#: ../../library/asyncio-eventloop.rst:1147 +#: ../../library/asyncio-eventloop.rst:1239 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1150 +#: ../../library/asyncio-eventloop.rst:1242 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1429,38 +1486,32 @@ msgid "" "default." msgstr "" -#: ../../library/asyncio-eventloop.rst:1159 +#: ../../library/asyncio-eventloop.rst:1251 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " -"*executor* should be an instance of :class:`~concurrent.futures." +"*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1163 -msgid "" -"Using an executor that is not an instance of :class:`~concurrent.futures." -"ThreadPoolExecutor` is deprecated and will trigger an error in Python 3.9." -msgstr "" - -#: ../../library/asyncio-eventloop.rst:1168 +#: ../../library/asyncio-eventloop.rst:1255 msgid "" -"*executor* must be an instance of :class:`concurrent.futures." +"*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1173 +#: ../../library/asyncio-eventloop.rst:1261 msgid "Error Handling API" msgstr "" -#: ../../library/asyncio-eventloop.rst:1175 +#: ../../library/asyncio-eventloop.rst:1263 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1179 +#: ../../library/asyncio-eventloop.rst:1267 msgid "Set *handler* as the new event loop exception handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1181 +#: ../../library/asyncio-eventloop.rst:1269 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -1469,158 +1520,158 @@ msgid "" "(see :meth:`call_exception_handler` documentation for details about context)." msgstr "" -#: ../../library/asyncio-eventloop.rst:1191 +#: ../../library/asyncio-eventloop.rst:1279 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" -#: ../../library/asyncio-eventloop.rst:1198 +#: ../../library/asyncio-eventloop.rst:1286 msgid "Default exception handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1200 +#: ../../library/asyncio-eventloop.rst:1288 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " "default handler behavior." msgstr "" -#: ../../library/asyncio-eventloop.rst:1204 +#: ../../library/asyncio-eventloop.rst:1292 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1209 +#: ../../library/asyncio-eventloop.rst:1297 msgid "Call the current event loop exception handler." msgstr "" -#: ../../library/asyncio-eventloop.rst:1211 +#: ../../library/asyncio-eventloop.rst:1299 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" msgstr "" -#: ../../library/asyncio-eventloop.rst:1214 +#: ../../library/asyncio-eventloop.rst:1302 msgid "'message': Error message;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1215 +#: ../../library/asyncio-eventloop.rst:1303 msgid "'exception' (optional): Exception object;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1216 +#: ../../library/asyncio-eventloop.rst:1304 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1217 +#: ../../library/asyncio-eventloop.rst:1305 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1218 +#: ../../library/asyncio-eventloop.rst:1306 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1219 +#: ../../library/asyncio-eventloop.rst:1307 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:1308 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1221 +#: ../../library/asyncio-eventloop.rst:1309 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1223 +#: ../../library/asyncio-eventloop.rst:1311 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "" -#: ../../library/asyncio-eventloop.rst:1223 +#: ../../library/asyncio-eventloop.rst:1311 msgid "the exception." msgstr "" -#: ../../library/asyncio-eventloop.rst:1227 +#: ../../library/asyncio-eventloop.rst:1315 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler()` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:1232 +#: ../../library/asyncio-eventloop.rst:1320 msgid "Enabling debug mode" msgstr "" -#: ../../library/asyncio-eventloop.rst:1236 +#: ../../library/asyncio-eventloop.rst:1324 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1238 +#: ../../library/asyncio-eventloop.rst:1326 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." msgstr "" -#: ../../library/asyncio-eventloop.rst:1244 +#: ../../library/asyncio-eventloop.rst:1332 msgid "Set the debug mode of the event loop." msgstr "" -#: ../../library/asyncio-eventloop.rst:1248 +#: ../../library/asyncio-eventloop.rst:1336 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "" -#: ../../library/asyncio-eventloop.rst:1253 +#: ../../library/asyncio-eventloop.rst:1341 msgid "The :ref:`debug mode of asyncio `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1257 +#: ../../library/asyncio-eventloop.rst:1345 msgid "Running Subprocesses" msgstr "" -#: ../../library/asyncio-eventloop.rst:1259 +#: ../../library/asyncio-eventloop.rst:1347 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -#: ../../library/asyncio-eventloop.rst:1266 +#: ../../library/asyncio-eventloop.rst:1354 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" "`Subprocess Support on Windows ` for details." msgstr "" -#: ../../library/asyncio-eventloop.rst:1275 +#: ../../library/asyncio-eventloop.rst:1363 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1278 +#: ../../library/asyncio-eventloop.rst:1366 msgid "*args* must be a list of strings represented by:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1280 +#: ../../library/asyncio-eventloop.rst:1368 msgid ":class:`str`;" msgstr ":class:`str`\\ ;" -#: ../../library/asyncio-eventloop.rst:1281 +#: ../../library/asyncio-eventloop.rst:1369 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "" -#: ../../library/asyncio-eventloop.rst:1284 +#: ../../library/asyncio-eventloop.rst:1372 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " "program." msgstr "" -#: ../../library/asyncio-eventloop.rst:1288 +#: ../../library/asyncio-eventloop.rst:1376 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -1628,136 +1679,136 @@ msgid "" "which is list of strings, *subprocess_exec* takes multiple string arguments." msgstr "" -#: ../../library/asyncio-eventloop.rst:1294 +#: ../../library/asyncio-eventloop.rst:1382 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." msgstr "" -#: ../../library/asyncio-eventloop.rst:1297 +#: ../../library/asyncio-eventloop.rst:1385 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1299 +#: ../../library/asyncio-eventloop.rst:1387 msgid "*stdin* can be any of these:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1301 +#: ../../library/asyncio-eventloop.rst:1389 msgid "" "a file-like object representing a pipe to be connected to the subprocess's " "standard input stream using :meth:`~loop.connect_write_pipe`" msgstr "" -#: ../../library/asyncio-eventloop.rst:1304 -#: ../../library/asyncio-eventloop.rst:1316 -#: ../../library/asyncio-eventloop.rst:1328 +#: ../../library/asyncio-eventloop.rst:1392 +#: ../../library/asyncio-eventloop.rst:1404 +#: ../../library/asyncio-eventloop.rst:1416 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr "" -#: ../../library/asyncio-eventloop.rst:1306 -#: ../../library/asyncio-eventloop.rst:1318 -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1406 +#: ../../library/asyncio-eventloop.rst:1418 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "" -#: ../../library/asyncio-eventloop.rst:1308 -#: ../../library/asyncio-eventloop.rst:1320 -#: ../../library/asyncio-eventloop.rst:1332 +#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1420 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" -#: ../../library/asyncio-eventloop.rst:1311 +#: ../../library/asyncio-eventloop.rst:1399 msgid "*stdout* can be any of these:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1313 +#: ../../library/asyncio-eventloop.rst:1401 msgid "" "a file-like object representing a pipe to be connected to the subprocess's " "standard output stream using :meth:`~loop.connect_write_pipe`" msgstr "" -#: ../../library/asyncio-eventloop.rst:1323 +#: ../../library/asyncio-eventloop.rst:1411 msgid "*stderr* can be any of these:" msgstr "" -#: ../../library/asyncio-eventloop.rst:1325 +#: ../../library/asyncio-eventloop.rst:1413 msgid "" "a file-like object representing a pipe to be connected to the subprocess's " "standard error stream using :meth:`~loop.connect_write_pipe`" msgstr "" -#: ../../library/asyncio-eventloop.rst:1334 +#: ../../library/asyncio-eventloop.rst:1422 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" -#: ../../library/asyncio-eventloop.rst:1337 +#: ../../library/asyncio-eventloop.rst:1425 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " "*encoding* and *errors*, which should not be specified at all." msgstr "" -#: ../../library/asyncio-eventloop.rst:1342 +#: ../../library/asyncio-eventloop.rst:1430 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " "the stream to text." msgstr "" -#: ../../library/asyncio-eventloop.rst:1346 +#: ../../library/asyncio-eventloop.rst:1434 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "" -#: ../../library/asyncio-eventloop.rst:1349 +#: ../../library/asyncio-eventloop.rst:1437 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1357 +#: ../../library/asyncio-eventloop.rst:1445 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -#: ../../library/asyncio-eventloop.rst:1362 +#: ../../library/asyncio-eventloop.rst:1450 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1365 +#: ../../library/asyncio-eventloop.rst:1453 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." msgstr "" -#: ../../library/asyncio-eventloop.rst:1368 +#: ../../library/asyncio-eventloop.rst:1456 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "" -#: ../../library/asyncio-eventloop.rst:1371 +#: ../../library/asyncio-eventloop.rst:1459 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1464 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -1767,105 +1818,105 @@ msgid "" "used to construct shell commands." msgstr "" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1473 msgid "Callback Handles" msgstr "" -#: ../../library/asyncio-eventloop.rst:1389 +#: ../../library/asyncio-eventloop.rst:1477 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1482 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1487 msgid "Return ``True`` if the callback was cancelled." msgstr "" -#: ../../library/asyncio-eventloop.rst:1405 +#: ../../library/asyncio-eventloop.rst:1493 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1496 msgid "This class is a subclass of :class:`Handle`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1412 +#: ../../library/asyncio-eventloop.rst:1500 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "" -#: ../../library/asyncio-eventloop.rst:1414 +#: ../../library/asyncio-eventloop.rst:1502 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1421 +#: ../../library/asyncio-eventloop.rst:1509 msgid "Server Objects" msgstr "" -#: ../../library/asyncio-eventloop.rst:1423 +#: ../../library/asyncio-eventloop.rst:1511 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " "functions." msgstr "" -#: ../../library/asyncio-eventloop.rst:1427 +#: ../../library/asyncio-eventloop.rst:1515 msgid "Do not instantiate the class directly." msgstr "" -#: ../../library/asyncio-eventloop.rst:1431 +#: ../../library/asyncio-eventloop.rst:1519 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " "accepting new connections when the ``async with`` statement is completed::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1444 +#: ../../library/asyncio-eventloop.rst:1532 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "" -#: ../../library/asyncio-eventloop.rst:1449 +#: ../../library/asyncio-eventloop.rst:1537 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "" -#: ../../library/asyncio-eventloop.rst:1452 +#: ../../library/asyncio-eventloop.rst:1540 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "" -#: ../../library/asyncio-eventloop.rst:1455 +#: ../../library/asyncio-eventloop.rst:1543 msgid "" "The server is closed asynchronously, use the :meth:`wait_closed` coroutine " "to wait until the server is closed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1460 +#: ../../library/asyncio-eventloop.rst:1548 msgid "Return the event loop associated with the server object." msgstr "" -#: ../../library/asyncio-eventloop.rst:1466 +#: ../../library/asyncio-eventloop.rst:1554 msgid "Start accepting connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1468 +#: ../../library/asyncio-eventloop.rst:1556 msgid "" "This method is idempotent, so it can be called when the server is already " -"being serving." +"serving." msgstr "" -#: ../../library/asyncio-eventloop.rst:1471 +#: ../../library/asyncio-eventloop.rst:1559 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -1874,96 +1925,96 @@ msgid "" "accepting connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1482 +#: ../../library/asyncio-eventloop.rst:1570 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1486 +#: ../../library/asyncio-eventloop.rst:1574 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." msgstr "" -#: ../../library/asyncio-eventloop.rst:1508 +#: ../../library/asyncio-eventloop.rst:1596 msgid "Return ``True`` if the server is accepting new connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1514 +#: ../../library/asyncio-eventloop.rst:1602 msgid "Wait until the :meth:`close` method completes." msgstr "" -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1606 msgid "List of :class:`socket.socket` objects the server is listening on." msgstr "" -#: ../../library/asyncio-eventloop.rst:1520 +#: ../../library/asyncio-eventloop.rst:1608 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." msgstr "" -#: ../../library/asyncio-eventloop.rst:1530 +#: ../../library/asyncio-eventloop.rst:1618 msgid "Event Loop Implementations" msgstr "" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1620 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1535 +#: ../../library/asyncio-eventloop.rst:1623 msgid "" "By default asyncio is configured to use :class:`SelectorEventLoop` on Unix " "and :class:`ProactorEventLoop` on Windows." msgstr "" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1629 msgid "An event loop based on the :mod:`selectors` module." msgstr "" -#: ../../library/asyncio-eventloop.rst:1543 +#: ../../library/asyncio-eventloop.rst:1631 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " "used::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1558 +#: ../../library/asyncio-eventloop.rst:1646 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/asyncio-eventloop.rst:1563 +#: ../../library/asyncio-eventloop.rst:1651 msgid "An event loop for Windows that uses \"I/O Completion Ports\" (IOCP)." msgstr "" -#: ../../library/asyncio-eventloop.rst:1566 +#: ../../library/asyncio-eventloop.rst:1654 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/asyncio-eventloop.rst:1569 +#: ../../library/asyncio-eventloop.rst:1657 msgid "" "`MSDN documentation on I/O Completion Ports `_." msgstr "" -#: ../../library/asyncio-eventloop.rst:1575 +#: ../../library/asyncio-eventloop.rst:1663 msgid "Abstract base class for asyncio-compliant event loops." msgstr "" -#: ../../library/asyncio-eventloop.rst:1577 +#: ../../library/asyncio-eventloop.rst:1665 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." msgstr "" -#: ../../library/asyncio-eventloop.rst:1583 +#: ../../library/asyncio-eventloop.rst:1671 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1585 +#: ../../library/asyncio-eventloop.rst:1673 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -1971,70 +2022,70 @@ msgid "" "consider using the high-level functions like :func:`asyncio.run`." msgstr "" -#: ../../library/asyncio-eventloop.rst:1595 +#: ../../library/asyncio-eventloop.rst:1683 msgid "Hello World with call_soon()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1597 +#: ../../library/asyncio-eventloop.rst:1685 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1621 +#: ../../library/asyncio-eventloop.rst:1709 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" -#: ../../library/asyncio-eventloop.rst:1628 +#: ../../library/asyncio-eventloop.rst:1716 msgid "Display the current date with call_later()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1630 +#: ../../library/asyncio-eventloop.rst:1718 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " "5 seconds, and then stops the event loop::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1658 +#: ../../library/asyncio-eventloop.rst:1746 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." msgstr "" -#: ../../library/asyncio-eventloop.rst:1665 +#: ../../library/asyncio-eventloop.rst:1753 msgid "Watch a file descriptor for read events" msgstr "" -#: ../../library/asyncio-eventloop.rst:1667 +#: ../../library/asyncio-eventloop.rst:1755 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" msgstr "" -#: ../../library/asyncio-eventloop.rst:1705 +#: ../../library/asyncio-eventloop.rst:1793 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." msgstr "" -#: ../../library/asyncio-eventloop.rst:1709 +#: ../../library/asyncio-eventloop.rst:1797 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." msgstr "" -#: ../../library/asyncio-eventloop.rst:1717 +#: ../../library/asyncio-eventloop.rst:1805 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "" -#: ../../library/asyncio-eventloop.rst:1719 +#: ../../library/asyncio-eventloop.rst:1807 msgid "(This ``signals`` example only works on Unix.)" msgstr "" -#: ../../library/asyncio-eventloop.rst:1721 +#: ../../library/asyncio-eventloop.rst:1809 msgid "" "Register handlers for signals :py:data:`SIGINT` and :py:data:`SIGTERM` using " "the :meth:`loop.add_signal_handler` method::" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index ec7c2614d6..075e7bc684 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-01-31 21:41+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,19 +29,20 @@ msgid "**Source code:** :source:`Lib/asyncio/exceptions.py`" msgstr "**原始碼:**\\ :source:`Lib/asyncio/exceptions.py`" #: ../../library/asyncio-exceptions.rst:16 -msgid "The operation has exceeded the given deadline." -msgstr "該操作已超過規定的截止時間。" - -#: ../../library/asyncio-exceptions.rst:19 msgid "" -"This exception is different from the builtin :exc:`TimeoutError` exception." -msgstr "這個例外與內建 :exc:`TimeoutError` 例外不同。" +"A deprecated alias of :exc:`TimeoutError`, raised when the operation has " +"exceeded the given deadline." +msgstr ":exc:`TimeoutError` 的一個已被棄用的別名,當操作已超過規定的截止時間時被引發。" + +#: ../../library/asyncio-exceptions.rst:21 +msgid "This class was made an alias of :exc:`TimeoutError`." +msgstr "此 class 是 :exc:`TimeoutError` 的一個別名。" -#: ../../library/asyncio-exceptions.rst:25 +#: ../../library/asyncio-exceptions.rst:26 msgid "The operation has been cancelled." msgstr "該操作已被取消。" -#: ../../library/asyncio-exceptions.rst:27 +#: ../../library/asyncio-exceptions.rst:28 msgid "" "This exception can be caught to perform custom operations when asyncio Tasks " "are cancelled. In almost all situations the exception must be re-raised." @@ -49,57 +50,57 @@ msgstr "" "當 asyncio Task 被取消時,可以捕獲此例外以執行客製化操作。在幾乎所有情況下," "該例外必須重新被引發。" -#: ../../library/asyncio-exceptions.rst:33 +#: ../../library/asyncio-exceptions.rst:34 msgid ":exc:`CancelledError` is now a subclass of :class:`BaseException`." msgstr ":exc:`CancelledError` 現在是 :class:`BaseException` 的子類別。" -#: ../../library/asyncio-exceptions.rst:38 +#: ../../library/asyncio-exceptions.rst:39 msgid "Invalid internal state of :class:`Task` or :class:`Future`." msgstr ":class:`Task` 或 :class:`Future` 的無效內部狀態。" -#: ../../library/asyncio-exceptions.rst:40 +#: ../../library/asyncio-exceptions.rst:41 msgid "" "Can be raised in situations like setting a result value for a *Future* " "object that already has a result value set." msgstr "可以在像是為已設定結果值的 *Future* 物件設定結果值的情況下引發。" -#: ../../library/asyncio-exceptions.rst:46 +#: ../../library/asyncio-exceptions.rst:47 msgid "" "The \"sendfile\" syscall is not available for the given socket or file type." msgstr "\"sendfile\" 系統呼叫不適用於給定的 socket 或檔案型別。" -#: ../../library/asyncio-exceptions.rst:49 +#: ../../library/asyncio-exceptions.rst:50 msgid "A subclass of :exc:`RuntimeError`." msgstr "一個 :exc:`RuntimeError` 的子類別。" -#: ../../library/asyncio-exceptions.rst:54 +#: ../../library/asyncio-exceptions.rst:55 msgid "The requested read operation did not complete fully." msgstr "請求的讀取操作未全部完成。" -#: ../../library/asyncio-exceptions.rst:56 +#: ../../library/asyncio-exceptions.rst:57 msgid "Raised by the :ref:`asyncio stream APIs`." msgstr "由 :ref:`asyncio 串流 APIs ` 引發。" -#: ../../library/asyncio-exceptions.rst:58 +#: ../../library/asyncio-exceptions.rst:59 msgid "This exception is a subclass of :exc:`EOFError`." msgstr "此例外是 :exc:`EOFError` 的子類別。" -#: ../../library/asyncio-exceptions.rst:62 +#: ../../library/asyncio-exceptions.rst:63 msgid "The total number (:class:`int`) of expected bytes." msgstr "預期的位元組總數 (\\ :class:`int`\\ )。" -#: ../../library/asyncio-exceptions.rst:66 +#: ../../library/asyncio-exceptions.rst:67 msgid "A string of :class:`bytes` read before the end of stream was reached." msgstr "串流結束之前讀取的 :class:`bytes` 字串。" -#: ../../library/asyncio-exceptions.rst:71 +#: ../../library/asyncio-exceptions.rst:72 msgid "Reached the buffer size limit while looking for a separator." msgstr "在查詢分隔符號 (separator) 時達到緩衝區 (buffer) 大小限制。" -#: ../../library/asyncio-exceptions.rst:73 +#: ../../library/asyncio-exceptions.rst:74 msgid "Raised by the :ref:`asyncio stream APIs `." msgstr "由 :ref:`asyncio 串流 APIs ` 引發。" -#: ../../library/asyncio-exceptions.rst:77 +#: ../../library/asyncio-exceptions.rst:78 msgid "The total number of to be consumed bytes." msgstr "要消耗的位元組總數。" diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po new file mode 100644 index 0000000000..b9a9a7083a --- /dev/null +++ b/library/asyncio-extending.po @@ -0,0 +1,155 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/asyncio-extending.rst:6 +msgid "Extending" +msgstr "" + +#: ../../library/asyncio-extending.rst:8 +msgid "" +"The main direction for :mod:`asyncio` extending is writing custom *event " +"loop* classes. Asyncio has helpers that could be used to simplify this task." +msgstr "" + +#: ../../library/asyncio-extending.rst:13 +msgid "" +"Third-parties should reuse existing asyncio code with caution, a new Python " +"version is free to break backward compatibility in *internal* part of API." +msgstr "" + +#: ../../library/asyncio-extending.rst:19 +msgid "Writing a Custom Event Loop" +msgstr "" + +#: ../../library/asyncio-extending.rst:21 +msgid "" +":class:`asyncio.AbstractEventLoop` declares very many methods. Implementing " +"all them from scratch is a tedious job." +msgstr "" + +#: ../../library/asyncio-extending.rst:24 +msgid "" +"A loop can get many common methods implementation for free by inheriting " +"from :class:`asyncio.BaseEventLoop`." +msgstr "" + +#: ../../library/asyncio-extending.rst:27 +msgid "" +"In turn, the successor should implement a bunch of *private* methods " +"declared but not implemented in :class:`asyncio.BaseEventLoop`." +msgstr "" + +#: ../../library/asyncio-extending.rst:30 +msgid "" +"For example, ``loop.create_connection()`` checks arguments, resolves DNS " +"addresses, and calls ``loop._make_socket_transport()`` that should be " +"implemented by inherited class. The ``_make_socket_transport()`` method is " +"not documented and is considered as an *internal* API." +msgstr "" + +#: ../../library/asyncio-extending.rst:38 +msgid "Future and Task private constructors" +msgstr "" + +#: ../../library/asyncio-extending.rst:40 +msgid "" +":class:`asyncio.Future` and :class:`asyncio.Task` should be never created " +"directly, please use corresponding :meth:`loop.create_future` and :meth:" +"`loop.create_task`, or :func:`asyncio.create_task` factories instead." +msgstr "" + +#: ../../library/asyncio-extending.rst:44 +msgid "" +"However, third-party *event loops* may *reuse* built-in future and task " +"implementations for the sake of getting a complex and highly optimized code " +"for free." +msgstr "" + +#: ../../library/asyncio-extending.rst:47 +msgid "For this purpose the following, *private* constructors are listed:" +msgstr "" + +#: ../../library/asyncio-extending.rst:51 +msgid "Create a built-in future instance." +msgstr "" + +#: ../../library/asyncio-extending.rst:53 +msgid "*loop* is an optional event loop instance." +msgstr "" + +#: ../../library/asyncio-extending.rst:57 +msgid "Create a built-in task instance." +msgstr "" + +#: ../../library/asyncio-extending.rst:59 +msgid "" +"*loop* is an optional event loop instance. The rest of arguments are " +"described in :meth:`loop.create_task` description." +msgstr "" + +#: ../../library/asyncio-extending.rst:64 +msgid "*context* argument is added." +msgstr "" + +#: ../../library/asyncio-extending.rst:69 +msgid "Task lifetime support" +msgstr "" + +#: ../../library/asyncio-extending.rst:71 +msgid "" +"A third party task implementation should call the following functions to " +"keep a task visible by :func:`asyncio.get_tasks` and :func:`asyncio." +"current_task`:" +msgstr "" + +#: ../../library/asyncio-extending.rst:76 +msgid "Register a new *task* as managed by *asyncio*." +msgstr "" + +#: ../../library/asyncio-extending.rst:78 +msgid "Call the function from a task constructor." +msgstr "" + +#: ../../library/asyncio-extending.rst:82 +msgid "Unregister a *task* from *asyncio* internal structures." +msgstr "" + +#: ../../library/asyncio-extending.rst:84 +msgid "The function should be called when a task is about to finish." +msgstr "" + +#: ../../library/asyncio-extending.rst:88 +msgid "Switch the current task to the *task* argument." +msgstr "" + +#: ../../library/asyncio-extending.rst:90 +msgid "" +"Call the function just before executing a portion of embedded *coroutine* (:" +"meth:`coroutine.send` or :meth:`coroutine.throw`)." +msgstr "" + +#: ../../library/asyncio-extending.rst:95 +msgid "Switch the current task back from *task* to ``None``." +msgstr "" + +#: ../../library/asyncio-extending.rst:97 +msgid "" +"Call the function just after :meth:`coroutine.send` or :meth:`coroutine." +"throw` execution." +msgstr "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index e93a42a359..8f385e9774 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-29 00:25+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-02-09 11:27+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,7 +64,7 @@ msgid "Create a new event loop." msgstr "建立一個新的事件迴圈。" #: ../../library/asyncio-llapi-index.rst:32 -#: ../../library/asyncio-llapi-index.rst:260 +#: ../../library/asyncio-llapi-index.rst:269 msgid "Examples" msgstr "範例" @@ -80,8 +80,7 @@ msgstr "事件迴圈方法" msgid "" "See also the main documentation section about the :ref:`asyncio-event-loop-" "methods`." -msgstr "" -"也請查閱文件中關於\\ :ref:`asyncio-event-loop-methods`\\ 的主要段落。" +msgstr "也請查閱文件中關於\\ :ref:`asyncio-event-loop-methods`\\ 的主要段落。" #: ../../library/asyncio-llapi-index.rst:42 msgid "Lifecycle" @@ -392,158 +391,183 @@ msgstr "" "將從 :class:`~socket.socket` 接收到的資料存放於一個緩衝區 (buffer) 中。" #: ../../library/asyncio-llapi-index.rst:192 +msgid "``await`` :meth:`loop.sock_recvfrom`" +msgstr "``await`` :meth:`loop.sock_recvfrom`" + +#: ../../library/asyncio-llapi-index.rst:193 +msgid "Receive a datagram from the :class:`~socket.socket`." +msgstr "從 :class:`~socket.socket` 接收一個資料單元。" + +#: ../../library/asyncio-llapi-index.rst:195 +msgid "``await`` :meth:`loop.sock_recvfrom_into`" +msgstr "``await`` :meth:`loop.sock_recvfrom_into`" + +#: ../../library/asyncio-llapi-index.rst:196 +msgid "Receive a datagram from the :class:`~socket.socket` into a buffer." +msgstr "" +"將從 :class:`~socket.socket` 接收到的資料單元存放於一個緩衝區中。" + +#: ../../library/asyncio-llapi-index.rst:198 msgid "``await`` :meth:`loop.sock_sendall`" msgstr "``await`` :meth:`loop.sock_sendall`" -#: ../../library/asyncio-llapi-index.rst:193 +#: ../../library/asyncio-llapi-index.rst:199 msgid "Send data to the :class:`~socket.socket`." msgstr "傳送資料到 :class:`~socket.socket`\\ 。" -#: ../../library/asyncio-llapi-index.rst:195 +#: ../../library/asyncio-llapi-index.rst:201 +msgid "``await`` :meth:`loop.sock_sendto`" +msgstr "``await`` :meth:`loop.sock_sendto`" + +#: ../../library/asyncio-llapi-index.rst:202 +msgid "Send a datagram via the :class:`~socket.socket` to the given address." +msgstr "透過 :class:`~socket.socket` 將資料單元傳送至給定的地址。" + +#: ../../library/asyncio-llapi-index.rst:204 msgid "``await`` :meth:`loop.sock_connect`" msgstr "``await`` :meth:`loop.sock_connect`" -#: ../../library/asyncio-llapi-index.rst:196 +#: ../../library/asyncio-llapi-index.rst:205 msgid "Connect the :class:`~socket.socket`." msgstr "連接 :class:`~socket.socket`\\ 。" -#: ../../library/asyncio-llapi-index.rst:198 +#: ../../library/asyncio-llapi-index.rst:207 msgid "``await`` :meth:`loop.sock_accept`" msgstr "``await`` :meth:`loop.sock_accept`" -#: ../../library/asyncio-llapi-index.rst:199 +#: ../../library/asyncio-llapi-index.rst:208 msgid "Accept a :class:`~socket.socket` connection." msgstr "接受一個 :class:`~socket.socket` 連線。" -#: ../../library/asyncio-llapi-index.rst:201 +#: ../../library/asyncio-llapi-index.rst:210 msgid "``await`` :meth:`loop.sock_sendfile`" msgstr "``await`` :meth:`loop.sock_sendfile`" -#: ../../library/asyncio-llapi-index.rst:202 +#: ../../library/asyncio-llapi-index.rst:211 msgid "Send a file over the :class:`~socket.socket`." msgstr "透過 :class:`~socket.socket` 傳送一個檔案。" -#: ../../library/asyncio-llapi-index.rst:204 +#: ../../library/asyncio-llapi-index.rst:213 msgid ":meth:`loop.add_reader`" msgstr ":meth:`loop.add_reader`" -#: ../../library/asyncio-llapi-index.rst:205 +#: ../../library/asyncio-llapi-index.rst:214 msgid "Start watching a file descriptor for read availability." msgstr "開始監控一個檔案描述器 (file descriptor) 的可讀取性。" -#: ../../library/asyncio-llapi-index.rst:207 +#: ../../library/asyncio-llapi-index.rst:216 msgid ":meth:`loop.remove_reader`" msgstr ":meth:`loop.remove_reader`" -#: ../../library/asyncio-llapi-index.rst:208 +#: ../../library/asyncio-llapi-index.rst:217 msgid "Stop watching a file descriptor for read availability." msgstr "停止監控一個檔案描述器的可讀取性。" -#: ../../library/asyncio-llapi-index.rst:210 +#: ../../library/asyncio-llapi-index.rst:219 msgid ":meth:`loop.add_writer`" msgstr ":meth:`loop.add_writer`" -#: ../../library/asyncio-llapi-index.rst:211 +#: ../../library/asyncio-llapi-index.rst:220 msgid "Start watching a file descriptor for write availability." msgstr "開始監控一個檔案描述器的可寫入性。" -#: ../../library/asyncio-llapi-index.rst:213 +#: ../../library/asyncio-llapi-index.rst:222 msgid ":meth:`loop.remove_writer`" msgstr ":meth:`loop.remove_writer`" -#: ../../library/asyncio-llapi-index.rst:214 +#: ../../library/asyncio-llapi-index.rst:223 msgid "Stop watching a file descriptor for write availability." msgstr "停止監控一個檔案描述器的可寫入性。" -#: ../../library/asyncio-llapi-index.rst:217 +#: ../../library/asyncio-llapi-index.rst:226 msgid "Unix Signals" msgstr "Unix 信號" -#: ../../library/asyncio-llapi-index.rst:222 +#: ../../library/asyncio-llapi-index.rst:231 msgid ":meth:`loop.add_signal_handler`" msgstr ":meth:`loop.add_signal_handler`" -#: ../../library/asyncio-llapi-index.rst:223 +#: ../../library/asyncio-llapi-index.rst:232 msgid "Add a handler for a :mod:`signal`." msgstr "為 :mod:`signal` 新增一個處理函式 (handler)。" -#: ../../library/asyncio-llapi-index.rst:225 +#: ../../library/asyncio-llapi-index.rst:234 msgid ":meth:`loop.remove_signal_handler`" msgstr ":meth:`loop.remove_signal_handler`" -#: ../../library/asyncio-llapi-index.rst:226 +#: ../../library/asyncio-llapi-index.rst:235 msgid "Remove a handler for a :mod:`signal`." msgstr "刪除 :mod:`signal` 的處理函式。" -#: ../../library/asyncio-llapi-index.rst:229 +#: ../../library/asyncio-llapi-index.rst:238 msgid "Subprocesses" msgstr "子行程" -#: ../../library/asyncio-llapi-index.rst:234 +#: ../../library/asyncio-llapi-index.rst:243 msgid ":meth:`loop.subprocess_exec`" msgstr ":meth:`loop.subprocess_exec`" -#: ../../library/asyncio-llapi-index.rst:235 +#: ../../library/asyncio-llapi-index.rst:244 msgid "Spawn a subprocess." msgstr "衍生 (spawn) 一個子行程 (subprocess)。" -#: ../../library/asyncio-llapi-index.rst:237 +#: ../../library/asyncio-llapi-index.rst:246 msgid ":meth:`loop.subprocess_shell`" msgstr ":meth:`loop.subprocess_shell`" -#: ../../library/asyncio-llapi-index.rst:238 +#: ../../library/asyncio-llapi-index.rst:247 msgid "Spawn a subprocess from a shell command." msgstr "從 shell 指令衍生一個子行程。" -#: ../../library/asyncio-llapi-index.rst:241 +#: ../../library/asyncio-llapi-index.rst:250 msgid "Error Handling" msgstr "錯誤處理" -#: ../../library/asyncio-llapi-index.rst:246 +#: ../../library/asyncio-llapi-index.rst:255 msgid ":meth:`loop.call_exception_handler`" msgstr ":meth:`loop.call_exception_handler`" -#: ../../library/asyncio-llapi-index.rst:247 +#: ../../library/asyncio-llapi-index.rst:256 msgid "Call the exception handler." msgstr "呼叫例外處理函式。" -#: ../../library/asyncio-llapi-index.rst:249 +#: ../../library/asyncio-llapi-index.rst:258 msgid ":meth:`loop.set_exception_handler`" msgstr ":meth:`loop.set_exception_handler`" -#: ../../library/asyncio-llapi-index.rst:250 +#: ../../library/asyncio-llapi-index.rst:259 msgid "Set a new exception handler." msgstr "設定一個新的例外處理函式。" -#: ../../library/asyncio-llapi-index.rst:252 +#: ../../library/asyncio-llapi-index.rst:261 msgid ":meth:`loop.get_exception_handler`" msgstr ":meth:`loop.get_exception_handler`" -#: ../../library/asyncio-llapi-index.rst:253 +#: ../../library/asyncio-llapi-index.rst:262 msgid "Get the current exception handler." msgstr "獲取當前例外處理函式。" -#: ../../library/asyncio-llapi-index.rst:255 +#: ../../library/asyncio-llapi-index.rst:264 msgid ":meth:`loop.default_exception_handler`" msgstr ":meth:`loop.default_exception_handler`" -#: ../../library/asyncio-llapi-index.rst:256 +#: ../../library/asyncio-llapi-index.rst:265 msgid "The default exception handler implementation." msgstr "預設例外處理函式實作。" -#: ../../library/asyncio-llapi-index.rst:261 +#: ../../library/asyncio-llapi-index.rst:270 msgid "" -":ref:`Using asyncio.get_event_loop() and loop.run_forever() " +":ref:`Using asyncio.new_event_loop() and loop.run_forever() " "`." msgstr "" -":ref:`使用 asyncio.get_event_loop() 和 loop.run_forever() " +":ref:`使用 asyncio.new_event_loop() 和 loop.run_forever() " "`\\ 。" -#: ../../library/asyncio-llapi-index.rst:264 +#: ../../library/asyncio-llapi-index.rst:273 msgid ":ref:`Using loop.call_later() `." msgstr ":ref:`使用 loop.call_later() `\\ 。" -#: ../../library/asyncio-llapi-index.rst:266 +#: ../../library/asyncio-llapi-index.rst:275 msgid "" "Using ``loop.create_connection()`` to implement :ref:`an echo-client " "`." @@ -551,7 +575,7 @@ msgstr "" "使用 ``loop.create_connection()`` 以實作\\ :ref:`一個 echo 客戶端 " "`\\ 。" -#: ../../library/asyncio-llapi-index.rst:269 +#: ../../library/asyncio-llapi-index.rst:278 msgid "" "Using ``loop.create_connection()`` to :ref:`connect a socket " "`." @@ -559,72 +583,72 @@ msgstr "" "使用 ``loop.create_connection()`` 來\\ :ref:`連接 socket " "`\\ 。" -#: ../../library/asyncio-llapi-index.rst:272 +#: ../../library/asyncio-llapi-index.rst:281 msgid "" ":ref:`Using add_reader() to watch an FD for read events " "`." msgstr "" ":ref:`使用 add_reader() 監控 FD 的讀取事件 `\\ 。" -#: ../../library/asyncio-llapi-index.rst:275 +#: ../../library/asyncio-llapi-index.rst:284 msgid ":ref:`Using loop.add_signal_handler() `." msgstr "" ":ref:`使用 loop.add_signal_handler() `\\ 。" -#: ../../library/asyncio-llapi-index.rst:277 +#: ../../library/asyncio-llapi-index.rst:286 msgid ":ref:`Using loop.subprocess_exec() `." msgstr "" ":ref:`使用 loop.add_signal_handler() `\\ 。" -#: ../../library/asyncio-llapi-index.rst:281 +#: ../../library/asyncio-llapi-index.rst:290 msgid "Transports" msgstr "傳輸" -#: ../../library/asyncio-llapi-index.rst:283 +#: ../../library/asyncio-llapi-index.rst:292 msgid "All transports implement the following methods:" msgstr "所有傳輸方式都有實作以下方法:" -#: ../../library/asyncio-llapi-index.rst:289 +#: ../../library/asyncio-llapi-index.rst:298 msgid ":meth:`transport.close() `" msgstr ":meth:`transport.close() `" -#: ../../library/asyncio-llapi-index.rst:290 +#: ../../library/asyncio-llapi-index.rst:299 msgid "Close the transport." msgstr "關閉傳輸。" -#: ../../library/asyncio-llapi-index.rst:292 +#: ../../library/asyncio-llapi-index.rst:301 msgid ":meth:`transport.is_closing() `" msgstr ":meth:`transport.is_closing() `" -#: ../../library/asyncio-llapi-index.rst:293 +#: ../../library/asyncio-llapi-index.rst:302 msgid "Return ``True`` if the transport is closing or is closed." msgstr "如果傳輸正在關閉或已經關閉則回傳 ``True``\\ 。" -#: ../../library/asyncio-llapi-index.rst:295 +#: ../../library/asyncio-llapi-index.rst:304 msgid ":meth:`transport.get_extra_info() `" msgstr ":meth:`transport.get_extra_info() `" -#: ../../library/asyncio-llapi-index.rst:296 +#: ../../library/asyncio-llapi-index.rst:305 msgid "Request for information about the transport." msgstr "請求傳輸的相關資訊。" -#: ../../library/asyncio-llapi-index.rst:298 +#: ../../library/asyncio-llapi-index.rst:307 msgid ":meth:`transport.set_protocol() `" msgstr ":meth:`transport.set_protocol() `" -#: ../../library/asyncio-llapi-index.rst:299 +#: ../../library/asyncio-llapi-index.rst:308 msgid "Set a new protocol." msgstr "設定一個新協定。" -#: ../../library/asyncio-llapi-index.rst:301 +#: ../../library/asyncio-llapi-index.rst:310 msgid ":meth:`transport.get_protocol() `" msgstr ":meth:`transport.get_protocol() `" -#: ../../library/asyncio-llapi-index.rst:302 +#: ../../library/asyncio-llapi-index.rst:311 msgid "Return the current protocol." msgstr "回傳當前協定。" -#: ../../library/asyncio-llapi-index.rst:305 +#: ../../library/asyncio-llapi-index.rst:314 msgid "" "Transports that can receive data (TCP and Unix connections, pipes, etc). " "Returned from methods like :meth:`loop.create_connection`, :meth:`loop." @@ -634,35 +658,35 @@ msgstr "" "create_connection`\\ 、\\ :meth:`loop.create_unix_connection`\\ 、\\ :meth:" "`loop.connect_read_pipe` 等方法回傳:" -#: ../../library/asyncio-llapi-index.rst:310 +#: ../../library/asyncio-llapi-index.rst:319 msgid "Read Transports" msgstr "讀取傳輸" -#: ../../library/asyncio-llapi-index.rst:315 +#: ../../library/asyncio-llapi-index.rst:324 msgid ":meth:`transport.is_reading() `" msgstr ":meth:`transport.is_reading() `" -#: ../../library/asyncio-llapi-index.rst:316 +#: ../../library/asyncio-llapi-index.rst:325 msgid "Return ``True`` if the transport is receiving." msgstr "如果傳輸正在接收則回傳 ``True``\\ 。" -#: ../../library/asyncio-llapi-index.rst:318 +#: ../../library/asyncio-llapi-index.rst:327 msgid ":meth:`transport.pause_reading() `" msgstr ":meth:`transport.pause_reading() `" -#: ../../library/asyncio-llapi-index.rst:319 +#: ../../library/asyncio-llapi-index.rst:328 msgid "Pause receiving." msgstr "暫停接收。" -#: ../../library/asyncio-llapi-index.rst:321 +#: ../../library/asyncio-llapi-index.rst:330 msgid ":meth:`transport.resume_reading() `" msgstr ":meth:`transport.resume_reading() `" -#: ../../library/asyncio-llapi-index.rst:322 +#: ../../library/asyncio-llapi-index.rst:331 msgid "Resume receiving." msgstr "繼續接收。" -#: ../../library/asyncio-llapi-index.rst:325 +#: ../../library/asyncio-llapi-index.rst:334 msgid "" "Transports that can Send data (TCP and Unix connections, pipes, etc). " "Returned from methods like :meth:`loop.create_connection`, :meth:`loop." @@ -672,52 +696,52 @@ msgstr "" "create_connection`\\ 、\\ :meth:`loop.create_unix_connection`\\ 、\\ :meth:" "`loop.connect_write_pipe` 等方法回傳:" -#: ../../library/asyncio-llapi-index.rst:330 +#: ../../library/asyncio-llapi-index.rst:339 msgid "Write Transports" msgstr "寫入傳輸" -#: ../../library/asyncio-llapi-index.rst:335 +#: ../../library/asyncio-llapi-index.rst:344 msgid ":meth:`transport.write() `" msgstr ":meth:`transport.write() `" -#: ../../library/asyncio-llapi-index.rst:336 +#: ../../library/asyncio-llapi-index.rst:345 msgid "Write data to the transport." msgstr "將資料寫入傳輸。" -#: ../../library/asyncio-llapi-index.rst:338 +#: ../../library/asyncio-llapi-index.rst:347 msgid ":meth:`transport.writelines() `" msgstr ":meth:`transport.writelines() `" -#: ../../library/asyncio-llapi-index.rst:339 +#: ../../library/asyncio-llapi-index.rst:348 msgid "Write buffers to the transport." msgstr "將緩衝區資料寫入傳輸。" -#: ../../library/asyncio-llapi-index.rst:341 +#: ../../library/asyncio-llapi-index.rst:350 msgid ":meth:`transport.can_write_eof() `" msgstr ":meth:`transport.can_write_eof() `" -#: ../../library/asyncio-llapi-index.rst:342 +#: ../../library/asyncio-llapi-index.rst:351 msgid "Return :const:`True` if the transport supports sending EOF." msgstr "如果傳輸支援傳送 EOF 則回傳 :const:`True`\\ 。" -#: ../../library/asyncio-llapi-index.rst:344 +#: ../../library/asyncio-llapi-index.rst:353 msgid ":meth:`transport.write_eof() `" msgstr ":meth:`transport.write_eof() `" -#: ../../library/asyncio-llapi-index.rst:345 +#: ../../library/asyncio-llapi-index.rst:354 msgid "Close and send EOF after flushing buffered data." msgstr "在清除 (flush) 已緩衝的資料後關閉傳輸並傳送 EOF。" -#: ../../library/asyncio-llapi-index.rst:347 +#: ../../library/asyncio-llapi-index.rst:356 msgid ":meth:`transport.abort() `" msgstr ":meth:`transport.abort() `" -#: ../../library/asyncio-llapi-index.rst:348 -#: ../../library/asyncio-llapi-index.rst:374 +#: ../../library/asyncio-llapi-index.rst:357 +#: ../../library/asyncio-llapi-index.rst:383 msgid "Close the transport immediately." msgstr "立即關閉傳輸。" -#: ../../library/asyncio-llapi-index.rst:350 +#: ../../library/asyncio-llapi-index.rst:359 msgid "" ":meth:`transport.get_write_buffer_size() `" @@ -725,11 +749,11 @@ msgstr "" ":meth:`transport.get_write_buffer_size() `" -#: ../../library/asyncio-llapi-index.rst:352 +#: ../../library/asyncio-llapi-index.rst:361 msgid "Return the current size of the output buffer." msgstr "回傳當前輸出緩衝區的大小。" -#: ../../library/asyncio-llapi-index.rst:354 +#: ../../library/asyncio-llapi-index.rst:363 msgid "" ":meth:`transport.get_write_buffer_limits() `" @@ -737,13 +761,13 @@ msgstr "" ":meth:`transport.get_write_buffer_limits() `" -#: ../../library/asyncio-llapi-index.rst:356 +#: ../../library/asyncio-llapi-index.rst:365 msgid "Return high and low water marks for write flow control." msgstr "" "回傳用於寫入流量控制 (write flow control) 的高低標記位 (high and low water " "marks)。" -#: ../../library/asyncio-llapi-index.rst:358 +#: ../../library/asyncio-llapi-index.rst:367 msgid "" ":meth:`transport.set_write_buffer_limits() `" @@ -751,31 +775,31 @@ msgstr "" ":meth:`transport.set_write_buffer_limits() `" -#: ../../library/asyncio-llapi-index.rst:360 +#: ../../library/asyncio-llapi-index.rst:369 msgid "Set new high and low water marks for write flow control." msgstr "為寫入流量控制設定高低標記位。" -#: ../../library/asyncio-llapi-index.rst:363 +#: ../../library/asyncio-llapi-index.rst:372 msgid "Transports returned by :meth:`loop.create_datagram_endpoint`:" msgstr "由 :meth:`loop.create_datagram_endpoint` 回傳的傳輸:" -#: ../../library/asyncio-llapi-index.rst:365 +#: ../../library/asyncio-llapi-index.rst:374 msgid "Datagram Transports" msgstr "資料單元傳輸" -#: ../../library/asyncio-llapi-index.rst:370 +#: ../../library/asyncio-llapi-index.rst:379 msgid ":meth:`transport.sendto() `" msgstr ":meth:`transport.sendto() `" -#: ../../library/asyncio-llapi-index.rst:371 +#: ../../library/asyncio-llapi-index.rst:380 msgid "Send data to the remote peer." msgstr "傳送資料到連線遠端。" -#: ../../library/asyncio-llapi-index.rst:373 +#: ../../library/asyncio-llapi-index.rst:382 msgid ":meth:`transport.abort() `" msgstr ":meth:`transport.abort() `" -#: ../../library/asyncio-llapi-index.rst:377 +#: ../../library/asyncio-llapi-index.rst:386 msgid "" "Low-level transport abstraction over subprocesses. Returned by :meth:`loop." "subprocess_exec` and :meth:`loop.subprocess_shell`:" @@ -783,19 +807,19 @@ msgstr "" "基於子行程的低階傳輸抽象,它會由 :meth:`loop.subprocess_exec` 和 :meth:`loop." "subprocess_shell` 所回傳:" -#: ../../library/asyncio-llapi-index.rst:381 +#: ../../library/asyncio-llapi-index.rst:390 msgid "Subprocess Transports" msgstr "子行程傳輸" -#: ../../library/asyncio-llapi-index.rst:386 +#: ../../library/asyncio-llapi-index.rst:395 msgid ":meth:`transport.get_pid() `" msgstr ":meth:`transport.get_pid() `" -#: ../../library/asyncio-llapi-index.rst:387 +#: ../../library/asyncio-llapi-index.rst:396 msgid "Return the subprocess process id." msgstr "回傳子行程的行程 id。" -#: ../../library/asyncio-llapi-index.rst:389 +#: ../../library/asyncio-llapi-index.rst:398 msgid "" ":meth:`transport.get_pipe_transport() `" @@ -803,169 +827,169 @@ msgstr "" ":meth:`transport.get_pipe_transport() `" -#: ../../library/asyncio-llapi-index.rst:391 +#: ../../library/asyncio-llapi-index.rst:400 msgid "" "Return the transport for the requested communication pipe (*stdin*, " "*stdout*, or *stderr*)." msgstr "" "回傳被請求用於通訊 pipe (*stdin*\\ 、\\ *stdout* 或 *stderr*)的傳輸。" -#: ../../library/asyncio-llapi-index.rst:394 +#: ../../library/asyncio-llapi-index.rst:403 msgid ":meth:`transport.get_returncode() `" msgstr "" ":meth:`transport.get_returncode() `" -#: ../../library/asyncio-llapi-index.rst:395 +#: ../../library/asyncio-llapi-index.rst:404 msgid "Return the subprocess return code." msgstr "回傳子行程的回傳代號 (return code)。" -#: ../../library/asyncio-llapi-index.rst:397 +#: ../../library/asyncio-llapi-index.rst:406 msgid ":meth:`transport.kill() `" msgstr ":meth:`transport.kill() `" -#: ../../library/asyncio-llapi-index.rst:398 +#: ../../library/asyncio-llapi-index.rst:407 msgid "Kill the subprocess." msgstr "殺死子行程。" -#: ../../library/asyncio-llapi-index.rst:400 +#: ../../library/asyncio-llapi-index.rst:409 msgid ":meth:`transport.send_signal() `" msgstr ":meth:`transport.send_signal() `" -#: ../../library/asyncio-llapi-index.rst:401 +#: ../../library/asyncio-llapi-index.rst:410 msgid "Send a signal to the subprocess." msgstr "傳送一個訊號到子行程。" -#: ../../library/asyncio-llapi-index.rst:403 +#: ../../library/asyncio-llapi-index.rst:412 msgid ":meth:`transport.terminate() `" msgstr ":meth:`transport.terminate() `" -#: ../../library/asyncio-llapi-index.rst:404 +#: ../../library/asyncio-llapi-index.rst:413 msgid "Stop the subprocess." msgstr "停止子行程。" -#: ../../library/asyncio-llapi-index.rst:406 +#: ../../library/asyncio-llapi-index.rst:415 msgid ":meth:`transport.close() `" msgstr ":meth:`transport.close() `" -#: ../../library/asyncio-llapi-index.rst:407 +#: ../../library/asyncio-llapi-index.rst:416 msgid "Kill the subprocess and close all pipes." msgstr "殺死子行程並關閉所有 pipes。" -#: ../../library/asyncio-llapi-index.rst:411 +#: ../../library/asyncio-llapi-index.rst:420 msgid "Protocols" msgstr "協定" -#: ../../library/asyncio-llapi-index.rst:413 +#: ../../library/asyncio-llapi-index.rst:422 msgid "Protocol classes can implement the following **callback methods**:" msgstr "協定類別可以實作以下\\ **回呼方法**\\ :" -#: ../../library/asyncio-llapi-index.rst:419 +#: ../../library/asyncio-llapi-index.rst:428 msgid "``callback`` :meth:`connection_made() `" msgstr "``callback`` :meth:`connection_made() `" -#: ../../library/asyncio-llapi-index.rst:420 +#: ../../library/asyncio-llapi-index.rst:429 msgid "Called when a connection is made." msgstr "在連線建立時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:422 +#: ../../library/asyncio-llapi-index.rst:431 msgid "``callback`` :meth:`connection_lost() `" msgstr "``callback`` :meth:`connection_lost() `" -#: ../../library/asyncio-llapi-index.rst:423 +#: ../../library/asyncio-llapi-index.rst:432 msgid "Called when the connection is lost or closed." msgstr "在失去連線或連線關閉時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:425 +#: ../../library/asyncio-llapi-index.rst:434 msgid "``callback`` :meth:`pause_writing() `" msgstr "``callback`` :meth:`pause_writing() `" -#: ../../library/asyncio-llapi-index.rst:426 +#: ../../library/asyncio-llapi-index.rst:435 msgid "Called when the transport's buffer goes over the high water mark." msgstr "在傳輸緩衝區超過高標記位時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:428 +#: ../../library/asyncio-llapi-index.rst:437 msgid "``callback`` :meth:`resume_writing() `" msgstr "``callback`` :meth:`resume_writing() `" -#: ../../library/asyncio-llapi-index.rst:429 +#: ../../library/asyncio-llapi-index.rst:438 msgid "Called when the transport's buffer drains below the low water mark." msgstr "在傳輸緩衝區低於低標記位時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:432 +#: ../../library/asyncio-llapi-index.rst:441 msgid "Streaming Protocols (TCP, Unix Sockets, Pipes)" msgstr "串流協定 (TCP, Unix socket, Pipes)" -#: ../../library/asyncio-llapi-index.rst:437 +#: ../../library/asyncio-llapi-index.rst:446 msgid "``callback`` :meth:`data_received() `" msgstr "``callback`` :meth:`data_received() `" -#: ../../library/asyncio-llapi-index.rst:438 +#: ../../library/asyncio-llapi-index.rst:447 msgid "Called when some data is received." msgstr "在接收到資料時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:440 +#: ../../library/asyncio-llapi-index.rst:449 msgid "``callback`` :meth:`eof_received() `" msgstr "``callback`` :meth:`eof_received() `" -#: ../../library/asyncio-llapi-index.rst:441 -#: ../../library/asyncio-llapi-index.rst:456 +#: ../../library/asyncio-llapi-index.rst:450 +#: ../../library/asyncio-llapi-index.rst:465 msgid "Called when an EOF is received." msgstr "在接收到 EOF 時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:444 +#: ../../library/asyncio-llapi-index.rst:453 msgid "Buffered Streaming Protocols" msgstr "緩衝串流協定" -#: ../../library/asyncio-llapi-index.rst:449 +#: ../../library/asyncio-llapi-index.rst:458 msgid "``callback`` :meth:`get_buffer() `" msgstr "``callback`` :meth:`get_buffer() `" -#: ../../library/asyncio-llapi-index.rst:450 +#: ../../library/asyncio-llapi-index.rst:459 msgid "Called to allocate a new receive buffer." msgstr "呼叫後會分配新的接收緩衝區。" -#: ../../library/asyncio-llapi-index.rst:452 +#: ../../library/asyncio-llapi-index.rst:461 msgid "``callback`` :meth:`buffer_updated() `" msgstr "" "``callback`` :meth:`buffer_updated() `" -#: ../../library/asyncio-llapi-index.rst:453 +#: ../../library/asyncio-llapi-index.rst:462 msgid "Called when the buffer was updated with the received data." msgstr "在以接收到的資料更新緩衝區時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:455 +#: ../../library/asyncio-llapi-index.rst:464 msgid "``callback`` :meth:`eof_received() `" msgstr "``callback`` :meth:`eof_received() `" -#: ../../library/asyncio-llapi-index.rst:459 +#: ../../library/asyncio-llapi-index.rst:468 msgid "Datagram Protocols" msgstr "資料單元協定" -#: ../../library/asyncio-llapi-index.rst:464 +#: ../../library/asyncio-llapi-index.rst:473 msgid "" "``callback`` :meth:`datagram_received() `" msgstr "" "``callback`` :meth:`datagram_received() `" -#: ../../library/asyncio-llapi-index.rst:466 +#: ../../library/asyncio-llapi-index.rst:475 msgid "Called when a datagram is received." msgstr "在接收到資料單元時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:468 +#: ../../library/asyncio-llapi-index.rst:477 msgid "``callback`` :meth:`error_received() `" msgstr "" "``callback`` :meth:`error_received() `" -#: ../../library/asyncio-llapi-index.rst:469 +#: ../../library/asyncio-llapi-index.rst:478 msgid "" "Called when a previous send or receive operation raises an :class:`OSError`." msgstr "在前一個傳送或接收操作引發 :class:`OSError` 時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:473 +#: ../../library/asyncio-llapi-index.rst:482 msgid "Subprocess Protocols" msgstr "子行程協定" -#: ../../library/asyncio-llapi-index.rst:478 +#: ../../library/asyncio-llapi-index.rst:487 msgid "" "``callback`` :meth:`pipe_data_received() `" @@ -973,12 +997,12 @@ msgstr "" "``callback`` :meth:`pipe_data_received() `" -#: ../../library/asyncio-llapi-index.rst:480 +#: ../../library/asyncio-llapi-index.rst:489 msgid "" "Called when the child process writes data into its *stdout* or *stderr* pipe." msgstr "在子行程向 *stdout* 或 *stderr* pipe 寫入資料時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:483 +#: ../../library/asyncio-llapi-index.rst:492 msgid "" "``callback`` :meth:`pipe_connection_lost() `" @@ -986,26 +1010,26 @@ msgstr "" "``callback`` :meth:`pipe_connection_lost() `" -#: ../../library/asyncio-llapi-index.rst:485 +#: ../../library/asyncio-llapi-index.rst:494 msgid "" "Called when one of the pipes communicating with the child process is closed." msgstr "在與子行程通訊的其中一個 pipes 關閉時被呼叫。" -#: ../../library/asyncio-llapi-index.rst:488 +#: ../../library/asyncio-llapi-index.rst:497 msgid "" "``callback`` :meth:`process_exited() `" msgstr "" "``callback`` :meth:`process_exited() `" -#: ../../library/asyncio-llapi-index.rst:490 +#: ../../library/asyncio-llapi-index.rst:499 msgid "Called when the child process has exited." msgstr "在子行程退出後被呼叫。" -#: ../../library/asyncio-llapi-index.rst:494 +#: ../../library/asyncio-llapi-index.rst:503 msgid "Event Loop Policies" msgstr "事件迴圈 Policies" -#: ../../library/asyncio-llapi-index.rst:496 +#: ../../library/asyncio-llapi-index.rst:505 msgid "" "Policies is a low-level mechanism to alter the behavior of functions like :" "func:`asyncio.get_event_loop`. See also the main :ref:`policies section " @@ -1014,30 +1038,30 @@ msgstr "" "Policy 是改變 :func:`asyncio.get_event_loop` 這類函式行為的一個低階機制。更多" "細節請見 :ref:`Policy 相關段落 `\\ 。" -#: ../../library/asyncio-llapi-index.rst:502 +#: ../../library/asyncio-llapi-index.rst:511 msgid "Accessing Policies" msgstr "存取 Policy" -#: ../../library/asyncio-llapi-index.rst:507 +#: ../../library/asyncio-llapi-index.rst:516 msgid ":meth:`asyncio.get_event_loop_policy`" msgstr ":meth:`asyncio.get_event_loop_policy`" -#: ../../library/asyncio-llapi-index.rst:508 +#: ../../library/asyncio-llapi-index.rst:517 msgid "Return the current process-wide policy." msgstr "回傳當前整個行程中的 Policy。" -#: ../../library/asyncio-llapi-index.rst:510 +#: ../../library/asyncio-llapi-index.rst:519 msgid ":meth:`asyncio.set_event_loop_policy`" msgstr ":meth:`asyncio.set_event_loop_policy`" -#: ../../library/asyncio-llapi-index.rst:511 +#: ../../library/asyncio-llapi-index.rst:520 msgid "Set a new process-wide policy." msgstr "設定整個行程中的一個新 Policy。" -#: ../../library/asyncio-llapi-index.rst:513 +#: ../../library/asyncio-llapi-index.rst:522 msgid ":class:`AbstractEventLoopPolicy`" msgstr ":class:`AbstractEventLoopPolicy`" -#: ../../library/asyncio-llapi-index.rst:514 +#: ../../library/asyncio-llapi-index.rst:523 msgid "Base class for policy objects." msgstr "Policy 物件的基礎類別。" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index 385f5f7c37..91920d52cb 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-01-17 11:37+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,9 +132,9 @@ msgstr "不支援 :meth:`loop.add_reader` 和 :meth:`loop.add_writer` method。" #: ../../library/asyncio-platforms.rst:65 msgid "" "The resolution of the monotonic clock on Windows is usually around 15.6 " -"msec. The best resolution is 0.5 msec. The resolution depends on the " -"hardware (availability of `HPET `_) and on the Windows configuration." +"milliseconds. The best resolution is 0.5 milliseconds. The resolution " +"depends on the hardware (availability of `HPET `_) and on the Windows configuration." msgstr "" "Windows 上單調時鐘 (monotonic clock) 的解析度大約為 15.6 毫秒。最佳的解析度" "是 0.5 毫秒。解析度和硬體(\\ `HPET , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/asyncio-runner.rst:6 +msgid "Runners" +msgstr "" + +#: ../../library/asyncio-runner.rst:8 +msgid "**Source code:** :source:`Lib/asyncio/runners.py`" +msgstr "**原始碼:**\\ :source:`Lib/asyncio/runners.py`" + +#: ../../library/asyncio-runner.rst:11 +msgid "" +"This section outlines high-level asyncio primitives to run asyncio code." +msgstr "" + +#: ../../library/asyncio-runner.rst:13 +msgid "" +"They are built on top of an :ref:`event loop ` with the " +"aim to simplify async code usage for common wide-spread scenarios." +msgstr "" + +#: ../../library/asyncio-runner.rst:23 +msgid "Running an asyncio Program" +msgstr "" + +#: ../../library/asyncio-runner.rst:27 +msgid "Execute the :term:`coroutine` *coro* and return the result." +msgstr "" + +#: ../../library/asyncio-runner.rst:29 +msgid "" +"This function runs the passed coroutine, taking care of managing the asyncio " +"event loop, *finalizing asynchronous generators*, and closing the threadpool." +msgstr "" + +#: ../../library/asyncio-runner.rst:33 ../../library/asyncio-runner.rst:103 +msgid "" +"This function cannot be called when another asyncio event loop is running in " +"the same thread." +msgstr "" + +#: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:73 +msgid "" +"If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " +"disables debug mode explicitly. ``None`` is used to respect the global :ref:" +"`asyncio-debug-mode` settings." +msgstr "" + +#: ../../library/asyncio-runner.rst:40 +msgid "" +"This function always creates a new event loop and closes it at the end. It " +"should be used as a main entry point for asyncio programs, and should " +"ideally only be called once." +msgstr "" + +#: ../../library/asyncio-runner.rst:44 +msgid "Example::" +msgstr "" +"範例:\n" +"\n" +"::" + +#: ../../library/asyncio-runner.rst:54 +msgid "Updated to use :meth:`loop.shutdown_default_executor`." +msgstr "" + +#: ../../library/asyncio-runner.rst:59 +msgid "" +"*debug* is ``None`` by default to respect the global debug mode settings." +msgstr "" + +#: ../../library/asyncio-runner.rst:63 +msgid "Runner context manager" +msgstr "" + +#: ../../library/asyncio-runner.rst:67 +msgid "" +"A context manager that simplifies *multiple* async function calls in the " +"same context." +msgstr "" + +#: ../../library/asyncio-runner.rst:70 +msgid "" +"Sometimes several top-level async functions should be called in the same :" +"ref:`event loop ` and :class:`contextvars.Context`." +msgstr "" + +#: ../../library/asyncio-runner.rst:77 +msgid "" +"*loop_factory* could be used for overriding the loop creation. It is the " +"responsibility of the *loop_factory* to set the created loop as the current " +"one. By default :func:`asyncio.new_event_loop` is used and set as current " +"event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." +msgstr "" + +#: ../../library/asyncio-runner.rst:82 +msgid "" +"Basically, :func:`asyncio.run()` example can be rewritten with the runner " +"usage::" +msgstr "" + +#: ../../library/asyncio-runner.rst:95 +msgid "Run a :term:`coroutine ` *coro* in the embedded loop." +msgstr "" + +#: ../../library/asyncio-runner.rst:97 +msgid "Return the coroutine's result or raise its exception." +msgstr "" + +#: ../../library/asyncio-runner.rst:99 +msgid "" +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *coro* to run in. The runner's default " +"context is used if ``None``." +msgstr "" + +#: ../../library/asyncio-runner.rst:108 +msgid "Close the runner." +msgstr "" + +#: ../../library/asyncio-runner.rst:110 +msgid "" +"Finalize asynchronous generators, shutdown default executor, close the event " +"loop and release embedded :class:`contextvars.Context`." +msgstr "" + +#: ../../library/asyncio-runner.rst:115 +msgid "Return the event loop associated with the runner instance." +msgstr "" + +#: ../../library/asyncio-runner.rst:119 +msgid "" +":class:`Runner` uses the lazy initialization strategy, its constructor " +"doesn't initialize underlying low-level structures." +msgstr "" + +#: ../../library/asyncio-runner.rst:122 +msgid "" +"Embedded *loop* and *context* are created at the :keyword:`with` body " +"entering or the first call of :meth:`run` or :meth:`get_loop`." +msgstr "" + +#: ../../library/asyncio-runner.rst:127 +msgid "Handling Keyboard Interruption" +msgstr "" + +#: ../../library/asyncio-runner.rst:131 +msgid "" +"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" +"`KeyboardInterrupt` exception is raised in the main thread by default. " +"However this doesn't work with :mod:`asyncio` because it can interrupt " +"asyncio internals and can hang the program from exiting." +msgstr "" + +#: ../../library/asyncio-runner.rst:136 +msgid "" +"To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " +"follows:" +msgstr "" + +#: ../../library/asyncio-runner.rst:138 +msgid "" +":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " +"before any user code is executed and removes it when exiting from the " +"function." +msgstr "" + +#: ../../library/asyncio-runner.rst:140 +msgid "" +"The :class:`~asyncio.Runner` creates the main task for the passed coroutine " +"for its execution." +msgstr "" + +#: ../../library/asyncio-runner.rst:142 +msgid "" +"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " +"handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " +"raises :exc:`asyncio.CancelledError` inside the main task. This causes the " +"Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be " +"used for resource cleanup. After the main task is cancelled, :meth:`asyncio." +"Runner.run` raises :exc:`KeyboardInterrupt`." +msgstr "" + +#: ../../library/asyncio-runner.rst:148 +msgid "" +"A user could write a tight loop which cannot be interrupted by :meth:" +"`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " +"immediately raises the :exc:`KeyboardInterrupt` without cancelling the main " +"task." +msgstr "" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index acbdaae2e1..d516726706 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-06-11 15:06+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,37 +390,62 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:324 +#: ../../library/asyncio-stream.rst:325 +msgid "Upgrade an existing stream-based connection to TLS." +msgstr "" + +#: ../../library/asyncio-stream.rst:327 +msgid "Parameters:" +msgstr "" + +#: ../../library/asyncio-stream.rst:329 +msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." +msgstr "" + +#: ../../library/asyncio-stream.rst:331 +msgid "" +"*server_hostname*: sets or overrides the host name that the target server's " +"certificate will be matched against." +msgstr "" + +#: ../../library/asyncio-stream.rst:334 +msgid "" +"*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " +"to complete before aborting the connection. ``60.0`` seconds if ``None`` " +"(default)." +msgstr "" + +#: ../../library/asyncio-stream.rst:342 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:331 +#: ../../library/asyncio-stream.rst:349 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:333 +#: ../../library/asyncio-stream.rst:351 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed." msgstr "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉。" -#: ../../library/asyncio-stream.rst:340 +#: ../../library/asyncio-stream.rst:358 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:345 +#: ../../library/asyncio-stream.rst:363 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:347 +#: ../../library/asyncio-stream.rst:365 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "" "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端:\n" "\n" "::" -#: ../../library/asyncio-stream.rst:369 +#: ../../library/asyncio-stream.rst:388 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -429,18 +454,18 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:376 +#: ../../library/asyncio-stream.rst:395 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:378 +#: ../../library/asyncio-stream.rst:397 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "" "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式:\n" "\n" "::" -#: ../../library/asyncio-stream.rst:411 +#: ../../library/asyncio-stream.rst:430 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -449,11 +474,11 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:416 +#: ../../library/asyncio-stream.rst:435 msgid "Get HTTP headers" msgstr "獲取 HTTP 標頭" -#: ../../library/asyncio-stream.rst:418 +#: ../../library/asyncio-stream.rst:437 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "" @@ -461,25 +486,25 @@ msgstr "" "\n" "::" -#: ../../library/asyncio-stream.rst:456 +#: ../../library/asyncio-stream.rst:475 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/asyncio-stream.rst:460 +#: ../../library/asyncio-stream.rst:479 msgid "or with HTTPS::" msgstr "" "或使用 HTTPS:\n" "\n" "::" -#: ../../library/asyncio-stream.rst:468 +#: ../../library/asyncio-stream.rst:487 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:470 +#: ../../library/asyncio-stream.rst:489 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" @@ -488,7 +513,7 @@ msgstr "" "\n" "::" -#: ../../library/asyncio-stream.rst:504 +#: ../../library/asyncio-stream.rst:523 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -498,7 +523,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:508 +#: ../../library/asyncio-stream.rst:527 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index 8173034414..791ed4d23a 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-19 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,47 +76,51 @@ msgstr ":class:`Semaphore`" msgid ":class:`BoundedSemaphore`" msgstr ":class:`BoundedSemaphore`" -#: ../../library/asyncio-sync.rst:37 +#: ../../library/asyncio-sync.rst:31 +msgid ":class:`Barrier`" +msgstr ":class:`Barrier`" + +#: ../../library/asyncio-sync.rst:38 msgid "Lock" msgstr "Lock" -#: ../../library/asyncio-sync.rst:41 +#: ../../library/asyncio-sync.rst:42 msgid "Implements a mutex lock for asyncio tasks. Not thread-safe." msgstr "" "實作了一個給 asyncio 任務 (task) 用的互斥鎖 (mutex lock)。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:43 +#: ../../library/asyncio-sync.rst:44 msgid "" "An asyncio lock can be used to guarantee exclusive access to a shared " "resource." msgstr "一個 asyncio 的鎖可以用來確保一個共享資源的存取權被獨佔。" -#: ../../library/asyncio-sync.rst:46 +#: ../../library/asyncio-sync.rst:47 msgid "The preferred way to use a Lock is an :keyword:`async with` statement::" msgstr "" "使用 Lock 的推薦方式是透過 :keyword:`async with` 陳述式:\n" "\n" "::" -#: ../../library/asyncio-sync.rst:55 ../../library/asyncio-sync.rst:198 -#: ../../library/asyncio-sync.rst:297 +#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:199 +#: ../../library/asyncio-sync.rst:298 msgid "which is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/asyncio-sync.rst:66 ../../library/asyncio-sync.rst:111 -#: ../../library/asyncio-sync.rst:186 ../../library/asyncio-sync.rst:285 -#: ../../library/asyncio-sync.rst:340 +#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:112 +#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:286 +#: ../../library/asyncio-sync.rst:341 msgid "Removed the *loop* parameter." msgstr "移除 ``loop`` 參數。" -#: ../../library/asyncio-sync.rst:71 +#: ../../library/asyncio-sync.rst:72 msgid "Acquire the lock." msgstr "獲得鎖。" -#: ../../library/asyncio-sync.rst:73 +#: ../../library/asyncio-sync.rst:74 msgid "" "This method waits until the lock is *unlocked*, sets it to *locked* and " "returns ``True``." @@ -124,7 +128,7 @@ msgstr "" "此方法會持續等待直到鎖的狀態成為 *unlocked*\\ ,並將其設置為 *locked* 和回傳 " "``True``\\ 。" -#: ../../library/asyncio-sync.rst:76 +#: ../../library/asyncio-sync.rst:77 msgid "" "When more than one coroutine is blocked in :meth:`acquire` waiting for the " "lock to be unlocked, only one coroutine eventually proceeds." @@ -132,45 +136,45 @@ msgstr "" "當多於一個的協程 (coroutine) 在 :meth:`acquire` 中等待解鎖而被阻塞,最終只會" "有其中的一個被處理。" -#: ../../library/asyncio-sync.rst:80 +#: ../../library/asyncio-sync.rst:81 msgid "" "Acquiring a lock is *fair*: the coroutine that proceeds will be the first " "coroutine that started waiting on the lock." msgstr "" "鎖的獲取方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" -#: ../../library/asyncio-sync.rst:85 +#: ../../library/asyncio-sync.rst:86 msgid "Release the lock." msgstr "釋放鎖。" -#: ../../library/asyncio-sync.rst:87 +#: ../../library/asyncio-sync.rst:88 msgid "When the lock is *locked*, reset it to *unlocked* and return." msgstr "如果鎖的狀態為 *locked* 則將其重置為 *unlocked* 並回傳。" -#: ../../library/asyncio-sync.rst:89 +#: ../../library/asyncio-sync.rst:90 msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised." msgstr "如果鎖的狀態為 *unlocked* 則 :exc:`RuntimeError` 會被引發。" -#: ../../library/asyncio-sync.rst:93 +#: ../../library/asyncio-sync.rst:94 msgid "Return ``True`` if the lock is *locked*." msgstr "如果鎖的狀態為 *locked* 則回傳 ``True``\\ 。" -#: ../../library/asyncio-sync.rst:97 +#: ../../library/asyncio-sync.rst:98 msgid "Event" msgstr "Event" -#: ../../library/asyncio-sync.rst:101 +#: ../../library/asyncio-sync.rst:102 msgid "An event object. Not thread-safe." msgstr "一個事件 (event) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:103 +#: ../../library/asyncio-sync.rst:104 msgid "" "An asyncio event can be used to notify multiple asyncio tasks that some " "event has happened." msgstr "" "一個 asyncio 事件可以被用於通知多個有發生某些事件於其中的 asyncio 任務。" -#: ../../library/asyncio-sync.rst:106 +#: ../../library/asyncio-sync.rst:107 msgid "" "An Event object manages an internal flag that can be set to *true* with the :" "meth:`~Event.set` method and reset to *false* with the :meth:`clear` " @@ -182,18 +186,18 @@ msgstr "" "`~Event.wait` 方法會被阻塞 (block) 直到該旗標被設為 *true*\\ 。該旗標初始設置" "為 *false*\\ 。" -#: ../../library/asyncio-sync.rst:116 +#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:365 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/asyncio-sync.rst:141 +#: ../../library/asyncio-sync.rst:142 msgid "Wait until the event is set." msgstr "持續等待直到事件被設置。" -#: ../../library/asyncio-sync.rst:143 +#: ../../library/asyncio-sync.rst:144 msgid "" "If the event is set, return ``True`` immediately. Otherwise block until " "another task calls :meth:`~Event.set`." @@ -201,19 +205,19 @@ msgstr "" "如果事件有被設置則立刻回傳 ``True``\\ 。否則持續阻塞直到另一個任務呼叫 :meth:" "`~Event.set`\\ 。" -#: ../../library/asyncio-sync.rst:148 +#: ../../library/asyncio-sync.rst:149 msgid "Set the event." msgstr "設置事件。" -#: ../../library/asyncio-sync.rst:150 +#: ../../library/asyncio-sync.rst:151 msgid "All tasks waiting for event to be set will be immediately awakened." msgstr "所有正在等待事件被設置的任務會立即被喚醒。" -#: ../../library/asyncio-sync.rst:155 +#: ../../library/asyncio-sync.rst:156 msgid "Clear (unset) the event." msgstr "清除(還原)事件。" -#: ../../library/asyncio-sync.rst:157 +#: ../../library/asyncio-sync.rst:158 msgid "" "Tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event." "set` method is called again." @@ -221,19 +225,19 @@ msgstr "" "正透過 :meth:`~Event.wait` 等待的 Tasks 現在會持續阻塞直到 :meth:`~Event." "set` 方法再次被呼叫。" -#: ../../library/asyncio-sync.rst:162 +#: ../../library/asyncio-sync.rst:163 msgid "Return ``True`` if the event is set." msgstr "如果事件有被設置則回傳 ``True``\\ 。" -#: ../../library/asyncio-sync.rst:166 +#: ../../library/asyncio-sync.rst:167 msgid "Condition" msgstr "Condition" -#: ../../library/asyncio-sync.rst:170 +#: ../../library/asyncio-sync.rst:171 msgid "A Condition object. Not thread-safe." msgstr "一個條件 (codition) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:172 +#: ../../library/asyncio-sync.rst:173 msgid "" "An asyncio condition primitive can be used by a task to wait for some event " "to happen and then get exclusive access to a shared resource." @@ -241,7 +245,7 @@ msgstr "" "一個 asyncio 條件原始物件可以被任務用來等待某事件發生,並獲得一個共享資源的獨" "佔存取權。" -#: ../../library/asyncio-sync.rst:176 +#: ../../library/asyncio-sync.rst:177 msgid "" "In essence, a Condition object combines the functionality of an :class:" "`Event` and a :class:`Lock`. It is possible to have multiple Condition " @@ -253,7 +257,7 @@ msgstr "" "個 Condition 物件共享一個 Lock 是有可能發生的,這能夠協調關注同一共享資源的不" "同狀態以獲取其獨佔存取權的多個任務。" -#: ../../library/asyncio-sync.rst:182 +#: ../../library/asyncio-sync.rst:183 msgid "" "The optional *lock* argument must be a :class:`Lock` object or ``None``. In " "the latter case a new Lock object is created automatically." @@ -261,7 +265,7 @@ msgstr "" "可選的 *lock* 引數必須是一個 :class:`Lock` 物件或者為 ``None``\\ 。如為後者則" "一個新的 Lock 物件會被自動建立。" -#: ../../library/asyncio-sync.rst:189 +#: ../../library/asyncio-sync.rst:190 msgid "" "The preferred way to use a Condition is an :keyword:`async with` statement::" msgstr "" @@ -269,11 +273,11 @@ msgstr "" "\n" "::" -#: ../../library/asyncio-sync.rst:211 +#: ../../library/asyncio-sync.rst:212 msgid "Acquire the underlying lock." msgstr "獲取底層的鎖。" -#: ../../library/asyncio-sync.rst:213 +#: ../../library/asyncio-sync.rst:214 msgid "" "This method waits until the underlying lock is *unlocked*, sets it to " "*locked* and returns ``True``." @@ -281,7 +285,7 @@ msgstr "" "此方法會持續等待直到底層的鎖為 *unlocked*\\ ,並將其設為 *locked* 並回傳 " "``True``\\ 。" -#: ../../library/asyncio-sync.rst:218 +#: ../../library/asyncio-sync.rst:219 msgid "" "Wake up at most *n* tasks (1 by default) waiting on this condition. The " "method is no-op if no tasks are waiting." @@ -289,7 +293,7 @@ msgstr "" "喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果沒有正在等待的任務則此方" "法為空操作 (no-op)。" -#: ../../library/asyncio-sync.rst:221 ../../library/asyncio-sync.rst:236 +#: ../../library/asyncio-sync.rst:222 ../../library/asyncio-sync.rst:237 msgid "" "The lock must be acquired before this method is called and released shortly " "after. If called with an *unlocked* lock a :exc:`RuntimeError` error is " @@ -298,31 +302,31 @@ msgstr "" "在此方法被呼叫前必須先獲得鎖,並在之後立刻將其釋放。如果呼叫於一個 " "*unlocked* 的鎖則 :exc:`RuntimeError` 錯誤會被引發。" -#: ../../library/asyncio-sync.rst:227 +#: ../../library/asyncio-sync.rst:228 msgid "Return ``True`` if the underlying lock is acquired." msgstr "如果已獲取底層的鎖則回傳 ``True``\\ 。" -#: ../../library/asyncio-sync.rst:231 +#: ../../library/asyncio-sync.rst:232 msgid "Wake up all tasks waiting on this condition." msgstr "喚醒所有正在等待此條件的任務。" -#: ../../library/asyncio-sync.rst:233 +#: ../../library/asyncio-sync.rst:234 msgid "This method acts like :meth:`notify`, but wakes up all waiting tasks." msgstr "這個方法的行為就像 :meth:`notify`\\ ,但會喚醒所有正在等待的任務。" -#: ../../library/asyncio-sync.rst:242 +#: ../../library/asyncio-sync.rst:243 msgid "Release the underlying lock." msgstr "釋放底層的鎖。" -#: ../../library/asyncio-sync.rst:244 +#: ../../library/asyncio-sync.rst:245 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "當調用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`\\ 。" -#: ../../library/asyncio-sync.rst:249 +#: ../../library/asyncio-sync.rst:250 msgid "Wait until notified." msgstr "持續等待直到被通知 (notify)。" -#: ../../library/asyncio-sync.rst:251 +#: ../../library/asyncio-sync.rst:252 msgid "" "If the calling task has not acquired the lock when this method is called, a :" "exc:`RuntimeError` is raised." @@ -330,7 +334,7 @@ msgstr "" "當此方法被呼叫時,如果呼叫它的任務還沒有獲取鎖的話,\\ :exc:`RuntimeError` 會" "被引發。" -#: ../../library/asyncio-sync.rst:254 +#: ../../library/asyncio-sync.rst:255 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " @@ -340,11 +344,11 @@ msgstr "" "`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新獲取該鎖且此方法會回" "傳 ``True``\\ 。" -#: ../../library/asyncio-sync.rst:261 +#: ../../library/asyncio-sync.rst:262 msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*\\ 。" -#: ../../library/asyncio-sync.rst:263 +#: ../../library/asyncio-sync.rst:264 msgid "" "The predicate must be a callable which result will be interpreted as a " "boolean value. The final value is the return value." @@ -352,15 +356,15 @@ msgstr "" "謂語必須是一個結果可被直譯為一個 boolean 值的可呼叫物件 (callable)。最終值為" "回傳值。" -#: ../../library/asyncio-sync.rst:269 +#: ../../library/asyncio-sync.rst:270 msgid "Semaphore" msgstr "Semaphore" -#: ../../library/asyncio-sync.rst:273 +#: ../../library/asyncio-sync.rst:274 msgid "A Semaphore object. Not thread-safe." msgstr "一個旗號 (semaphore) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:275 +#: ../../library/asyncio-sync.rst:276 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -371,7 +375,7 @@ msgstr "" "呼叫 :meth:`release` 時增加一。此計數器永遠不會少於零;當 :meth:`acquire` 發" "現它是零時,它會持續阻塞並等待某任務呼叫 :meth:`release`\\ 。" -#: ../../library/asyncio-sync.rst:281 +#: ../../library/asyncio-sync.rst:282 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" @@ -380,7 +384,7 @@ msgstr "" "可選的 *value* 引數給定了內部計數器的初始值(預設為 ``1``\\ )。如給定的值少" "於 ``0`` 則 :exc:`ValueError` 會被引發。" -#: ../../library/asyncio-sync.rst:288 +#: ../../library/asyncio-sync.rst:289 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "" @@ -388,11 +392,11 @@ msgstr "" "\n" "::" -#: ../../library/asyncio-sync.rst:310 +#: ../../library/asyncio-sync.rst:311 msgid "Acquire a semaphore." msgstr "獲取一個旗號。" -#: ../../library/asyncio-sync.rst:312 +#: ../../library/asyncio-sync.rst:313 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " @@ -401,11 +405,11 @@ msgstr "" "如果內部計數器大於零,將其減一並立刻回傳 ``True``\\ 。如果為零,則持續等待直" "到 :meth:`release` 被呼叫,並回傳 ``True``\\ 。" -#: ../../library/asyncio-sync.rst:318 +#: ../../library/asyncio-sync.rst:319 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "如果旗號無法立即被取得則回傳 ``True``\\ 。" -#: ../../library/asyncio-sync.rst:322 +#: ../../library/asyncio-sync.rst:323 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." @@ -413,7 +417,7 @@ msgstr "" "釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待獲取旗號的任務" "叫醒。" -#: ../../library/asyncio-sync.rst:325 +#: ../../library/asyncio-sync.rst:326 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." @@ -421,15 +425,15 @@ msgstr "" "和 :class:`BoundedSemaphore` 不同,\\ :class:`Semaphore` 允許 ``release()`` " "的呼叫次數多於 ``acquire()``\\ 。" -#: ../../library/asyncio-sync.rst:330 +#: ../../library/asyncio-sync.rst:331 msgid "BoundedSemaphore" msgstr "BoundedSemaphore" -#: ../../library/asyncio-sync.rst:334 +#: ../../library/asyncio-sync.rst:335 msgid "A bounded semaphore object. Not thread-safe." msgstr "一個有界的旗號物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:336 +#: ../../library/asyncio-sync.rst:337 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " @@ -439,7 +443,102 @@ msgstr "" "加至大於初始 *value* 值的話,\\ :exc:`ValueError` 會在 :meth:`~Semaphore." "release` 時被引發。" -#: ../../library/asyncio-sync.rst:348 +#: ../../library/asyncio-sync.rst:346 +msgid "Barrier" +msgstr "Barrier" + +#: ../../library/asyncio-sync.rst:350 +msgid "A barrier object. Not thread-safe." +msgstr "一個屏障 (barrier) 物件。不支援執行緒安全。" + +#: ../../library/asyncio-sync.rst:352 +msgid "" +"A barrier is a simple synchronization primitive that allows to block until " +"*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" +"`~Barrier.wait` method and would be blocked until the specified number of " +"tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the " +"waiting tasks would unblock simultaneously." +msgstr "" + +#: ../../library/asyncio-sync.rst:358 +msgid "" +":keyword:`async with` can be used as an alternative to awaiting on :meth:" +"`~Barrier.wait`." +msgstr "" + +#: ../../library/asyncio-sync.rst:361 +msgid "The barrier can be reused any number of times." +msgstr "" + +#: ../../library/asyncio-sync.rst:388 +msgid "Result of this example is::" +msgstr "" + +#: ../../library/asyncio-sync.rst:399 +msgid "" +"Pass the barrier. When all the tasks party to the barrier have called this " +"function, they are all unblocked simultaneously." +msgstr "" + +#: ../../library/asyncio-sync.rst:402 +msgid "" +"When a waiting or blocked task in the barrier is cancelled, this task exits " +"the barrier which stays in the same state. If the state of the barrier is " +"\"filling\", the number of waiting task decreases by 1." +msgstr "" + +#: ../../library/asyncio-sync.rst:407 +msgid "" +"The return value is an integer in the range of 0 to ``parties-1``, different " +"for each task. This can be used to select a task to do some special " +"housekeeping, e.g.::" +msgstr "" + +#: ../../library/asyncio-sync.rst:417 +msgid "" +"This method may raise a :class:`BrokenBarrierError` exception if the barrier " +"is broken or reset while a task is waiting. It could raise a :exc:" +"`CancelledError` if a task is cancelled." +msgstr "" + +#: ../../library/asyncio-sync.rst:423 +msgid "" +"Return the barrier to the default, empty state. Any tasks waiting on it " +"will receive the :class:`BrokenBarrierError` exception." +msgstr "" + +#: ../../library/asyncio-sync.rst:426 +msgid "" +"If a barrier is broken it may be better to just leave it and create a new " +"one." +msgstr "" + +#: ../../library/asyncio-sync.rst:430 +msgid "" +"Put the barrier into a broken state. This causes any active or future calls " +"to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " +"example if one of the tasks needs to abort, to avoid infinite waiting tasks." +msgstr "" + +#: ../../library/asyncio-sync.rst:437 +msgid "The number of tasks required to pass the barrier." +msgstr "" + +#: ../../library/asyncio-sync.rst:441 +msgid "The number of tasks currently waiting in the barrier while filling." +msgstr "" + +#: ../../library/asyncio-sync.rst:445 +msgid "A boolean that is ``True`` if the barrier is in the broken state." +msgstr "" + +#: ../../library/asyncio-sync.rst:450 +msgid "" +"This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" +"`Barrier` object is reset or broken." +msgstr "" + +#: ../../library/asyncio-sync.rst:458 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 6b4f804080..4669564acf 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-11 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -28,7 +28,7 @@ msgid "" "Tasks." msgstr "" -#: ../../library/asyncio-task.rst:19 ../../library/asyncio-task.rst:121 +#: ../../library/asyncio-task.rst:19 ../../library/asyncio-task.rst:144 msgid "Coroutines" msgstr "協程" @@ -45,7 +45,7 @@ msgid "" msgstr "" #: ../../library/asyncio-task.rst:43 -msgid "To actually run a coroutine, asyncio provides three main mechanisms:" +msgid "To actually run a coroutine, asyncio provides the following mechanisms:" msgstr "" #: ../../library/asyncio-task.rst:45 @@ -83,258 +83,336 @@ msgid "" "than before::" msgstr "" -#: ../../library/asyncio-task.rst:110 +#: ../../library/asyncio-task.rst:106 +msgid "" +"The :class:`asyncio.TaskGroup` class provides a more modern alternative to :" +"func:`create_task`. Using this API, the last example becomes::" +msgstr "" + +#: ../../library/asyncio-task.rst:124 +msgid "The timing and output should be the same as for the previous version." +msgstr "" + +#: ../../library/asyncio-task.rst:126 +msgid ":class:`asyncio.TaskGroup`." +msgstr "" + +#: ../../library/asyncio-task.rst:133 msgid "Awaitables" msgstr "" -#: ../../library/asyncio-task.rst:112 +#: ../../library/asyncio-task.rst:135 msgid "" "We say that an object is an **awaitable** object if it can be used in an :" "keyword:`await` expression. Many asyncio APIs are designed to accept " "awaitables." msgstr "" -#: ../../library/asyncio-task.rst:116 +#: ../../library/asyncio-task.rst:139 msgid "" "There are three main types of *awaitable* objects: **coroutines**, " "**Tasks**, and **Futures**." msgstr "" -#: ../../library/asyncio-task.rst:122 +#: ../../library/asyncio-task.rst:145 msgid "" "Python coroutines are *awaitables* and therefore can be awaited from other " "coroutines::" msgstr "" -#: ../../library/asyncio-task.rst:143 +#: ../../library/asyncio-task.rst:166 msgid "" "In this documentation the term \"coroutine\" can be used for two closely " "related concepts:" msgstr "" -#: ../../library/asyncio-task.rst:146 +#: ../../library/asyncio-task.rst:169 msgid "a *coroutine function*: an :keyword:`async def` function;" msgstr "" -#: ../../library/asyncio-task.rst:148 +#: ../../library/asyncio-task.rst:171 msgid "" "a *coroutine object*: an object returned by calling a *coroutine function*." msgstr "" -#: ../../library/asyncio-task.rst:151 -msgid "" -"asyncio also supports legacy :ref:`generator-based " -"` coroutines." -msgstr "" - -#: ../../library/asyncio-task.rst:156 +#: ../../library/asyncio-task.rst:176 msgid "Tasks" msgstr "" -#: ../../library/asyncio-task.rst:157 +#: ../../library/asyncio-task.rst:177 msgid "*Tasks* are used to schedule coroutines *concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:159 +#: ../../library/asyncio-task.rst:179 msgid "" "When a coroutine is wrapped into a *Task* with functions like :func:`asyncio." "create_task` the coroutine is automatically scheduled to run soon::" msgstr "" -#: ../../library/asyncio-task.rst:181 +#: ../../library/asyncio-task.rst:201 msgid "Futures" msgstr "" -#: ../../library/asyncio-task.rst:182 +#: ../../library/asyncio-task.rst:202 msgid "" "A :class:`Future` is a special **low-level** awaitable object that " "represents an **eventual result** of an asynchronous operation." msgstr "" -#: ../../library/asyncio-task.rst:185 +#: ../../library/asyncio-task.rst:205 msgid "" "When a Future object is *awaited* it means that the coroutine will wait " "until the Future is resolved in some other place." msgstr "" -#: ../../library/asyncio-task.rst:188 +#: ../../library/asyncio-task.rst:208 msgid "" "Future objects in asyncio are needed to allow callback-based code to be used " "with async/await." msgstr "" -#: ../../library/asyncio-task.rst:191 +#: ../../library/asyncio-task.rst:211 msgid "" "Normally **there is no need** to create Future objects at the application " "level code." msgstr "" -#: ../../library/asyncio-task.rst:194 +#: ../../library/asyncio-task.rst:214 msgid "" "Future objects, sometimes exposed by libraries and some asyncio APIs, can be " "awaited::" msgstr "" -#: ../../library/asyncio-task.rst:206 +#: ../../library/asyncio-task.rst:226 msgid "" "A good example of a low-level function that returns a Future object is :meth:" "`loop.run_in_executor`." msgstr "" -#: ../../library/asyncio-task.rst:211 -msgid "Running an asyncio Program" +#: ../../library/asyncio-task.rst:231 +msgid "Creating Tasks" msgstr "" -#: ../../library/asyncio-task.rst:215 -msgid "Execute the :term:`coroutine` *coro* and return the result." +#: ../../library/asyncio-task.rst:235 +msgid "" +"Wrap the *coro* :ref:`coroutine ` into a :class:`Task` and " +"schedule its execution. Return the Task object." msgstr "" -#: ../../library/asyncio-task.rst:217 +#: ../../library/asyncio-task.rst:238 msgid "" -"This function runs the passed coroutine, taking care of managing the asyncio " -"event loop, *finalizing asynchronous generators*, and closing the threadpool." +"If *name* is not ``None``, it is set as the name of the task using :meth:" +"`Task.set_name`." msgstr "" -#: ../../library/asyncio-task.rst:221 +#: ../../library/asyncio-task.rst:241 msgid "" -"This function cannot be called when another asyncio event loop is running in " -"the same thread." +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *coro* to run in. The current context " +"copy is created when no *context* is provided." msgstr "" -#: ../../library/asyncio-task.rst:224 -msgid "If *debug* is ``True``, the event loop will be run in debug mode." +#: ../../library/asyncio-task.rst:245 +msgid "" +"The task is executed in the loop returned by :func:`get_running_loop`, :exc:" +"`RuntimeError` is raised if there is no running loop in current thread." msgstr "" -#: ../../library/asyncio-task.rst:226 +#: ../../library/asyncio-task.rst:251 msgid "" -"This function always creates a new event loop and closes it at the end. It " -"should be used as a main entry point for asyncio programs, and should " -"ideally only be called once." +":meth:`asyncio.TaskGroup.create_task` is a newer alternative that allows for " +"convenient waiting for a group of related tasks." msgstr "" -#: ../../library/asyncio-task.rst:230 ../../library/asyncio-task.rst:374 -#: ../../library/asyncio-task.rst:516 ../../library/asyncio-task.rst:652 -msgid "Example::" +#: ../../library/asyncio-task.rst:256 +msgid "" +"Save a reference to the result of this function, to avoid a task " +"disappearing mid-execution. The event loop only keeps weak references to " +"tasks. A task that isn't referenced elsewhere may get garbage collected at " +"any time, even before it's done. For reliable \"fire-and-forget\" background " +"tasks, gather them in a collection::" msgstr "" -"範例:\n" -"\n" -"::" -#: ../../library/asyncio-task.rst:240 -msgid "Updated to use :meth:`loop.shutdown_default_executor`." +#: ../../library/asyncio-task.rst:278 ../../library/asyncio-task.rst:1001 +msgid "Added the *name* parameter." +msgstr "新增 *name* 參數。" + +#: ../../library/asyncio-task.rst:281 +msgid "Added the *context* parameter." +msgstr "新增 *context* 參數。" + +#: ../../library/asyncio-task.rst:286 +msgid "Task Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:244 +#: ../../library/asyncio-task.rst:288 msgid "" -"The source code for ``asyncio.run()`` can be found in :source:`Lib/asyncio/" -"runners.py`." +"Tasks can easily and safely be cancelled. When a task is cancelled, :exc:" +"`asyncio.CancelledError` will be raised in the task at the next opportunity." msgstr "" -#: ../../library/asyncio-task.rst:248 -msgid "Creating Tasks" +#: ../../library/asyncio-task.rst:292 +msgid "" +"It is recommended that coroutines use ``try/finally`` blocks to robustly " +"perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " +"caught, it should generally be propagated when clean-up is complete. Most " +"code can safely ignore :exc:`asyncio.CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:252 +#: ../../library/asyncio-task.rst:297 msgid "" -"Wrap the *coro* :ref:`coroutine ` into a :class:`Task` and " -"schedule its execution. Return the Task object." +"The asyncio components that enable structured concurrency, like :class:" +"`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " +"cancellation internally and might misbehave if a coroutine swallows :exc:" +"`asyncio.CancelledError`. Similarly, user code should not call :meth:" +"`uncancel `." msgstr "" -#: ../../library/asyncio-task.rst:255 +#: ../../library/asyncio-task.rst:306 +msgid "Task Groups" +msgstr "" + +#: ../../library/asyncio-task.rst:308 msgid "" -"If *name* is not ``None``, it is set as the name of the task using :meth:" -"`Task.set_name`." +"Task groups combine a task creation API with a convenient and reliable way " +"to wait for all tasks in the group to finish." msgstr "" -#: ../../library/asyncio-task.rst:258 +#: ../../library/asyncio-task.rst:313 msgid "" -"The task is executed in the loop returned by :func:`get_running_loop`, :exc:" -"`RuntimeError` is raised if there is no running loop in current thread." +"An :ref:`asynchronous context manager ` holding a " +"group of tasks. Tasks can be added to the group using :meth:`create_task`. " +"All tasks are awaited when the context manager exits." msgstr "" -#: ../../library/asyncio-task.rst:264 +#: ../../library/asyncio-task.rst:322 msgid "" -"Save a reference to the result of this function, to avoid a task " -"disappearing mid-execution. The event loop only keeps weak references to " -"tasks. A task that isn't referenced elsewhere may get garbage collected at " -"any time, even before it's done. For reliable \"fire-and-forget\" background " -"tasks, gather them in a collection::" +"Create a task in this task group. The signature matches that of :func:" +"`asyncio.create_task`." msgstr "" -#: ../../library/asyncio-task.rst:286 ../../library/asyncio-task.rst:841 -msgid "Added the *name* parameter." -msgstr "新增 *name* 參數。" +#: ../../library/asyncio-task.rst:325 ../../library/asyncio-task.rst:455 +#: ../../library/asyncio-task.rst:583 ../../library/asyncio-task.rst:647 +#: ../../library/asyncio-task.rst:673 ../../library/asyncio-task.rst:716 +#: ../../library/asyncio-task.rst:812 +msgid "Example::" +msgstr "" +"範例:\n" +"\n" +"::" + +#: ../../library/asyncio-task.rst:333 +msgid "" +"The ``async with`` statement will wait for all tasks in the group to finish. " +"While waiting, new tasks may still be added to the group (for example, by " +"passing ``tg`` into one of the coroutines and calling ``tg.create_task()`` " +"in that coroutine). Once the last task has finished and the ``async with`` " +"block is exited, no new tasks may be added to the group." +msgstr "" + +#: ../../library/asyncio-task.rst:340 +msgid "" +"The first time any of the tasks belonging to the group fails with an " +"exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " +"the group are cancelled. No further tasks can then be added to the group. At " +"this point, if the body of the ``async with`` statement is still active (i." +"e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " +"containing the ``async with`` statement is also cancelled. The resulting :" +"exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not " +"bubble out of the containing ``async with`` statement." +msgstr "" + +#: ../../library/asyncio-task.rst:350 +msgid "" +"Once all tasks have finished, if any tasks have failed with an exception " +"other than :exc:`asyncio.CancelledError`, those exceptions are combined in " +"an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see " +"their documentation) which is then raised." +msgstr "" + +#: ../../library/asyncio-task.rst:357 +msgid "" +"Two base exceptions are treated specially: If any task fails with :exc:" +"`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " +"remaining tasks and waits for them, but then the initial :exc:" +"`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:" +"`ExceptionGroup` or :exc:`BaseExceptionGroup`." +msgstr "" + +#: ../../library/asyncio-task.rst:363 +msgid "" +"If the body of the ``async with`` statement exits with an exception (so :" +"meth:`~object.__aexit__` is called with an exception set), this is treated " +"the same as if one of the tasks failed: the remaining tasks are cancelled " +"and then waited for, and non-cancellation exceptions are grouped into an " +"exception group and raised. The exception passed into :meth:`~object." +"__aexit__`, unless it is :exc:`asyncio.CancelledError`, is also included in " +"the exception group. The same special case is made for :exc:" +"`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." +msgstr "" -#: ../../library/asyncio-task.rst:291 +#: ../../library/asyncio-task.rst:377 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:295 +#: ../../library/asyncio-task.rst:381 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:297 +#: ../../library/asyncio-task.rst:383 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:300 +#: ../../library/asyncio-task.rst:386 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:303 +#: ../../library/asyncio-task.rst:389 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:312 -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:315 +#: ../../library/asyncio-task.rst:395 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:333 ../../library/asyncio-task.rst:369 -#: ../../library/asyncio-task.rst:423 ../../library/asyncio-task.rst:477 -#: ../../library/asyncio-task.rst:511 ../../library/asyncio-task.rst:541 -#: ../../library/asyncio-task.rst:600 ../../library/asyncio-task.rst:635 -#: ../../library/asyncio-task.rst:649 ../../library/asyncio-task.rst:658 +#: ../../library/asyncio-task.rst:413 ../../library/asyncio-task.rst:504 +#: ../../library/asyncio-task.rst:558 ../../library/asyncio-task.rst:711 +#: ../../library/asyncio-task.rst:741 ../../library/asyncio-task.rst:793 +#: ../../library/asyncio-task.rst:809 ../../library/asyncio-task.rst:818 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:338 +#: ../../library/asyncio-task.rst:418 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:342 +#: ../../library/asyncio-task.rst:422 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:345 +#: ../../library/asyncio-task.rst:425 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:348 +#: ../../library/asyncio-task.rst:428 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:352 +#: ../../library/asyncio-task.rst:432 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -342,19 +420,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:357 +#: ../../library/asyncio-task.rst:437 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:360 +#: ../../library/asyncio-task.rst:440 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:363 +#: ../../library/asyncio-task.rst:443 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** " @@ -362,7 +440,13 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:412 +#: ../../library/asyncio-task.rst:450 +msgid "" +"A more modern way to create and run tasks concurrently and wait for their " +"completion is :class:`asyncio.TaskGroup`." +msgstr "" + +#: ../../library/asyncio-task.rst:493 msgid "" "If *return_exceptions* is False, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -371,42 +455,42 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:419 +#: ../../library/asyncio-task.rst:500 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:426 +#: ../../library/asyncio-task.rst:507 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:433 +#: ../../library/asyncio-task.rst:514 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:437 +#: ../../library/asyncio-task.rst:518 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:440 ../../library/asyncio-task.rst:493 +#: ../../library/asyncio-task.rst:521 ../../library/asyncio-task.rst:693 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:442 +#: ../../library/asyncio-task.rst:523 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:447 +#: ../../library/asyncio-task.rst:528 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:451 +#: ../../library/asyncio-task.rst:532 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -415,20 +499,20 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:457 +#: ../../library/asyncio-task.rst:538 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:460 +#: ../../library/asyncio-task.rst:541 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:472 +#: ../../library/asyncio-task.rst:553 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -436,165 +520,243 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:480 +#: ../../library/asyncio-task.rst:561 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:486 +#: ../../library/asyncio-task.rst:567 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:490 +#: ../../library/asyncio-task.rst:571 +msgid "" +"An :ref:`asynchronous context manager ` that can be " +"used to limit the amount of time spent waiting on something." +msgstr "" + +#: ../../library/asyncio-task.rst:575 +msgid "" +"*delay* can either be ``None``, or a float/int number of seconds to wait. If " +"*delay* is ``None``, no time limit will be applied; this can be useful if " +"the delay is unknown when the context manager is created." +msgstr "" + +#: ../../library/asyncio-task.rst:580 +msgid "" +"In either case, the context manager can be rescheduled after creation using :" +"meth:`Timeout.reschedule`." +msgstr "" + +#: ../../library/asyncio-task.rst:589 +msgid "" +"If ``long_running_task`` takes more than 10 seconds to complete, the context " +"manager will cancel the current task and handle the resulting :exc:`asyncio." +"CancelledError` internally, transforming it into an :exc:`asyncio." +"TimeoutError` which can be caught and handled." +msgstr "" + +#: ../../library/asyncio-task.rst:596 +msgid "" +"The :func:`asyncio.timeout` context manager is what transforms the :exc:" +"`asyncio.CancelledError` into an :exc:`asyncio.TimeoutError`, which means " +"the :exc:`asyncio.TimeoutError` can only be caught *outside* of the context " +"manager." +msgstr "" + +#: ../../library/asyncio-task.rst:601 +msgid "Example of catching :exc:`asyncio.TimeoutError`::" +msgstr "" + +#: ../../library/asyncio-task.rst:612 +msgid "" +"The context manager produced by :func:`asyncio.timeout` can be rescheduled " +"to a different deadline and inspected." +msgstr "" + +#: ../../library/asyncio-task.rst:617 +msgid "" +"An :ref:`asynchronous context manager ` that limits " +"time spent inside of it." +msgstr "" + +#: ../../library/asyncio-task.rst:624 +msgid "" +"Return the current deadline, or ``None`` if the current deadline is not set." +msgstr "" + +#: ../../library/asyncio-task.rst:627 +msgid "" +"The deadline is a float, consistent with the time returned by :meth:`loop." +"time`." +msgstr "" + +#: ../../library/asyncio-task.rst:632 +msgid "Change the time the timeout will trigger." +msgstr "" + +#: ../../library/asyncio-task.rst:634 +msgid "" +"If *when* is `None`, any current deadline will be removed, and the context " +"manager will wait indefinitely." +msgstr "" + +#: ../../library/asyncio-task.rst:637 +msgid "If *when* is a float, it is set as the new deadline." +msgstr "" + +#: ../../library/asyncio-task.rst:639 +msgid "" +"if *when* is in the past, the timeout will trigger on the next iteration of " +"the event loop." +msgstr "" + +#: ../../library/asyncio-task.rst:644 +msgid "Return whether the context manager has exceeded its deadline (expired)." +msgstr "" + +#: ../../library/asyncio-task.rst:664 +msgid "Timeout context managers can be safely nested." +msgstr "" + +#: ../../library/asyncio-task.rst:670 +msgid "" +"Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " +"stop waiting, or ``None``." +msgstr "" + +#: ../../library/asyncio-task.rst:690 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:495 +#: ../../library/asyncio-task.rst:695 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:499 +#: ../../library/asyncio-task.rst:699 msgid "" -"If a timeout occurs, it cancels the task and raises :exc:`asyncio." -"TimeoutError`." +"If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:502 +#: ../../library/asyncio-task.rst:702 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:505 +#: ../../library/asyncio-task.rst:705 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:509 +#: ../../library/asyncio-task.rst:709 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:536 +#: ../../library/asyncio-task.rst:736 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " -"cancelled. Previously, it raised :exc:`asyncio.TimeoutError` immediately." +"cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:546 +#: ../../library/asyncio-task.rst:746 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:550 +#: ../../library/asyncio-task.rst:750 msgid "" -"Run :ref:`awaitable objects ` in the *aws* iterable " -"concurrently and block until the condition specified by *return_when*." +"Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " +"*aws* iterable concurrently and block until the condition specified by " +"*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:554 +#: ../../library/asyncio-task.rst:754 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:556 +#: ../../library/asyncio-task.rst:756 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:558 +#: ../../library/asyncio-task.rst:758 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/asyncio-task.rst:562 +#: ../../library/asyncio-task.rst:762 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:565 +#: ../../library/asyncio-task.rst:765 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." +"Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " +"that aren't done when the timeout occurs are simply returned in the second " +"set." msgstr "" -#: ../../library/asyncio-task.rst:569 +#: ../../library/asyncio-task.rst:769 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:575 +#: ../../library/asyncio-task.rst:775 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:575 +#: ../../library/asyncio-task.rst:775 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:577 +#: ../../library/asyncio-task.rst:777 msgid ":const:`FIRST_COMPLETED`" msgstr ":const:`FIRST_COMPLETED`" -#: ../../library/asyncio-task.rst:577 +#: ../../library/asyncio-task.rst:777 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:580 +#: ../../library/asyncio-task.rst:780 msgid ":const:`FIRST_EXCEPTION`" msgstr ":const:`FIRST_EXCEPTION`" -#: ../../library/asyncio-task.rst:580 +#: ../../library/asyncio-task.rst:780 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:586 +#: ../../library/asyncio-task.rst:786 msgid ":const:`ALL_COMPLETED`" msgstr ":const:`ALL_COMPLETED`" -#: ../../library/asyncio-task.rst:586 +#: ../../library/asyncio-task.rst:786 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:590 +#: ../../library/asyncio-task.rst:790 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:595 -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:606 -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:619 -msgid "Here is how the above snippet can be fixed::" -msgstr "" - -#: ../../library/asyncio-task.rst:632 -msgid "Passing coroutine objects to ``wait()`` directly is deprecated." +#: ../../library/asyncio-task.rst:796 +msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:641 +#: ../../library/asyncio-task.rst:801 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. Return an iterator of coroutines. Each coroutine returned can " @@ -602,27 +764,26 @@ msgid "" "remaining awaitables." msgstr "" -#: ../../library/asyncio-task.rst:646 +#: ../../library/asyncio-task.rst:806 msgid "" -"Raises :exc:`asyncio.TimeoutError` if the timeout occurs before all Futures " -"are done." +"Raises :exc:`TimeoutError` if the timeout occurs before all Futures are done." msgstr "" -#: ../../library/asyncio-task.rst:661 +#: ../../library/asyncio-task.rst:821 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:667 +#: ../../library/asyncio-task.rst:827 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:671 +#: ../../library/asyncio-task.rst:831 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:673 +#: ../../library/asyncio-task.rst:833 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -630,19 +791,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:678 +#: ../../library/asyncio-task.rst:838 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:680 +#: ../../library/asyncio-task.rst:840 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::" +"were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:710 +#: ../../library/asyncio-task.rst:870 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, " @@ -650,7 +811,7 @@ msgid "" "blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:717 +#: ../../library/asyncio-task.rst:877 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 " @@ -658,81 +819,81 @@ msgid "" "`asyncio.to_thread()` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:726 +#: ../../library/asyncio-task.rst:886 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:730 +#: ../../library/asyncio-task.rst:890 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:732 +#: ../../library/asyncio-task.rst:892 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:735 +#: ../../library/asyncio-task.rst:895 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:747 +#: ../../library/asyncio-task.rst:907 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:761 +#: ../../library/asyncio-task.rst:921 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:764 +#: ../../library/asyncio-task.rst:924 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:771 +#: ../../library/asyncio-task.rst:931 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:776 +#: ../../library/asyncio-task.rst:936 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:779 +#: ../../library/asyncio-task.rst:939 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:787 +#: ../../library/asyncio-task.rst:947 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:790 +#: ../../library/asyncio-task.rst:950 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:797 +#: ../../library/asyncio-task.rst:957 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:801 +#: ../../library/asyncio-task.rst:961 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:804 +#: ../../library/asyncio-task.rst:964 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 " @@ -740,21 +901,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:810 +#: ../../library/asyncio-task.rst:970 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:815 +#: ../../library/asyncio-task.rst:975 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:820 +#: ../../library/asyncio-task.rst:980 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 " @@ -762,153 +923,112 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:825 +#: ../../library/asyncio-task.rst:985 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:830 +#: ../../library/asyncio-task.rst:990 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:834 +#: ../../library/asyncio-task.rst:994 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:838 +#: ../../library/asyncio-task.rst:998 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:844 +#: ../../library/asyncio-task.rst:1004 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:850 -msgid "Request the Task to be cancelled." -msgstr "" - -#: ../../library/asyncio-task.rst:852 -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:855 -msgid "" -"The coroutine then has a chance to clean up or even deny the request by " -"suppressing the exception with a :keyword:`try` ... ... ``except " -"CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:" -"`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will " -"be cancelled, although suppressing cancellation completely is not common and " -"is actively discouraged." -msgstr "" - -#: ../../library/asyncio-task.rst:863 -msgid "Added the *msg* parameter." -msgstr "新增 *msg* 參數。" - -#: ../../library/asyncio-task.rst:868 -msgid "" -"The following example illustrates how coroutines can intercept the " -"cancellation request::" -msgstr "" - -#: ../../library/asyncio-task.rst:907 -msgid "Return ``True`` if the Task is *cancelled*." -msgstr "" - -#: ../../library/asyncio-task.rst:909 -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:915 +#: ../../library/asyncio-task.rst:1010 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:917 +#: ../../library/asyncio-task.rst:1012 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:922 +#: ../../library/asyncio-task.rst:1017 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:924 +#: ../../library/asyncio-task.rst:1019 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:928 ../../library/asyncio-task.rst:942 +#: ../../library/asyncio-task.rst:1023 ../../library/asyncio-task.rst:1037 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:931 +#: ../../library/asyncio-task.rst:1026 msgid "" "If the Task's result isn't yet available, this method raises a :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:936 +#: ../../library/asyncio-task.rst:1031 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:938 +#: ../../library/asyncio-task.rst:1033 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:945 +#: ../../library/asyncio-task.rst:1040 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:950 +#: ../../library/asyncio-task.rst:1045 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:952 ../../library/asyncio-task.rst:961 +#: ../../library/asyncio-task.rst:1047 ../../library/asyncio-task.rst:1056 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:954 +#: ../../library/asyncio-task.rst:1049 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:959 +#: ../../library/asyncio-task.rst:1054 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:963 +#: ../../library/asyncio-task.rst:1058 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:968 +#: ../../library/asyncio-task.rst:1063 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:970 +#: ../../library/asyncio-task.rst:1065 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, " @@ -916,15 +1036,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:976 +#: ../../library/asyncio-task.rst:1071 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:978 +#: ../../library/asyncio-task.rst:1073 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:980 +#: ../../library/asyncio-task.rst:1075 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 " @@ -933,113 +1053,149 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:989 +#: ../../library/asyncio-task.rst:1084 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:991 +#: ../../library/asyncio-task.rst:1086 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:994 +#: ../../library/asyncio-task.rst:1089 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:996 +#: ../../library/asyncio-task.rst:1091 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:1001 +#: ../../library/asyncio-task.rst:1096 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1007 +#: ../../library/asyncio-task.rst:1102 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1009 +#: ../../library/asyncio-task.rst:1104 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:1017 +#: ../../library/asyncio-task.rst:1112 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1019 +#: ../../library/asyncio-task.rst:1114 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1022 +#: ../../library/asyncio-task.rst:1117 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:1031 -msgid "Generator-based Coroutines" +#: ../../library/asyncio-task.rst:1124 +msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1035 +#: ../../library/asyncio-task.rst:1126 msgid "" -"Support for generator-based coroutines is **deprecated** and is removed in " -"Python 3.11." +"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:1038 +#: ../../library/asyncio-task.rst:1129 msgid "" -"Generator-based coroutines predate async/await syntax. They are Python " -"generators that use ``yield from`` expressions to await on Futures and other " -"coroutines." +"The coroutine then has a chance to clean up or even deny the request by " +"suppressing the exception with a :keyword:`try` ... ... ``except " +"CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:" +"`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will " +"be cancelled, although suppressing cancellation completely is not common and " +"is actively discouraged." +msgstr "" + +#: ../../library/asyncio-task.rst:1137 +msgid "Added the *msg* parameter." +msgstr "新增 *msg* 參數。" + +#: ../../library/asyncio-task.rst:1140 +msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1042 +#: ../../library/asyncio-task.rst:1145 msgid "" -"Generator-based coroutines should be decorated with :func:`@asyncio." -"coroutine `, although this is not enforced." +"The following example illustrates how coroutines can intercept the " +"cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1049 -msgid "Decorator to mark generator-based coroutines." +#: ../../library/asyncio-task.rst:1184 +msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1051 +#: ../../library/asyncio-task.rst:1186 msgid "" -"This decorator enables legacy generator-based coroutines to be compatible " -"with async/await code::" +"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:1061 -msgid "This decorator should not be used for :keyword:`async def` coroutines." +#: ../../library/asyncio-task.rst:1192 +msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1066 -msgid "Use :keyword:`async def` instead." +#: ../../library/asyncio-task.rst:1194 +msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1070 -msgid "Return ``True`` if *obj* is a :ref:`coroutine object `." +#: ../../library/asyncio-task.rst:1196 +msgid "" +"Note that once execution of a cancelled task completed, further calls to :" +"meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1072 +#: ../../library/asyncio-task.rst:1201 msgid "" -"This method is different from :func:`inspect.iscoroutine` because it returns " -"``True`` for generator-based coroutines." +"This method is used by asyncio's internals and isn't expected to be used by " +"end-user code. In particular, if a Task gets successfully uncancelled, this " +"allows for elements of structured concurrency like :ref:`taskgroups` and :" +"func:`asyncio.timeout` to continue running, isolating cancellation to the " +"respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1077 -msgid "Return ``True`` if *func* is a :ref:`coroutine function `." +#: ../../library/asyncio-task.rst:1219 +msgid "" +"While the block with ``make_request()`` and ``make_another_request()`` might " +"get cancelled due to the timeout, ``unrelated_code()`` should continue " +"running even in case of the timeout. This is implemented with :meth:" +"`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a " +"similar fashion." +msgstr "" + +#: ../../library/asyncio-task.rst:1227 +msgid "" +"Return the number of pending cancellation requests to this Task, i.e., the " +"number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." +msgstr "" + +#: ../../library/asyncio-task.rst:1231 +msgid "" +"Note that if this number is greater than zero but the Task is still " +"executing, :meth:`cancelled` will still return ``False``. This is because " +"this number can be lowered by calling :meth:`uncancel`, which can lead to " +"the task not being cancelled after all if the cancellation requests go down " +"to zero." msgstr "" -#: ../../library/asyncio-task.rst:1080 +#: ../../library/asyncio-task.rst:1237 msgid "" -"This method is different from :func:`inspect.iscoroutinefunction` because it " -"returns ``True`` for generator-based coroutine functions decorated with :" -"func:`@coroutine `." +"This method is used by asyncio's internals and isn't expected to be used by " +"end-user code. See :meth:`uncancel` for more details." msgstr "" diff --git a/library/asyncio.po b/library/asyncio.po index 815ce9a6aa..ea5250c713 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-03 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2021-11-23 12:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,15 +20,15 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.0\n" -#: ../../library/asyncio.rst:65 +#: ../../library/asyncio.rst:66 msgid "High-level APIs" msgstr "高階 API" -#: ../../library/asyncio.rst:76 +#: ../../library/asyncio.rst:78 msgid "Low-level APIs" msgstr "低階 API" -#: ../../library/asyncio.rst:86 +#: ../../library/asyncio.rst:89 msgid "Guides and Tutorials" msgstr "指南與教學" @@ -126,10 +126,21 @@ msgstr "" "透過 async/await 語法來\\ :ref:`橋接 `\\ 基於回呼 (callback-" "based) 的函式庫與程式碼。" -#: ../../library/asyncio.rst:64 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/asyncio.rst:65 msgid "Reference" msgstr "參閱" -#: ../../library/asyncio.rst:95 +#: ../../library/asyncio.rst:98 msgid "The source code for asyncio can be found in :source:`Lib/asyncio/`." msgstr "asyncio 的原始碼可以在 :source:`Lib/asyncio/` 中找到。" diff --git a/library/asyncore.po b/library/asyncore.po index cebcaffcb0..dcbd34afcc 100644 --- a/library/asyncore.po +++ b/library/asyncore.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" -"PO-Revision-Date: 2022-05-22 02:00+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 04:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/asyncore.rst:2 msgid ":mod:`asyncore` --- Asynchronous socket handler" @@ -27,13 +27,13 @@ msgstr ":mod:`asyncore` --- 非同步 socket 處理函式" msgid "**Source code:** :source:`Lib/asyncore.py`" msgstr "**原始碼:**\\ :source:`Lib/asyncore.py`" -#: ../../library/asyncore.rst:16 +#: ../../library/asyncore.rst:20 msgid "" -":mod:`asyncore` will be removed in Python 3.12 (see :pep:`PEP 594 " -"<594#asyncore>` for details). Please use :mod:`asyncio` instead." +"The :mod:`asyncore` module is deprecated (see :pep:`PEP 594 <594#asyncore>` " +"for details). Please use :mod:`asyncio` instead." msgstr "" -":mod:`asyncore` 將於 Python 3.12 中移除(詳情請見:pep:`PEP 594 " -"<594#asyncore>`\\ )。請改用 :mod:`asyncio`\\ 。" +":mod:`asyncore` 已被棄用(詳情請見:pep:`PEP 594 <594#asyncore>`\\ )。請改" +"用 :mod:`asyncio`\\ 。" #: ../../library/asyncore.rst:25 msgid "" @@ -47,7 +47,18 @@ msgid "" "socket service clients and servers." msgstr "" -#: ../../library/asyncore.rst:31 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/asyncore.rst:33 msgid "" "There are only two ways to have a program on a single processor do \"more " "than one thing at a time.\" Multi-threaded programming is the simplest and " @@ -59,7 +70,7 @@ msgid "" "servers are rarely processor bound, however." msgstr "" -#: ../../library/asyncore.rst:40 +#: ../../library/asyncore.rst:42 msgid "" "If your operating system supports the :c:func:`select` system call in its I/" "O library (and nearly all do), then you can use it to juggle multiple " @@ -73,7 +84,7 @@ msgid "" "module is invaluable." msgstr "" -#: ../../library/asyncore.rst:51 +#: ../../library/asyncore.rst:53 msgid "" "The basic idea behind both modules is to create one or more network " "*channels*, instances of class :class:`asyncore.dispatcher` and :class:" @@ -82,7 +93,7 @@ msgid "" "*map*." msgstr "" -#: ../../library/asyncore.rst:57 +#: ../../library/asyncore.rst:59 msgid "" "Once the initial channel(s) is(are) created, calling the :func:`loop` " "function activates channel service, which continues until the last channel " @@ -90,7 +101,7 @@ msgid "" "is closed." msgstr "" -#: ../../library/asyncore.rst:64 +#: ../../library/asyncore.rst:66 msgid "" "Enter a polling loop that terminates after count passes or all open channels " "have been closed. All arguments are optional. The *count* parameter " @@ -102,7 +113,7 @@ msgid "" "preference to :func:`~select.select` (the default is ``False``)." msgstr "" -#: ../../library/asyncore.rst:73 +#: ../../library/asyncore.rst:75 msgid "" "The *map* parameter is a dictionary whose items are the channels to watch. " "As channels are closed they are deleted from their map. If *map* is " @@ -111,7 +122,7 @@ msgid "" "be mixed in the map." msgstr "" -#: ../../library/asyncore.rst:82 +#: ../../library/asyncore.rst:84 msgid "" "The :class:`dispatcher` class is a thin wrapper around a low-level socket " "object. To make it more useful, it has a few methods for event-handling " @@ -119,7 +130,7 @@ msgid "" "as a normal non-blocking socket object." msgstr "" -#: ../../library/asyncore.rst:87 +#: ../../library/asyncore.rst:89 msgid "" "The firing of low-level events at certain times or in certain connection " "states tells the asynchronous loop that certain higher-level events have " @@ -130,39 +141,39 @@ msgid "" "events are:" msgstr "" -#: ../../library/asyncore.rst:96 +#: ../../library/asyncore.rst:98 msgid "Event" msgstr "" -#: ../../library/asyncore.rst:96 +#: ../../library/asyncore.rst:98 msgid "Description" msgstr "描述" -#: ../../library/asyncore.rst:98 +#: ../../library/asyncore.rst:100 msgid "``handle_connect()``" msgstr "``handle_connect()``" -#: ../../library/asyncore.rst:98 +#: ../../library/asyncore.rst:100 msgid "Implied by the first read or write event" msgstr "" -#: ../../library/asyncore.rst:101 +#: ../../library/asyncore.rst:103 msgid "``handle_close()``" msgstr "``handle_close()``" -#: ../../library/asyncore.rst:101 +#: ../../library/asyncore.rst:103 msgid "Implied by a read event with no data available" msgstr "" -#: ../../library/asyncore.rst:104 +#: ../../library/asyncore.rst:106 msgid "``handle_accepted()``" msgstr "``handle_accepted()``" -#: ../../library/asyncore.rst:104 +#: ../../library/asyncore.rst:106 msgid "Implied by a read event on a listening socket" msgstr "" -#: ../../library/asyncore.rst:108 +#: ../../library/asyncore.rst:110 msgid "" "During asynchronous processing, each mapped channel's :meth:`readable` and :" "meth:`writable` methods are used to determine whether the channel's socket " @@ -170,49 +181,49 @@ msgid "" "`poll`\\ ed for read and write events." msgstr "" -#: ../../library/asyncore.rst:113 +#: ../../library/asyncore.rst:115 msgid "" "Thus, the set of channel events is larger than the basic socket events. The " "full set of methods that can be overridden in your subclass follows:" msgstr "" -#: ../../library/asyncore.rst:119 +#: ../../library/asyncore.rst:121 msgid "" "Called when the asynchronous loop detects that a :meth:`read` call on the " "channel's socket will succeed." msgstr "" -#: ../../library/asyncore.rst:125 +#: ../../library/asyncore.rst:127 msgid "" "Called when the asynchronous loop detects that a writable socket can be " "written. Often this method will implement the necessary buffering for " "performance. For example::" msgstr "" -#: ../../library/asyncore.rst:136 +#: ../../library/asyncore.rst:138 msgid "" "Called when there is out of band (OOB) data for a socket connection. This " "will almost never happen, as OOB is tenuously supported and rarely used." msgstr "" -#: ../../library/asyncore.rst:142 +#: ../../library/asyncore.rst:144 msgid "" "Called when the active opener's socket actually makes a connection. Might " "send a \"welcome\" banner, or initiate a protocol negotiation with the " "remote endpoint, for example." msgstr "" -#: ../../library/asyncore.rst:149 +#: ../../library/asyncore.rst:151 msgid "Called when the socket is closed." msgstr "" -#: ../../library/asyncore.rst:154 +#: ../../library/asyncore.rst:156 msgid "" "Called when an exception is raised and not otherwise handled. The default " "version prints a condensed traceback." msgstr "" -#: ../../library/asyncore.rst:160 +#: ../../library/asyncore.rst:162 msgid "" "Called on listening channels (passive openers) when a connection can be " "established with a new remote endpoint that has issued a :meth:`connect` " @@ -220,7 +231,7 @@ msgid "" "`handle_accepted` instead." msgstr "" -#: ../../library/asyncore.rst:170 +#: ../../library/asyncore.rst:172 msgid "" "Called on listening channels (passive openers) when a connection has been " "established with a new remote endpoint that has issued a :meth:`connect` " @@ -229,7 +240,7 @@ msgid "" "socket on the other end of the connection." msgstr "" -#: ../../library/asyncore.rst:181 +#: ../../library/asyncore.rst:183 msgid "" "Called each time around the asynchronous loop to determine whether a " "channel's socket should be added to the list on which read events can " @@ -237,7 +248,7 @@ msgid "" "default, all channels will be interested in read events." msgstr "" -#: ../../library/asyncore.rst:189 +#: ../../library/asyncore.rst:191 msgid "" "Called each time around the asynchronous loop to determine whether a " "channel's socket should be added to the list on which write events can " @@ -245,55 +256,55 @@ msgid "" "default, all channels will be interested in write events." msgstr "" -#: ../../library/asyncore.rst:195 +#: ../../library/asyncore.rst:197 msgid "" "In addition, each channel delegates or extends many of the socket methods. " "Most of these are nearly identical to their socket partners." msgstr "" -#: ../../library/asyncore.rst:201 +#: ../../library/asyncore.rst:203 msgid "" "This is identical to the creation of a normal socket, and will use the same " "options for creation. Refer to the :mod:`socket` documentation for " "information on creating sockets." msgstr "" -#: ../../library/asyncore.rst:205 +#: ../../library/asyncore.rst:207 msgid "*family* and *type* arguments can be omitted." msgstr "" -#: ../../library/asyncore.rst:211 +#: ../../library/asyncore.rst:213 msgid "" "As with the normal socket object, *address* is a tuple with the first " "element the host to connect to, and the second the port number." msgstr "" -#: ../../library/asyncore.rst:217 +#: ../../library/asyncore.rst:219 msgid "Send *data* to the remote end-point of the socket." msgstr "" -#: ../../library/asyncore.rst:222 +#: ../../library/asyncore.rst:224 msgid "" "Read at most *buffer_size* bytes from the socket's remote end-point. An " "empty bytes object implies that the channel has been closed from the other " "end." msgstr "" -#: ../../library/asyncore.rst:226 +#: ../../library/asyncore.rst:228 msgid "" "Note that :meth:`recv` may raise :exc:`BlockingIOError` , even though :func:" "`select.select` or :func:`select.poll` has reported the socket ready for " "reading." msgstr "" -#: ../../library/asyncore.rst:233 +#: ../../library/asyncore.rst:235 msgid "" "Listen for connections made to the socket. The *backlog* argument specifies " "the maximum number of queued connections and should be at least 1; the " "maximum value is system-dependent (usually 5)." msgstr "" -#: ../../library/asyncore.rst:240 +#: ../../library/asyncore.rst:242 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- refer to the :mod:" @@ -302,7 +313,7 @@ msgid "" "`dispatcher` object's :meth:`set_reuse_addr` method." msgstr "" -#: ../../library/asyncore.rst:249 +#: ../../library/asyncore.rst:251 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value can be either ``None`` or a pair ``(conn, " @@ -313,21 +324,21 @@ msgid "" "this event and keep listening for further incoming connections." msgstr "" -#: ../../library/asyncore.rst:261 +#: ../../library/asyncore.rst:263 msgid "" "Close the socket. All future operations on the socket object will fail. The " "remote end-point will receive no more data (after queued data is flushed). " "Sockets are automatically closed when they are garbage-collected." msgstr "" -#: ../../library/asyncore.rst:269 +#: ../../library/asyncore.rst:271 msgid "" "A :class:`dispatcher` subclass which adds simple buffered output capability, " "useful for simple clients. For more sophisticated usage use :class:`asynchat." "async_chat`." msgstr "" -#: ../../library/asyncore.rst:275 +#: ../../library/asyncore.rst:277 msgid "" "A file_dispatcher takes a file descriptor or :term:`file object` along with " "an optional map argument and wraps it for use with the :c:func:`poll` or :c:" @@ -336,11 +347,11 @@ msgid "" "`file_wrapper` constructor." msgstr "" -#: ../../library/asyncore.rst:281 ../../library/asyncore.rst:290 +#: ../../library/asyncore.rst:283 ../../library/asyncore.rst:292 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/asyncore.rst:285 +#: ../../library/asyncore.rst:287 msgid "" "A file_wrapper takes an integer file descriptor and calls :func:`os.dup` to " "duplicate the handle so that the original handle may be closed independently " @@ -348,21 +359,21 @@ msgid "" "socket for use by the :class:`file_dispatcher` class." msgstr "" -#: ../../library/asyncore.rst:296 +#: ../../library/asyncore.rst:298 msgid "asyncore Example basic HTTP client" msgstr "" -#: ../../library/asyncore.rst:298 +#: ../../library/asyncore.rst:300 msgid "" "Here is a very basic HTTP client that uses the :class:`dispatcher` class to " "implement its socket handling::" msgstr "" -#: ../../library/asyncore.rst:335 +#: ../../library/asyncore.rst:337 msgid "asyncore Example basic echo server" msgstr "" -#: ../../library/asyncore.rst:337 +#: ../../library/asyncore.rst:339 msgid "" "Here is a basic echo server that uses the :class:`dispatcher` class to " "accept connections and dispatches the incoming connections to a handler::" diff --git a/library/audioop.po b/library/audioop.po index 89b8b6171a..e71ff77ba8 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:00+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr "" msgid ":mod:`audioop` --- Manipulate raw audio data" msgstr ":mod:`audioop` --- 操作原始聲音檔案" -#: ../../library/audioop.rst:8 +#: ../../library/audioop.rst:11 msgid "" "The :mod:`audioop` module is deprecated (see :pep:`PEP 594 <594#audioop>` " "for details)." diff --git a/library/base64.po b/library/base64.po index 6b505f50ef..66048cdaab 100644 --- a/library/base64.po +++ b/library/base64.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -126,19 +126,25 @@ msgid "" "in the input result in a :exc:`binascii.Error`." msgstr "" -#: ../../library/base64.rst:84 +#: ../../library/base64.rst:81 +msgid "" +"For more information about the strict base64 check, see :func:`binascii." +"a2b_base64`" +msgstr "" + +#: ../../library/base64.rst:86 msgid "" "Encode :term:`bytes-like object` *s* using the standard Base64 alphabet and " "return the encoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:90 +#: ../../library/base64.rst:92 msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the standard " "Base64 alphabet and return the decoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:96 +#: ../../library/base64.rst:98 msgid "" "Encode :term:`bytes-like object` *s* using the URL- and filesystem-safe " "alphabet, which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/" @@ -146,7 +152,7 @@ msgid "" "The result can still contain ``=``." msgstr "" -#: ../../library/base64.rst:105 +#: ../../library/base64.rst:107 msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the URL- and " "filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` " @@ -154,25 +160,25 @@ msgid "" "class:`bytes`." msgstr "" -#: ../../library/base64.rst:114 +#: ../../library/base64.rst:116 msgid "" "Encode the :term:`bytes-like object` *s* using Base32 and return the " "encoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:120 +#: ../../library/base64.rst:122 msgid "" "Decode the Base32 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:123 ../../library/base64.rst:171 +#: ../../library/base64.rst:125 ../../library/base64.rst:173 msgid "" "Optional *casefold* is a flag specifying whether a lowercase alphabet is " "acceptable as input. For security purposes, the default is ``False``." msgstr "" -#: ../../library/base64.rst:127 +#: ../../library/base64.rst:129 msgid "" ":rfc:`4648` allows for optional mapping of the digit 0 (zero) to the letter " "O (oh), and for optional mapping of the digit 1 (one) to either the letter I " @@ -183,25 +189,25 @@ msgid "" "input." msgstr "" -#: ../../library/base64.rst:134 ../../library/base64.rst:175 +#: ../../library/base64.rst:136 ../../library/base64.rst:177 msgid "" "A :exc:`binascii.Error` is raised if *s* is incorrectly padded or if there " "are non-alphabet characters present in the input." msgstr "" -#: ../../library/base64.rst:141 +#: ../../library/base64.rst:143 msgid "" "Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" -#: ../../library/base64.rst:149 +#: ../../library/base64.rst:151 msgid "" "Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" -#: ../../library/base64.rst:152 +#: ../../library/base64.rst:154 msgid "" "This version does not allow the digit 0 (zero) to the letter O (oh) and " "digit 1 (one) to either the letter I (eye) or letter L (el) mappings, all " @@ -209,70 +215,70 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/base64.rst:162 +#: ../../library/base64.rst:164 msgid "" "Encode the :term:`bytes-like object` *s* using Base16 and return the " "encoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:168 +#: ../../library/base64.rst:170 msgid "" "Decode the Base16 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:182 +#: ../../library/base64.rst:184 msgid "" "Encode the :term:`bytes-like object` *b* using Ascii85 and return the " "encoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:185 +#: ../../library/base64.rst:187 msgid "" "*foldspaces* is an optional flag that uses the special short sequence 'y' " "instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This " "feature is not supported by the \"standard\" Ascii85 encoding." msgstr "" -#: ../../library/base64.rst:189 +#: ../../library/base64.rst:191 msgid "" "*wrapcol* controls whether the output should have newline (``b'\\n'``) " "characters added to it. If this is non-zero, each output line will be at " "most this many characters long." msgstr "" -#: ../../library/base64.rst:193 +#: ../../library/base64.rst:195 msgid "" "*pad* controls whether the input is padded to a multiple of 4 before " "encoding. Note that the ``btoa`` implementation always pads." msgstr "" -#: ../../library/base64.rst:196 +#: ../../library/base64.rst:198 msgid "" "*adobe* controls whether the encoded byte sequence is framed with ``<~`` and " "``~>``, which is used by the Adobe implementation." msgstr "" -#: ../../library/base64.rst:204 +#: ../../library/base64.rst:206 msgid "" "Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:207 +#: ../../library/base64.rst:209 msgid "" "*foldspaces* is a flag that specifies whether the 'y' short sequence should " "be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature " "is not supported by the \"standard\" Ascii85 encoding." msgstr "" -#: ../../library/base64.rst:211 +#: ../../library/base64.rst:213 msgid "" "*adobe* controls whether the input sequence is in Adobe Ascii85 format (i.e. " "is framed with <~ and ~>)." msgstr "" -#: ../../library/base64.rst:214 +#: ../../library/base64.rst:216 msgid "" "*ignorechars* should be a :term:`bytes-like object` or ASCII string " "containing characters to ignore from the input. This should only contain " @@ -280,30 +286,30 @@ msgid "" "ASCII." msgstr "" -#: ../../library/base64.rst:224 +#: ../../library/base64.rst:226 msgid "" "Encode the :term:`bytes-like object` *b* using base85 (as used in e.g. git-" "style binary diffs) and return the encoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:227 +#: ../../library/base64.rst:229 msgid "" "If *pad* is true, the input is padded with ``b'\\0'`` so its length is a " "multiple of 4 bytes before encoding." msgstr "" -#: ../../library/base64.rst:235 +#: ../../library/base64.rst:237 msgid "" "Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`. Padding is implicitly removed, if " "necessary." msgstr "" -#: ../../library/base64.rst:242 +#: ../../library/base64.rst:244 msgid "The legacy interface:" msgstr "" -#: ../../library/base64.rst:246 +#: ../../library/base64.rst:248 msgid "" "Decode the contents of the binary *input* file and write the resulting " "binary data to the *output* file. *input* and *output* must be :term:`file " @@ -311,13 +317,13 @@ msgid "" "returns an empty bytes object." msgstr "" -#: ../../library/base64.rst:254 +#: ../../library/base64.rst:256 msgid "" "Decode the :term:`bytes-like object` *s*, which must contain one or more " "lines of base64 encoded data, and return the decoded :class:`bytes`." msgstr "" -#: ../../library/base64.rst:262 +#: ../../library/base64.rst:264 msgid "" "Encode the contents of the binary *input* file and write the resulting " "base64 encoded data to the *output* file. *input* and *output* must be :term:" @@ -327,7 +333,7 @@ msgid "" "the output always ends with a newline, as per :rfc:`2045` (MIME)." msgstr "" -#: ../../library/base64.rst:272 +#: ../../library/base64.rst:274 msgid "" "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " "data, and return :class:`bytes` containing the base64-encoded data, with " @@ -335,38 +341,38 @@ msgid "" "that there is a trailing newline, as per :rfc:`2045` (MIME)." msgstr "" -#: ../../library/base64.rst:280 +#: ../../library/base64.rst:282 msgid "An example usage of the module:" msgstr "" -#: ../../library/base64.rst:293 +#: ../../library/base64.rst:295 msgid "Security Considerations" msgstr "" -#: ../../library/base64.rst:295 +#: ../../library/base64.rst:297 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " "production." msgstr "" -#: ../../library/base64.rst:301 +#: ../../library/base64.rst:303 msgid "Module :mod:`binascii`" msgstr ":mod:`binascii` 模組" -#: ../../library/base64.rst:301 +#: ../../library/base64.rst:303 msgid "" "Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" -#: ../../library/base64.rst:304 +#: ../../library/base64.rst:306 msgid "" ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " "Mechanisms for Specifying and Describing the Format of Internet Message " "Bodies" msgstr "" -#: ../../library/base64.rst:304 +#: ../../library/base64.rst:306 msgid "" "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " "of the base64 encoding." diff --git a/library/binascii.po b/library/binascii.po index 65b681dff7..cc120aeb58 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-21 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -22,17 +22,17 @@ msgstr "" msgid ":mod:`binascii` --- Convert between binary and ASCII" msgstr "" -#: ../../library/binascii.rst:15 +#: ../../library/binascii.rst:14 msgid "" "The :mod:`binascii` module contains a number of methods to convert between " "binary and various ASCII-encoded binary representations. Normally, you will " -"not use these functions directly but use wrapper modules like :mod:`uu`, :" -"mod:`base64`, or :mod:`binhex` instead. The :mod:`binascii` module contains " -"low-level functions written in C for greater speed that are used by the " -"higher-level modules." +"not use these functions directly but use wrapper modules like :mod:`uu` or :" +"mod:`base64` instead. The :mod:`binascii` module contains low-level " +"functions written in C for greater speed that are used by the higher-level " +"modules." msgstr "" -#: ../../library/binascii.rst:24 +#: ../../library/binascii.rst:23 msgid "" "``a2b_*`` functions accept Unicode strings containing only ASCII characters. " "Other functions only accept :term:`bytes-like objects ` " @@ -40,22 +40,22 @@ msgid "" "the buffer protocol)." msgstr "" -#: ../../library/binascii.rst:29 +#: ../../library/binascii.rst:28 msgid "ASCII-only unicode strings are now accepted by the ``a2b_*`` functions." msgstr "" -#: ../../library/binascii.rst:33 +#: ../../library/binascii.rst:32 msgid "The :mod:`binascii` module defines the following functions:" msgstr "" -#: ../../library/binascii.rst:38 +#: ../../library/binascii.rst:37 msgid "" "Convert a single line of uuencoded data back to binary and return the binary " "data. Lines normally contain 45 (binary) bytes, except for the last line. " "Line data may be followed by whitespace." msgstr "" -#: ../../library/binascii.rst:45 +#: ../../library/binascii.rst:44 msgid "" "Convert binary data to a line of ASCII characters, the return value is the " "converted line, including a newline char. The length of *data* should be at " @@ -63,35 +63,67 @@ msgid "" "spaces." msgstr "" -#: ../../library/binascii.rst:49 +#: ../../library/binascii.rst:48 msgid "Added the *backtick* parameter." msgstr "新增 *backtick* 參數。" -#: ../../library/binascii.rst:55 +#: ../../library/binascii.rst:54 msgid "" "Convert a block of base64 data back to binary and return the binary data. " "More than one line may be passed at a time." msgstr "" +#: ../../library/binascii.rst:57 +msgid "" +"If *strict_mode* is true, only valid base64 data will be converted. Invalid " +"base64 data will raise :exc:`binascii.Error`." +msgstr "" + +#: ../../library/binascii.rst:64 +msgid "Valid base64:" +msgstr "" + #: ../../library/binascii.rst:61 +msgid "Conforms to :rfc:`3548`." +msgstr "" + +#: ../../library/binascii.rst:62 +msgid "Contains only characters from the base64 alphabet." +msgstr "" + +#: ../../library/binascii.rst:63 +msgid "" +"Contains no excess data after padding (including excess padding, newlines, " +"etc.)." +msgstr "" + +#: ../../library/binascii.rst:64 +msgid "Does not start with a padding." +msgstr "" + +#: ../../library/binascii.rst:66 +msgid "Added the *strict_mode* parameter." +msgstr "新增 *strict_mode* 參數。" + +#: ../../library/binascii.rst:72 msgid "" "Convert binary data to a line of ASCII characters in base64 coding. The " "return value is the converted line, including a newline char if *newline* is " "true. The output of this function conforms to :rfc:`3548`." msgstr "" -#: ../../library/binascii.rst:65 +#: ../../library/binascii.rst:76 msgid "Added the *newline* parameter." msgstr "新增 *newline* 參數。" -#: ../../library/binascii.rst:71 +#: ../../library/binascii.rst:82 msgid "" "Convert a block of quoted-printable data back to binary and return the " "binary data. More than one line may be passed at a time. If the optional " "argument *header* is present and true, underscores will be decoded as spaces." msgstr "" -#: ../../library/binascii.rst:78 +#: ../../library/binascii.rst:89 msgid "" "Convert binary data to a line(s) of ASCII characters in quoted-printable " "encoding. The return value is the converted line(s). If the optional " @@ -104,39 +136,7 @@ msgid "" "might corrupt the binary data stream." msgstr "" -#: ../../library/binascii.rst:91 -msgid "" -"Convert binhex4 formatted ASCII data to binary, without doing RLE-" -"decompression. The string should contain a complete number of binary bytes, " -"or (in case of the last portion of the binhex4 data) have the remaining bits " -"zero." -msgstr "" - -#: ../../library/binascii.rst:100 -msgid "" -"Perform RLE-decompression on the data, as per the binhex4 standard. The " -"algorithm uses ``0x90`` after a byte as a repeat indicator, followed by a " -"count. A count of ``0`` specifies a byte value of ``0x90``. The routine " -"returns the decompressed data, unless data input data ends in an orphaned " -"repeat indicator, in which case the :exc:`Incomplete` exception is raised." -msgstr "" - -#: ../../library/binascii.rst:106 -msgid "Accept only bytestring or bytearray objects as input." -msgstr "" - -#: ../../library/binascii.rst:114 -msgid "Perform binhex4 style RLE-compression on *data* and return the result." -msgstr "" - -#: ../../library/binascii.rst:121 -msgid "" -"Perform hexbin4 binary-to-ASCII translation and return the resulting string. " -"The argument should already be RLE-coded, and have a length divisible by 3 " -"(except possibly the last fragment)." -msgstr "" - -#: ../../library/binascii.rst:130 +#: ../../library/binascii.rst:102 msgid "" "Compute a 16-bit CRC value of *data*, starting with *value* as the initial " "CRC, and return the result. This uses the CRC-CCITT polynomial *x*:sup:`16` " @@ -144,7 +144,7 @@ msgid "" "used in the binhex4 format." msgstr "" -#: ../../library/binascii.rst:138 +#: ../../library/binascii.rst:110 msgid "" "Compute CRC-32, the unsigned 32-bit checksum of *data*, starting with an " "initial CRC of *value*. The default initial CRC is zero. The algorithm is " @@ -153,26 +153,24 @@ msgid "" "algorithm. Use as follows::" msgstr "" -#: ../../library/binascii.rst:150 -msgid "" -"The result is always unsigned. To generate the same numeric value when using " -"Python 2 or earlier, use ``crc32(data) & 0xffffffff``." +#: ../../library/binascii.rst:122 +msgid "The result is always unsigned." msgstr "" -#: ../../library/binascii.rst:158 +#: ../../library/binascii.rst:128 msgid "" "Return the hexadecimal representation of the binary *data*. Every byte of " "*data* is converted into the corresponding 2-digit hex representation. The " "returned bytes object is therefore twice as long as the length of *data*." msgstr "" -#: ../../library/binascii.rst:162 +#: ../../library/binascii.rst:132 msgid "" "Similar functionality (but returning a text string) is also conveniently " "accessible using the :meth:`bytes.hex` method." msgstr "" -#: ../../library/binascii.rst:165 +#: ../../library/binascii.rst:135 msgid "" "If *sep* is specified, it must be a single character str or bytes object. It " "will be inserted in the output after every *bytes_per_sep* input bytes. " @@ -180,11 +178,11 @@ msgid "" "if you wish to count from the left, supply a negative *bytes_per_sep* value." msgstr "" -#: ../../library/binascii.rst:180 +#: ../../library/binascii.rst:150 msgid "The *sep* and *bytes_per_sep* parameters were added." msgstr "新增 *sep* 與 *bytes_per_sep* 參數。" -#: ../../library/binascii.rst:186 +#: ../../library/binascii.rst:156 msgid "" "Return the binary data represented by the hexadecimal string *hexstr*. This " "function is the inverse of :func:`b2a_hex`. *hexstr* must contain an even " @@ -192,52 +190,47 @@ msgid "" "an :exc:`Error` exception is raised." msgstr "" -#: ../../library/binascii.rst:191 +#: ../../library/binascii.rst:161 msgid "" "Similar functionality (accepting only text string arguments, but more " "liberal towards whitespace) is also accessible using the :meth:`bytes." "fromhex` class method." msgstr "" -#: ../../library/binascii.rst:197 +#: ../../library/binascii.rst:167 msgid "Exception raised on errors. These are usually programming errors." msgstr "" -#: ../../library/binascii.rst:202 +#: ../../library/binascii.rst:172 msgid "" "Exception raised on incomplete data. These are usually not programming " "errors, but may be handled by reading a little more data and trying again." msgstr "" -#: ../../library/binascii.rst:210 +#: ../../library/binascii.rst:180 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/binascii.rst:209 +#: ../../library/binascii.rst:179 msgid "" "Support for RFC compliant base64-style encoding in base 16, 32, 64, and 85." msgstr "" -#: ../../library/binascii.rst:213 -msgid "Module :mod:`binhex`" -msgstr ":mod:`binhex` 模組" - -#: ../../library/binascii.rst:213 -msgid "Support for the binhex format used on the Macintosh." -msgstr "" - -#: ../../library/binascii.rst:216 +#: ../../library/binascii.rst:183 msgid "Module :mod:`uu`" msgstr ":mod:`uu` 模組" -#: ../../library/binascii.rst:216 +#: ../../library/binascii.rst:183 msgid "Support for UU encoding used on Unix." msgstr "" -#: ../../library/binascii.rst:218 +#: ../../library/binascii.rst:185 msgid "Module :mod:`quopri`" msgstr ":mod:`quopri` 模組" -#: ../../library/binascii.rst:219 +#: ../../library/binascii.rst:186 msgid "Support for quoted-printable encoding used in MIME email messages." msgstr "" + +#~ msgid "Module :mod:`binhex`" +#~ msgstr ":mod:`binhex` 模組" diff --git a/library/calendar.po b/library/calendar.po index 57108961b1..83f49e3f56 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-24 00:09+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -288,32 +288,28 @@ msgstr "" #: ../../library/calendar.rst:280 msgid "" "This subclass of :class:`TextCalendar` can be passed a locale name in the " -"constructor and will return month and weekday names in the specified locale. " -"If this locale includes an encoding all strings containing month and weekday " -"names will be returned as unicode." +"constructor and will return month and weekday names in the specified locale." msgstr "" -#: ../../library/calendar.rst:288 +#: ../../library/calendar.rst:286 msgid "" "This subclass of :class:`HTMLCalendar` can be passed a locale name in the " -"constructor and will return month and weekday names in the specified locale. " -"If this locale includes an encoding all strings containing month and weekday " -"names will be returned as unicode." +"constructor and will return month and weekday names in the specified locale." msgstr "" -#: ../../library/calendar.rst:295 +#: ../../library/calendar.rst:292 msgid "" -"The :meth:`formatweekday` and :meth:`formatmonthname` methods of these two " -"classes temporarily change the current locale to the given *locale*. " -"Because the current locale is a process-wide setting, they are not thread-" -"safe." +"The constructor, :meth:`formatweekday` and :meth:`formatmonthname` methods " +"of these two classes temporarily change the ``LC_TIME`` locale to the given " +"*locale*. Because the current locale is a process-wide setting, they are not " +"thread-safe." msgstr "" -#: ../../library/calendar.rst:300 +#: ../../library/calendar.rst:298 msgid "For simple text calendars this module provides the following functions." msgstr "" -#: ../../library/calendar.rst:304 +#: ../../library/calendar.rst:302 msgid "" "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " "values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:" @@ -321,72 +317,72 @@ msgid "" "provided for convenience. For example, to set the first weekday to Sunday::" msgstr "" -#: ../../library/calendar.rst:315 +#: ../../library/calendar.rst:313 msgid "Returns the current setting for the weekday to start each week." msgstr "" -#: ../../library/calendar.rst:320 +#: ../../library/calendar.rst:318 msgid "" "Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." msgstr "" -#: ../../library/calendar.rst:325 +#: ../../library/calendar.rst:323 msgid "" "Returns the number of leap years in the range from *y1* to *y2* (exclusive), " "where *y1* and *y2* are years." msgstr "" -#: ../../library/calendar.rst:328 +#: ../../library/calendar.rst:326 msgid "This function works for ranges spanning a century change." msgstr "" -#: ../../library/calendar.rst:333 +#: ../../library/calendar.rst:331 msgid "" "Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), " "*month* (``1``--``12``), *day* (``1``--``31``)." msgstr "" -#: ../../library/calendar.rst:339 +#: ../../library/calendar.rst:337 msgid "" "Return a header containing abbreviated weekday names. *n* specifies the " "width in characters for one weekday." msgstr "" -#: ../../library/calendar.rst:345 +#: ../../library/calendar.rst:343 msgid "" "Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "" -#: ../../library/calendar.rst:351 +#: ../../library/calendar.rst:349 msgid "" "Returns a matrix representing a month's calendar. Each row represents a " "week; days outside of the month are represented by zeros. Each week begins " "with Monday unless set by :func:`setfirstweekday`." msgstr "" -#: ../../library/calendar.rst:358 +#: ../../library/calendar.rst:356 msgid "Prints a month's calendar as returned by :func:`month`." msgstr "" -#: ../../library/calendar.rst:363 +#: ../../library/calendar.rst:361 msgid "" "Returns a month's calendar in a multi-line string using the :meth:" "`formatmonth` of the :class:`TextCalendar` class." msgstr "" -#: ../../library/calendar.rst:369 +#: ../../library/calendar.rst:367 msgid "" "Prints the calendar for an entire year as returned by :func:`calendar`." msgstr "" -#: ../../library/calendar.rst:374 +#: ../../library/calendar.rst:372 msgid "" "Returns a 3-column calendar for an entire year as a multi-line string using " "the :meth:`formatyear` of the :class:`TextCalendar` class." msgstr "" -#: ../../library/calendar.rst:380 +#: ../../library/calendar.rst:378 msgid "" "An unrelated but handy function that takes a time tuple such as returned by " "the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " @@ -395,53 +391,53 @@ msgid "" "inverse." msgstr "" -#: ../../library/calendar.rst:387 +#: ../../library/calendar.rst:385 msgid "The :mod:`calendar` module exports the following data attributes:" msgstr "" -#: ../../library/calendar.rst:391 +#: ../../library/calendar.rst:389 msgid "An array that represents the days of the week in the current locale." msgstr "" -#: ../../library/calendar.rst:396 +#: ../../library/calendar.rst:394 msgid "" "An array that represents the abbreviated days of the week in the current " "locale." msgstr "" -#: ../../library/calendar.rst:401 +#: ../../library/calendar.rst:399 msgid "" "An array that represents the months of the year in the current locale. This " "follows normal convention of January being month number 1, so it has a " "length of 13 and ``month_name[0]`` is the empty string." msgstr "" -#: ../../library/calendar.rst:408 +#: ../../library/calendar.rst:406 msgid "" "An array that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " "it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" -#: ../../library/calendar.rst:420 +#: ../../library/calendar.rst:418 msgid "" "Aliases for day numbers, where ``MONDAY`` is ``0`` and ``SUNDAY`` is ``6``." msgstr "" -#: ../../library/calendar.rst:426 +#: ../../library/calendar.rst:424 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:425 +#: ../../library/calendar.rst:423 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "" -#: ../../library/calendar.rst:428 +#: ../../library/calendar.rst:426 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:429 +#: ../../library/calendar.rst:427 msgid "Low-level time related functions." msgstr "" diff --git a/library/cgi.po b/library/cgi.po index 2d724a9205..146654af8f 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`cgi` --- 通用閘道器介面支援" msgid "**Source code:** :source:`Lib/cgi.py`" msgstr "**原始碼:**\\ :source:`Lib/cgi.py`" -#: ../../library/cgi.rst:18 +#: ../../library/cgi.rst:27 msgid "" "The :mod:`cgi` module is deprecated (see :pep:`PEP 594 <594#cgi>` for " "details and alternatives)." @@ -35,27 +35,55 @@ msgstr "" ":mod:`cgi` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " "<594#cgi>`\\ )。" -#: ../../library/cgi.rst:24 +#: ../../library/cgi.rst:22 +msgid "" +"The :class:`FieldStorage` class can typically be replaced with :func:`urllib." +"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." +"message` module or `multipart `_ for " +"``POST`` and ``PUT``. Most :ref:`utility functions ` have replacements." +msgstr "" + +#: ../../library/cgi.rst:30 msgid "Support module for Common Gateway Interface (CGI) scripts." msgstr "" -#: ../../library/cgi.rst:26 +#: ../../library/cgi.rst:32 msgid "" "This module defines a number of utilities for use by CGI scripts written in " "Python." msgstr "" -#: ../../library/cgi.rst:31 +#: ../../library/cgi.rst:35 +msgid "" +"The global variable ``maxlen`` can be set to an integer indicating the " +"maximum size of a POST request. POST requests larger than this size will " +"result in a :exc:`ValueError` being raised during parsing. The default value " +"of this variable is ``0``, meaning the request size is unlimited." +msgstr "" + +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/cgi.rst:43 msgid "Introduction" msgstr "簡介" -#: ../../library/cgi.rst:35 +#: ../../library/cgi.rst:47 msgid "" "A CGI script is invoked by an HTTP server, usually to process user input " "submitted through an HTML ``
`` or ```` element." msgstr "" -#: ../../library/cgi.rst:38 +#: ../../library/cgi.rst:50 msgid "" "Most often, CGI scripts live in the server's special :file:`cgi-bin` " "directory. The HTTP server places all sorts of information about the request " @@ -64,7 +92,7 @@ msgid "" "script, and sends the script's output back to the client." msgstr "" -#: ../../library/cgi.rst:44 +#: ../../library/cgi.rst:56 msgid "" "The script's input is connected to the client too, and sometimes the form " "data is read this way; at other times the form data is passed via the " @@ -75,7 +103,7 @@ msgid "" "supports it)." msgstr "" -#: ../../library/cgi.rst:51 +#: ../../library/cgi.rst:63 msgid "" "The output of a CGI script should consist of two sections, separated by a " "blank line. The first section contains a number of headers, telling the " @@ -83,26 +111,26 @@ msgid "" "header section looks like this::" msgstr "" -#: ../../library/cgi.rst:59 +#: ../../library/cgi.rst:71 msgid "" "The second section is usually HTML, which allows the client software to " "display nicely formatted text with header, in-line images, etc. Here's " "Python code that prints a simple piece of HTML::" msgstr "" -#: ../../library/cgi.rst:71 +#: ../../library/cgi.rst:83 msgid "Using the cgi module" msgstr "" -#: ../../library/cgi.rst:73 +#: ../../library/cgi.rst:85 msgid "Begin by writing ``import cgi``." msgstr "" -#: ../../library/cgi.rst:75 +#: ../../library/cgi.rst:87 msgid "When you write a new script, consider adding these lines::" msgstr "" -#: ../../library/cgi.rst:80 +#: ../../library/cgi.rst:92 msgid "" "This activates a special exception handler that will display detailed " "reports in the web browser if any errors occur. If you'd rather not show " @@ -110,7 +138,7 @@ msgid "" "saved to files instead, with code like this::" msgstr "" -#: ../../library/cgi.rst:88 +#: ../../library/cgi.rst:100 msgid "" "It's very helpful to use this feature during script development. The reports " "produced by :mod:`cgitb` provide information that can save you a lot of time " @@ -118,7 +146,7 @@ msgid "" "you have tested your script and are confident that it works correctly." msgstr "" -#: ../../library/cgi.rst:93 +#: ../../library/cgi.rst:105 msgid "" "To get at submitted form data, use the :class:`FieldStorage` class. If the " "form contains non-ASCII characters, use the *encoding* keyword parameter set " @@ -130,7 +158,7 @@ msgid "" "consume standard input, it should be instantiated only once." msgstr "" -#: ../../library/cgi.rst:102 +#: ../../library/cgi.rst:114 msgid "" "The :class:`FieldStorage` instance can be indexed like a Python dictionary. " "It allows membership testing with the :keyword:`in` operator, and also " @@ -141,14 +169,14 @@ msgid "" "class:`FieldStorage` instance." msgstr "" -#: ../../library/cgi.rst:110 +#: ../../library/cgi.rst:122 msgid "" "For instance, the following code (which assumes that the :mailheader:" "`Content-Type` header and blank line have already been printed) checks that " "the fields ``name`` and ``addr`` are both set to a non-empty string::" msgstr "" -#: ../../library/cgi.rst:124 +#: ../../library/cgi.rst:136 msgid "" "Here the fields, accessed through ``form[key]``, are themselves instances " "of :class:`FieldStorage` (or :class:`MiniFieldStorage`, depending on the " @@ -158,7 +186,7 @@ msgid "" "second argument as a default to return if the requested key is not present." msgstr "" -#: ../../library/cgi.rst:131 +#: ../../library/cgi.rst:143 msgid "" "If the submitted form data contains more than one field with the same name, " "the object retrieved by ``form[key]`` is not a :class:`FieldStorage` or :" @@ -171,7 +199,7 @@ msgid "" "username fields, separated by commas::" msgstr "" -#: ../../library/cgi.rst:144 +#: ../../library/cgi.rst:156 msgid "" "If a field represents an uploaded file, accessing the value via the :attr:" "`~FieldStorage.value` attribute or the :meth:`~FieldStorage.getvalue` method " @@ -184,13 +212,13 @@ msgid "" "IOBase.readline` methods will return bytes)::" msgstr "" -#: ../../library/cgi.rst:164 +#: ../../library/cgi.rst:176 msgid "" ":class:`FieldStorage` objects also support being used in a :keyword:`with` " "statement, which will automatically close them when done." msgstr "" -#: ../../library/cgi.rst:167 +#: ../../library/cgi.rst:179 msgid "" "If an error is encountered when obtaining the contents of an uploaded file " "(for example, when the user interrupts the form submission by clicking on a " @@ -198,7 +226,7 @@ msgid "" "object for the field will be set to the value -1." msgstr "" -#: ../../library/cgi.rst:172 +#: ../../library/cgi.rst:184 msgid "" "The file upload draft standard entertains the possibility of uploading " "multiple files from one field (using a recursive :mimetype:`multipart/\\*` " @@ -209,7 +237,7 @@ msgid "" "be iterated over recursively just like the top-level form object." msgstr "" -#: ../../library/cgi.rst:180 +#: ../../library/cgi.rst:192 msgid "" "When a form is submitted in the \"old\" format (as the query string or as a " "single data part of type :mimetype:`application/x-www-form-urlencoded`), the " @@ -218,29 +246,29 @@ msgid "" "are always ``None``." msgstr "" -#: ../../library/cgi.rst:185 +#: ../../library/cgi.rst:197 msgid "" "A form submitted via POST that also has a query string will contain both :" "class:`FieldStorage` and :class:`MiniFieldStorage` items." msgstr "" -#: ../../library/cgi.rst:188 +#: ../../library/cgi.rst:200 msgid "" "The :attr:`~FieldStorage.file` attribute is automatically closed upon the " "garbage collection of the creating :class:`FieldStorage` instance." msgstr "" -#: ../../library/cgi.rst:192 +#: ../../library/cgi.rst:204 msgid "" "Added support for the context management protocol to the :class:" "`FieldStorage` class." msgstr "" -#: ../../library/cgi.rst:198 +#: ../../library/cgi.rst:210 msgid "Higher Level Interface" msgstr "" -#: ../../library/cgi.rst:200 +#: ../../library/cgi.rst:212 msgid "" "The previous section explains how to read CGI form data using the :class:" "`FieldStorage` class. This section describes a higher level interface which " @@ -250,33 +278,33 @@ msgid "" "efficiently, for example." msgstr "" -#: ../../library/cgi.rst:209 +#: ../../library/cgi.rst:221 msgid "" "The interface consists of two simple methods. Using the methods you can " "process form data in a generic way, without the need to worry whether only " "one or more values were posted under one name." msgstr "" -#: ../../library/cgi.rst:213 +#: ../../library/cgi.rst:225 msgid "" "In the previous section, you learned to write following code anytime you " "expected a user to post more than one value under one name::" msgstr "" -#: ../../library/cgi.rst:222 +#: ../../library/cgi.rst:234 msgid "" "This situation is common for example when a form contains a group of " "multiple checkboxes with the same name::" msgstr "" -#: ../../library/cgi.rst:228 +#: ../../library/cgi.rst:240 msgid "" "In most situations, however, there's only one form control with a particular " "name in a form and then you expect and need only one value associated with " "this name. So you write a script containing for example this code::" msgstr "" -#: ../../library/cgi.rst:234 +#: ../../library/cgi.rst:246 msgid "" "The problem with the code is that you should never expect that a client will " "provide valid input to your scripts. For example, if a curious user appends " @@ -287,21 +315,21 @@ msgid "" "an :exc:`AttributeError` exception." msgstr "" -#: ../../library/cgi.rst:242 +#: ../../library/cgi.rst:254 msgid "" "Therefore, the appropriate way to read form data values was to always use " "the code which checks whether the obtained value is a single value or a list " "of values. That's annoying and leads to less readable scripts." msgstr "" -#: ../../library/cgi.rst:246 +#: ../../library/cgi.rst:258 msgid "" "A more convenient approach is to use the methods :meth:`~FieldStorage." "getfirst` and :meth:`~FieldStorage.getlist` provided by this higher level " "interface." msgstr "" -#: ../../library/cgi.rst:252 +#: ../../library/cgi.rst:264 msgid "" "This method always returns only one value associated with form field *name*. " "The method returns only the first value in case that more values were posted " @@ -312,7 +340,7 @@ msgid "" "defaults to ``None`` if not specified." msgstr "" -#: ../../library/cgi.rst:263 +#: ../../library/cgi.rst:275 msgid "" "This method always returns a list of values associated with form field " "*name*. The method returns an empty list if no such form field or value " @@ -320,28 +348,36 @@ msgid "" "such value exists." msgstr "" -#: ../../library/cgi.rst:267 +#: ../../library/cgi.rst:279 msgid "Using these methods you can write nice compact code::" msgstr "" -#: ../../library/cgi.rst:279 +#: ../../library/cgi.rst:291 msgid "Functions" msgstr "函式" -#: ../../library/cgi.rst:281 +#: ../../library/cgi.rst:293 msgid "" "These are useful if you want more control, or if you want to employ some of " "the algorithms implemented in this module in other circumstances." msgstr "" -#: ../../library/cgi.rst:287 +#: ../../library/cgi.rst:299 msgid "" "Parse a query in the environment or from a file (the file defaults to ``sys." "stdin``). The *keep_blank_values*, *strict_parsing* and *separator* " "parameters are passed to :func:`urllib.parse.parse_qs` unchanged." msgstr "" -#: ../../library/cgi.rst:294 +#: ../../library/cgi.rst:307 +msgid "" +"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " +"be replaced by calling :func:`urllib.parse.parse_qs` directly on the desired " +"query string (except for ``multipart/form-data`` input, which can be handled " +"as described for :func:`parse_multipart`)." +msgstr "" + +#: ../../library/cgi.rst:312 msgid "" "Parse input of type :mimetype:`multipart/form-data` (for file uploads). " "Arguments are *fp* for the input file, *pdict* for a dictionary containing " @@ -349,63 +385,83 @@ msgid "" "the request encoding." msgstr "" -#: ../../library/cgi.rst:299 +#: ../../library/cgi.rst:317 msgid "" "Returns a dictionary just like :func:`urllib.parse.parse_qs`: keys are the " "field names, each value is a list of values for that field. For non-file " "fields, the value is a list of strings." msgstr "" -#: ../../library/cgi.rst:303 +#: ../../library/cgi.rst:321 msgid "" "This is easy to use but not much good if you are expecting megabytes to be " "uploaded --- in that case, use the :class:`FieldStorage` class instead which " "is much more flexible." msgstr "" -#: ../../library/cgi.rst:307 +#: ../../library/cgi.rst:325 msgid "" "Added the *encoding* and *errors* parameters. For non-file fields, the " "value is now a list of strings, not bytes." msgstr "" -#: ../../library/cgi.rst:311 +#: ../../library/cgi.rst:329 msgid "Added the *separator* parameter." msgstr "新增 *separator* 參數。" -#: ../../library/cgi.rst:317 +#: ../../library/cgi.rst:337 +msgid "" +"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " +"be replaced with the functionality in the :mod:`email` package (e.g. :class:" +"`email.message.EmailMessage`/:class:`email.message.Message`) which " +"implements the same MIME RFCs, or with the `multipart `__ PyPI project." +msgstr "" + +#: ../../library/cgi.rst:342 msgid "" "Parse a MIME header (such as :mailheader:`Content-Type`) into a main value " "and a dictionary of parameters." msgstr "" -#: ../../library/cgi.rst:323 +#: ../../library/cgi.rst:355 +msgid "" +"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " +"be replaced with the functionality in the :mod:`email` package, which " +"implements the same MIME RFCs." +msgstr "" + +#: ../../library/cgi.rst:350 +msgid "For example, with :class:`email.message.EmailMessage`::" +msgstr "" + +#: ../../library/cgi.rst:360 msgid "" "Robust test CGI script, usable as main program. Writes minimal HTTP headers " "and formats all information provided to the script in HTML format." msgstr "" -#: ../../library/cgi.rst:329 +#: ../../library/cgi.rst:366 msgid "Format the shell environment in HTML." msgstr "" -#: ../../library/cgi.rst:334 +#: ../../library/cgi.rst:371 msgid "Format a form in HTML." msgstr "" -#: ../../library/cgi.rst:339 +#: ../../library/cgi.rst:376 msgid "Format the current directory in HTML." msgstr "" -#: ../../library/cgi.rst:344 +#: ../../library/cgi.rst:381 msgid "Print a list of useful (used by CGI) environment variables in HTML." msgstr "" -#: ../../library/cgi.rst:350 +#: ../../library/cgi.rst:387 msgid "Caring about security" msgstr "" -#: ../../library/cgi.rst:354 +#: ../../library/cgi.rst:391 msgid "" "There's one important rule: if you invoke an external program (via :func:`os." "system`, :func:`os.popen` or other functions with similar functionality), " @@ -416,25 +472,25 @@ msgid "" "since the request doesn't have to come from your form!" msgstr "" -#: ../../library/cgi.rst:362 +#: ../../library/cgi.rst:399 msgid "" "To be on the safe side, if you must pass a string gotten from a form to a " "shell command, you should make sure the string contains only alphanumeric " "characters, dashes, underscores, and periods." msgstr "" -#: ../../library/cgi.rst:368 +#: ../../library/cgi.rst:405 msgid "Installing your CGI script on a Unix system" msgstr "" -#: ../../library/cgi.rst:370 +#: ../../library/cgi.rst:407 msgid "" "Read the documentation for your HTTP server and check with your local system " "administrator to find the directory where CGI scripts should be installed; " "usually this is in a directory :file:`cgi-bin` in the server tree." msgstr "" -#: ../../library/cgi.rst:374 +#: ../../library/cgi.rst:411 msgid "" "Make sure that your script is readable and executable by \"others\"; the " "Unix file mode should be ``0o755`` octal (use ``chmod 0755 filename``). " @@ -442,12 +498,12 @@ msgid "" "column 1 followed by the pathname of the Python interpreter, for instance::" msgstr "" -#: ../../library/cgi.rst:381 +#: ../../library/cgi.rst:418 msgid "" "Make sure the Python interpreter exists and is executable by \"others\"." msgstr "" -#: ../../library/cgi.rst:383 +#: ../../library/cgi.rst:420 msgid "" "Make sure that any files your script needs to read or write are readable or " "writable, respectively, by \"others\" --- their mode should be ``0o644`` for " @@ -462,28 +518,28 @@ msgid "" "anything interesting." msgstr "" -#: ../../library/cgi.rst:394 +#: ../../library/cgi.rst:431 msgid "" "If you need to load modules from a directory which is not on Python's " "default module search path, you can change the path in your script, before " "importing other modules. For example::" msgstr "" -#: ../../library/cgi.rst:402 +#: ../../library/cgi.rst:439 msgid "(This way, the directory inserted last will be searched first!)" msgstr "" -#: ../../library/cgi.rst:404 +#: ../../library/cgi.rst:441 msgid "" "Instructions for non-Unix systems will vary; check your HTTP server's " "documentation (it will usually have a section on CGI scripts)." msgstr "" -#: ../../library/cgi.rst:409 +#: ../../library/cgi.rst:446 msgid "Testing your CGI script" msgstr "" -#: ../../library/cgi.rst:411 +#: ../../library/cgi.rst:448 msgid "" "Unfortunately, a CGI script will generally not run when you try it from the " "command line, and a script that works perfectly from the command line may " @@ -493,17 +549,17 @@ msgid "" "will most likely send a cryptic error to the client." msgstr "" -#: ../../library/cgi.rst:418 +#: ../../library/cgi.rst:455 msgid "" "Assuming your script has no syntax errors, yet it does not work, you have no " "choice but to read the next section." msgstr "" -#: ../../library/cgi.rst:423 +#: ../../library/cgi.rst:460 msgid "Debugging CGI scripts" msgstr "" -#: ../../library/cgi.rst:427 +#: ../../library/cgi.rst:464 msgid "" "First of all, check for trivial installation errors --- reading the section " "above on installing your CGI script carefully can save you a lot of time. " @@ -516,7 +572,7 @@ msgid "" "your browser of the form:" msgstr "" -#: ../../library/cgi.rst:440 +#: ../../library/cgi.rst:477 msgid "" "If this gives an error of type 404, the server cannot find the script -- " "perhaps you need to install it in a different directory. If it gives " @@ -528,19 +584,19 @@ msgid "" "same procedure for your own script, you should now be able to debug it." msgstr "" -#: ../../library/cgi.rst:449 +#: ../../library/cgi.rst:486 msgid "" "The next step could be to call the :mod:`cgi` module's :func:`test` function " "from your script: replace its main code with the single statement ::" msgstr "" -#: ../../library/cgi.rst:454 +#: ../../library/cgi.rst:491 msgid "" "This should produce the same results as those gotten from installing the :" "file:`cgi.py` file itself." msgstr "" -#: ../../library/cgi.rst:457 +#: ../../library/cgi.rst:494 msgid "" "When an ordinary Python script raises an unhandled exception (for whatever " "reason: of a typo in a module name, a file that can't be opened, etc.), the " @@ -550,28 +606,28 @@ msgid "" "or be discarded altogether." msgstr "" -#: ../../library/cgi.rst:464 +#: ../../library/cgi.rst:501 msgid "" "Fortunately, once you have managed to get your script to execute *some* " "code, you can easily send tracebacks to the web browser using the :mod:" "`cgitb` module. If you haven't done so already, just add the lines::" msgstr "" -#: ../../library/cgi.rst:471 +#: ../../library/cgi.rst:508 msgid "" "to the top of your script. Then try running it again; when a problem " "occurs, you should see a detailed report that will likely make apparent the " "cause of the crash." msgstr "" -#: ../../library/cgi.rst:475 +#: ../../library/cgi.rst:512 msgid "" "If you suspect that there may be a problem in importing the :mod:`cgitb` " "module, you can use an even more robust approach (which only uses built-in " "modules)::" msgstr "" -#: ../../library/cgi.rst:484 +#: ../../library/cgi.rst:521 msgid "" "This relies on the Python interpreter to print the traceback. The content " "type of the output is set to plain text, which disables all HTML " @@ -581,47 +637,47 @@ msgid "" "interpretation is going on, the traceback will be readable." msgstr "" -#: ../../library/cgi.rst:493 +#: ../../library/cgi.rst:530 msgid "Common problems and solutions" msgstr "" -#: ../../library/cgi.rst:495 +#: ../../library/cgi.rst:532 msgid "" "Most HTTP servers buffer the output from CGI scripts until the script is " "completed. This means that it is not possible to display a progress report " "on the client's display while the script is running." msgstr "" -#: ../../library/cgi.rst:499 +#: ../../library/cgi.rst:536 msgid "Check the installation instructions above." msgstr "" -#: ../../library/cgi.rst:501 +#: ../../library/cgi.rst:538 msgid "" "Check the HTTP server's log files. (``tail -f logfile`` in a separate " "window may be useful!)" msgstr "" -#: ../../library/cgi.rst:504 +#: ../../library/cgi.rst:541 msgid "" "Always check a script for syntax errors first, by doing something like " "``python script.py``." msgstr "" -#: ../../library/cgi.rst:507 +#: ../../library/cgi.rst:544 msgid "" "If your script does not have any syntax errors, try adding ``import cgitb; " "cgitb.enable()`` to the top of the script." msgstr "" -#: ../../library/cgi.rst:510 +#: ../../library/cgi.rst:547 msgid "" "When invoking external programs, make sure they can be found. Usually, this " "means using absolute path names --- :envvar:`PATH` is usually not set to a " "very useful value in a CGI script." msgstr "" -#: ../../library/cgi.rst:514 +#: ../../library/cgi.rst:551 msgid "" "When reading or writing external files, make sure they can be read or " "written by the userid under which your CGI script will be running: this is " @@ -629,17 +685,17 @@ msgid "" "explicitly specified userid for a web server's ``suexec`` feature." msgstr "" -#: ../../library/cgi.rst:519 +#: ../../library/cgi.rst:556 msgid "" "Don't try to give a CGI script a set-uid mode. This doesn't work on most " "systems, and is a security liability as well." msgstr "" -#: ../../library/cgi.rst:523 +#: ../../library/cgi.rst:560 msgid "Footnotes" msgstr "註解" -#: ../../library/cgi.rst:524 +#: ../../library/cgi.rst:561 msgid "" "Note that some recent versions of the HTML specification do state what order " "the field values should be supplied in, but knowing whether a request was " diff --git a/library/cgitb.po b/library/cgitb.po index a57f871d57..b9890b30ee 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:02+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`cgitb` --- CGI 腳本的回溯 (traceback) 管理程式" msgid "**Source code:** :source:`Lib/cgitb.py`" msgstr "**原始碼:**\\ :source:`Lib/cgitb.py`" -#: ../../library/cgitb.rst:19 +#: ../../library/cgitb.rst:22 msgid "" "The :mod:`cgitb` module is deprecated (see :pep:`PEP 594 <594#cgitb>` for " "details)." diff --git a/library/chunk.po b/library/chunk.po index 3dfcee9826..47c3cf71d3 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:03+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`chunk` --- 讀取 IFF 分塊資料" msgid "**Source code:** :source:`Lib/chunk.py`" msgstr "**原始碼:**\\ :source:`Lib/chunk.py`" -#: ../../library/chunk.rst:20 +#: ../../library/chunk.rst:23 msgid "" "The :mod:`chunk` module is deprecated (see :pep:`PEP 594 <594#chunk>` for " "details)." diff --git a/library/cmd.po b/library/cmd.po index 6f5acc2b3a..1ccbbcd028 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-11-05 17:14+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -170,6 +170,13 @@ msgstr "" #: ../../library/cmd.rst:126 msgid "" +"Method called to display a list of strings as a compact set of columns. Each " +"column is only as wide as necessary. Columns are separated by two spaces for " +"readability." +msgstr "" + +#: ../../library/cmd.rst:133 +msgid "" "Hook method executed just before the command line *line* is interpreted, but " "after the input prompt is generated and issued. This method is a stub in :" "class:`Cmd`; it exists to be overridden by subclasses. The return value is " @@ -178,7 +185,7 @@ msgid "" "*line* unchanged." msgstr "" -#: ../../library/cmd.rst:136 +#: ../../library/cmd.rst:143 msgid "" "Hook method executed just after a command dispatch is finished. This method " "is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* " @@ -189,74 +196,74 @@ msgid "" "corresponds to *stop*; returning false will cause interpretation to continue." msgstr "" -#: ../../library/cmd.rst:147 +#: ../../library/cmd.rst:154 msgid "" "Hook method executed once when :meth:`cmdloop` is called. This method is a " "stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: ../../library/cmd.rst:153 +#: ../../library/cmd.rst:160 msgid "" "Hook method executed once when :meth:`cmdloop` is about to return. This " "method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: ../../library/cmd.rst:157 +#: ../../library/cmd.rst:164 msgid "" "Instances of :class:`Cmd` subclasses have some public instance variables:" msgstr "" -#: ../../library/cmd.rst:161 +#: ../../library/cmd.rst:168 msgid "The prompt issued to solicit input." msgstr "" -#: ../../library/cmd.rst:166 +#: ../../library/cmd.rst:173 msgid "The string of characters accepted for the command prefix." msgstr "" -#: ../../library/cmd.rst:171 +#: ../../library/cmd.rst:178 msgid "The last nonempty command prefix seen." msgstr "" -#: ../../library/cmd.rst:176 +#: ../../library/cmd.rst:183 msgid "" "A list of queued input lines. The cmdqueue list is checked in :meth:" "`cmdloop` when new input is needed; if it is nonempty, its elements will be " "processed in order, as if entered at the prompt." msgstr "" -#: ../../library/cmd.rst:183 +#: ../../library/cmd.rst:190 msgid "" "A string to issue as an intro or banner. May be overridden by giving the :" "meth:`cmdloop` method an argument." msgstr "" -#: ../../library/cmd.rst:189 +#: ../../library/cmd.rst:196 msgid "" "The header to issue if the help output has a section for documented commands." msgstr "" -#: ../../library/cmd.rst:194 +#: ../../library/cmd.rst:201 msgid "" "The header to issue if the help output has a section for miscellaneous help " "topics (that is, there are :meth:`help_\\*` methods without corresponding :" "meth:`do_\\*` methods)." msgstr "" -#: ../../library/cmd.rst:201 +#: ../../library/cmd.rst:208 msgid "" "The header to issue if the help output has a section for undocumented " "commands (that is, there are :meth:`do_\\*` methods without corresponding :" "meth:`help_\\*` methods)." msgstr "" -#: ../../library/cmd.rst:208 +#: ../../library/cmd.rst:215 msgid "" "The character used to draw separator lines under the help-message headers. " "If empty, no ruler line is drawn. It defaults to ``'='``." msgstr "" -#: ../../library/cmd.rst:214 +#: ../../library/cmd.rst:221 msgid "" "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " "display a prompt and read the next command; if false, :meth:`sys.stdout." @@ -266,23 +273,23 @@ msgid "" "history keystrokes.)" msgstr "" -#: ../../library/cmd.rst:224 +#: ../../library/cmd.rst:231 msgid "Cmd Example" msgstr "" -#: ../../library/cmd.rst:228 +#: ../../library/cmd.rst:235 msgid "" "The :mod:`cmd` module is mainly useful for building custom shells that let a " "user work with a program interactively." msgstr "" -#: ../../library/cmd.rst:231 +#: ../../library/cmd.rst:238 msgid "" "This section presents a simple example of how to build a shell around a few " "of the commands in the :mod:`turtle` module." msgstr "" -#: ../../library/cmd.rst:234 +#: ../../library/cmd.rst:241 msgid "" "Basic turtle commands such as :meth:`~turtle.forward` are added to a :class:" "`Cmd` subclass with method named :meth:`do_forward`. The argument is " @@ -290,7 +297,7 @@ msgid "" "used in the help utility provided by the shell." msgstr "" -#: ../../library/cmd.rst:239 +#: ../../library/cmd.rst:246 msgid "" "The example also includes a basic record and playback facility implemented " "with the :meth:`~Cmd.precmd` method which is responsible for converting the " @@ -299,7 +306,7 @@ msgid "" "attr:`cmdqueue` for immediate playback::" msgstr "" -#: ../../library/cmd.rst:320 +#: ../../library/cmd.rst:327 msgid "" "Here is a sample session with the turtle shell showing the help functions, " "using blank lines to repeat commands, and the simple record and playback " diff --git a/library/codecs.po b/library/codecs.po index b25e565b5b..0d4281702f 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -248,14 +248,18 @@ msgid "" "It defaults to -1 which means that the default buffer size will be used." msgstr "" -#: ../../library/codecs.rst:210 +#: ../../library/codecs.rst:207 +msgid "The ``'U'`` mode has been removed." +msgstr "" + +#: ../../library/codecs.rst:213 msgid "" "Return a :class:`StreamRecoder` instance, a wrapped version of *file* which " "provides transparent transcoding. The original file is closed when the " "wrapped version is closed." msgstr "" -#: ../../library/codecs.rst:214 +#: ../../library/codecs.rst:217 msgid "" "Data written to the wrapped file is decoded according to the given " "*data_encoding* and then written to the original file as bytes using " @@ -263,18 +267,18 @@ msgid "" "*file_encoding*, and the result is encoded using *data_encoding*." msgstr "" -#: ../../library/codecs.rst:220 +#: ../../library/codecs.rst:223 msgid "If *file_encoding* is not given, it defaults to *data_encoding*." msgstr "" -#: ../../library/codecs.rst:222 +#: ../../library/codecs.rst:225 msgid "" "*errors* may be given to define the error handling. It defaults to " "``'strict'``, which causes :exc:`ValueError` to be raised in case an " "encoding error occurs." msgstr "" -#: ../../library/codecs.rst:229 +#: ../../library/codecs.rst:232 msgid "" "Uses an incremental encoder to iteratively encode the input provided by " "*iterator*. This function is a :term:`generator`. The *errors* argument (as " @@ -282,14 +286,14 @@ msgid "" "encoder." msgstr "" -#: ../../library/codecs.rst:234 +#: ../../library/codecs.rst:237 msgid "" "This function requires that the codec accept text :class:`str` objects to " "encode. Therefore it does not support bytes-to-bytes encoders such as " "``base64_codec``." msgstr "" -#: ../../library/codecs.rst:241 +#: ../../library/codecs.rst:244 msgid "" "Uses an incremental decoder to iteratively decode the input provided by " "*iterator*. This function is a :term:`generator`. The *errors* argument (as " @@ -297,7 +301,7 @@ msgid "" "decoder." msgstr "" -#: ../../library/codecs.rst:246 +#: ../../library/codecs.rst:249 msgid "" "This function requires that the codec accept :class:`bytes` objects to " "decode. Therefore it does not support text-to-text encoders such as " @@ -305,13 +309,13 @@ msgid "" "`iterencode`." msgstr "" -#: ../../library/codecs.rst:252 +#: ../../library/codecs.rst:255 msgid "" "The module also provides the following constants which are useful for " "reading and writing to platform dependent files:" msgstr "" -#: ../../library/codecs.rst:267 +#: ../../library/codecs.rst:270 msgid "" "These constants define various byte sequences, being Unicode byte order " "marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " @@ -323,18 +327,18 @@ msgid "" "represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" -#: ../../library/codecs.rst:281 +#: ../../library/codecs.rst:284 msgid "Codec Base Classes" msgstr "" -#: ../../library/codecs.rst:283 +#: ../../library/codecs.rst:286 msgid "" "The :mod:`codecs` module defines a set of base classes which define the " "interfaces for working with codec objects, and can also be used as the basis " "for custom codec implementations." msgstr "" -#: ../../library/codecs.rst:287 +#: ../../library/codecs.rst:290 msgid "" "Each codec has to define four interfaces to make it usable as codec in " "Python: stateless encoder, stateless decoder, stream reader and stream " @@ -343,69 +347,69 @@ msgid "" "how the codec will handle encoding and decoding errors." msgstr "" -#: ../../library/codecs.rst:298 +#: ../../library/codecs.rst:301 msgid "Error Handlers" msgstr "" -#: ../../library/codecs.rst:300 +#: ../../library/codecs.rst:303 msgid "" "To simplify and standardize error handling, codecs may implement different " "error handling schemes by accepting the *errors* string argument:" msgstr "" -#: ../../library/codecs.rst:320 +#: ../../library/codecs.rst:323 msgid "" "The following error handlers can be used with all Python :ref:`standard-" "encodings` codecs:" msgstr "" -#: ../../library/codecs.rst:326 ../../library/codecs.rst:368 -#: ../../library/codecs.rst:387 +#: ../../library/codecs.rst:329 ../../library/codecs.rst:371 +#: ../../library/codecs.rst:390 msgid "Value" msgstr "" -#: ../../library/codecs.rst:326 ../../library/codecs.rst:368 -#: ../../library/codecs.rst:387 ../../library/codecs.rst:1320 -#: ../../library/codecs.rst:1387 ../../library/codecs.rst:1442 +#: ../../library/codecs.rst:329 ../../library/codecs.rst:371 +#: ../../library/codecs.rst:390 ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1390 ../../library/codecs.rst:1445 msgid "Meaning" msgstr "" -#: ../../library/codecs.rst:328 +#: ../../library/codecs.rst:331 msgid "``'strict'``" msgstr "``'strict'``" -#: ../../library/codecs.rst:328 +#: ../../library/codecs.rst:331 msgid "" "Raise :exc:`UnicodeError` (or a subclass), this is the default. Implemented " "in :func:`strict_errors`." msgstr "" -#: ../../library/codecs.rst:332 +#: ../../library/codecs.rst:335 msgid "``'ignore'``" msgstr "``'ignore'``" -#: ../../library/codecs.rst:332 +#: ../../library/codecs.rst:335 msgid "" "Ignore the malformed data and continue without further notice. Implemented " "in :func:`ignore_errors`." msgstr "" -#: ../../library/codecs.rst:336 +#: ../../library/codecs.rst:339 msgid "``'replace'``" msgstr "``'replace'``" -#: ../../library/codecs.rst:336 +#: ../../library/codecs.rst:339 msgid "" "Replace with a replacement marker. On encoding, use ``?`` (ASCII character). " "On decoding, use ``�`` (U+FFFD, the official REPLACEMENT CHARACTER). " "Implemented in :func:`replace_errors`." msgstr "" -#: ../../library/codecs.rst:342 +#: ../../library/codecs.rst:345 msgid "``'backslashreplace'``" msgstr "``'backslashreplace'``" -#: ../../library/codecs.rst:342 +#: ../../library/codecs.rst:345 msgid "" "Replace with backslashed escape sequences. On encoding, use hexadecimal form " "of Unicode code point with formats ``\\xhh`` ``\\uxxxx`` ``\\Uxxxxxxxx``. On " @@ -413,11 +417,11 @@ msgid "" "Implemented in :func:`backslashreplace_errors`." msgstr "" -#: ../../library/codecs.rst:350 +#: ../../library/codecs.rst:353 msgid "``'surrogateescape'``" msgstr "``'surrogateescape'``" -#: ../../library/codecs.rst:350 +#: ../../library/codecs.rst:353 msgid "" "On decoding, replace byte with individual surrogate code ranging from ``U" "+DC80`` to ``U+DCFF``. This code will then be turned back into the same byte " @@ -425,92 +429,92 @@ msgid "" "(See :pep:`383` for more.)" msgstr "" -#: ../../library/codecs.rst:364 +#: ../../library/codecs.rst:367 msgid "" "The following error handlers are only applicable to encoding (within :term:" "`text encodings `):" msgstr "" -#: ../../library/codecs.rst:370 +#: ../../library/codecs.rst:373 msgid "``'xmlcharrefreplace'``" msgstr "``'xmlcharrefreplace'``" -#: ../../library/codecs.rst:370 +#: ../../library/codecs.rst:373 msgid "" "Replace with XML/HTML numeric character reference, which is a decimal form " "of Unicode code point with format ``&#num;`` Implemented in :func:" "`xmlcharrefreplace_errors`." msgstr "" -#: ../../library/codecs.rst:375 +#: ../../library/codecs.rst:378 msgid "``'namereplace'``" msgstr "``'namereplace'``" -#: ../../library/codecs.rst:375 +#: ../../library/codecs.rst:378 msgid "" "Replace with ``\\N{...}`` escape sequences, what appears in the braces is " "the Name property from Unicode Character Database. Implemented in :func:" "`namereplace_errors`." msgstr "" -#: ../../library/codecs.rst:384 +#: ../../library/codecs.rst:387 msgid "" "In addition, the following error handler is specific to the given codecs:" msgstr "" -#: ../../library/codecs.rst:387 +#: ../../library/codecs.rst:390 msgid "Codecs" msgstr "" -#: ../../library/codecs.rst:389 +#: ../../library/codecs.rst:392 msgid "``'surrogatepass'``" msgstr "``'surrogatepass'``" -#: ../../library/codecs.rst:389 +#: ../../library/codecs.rst:392 msgid "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" msgstr "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" -#: ../../library/codecs.rst:389 +#: ../../library/codecs.rst:392 msgid "" "Allow encoding and decoding surrogate code point (``U+D800`` - ``U+DFFF``) " "as normal code point. Otherwise these codecs treat the presence of surrogate " "code point in :class:`str` as an error." msgstr "" -#: ../../library/codecs.rst:396 +#: ../../library/codecs.rst:399 msgid "The ``'surrogateescape'`` and ``'surrogatepass'`` error handlers." msgstr "" -#: ../../library/codecs.rst:399 +#: ../../library/codecs.rst:402 msgid "" "The ``'surrogatepass'`` error handler now works with utf-16\\* and utf-32\\* " "codecs." msgstr "" -#: ../../library/codecs.rst:403 +#: ../../library/codecs.rst:406 msgid "The ``'namereplace'`` error handler." msgstr "" -#: ../../library/codecs.rst:406 +#: ../../library/codecs.rst:409 msgid "" "The ``'backslashreplace'`` error handler now works with decoding and " "translating." msgstr "" -#: ../../library/codecs.rst:410 +#: ../../library/codecs.rst:413 msgid "" "The set of allowed values can be extended by registering a new named error " "handler:" msgstr "" -#: ../../library/codecs.rst:415 +#: ../../library/codecs.rst:418 msgid "" "Register the error handling function *error_handler* under the name *name*. " "The *error_handler* argument will be called during encoding and decoding in " "case of an error, when *name* is specified as the errors parameter." msgstr "" -#: ../../library/codecs.rst:419 +#: ../../library/codecs.rst:422 msgid "" "For encoding, *error_handler* will be called with a :exc:" "`UnicodeEncodeError` instance, which contains information about the location " @@ -525,66 +529,66 @@ msgid "" "position is out of bound an :exc:`IndexError` will be raised." msgstr "" -#: ../../library/codecs.rst:431 +#: ../../library/codecs.rst:434 msgid "" "Decoding and translating works similarly, except :exc:`UnicodeDecodeError` " "or :exc:`UnicodeTranslateError` will be passed to the handler and that the " "replacement from the error handler will be put into the output directly." msgstr "" -#: ../../library/codecs.rst:436 +#: ../../library/codecs.rst:439 msgid "" "Previously registered error handlers (including the standard error handlers) " "can be looked up by name:" msgstr "" -#: ../../library/codecs.rst:441 +#: ../../library/codecs.rst:444 msgid "Return the error handler previously registered under the name *name*." msgstr "" -#: ../../library/codecs.rst:443 +#: ../../library/codecs.rst:446 msgid "Raises a :exc:`LookupError` in case the handler cannot be found." msgstr "" -#: ../../library/codecs.rst:445 +#: ../../library/codecs.rst:448 msgid "" "The following standard error handlers are also made available as module " "level functions:" msgstr "" -#: ../../library/codecs.rst:450 +#: ../../library/codecs.rst:453 msgid "Implements the ``'strict'`` error handling." msgstr "" -#: ../../library/codecs.rst:452 +#: ../../library/codecs.rst:455 msgid "Each encoding or decoding error raises a :exc:`UnicodeError`." msgstr "" -#: ../../library/codecs.rst:457 +#: ../../library/codecs.rst:460 msgid "Implements the ``'ignore'`` error handling." msgstr "" -#: ../../library/codecs.rst:459 +#: ../../library/codecs.rst:462 msgid "" "Malformed data is ignored; encoding or decoding is continued without further " "notice." msgstr "" -#: ../../library/codecs.rst:465 +#: ../../library/codecs.rst:468 msgid "Implements the ``'replace'`` error handling." msgstr "" -#: ../../library/codecs.rst:467 +#: ../../library/codecs.rst:470 msgid "" "Substitutes ``?`` (ASCII character) for encoding errors or ``�`` (U+FFFD, " "the official REPLACEMENT CHARACTER) for decoding errors." msgstr "" -#: ../../library/codecs.rst:473 +#: ../../library/codecs.rst:476 msgid "Implements the ``'backslashreplace'`` error handling." msgstr "" -#: ../../library/codecs.rst:475 +#: ../../library/codecs.rst:478 msgid "" "Malformed data is replaced by a backslashed escape sequence. On encoding, " "use the hexadecimal form of Unicode code point with formats ``\\xhh`` ``" @@ -592,30 +596,30 @@ msgid "" "value with format ``\\xhh``." msgstr "" -#: ../../library/codecs.rst:480 +#: ../../library/codecs.rst:483 msgid "Works with decoding and translating." msgstr "" -#: ../../library/codecs.rst:486 +#: ../../library/codecs.rst:489 msgid "" "Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :" "term:`text encoding` only)." msgstr "" -#: ../../library/codecs.rst:489 +#: ../../library/codecs.rst:492 msgid "" "The unencodable character is replaced by an appropriate XML/HTML numeric " "character reference, which is a decimal form of Unicode code point with " "format ``&#num;`` ." msgstr "" -#: ../../library/codecs.rst:496 +#: ../../library/codecs.rst:499 msgid "" "Implements the ``'namereplace'`` error handling (for encoding within :term:" "`text encoding` only)." msgstr "" -#: ../../library/codecs.rst:499 +#: ../../library/codecs.rst:502 msgid "" "The unencodable character is replaced by a ``\\N{...}`` escape sequence. The " "set of characters that appear in the braces is the Name property from " @@ -623,17 +627,17 @@ msgid "" "will be converted to byte sequence ``\\N{LATIN SMALL LETTER SHARP S}`` ." msgstr "" -#: ../../library/codecs.rst:510 +#: ../../library/codecs.rst:513 msgid "Stateless Encoding and Decoding" msgstr "" -#: ../../library/codecs.rst:512 +#: ../../library/codecs.rst:515 msgid "" "The base :class:`Codec` class defines these methods which also define the " "function interfaces of the stateless encoder and decoder:" msgstr "" -#: ../../library/codecs.rst:518 +#: ../../library/codecs.rst:521 msgid "" "Encodes the object *input* and returns a tuple (output object, length " "consumed). For instance, :term:`text encoding` converts a string object to a " @@ -641,26 +645,26 @@ msgid "" "``iso-8859-1``)." msgstr "" -#: ../../library/codecs.rst:523 ../../library/codecs.rst:545 +#: ../../library/codecs.rst:526 ../../library/codecs.rst:548 msgid "" "The *errors* argument defines the error handling to apply. It defaults to " "``'strict'`` handling." msgstr "" -#: ../../library/codecs.rst:526 +#: ../../library/codecs.rst:529 msgid "" "The method may not store state in the :class:`Codec` instance. Use :class:" "`StreamWriter` for codecs which have to keep state in order to make encoding " "efficient." msgstr "" -#: ../../library/codecs.rst:530 +#: ../../library/codecs.rst:533 msgid "" "The encoder must be able to handle zero length input and return an empty " "object of the output object type in this situation." msgstr "" -#: ../../library/codecs.rst:536 +#: ../../library/codecs.rst:539 msgid "" "Decodes the object *input* and returns a tuple (output object, length " "consumed). For instance, for a :term:`text encoding`, decoding converts a " @@ -668,31 +672,31 @@ msgid "" "object." msgstr "" -#: ../../library/codecs.rst:541 +#: ../../library/codecs.rst:544 msgid "" "For text encodings and bytes-to-bytes codecs, *input* must be a bytes object " "or one which provides the read-only buffer interface -- for example, buffer " "objects and memory mapped files." msgstr "" -#: ../../library/codecs.rst:548 +#: ../../library/codecs.rst:551 msgid "" "The method may not store state in the :class:`Codec` instance. Use :class:" "`StreamReader` for codecs which have to keep state in order to make decoding " "efficient." msgstr "" -#: ../../library/codecs.rst:552 +#: ../../library/codecs.rst:555 msgid "" "The decoder must be able to handle zero length input and return an empty " "object of the output object type in this situation." msgstr "" -#: ../../library/codecs.rst:557 +#: ../../library/codecs.rst:560 msgid "Incremental Encoding and Decoding" msgstr "" -#: ../../library/codecs.rst:559 +#: ../../library/codecs.rst:562 msgid "" "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " "provide the basic interface for incremental encoding and decoding. Encoding/" @@ -703,7 +707,7 @@ msgid "" "during method calls." msgstr "" -#: ../../library/codecs.rst:567 +#: ../../library/codecs.rst:570 msgid "" "The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:" "`~IncrementalDecoder.decode` method is the same as if all the single inputs " @@ -711,36 +715,36 @@ msgid "" "encoder/decoder." msgstr "" -#: ../../library/codecs.rst:576 +#: ../../library/codecs.rst:579 msgid "IncrementalEncoder Objects" msgstr "IncrementalEncoder 物件" -#: ../../library/codecs.rst:578 +#: ../../library/codecs.rst:581 msgid "" "The :class:`IncrementalEncoder` class is used for encoding an input in " "multiple steps. It defines the following methods which every incremental " "encoder must define in order to be compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:585 +#: ../../library/codecs.rst:588 msgid "Constructor for an :class:`IncrementalEncoder` instance." msgstr "" -#: ../../library/codecs.rst:587 +#: ../../library/codecs.rst:590 msgid "" "All incremental encoders must provide this constructor interface. They are " "free to add additional keyword arguments, but only the ones defined here are " "used by the Python codec registry." msgstr "" -#: ../../library/codecs.rst:591 +#: ../../library/codecs.rst:594 msgid "" "The :class:`IncrementalEncoder` may implement different error handling " "schemes by providing the *errors* keyword argument. See :ref:`error-" "handlers` for possible values." msgstr "" -#: ../../library/codecs.rst:595 +#: ../../library/codecs.rst:598 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -748,21 +752,21 @@ msgid "" "`IncrementalEncoder` object." msgstr "" -#: ../../library/codecs.rst:603 +#: ../../library/codecs.rst:606 msgid "" "Encodes *object* (taking the current state of the encoder into account) and " "returns the resulting encoded object. If this is the last call to :meth:" "`encode` *final* must be true (the default is false)." msgstr "" -#: ../../library/codecs.rst:610 +#: ../../library/codecs.rst:613 msgid "" "Reset the encoder to the initial state. The output is discarded: call ``." "encode(object, final=True)``, passing an empty byte or text string if " "necessary, to reset the encoder and to get the output." msgstr "" -#: ../../library/codecs.rst:617 +#: ../../library/codecs.rst:620 msgid "" "Return the current state of the encoder which must be an integer. The " "implementation should make sure that ``0`` is the most common state. (States " @@ -771,42 +775,42 @@ msgid "" "into an integer.)" msgstr "" -#: ../../library/codecs.rst:626 +#: ../../library/codecs.rst:629 msgid "" "Set the state of the encoder to *state*. *state* must be an encoder state " "returned by :meth:`getstate`." msgstr "" -#: ../../library/codecs.rst:633 +#: ../../library/codecs.rst:636 msgid "IncrementalDecoder Objects" msgstr "IncrementalDecoder 物件" -#: ../../library/codecs.rst:635 +#: ../../library/codecs.rst:638 msgid "" "The :class:`IncrementalDecoder` class is used for decoding an input in " "multiple steps. It defines the following methods which every incremental " "decoder must define in order to be compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:642 +#: ../../library/codecs.rst:645 msgid "Constructor for an :class:`IncrementalDecoder` instance." msgstr "" -#: ../../library/codecs.rst:644 +#: ../../library/codecs.rst:647 msgid "" "All incremental decoders must provide this constructor interface. They are " "free to add additional keyword arguments, but only the ones defined here are " "used by the Python codec registry." msgstr "" -#: ../../library/codecs.rst:648 +#: ../../library/codecs.rst:651 msgid "" "The :class:`IncrementalDecoder` may implement different error handling " "schemes by providing the *errors* keyword argument. See :ref:`error-" "handlers` for possible values." msgstr "" -#: ../../library/codecs.rst:652 +#: ../../library/codecs.rst:655 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -814,7 +818,7 @@ msgid "" "`IncrementalDecoder` object." msgstr "" -#: ../../library/codecs.rst:660 +#: ../../library/codecs.rst:663 msgid "" "Decodes *object* (taking the current state of the decoder into account) and " "returns the resulting decoded object. If this is the last call to :meth:" @@ -825,11 +829,11 @@ msgid "" "(which might raise an exception)." msgstr "" -#: ../../library/codecs.rst:671 +#: ../../library/codecs.rst:674 msgid "Reset the decoder to the initial state." msgstr "" -#: ../../library/codecs.rst:676 +#: ../../library/codecs.rst:679 msgid "" "Return the current state of the decoder. This must be a tuple with two " "items, the first must be the buffer containing the still undecoded input. " @@ -844,59 +848,59 @@ msgid "" "bytes of the resulting string into an integer.)" msgstr "" -#: ../../library/codecs.rst:691 +#: ../../library/codecs.rst:694 msgid "" "Set the state of the decoder to *state*. *state* must be a decoder state " "returned by :meth:`getstate`." msgstr "" -#: ../../library/codecs.rst:696 +#: ../../library/codecs.rst:699 msgid "Stream Encoding and Decoding" msgstr "" -#: ../../library/codecs.rst:699 +#: ../../library/codecs.rst:702 msgid "" "The :class:`StreamWriter` and :class:`StreamReader` classes provide generic " "working interfaces which can be used to implement new encoding submodules " "very easily. See :mod:`encodings.utf_8` for an example of how this is done." msgstr "" -#: ../../library/codecs.rst:707 +#: ../../library/codecs.rst:710 msgid "StreamWriter Objects" msgstr "StreamWriter 物件" -#: ../../library/codecs.rst:709 +#: ../../library/codecs.rst:712 msgid "" "The :class:`StreamWriter` class is a subclass of :class:`Codec` and defines " "the following methods which every stream writer must define in order to be " "compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:716 +#: ../../library/codecs.rst:719 msgid "Constructor for a :class:`StreamWriter` instance." msgstr "" -#: ../../library/codecs.rst:718 +#: ../../library/codecs.rst:721 msgid "" "All stream writers must provide this constructor interface. They are free to " "add additional keyword arguments, but only the ones defined here are used by " "the Python codec registry." msgstr "" -#: ../../library/codecs.rst:722 +#: ../../library/codecs.rst:725 msgid "" "The *stream* argument must be a file-like object open for writing text or " "binary data, as appropriate for the specific codec." msgstr "" -#: ../../library/codecs.rst:725 +#: ../../library/codecs.rst:728 msgid "" "The :class:`StreamWriter` may implement different error handling schemes by " "providing the *errors* keyword argument. See :ref:`error-handlers` for the " "standard error handlers the underlying stream codec may support." msgstr "" -#: ../../library/codecs.rst:729 +#: ../../library/codecs.rst:732 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -904,70 +908,70 @@ msgid "" "object." msgstr "" -#: ../../library/codecs.rst:735 +#: ../../library/codecs.rst:738 msgid "Writes the object's contents encoded to the stream." msgstr "" -#: ../../library/codecs.rst:740 +#: ../../library/codecs.rst:743 msgid "" "Writes the concatenated iterable of strings to the stream (possibly by " "reusing the :meth:`write` method). Infinite or very large iterables are not " "supported. The standard bytes-to-bytes codecs do not support this method." msgstr "" -#: ../../library/codecs.rst:748 ../../library/codecs.rst:843 +#: ../../library/codecs.rst:751 ../../library/codecs.rst:846 msgid "Resets the codec buffers used for keeping internal state." msgstr "" -#: ../../library/codecs.rst:750 +#: ../../library/codecs.rst:753 msgid "" "Calling this method should ensure that the data on the output is put into a " "clean state that allows appending of new fresh data without having to rescan " "the whole stream to recover state." msgstr "" -#: ../../library/codecs.rst:755 +#: ../../library/codecs.rst:758 msgid "" "In addition to the above methods, the :class:`StreamWriter` must also " "inherit all other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:762 +#: ../../library/codecs.rst:765 msgid "StreamReader Objects" msgstr "StreamReader 物件" -#: ../../library/codecs.rst:764 +#: ../../library/codecs.rst:767 msgid "" "The :class:`StreamReader` class is a subclass of :class:`Codec` and defines " "the following methods which every stream reader must define in order to be " "compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:771 +#: ../../library/codecs.rst:774 msgid "Constructor for a :class:`StreamReader` instance." msgstr "" -#: ../../library/codecs.rst:773 +#: ../../library/codecs.rst:776 msgid "" "All stream readers must provide this constructor interface. They are free to " "add additional keyword arguments, but only the ones defined here are used by " "the Python codec registry." msgstr "" -#: ../../library/codecs.rst:777 +#: ../../library/codecs.rst:780 msgid "" "The *stream* argument must be a file-like object open for reading text or " "binary data, as appropriate for the specific codec." msgstr "" -#: ../../library/codecs.rst:780 +#: ../../library/codecs.rst:783 msgid "" "The :class:`StreamReader` may implement different error handling schemes by " "providing the *errors* keyword argument. See :ref:`error-handlers` for the " "standard error handlers the underlying stream codec may support." msgstr "" -#: ../../library/codecs.rst:784 +#: ../../library/codecs.rst:787 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -975,24 +979,24 @@ msgid "" "object." msgstr "" -#: ../../library/codecs.rst:788 +#: ../../library/codecs.rst:791 msgid "" "The set of allowed values for the *errors* argument can be extended with :" "func:`register_error`." msgstr "" -#: ../../library/codecs.rst:794 +#: ../../library/codecs.rst:797 msgid "Decodes data from the stream and returns the resulting object." msgstr "" -#: ../../library/codecs.rst:796 +#: ../../library/codecs.rst:799 msgid "" "The *chars* argument indicates the number of decoded code points or bytes to " "return. The :func:`read` method will never return more data than requested, " "but it might return less, if there is not enough available." msgstr "" -#: ../../library/codecs.rst:801 +#: ../../library/codecs.rst:804 msgid "" "The *size* argument indicates the approximate maximum number of encoded " "bytes or code points to read for decoding. The decoder can modify this " @@ -1001,13 +1005,13 @@ msgid "" "huge files in one step." msgstr "" -#: ../../library/codecs.rst:808 +#: ../../library/codecs.rst:811 msgid "" "The *firstline* flag indicates that it would be sufficient to only return " "the first line, if there are decoding errors on later lines." msgstr "" -#: ../../library/codecs.rst:812 +#: ../../library/codecs.rst:815 msgid "" "The method should use a greedy read strategy meaning that it should read as " "much data as is allowed within the definition of the encoding and the given " @@ -1015,68 +1019,68 @@ msgid "" "the stream, these should be read too." msgstr "" -#: ../../library/codecs.rst:820 +#: ../../library/codecs.rst:823 msgid "Read one line from the input stream and return the decoded data." msgstr "" -#: ../../library/codecs.rst:822 +#: ../../library/codecs.rst:825 msgid "" "*size*, if given, is passed as size argument to the stream's :meth:`read` " "method." msgstr "" -#: ../../library/codecs.rst:825 +#: ../../library/codecs.rst:828 msgid "" "If *keepends* is false line-endings will be stripped from the lines returned." msgstr "" -#: ../../library/codecs.rst:831 +#: ../../library/codecs.rst:834 msgid "" "Read all lines available on the input stream and return them as a list of " "lines." msgstr "" -#: ../../library/codecs.rst:834 +#: ../../library/codecs.rst:837 msgid "" "Line-endings are implemented using the codec's :meth:`decode` method and are " "included in the list entries if *keepends* is true." msgstr "" -#: ../../library/codecs.rst:837 +#: ../../library/codecs.rst:840 msgid "" "*sizehint*, if given, is passed as the *size* argument to the stream's :meth:" "`read` method." msgstr "" -#: ../../library/codecs.rst:845 +#: ../../library/codecs.rst:848 msgid "" "Note that no stream repositioning should take place. This method is " "primarily intended to be able to recover from decoding errors." msgstr "" -#: ../../library/codecs.rst:849 +#: ../../library/codecs.rst:852 msgid "" "In addition to the above methods, the :class:`StreamReader` must also " "inherit all other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:855 +#: ../../library/codecs.rst:858 msgid "StreamReaderWriter Objects" msgstr "StreamReaderWriter 物件" -#: ../../library/codecs.rst:857 +#: ../../library/codecs.rst:860 msgid "" "The :class:`StreamReaderWriter` is a convenience class that allows wrapping " "streams which work in both read and write modes." msgstr "" -#: ../../library/codecs.rst:860 ../../library/codecs.rst:884 +#: ../../library/codecs.rst:863 ../../library/codecs.rst:887 msgid "" "The design is such that one can use the factory functions returned by the :" "func:`lookup` function to construct the instance." msgstr "" -#: ../../library/codecs.rst:866 +#: ../../library/codecs.rst:869 msgid "" "Creates a :class:`StreamReaderWriter` instance. *stream* must be a file-like " "object. *Reader* and *Writer* must be factory functions or classes providing " @@ -1085,24 +1089,24 @@ msgid "" "writers." msgstr "" -#: ../../library/codecs.rst:871 +#: ../../library/codecs.rst:874 msgid "" ":class:`StreamReaderWriter` instances define the combined interfaces of :" "class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " "other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:879 +#: ../../library/codecs.rst:882 msgid "StreamRecoder Objects" msgstr "StreamRecoder 物件" -#: ../../library/codecs.rst:881 +#: ../../library/codecs.rst:884 msgid "" "The :class:`StreamRecoder` translates data from one encoding to another, " "which is sometimes useful when dealing with different encoding environments." msgstr "" -#: ../../library/codecs.rst:890 +#: ../../library/codecs.rst:893 msgid "" "Creates a :class:`StreamRecoder` instance which implements a two-way " "conversion: *encode* and *decode* work on the frontend — the data visible to " @@ -1110,17 +1114,17 @@ msgid "" "work on the backend — the data in *stream*." msgstr "" -#: ../../library/codecs.rst:895 +#: ../../library/codecs.rst:898 msgid "" "You can use these objects to do transparent transcodings, e.g., from Latin-1 " "to UTF-8 and back." msgstr "" -#: ../../library/codecs.rst:898 +#: ../../library/codecs.rst:901 msgid "The *stream* argument must be a file-like object." msgstr "" -#: ../../library/codecs.rst:900 +#: ../../library/codecs.rst:903 msgid "" "The *encode* and *decode* arguments must adhere to the :class:`Codec` " "interface. *Reader* and *Writer* must be factory functions or classes " @@ -1128,24 +1132,24 @@ msgid "" "interface respectively." msgstr "" -#: ../../library/codecs.rst:905 +#: ../../library/codecs.rst:908 msgid "" "Error handling is done in the same way as defined for the stream readers and " "writers." msgstr "" -#: ../../library/codecs.rst:909 +#: ../../library/codecs.rst:912 msgid "" ":class:`StreamRecoder` instances define the combined interfaces of :class:" "`StreamReader` and :class:`StreamWriter` classes. They inherit all other " "methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:917 +#: ../../library/codecs.rst:920 msgid "Encodings and Unicode" msgstr "" -#: ../../library/codecs.rst:919 +#: ../../library/codecs.rst:922 msgid "" "Strings are stored internally as sequences of code points in range ``U" "+0000``--``U+10FFFF``. (See :pep:`393` for more details about the " @@ -1157,7 +1161,7 @@ msgid "" "which are collectivity referred to as :term:`text encodings `." msgstr "" -#: ../../library/codecs.rst:929 +#: ../../library/codecs.rst:932 msgid "" "The simplest text encoding (called ``'latin-1'`` or ``'iso-8859-1'``) maps " "the code points 0--255 to the bytes ``0x0``--``0xff``, which means that a " @@ -1168,7 +1172,7 @@ msgid "" "position 3: ordinal not in range(256)``." msgstr "" -#: ../../library/codecs.rst:937 +#: ../../library/codecs.rst:940 msgid "" "There's another group of encodings (the so called charmap encodings) that " "choose a different subset of all Unicode code points and how these code " @@ -1178,7 +1182,7 @@ msgid "" "that shows you which character is mapped to which byte value." msgstr "" -#: ../../library/codecs.rst:944 +#: ../../library/codecs.rst:947 msgid "" "All of these encodings can only encode 256 of the 1114112 code points " "defined in Unicode. A simple and straightforward way that can store each " @@ -1208,7 +1212,7 @@ msgid "" "normal character that will be decoded like any other." msgstr "" -#: ../../library/codecs.rst:970 +#: ../../library/codecs.rst:973 msgid "" "There's another encoding that is able to encode the full range of Unicode " "characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no " @@ -1219,59 +1223,59 @@ msgid "" "which when concatenated give the Unicode character):" msgstr "" -#: ../../library/codecs.rst:979 +#: ../../library/codecs.rst:982 msgid "Range" msgstr "" -#: ../../library/codecs.rst:979 +#: ../../library/codecs.rst:982 msgid "Encoding" msgstr "" -#: ../../library/codecs.rst:981 +#: ../../library/codecs.rst:984 msgid "``U-00000000`` ... ``U-0000007F``" msgstr "``U-00000000`` ... ``U-0000007F``" -#: ../../library/codecs.rst:981 +#: ../../library/codecs.rst:984 msgid "0xxxxxxx" msgstr "0xxxxxxx" -#: ../../library/codecs.rst:983 +#: ../../library/codecs.rst:986 msgid "``U-00000080`` ... ``U-000007FF``" msgstr "``U-00000080`` ... ``U-000007FF``" -#: ../../library/codecs.rst:983 +#: ../../library/codecs.rst:986 msgid "110xxxxx 10xxxxxx" msgstr "110xxxxx 10xxxxxx" -#: ../../library/codecs.rst:985 +#: ../../library/codecs.rst:988 msgid "``U-00000800`` ... ``U-0000FFFF``" msgstr "``U-00000800`` ... ``U-0000FFFF``" -#: ../../library/codecs.rst:985 +#: ../../library/codecs.rst:988 msgid "1110xxxx 10xxxxxx 10xxxxxx" msgstr "1110xxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:987 +#: ../../library/codecs.rst:990 msgid "``U-00010000`` ... ``U-0010FFFF``" msgstr "``U-00010000`` ... ``U-0010FFFF``" -#: ../../library/codecs.rst:987 +#: ../../library/codecs.rst:990 msgid "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" msgstr "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:990 +#: ../../library/codecs.rst:993 msgid "" "The least significant bit of the Unicode character is the rightmost x bit." msgstr "" -#: ../../library/codecs.rst:992 +#: ../../library/codecs.rst:995 msgid "" "As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` " "character in the decoded string (even if it's the first character) is " "treated as a ``ZERO WIDTH NO-BREAK SPACE``." msgstr "" -#: ../../library/codecs.rst:996 +#: ../../library/codecs.rst:999 msgid "" "Without external information it's impossible to reliably determine which " "encoding was used for encoding a string. Each charmap encoding can decode " @@ -1297,7 +1301,7 @@ msgstr "" msgid "INVERTED QUESTION MARK" msgstr "" -#: ../../library/codecs.rst:1012 +#: ../../library/codecs.rst:1015 msgid "" "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " "can be correctly guessed from the byte sequence. So here the BOM is not used " @@ -1309,11 +1313,11 @@ msgid "" "the use of the BOM is discouraged and should generally be avoided." msgstr "" -#: ../../library/codecs.rst:1025 +#: ../../library/codecs.rst:1028 msgid "Standard Encodings" msgstr "" -#: ../../library/codecs.rst:1027 +#: ../../library/codecs.rst:1030 msgid "" "Python comes with a number of codecs built-in, either implemented as C " "functions or with dictionaries as mapping tables. The following table lists " @@ -1325,7 +1329,7 @@ msgid "" "alias for the ``'utf_8'`` codec." msgstr "" -#: ../../library/codecs.rst:1037 +#: ../../library/codecs.rst:1040 msgid "" "Some common encodings can bypass the codecs lookup machinery to improve " "performance. These optimization opportunities are only recognized by CPython " @@ -1335,11 +1339,11 @@ msgid "" "Using alternative aliases for these encodings may result in slower execution." msgstr "" -#: ../../library/codecs.rst:1045 +#: ../../library/codecs.rst:1048 msgid "Optimization opportunity recognized for us-ascii." msgstr "" -#: ../../library/codecs.rst:1048 +#: ../../library/codecs.rst:1051 msgid "" "Many of the character sets support the same languages. They vary in " "individual characters (e.g. whether the EURO SIGN is supported or not), and " @@ -1347,504 +1351,504 @@ msgid "" "languages in particular, the following variants typically exist:" msgstr "" -#: ../../library/codecs.rst:1053 +#: ../../library/codecs.rst:1056 msgid "an ISO 8859 codeset" msgstr "" -#: ../../library/codecs.rst:1055 +#: ../../library/codecs.rst:1058 msgid "" "a Microsoft Windows code page, which is typically derived from an 8859 " "codeset, but replaces control characters with additional graphic characters" msgstr "" -#: ../../library/codecs.rst:1058 +#: ../../library/codecs.rst:1061 msgid "an IBM EBCDIC code page" msgstr "" -#: ../../library/codecs.rst:1060 +#: ../../library/codecs.rst:1063 msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: ../../library/codecs.rst:1065 ../../library/codecs.rst:1320 -#: ../../library/codecs.rst:1387 ../../library/codecs.rst:1442 +#: ../../library/codecs.rst:1068 ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1390 ../../library/codecs.rst:1445 msgid "Codec" msgstr "" -#: ../../library/codecs.rst:1065 ../../library/codecs.rst:1320 -#: ../../library/codecs.rst:1387 ../../library/codecs.rst:1442 +#: ../../library/codecs.rst:1068 ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1390 ../../library/codecs.rst:1445 msgid "Aliases" msgstr "" -#: ../../library/codecs.rst:1065 +#: ../../library/codecs.rst:1068 msgid "Languages" msgstr "語言" -#: ../../library/codecs.rst:1067 +#: ../../library/codecs.rst:1070 msgid "ascii" msgstr "ascii" -#: ../../library/codecs.rst:1067 +#: ../../library/codecs.rst:1070 msgid "646, us-ascii" msgstr "646, us-ascii" -#: ../../library/codecs.rst:1067 ../../library/codecs.rst:1073 -#: ../../library/codecs.rst:1081 +#: ../../library/codecs.rst:1070 ../../library/codecs.rst:1076 +#: ../../library/codecs.rst:1084 msgid "English" msgstr "英文" -#: ../../library/codecs.rst:1069 +#: ../../library/codecs.rst:1072 msgid "big5" msgstr "big5" -#: ../../library/codecs.rst:1069 +#: ../../library/codecs.rst:1072 msgid "big5-tw, csbig5" msgstr "big5-tw, csbig5" -#: ../../library/codecs.rst:1069 ../../library/codecs.rst:1071 -#: ../../library/codecs.rst:1129 +#: ../../library/codecs.rst:1072 ../../library/codecs.rst:1074 +#: ../../library/codecs.rst:1132 msgid "Traditional Chinese" msgstr "繁體中文" -#: ../../library/codecs.rst:1071 +#: ../../library/codecs.rst:1074 msgid "big5hkscs" msgstr "big5hkscs" -#: ../../library/codecs.rst:1071 +#: ../../library/codecs.rst:1074 msgid "big5-hkscs, hkscs" msgstr "big5-hkscs, hkscs" -#: ../../library/codecs.rst:1073 +#: ../../library/codecs.rst:1076 msgid "cp037" msgstr "cp037" -#: ../../library/codecs.rst:1073 +#: ../../library/codecs.rst:1076 msgid "IBM037, IBM039" msgstr "IBM037, IBM039" -#: ../../library/codecs.rst:1075 +#: ../../library/codecs.rst:1078 msgid "cp273" msgstr "cp273" -#: ../../library/codecs.rst:1075 +#: ../../library/codecs.rst:1078 msgid "273, IBM273, csIBM273" msgstr "273, IBM273, csIBM273" -#: ../../library/codecs.rst:1075 +#: ../../library/codecs.rst:1078 msgid "German" msgstr "德文" -#: ../../library/codecs.rst:1079 +#: ../../library/codecs.rst:1082 msgid "cp424" msgstr "cp424" -#: ../../library/codecs.rst:1079 +#: ../../library/codecs.rst:1082 msgid "EBCDIC-CP-HE, IBM424" msgstr "EBCDIC-CP-HE, IBM424" -#: ../../library/codecs.rst:1079 ../../library/codecs.rst:1099 -#: ../../library/codecs.rst:1109 ../../library/codecs.rst:1152 -#: ../../library/codecs.rst:1215 +#: ../../library/codecs.rst:1082 ../../library/codecs.rst:1102 +#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1155 +#: ../../library/codecs.rst:1218 msgid "Hebrew" msgstr "希伯來文" -#: ../../library/codecs.rst:1081 +#: ../../library/codecs.rst:1084 msgid "cp437" msgstr "cp437" -#: ../../library/codecs.rst:1081 +#: ../../library/codecs.rst:1084 msgid "437, IBM437" msgstr "437, IBM437" -#: ../../library/codecs.rst:1083 +#: ../../library/codecs.rst:1086 msgid "cp500" msgstr "cp500" -#: ../../library/codecs.rst:1083 +#: ../../library/codecs.rst:1086 msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" -#: ../../library/codecs.rst:1083 ../../library/codecs.rst:1092 -#: ../../library/codecs.rst:1103 ../../library/codecs.rst:1139 -#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1199 -#: ../../library/codecs.rst:1227 ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1086 ../../library/codecs.rst:1095 +#: ../../library/codecs.rst:1106 ../../library/codecs.rst:1142 +#: ../../library/codecs.rst:1149 ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1230 ../../library/codecs.rst:1258 msgid "Western Europe" msgstr "" -#: ../../library/codecs.rst:1086 +#: ../../library/codecs.rst:1089 msgid "cp720" msgstr "cp720" -#: ../../library/codecs.rst:1086 ../../library/codecs.rst:1113 -#: ../../library/codecs.rst:1154 ../../library/codecs.rst:1211 +#: ../../library/codecs.rst:1089 ../../library/codecs.rst:1116 +#: ../../library/codecs.rst:1157 ../../library/codecs.rst:1214 msgid "Arabic" msgstr "阿拉伯文" -#: ../../library/codecs.rst:1088 +#: ../../library/codecs.rst:1091 msgid "cp737" msgstr "cp737" -#: ../../library/codecs.rst:1088 ../../library/codecs.rst:1119 -#: ../../library/codecs.rst:1123 ../../library/codecs.rst:1148 -#: ../../library/codecs.rst:1213 ../../library/codecs.rst:1248 +#: ../../library/codecs.rst:1091 ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1126 ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1216 ../../library/codecs.rst:1251 msgid "Greek" msgstr "希臘文" -#: ../../library/codecs.rst:1090 +#: ../../library/codecs.rst:1093 msgid "cp775" msgstr "cp775" -#: ../../library/codecs.rst:1090 +#: ../../library/codecs.rst:1093 msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1090 ../../library/codecs.rst:1156 -#: ../../library/codecs.rst:1206 ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1093 ../../library/codecs.rst:1159 +#: ../../library/codecs.rst:1209 ../../library/codecs.rst:1226 msgid "Baltic languages" msgstr "" -#: ../../library/codecs.rst:1092 +#: ../../library/codecs.rst:1095 msgid "cp850" msgstr "cp850" -#: ../../library/codecs.rst:1092 +#: ../../library/codecs.rst:1095 msgid "850, IBM850" msgstr "850, IBM850" -#: ../../library/codecs.rst:1094 +#: ../../library/codecs.rst:1097 msgid "cp852" msgstr "cp852" -#: ../../library/codecs.rst:1094 +#: ../../library/codecs.rst:1097 msgid "852, IBM852" msgstr "852, IBM852" -#: ../../library/codecs.rst:1094 ../../library/codecs.rst:1141 -#: ../../library/codecs.rst:1202 ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1097 ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1205 ../../library/codecs.rst:1255 msgid "Central and Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1096 +#: ../../library/codecs.rst:1099 msgid "cp855" msgstr "cp855" -#: ../../library/codecs.rst:1096 +#: ../../library/codecs.rst:1099 msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1096 ../../library/codecs.rst:1143 -#: ../../library/codecs.rst:1208 ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1099 ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1211 ../../library/codecs.rst:1248 msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" msgstr "" -#: ../../library/codecs.rst:1099 +#: ../../library/codecs.rst:1102 msgid "cp856" msgstr "cp856" -#: ../../library/codecs.rst:1101 +#: ../../library/codecs.rst:1104 msgid "cp857" msgstr "cp857" -#: ../../library/codecs.rst:1101 +#: ../../library/codecs.rst:1104 msgid "857, IBM857" msgstr "857, IBM857" -#: ../../library/codecs.rst:1101 ../../library/codecs.rst:1133 -#: ../../library/codecs.rst:1150 ../../library/codecs.rst:1217 -#: ../../library/codecs.rst:1257 +#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1136 +#: ../../library/codecs.rst:1153 ../../library/codecs.rst:1220 +#: ../../library/codecs.rst:1260 msgid "Turkish" msgstr "土耳其文" -#: ../../library/codecs.rst:1103 +#: ../../library/codecs.rst:1106 msgid "cp858" msgstr "cp858" -#: ../../library/codecs.rst:1103 +#: ../../library/codecs.rst:1106 msgid "858, IBM858" msgstr "858, IBM858" -#: ../../library/codecs.rst:1105 +#: ../../library/codecs.rst:1108 msgid "cp860" msgstr "cp860" -#: ../../library/codecs.rst:1105 +#: ../../library/codecs.rst:1108 msgid "860, IBM860" msgstr "860, IBM860" -#: ../../library/codecs.rst:1105 +#: ../../library/codecs.rst:1108 msgid "Portuguese" msgstr "" -#: ../../library/codecs.rst:1107 +#: ../../library/codecs.rst:1110 msgid "cp861" msgstr "cp861" -#: ../../library/codecs.rst:1107 +#: ../../library/codecs.rst:1110 msgid "861, CP-IS, IBM861" msgstr "861, CP-IS, IBM861" -#: ../../library/codecs.rst:1107 ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1110 ../../library/codecs.rst:1253 msgid "Icelandic" msgstr "" -#: ../../library/codecs.rst:1109 +#: ../../library/codecs.rst:1112 msgid "cp862" msgstr "cp862" -#: ../../library/codecs.rst:1109 +#: ../../library/codecs.rst:1112 msgid "862, IBM862" msgstr "862, IBM862" -#: ../../library/codecs.rst:1111 +#: ../../library/codecs.rst:1114 msgid "cp863" msgstr "cp863" -#: ../../library/codecs.rst:1111 +#: ../../library/codecs.rst:1114 msgid "863, IBM863" msgstr "863, IBM863" -#: ../../library/codecs.rst:1111 +#: ../../library/codecs.rst:1114 msgid "Canadian" msgstr "" -#: ../../library/codecs.rst:1113 +#: ../../library/codecs.rst:1116 msgid "cp864" msgstr "cp864" -#: ../../library/codecs.rst:1113 +#: ../../library/codecs.rst:1116 msgid "IBM864" msgstr "IBM864" -#: ../../library/codecs.rst:1115 +#: ../../library/codecs.rst:1118 msgid "cp865" msgstr "cp865" -#: ../../library/codecs.rst:1115 +#: ../../library/codecs.rst:1118 msgid "865, IBM865" msgstr "865, IBM865" -#: ../../library/codecs.rst:1115 +#: ../../library/codecs.rst:1118 msgid "Danish, Norwegian" msgstr "" -#: ../../library/codecs.rst:1117 +#: ../../library/codecs.rst:1120 msgid "cp866" msgstr "cp866" -#: ../../library/codecs.rst:1117 +#: ../../library/codecs.rst:1120 msgid "866, IBM866" msgstr "866, IBM866" -#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1120 ../../library/codecs.rst:1236 msgid "Russian" msgstr "俄羅斯文" -#: ../../library/codecs.rst:1119 +#: ../../library/codecs.rst:1122 msgid "cp869" msgstr "cp869" -#: ../../library/codecs.rst:1119 +#: ../../library/codecs.rst:1122 msgid "869, CP-GR, IBM869" msgstr "869, CP-GR, IBM869" -#: ../../library/codecs.rst:1121 +#: ../../library/codecs.rst:1124 msgid "cp874" msgstr "cp874" -#: ../../library/codecs.rst:1121 +#: ../../library/codecs.rst:1124 msgid "Thai" msgstr "泰文" -#: ../../library/codecs.rst:1123 +#: ../../library/codecs.rst:1126 msgid "cp875" msgstr "cp875" -#: ../../library/codecs.rst:1125 +#: ../../library/codecs.rst:1128 msgid "cp932" msgstr "cp932" -#: ../../library/codecs.rst:1125 +#: ../../library/codecs.rst:1128 msgid "932, ms932, mskanji, ms-kanji" msgstr "932, ms932, mskanji, ms-kanji" -#: ../../library/codecs.rst:1125 ../../library/codecs.rst:1160 -#: ../../library/codecs.rst:1162 ../../library/codecs.rst:1164 -#: ../../library/codecs.rst:1181 ../../library/codecs.rst:1184 -#: ../../library/codecs.rst:1189 ../../library/codecs.rst:1192 -#: ../../library/codecs.rst:1194 ../../library/codecs.rst:1262 -#: ../../library/codecs.rst:1265 ../../library/codecs.rst:1268 +#: ../../library/codecs.rst:1128 ../../library/codecs.rst:1163 +#: ../../library/codecs.rst:1165 ../../library/codecs.rst:1167 +#: ../../library/codecs.rst:1184 ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1192 ../../library/codecs.rst:1195 +#: ../../library/codecs.rst:1197 ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1268 ../../library/codecs.rst:1271 msgid "Japanese" msgstr "日文" -#: ../../library/codecs.rst:1127 +#: ../../library/codecs.rst:1130 msgid "cp949" msgstr "cp949" -#: ../../library/codecs.rst:1127 +#: ../../library/codecs.rst:1130 msgid "949, ms949, uhc" msgstr "949, ms949, uhc" -#: ../../library/codecs.rst:1127 ../../library/codecs.rst:1166 -#: ../../library/codecs.rst:1196 ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1130 ../../library/codecs.rst:1169 +#: ../../library/codecs.rst:1199 ../../library/codecs.rst:1234 msgid "Korean" msgstr "韓文" -#: ../../library/codecs.rst:1129 +#: ../../library/codecs.rst:1132 msgid "cp950" msgstr "cp950" -#: ../../library/codecs.rst:1129 +#: ../../library/codecs.rst:1132 msgid "950, ms950" msgstr "950, ms950" -#: ../../library/codecs.rst:1131 +#: ../../library/codecs.rst:1134 msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1131 +#: ../../library/codecs.rst:1134 msgid "Urdu" msgstr "" -#: ../../library/codecs.rst:1133 +#: ../../library/codecs.rst:1136 msgid "cp1026" msgstr "cp1026" -#: ../../library/codecs.rst:1133 +#: ../../library/codecs.rst:1136 msgid "ibm1026" msgstr "ibm1026" -#: ../../library/codecs.rst:1135 +#: ../../library/codecs.rst:1138 msgid "cp1125" msgstr "cp1125" -#: ../../library/codecs.rst:1135 +#: ../../library/codecs.rst:1138 msgid "1125, ibm1125, cp866u, ruscii" msgstr "1125, ibm1125, cp866u, ruscii" -#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1138 ../../library/codecs.rst:1242 msgid "Ukrainian" msgstr "烏克蘭文" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1142 msgid "cp1140" msgstr "cp1140" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1142 msgid "ibm1140" msgstr "ibm1140" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1144 msgid "cp1250" msgstr "cp1250" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1144 msgid "windows-1250" msgstr "windows-1250" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1146 msgid "cp1251" msgstr "cp1251" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1146 msgid "windows-1251" msgstr "windows-1251" -#: ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1149 msgid "cp1252" msgstr "cp1252" -#: ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1149 msgid "windows-1252" msgstr "windows-1252" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1151 msgid "cp1253" msgstr "cp1253" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1151 msgid "windows-1253" msgstr "windows-1253" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1153 msgid "cp1254" msgstr "cp1254" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1153 msgid "windows-1254" msgstr "windows-1254" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1155 msgid "cp1255" msgstr "cp1255" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1155 msgid "windows-1255" msgstr "windows-1255" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1157 msgid "cp1256" msgstr "cp1256" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1157 msgid "windows-1256" msgstr "windows-1256" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1159 msgid "cp1257" msgstr "cp1257" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1159 msgid "windows-1257" msgstr "windows-1257" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1161 msgid "cp1258" msgstr "cp1258" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1161 msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1161 msgid "Vietnamese" msgstr "越南文" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1163 msgid "euc_jp" msgstr "euc_jp" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1163 msgid "eucjp, ujis, u-jis" msgstr "eucjp, ujis, u-jis" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1165 msgid "euc_jis_2004" msgstr "euc_jis_2004" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1165 msgid "jisx0213, eucjis2004" msgstr "jisx0213, eucjis2004" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1167 msgid "euc_jisx0213" msgstr "euc_jisx0213" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1167 msgid "eucjisx0213" msgstr "eucjisx0213" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1169 msgid "euc_kr" msgstr "euc_kr" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1169 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1173 msgid "gb2312" msgstr "gb2312" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1173 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" @@ -1852,446 +1856,446 @@ msgstr "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" -#: ../../library/codecs.rst:1170 ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1173 ../../library/codecs.rst:1182 msgid "Simplified Chinese" msgstr "簡體中文" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1178 msgid "gbk" msgstr "gbk" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1178 msgid "936, cp936, ms936" msgstr "936, cp936, ms936" -#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1178 ../../library/codecs.rst:1180 msgid "Unified Chinese" msgstr "" -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1180 msgid "gb18030" msgstr "gb18030" -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1180 msgid "gb18030-2000" msgstr "gb18030-2000" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1182 msgid "hz" msgstr "" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1182 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "hzgb, hz-gb, hz-gb-2312" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1184 msgid "iso2022_jp" msgstr "iso2022_jp" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1184 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "csiso2022jp, iso2022jp, iso-2022-jp" -#: ../../library/codecs.rst:1184 +#: ../../library/codecs.rst:1187 msgid "iso2022_jp_1" msgstr "iso2022_jp_1" -#: ../../library/codecs.rst:1184 +#: ../../library/codecs.rst:1187 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "iso2022jp-1, iso-2022-jp-1" -#: ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1189 msgid "iso2022_jp_2" msgstr "iso2022_jp_2" -#: ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1189 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "iso2022jp-2, iso-2022-jp-2" -#: ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1189 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1192 msgid "iso2022_jp_2004" msgstr "iso2022_jp_2004" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1192 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "iso2022jp-2004, iso-2022-jp-2004" -#: ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1195 msgid "iso2022_jp_3" msgstr "iso2022_jp_3" -#: ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1195 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "iso2022jp-3, iso-2022-jp-3" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1197 msgid "iso2022_jp_ext" msgstr "iso2022_jp_ext" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1197 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "iso2022jp-ext, iso-2022-jp-ext" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1199 msgid "iso2022_kr" msgstr "iso2022_kr" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1199 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "csiso2022kr, iso2022kr, iso-2022-kr" -#: ../../library/codecs.rst:1199 +#: ../../library/codecs.rst:1202 msgid "latin_1" msgstr "latin_1" -#: ../../library/codecs.rst:1199 +#: ../../library/codecs.rst:1202 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1205 msgid "iso8859_2" msgstr "iso8859_2" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1205 msgid "iso-8859-2, latin2, L2" msgstr "iso-8859-2, latin2, L2" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1207 msgid "iso8859_3" msgstr "iso8859_3" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1207 msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1207 msgid "Esperanto, Maltese" msgstr "" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1209 msgid "iso8859_4" msgstr "iso8859_4" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1209 msgid "iso-8859-4, latin4, L4" msgstr "iso-8859-4, latin4, L4" -#: ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1211 msgid "iso8859_5" msgstr "iso8859_5" -#: ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1211 msgid "iso-8859-5, cyrillic" msgstr "iso-8859-5, cyrillic" -#: ../../library/codecs.rst:1211 +#: ../../library/codecs.rst:1214 msgid "iso8859_6" msgstr "iso8859_6" -#: ../../library/codecs.rst:1211 +#: ../../library/codecs.rst:1214 msgid "iso-8859-6, arabic" msgstr "iso-8859-6, arabic" -#: ../../library/codecs.rst:1213 +#: ../../library/codecs.rst:1216 msgid "iso8859_7" msgstr "iso8859_7" -#: ../../library/codecs.rst:1213 +#: ../../library/codecs.rst:1216 msgid "iso-8859-7, greek, greek8" msgstr "iso-8859-7, greek, greek8" -#: ../../library/codecs.rst:1215 +#: ../../library/codecs.rst:1218 msgid "iso8859_8" msgstr "iso8859_8" -#: ../../library/codecs.rst:1215 +#: ../../library/codecs.rst:1218 msgid "iso-8859-8, hebrew" msgstr "iso-8859-8, hebrew" -#: ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1220 msgid "iso8859_9" msgstr "iso8859_9" -#: ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1220 msgid "iso-8859-9, latin5, L5" msgstr "iso-8859-9, latin5, L5" -#: ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1222 msgid "iso8859_10" msgstr "iso8859_10" -#: ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1222 msgid "iso-8859-10, latin6, L6" msgstr "iso-8859-10, latin6, L6" -#: ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1222 msgid "Nordic languages" msgstr "" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1224 msgid "iso8859_11" msgstr "iso8859_11" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1224 msgid "iso-8859-11, thai" msgstr "iso-8859-11, thai" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1224 msgid "Thai languages" msgstr "" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1226 msgid "iso8859_13" msgstr "iso8859_13" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1226 msgid "iso-8859-13, latin7, L7" msgstr "iso-8859-13, latin7, L7" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1228 msgid "iso8859_14" msgstr "iso8859_14" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1228 msgid "iso-8859-14, latin8, L8" msgstr "iso-8859-14, latin8, L8" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1228 msgid "Celtic languages" msgstr "" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1230 msgid "iso8859_15" msgstr "iso8859_15" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1230 msgid "iso-8859-15, latin9, L9" msgstr "iso-8859-15, latin9, L9" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1232 msgid "iso8859_16" msgstr "iso8859_16" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1232 msgid "iso-8859-16, latin10, L10" msgstr "iso-8859-16, latin10, L10" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1232 msgid "South-Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1234 msgid "johab" msgstr "" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1234 msgid "cp1361, ms1361" msgstr "cp1361, ms1361" -#: ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1236 msgid "koi8_r" msgstr "koi8_r" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1238 msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1238 msgid "Tajik" msgstr "" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1242 msgid "koi8_u" msgstr "koi8_u" -#: ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1244 msgid "kz1048" msgstr "kz1048" -#: ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1244 msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1241 ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1244 ../../library/codecs.rst:1262 msgid "Kazakh" msgstr "" -#: ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1248 msgid "mac_cyrillic" msgstr "mac_cyrillic" -#: ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1248 msgid "maccyrillic" msgstr "" -#: ../../library/codecs.rst:1248 +#: ../../library/codecs.rst:1251 msgid "mac_greek" msgstr "mac_greek" -#: ../../library/codecs.rst:1248 +#: ../../library/codecs.rst:1251 msgid "macgreek" msgstr "" -#: ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1253 msgid "mac_iceland" msgstr "mac_iceland" -#: ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1253 msgid "maciceland" msgstr "" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1255 msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1255 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "maclatin2, maccentraleurope, mac_centeuro" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1258 msgid "mac_roman" msgstr "mac_roman" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1258 msgid "macroman, macintosh" msgstr "macroman, macintosh" -#: ../../library/codecs.rst:1257 +#: ../../library/codecs.rst:1260 msgid "mac_turkish" msgstr "mac_turkish" -#: ../../library/codecs.rst:1257 +#: ../../library/codecs.rst:1260 msgid "macturkish" msgstr "" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1262 msgid "ptcp154" msgstr "ptcp154" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1262 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "csptcp154, pt154, cp154, cyrillic-asian" -#: ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1265 msgid "shift_jis" msgstr "shift_jis" -#: ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1265 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "csshiftjis, shiftjis, sjis, s_jis" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1268 msgid "shift_jis_2004" msgstr "shift_jis_2004" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1268 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "shiftjis2004, sjis_2004, sjis2004" -#: ../../library/codecs.rst:1268 +#: ../../library/codecs.rst:1271 msgid "shift_jisx0213" msgstr "shift_jisx0213" -#: ../../library/codecs.rst:1268 +#: ../../library/codecs.rst:1271 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "shiftjisx0213, sjisx0213, s_jisx0213" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1274 msgid "utf_32" msgstr "utf_32" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1274 msgid "U32, utf32" msgstr "U32, utf32" -#: ../../library/codecs.rst:1271 ../../library/codecs.rst:1273 -#: ../../library/codecs.rst:1275 ../../library/codecs.rst:1277 -#: ../../library/codecs.rst:1279 ../../library/codecs.rst:1281 -#: ../../library/codecs.rst:1283 ../../library/codecs.rst:1285 -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1274 ../../library/codecs.rst:1276 +#: ../../library/codecs.rst:1278 ../../library/codecs.rst:1280 +#: ../../library/codecs.rst:1282 ../../library/codecs.rst:1284 +#: ../../library/codecs.rst:1286 ../../library/codecs.rst:1288 +#: ../../library/codecs.rst:1290 msgid "all languages" msgstr "" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1276 msgid "utf_32_be" msgstr "utf_32_be" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1276 msgid "UTF-32BE" msgstr "UTF-32BE" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1278 msgid "utf_32_le" msgstr "utf_32_le" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1278 msgid "UTF-32LE" msgstr "UTF-32LE" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1280 msgid "utf_16" msgstr "utf_16" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1280 msgid "U16, utf16" msgstr "U16, utf16" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1282 msgid "utf_16_be" msgstr "utf_16_be" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1282 msgid "UTF-16BE" msgstr "UTF-16BE" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1284 msgid "utf_16_le" msgstr "utf_16_le" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1284 msgid "UTF-16LE" msgstr "UTF-16LE" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1286 msgid "utf_7" msgstr "utf_7" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1286 msgid "U7, unicode-1-1-utf-7" msgstr "U7, unicode-1-1-utf-7" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1288 msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1288 msgid "U8, UTF, utf8, cp65001" msgstr "U8, UTF, utf8, cp65001" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1290 msgid "utf_8_sig" msgstr "utf_8_sig" -#: ../../library/codecs.rst:1290 +#: ../../library/codecs.rst:1293 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1299 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "" -#: ../../library/codecs.rst:1301 +#: ../../library/codecs.rst:1304 msgid "Python Specific Encodings" msgstr "" -#: ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1306 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2301,272 +2305,272 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: ../../library/codecs.rst:1311 +#: ../../library/codecs.rst:1314 msgid "Text Encodings" msgstr "" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1316 msgid "" "The following codecs provide :class:`str` to :class:`bytes` encoding and :" "term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " "text encodings." msgstr "" -#: ../../library/codecs.rst:1322 +#: ../../library/codecs.rst:1325 msgid "idna" msgstr "idna" -#: ../../library/codecs.rst:1322 +#: ../../library/codecs.rst:1325 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: ../../library/codecs.rst:1328 +#: ../../library/codecs.rst:1331 msgid "mbcs" msgstr "mbcs" -#: ../../library/codecs.rst:1328 +#: ../../library/codecs.rst:1331 msgid "ansi, dbcs" msgstr "ansi, dbcs" -#: ../../library/codecs.rst:1328 +#: ../../library/codecs.rst:1331 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1332 +#: ../../library/codecs.rst:1335 msgid "oem" msgstr "oem" -#: ../../library/codecs.rst:1332 +#: ../../library/codecs.rst:1335 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1341 msgid "palmos" msgstr "" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1341 msgid "Encoding of PalmOS 3.5." msgstr "" -#: ../../library/codecs.rst:1340 +#: ../../library/codecs.rst:1343 msgid "punycode" msgstr "" -#: ../../library/codecs.rst:1340 +#: ../../library/codecs.rst:1343 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: ../../library/codecs.rst:1344 +#: ../../library/codecs.rst:1347 msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1344 +#: ../../library/codecs.rst:1347 msgid "" "Latin-1 encoding with ``\\uXXXX`` and ``\\UXXXXXXXX`` for other code points. " "Existing backslashes are not escaped in any way. It is used in the Python " "pickle protocol." msgstr "" -#: ../../library/codecs.rst:1353 +#: ../../library/codecs.rst:1356 msgid "undefined" msgstr "" -#: ../../library/codecs.rst:1353 +#: ../../library/codecs.rst:1356 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: ../../library/codecs.rst:1358 +#: ../../library/codecs.rst:1361 msgid "unicode_escape" msgstr "unicode_escape" -#: ../../library/codecs.rst:1358 +#: ../../library/codecs.rst:1361 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: ../../library/codecs.rst:1370 +#: ../../library/codecs.rst:1373 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: ../../library/codecs.rst:1377 +#: ../../library/codecs.rst:1380 msgid "Binary Transforms" msgstr "" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1382 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: ../../library/codecs.rst:1387 +#: ../../library/codecs.rst:1390 msgid "Encoder / decoder" msgstr "" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1392 msgid "base64_codec [#b64]_" msgstr "base64_codec [#b64]_" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1392 msgid "base64, base_64" msgstr "base64, base_64" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1392 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: ../../library/codecs.rst:1394 +#: ../../library/codecs.rst:1397 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1392 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1403 msgid "bz2_codec" msgstr "bz2_codec" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1403 msgid "bz2" msgstr "bz2" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1403 msgid "Compress the operand using bz2." msgstr "" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1403 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr ":meth:`bz2.compress` / :meth:`bz2.decompress`" -#: ../../library/codecs.rst:1403 +#: ../../library/codecs.rst:1406 msgid "hex_codec" msgstr "hex_codec" -#: ../../library/codecs.rst:1403 +#: ../../library/codecs.rst:1406 msgid "hex" msgstr "hex" -#: ../../library/codecs.rst:1403 +#: ../../library/codecs.rst:1406 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: ../../library/codecs.rst:1403 +#: ../../library/codecs.rst:1406 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" -#: ../../library/codecs.rst:1408 +#: ../../library/codecs.rst:1411 msgid "quopri_codec" msgstr "quopri_codec" -#: ../../library/codecs.rst:1408 +#: ../../library/codecs.rst:1411 msgid "quopri, quotedprintable, quoted_printable" msgstr "quopri, quotedprintable, quoted_printable" -#: ../../library/codecs.rst:1408 +#: ../../library/codecs.rst:1411 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: ../../library/codecs.rst:1408 +#: ../../library/codecs.rst:1411 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" -#: ../../library/codecs.rst:1412 +#: ../../library/codecs.rst:1415 msgid "uu_codec" msgstr "uu_codec" -#: ../../library/codecs.rst:1412 +#: ../../library/codecs.rst:1415 msgid "uu" msgstr "uu" -#: ../../library/codecs.rst:1412 +#: ../../library/codecs.rst:1415 msgid "Convert the operand using uuencode." msgstr "" -#: ../../library/codecs.rst:1412 +#: ../../library/codecs.rst:1415 msgid ":meth:`uu.encode` / :meth:`uu.decode`" msgstr ":meth:`uu.encode` / :meth:`uu.decode`" -#: ../../library/codecs.rst:1415 +#: ../../library/codecs.rst:1418 msgid "zlib_codec" msgstr "zlib_codec" -#: ../../library/codecs.rst:1415 +#: ../../library/codecs.rst:1418 msgid "zip, zlib" msgstr "zip, zlib" -#: ../../library/codecs.rst:1415 +#: ../../library/codecs.rst:1418 msgid "Compress the operand using gzip." msgstr "" -#: ../../library/codecs.rst:1415 +#: ../../library/codecs.rst:1418 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr ":meth:`zlib.compress` / :meth:`zlib.decompress`" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1422 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1426 msgid "Restoration of the binary transforms." msgstr "" -#: ../../library/codecs.rst:1426 +#: ../../library/codecs.rst:1429 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: ../../library/codecs.rst:1433 +#: ../../library/codecs.rst:1436 msgid "Text Transforms" msgstr "" -#: ../../library/codecs.rst:1435 +#: ../../library/codecs.rst:1438 msgid "" "The following codec provides a text transform: a :class:`str` to :class:" "`str` mapping. It is not supported by :meth:`str.encode` (which only " "produces :class:`bytes` output)." msgstr "" -#: ../../library/codecs.rst:1444 +#: ../../library/codecs.rst:1447 msgid "rot_13" msgstr "rot_13" -#: ../../library/codecs.rst:1444 +#: ../../library/codecs.rst:1447 msgid "rot13" msgstr "" -#: ../../library/codecs.rst:1444 +#: ../../library/codecs.rst:1447 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: ../../library/codecs.rst:1449 +#: ../../library/codecs.rst:1452 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: ../../library/codecs.rst:1452 +#: ../../library/codecs.rst:1455 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1460 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: ../../library/codecs.rst:1463 +#: ../../library/codecs.rst:1466 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2574,13 +2578,13 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1471 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party `idna module `_." msgstr "" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1474 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " "domain names. A domain name containing non-ASCII characters (such as ``www." @@ -2594,7 +2598,7 @@ msgid "" "presenting them to the user." msgstr "" -#: ../../library/codecs.rst:1482 +#: ../../library/codecs.rst:1485 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2611,14 +2615,14 @@ msgid "" "sends that field at all)." msgstr "" -#: ../../library/codecs.rst:1495 +#: ../../library/codecs.rst:1498 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: ../../library/codecs.rst:1499 +#: ../../library/codecs.rst:1502 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2626,49 +2630,49 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: ../../library/codecs.rst:1507 +#: ../../library/codecs.rst:1510 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: ../../library/codecs.rst:1513 +#: ../../library/codecs.rst:1516 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: ../../library/codecs.rst:1519 +#: ../../library/codecs.rst:1522 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: ../../library/codecs.rst:1523 +#: ../../library/codecs.rst:1526 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr "" -#: ../../library/codecs.rst:1528 +#: ../../library/codecs.rst:1531 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1531 -msgid ":ref:`Availability `: Windows only." -msgstr ":ref:`適用 `:只有 Windows。" +#: ../../library/codecs.rst:1534 +msgid ":ref:`Availability `: Windows." +msgstr ":ref:`適用 `:Windows。" -#: ../../library/codecs.rst:1532 +#: ../../library/codecs.rst:1535 msgid "Support any error handler." msgstr "" -#: ../../library/codecs.rst:1535 +#: ../../library/codecs.rst:1538 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: ../../library/codecs.rst:1541 +#: ../../library/codecs.rst:1544 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: ../../library/codecs.rst:1547 +#: ../../library/codecs.rst:1550 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " diff --git a/library/collections.abc.po b/library/collections.abc.po index ccd70885b1..05fccba50f 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -274,7 +274,9 @@ msgstr ":class:`MutableSet`" #: ../../library/collections.abc.rst:151 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" -msgstr "``__contains__``\\ 、\\ ``__iter__``\\ 、\\ ``__len__``\\ 、\\ ``add``\\ 、\\ ``discard``" +msgstr "" +"``__contains__``\\ 、\\ ``__iter__``\\ 、\\ ``__len__``\\ 、\\ ``add``" +"\\ 、\\ ``discard``" #: ../../library/collections.abc.rst:151 msgid "" @@ -529,10 +531,9 @@ msgstr "" #: ../../library/collections.abc.rst:302 msgid "" "In CPython, generator-based coroutines (generators decorated with :func:" -"`types.coroutine` or :func:`asyncio.coroutine`) are *awaitables*, even " -"though they do not have an :meth:`__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"`types.coroutine`) are *awaitables*, even though they do not have an :meth:" +"`__await__` method. Using ``isinstance(gencoro, Awaitable)`` for them will " +"return ``False``. Use :func:`inspect.isawaitable` to detect them." msgstr "" #: ../../library/collections.abc.rst:312 @@ -548,10 +549,9 @@ msgstr "" #: ../../library/collections.abc.rst:320 msgid "" "In CPython, generator-based coroutines (generators decorated with :func:" -"`types.coroutine` or :func:`asyncio.coroutine`) are *awaitables*, even " -"though they do not have an :meth:`__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"`types.coroutine`) are *awaitables*, even though they do not have an :meth:" +"`__await__` method. Using ``isinstance(gencoro, Coroutine)`` for them will " +"return ``False``. Use :func:`inspect.isawaitable` to detect them." msgstr "" #: ../../library/collections.abc.rst:330 diff --git a/library/compileall.po b/library/compileall.po index 2f9f4efee0..c9601f07d4 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,40 +35,51 @@ msgid "" "don't have write permission to the library directories." msgstr "" -#: ../../library/compileall.rst:19 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/compileall.rst:20 msgid "Command-line use" msgstr "" -#: ../../library/compileall.rst:21 +#: ../../library/compileall.rst:22 msgid "" "This module can work as a script (using :program:`python -m compileall`) to " "compile Python sources." msgstr "" -#: ../../library/compileall.rst:29 +#: ../../library/compileall.rst:30 msgid "" "Positional arguments are files to compile or directories that contain source " "files, traversed recursively. If no argument is given, behave as if the " "command line was ``-l ``." msgstr "" -#: ../../library/compileall.rst:35 +#: ../../library/compileall.rst:36 msgid "" "Do not recurse into subdirectories, only compile source code files directly " "contained in the named or implied directories." msgstr "" -#: ../../library/compileall.rst:40 +#: ../../library/compileall.rst:41 msgid "Force rebuild even if timestamps are up-to-date." msgstr "" -#: ../../library/compileall.rst:44 +#: ../../library/compileall.rst:45 msgid "" "Do not print the list of files compiled. If passed once, error messages will " "still be printed. If passed twice (``-qq``), all output is suppressed." msgstr "" -#: ../../library/compileall.rst:49 +#: ../../library/compileall.rst:50 msgid "" "Directory prepended to the path to each file being compiled. This will " "appear in compilation time tracebacks, and is also compiled in to the byte-" @@ -77,26 +88,26 @@ msgid "" "executed." msgstr "" -#: ../../library/compileall.rst:58 +#: ../../library/compileall.rst:59 msgid "" "Remove (``-s``) or append (``-p``) the given prefix of paths recorded in the " "``.pyc`` files. Cannot be combined with ``-d``." msgstr "" -#: ../../library/compileall.rst:64 +#: ../../library/compileall.rst:65 msgid "" "regex is used to search the full path to each file considered for " "compilation, and if the regex produces a match, the file is skipped." msgstr "" -#: ../../library/compileall.rst:69 +#: ../../library/compileall.rst:70 msgid "" "Read the file ``list`` and add each line that it contains to the list of " "files and directories to compile. If ``list`` is ``-``, read lines from " "``stdin``." msgstr "" -#: ../../library/compileall.rst:75 +#: ../../library/compileall.rst:76 msgid "" "Write the byte-code files to their legacy locations and names, which may " "overwrite byte-code files created by another version of Python. The default " @@ -104,7 +115,7 @@ msgid "" "byte-code files from multiple versions of Python to coexist." msgstr "" -#: ../../library/compileall.rst:82 +#: ../../library/compileall.rst:83 msgid "" "Control the maximum recursion level for subdirectories. If this is given, " "then ``-l`` option will not be taken into account. :program:`python -m " @@ -112,13 +123,13 @@ msgid "" " -l`." msgstr "" -#: ../../library/compileall.rst:89 +#: ../../library/compileall.rst:90 msgid "" "Use *N* workers to compile the files within the given directory. If ``0`` is " "used, then the result of :func:`os.cpu_count()` will be used." msgstr "" -#: ../../library/compileall.rst:95 +#: ../../library/compileall.rst:96 msgid "" "Control how the generated byte-code files are invalidated at runtime. The " "``timestamp`` value, means that ``.pyc`` files with the source timestamp and " @@ -131,53 +142,53 @@ msgid "" "the ``SOURCE_DATE_EPOCH`` environment variable is set." msgstr "" -#: ../../library/compileall.rst:108 +#: ../../library/compileall.rst:109 msgid "" "Compile with the given optimization level. May be used multiple times to " "compile for multiple levels at a time (for example, ``compileall -o 1 -o " "2``)." msgstr "" -#: ../../library/compileall.rst:114 +#: ../../library/compileall.rst:115 msgid "Ignore symlinks pointing outside the given directory." msgstr "" -#: ../../library/compileall.rst:118 +#: ../../library/compileall.rst:119 msgid "" "If two ``.pyc`` files with different optimization level have the same " "content, use hard links to consolidate duplicate files." msgstr "" -#: ../../library/compileall.rst:121 +#: ../../library/compileall.rst:122 msgid "Added the ``-i``, ``-b`` and ``-h`` options." msgstr "新增選項 ``-i``\\ 、\\ ``-b`` 與 ``-h``\\ 。" -#: ../../library/compileall.rst:124 +#: ../../library/compileall.rst:125 msgid "" "Added the ``-j``, ``-r``, and ``-qq`` options. ``-q`` option was changed " "to a multilevel value. ``-b`` will always produce a byte-code file ending " "in ``.pyc``, never ``.pyo``." msgstr "" -#: ../../library/compileall.rst:129 +#: ../../library/compileall.rst:130 msgid "Added the ``--invalidation-mode`` option." msgstr "新增選項 ``--invalidation-mode``\\ 。" -#: ../../library/compileall.rst:132 +#: ../../library/compileall.rst:133 msgid "" "Added the ``-s``, ``-p``, ``-e`` and ``--hardlink-dupes`` options. Raised " "the default recursion limit from 10 to :py:func:`sys.getrecursionlimit()`. " "Added the possibility to specify the ``-o`` option multiple times." msgstr "" -#: ../../library/compileall.rst:139 +#: ../../library/compileall.rst:140 msgid "" "There is no command-line option to control the optimization level used by " "the :func:`compile` function, because the Python interpreter itself already " "provides the option: :program:`python -O -m compileall`." msgstr "" -#: ../../library/compileall.rst:143 +#: ../../library/compileall.rst:144 msgid "" "Similarly, the :func:`compile` function respects the :attr:`sys." "pycache_prefix` setting. The generated bytecode cache will only be useful " @@ -185,24 +196,24 @@ msgid "" "that will be used at runtime." msgstr "" -#: ../../library/compileall.rst:149 +#: ../../library/compileall.rst:150 msgid "Public functions" msgstr "" -#: ../../library/compileall.rst:153 +#: ../../library/compileall.rst:154 msgid "" "Recursively descend the directory tree named by *dir*, compiling all :file:`." "py` files along the way. Return a true value if all the files compiled " "successfully, and a false value otherwise." msgstr "" -#: ../../library/compileall.rst:157 +#: ../../library/compileall.rst:158 msgid "" "The *maxlevels* parameter is used to limit the depth of the recursion; it " "defaults to ``sys.getrecursionlimit()``." msgstr "" -#: ../../library/compileall.rst:160 +#: ../../library/compileall.rst:161 msgid "" "If *ddir* is given, it is prepended to the path to each file being compiled " "for use in compilation time tracebacks, and is also compiled in to the byte-" @@ -211,13 +222,13 @@ msgid "" "executed." msgstr "" -#: ../../library/compileall.rst:166 +#: ../../library/compileall.rst:167 msgid "" "If *force* is true, modules are re-compiled even if the timestamps are up to " "date." msgstr "" -#: ../../library/compileall.rst:169 +#: ../../library/compileall.rst:170 msgid "" "If *rx* is given, its ``search`` method is called on the complete path to " "each file considered for compilation, and if it returns a true value, the " @@ -225,14 +236,14 @@ msgid "" "expression, given as a :ref:`re.Pattern ` object." msgstr "" -#: ../../library/compileall.rst:174 ../../library/compileall.rst:251 +#: ../../library/compileall.rst:175 ../../library/compileall.rst:252 msgid "" "If *quiet* is ``False`` or ``0`` (the default), the filenames and other " "information are printed to standard out. Set to ``1``, only errors are " "printed. Set to ``2``, all output is suppressed." msgstr "" -#: ../../library/compileall.rst:178 ../../library/compileall.rst:255 +#: ../../library/compileall.rst:179 ../../library/compileall.rst:256 msgid "" "If *legacy* is true, byte-code files are written to their legacy locations " "and names, which may overwrite byte-code files created by another version of " @@ -241,7 +252,7 @@ msgid "" "coexist." msgstr "" -#: ../../library/compileall.rst:184 ../../library/compileall.rst:261 +#: ../../library/compileall.rst:185 ../../library/compileall.rst:262 msgid "" "*optimize* specifies the optimization level for the compiler. It is passed " "to the built-in :func:`compile` function. Accepts also a sequence of " @@ -249,7 +260,7 @@ msgid "" "file in one call." msgstr "" -#: ../../library/compileall.rst:188 +#: ../../library/compileall.rst:189 msgid "" "The argument *workers* specifies how many workers are used to compile files " "in parallel. The default is to not use multiple workers. If the platform " @@ -259,79 +270,79 @@ msgid "" "`ValueError` will be raised." msgstr "" -#: ../../library/compileall.rst:195 ../../library/compileall.rst:265 +#: ../../library/compileall.rst:196 ../../library/compileall.rst:266 msgid "" "*invalidation_mode* should be a member of the :class:`py_compile." "PycInvalidationMode` enum and controls how the generated pycs are " "invalidated at runtime." msgstr "" -#: ../../library/compileall.rst:199 ../../library/compileall.rst:269 +#: ../../library/compileall.rst:200 ../../library/compileall.rst:270 msgid "" "The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the " "``-s``, ``-p`` and ``-e`` options described above. They may be specified as " "``str``, ``bytes`` or :py:class:`os.PathLike`." msgstr "" -#: ../../library/compileall.rst:203 ../../library/compileall.rst:273 +#: ../../library/compileall.rst:204 ../../library/compileall.rst:274 msgid "" "If *hardlink_dupes* is true and two ``.pyc`` files with different " "optimization level have the same content, use hard links to consolidate " "duplicate files." msgstr "" -#: ../../library/compileall.rst:206 ../../library/compileall.rst:304 +#: ../../library/compileall.rst:207 ../../library/compileall.rst:305 msgid "Added the *legacy* and *optimize* parameter." msgstr "新增 *legacy* 與 *optimize* 參數。" -#: ../../library/compileall.rst:209 +#: ../../library/compileall.rst:210 msgid "Added the *workers* parameter." msgstr "新增 *workers* 參數。" -#: ../../library/compileall.rst:212 ../../library/compileall.rst:278 -#: ../../library/compileall.rst:307 +#: ../../library/compileall.rst:213 ../../library/compileall.rst:279 +#: ../../library/compileall.rst:308 msgid "*quiet* parameter was changed to a multilevel value." msgstr "" -#: ../../library/compileall.rst:215 ../../library/compileall.rst:281 -#: ../../library/compileall.rst:310 +#: ../../library/compileall.rst:216 ../../library/compileall.rst:282 +#: ../../library/compileall.rst:311 msgid "" "The *legacy* parameter only writes out ``.pyc`` files, not ``.pyo`` files no " "matter what the value of *optimize* is." msgstr "" -#: ../../library/compileall.rst:219 +#: ../../library/compileall.rst:220 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/compileall.rst:222 ../../library/compileall.rst:285 -#: ../../library/compileall.rst:314 +#: ../../library/compileall.rst:223 ../../library/compileall.rst:286 +#: ../../library/compileall.rst:315 msgid "The *invalidation_mode* parameter was added." msgstr "新增 *invalidation_mode* 參數。" -#: ../../library/compileall.rst:225 ../../library/compileall.rst:288 -#: ../../library/compileall.rst:317 +#: ../../library/compileall.rst:226 ../../library/compileall.rst:289 +#: ../../library/compileall.rst:318 msgid "The *invalidation_mode* parameter's default value is updated to None." msgstr "" -#: ../../library/compileall.rst:228 +#: ../../library/compileall.rst:229 msgid "Setting *workers* to 0 now chooses the optimal number of cores." msgstr "" -#: ../../library/compileall.rst:231 +#: ../../library/compileall.rst:232 msgid "" "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " "arguments. Default value of *maxlevels* was changed from ``10`` to ``sys." "getrecursionlimit()``" msgstr "" -#: ../../library/compileall.rst:237 +#: ../../library/compileall.rst:238 msgid "" "Compile the file with path *fullname*. Return a true value if the file " "compiled successfully, and a false value otherwise." msgstr "" -#: ../../library/compileall.rst:240 +#: ../../library/compileall.rst:241 msgid "" "If *ddir* is given, it is prepended to the path to the file being compiled " "for use in compilation time tracebacks, and is also compiled in to the byte-" @@ -340,7 +351,7 @@ msgid "" "executed." msgstr "" -#: ../../library/compileall.rst:246 +#: ../../library/compileall.rst:247 msgid "" "If *rx* is given, its ``search`` method is passed the full path name to the " "file being compiled, and if it returns a true value, the file is not " @@ -349,20 +360,20 @@ msgid "" "object." msgstr "" -#: ../../library/compileall.rst:291 +#: ../../library/compileall.rst:292 msgid "" "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " "arguments." msgstr "" -#: ../../library/compileall.rst:296 +#: ../../library/compileall.rst:297 msgid "" "Byte-compile all the :file:`.py` files found along ``sys.path``. Return a " "true value if all the files compiled successfully, and a false value " "otherwise." msgstr "" -#: ../../library/compileall.rst:299 +#: ../../library/compileall.rst:300 msgid "" "If *skip_curdir* is true (the default), the current directory is not " "included in the search. All other parameters are passed to the :func:" @@ -370,16 +381,16 @@ msgid "" "``maxlevels`` defaults to ``0``." msgstr "" -#: ../../library/compileall.rst:320 +#: ../../library/compileall.rst:321 msgid "" "To force a recompile of all the :file:`.py` files in the :file:`Lib/` " "subdirectory and all its subdirectories::" msgstr "" -#: ../../library/compileall.rst:337 +#: ../../library/compileall.rst:338 msgid "Module :mod:`py_compile`" msgstr ":mod:`py_compile` 模組" -#: ../../library/compileall.rst:338 +#: ../../library/compileall.rst:339 msgid "Byte-compile a single source file." msgstr "" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 922a7ad58e..774f46d709 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-29 00:16+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,53 +44,64 @@ msgid "" "by the abstract :class:`Executor` class." msgstr "" -#: ../../library/concurrent.futures.rst:24 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/concurrent.futures.rst:25 msgid "Executor Objects" msgstr "" -#: ../../library/concurrent.futures.rst:28 +#: ../../library/concurrent.futures.rst:29 msgid "" "An abstract class that provides methods to execute calls asynchronously. It " "should not be used directly, but through its concrete subclasses." msgstr "" -#: ../../library/concurrent.futures.rst:33 +#: ../../library/concurrent.futures.rst:34 msgid "" "Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and " "returns a :class:`Future` object representing the execution of the " "callable. ::" msgstr "" -#: ../../library/concurrent.futures.rst:43 +#: ../../library/concurrent.futures.rst:44 msgid "Similar to :func:`map(func, *iterables) ` except:" msgstr "" -#: ../../library/concurrent.futures.rst:45 +#: ../../library/concurrent.futures.rst:46 msgid "the *iterables* are collected immediately rather than lazily;" msgstr "" -#: ../../library/concurrent.futures.rst:47 +#: ../../library/concurrent.futures.rst:48 msgid "" "*func* is executed asynchronously and several calls to *func* may be made " "concurrently." msgstr "" -#: ../../library/concurrent.futures.rst:50 +#: ../../library/concurrent.futures.rst:51 msgid "" -"The returned iterator raises a :exc:`concurrent.futures.TimeoutError` if :" -"meth:`~iterator.__next__` is called and the result isn't available after " -"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " -"can be an int or a float. If *timeout* is not specified or ``None``, there " -"is no limit to the wait time." +"The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." +"__next__` is called and the result isn't available after *timeout* seconds " +"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " +"float. If *timeout* is not specified or ``None``, there is no limit to the " +"wait time." msgstr "" -#: ../../library/concurrent.futures.rst:56 +#: ../../library/concurrent.futures.rst:57 msgid "" "If a *func* call raises an exception, then that exception will be raised " "when its value is retrieved from the iterator." msgstr "" -#: ../../library/concurrent.futures.rst:59 +#: ../../library/concurrent.futures.rst:60 msgid "" "When using :class:`ProcessPoolExecutor`, this method chops *iterables* into " "a number of chunks which it submits to the pool as separate tasks. The " @@ -100,11 +111,11 @@ msgid "" "size of 1. With :class:`ThreadPoolExecutor`, *chunksize* has no effect." msgstr "" -#: ../../library/concurrent.futures.rst:67 +#: ../../library/concurrent.futures.rst:68 msgid "Added the *chunksize* argument." msgstr "新增 *chunksize* 引數。" -#: ../../library/concurrent.futures.rst:72 +#: ../../library/concurrent.futures.rst:73 msgid "" "Signal the executor that it should free any resources that it is using when " "the currently pending futures are done executing. Calls to :meth:`Executor." @@ -112,7 +123,7 @@ msgid "" "`RuntimeError`." msgstr "" -#: ../../library/concurrent.futures.rst:77 +#: ../../library/concurrent.futures.rst:78 msgid "" "If *wait* is ``True`` then this method will not return until all the pending " "futures are done executing and the resources associated with the executor " @@ -123,61 +134,61 @@ msgid "" "are done executing." msgstr "" -#: ../../library/concurrent.futures.rst:85 +#: ../../library/concurrent.futures.rst:86 msgid "" "If *cancel_futures* is ``True``, this method will cancel all pending futures " "that the executor has not started running. Any futures that are completed or " "running won't be cancelled, regardless of the value of *cancel_futures*." msgstr "" -#: ../../library/concurrent.futures.rst:90 +#: ../../library/concurrent.futures.rst:91 msgid "" "If both *cancel_futures* and *wait* are ``True``, all futures that the " "executor has started running will be completed prior to this method " "returning. The remaining futures are cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:94 +#: ../../library/concurrent.futures.rst:95 msgid "" "You can avoid having to call this method explicitly if you use the :keyword:" "`with` statement, which will shutdown the :class:`Executor` (waiting as if :" "meth:`Executor.shutdown` were called with *wait* set to ``True``)::" msgstr "" -#: ../../library/concurrent.futures.rst:106 +#: ../../library/concurrent.futures.rst:107 msgid "Added *cancel_futures*." msgstr "新增 *cancel_futures*\\ 。" -#: ../../library/concurrent.futures.rst:111 +#: ../../library/concurrent.futures.rst:112 msgid "ThreadPoolExecutor" msgstr "ThreadPoolExecutor" -#: ../../library/concurrent.futures.rst:113 +#: ../../library/concurrent.futures.rst:114 msgid "" ":class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a " "pool of threads to execute calls asynchronously." msgstr "" -#: ../../library/concurrent.futures.rst:116 +#: ../../library/concurrent.futures.rst:117 msgid "" "Deadlocks can occur when the callable associated with a :class:`Future` " "waits on the results of another :class:`Future`. For example::" msgstr "" -#: ../../library/concurrent.futures.rst:135 +#: ../../library/concurrent.futures.rst:136 msgid "And::" msgstr "" "和:\n" "\n" "::" -#: ../../library/concurrent.futures.rst:149 +#: ../../library/concurrent.futures.rst:150 msgid "" "An :class:`Executor` subclass that uses a pool of at most *max_workers* " "threads to execute calls asynchronously." msgstr "" -#: ../../library/concurrent.futures.rst:152 +#: ../../library/concurrent.futures.rst:153 msgid "" "All threads enqueued to ``ThreadPoolExecutor`` will be joined before the " "interpreter can exit. Note that the exit handler which does this is executed " @@ -187,7 +198,7 @@ msgid "" "``ThreadPoolExecutor`` not be used for long-running tasks." msgstr "" -#: ../../library/concurrent.futures.rst:159 +#: ../../library/concurrent.futures.rst:160 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker thread; *initargs* is a tuple of arguments passed to the " @@ -196,7 +207,7 @@ msgid "" "well as any attempt to submit more jobs to the pool." msgstr "" -#: ../../library/concurrent.futures.rst:165 +#: ../../library/concurrent.futures.rst:166 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " "processors on the machine, multiplied by ``5``, assuming that :class:" @@ -205,19 +216,19 @@ msgid "" "`ProcessPoolExecutor`." msgstr "" -#: ../../library/concurrent.futures.rst:173 +#: ../../library/concurrent.futures.rst:174 msgid "" "The *thread_name_prefix* argument was added to allow users to control the :" "class:`threading.Thread` names for worker threads created by the pool for " "easier debugging." msgstr "" -#: ../../library/concurrent.futures.rst:178 -#: ../../library/concurrent.futures.rst:272 +#: ../../library/concurrent.futures.rst:179 +#: ../../library/concurrent.futures.rst:281 msgid "Added the *initializer* and *initargs* arguments." msgstr "新增 *initializer* 與 *initargs* 引數。" -#: ../../library/concurrent.futures.rst:181 +#: ../../library/concurrent.futures.rst:182 msgid "" "Default value of *max_workers* is changed to ``min(32, os.cpu_count() + " "4)``. This default value preserves at least 5 workers for I/O bound tasks. " @@ -225,21 +236,21 @@ msgid "" "And it avoids using very large resources implicitly on many-core machines." msgstr "" -#: ../../library/concurrent.futures.rst:187 +#: ../../library/concurrent.futures.rst:188 msgid "" "ThreadPoolExecutor now reuses idle worker threads before starting " "*max_workers* worker threads too." msgstr "" -#: ../../library/concurrent.futures.rst:194 +#: ../../library/concurrent.futures.rst:195 msgid "ThreadPoolExecutor Example" msgstr "ThreadPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:226 +#: ../../library/concurrent.futures.rst:227 msgid "ProcessPoolExecutor" msgstr "ProcessPoolExecutor" -#: ../../library/concurrent.futures.rst:228 +#: ../../library/concurrent.futures.rst:229 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " "uses a pool of processes to execute calls asynchronously. :class:" @@ -249,20 +260,20 @@ msgid "" "returned." msgstr "" -#: ../../library/concurrent.futures.rst:235 +#: ../../library/concurrent.futures.rst:236 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -#: ../../library/concurrent.futures.rst:238 +#: ../../library/concurrent.futures.rst:239 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." msgstr "" -#: ../../library/concurrent.futures.rst:243 +#: ../../library/concurrent.futures.rst:244 msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -276,7 +287,7 @@ msgid "" "not given, the default multiprocessing context is used." msgstr "" -#: ../../library/concurrent.futures.rst:256 +#: ../../library/concurrent.futures.rst:257 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -285,7 +296,18 @@ msgid "" "well as any attempt to submit more jobs to the pool." msgstr "" -#: ../../library/concurrent.futures.rst:262 +#: ../../library/concurrent.futures.rst:263 +msgid "" +"*max_tasks_per_child* is an optional argument that specifies the maximum " +"number of tasks a single process can execute before it will exit and be " +"replaced with a fresh worker process. By default *max_tasks_per_child* is " +"``None`` which means worker processes will live as long as the pool. When a " +"max is specified, the \"spawn\" multiprocessing start method will be used by " +"default in absence of a *mp_context* parameter. This feature is incompatible " +"with the \"fork\" start method." +msgstr "" + +#: ../../library/concurrent.futures.rst:271 msgid "" "When one of the worker processes terminates abruptly, a :exc:" "`BrokenProcessPool` error is now raised. Previously, behaviour was " @@ -293,34 +315,40 @@ msgid "" "or deadlock." msgstr "" -#: ../../library/concurrent.futures.rst:268 +#: ../../library/concurrent.futures.rst:277 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" -#: ../../library/concurrent.futures.rst:278 +#: ../../library/concurrent.futures.rst:283 +msgid "" +"The *max_tasks_per_child* argument was added to allow users to control the " +"lifetime of workers in the pool." +msgstr "" + +#: ../../library/concurrent.futures.rst:291 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:316 +#: ../../library/concurrent.futures.rst:329 msgid "Future Objects" msgstr "" -#: ../../library/concurrent.futures.rst:318 +#: ../../library/concurrent.futures.rst:331 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -#: ../../library/concurrent.futures.rst:323 +#: ../../library/concurrent.futures.rst:336 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " "directly except for testing." msgstr "" -#: ../../library/concurrent.futures.rst:329 +#: ../../library/concurrent.futures.rst:342 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -328,63 +356,63 @@ msgid "" "``True``." msgstr "" -#: ../../library/concurrent.futures.rst:336 +#: ../../library/concurrent.futures.rst:349 msgid "Return ``True`` if the call was successfully cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:340 +#: ../../library/concurrent.futures.rst:353 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:345 +#: ../../library/concurrent.futures.rst:358 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "" -#: ../../library/concurrent.futures.rst:350 +#: ../../library/concurrent.futures.rst:363 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " -"in *timeout* seconds, then a :exc:`concurrent.futures.TimeoutError` will be " -"raised. *timeout* can be an int or float. If *timeout* is not specified or " -"``None``, there is no limit to the wait time." +"in *timeout* seconds, then a :exc:`TimeoutError` will be raised. *timeout* " +"can be an int or float. If *timeout* is not specified or ``None``, there is " +"no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:357 -#: ../../library/concurrent.futures.rst:371 +#: ../../library/concurrent.futures.rst:370 +#: ../../library/concurrent.futures.rst:384 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "" -#: ../../library/concurrent.futures.rst:360 +#: ../../library/concurrent.futures.rst:373 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "" -#: ../../library/concurrent.futures.rst:364 +#: ../../library/concurrent.futures.rst:377 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " -"completed in *timeout* seconds, then a :exc:`concurrent.futures." -"TimeoutError` will be raised. *timeout* can be an int or float. If " -"*timeout* is not specified or ``None``, there is no limit to the wait time." +"completed in *timeout* seconds, then a :exc:`TimeoutError` will be raised. " +"*timeout* can be an int or float. If *timeout* is not specified or " +"``None``, there is no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:374 +#: ../../library/concurrent.futures.rst:387 msgid "If the call completed without raising, ``None`` is returned." msgstr "" -#: ../../library/concurrent.futures.rst:378 +#: ../../library/concurrent.futures.rst:391 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " "running." msgstr "" -#: ../../library/concurrent.futures.rst:382 +#: ../../library/concurrent.futures.rst:395 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -393,26 +421,26 @@ msgid "" "behavior is undefined." msgstr "" -#: ../../library/concurrent.futures.rst:388 +#: ../../library/concurrent.futures.rst:401 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "" -#: ../../library/concurrent.futures.rst:391 +#: ../../library/concurrent.futures.rst:404 msgid "" "The following :class:`Future` methods are meant for use in unit tests and :" "class:`Executor` implementations." msgstr "" -#: ../../library/concurrent.futures.rst:396 +#: ../../library/concurrent.futures.rst:409 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " "tests." msgstr "" -#: ../../library/concurrent.futures.rst:400 +#: ../../library/concurrent.futures.rst:413 msgid "" "If the method returns ``False`` then the :class:`Future` was cancelled, i." "e. :meth:`Future.cancel` was called and returned `True`. Any threads " @@ -420,49 +448,49 @@ msgid "" "or :func:`wait`) will be woken up." msgstr "" -#: ../../library/concurrent.futures.rst:405 +#: ../../library/concurrent.futures.rst:418 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " "will return `True`." msgstr "" -#: ../../library/concurrent.futures.rst:409 +#: ../../library/concurrent.futures.rst:422 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." msgstr "" -#: ../../library/concurrent.futures.rst:415 +#: ../../library/concurrent.futures.rst:428 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "" -#: ../../library/concurrent.futures.rst:418 #: ../../library/concurrent.futures.rst:431 +#: ../../library/concurrent.futures.rst:444 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "" -#: ../../library/concurrent.futures.rst:421 #: ../../library/concurrent.futures.rst:434 +#: ../../library/concurrent.futures.rst:447 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." msgstr "" -#: ../../library/concurrent.futures.rst:428 +#: ../../library/concurrent.futures.rst:441 msgid "" "Sets the result of the work associated with the :class:`Future` to the :" "class:`Exception` *exception*." msgstr "" -#: ../../library/concurrent.futures.rst:440 +#: ../../library/concurrent.futures.rst:453 msgid "Module Functions" msgstr "模組函式" -#: ../../library/concurrent.futures.rst:444 +#: ../../library/concurrent.futures.rst:457 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -473,111 +501,116 @@ msgid "" "running futures)." msgstr "" -#: ../../library/concurrent.futures.rst:452 +#: ../../library/concurrent.futures.rst:465 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " "specified or ``None``, there is no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:456 +#: ../../library/concurrent.futures.rst:469 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/concurrent.futures.rst:462 +#: ../../library/concurrent.futures.rst:475 msgid "Constant" msgstr "常數" -#: ../../library/concurrent.futures.rst:462 +#: ../../library/concurrent.futures.rst:475 msgid "Description" msgstr "描述" -#: ../../library/concurrent.futures.rst:464 +#: ../../library/concurrent.futures.rst:477 msgid ":const:`FIRST_COMPLETED`" msgstr ":const:`FIRST_COMPLETED`" -#: ../../library/concurrent.futures.rst:464 +#: ../../library/concurrent.futures.rst:477 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:467 +#: ../../library/concurrent.futures.rst:480 msgid ":const:`FIRST_EXCEPTION`" msgstr ":const:`FIRST_EXCEPTION`" -#: ../../library/concurrent.futures.rst:467 +#: ../../library/concurrent.futures.rst:480 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/concurrent.futures.rst:473 +#: ../../library/concurrent.futures.rst:486 msgid ":const:`ALL_COMPLETED`" msgstr ":const:`ALL_COMPLETED`" -#: ../../library/concurrent.futures.rst:473 +#: ../../library/concurrent.futures.rst:486 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:479 +#: ../../library/concurrent.futures.rst:492 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " "they complete (finished or cancelled futures). Any futures given by *fs* " "that are duplicated will be returned once. Any futures that completed " "before :func:`as_completed` is called will be yielded first. The returned " -"iterator raises a :exc:`concurrent.futures.TimeoutError` if :meth:`~iterator." -"__next__` is called and the result isn't available after *timeout* seconds " -"from the original call to :func:`as_completed`. *timeout* can be an int or " -"float. If *timeout* is not specified or ``None``, there is no limit to the " -"wait time." +"iterator raises a :exc:`TimeoutError` if :meth:`~iterator.__next__` is " +"called and the result isn't available after *timeout* seconds from the " +"original call to :func:`as_completed`. *timeout* can be an int or float. If " +"*timeout* is not specified or ``None``, there is no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:493 +#: ../../library/concurrent.futures.rst:506 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr "" -#: ../../library/concurrent.futures.rst:493 +#: ../../library/concurrent.futures.rst:506 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/concurrent.futures.rst:498 +#: ../../library/concurrent.futures.rst:511 msgid "Exception classes" msgstr "" -#: ../../library/concurrent.futures.rst:504 +#: ../../library/concurrent.futures.rst:517 msgid "Raised when a future is cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:508 -msgid "Raised when a future operation exceeds the given timeout." +#: ../../library/concurrent.futures.rst:521 +msgid "" +"A deprecated alias of :exc:`TimeoutError`, raised when a future operation " +"exceeds the given timeout." msgstr "" -#: ../../library/concurrent.futures.rst:512 +#: ../../library/concurrent.futures.rst:526 +msgid "This class was made an alias of :exc:`TimeoutError`." +msgstr "" + +#: ../../library/concurrent.futures.rst:531 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " "new tasks." msgstr "" -#: ../../library/concurrent.futures.rst:520 +#: ../../library/concurrent.futures.rst:539 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "" -#: ../../library/concurrent.futures.rst:529 +#: ../../library/concurrent.futures.rst:548 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`ThreadPoolExecutor` has " "failed initializing." msgstr "" -#: ../../library/concurrent.futures.rst:539 +#: ../../library/concurrent.futures.rst:558 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " diff --git a/library/contextlib.po b/library/contextlib.po index f95c0842fd..4c5c7b68d8 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -254,7 +254,7 @@ msgid "This code is equivalent to::" msgstr "" #: ../../library/contextlib.rst:305 ../../library/contextlib.rst:345 -#: ../../library/contextlib.rst:355 +#: ../../library/contextlib.rst:355 ../../library/contextlib.rst:372 msgid "This context manager is :ref:`reentrant `." msgstr "" @@ -305,55 +305,71 @@ msgstr "" #: ../../library/contextlib.rst:362 msgid "" +"Non parallel-safe context manager to change the current working directory. " +"As this changes a global state, the working directory, it is not suitable " +"for use in most threaded or async contexts. It is also not suitable for most " +"non-linear code execution, like generators, where the program execution is " +"temporarily relinquished -- unless explicitly desired, you should not yield " +"when this context manager is active." +msgstr "" + +#: ../../library/contextlib.rst:369 +msgid "" +"This is a simple wrapper around :func:`~os.chdir`, it changes the current " +"working directory upon entering and restores the old one on exit." +msgstr "" + +#: ../../library/contextlib.rst:379 +msgid "" "A base class that enables a context manager to also be used as a decorator." msgstr "" -#: ../../library/contextlib.rst:364 +#: ../../library/contextlib.rst:381 msgid "" "Context managers inheriting from ``ContextDecorator`` have to implement " "``__enter__`` and ``__exit__`` as normal. ``__exit__`` retains its optional " "exception handling even when used as a decorator." msgstr "" -#: ../../library/contextlib.rst:368 +#: ../../library/contextlib.rst:385 msgid "" "``ContextDecorator`` is used by :func:`contextmanager`, so you get this " "functionality automatically." msgstr "" -#: ../../library/contextlib.rst:371 +#: ../../library/contextlib.rst:388 msgid "Example of ``ContextDecorator``::" msgstr "" "``ContextDecorator`` 範例:\n" "\n" "::" -#: ../../library/contextlib.rst:384 ../../library/contextlib.rst:456 +#: ../../library/contextlib.rst:401 ../../library/contextlib.rst:473 msgid "The class can then be used like this::" msgstr "" -#: ../../library/contextlib.rst:402 +#: ../../library/contextlib.rst:419 msgid "" "This change is just syntactic sugar for any construct of the following form::" msgstr "" -#: ../../library/contextlib.rst:408 +#: ../../library/contextlib.rst:425 msgid "``ContextDecorator`` lets you instead write::" msgstr "" -#: ../../library/contextlib.rst:414 +#: ../../library/contextlib.rst:431 msgid "" "It makes it clear that the ``cm`` applies to the whole function, rather than " "just a piece of it (and saving an indentation level is nice, too)." msgstr "" -#: ../../library/contextlib.rst:417 +#: ../../library/contextlib.rst:434 msgid "" "Existing context managers that already have a base class can be extended by " "using ``ContextDecorator`` as a mixin class::" msgstr "" -#: ../../library/contextlib.rst:430 +#: ../../library/contextlib.rst:447 msgid "" "As the decorated function must be able to be called multiple times, the " "underlying context manager must support use in multiple :keyword:`with` " @@ -361,38 +377,38 @@ msgid "" "explicit :keyword:`!with` statement inside the function should be used." msgstr "" -#: ../../library/contextlib.rst:440 +#: ../../library/contextlib.rst:457 msgid "" "Similar to :class:`ContextDecorator` but only for asynchronous functions." msgstr "" -#: ../../library/contextlib.rst:442 +#: ../../library/contextlib.rst:459 msgid "Example of ``AsyncContextDecorator``::" msgstr "" "``AsyncContextDecorator`` 範例:\n" "\n" "::" -#: ../../library/contextlib.rst:481 +#: ../../library/contextlib.rst:498 msgid "" "A context manager that is designed to make it easy to programmatically " "combine other context managers and cleanup functions, especially those that " "are optional or otherwise driven by input data." msgstr "" -#: ../../library/contextlib.rst:485 +#: ../../library/contextlib.rst:502 msgid "" "For example, a set of files may easily be handled in a single with statement " "as follows::" msgstr "" -#: ../../library/contextlib.rst:494 +#: ../../library/contextlib.rst:511 msgid "" "The :meth:`__enter__` method returns the :class:`ExitStack` instance, and " "performs no additional operations." msgstr "" -#: ../../library/contextlib.rst:497 +#: ../../library/contextlib.rst:514 msgid "" "Each instance maintains a stack of registered callbacks that are called in " "reverse order when the instance is closed (either explicitly or implicitly " @@ -400,14 +416,14 @@ msgid "" "invoked implicitly when the context stack instance is garbage collected." msgstr "" -#: ../../library/contextlib.rst:502 +#: ../../library/contextlib.rst:519 msgid "" "This stack model is used so that context managers that acquire their " "resources in their ``__init__`` method (such as file objects) can be handled " "correctly." msgstr "" -#: ../../library/contextlib.rst:506 +#: ../../library/contextlib.rst:523 msgid "" "Since registered callbacks are invoked in the reverse order of registration, " "this ends up behaving as if multiple nested :keyword:`with` statements had " @@ -417,7 +433,7 @@ msgid "" "updated state." msgstr "" -#: ../../library/contextlib.rst:513 +#: ../../library/contextlib.rst:530 msgid "" "This is a relatively low level API that takes care of the details of " "correctly unwinding the stack of exit callbacks. It provides a suitable " @@ -425,68 +441,74 @@ msgid "" "in application specific ways." msgstr "" -#: ../../library/contextlib.rst:522 +#: ../../library/contextlib.rst:539 msgid "" "Enters a new context manager and adds its :meth:`__exit__` method to the " "callback stack. The return value is the result of the context manager's own :" "meth:`__enter__` method." msgstr "" -#: ../../library/contextlib.rst:526 +#: ../../library/contextlib.rst:543 msgid "" "These context managers may suppress exceptions just as they normally would " "if used directly as part of a :keyword:`with` statement." msgstr "" -#: ../../library/contextlib.rst:531 +#: ../../library/contextlib.rst:546 +msgid "" +"Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a " +"context manager." +msgstr "" + +#: ../../library/contextlib.rst:552 msgid "Adds a context manager's :meth:`__exit__` method to the callback stack." msgstr "" -#: ../../library/contextlib.rst:533 +#: ../../library/contextlib.rst:554 msgid "" "As ``__enter__`` is *not* invoked, this method can be used to cover part of " "an :meth:`__enter__` implementation with a context manager's own :meth:" "`__exit__` method." msgstr "" -#: ../../library/contextlib.rst:537 +#: ../../library/contextlib.rst:558 msgid "" "If passed an object that is not a context manager, this method assumes it is " "a callback with the same signature as a context manager's :meth:`__exit__` " "method and adds it directly to the callback stack." msgstr "" -#: ../../library/contextlib.rst:541 +#: ../../library/contextlib.rst:562 msgid "" "By returning true values, these callbacks can suppress exceptions the same " "way context manager :meth:`__exit__` methods can." msgstr "" -#: ../../library/contextlib.rst:544 +#: ../../library/contextlib.rst:565 msgid "" "The passed in object is returned from the function, allowing this method to " "be used as a function decorator." msgstr "" -#: ../../library/contextlib.rst:549 +#: ../../library/contextlib.rst:570 msgid "" "Accepts an arbitrary callback function and arguments and adds it to the " "callback stack." msgstr "" -#: ../../library/contextlib.rst:552 +#: ../../library/contextlib.rst:573 msgid "" "Unlike the other methods, callbacks added this way cannot suppress " "exceptions (as they are never passed the exception details)." msgstr "" -#: ../../library/contextlib.rst:555 +#: ../../library/contextlib.rst:576 msgid "" "The passed in callback is returned from the function, allowing this method " "to be used as a function decorator." msgstr "" -#: ../../library/contextlib.rst:560 +#: ../../library/contextlib.rst:581 msgid "" "Transfers the callback stack to a fresh :class:`ExitStack` instance and " "returns it. No callbacks are invoked by this operation - instead, they will " @@ -494,70 +516,76 @@ msgid "" "at the end of a :keyword:`with` statement)." msgstr "" -#: ../../library/contextlib.rst:565 +#: ../../library/contextlib.rst:586 msgid "" "For example, a group of files can be opened as an \"all or nothing\" " "operation as follows::" msgstr "" -#: ../../library/contextlib.rst:579 +#: ../../library/contextlib.rst:600 msgid "" "Immediately unwinds the callback stack, invoking callbacks in the reverse " "order of registration. For any context managers and exit callbacks " "registered, the arguments passed in will indicate that no exception occurred." msgstr "" -#: ../../library/contextlib.rst:586 +#: ../../library/contextlib.rst:607 msgid "" "An :ref:`asynchronous context manager `, similar to :" "class:`ExitStack`, that supports combining both synchronous and asynchronous " "context managers, as well as having coroutines for cleanup logic." msgstr "" -#: ../../library/contextlib.rst:591 +#: ../../library/contextlib.rst:612 msgid "" "The :meth:`close` method is not implemented, :meth:`aclose` must be used " "instead." msgstr "" -#: ../../library/contextlib.rst:596 +#: ../../library/contextlib.rst:617 msgid "" "Similar to :meth:`enter_context` but expects an asynchronous context manager." msgstr "" -#: ../../library/contextlib.rst:601 +#: ../../library/contextlib.rst:620 +msgid "" +"Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an " +"asynchronous context manager." +msgstr "" + +#: ../../library/contextlib.rst:626 msgid "" "Similar to :meth:`push` but expects either an asynchronous context manager " "or a coroutine function." msgstr "" -#: ../../library/contextlib.rst:606 +#: ../../library/contextlib.rst:631 msgid "Similar to :meth:`callback` but expects a coroutine function." msgstr "" -#: ../../library/contextlib.rst:610 +#: ../../library/contextlib.rst:635 msgid "Similar to :meth:`close` but properly handles awaitables." msgstr "" -#: ../../library/contextlib.rst:612 +#: ../../library/contextlib.rst:637 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr "" -#: ../../library/contextlib.rst:624 +#: ../../library/contextlib.rst:649 msgid "Examples and Recipes" msgstr "" -#: ../../library/contextlib.rst:626 +#: ../../library/contextlib.rst:651 msgid "" "This section describes some examples and recipes for making effective use of " "the tools provided by :mod:`contextlib`." msgstr "" -#: ../../library/contextlib.rst:631 +#: ../../library/contextlib.rst:656 msgid "Supporting a variable number of context managers" msgstr "" -#: ../../library/contextlib.rst:633 +#: ../../library/contextlib.rst:658 msgid "" "The primary use case for :class:`ExitStack` is the one given in the class " "documentation: supporting a variable number of context managers and other " @@ -567,18 +595,18 @@ msgid "" "of the context managers being optional::" msgstr "" -#: ../../library/contextlib.rst:648 +#: ../../library/contextlib.rst:673 msgid "" "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " "statements to manage arbitrary resources that don't natively support the " "context management protocol." msgstr "" -#: ../../library/contextlib.rst:654 +#: ../../library/contextlib.rst:679 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -#: ../../library/contextlib.rst:656 +#: ../../library/contextlib.rst:681 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " "method implementation, *without* inadvertently catching exceptions from the :" @@ -587,7 +615,7 @@ msgid "" "be separated slightly in order to allow this::" msgstr "" -#: ../../library/contextlib.rst:671 +#: ../../library/contextlib.rst:696 msgid "" "Actually needing to do this is likely to indicate that the underlying API " "should be providing a direct resource management interface for use with :" @@ -598,29 +626,29 @@ msgid "" "`with` statement." msgstr "" -#: ../../library/contextlib.rst:681 +#: ../../library/contextlib.rst:706 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -#: ../../library/contextlib.rst:683 +#: ../../library/contextlib.rst:708 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " "useful in cleaning up an already allocated resource if later steps in the :" "meth:`__enter__` implementation fail." msgstr "" -#: ../../library/contextlib.rst:687 +#: ../../library/contextlib.rst:712 msgid "" "Here's an example of doing this for a context manager that accepts resource " "acquisition and release functions, along with an optional validation " "function, and maps them to the context management protocol::" msgstr "" -#: ../../library/contextlib.rst:727 +#: ../../library/contextlib.rst:752 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -#: ../../library/contextlib.rst:729 +#: ../../library/contextlib.rst:754 msgid "" "A pattern you will sometimes see is a ``try-finally`` statement with a flag " "variable to indicate whether or not the body of the ``finally`` clause " @@ -628,57 +656,57 @@ msgid "" "by using an ``except`` clause instead), it looks something like this::" msgstr "" -#: ../../library/contextlib.rst:743 +#: ../../library/contextlib.rst:768 msgid "" "As with any ``try`` statement based code, this can cause problems for " "development and review, because the setup code and the cleanup code can end " "up being separated by arbitrarily long sections of code." msgstr "" -#: ../../library/contextlib.rst:747 +#: ../../library/contextlib.rst:772 msgid "" ":class:`ExitStack` makes it possible to instead register a callback for " "execution at the end of a ``with`` statement, and then later decide to skip " "executing that callback::" msgstr "" -#: ../../library/contextlib.rst:759 +#: ../../library/contextlib.rst:784 msgid "" "This allows the intended cleanup up behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" -#: ../../library/contextlib.rst:762 +#: ../../library/contextlib.rst:787 msgid "" "If a particular application uses this pattern a lot, it can be simplified " "even further by means of a small helper class::" msgstr "" -#: ../../library/contextlib.rst:780 +#: ../../library/contextlib.rst:805 msgid "" "If the resource cleanup isn't already neatly bundled into a standalone " "function, then it is still possible to use the decorator form of :meth:" "`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -#: ../../library/contextlib.rst:795 +#: ../../library/contextlib.rst:820 msgid "" "Due to the way the decorator protocol works, a callback function declared " "this way cannot take any parameters. Instead, any resources to be released " "must be accessed as closure variables." msgstr "" -#: ../../library/contextlib.rst:801 +#: ../../library/contextlib.rst:826 msgid "Using a context manager as a function decorator" msgstr "" -#: ../../library/contextlib.rst:803 +#: ../../library/contextlib.rst:828 msgid "" ":class:`ContextDecorator` makes it possible to use a context manager in both " "an ordinary ``with`` statement and also as a function decorator." msgstr "" -#: ../../library/contextlib.rst:806 +#: ../../library/contextlib.rst:831 msgid "" "For example, it is sometimes useful to wrap functions or groups of " "statements with a logger that can track the time of entry and time of exit. " @@ -687,15 +715,15 @@ msgid "" "in a single definition::" msgstr "" -#: ../../library/contextlib.rst:827 +#: ../../library/contextlib.rst:852 msgid "Instances of this class can be used as both a context manager::" msgstr "" -#: ../../library/contextlib.rst:833 +#: ../../library/contextlib.rst:858 msgid "And also as a function decorator::" msgstr "" -#: ../../library/contextlib.rst:840 +#: ../../library/contextlib.rst:865 msgid "" "Note that there is one additional limitation when using context managers as " "function decorators: there's no way to access the return value of :meth:" @@ -703,21 +731,21 @@ msgid "" "explicit ``with`` statement." msgstr "" -#: ../../library/contextlib.rst:848 +#: ../../library/contextlib.rst:873 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../library/contextlib.rst:848 +#: ../../library/contextlib.rst:873 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../library/contextlib.rst:854 +#: ../../library/contextlib.rst:879 msgid "Single use, reusable and reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:856 +#: ../../library/contextlib.rst:881 msgid "" "Most context managers are written in a way that means they can only be used " "effectively in a :keyword:`with` statement once. These single use context " @@ -725,32 +753,32 @@ msgid "" "them a second time will trigger an exception or otherwise not work correctly." msgstr "" -#: ../../library/contextlib.rst:862 +#: ../../library/contextlib.rst:887 msgid "" "This common limitation means that it is generally advisable to create " "context managers directly in the header of the :keyword:`with` statement " "where they are used (as shown in all of the usage examples above)." msgstr "" -#: ../../library/contextlib.rst:866 +#: ../../library/contextlib.rst:891 msgid "" "Files are an example of effectively single use context managers, since the " "first :keyword:`with` statement will close the file, preventing any further " "IO operations using that file object." msgstr "" -#: ../../library/contextlib.rst:870 +#: ../../library/contextlib.rst:895 msgid "" "Context managers created using :func:`contextmanager` are also single use " "context managers, and will complain about the underlying generator failing " "to yield if an attempt is made to use them a second time::" msgstr "" -#: ../../library/contextlib.rst:898 +#: ../../library/contextlib.rst:923 msgid "Reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:900 +#: ../../library/contextlib.rst:925 msgid "" "More sophisticated context managers may be \"reentrant\". These context " "managers can not only be used in multiple :keyword:`with` statements, but " @@ -758,21 +786,21 @@ msgid "" "the same context manager." msgstr "" -#: ../../library/contextlib.rst:905 +#: ../../library/contextlib.rst:930 msgid "" ":class:`threading.RLock` is an example of a reentrant context manager, as " -"are :func:`suppress` and :func:`redirect_stdout`. Here's a very simple " -"example of reentrant use::" +"are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a " +"very simple example of reentrant use::" msgstr "" -#: ../../library/contextlib.rst:924 +#: ../../library/contextlib.rst:949 msgid "" "Real world examples of reentrancy are more likely to involve multiple " "functions calling each other and hence be far more complicated than this " "example." msgstr "" -#: ../../library/contextlib.rst:928 +#: ../../library/contextlib.rst:953 msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " @@ -780,11 +808,11 @@ msgid "" "stdout` to a different stream." msgstr "" -#: ../../library/contextlib.rst:937 +#: ../../library/contextlib.rst:962 msgid "Reusable context managers" msgstr "" -#: ../../library/contextlib.rst:939 +#: ../../library/contextlib.rst:964 msgid "" "Distinct from both single use and reentrant context managers are \"reusable" "\" context managers (or, to be completely explicit, \"reusable, but not " @@ -794,21 +822,21 @@ msgid "" "instance has already been used in a containing with statement." msgstr "" -#: ../../library/contextlib.rst:946 +#: ../../library/contextlib.rst:971 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " "context manager (for a reentrant lock, it is necessary to use :class:" "`threading.RLock` instead)." msgstr "" -#: ../../library/contextlib.rst:950 +#: ../../library/contextlib.rst:975 msgid "" "Another example of a reusable, but not reentrant, context manager is :class:" "`ExitStack`, as it invokes *all* currently registered callbacks when leaving " "any with statement, regardless of where those callbacks were added::" msgstr "" -#: ../../library/contextlib.rst:981 +#: ../../library/contextlib.rst:1006 msgid "" "As the output from the example shows, reusing a single stack object across " "multiple with statements works correctly, but attempting to nest them will " @@ -816,7 +844,7 @@ msgid "" "which is unlikely to be desirable behaviour." msgstr "" -#: ../../library/contextlib.rst:986 +#: ../../library/contextlib.rst:1011 msgid "" "Using separate :class:`ExitStack` instances instead of reusing a single " "instance avoids that problem::" diff --git a/library/crypt.po b/library/crypt.po index 900bc5989b..bcea088d03 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,7 +26,7 @@ msgstr ":mod:`crypt` --- 用於檢查 Unix 密碼的函式" msgid "**Source code:** :source:`Lib/crypt.py`" msgstr "**原始碼:**\\ :source:`Lib/crypt.py`" -#: ../../library/crypt.rst:19 +#: ../../library/crypt.rst:23 msgid "" "The :mod:`crypt` module is deprecated (see :pep:`PEP 594 <594#crypt>` for " "details and alternatives). The :mod:`hashlib` module is a potential " @@ -51,68 +51,79 @@ msgid "" msgstr "" #: ../../library/crypt.rst:40 -msgid ":ref:`Availability `: Unix. Not available on VxWorks." -msgstr ":ref:`適用 `:Unix,在 VxWorks 上不支援。" +msgid ":ref:`Availability `: Unix, not VxWorks." +msgstr ":ref:`適用 `:Unix,非 VxWorks。" -#: ../../library/crypt.rst:42 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/crypt.rst:44 msgid "Hashing Methods" msgstr "" -#: ../../library/crypt.rst:46 +#: ../../library/crypt.rst:48 msgid "" "The :mod:`crypt` module defines the list of hashing methods (not all methods " "are available on all platforms):" msgstr "" -#: ../../library/crypt.rst:51 +#: ../../library/crypt.rst:53 msgid "" "A Modular Crypt Format method with 16 character salt and 86 character hash " "based on the SHA-512 hash function. This is the strongest method." msgstr "" -#: ../../library/crypt.rst:56 +#: ../../library/crypt.rst:58 msgid "" "Another Modular Crypt Format method with 16 character salt and 43 character " "hash based on the SHA-256 hash function." msgstr "" -#: ../../library/crypt.rst:61 +#: ../../library/crypt.rst:63 msgid "" "Another Modular Crypt Format method with 22 character salt and 31 character " "hash based on the Blowfish cipher." msgstr "" -#: ../../library/crypt.rst:68 +#: ../../library/crypt.rst:70 msgid "" "Another Modular Crypt Format method with 8 character salt and 22 character " "hash based on the MD5 hash function." msgstr "" -#: ../../library/crypt.rst:73 +#: ../../library/crypt.rst:75 msgid "" "The traditional method with a 2 character salt and 13 characters of hash. " "This is the weakest method." msgstr "" -#: ../../library/crypt.rst:78 +#: ../../library/crypt.rst:80 msgid "Module Attributes" msgstr "模組屬性" -#: ../../library/crypt.rst:84 +#: ../../library/crypt.rst:86 msgid "" "A list of available password hashing algorithms, as ``crypt.METHOD_*`` " "objects. This list is sorted from strongest to weakest." msgstr "" -#: ../../library/crypt.rst:90 +#: ../../library/crypt.rst:92 msgid "Module Functions" msgstr "模組函式" -#: ../../library/crypt.rst:92 +#: ../../library/crypt.rst:94 msgid "The :mod:`crypt` module defines the following functions:" msgstr ":mod:`crypt` 模組定義了以下函式:" -#: ../../library/crypt.rst:96 +#: ../../library/crypt.rst:98 msgid "" "*word* will usually be a user's password as typed at a prompt or in a " "graphical interface. The optional *salt* is either a string as returned " @@ -122,14 +133,14 @@ msgid "" "strongest method available in :attr:`methods` will be used." msgstr "" -#: ../../library/crypt.rst:103 +#: ../../library/crypt.rst:105 msgid "" "Checking a password is usually done by passing the plain-text password as " "*word* and the full results of a previous :func:`crypt` call, which should " "be the same as the results of this call." msgstr "" -#: ../../library/crypt.rst:107 +#: ../../library/crypt.rst:109 msgid "" "*salt* (either a random 2 or 16 character string, possibly prefixed with ``" "$digit$`` to indicate the method) which will be used to perturb the " @@ -138,36 +149,36 @@ msgid "" "$``." msgstr "" -#: ../../library/crypt.rst:113 +#: ../../library/crypt.rst:115 msgid "" "Returns the hashed password as a string, which will be composed of " "characters from the same alphabet as the salt." msgstr "" -#: ../../library/crypt.rst:118 +#: ../../library/crypt.rst:120 msgid "" "Since a few :manpage:`crypt(3)` extensions allow different values, with " "different sizes in the *salt*, it is recommended to use the full crypted " "password as salt when checking for a password." msgstr "" -#: ../../library/crypt.rst:122 +#: ../../library/crypt.rst:124 msgid "Accept ``crypt.METHOD_*`` values in addition to strings for *salt*." msgstr "" -#: ../../library/crypt.rst:128 +#: ../../library/crypt.rst:130 msgid "" "Return a randomly generated salt of the specified method. If no *method* is " "given, the strongest method available in :attr:`methods` is used." msgstr "" -#: ../../library/crypt.rst:132 +#: ../../library/crypt.rst:134 msgid "" "The return value is a string suitable for passing as the *salt* argument to :" "func:`crypt`." msgstr "" -#: ../../library/crypt.rst:135 +#: ../../library/crypt.rst:137 msgid "" "*rounds* specifies the number of rounds for ``METHOD_SHA256``, " "``METHOD_SHA512`` and ``METHOD_BLOWFISH``. For ``METHOD_SHA256`` and " @@ -177,22 +188,22 @@ msgid "" "sup:`31`), the default is ``4096`` (2\\ :sup:`12`)." msgstr "" -#: ../../library/crypt.rst:145 +#: ../../library/crypt.rst:147 msgid "Added the *rounds* parameter." msgstr "新增 *rounds* 參數。" -#: ../../library/crypt.rst:150 +#: ../../library/crypt.rst:152 msgid "Examples" msgstr "範例" -#: ../../library/crypt.rst:152 +#: ../../library/crypt.rst:154 msgid "" "A simple example illustrating typical use (a constant-time comparison " "operation is needed to limit exposure to timing attacks. :func:`hmac." "compare_digest` is suitable for this purpose)::" msgstr "" -#: ../../library/crypt.rst:172 +#: ../../library/crypt.rst:174 msgid "" "To generate a hash of a password using the strongest available method and " "check it against the original::" diff --git a/library/csv.po b/library/csv.po index b8787a205c..d2c698b7b2 100644 --- a/library/csv.po +++ b/library/csv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-08 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -400,56 +400,64 @@ msgid "" "escaping." msgstr "" -#: ../../library/csv.rst:389 +#: ../../library/csv.rst:386 +msgid "An empty *escapechar* is not allowed." +msgstr "" + +#: ../../library/csv.rst:391 msgid "" "The string used to terminate lines produced by the :class:`writer`. It " "defaults to ``'\\r\\n'``." msgstr "" -#: ../../library/csv.rst:394 +#: ../../library/csv.rst:396 msgid "" "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " "as end-of-line, and ignores *lineterminator*. This behavior may change in " "the future." msgstr "" -#: ../../library/csv.rst:401 +#: ../../library/csv.rst:403 msgid "" "A one-character string used to quote fields containing special characters, " "such as the *delimiter* or *quotechar*, or which contain new-line " "characters. It defaults to ``'\"'``." msgstr "" -#: ../../library/csv.rst:408 +#: ../../library/csv.rst:407 +msgid "An empty *quotechar* is not allowed." +msgstr "" + +#: ../../library/csv.rst:412 msgid "" "Controls when quotes should be generated by the writer and recognised by the " "reader. It can take on any of the :const:`QUOTE_\\*` constants (see " "section :ref:`csv-contents`) and defaults to :const:`QUOTE_MINIMAL`." msgstr "" -#: ../../library/csv.rst:415 +#: ../../library/csv.rst:419 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " "ignored. The default is :const:`False`." msgstr "" -#: ../../library/csv.rst:421 +#: ../../library/csv.rst:425 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" -#: ../../library/csv.rst:425 +#: ../../library/csv.rst:429 msgid "Reader Objects" msgstr "" -#: ../../library/csv.rst:427 +#: ../../library/csv.rst:431 msgid "" "Reader objects (:class:`DictReader` instances and objects returned by the :" "func:`reader` function) have the following public methods:" msgstr "" -#: ../../library/csv.rst:432 +#: ../../library/csv.rst:436 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " @@ -457,35 +465,35 @@ msgid "" "should call this as ``next(reader)``." msgstr "" -#: ../../library/csv.rst:438 +#: ../../library/csv.rst:442 msgid "Reader objects have the following public attributes:" msgstr "" -#: ../../library/csv.rst:442 +#: ../../library/csv.rst:446 msgid "A read-only description of the dialect in use by the parser." msgstr "" -#: ../../library/csv.rst:447 +#: ../../library/csv.rst:451 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "" -#: ../../library/csv.rst:451 +#: ../../library/csv.rst:455 msgid "DictReader objects have the following public attribute:" msgstr "" -#: ../../library/csv.rst:455 +#: ../../library/csv.rst:459 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." msgstr "" -#: ../../library/csv.rst:462 +#: ../../library/csv.rst:466 msgid "Writer Objects" msgstr "" -#: ../../library/csv.rst:464 +#: ../../library/csv.rst:468 msgid "" ":class:`Writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -497,100 +505,100 @@ msgid "" "complex numbers at all)." msgstr "" -#: ../../library/csv.rst:475 +#: ../../library/csv.rst:479 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " "*write* method of the underlying file object." msgstr "" -#: ../../library/csv.rst:479 +#: ../../library/csv.rst:483 msgid "Added support of arbitrary iterables." msgstr "" -#: ../../library/csv.rst:484 +#: ../../library/csv.rst:488 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " "dialect." msgstr "" -#: ../../library/csv.rst:488 +#: ../../library/csv.rst:492 msgid "Writer objects have the following public attribute:" msgstr "" -#: ../../library/csv.rst:493 +#: ../../library/csv.rst:497 msgid "A read-only description of the dialect in use by the writer." msgstr "" -#: ../../library/csv.rst:496 +#: ../../library/csv.rst:500 msgid "DictWriter objects have the following public method:" msgstr "" -#: ../../library/csv.rst:501 +#: ../../library/csv.rst:505 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " "return value of the :meth:`csvwriter.writerow` call used internally." msgstr "" -#: ../../library/csv.rst:506 +#: ../../library/csv.rst:510 msgid "" ":meth:`writeheader` now also returns the value returned by the :meth:" "`csvwriter.writerow` method it uses internally." msgstr "" -#: ../../library/csv.rst:514 +#: ../../library/csv.rst:518 msgid "Examples" msgstr "範例" -#: ../../library/csv.rst:516 +#: ../../library/csv.rst:520 msgid "The simplest example of reading a CSV file::" msgstr "" -#: ../../library/csv.rst:524 +#: ../../library/csv.rst:528 msgid "Reading a file with an alternate format::" msgstr "" -#: ../../library/csv.rst:532 +#: ../../library/csv.rst:536 msgid "The corresponding simplest possible writing example is::" msgstr "" -#: ../../library/csv.rst:539 +#: ../../library/csv.rst:543 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " "default be decoded into unicode using the system default encoding (see :func:" -"`locale.getpreferredencoding`). To decode a file using a different " -"encoding, use the ``encoding`` argument of open::" +"`locale.getencoding`). To decode a file using a different encoding, use the " +"``encoding`` argument of open::" msgstr "" -#: ../../library/csv.rst:550 +#: ../../library/csv.rst:554 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." msgstr "" -#: ../../library/csv.rst:553 +#: ../../library/csv.rst:557 msgid "Registering a new dialect::" msgstr "" -#: ../../library/csv.rst:560 +#: ../../library/csv.rst:564 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "" -#: ../../library/csv.rst:572 +#: ../../library/csv.rst:576 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "" -#: ../../library/csv.rst:581 +#: ../../library/csv.rst:585 msgid "Footnotes" msgstr "註解" -#: ../../library/csv.rst:582 +#: ../../library/csv.rst:586 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " "will not be interpreted correctly, and on platforms that use ``\\r\\n`` " diff --git a/library/ctypes.po b/library/ctypes.po index 35bb771873..035429a77d 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -206,7 +206,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:211 ../../library/ctypes.rst:2138 +#: ../../library/ctypes.rst:211 ../../library/ctypes.rst:2137 msgid "Fundamental data types" msgstr "" @@ -463,36 +463,35 @@ msgstr "" #: ../../library/ctypes.rst:333 msgid "" -"The :func:`create_string_buffer` function replaces the :func:`c_buffer` " -"function (which is still available as an alias), as well as the :func:" -"`c_string` function from earlier ctypes releases. To create a mutable " -"memory block containing unicode characters of the C type :c:expr:`wchar_t` " -"use the :func:`create_unicode_buffer` function." +"The :func:`create_string_buffer` function replaces the old :func:`c_buffer` " +"function (which is still available as an alias). To create a mutable memory " +"block containing unicode characters of the C type :c:expr:`wchar_t`, use " +"the :func:`create_unicode_buffer` function." msgstr "" -#: ../../library/ctypes.rst:343 +#: ../../library/ctypes.rst:342 msgid "Calling functions, continued" msgstr "" -#: ../../library/ctypes.rst:345 +#: ../../library/ctypes.rst:344 msgid "" "Note that printf prints to the real standard output channel, *not* to :data:" "`sys.stdout`, so these examples will only work at the console prompt, not " "from within *IDLE* or *PythonWin*::" msgstr "" -#: ../../library/ctypes.rst:365 +#: ../../library/ctypes.rst:364 msgid "" "As has been mentioned before, all Python types except integers, strings, and " "bytes objects have to be wrapped in their corresponding :mod:`ctypes` type, " "so that they can be converted to the required C data type::" msgstr "" -#: ../../library/ctypes.rst:378 +#: ../../library/ctypes.rst:377 msgid "Calling functions with your own custom data types" msgstr "" -#: ../../library/ctypes.rst:380 +#: ../../library/ctypes.rst:379 msgid "" "You can also customize :mod:`ctypes` argument conversion to allow instances " "of your own classes be used as function arguments. :mod:`ctypes` looks for " @@ -500,24 +499,24 @@ msgid "" "Of course, it must be one of integer, string, or bytes::" msgstr "" -#: ../../library/ctypes.rst:395 +#: ../../library/ctypes.rst:394 msgid "" "If you don't want to store the instance's data in the :attr:`_as_parameter_` " "instance variable, you could define a :class:`property` which makes the " "attribute available on request." msgstr "" -#: ../../library/ctypes.rst:403 +#: ../../library/ctypes.rst:402 msgid "Specifying the required argument types (function prototypes)" msgstr "" -#: ../../library/ctypes.rst:405 +#: ../../library/ctypes.rst:404 msgid "" "It is possible to specify the required argument types of functions exported " "from DLLs by setting the :attr:`argtypes` attribute." msgstr "" -#: ../../library/ctypes.rst:408 +#: ../../library/ctypes.rst:407 msgid "" ":attr:`argtypes` must be a sequence of C data types (the ``printf`` function " "is probably not a good example here, because it takes a variable number and " @@ -525,14 +524,14 @@ msgid "" "hand this is quite handy to experiment with this feature)::" msgstr "" -#: ../../library/ctypes.rst:419 +#: ../../library/ctypes.rst:418 msgid "" "Specifying a format protects against incompatible argument types (just as a " "prototype for a C function), and tries to convert the arguments to valid " "types::" msgstr "" -#: ../../library/ctypes.rst:431 +#: ../../library/ctypes.rst:430 msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`from_param` class method for them to be able to " @@ -545,31 +544,31 @@ msgid "" "an object with an :attr:`_as_parameter_` attribute." msgstr "" -#: ../../library/ctypes.rst:445 +#: ../../library/ctypes.rst:444 msgid "Return types" msgstr "" -#: ../../library/ctypes.rst:447 +#: ../../library/ctypes.rst:446 msgid "" "By default functions are assumed to return the C :c:expr:`int` type. Other " "return types can be specified by setting the :attr:`restype` attribute of " "the function object." msgstr "" -#: ../../library/ctypes.rst:451 +#: ../../library/ctypes.rst:450 msgid "" "Here is a more advanced example, it uses the ``strchr`` function, which " "expects a string pointer and a char, and returns a pointer to a string::" msgstr "" -#: ../../library/ctypes.rst:464 +#: ../../library/ctypes.rst:463 msgid "" "If you want to avoid the ``ord(\"x\")`` calls above, you can set the :attr:" "`argtypes` attribute, and the second argument will be converted from a " "single character Python bytes object into a C char::" msgstr "" -#: ../../library/ctypes.rst:482 +#: ../../library/ctypes.rst:481 msgid "" "You can also use a callable Python object (a function or a class for " "example) as the :attr:`restype` attribute, if the foreign function returns " @@ -579,7 +578,7 @@ msgid "" "automatically raise an exception::" msgstr "" -#: ../../library/ctypes.rst:505 +#: ../../library/ctypes.rst:504 msgid "" "``WinError`` is a function which will call Windows ``FormatMessage()`` api " "to get the string representation of an error code, and *returns* an " @@ -587,17 +586,17 @@ msgid "" "used, it calls :func:`GetLastError` to retrieve it." msgstr "" -#: ../../library/ctypes.rst:510 +#: ../../library/ctypes.rst:509 msgid "" "Please note that a much more powerful error checking mechanism is available " "through the :attr:`errcheck` attribute; see the reference manual for details." msgstr "" -#: ../../library/ctypes.rst:517 +#: ../../library/ctypes.rst:516 msgid "Passing pointers (or: passing parameters by reference)" msgstr "" -#: ../../library/ctypes.rst:519 +#: ../../library/ctypes.rst:518 msgid "" "Sometimes a C api function expects a *pointer* to a data type as parameter, " "probably to write into the corresponding location, or if the data is too " @@ -605,7 +604,7 @@ msgid "" "reference*." msgstr "" -#: ../../library/ctypes.rst:523 +#: ../../library/ctypes.rst:522 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " "parameters by reference. The same effect can be achieved with the :func:" @@ -614,11 +613,11 @@ msgid "" "you don't need the pointer object in Python itself::" msgstr "" -#: ../../library/ctypes.rst:545 +#: ../../library/ctypes.rst:544 msgid "Structures and unions" msgstr "" -#: ../../library/ctypes.rst:547 +#: ../../library/ctypes.rst:546 msgid "" "Structures and unions must derive from the :class:`Structure` and :class:" "`Union` base classes which are defined in the :mod:`ctypes` module. Each " @@ -626,44 +625,44 @@ msgid "" "a list of *2-tuples*, containing a *field name* and a *field type*." msgstr "" -#: ../../library/ctypes.rst:552 +#: ../../library/ctypes.rst:551 msgid "" "The field type must be a :mod:`ctypes` type like :class:`c_int`, or any " "other derived :mod:`ctypes` type: structure, union, array, pointer." msgstr "" -#: ../../library/ctypes.rst:555 +#: ../../library/ctypes.rst:554 msgid "" "Here is a simple example of a POINT structure, which contains two integers " "named *x* and *y*, and also shows how to initialize a structure in the " "constructor::" msgstr "" -#: ../../library/ctypes.rst:575 +#: ../../library/ctypes.rst:574 msgid "" "You can, however, build much more complicated structures. A structure can " "itself contain other structures by using a structure as a field type." msgstr "" -#: ../../library/ctypes.rst:578 +#: ../../library/ctypes.rst:577 msgid "" "Here is a RECT structure which contains two POINTs named *upperleft* and " "*lowerright*::" msgstr "" -#: ../../library/ctypes.rst:592 +#: ../../library/ctypes.rst:591 msgid "" "Nested structures can also be initialized in the constructor in several " "ways::" msgstr "" -#: ../../library/ctypes.rst:597 +#: ../../library/ctypes.rst:596 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " "useful for debugging because they can provide useful information::" msgstr "" -#: ../../library/ctypes.rst:611 +#: ../../library/ctypes.rst:610 msgid "" ":mod:`ctypes` does not support passing unions or structures with bit-fields " "to functions by value. While this may work on 32-bit x86, it's not " @@ -671,11 +670,11 @@ msgid "" "structures with bit-fields should always be passed to functions by pointer." msgstr "" -#: ../../library/ctypes.rst:617 +#: ../../library/ctypes.rst:616 msgid "Structure/union alignment and byte order" msgstr "" -#: ../../library/ctypes.rst:619 +#: ../../library/ctypes.rst:618 msgid "" "By default, Structure and Union fields are aligned in the same way the C " "compiler does it. It is possible to override this behavior by specifying a :" @@ -684,7 +683,7 @@ msgid "" "This is what ``#pragma pack(n)`` also does in MSVC." msgstr "" -#: ../../library/ctypes.rst:625 +#: ../../library/ctypes.rst:624 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " "build structures with non-native byte order, you can use one of the :class:" @@ -693,91 +692,91 @@ msgid "" "classes cannot contain pointer fields." msgstr "" -#: ../../library/ctypes.rst:635 +#: ../../library/ctypes.rst:634 msgid "Bit fields in structures and unions" msgstr "" -#: ../../library/ctypes.rst:637 +#: ../../library/ctypes.rst:636 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`_fields_` tuples::" msgstr "" -#: ../../library/ctypes.rst:655 +#: ../../library/ctypes.rst:654 msgid "Arrays" msgstr "" -#: ../../library/ctypes.rst:657 +#: ../../library/ctypes.rst:656 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: ../../library/ctypes.rst:659 +#: ../../library/ctypes.rst:658 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: ../../library/ctypes.rst:664 +#: ../../library/ctypes.rst:663 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: ../../library/ctypes.rst:680 +#: ../../library/ctypes.rst:679 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: ../../library/ctypes.rst:686 +#: ../../library/ctypes.rst:685 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: ../../library/ctypes.rst:689 +#: ../../library/ctypes.rst:688 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: ../../library/ctypes.rst:705 +#: ../../library/ctypes.rst:704 msgid "Pointers" msgstr "" -#: ../../library/ctypes.rst:707 +#: ../../library/ctypes.rst:706 msgid "" "Pointer instances are created by calling the :func:`pointer` function on a :" "mod:`ctypes` type::" msgstr "" -#: ../../library/ctypes.rst:715 +#: ../../library/ctypes.rst:714 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: ../../library/ctypes.rst:722 +#: ../../library/ctypes.rst:721 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: ../../library/ctypes.rst:731 +#: ../../library/ctypes.rst:730 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: ../../library/ctypes.rst:743 +#: ../../library/ctypes.rst:742 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: ../../library/ctypes.rst:749 +#: ../../library/ctypes.rst:748 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: ../../library/ctypes.rst:758 +#: ../../library/ctypes.rst:757 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -786,7 +785,7 @@ msgid "" "instead of a single item." msgstr "" -#: ../../library/ctypes.rst:764 +#: ../../library/ctypes.rst:763 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -794,23 +793,23 @@ msgid "" "returns a new type::" msgstr "" -#: ../../library/ctypes.rst:780 +#: ../../library/ctypes.rst:779 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: ../../library/ctypes.rst:788 +#: ../../library/ctypes.rst:787 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: ../../library/ctypes.rst:807 +#: ../../library/ctypes.rst:806 msgid "Type conversions" msgstr "" -#: ../../library/ctypes.rst:809 +#: ../../library/ctypes.rst:808 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`argtypes` list of a function or as the type " @@ -821,7 +820,7 @@ msgid "" "accepts an array of c_int::" msgstr "" -#: ../../library/ctypes.rst:830 +#: ../../library/ctypes.rst:829 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the " @@ -829,11 +828,11 @@ msgid "" "will apply the required :func:`byref` conversion in this case automatically." msgstr "" -#: ../../library/ctypes.rst:835 +#: ../../library/ctypes.rst:834 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: ../../library/ctypes.rst:842 +#: ../../library/ctypes.rst:841 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -842,11 +841,11 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: ../../library/ctypes.rst:854 +#: ../../library/ctypes.rst:853 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: ../../library/ctypes.rst:856 +#: ../../library/ctypes.rst:855 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -855,60 +854,60 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: ../../library/ctypes.rst:867 +#: ../../library/ctypes.rst:866 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: ../../library/ctypes.rst:880 +#: ../../library/ctypes.rst:879 msgid "Incomplete Types" msgstr "" -#: ../../library/ctypes.rst:882 +#: ../../library/ctypes.rst:881 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: ../../library/ctypes.rst:893 +#: ../../library/ctypes.rst:892 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: ../../library/ctypes.rst:906 +#: ../../library/ctypes.rst:905 msgid "" "because the new ``class cell`` is not available in the class statement " "itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" "`_fields_` attribute later, after the class statement::" msgstr "" -#: ../../library/ctypes.rst:918 +#: ../../library/ctypes.rst:917 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: ../../library/ctypes.rst:939 +#: ../../library/ctypes.rst:938 msgid "Callback functions" msgstr "" -#: ../../library/ctypes.rst:941 +#: ../../library/ctypes.rst:940 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: ../../library/ctypes.rst:944 +#: ../../library/ctypes.rst:943 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: ../../library/ctypes.rst:948 +#: ../../library/ctypes.rst:947 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -916,21 +915,21 @@ msgid "" "calling convention." msgstr "" -#: ../../library/ctypes.rst:953 +#: ../../library/ctypes.rst:952 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: ../../library/ctypes.rst:957 +#: ../../library/ctypes.rst:956 msgid "" "I will present an example here which uses the standard C library's :c:func:" "`qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`qsort` will be used to sort an array of integers::" msgstr "" -#: ../../library/ctypes.rst:967 +#: ../../library/ctypes.rst:966 msgid "" ":func:`qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -940,44 +939,44 @@ msgid "" "otherwise." msgstr "" -#: ../../library/ctypes.rst:973 +#: ../../library/ctypes.rst:972 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: ../../library/ctypes.rst:979 +#: ../../library/ctypes.rst:978 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: ../../library/ctypes.rst:989 +#: ../../library/ctypes.rst:988 msgid "The result::" msgstr "" -#: ../../library/ctypes.rst:999 +#: ../../library/ctypes.rst:998 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: ../../library/ctypes.rst:1014 +#: ../../library/ctypes.rst:1013 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: ../../library/ctypes.rst:1021 +#: ../../library/ctypes.rst:1020 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: ../../library/ctypes.rst:1039 +#: ../../library/ctypes.rst:1038 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: ../../library/ctypes.rst:1043 +#: ../../library/ctypes.rst:1042 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -987,11 +986,11 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: ../../library/ctypes.rst:1053 +#: ../../library/ctypes.rst:1052 msgid "Accessing values exported from dlls" msgstr "" -#: ../../library/ctypes.rst:1055 +#: ../../library/ctypes.rst:1054 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_OptimizeFlag`, an " @@ -999,31 +998,31 @@ msgid "" "flag given on startup." msgstr "" -#: ../../library/ctypes.rst:1060 +#: ../../library/ctypes.rst:1059 msgid "" ":mod:`ctypes` can access values like this with the :meth:`in_dll` class " "methods of the type. *pythonapi* is a predefined symbol giving access to " "the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1069 +#: ../../library/ctypes.rst:1068 msgid "" "If the interpreter would have been started with :option:`-O`, the sample " "would have printed ``c_long(1)``, or ``c_long(2)`` if :option:`-OO` would " "have been specified." msgstr "" -#: ../../library/ctypes.rst:1073 +#: ../../library/ctypes.rst:1072 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: ../../library/ctypes.rst:1076 +#: ../../library/ctypes.rst:1075 msgid "Quoting the docs for that value:" msgstr "" -#: ../../library/ctypes.rst:1078 +#: ../../library/ctypes.rst:1077 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -1032,19 +1031,19 @@ msgid "" "frozen modules." msgstr "" -#: ../../library/ctypes.rst:1083 +#: ../../library/ctypes.rst:1082 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1095 +#: ../../library/ctypes.rst:1096 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: ../../library/ctypes.rst:1102 +#: ../../library/ctypes.rst:1103 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -1053,34 +1052,34 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: ../../library/ctypes.rst:1120 +#: ../../library/ctypes.rst:1119 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: ../../library/ctypes.rst:1128 +#: ../../library/ctypes.rst:1127 msgid "Surprises" msgstr "" -#: ../../library/ctypes.rst:1130 +#: ../../library/ctypes.rst:1129 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: ../../library/ctypes.rst:1133 +#: ../../library/ctypes.rst:1132 msgid "Consider the following example::" msgstr "" -#: ../../library/ctypes.rst:1153 +#: ../../library/ctypes.rst:1152 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: ../../library/ctypes.rst:1161 +#: ../../library/ctypes.rst:1160 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -1089,26 +1088,26 @@ msgid "" "have the expected effect." msgstr "" -#: ../../library/ctypes.rst:1167 +#: ../../library/ctypes.rst:1166 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: ../../library/ctypes.rst:1171 +#: ../../library/ctypes.rst:1170 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: ../../library/ctypes.rst:1183 +#: ../../library/ctypes.rst:1182 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: ../../library/ctypes.rst:1186 +#: ../../library/ctypes.rst:1185 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -1117,16 +1116,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: ../../library/ctypes.rst:1196 +#: ../../library/ctypes.rst:1195 msgid "Variable-sized data types" msgstr "" -#: ../../library/ctypes.rst:1198 +#: ../../library/ctypes.rst:1197 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: ../../library/ctypes.rst:1200 +#: ../../library/ctypes.rst:1199 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -1135,35 +1134,35 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: ../../library/ctypes.rst:1220 +#: ../../library/ctypes.rst:1219 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: ../../library/ctypes.rst:1232 +#: ../../library/ctypes.rst:1231 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: ../../library/ctypes.rst:1240 +#: ../../library/ctypes.rst:1239 msgid "ctypes reference" msgstr "" -#: ../../library/ctypes.rst:1246 +#: ../../library/ctypes.rst:1245 msgid "Finding shared libraries" msgstr "" -#: ../../library/ctypes.rst:1248 +#: ../../library/ctypes.rst:1247 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: ../../library/ctypes.rst:1251 +#: ../../library/ctypes.rst:1250 msgid "" "The purpose of the :func:`find_library` function is to locate a library in a " "way similar to what the compiler or runtime loader does (on platforms with " @@ -1172,13 +1171,13 @@ msgid "" "the runtime loader directly." msgstr "" -#: ../../library/ctypes.rst:1257 +#: ../../library/ctypes.rst:1256 msgid "" "The :mod:`ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: ../../library/ctypes.rst:1265 +#: ../../library/ctypes.rst:1264 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -1186,45 +1185,45 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1270 ../../library/ctypes.rst:1913 +#: ../../library/ctypes.rst:1269 ../../library/ctypes.rst:1912 msgid "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:1272 +#: ../../library/ctypes.rst:1271 msgid "" "On Linux, :func:`find_library` tries to run external programs (``/sbin/" "ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library file. It " "returns the filename of the library file." msgstr "" -#: ../../library/ctypes.rst:1276 +#: ../../library/ctypes.rst:1275 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: ../../library/ctypes.rst:1280 +#: ../../library/ctypes.rst:1279 msgid "Here are some examples::" msgstr "" "以下是一些範例:\n" "\n" "::" -#: ../../library/ctypes.rst:1291 +#: ../../library/ctypes.rst:1290 msgid "" "On macOS, :func:`find_library` tries several predefined naming schemes and " "paths to locate the library, and returns a full pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1305 +#: ../../library/ctypes.rst:1304 msgid "" "On Windows, :func:`find_library` searches along the system search path, and " "returns the full pathname, but since there is no predefined naming scheme a " "call like ``find_library(\"c\")`` will fail and return ``None``." msgstr "" -#: ../../library/ctypes.rst:1309 +#: ../../library/ctypes.rst:1308 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -1232,24 +1231,24 @@ msgid "" "library at runtime." msgstr "" -#: ../../library/ctypes.rst:1317 +#: ../../library/ctypes.rst:1316 msgid "Loading shared libraries" msgstr "" -#: ../../library/ctypes.rst:1319 +#: ../../library/ctypes.rst:1318 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: ../../library/ctypes.rst:1325 +#: ../../library/ctypes.rst:1324 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: ../../library/ctypes.rst:1329 +#: ../../library/ctypes.rst:1328 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " "exists. When a dependent DLL of the loaded DLL is not found, a :exc:" @@ -1261,13 +1260,13 @@ msgid "" "determine which one is not found using Windows debugging and tracing tools." msgstr "" -#: ../../library/ctypes.rst:1341 +#: ../../library/ctypes.rst:1340 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: ../../library/ctypes.rst:1347 +#: ../../library/ctypes.rst:1346 msgid "" "Windows only: Instances of this class represent loaded shared libraries, " "functions in these libraries use the ``stdcall`` calling convention, and are " @@ -1277,24 +1276,24 @@ msgid "" "value signals a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1354 +#: ../../library/ctypes.rst:1353 msgid ":exc:`WindowsError` used to be raised." msgstr "" -#: ../../library/ctypes.rst:1360 +#: ../../library/ctypes.rst:1359 msgid "" "Windows only: Instances of this class represent loaded shared libraries, " "functions in these libraries use the ``stdcall`` calling convention, and are " "assumed to return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1364 +#: ../../library/ctypes.rst:1363 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1370 +#: ../../library/ctypes.rst:1369 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -1302,11 +1301,11 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1375 +#: ../../library/ctypes.rst:1374 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1377 +#: ../../library/ctypes.rst:1376 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " @@ -1316,7 +1315,7 @@ msgid "" "to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1384 +#: ../../library/ctypes.rst:1383 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -1324,7 +1323,7 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1389 +#: ../../library/ctypes.rst:1388 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " "allows accessing the system :data:`errno` error number in a safe way. :mod:" @@ -1334,14 +1333,14 @@ msgid "" "private copy, the same happens immediately after the function call." msgstr "" -#: ../../library/ctypes.rst:1396 +#: ../../library/ctypes.rst:1395 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1400 +#: ../../library/ctypes.rst:1399 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " "for the Windows error code which is managed by the :func:`GetLastError` and :" @@ -1350,7 +1349,7 @@ msgid "" "private copy of the windows error code." msgstr "" -#: ../../library/ctypes.rst:1406 +#: ../../library/ctypes.rst:1405 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -1360,29 +1359,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1413 +#: ../../library/ctypes.rst:1412 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1420 +#: ../../library/ctypes.rst:1419 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1427 +#: ../../library/ctypes.rst:1426 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1434 +#: ../../library/ctypes.rst:1433 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1437 +#: ../../library/ctypes.rst:1436 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -1391,21 +1390,21 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1450 +#: ../../library/ctypes.rst:1449 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1456 +#: ../../library/ctypes.rst:1455 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1461 +#: ../../library/ctypes.rst:1460 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1463 +#: ../../library/ctypes.rst:1462 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -1413,52 +1412,52 @@ msgid "" "attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1471 +#: ../../library/ctypes.rst:1470 msgid "" "Class which loads shared libraries. *dlltype* should be one of the :class:" "`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: ../../library/ctypes.rst:1474 +#: ../../library/ctypes.rst:1473 msgid "" ":meth:`__getattr__` has special behavior: It allows loading a shared library " "by accessing it as attribute of a library loader instance. The result is " "cached, so repeated attribute accesses return the same library each time." msgstr "" -#: ../../library/ctypes.rst:1480 +#: ../../library/ctypes.rst:1479 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1484 +#: ../../library/ctypes.rst:1483 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1489 +#: ../../library/ctypes.rst:1488 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1495 +#: ../../library/ctypes.rst:1494 msgid "Windows only: Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1501 +#: ../../library/ctypes.rst:1500 msgid "Windows only: Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1507 +#: ../../library/ctypes.rst:1506 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1510 +#: ../../library/ctypes.rst:1509 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1516 +#: ../../library/ctypes.rst:1515 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " "attributes. Note that all these functions are assumed to return C :c:expr:" @@ -1466,50 +1465,50 @@ msgid "" "correct :attr:`restype` attribute to use these functions." msgstr "" -#: ../../library/ctypes.rst:1521 +#: ../../library/ctypes.rst:1520 msgid "" "Raises an :ref:`auditing event ` ``ctypes.dlopen`` with argument " "``name``." msgstr "" -#: ../../library/ctypes.rst:1523 +#: ../../library/ctypes.rst:1522 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1527 +#: ../../library/ctypes.rst:1526 msgid "" "Raises an :ref:`auditing event ` ``ctypes.dlsym`` with arguments " "``library``, ``name``." msgstr "" -#: ../../library/ctypes.rst:1529 +#: ../../library/ctypes.rst:1528 msgid "" "Accessing a function on a loaded library raises an auditing event ``ctypes." "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" -#: ../../library/ctypes.rst:1533 +#: ../../library/ctypes.rst:1532 msgid "" "Raises an :ref:`auditing event ` ``ctypes.dlsym/handle`` with " "arguments ``handle``, ``name``." msgstr "" -#: ../../library/ctypes.rst:1535 +#: ../../library/ctypes.rst:1534 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1542 +#: ../../library/ctypes.rst:1541 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1544 +#: ../../library/ctypes.rst:1543 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -1518,29 +1517,29 @@ msgid "" "library loader. They are instances of a private class:" msgstr "" -#: ../../library/ctypes.rst:1553 +#: ../../library/ctypes.rst:1552 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1555 +#: ../../library/ctypes.rst:1554 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1558 +#: ../../library/ctypes.rst:1557 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1563 +#: ../../library/ctypes.rst:1562 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1566 +#: ../../library/ctypes.rst:1565 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -1550,7 +1549,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1575 +#: ../../library/ctypes.rst:1574 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -1559,7 +1558,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1581 +#: ../../library/ctypes.rst:1580 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`from_param` class method of the items in the :attr:`argtypes` tuple, " @@ -1569,7 +1568,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1588 +#: ../../library/ctypes.rst:1587 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`from_param` method which returns a value " @@ -1577,50 +1576,50 @@ msgid "" "adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1595 +#: ../../library/ctypes.rst:1594 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1602 +#: ../../library/ctypes.rst:1601 msgid "" "*result* is what the foreign function returns, as specified by the :attr:" "`restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1605 +#: ../../library/ctypes.rst:1604 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1609 +#: ../../library/ctypes.rst:1608 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1613 +#: ../../library/ctypes.rst:1612 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1620 +#: ../../library/ctypes.rst:1619 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:1624 +#: ../../library/ctypes.rst:1623 msgid "" "Raises an :ref:`auditing event ` ``ctypes.seh_exception`` with " "argument ``code``." msgstr "" -#: ../../library/ctypes.rst:1626 +#: ../../library/ctypes.rst:1625 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -1629,24 +1628,24 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1632 +#: ../../library/ctypes.rst:1631 msgid "" "Raises an :ref:`auditing event ` ``ctypes.call_function`` with " "arguments ``func_pointer``, ``arguments``." msgstr "" -#: ../../library/ctypes.rst:1634 +#: ../../library/ctypes.rst:1633 msgid "" "Some ways to invoke foreign function calls may raise an auditing event " "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" -#: ../../library/ctypes.rst:1640 +#: ../../library/ctypes.rst:1639 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1642 +#: ../../library/ctypes.rst:1641 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -1657,7 +1656,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1653 +#: ../../library/ctypes.rst:1652 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -1666,37 +1665,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1663 +#: ../../library/ctypes.rst:1662 msgid "" "Windows only: The returned function prototype creates functions that use the " "``stdcall`` calling convention. The function will release the GIL during " "the call. *use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1671 +#: ../../library/ctypes.rst:1670 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1674 +#: ../../library/ctypes.rst:1673 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1682 +#: ../../library/ctypes.rst:1681 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1689 +#: ../../library/ctypes.rst:1688 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1696 +#: ../../library/ctypes.rst:1695 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -1704,7 +1703,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1706 +#: ../../library/ctypes.rst:1705 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -1712,85 +1711,85 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1711 +#: ../../library/ctypes.rst:1710 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1715 +#: ../../library/ctypes.rst:1714 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1718 +#: ../../library/ctypes.rst:1717 msgid "*paramflags* must be a tuple of the same length as :attr:`argtypes`." msgstr "" -#: ../../library/ctypes.rst:1720 +#: ../../library/ctypes.rst:1719 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1723 +#: ../../library/ctypes.rst:1722 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1727 +#: ../../library/ctypes.rst:1726 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1727 +#: ../../library/ctypes.rst:1726 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1730 +#: ../../library/ctypes.rst:1729 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1730 +#: ../../library/ctypes.rst:1729 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1733 +#: ../../library/ctypes.rst:1732 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1733 +#: ../../library/ctypes.rst:1732 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1735 +#: ../../library/ctypes.rst:1734 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1738 +#: ../../library/ctypes.rst:1737 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1740 +#: ../../library/ctypes.rst:1739 msgid "" "This example demonstrates how to wrap the Windows ``MessageBoxW`` function " "so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1751 ../../library/ctypes.rst:1774 +#: ../../library/ctypes.rst:1750 ../../library/ctypes.rst:1773 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1759 +#: ../../library/ctypes.rst:1758 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1765 +#: ../../library/ctypes.rst:1764 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -1798,7 +1797,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1783 +#: ../../library/ctypes.rst:1782 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -1806,7 +1805,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1788 +#: ../../library/ctypes.rst:1787 msgid "" "Output parameters can be combined with the :attr:`errcheck` protocol to do " "further output processing and error checking. The win32 ``GetWindowRect`` " @@ -1815,7 +1814,7 @@ msgid "" "call failed::" msgstr "" -#: ../../library/ctypes.rst:1801 +#: ../../library/ctypes.rst:1800 msgid "" "If the :attr:`errcheck` function returns the argument tuple it receives " "unchanged, :mod:`ctypes` continues the normal processing it does on the " @@ -1824,46 +1823,46 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1820 +#: ../../library/ctypes.rst:1819 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1824 +#: ../../library/ctypes.rst:1823 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1827 +#: ../../library/ctypes.rst:1826 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -#: ../../library/ctypes.rst:1832 +#: ../../library/ctypes.rst:1831 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1838 +#: ../../library/ctypes.rst:1837 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1842 +#: ../../library/ctypes.rst:1841 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1846 +#: ../../library/ctypes.rst:1845 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1852 +#: ../../library/ctypes.rst:1851 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -1871,19 +1870,19 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1860 +#: ../../library/ctypes.rst:1859 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1863 +#: ../../library/ctypes.rst:1862 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1866 +#: ../../library/ctypes.rst:1865 msgid "" "If a bytes object is specified as first argument, the buffer is made one " "item larger than its length so that the last element in the array is a NUL " @@ -1892,25 +1891,25 @@ msgid "" "not be used." msgstr "" -#: ../../library/ctypes.rst:1871 +#: ../../library/ctypes.rst:1870 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." msgstr "" -#: ../../library/ctypes.rst:1876 +#: ../../library/ctypes.rst:1875 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:1879 +#: ../../library/ctypes.rst:1878 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1882 +#: ../../library/ctypes.rst:1881 msgid "" "If a string is specified as first argument, the buffer is made one item " "larger than the length of the string so that the last element in the array " @@ -1919,27 +1918,27 @@ msgid "" "should not be used." msgstr "" -#: ../../library/ctypes.rst:1888 +#: ../../library/ctypes.rst:1887 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." msgstr "" -#: ../../library/ctypes.rst:1893 +#: ../../library/ctypes.rst:1892 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllCanUnloadNow function " "that the _ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1900 +#: ../../library/ctypes.rst:1899 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllGetClassObject function " "that the ``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1908 +#: ../../library/ctypes.rst:1907 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -1947,92 +1946,92 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1919 +#: ../../library/ctypes.rst:1918 msgid "" "Windows only: return the filename of the VC runtime library used by Python, " "and by the extension modules. If the name of the library cannot be " "determined, ``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:1923 +#: ../../library/ctypes.rst:1922 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:1930 +#: ../../library/ctypes.rst:1929 msgid "" "Windows only: Returns a textual description of the error code *code*. If no " "error code is specified, the last error code is used by calling the Windows " "api function GetLastError." msgstr "" -#: ../../library/ctypes.rst:1937 +#: ../../library/ctypes.rst:1936 msgid "" "Windows only: Returns the last error code set by Windows in the calling " "thread. This function calls the Windows `GetLastError()` function directly, " "it does not return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:1943 +#: ../../library/ctypes.rst:1942 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:1946 +#: ../../library/ctypes.rst:1945 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" -#: ../../library/ctypes.rst:1950 +#: ../../library/ctypes.rst:1949 msgid "" "Windows only: returns the current value of the ctypes-private copy of the " "system :data:`LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:1953 +#: ../../library/ctypes.rst:1952 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" -#: ../../library/ctypes.rst:1957 +#: ../../library/ctypes.rst:1956 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:1964 +#: ../../library/ctypes.rst:1963 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:1971 +#: ../../library/ctypes.rst:1970 msgid "" "This factory function creates and returns a new ctypes pointer type. Pointer " "types are cached and reused internally, so calling this function repeatedly " "is cheap. *type* must be a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1978 +#: ../../library/ctypes.rst:1977 msgid "" "This function creates a new pointer instance, pointing to *obj*. The " "returned object is of the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:1981 +#: ../../library/ctypes.rst:1980 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:1987 +#: ../../library/ctypes.rst:1986 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -2040,51 +2039,51 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:1995 +#: ../../library/ctypes.rst:1994 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:1998 +#: ../../library/ctypes.rst:1997 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -#: ../../library/ctypes.rst:2003 +#: ../../library/ctypes.rst:2002 msgid "" "Windows only: set the current value of the ctypes-private copy of the " "system :data:`LastError` variable in the calling thread to *value* and " "return the previous value." msgstr "" -#: ../../library/ctypes.rst:2007 +#: ../../library/ctypes.rst:2006 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -#: ../../library/ctypes.rst:2012 +#: ../../library/ctypes.rst:2011 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2018 +#: ../../library/ctypes.rst:2017 msgid "" "This function returns the C string starting at memory address *address* as a " "bytes object. If size is specified, it is used as size, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2022 +#: ../../library/ctypes.rst:2021 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``address``, ``size``." msgstr "" -#: ../../library/ctypes.rst:2027 +#: ../../library/ctypes.rst:2026 msgid "" "Windows only: this function is probably the worst-named thing in ctypes. It " "creates an instance of OSError. If *code* is not specified, " @@ -2093,11 +2092,11 @@ msgid "" "error." msgstr "" -#: ../../library/ctypes.rst:2033 +#: ../../library/ctypes.rst:2032 msgid "An instance of :exc:`WindowsError` used to be created." msgstr "" -#: ../../library/ctypes.rst:2039 +#: ../../library/ctypes.rst:2038 msgid "" "This function returns the wide character string starting at memory address " "*address* as a string. If *size* is specified, it is used as the number of " @@ -2105,17 +2104,17 @@ msgid "" "terminated." msgstr "" -#: ../../library/ctypes.rst:2044 +#: ../../library/ctypes.rst:2043 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``address``, ``size``." msgstr "" -#: ../../library/ctypes.rst:2050 +#: ../../library/ctypes.rst:2049 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2055 +#: ../../library/ctypes.rst:2054 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -2125,13 +2124,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2061 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2067 +#: ../../library/ctypes.rst:2066 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -2140,13 +2139,13 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2073 ../../library/ctypes.rst:2083 +#: ../../library/ctypes.rst:2072 ../../library/ctypes.rst:2082 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." msgstr "" -#: ../../library/ctypes.rst:2077 +#: ../../library/ctypes.rst:2076 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -2154,25 +2153,25 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2087 +#: ../../library/ctypes.rst:2086 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2090 +#: ../../library/ctypes.rst:2089 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata`` with argument " "``address``." msgstr "" -#: ../../library/ctypes.rst:2092 +#: ../../library/ctypes.rst:2091 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2098 +#: ../../library/ctypes.rst:2097 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -2180,25 +2179,25 @@ msgid "" "be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2103 +#: ../../library/ctypes.rst:2102 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2109 +#: ../../library/ctypes.rst:2108 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2113 +#: ../../library/ctypes.rst:2112 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2117 +#: ../../library/ctypes.rst:2116 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -2206,13 +2205,13 @@ msgid "" "block." msgstr "" -#: ../../library/ctypes.rst:2124 +#: ../../library/ctypes.rst:2123 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2129 +#: ../../library/ctypes.rst:2128 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -2220,7 +2219,7 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2142 +#: ../../library/ctypes.rst:2141 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -2229,11 +2228,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2148 +#: ../../library/ctypes.rst:2147 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2152 +#: ../../library/ctypes.rst:2151 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -2241,7 +2240,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2157 +#: ../../library/ctypes.rst:2156 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -2249,7 +2248,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2163 +#: ../../library/ctypes.rst:2162 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -2258,7 +2257,7 @@ msgid "" "receive a Python bytes object, *not* a :class:`c_char_p` instance." msgstr "" -#: ../../library/ctypes.rst:2171 +#: ../../library/ctypes.rst:2170 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`restype` is a subclass of :class:`c_void_p`, you " @@ -2266,25 +2265,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2176 +#: ../../library/ctypes.rst:2175 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2180 +#: ../../library/ctypes.rst:2179 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2187 +#: ../../library/ctypes.rst:2186 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2194 +#: ../../library/ctypes.rst:2193 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -2292,178 +2291,178 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2202 +#: ../../library/ctypes.rst:2201 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2208 +#: ../../library/ctypes.rst:2207 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2214 +#: ../../library/ctypes.rst:2213 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2220 +#: ../../library/ctypes.rst:2219 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2227 +#: ../../library/ctypes.rst:2226 msgid "" "Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2233 +#: ../../library/ctypes.rst:2232 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2239 +#: ../../library/ctypes.rst:2238 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2245 +#: ../../library/ctypes.rst:2244 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2251 +#: ../../library/ctypes.rst:2250 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2257 +#: ../../library/ctypes.rst:2256 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2263 +#: ../../library/ctypes.rst:2262 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2269 +#: ../../library/ctypes.rst:2268 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2274 +#: ../../library/ctypes.rst:2273 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2281 +#: ../../library/ctypes.rst:2280 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2288 +#: ../../library/ctypes.rst:2287 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2295 +#: ../../library/ctypes.rst:2294 msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2301 +#: ../../library/ctypes.rst:2300 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2307 +#: ../../library/ctypes.rst:2306 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2313 +#: ../../library/ctypes.rst:2312 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2319 +#: ../../library/ctypes.rst:2318 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2325 +#: ../../library/ctypes.rst:2324 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2331 +#: ../../library/ctypes.rst:2330 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2337 +#: ../../library/ctypes.rst:2336 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2343 +#: ../../library/ctypes.rst:2342 msgid "" "Represents the C :c:expr:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2350 +#: ../../library/ctypes.rst:2349 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2357 +#: ../../library/ctypes.rst:2356 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2364 +#: ../../library/ctypes.rst:2363 msgid "" "Windows only: Represents a :c:type:`HRESULT` value, which contains success " "or error information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2370 +#: ../../library/ctypes.rst:2369 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2373 +#: ../../library/ctypes.rst:2372 msgid "" "The :mod:`ctypes.wintypes` module provides quite some other Windows specific " "data types, for example :c:type:`HWND`, :c:type:`WPARAM`, or :c:type:" @@ -2471,33 +2470,41 @@ msgid "" "also defined." msgstr "" -#: ../../library/ctypes.rst:2381 +#: ../../library/ctypes.rst:2380 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2386 +#: ../../library/ctypes.rst:2385 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2391 -msgid "Abstract base class for structures in *big endian* byte order." +#: ../../library/ctypes.rst:2390 +msgid "Abstract base class for unions in *big endian* byte order." msgstr "" #: ../../library/ctypes.rst:2396 +msgid "Abstract base class for unions in *little endian* byte order." +msgstr "" + +#: ../../library/ctypes.rst:2402 +msgid "Abstract base class for structures in *big endian* byte order." +msgstr "" + +#: ../../library/ctypes.rst:2407 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2398 +#: ../../library/ctypes.rst:2409 msgid "" -"Structures with non-native byte order cannot contain pointer type fields, or " -"any other data types containing pointer type fields." +"Structures and unions with non-native byte order cannot contain pointer type " +"fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2404 +#: ../../library/ctypes.rst:2415 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2406 +#: ../../library/ctypes.rst:2417 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -2505,34 +2512,34 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2414 +#: ../../library/ctypes.rst:2425 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2418 +#: ../../library/ctypes.rst:2429 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2422 +#: ../../library/ctypes.rst:2433 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2425 +#: ../../library/ctypes.rst:2436 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2435 +#: ../../library/ctypes.rst:2446 msgid "" "The :attr:`_fields_` class variable must, however, be defined before the " "type is first used (an instance is created, :func:`sizeof` is called on it, " @@ -2540,28 +2547,28 @@ msgid "" "raise an AttributeError." msgstr "" -#: ../../library/ctypes.rst:2440 +#: ../../library/ctypes.rst:2451 msgid "" "It is possible to define sub-subclasses of structure types, they inherit the " "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2447 +#: ../../library/ctypes.rst:2458 msgid "" "An optional small integer that allows overriding the alignment of structure " "fields in the instance. :attr:`_pack_` must already be defined when :attr:" "`_fields_` is assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2454 +#: ../../library/ctypes.rst:2465 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2458 +#: ../../library/ctypes.rst:2469 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -2569,11 +2576,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2463 +#: ../../library/ctypes.rst:2474 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2476 +#: ../../library/ctypes.rst:2487 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -2583,7 +2590,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2488 +#: ../../library/ctypes.rst:2499 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -2591,7 +2598,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2493 +#: ../../library/ctypes.rst:2504 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -2601,15 +2608,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2504 +#: ../../library/ctypes.rst:2515 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2508 +#: ../../library/ctypes.rst:2519 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2510 +#: ../../library/ctypes.rst:2521 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -2619,34 +2626,34 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2520 +#: ../../library/ctypes.rst:2531 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2527 +#: ../../library/ctypes.rst:2538 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2530 +#: ../../library/ctypes.rst:2541 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2536 +#: ../../library/ctypes.rst:2547 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2538 +#: ../../library/ctypes.rst:2549 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2542 +#: ../../library/ctypes.rst:2553 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -2655,11 +2662,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2552 +#: ../../library/ctypes.rst:2563 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2556 +#: ../../library/ctypes.rst:2567 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/curses.po b/library/curses.po index daa0eda6f6..8ef7e66e11 100644 --- a/library/curses.po +++ b/library/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,88 +48,75 @@ msgid "" "as a Unicode string or a byte string." msgstr "" -#: ../../library/curses.rst:32 -msgid "" -"Since version 5.4, the ncurses library decides how to interpret non-ASCII " -"data using the ``nl_langinfo`` function. That means that you have to call :" -"func:`locale.setlocale` in the application and encode Unicode strings using " -"one of the system's available encodings. This example uses the system's " -"default encoding::" -msgstr "" - -#: ../../library/curses.rst:42 -msgid "Then use *code* as the encoding for :meth:`str.encode` calls." -msgstr "" - -#: ../../library/curses.rst:47 +#: ../../library/curses.rst:33 msgid "Module :mod:`curses.ascii`" msgstr "" -#: ../../library/curses.rst:47 +#: ../../library/curses.rst:33 msgid "" "Utilities for working with ASCII characters, regardless of your locale " "settings." msgstr "" -#: ../../library/curses.rst:50 +#: ../../library/curses.rst:36 msgid "Module :mod:`curses.panel`" msgstr "" -#: ../../library/curses.rst:50 +#: ../../library/curses.rst:36 msgid "A panel stack extension that adds depth to curses windows." msgstr "" -#: ../../library/curses.rst:53 +#: ../../library/curses.rst:39 msgid "Module :mod:`curses.textpad`" msgstr "" -#: ../../library/curses.rst:53 +#: ../../library/curses.rst:39 msgid "" "Editable text widget for curses supporting :program:`Emacs`\\ -like " "bindings." msgstr "" -#: ../../library/curses.rst:57 +#: ../../library/curses.rst:43 msgid ":ref:`curses-howto`" msgstr ":ref:`curses-howto`" -#: ../../library/curses.rst:56 +#: ../../library/curses.rst:42 msgid "" "Tutorial material on using curses with Python, by Andrew Kuchling and Eric " "Raymond." msgstr "" -#: ../../library/curses.rst:59 +#: ../../library/curses.rst:45 msgid "" "The :source:`Tools/demo/` directory in the Python source distribution " "contains some example programs using the curses bindings provided by this " "module." msgstr "" -#: ../../library/curses.rst:66 +#: ../../library/curses.rst:52 msgid "Functions" msgstr "函式" -#: ../../library/curses.rst:68 +#: ../../library/curses.rst:54 msgid "The module :mod:`curses` defines the following exception:" msgstr "" -#: ../../library/curses.rst:73 +#: ../../library/curses.rst:59 msgid "Exception raised when a curses library function returns an error." msgstr "" -#: ../../library/curses.rst:77 +#: ../../library/curses.rst:63 msgid "" "Whenever *x* or *y* arguments to a function or a method are optional, they " "default to the current cursor location. Whenever *attr* is optional, it " "defaults to :const:`A_NORMAL`." msgstr "" -#: ../../library/curses.rst:81 +#: ../../library/curses.rst:67 msgid "The module :mod:`curses` defines the following functions:" msgstr "" -#: ../../library/curses.rst:86 +#: ../../library/curses.rst:72 msgid "" "Return the output speed of the terminal in bits per second. On software " "terminal emulators it will have a fixed high value. Included for historical " @@ -137,17 +124,17 @@ msgid "" "and occasionally to change interfaces depending on the line speed." msgstr "" -#: ../../library/curses.rst:94 +#: ../../library/curses.rst:80 msgid "Emit a short attention sound." msgstr "" -#: ../../library/curses.rst:99 +#: ../../library/curses.rst:85 msgid "" "Return ``True`` or ``False``, depending on whether the programmer can change " "the colors displayed by the terminal." msgstr "" -#: ../../library/curses.rst:105 +#: ../../library/curses.rst:91 msgid "" "Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal " "tty line buffering is turned off and characters are available to be read one " @@ -157,7 +144,7 @@ msgid "" "terminal in cbreak mode." msgstr "" -#: ../../library/curses.rst:114 +#: ../../library/curses.rst:100 msgid "" "Return the intensity of the red, green, and blue (RGB) components in the " "color *color_number*, which must be between ``0`` and ``COLORS - 1``. " @@ -166,7 +153,7 @@ msgid "" "component)." msgstr "" -#: ../../library/curses.rst:122 +#: ../../library/curses.rst:108 msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " @@ -174,7 +161,7 @@ msgid "" "`A_\\*` attributes. :func:`pair_number` is the counterpart to this function." msgstr "" -#: ../../library/curses.rst:131 +#: ../../library/curses.rst:117 msgid "" "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " "for invisible, normal, or very visible. If the terminal supports the " @@ -183,7 +170,7 @@ msgid "" "and the \"very visible\" mode is a block cursor." msgstr "" -#: ../../library/curses.rst:140 +#: ../../library/curses.rst:126 msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " @@ -191,7 +178,7 @@ msgid "" "`reset_prog_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:148 +#: ../../library/curses.rst:134 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " @@ -199,11 +186,11 @@ msgid "" "func:`reset_shell_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:156 +#: ../../library/curses.rst:142 msgid "Insert an *ms* millisecond pause in output." msgstr "" -#: ../../library/curses.rst:161 +#: ../../library/curses.rst:147 msgid "" "Update the physical screen. The curses library keeps two data structures, " "one representing the current physical screen contents and a virtual screen " @@ -211,7 +198,7 @@ msgid "" "the physical screen to match the virtual screen." msgstr "" -#: ../../library/curses.rst:166 +#: ../../library/curses.rst:152 msgid "" "The virtual screen may be updated by a :meth:`~window.noutrefresh` call " "after write operations such as :meth:`~window.addstr` have been performed on " @@ -222,24 +209,24 @@ msgid "" "func:`!doupdate`." msgstr "" -#: ../../library/curses.rst:176 +#: ../../library/curses.rst:162 msgid "" "Enter echo mode. In echo mode, each character input is echoed to the screen " "as it is entered." msgstr "" -#: ../../library/curses.rst:182 +#: ../../library/curses.rst:168 msgid "De-initialize the library, and return terminal to normal status." msgstr "" -#: ../../library/curses.rst:187 +#: ../../library/curses.rst:173 msgid "" "Return the user's current erase character as a one-byte bytes object. Under " "Unix operating systems this is a property of the controlling tty of the " "curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:194 +#: ../../library/curses.rst:180 msgid "" "The :func:`.filter` routine, if used, must be called before :func:`initscr` " "is called. The effect is that, during those calls, :envvar:`LINES` is set " @@ -250,20 +237,20 @@ msgid "" "time line editing without touching the rest of the screen." msgstr "" -#: ../../library/curses.rst:204 +#: ../../library/curses.rst:190 msgid "" "Flash the screen. That is, change it to reverse-video and then change it " "back in a short interval. Some people prefer such as 'visible bell' to the " "audible attention signal produced by :func:`beep`." msgstr "" -#: ../../library/curses.rst:211 +#: ../../library/curses.rst:197 msgid "" "Flush all input buffers. This throws away any typeahead that has been " "typed by the user and has not yet been processed by the program." msgstr "" -#: ../../library/curses.rst:217 +#: ../../library/curses.rst:203 msgid "" "After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse " "event, this method should be called to retrieve the queued mouse event, " @@ -278,51 +265,51 @@ msgid "" "const:`BUTTON_ALT`." msgstr "" -#: ../../library/curses.rst:228 +#: ../../library/curses.rst:214 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." msgstr "" -#: ../../library/curses.rst:235 +#: ../../library/curses.rst:221 msgid "" "Return the current coordinates of the virtual screen cursor as a tuple ``(y, " "x)``. If :meth:`leaveok ` is currently ``True``, then " "return ``(-1, -1)``." msgstr "" -#: ../../library/curses.rst:241 +#: ../../library/curses.rst:227 msgid "" "Read window related data stored in the file by an earlier :func:`putwin` " "call. The routine then creates and initializes a new window using that data, " "returning the new window object." msgstr "" -#: ../../library/curses.rst:248 +#: ../../library/curses.rst:234 msgid "" "Return ``True`` if the terminal can display colors; otherwise, return " "``False``." msgstr "" -#: ../../library/curses.rst:252 +#: ../../library/curses.rst:238 msgid "" "Return ``True`` if the module supports extended colors; otherwise, return " "``False``. Extended color support allows more than 256 color pairs for " "terminals that support more than 16 colors (e.g. xterm-256color)." msgstr "" -#: ../../library/curses.rst:256 +#: ../../library/curses.rst:242 msgid "Extended color support requires ncurses version 6.1 or later." msgstr "" -#: ../../library/curses.rst:262 +#: ../../library/curses.rst:248 msgid "" "Return ``True`` if the terminal has insert- and delete-character " "capabilities. This function is included for historical reasons only, as all " "modern software terminal emulators have such capabilities." msgstr "" -#: ../../library/curses.rst:269 +#: ../../library/curses.rst:255 msgid "" "Return ``True`` if the terminal has insert- and delete-line capabilities, or " "can simulate them using scrolling regions. This function is included for " @@ -330,13 +317,13 @@ msgid "" "capabilities." msgstr "" -#: ../../library/curses.rst:277 +#: ../../library/curses.rst:263 msgid "" "Take a key value *ch*, and return ``True`` if the current terminal type " "recognizes a key with that value." msgstr "" -#: ../../library/curses.rst:283 +#: ../../library/curses.rst:269 msgid "" "Used for half-delay mode, which is similar to cbreak mode in that characters " "typed by the user are immediately available to the program. However, after " @@ -345,7 +332,7 @@ msgid "" "``255``. Use :func:`nocbreak` to leave half-delay mode." msgstr "" -#: ../../library/curses.rst:292 +#: ../../library/curses.rst:278 msgid "" "Change the definition of a color, taking the number of the color to be " "changed followed by three RGB values (for the amounts of red, green, and " @@ -357,7 +344,7 @@ msgid "" "``True``." msgstr "" -#: ../../library/curses.rst:303 +#: ../../library/curses.rst:289 msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " @@ -370,31 +357,31 @@ msgid "" "definition." msgstr "" -#: ../../library/curses.rst:316 +#: ../../library/curses.rst:302 msgid "" "Initialize the library. Return a :ref:`window ` " "object which represents the whole screen." msgstr "" -#: ../../library/curses.rst:321 +#: ../../library/curses.rst:307 msgid "" "If there is an error opening the terminal, the underlying curses library may " "cause the interpreter to exit." msgstr "" -#: ../../library/curses.rst:327 +#: ../../library/curses.rst:313 msgid "" "Return ``True`` if :func:`resize_term` would modify the window structure, " "``False`` otherwise." msgstr "" -#: ../../library/curses.rst:333 +#: ../../library/curses.rst:319 msgid "" "Return ``True`` if :func:`endwin` has been called (that is, the curses " "library has been deinitialized)." msgstr "" -#: ../../library/curses.rst:339 +#: ../../library/curses.rst:325 msgid "" "Return the name of the key numbered *k* as a bytes object. The name of a " "key generating printable ASCII character is the key's character. The name " @@ -405,35 +392,35 @@ msgid "" "character." msgstr "" -#: ../../library/curses.rst:349 +#: ../../library/curses.rst:335 msgid "" "Return the user's current line kill character as a one-byte bytes object. " "Under Unix operating systems this is a property of the controlling tty of " "the curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:356 +#: ../../library/curses.rst:342 msgid "" "Return a bytes object containing the terminfo long name field describing the " "current terminal. The maximum length of a verbose description is 128 " "characters. It is defined only after the call to :func:`initscr`." msgstr "" -#: ../../library/curses.rst:363 +#: ../../library/curses.rst:349 msgid "" "If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is " "``False``, allow only 7-bit chars." msgstr "" -#: ../../library/curses.rst:369 +#: ../../library/curses.rst:355 msgid "" "Set the maximum time in milliseconds that can elapse between press and " "release events in order for them to be recognized as a click, and return the " -"previous interval value. The default value is 200 msec, or one fifth of a " -"second." +"previous interval value. The default value is 200 milliseconds, or one " +"fifth of a second." msgstr "" -#: ../../library/curses.rst:376 +#: ../../library/curses.rst:362 msgid "" "Set the mouse events to be reported, and return a tuple ``(availmask, " "oldmask)``. *availmask* indicates which of the specified mouse events can " @@ -442,17 +429,17 @@ msgid "" "never called, no mouse events are ever reported." msgstr "" -#: ../../library/curses.rst:385 +#: ../../library/curses.rst:371 msgid "Sleep for *ms* milliseconds." msgstr "" -#: ../../library/curses.rst:390 +#: ../../library/curses.rst:376 msgid "" "Create and return a pointer to a new pad data structure with the given " "number of lines and columns. Return a pad as a window object." msgstr "" -#: ../../library/curses.rst:393 +#: ../../library/curses.rst:379 msgid "" "A pad is like a window, except that it is not restricted by the screen size, " "and is not necessarily associated with a particular part of the screen. " @@ -468,35 +455,35 @@ msgid "" "to be displayed." msgstr "" -#: ../../library/curses.rst:409 +#: ../../library/curses.rst:395 msgid "" "Return a new :ref:`window `, whose left-upper corner " "is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -#: ../../library/curses.rst:412 +#: ../../library/curses.rst:398 msgid "" "By default, the window will extend from the specified position to the lower " "right corner of the screen." msgstr "" -#: ../../library/curses.rst:418 +#: ../../library/curses.rst:404 msgid "" "Enter newline mode. This mode translates the return key into newline on " "input, and translates newline into return and line-feed on output. Newline " "mode is initially on." msgstr "" -#: ../../library/curses.rst:425 +#: ../../library/curses.rst:411 msgid "" "Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:430 +#: ../../library/curses.rst:416 msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "" -#: ../../library/curses.rst:435 +#: ../../library/curses.rst:421 msgid "" "Leave newline mode. Disable translation of return into newline on input, " "and disable low-level translation of newline into newline/return on output " @@ -506,7 +493,7 @@ msgid "" "also, it will be able to detect the return key on input." msgstr "" -#: ../../library/curses.rst:445 +#: ../../library/curses.rst:431 msgid "" "When the :func:`!noqiflush` routine is used, normal flush of input and " "output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters " @@ -515,63 +502,63 @@ msgid "" "occurred, after the handler exits." msgstr "" -#: ../../library/curses.rst:453 +#: ../../library/curses.rst:439 msgid "Leave raw mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:458 +#: ../../library/curses.rst:444 msgid "" "Return a tuple ``(fg, bg)`` containing the colors for the requested color " "pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - " "1``." msgstr "" -#: ../../library/curses.rst:464 +#: ../../library/curses.rst:450 msgid "" "Return the number of the color-pair set by the attribute value *attr*. :func:" "`color_pair` is the counterpart to this function." msgstr "" -#: ../../library/curses.rst:470 +#: ../../library/curses.rst:456 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " "terminfo capability for the current terminal. Note that the output of :func:" "`putp` always goes to standard output." msgstr "" -#: ../../library/curses.rst:477 +#: ../../library/curses.rst:463 msgid "" "If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. " "If *flag* is ``True``, or no argument is provided, the queues will be " "flushed when these control characters are read." msgstr "" -#: ../../library/curses.rst:484 +#: ../../library/curses.rst:470 msgid "" "Enter raw mode. In raw mode, normal line buffering and processing of " "interrupt, quit, suspend, and flow control keys are turned off; characters " "are presented to curses input functions one by one." msgstr "" -#: ../../library/curses.rst:491 +#: ../../library/curses.rst:477 msgid "" "Restore the terminal to \"program\" mode, as previously saved by :func:" "`def_prog_mode`." msgstr "" -#: ../../library/curses.rst:497 +#: ../../library/curses.rst:483 msgid "" "Restore the terminal to \"shell\" mode, as previously saved by :func:" "`def_shell_mode`." msgstr "" -#: ../../library/curses.rst:503 +#: ../../library/curses.rst:489 msgid "" "Restore the state of the terminal modes to what it was at the last call to :" "func:`savetty`." msgstr "" -#: ../../library/curses.rst:509 +#: ../../library/curses.rst:495 msgid "" "Backend function used by :func:`resizeterm`, performing most of the work; " "when resizing the windows, :func:`resize_term` blank-fills the areas that " @@ -581,47 +568,47 @@ msgid "" "to resize these without additional interaction with the application." msgstr "" -#: ../../library/curses.rst:519 +#: ../../library/curses.rst:505 msgid "" "Resize the standard and current windows to the specified dimensions, and " "adjusts other bookkeeping data used by the curses library that record the " "window dimensions (in particular the SIGWINCH handler)." msgstr "" -#: ../../library/curses.rst:526 +#: ../../library/curses.rst:512 msgid "" "Save the current state of the terminal modes in a buffer, usable by :func:" "`resetty`." msgstr "" -#: ../../library/curses.rst:531 +#: ../../library/curses.rst:517 msgid "Retrieves the value set by :func:`set_escdelay`." msgstr "" -#: ../../library/curses.rst:537 +#: ../../library/curses.rst:523 msgid "" "Sets the number of milliseconds to wait after reading an escape character, " "to distinguish between an individual escape character entered on the " "keyboard from escape sequences sent by cursor and function keys." msgstr "" -#: ../../library/curses.rst:545 +#: ../../library/curses.rst:531 msgid "Retrieves the value set by :func:`set_tabsize`." msgstr "" -#: ../../library/curses.rst:551 +#: ../../library/curses.rst:537 msgid "" "Sets the number of columns used by the curses library when converting a tab " "character to spaces as it adds the tab to a window." msgstr "" -#: ../../library/curses.rst:558 +#: ../../library/curses.rst:544 msgid "" "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " "then :meth:`leaveok ` is set ``True``." msgstr "" -#: ../../library/curses.rst:564 +#: ../../library/curses.rst:550 msgid "" "Initialize the terminal. *term* is a string giving the terminal name, or " "``None``; if omitted or ``None``, the value of the :envvar:`TERM` " @@ -630,14 +617,14 @@ msgid "" "descriptor for ``sys.stdout`` will be used." msgstr "" -#: ../../library/curses.rst:573 +#: ../../library/curses.rst:559 msgid "" "Must be called if the programmer wants to use colors, and before any other " "color manipulation routine is called. It is good practice to call this " "routine right after :func:`initscr`." msgstr "" -#: ../../library/curses.rst:577 +#: ../../library/curses.rst:563 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " "yellow, blue, magenta, cyan, and white), and two global variables in the :" @@ -647,20 +634,20 @@ msgid "" "terminal was just turned on." msgstr "" -#: ../../library/curses.rst:586 +#: ../../library/curses.rst:572 msgid "" "Return a logical OR of all video attributes supported by the terminal. This " "information is useful when a curses program needs complete control over the " "appearance of the screen." msgstr "" -#: ../../library/curses.rst:593 +#: ../../library/curses.rst:579 msgid "" "Return the value of the environment variable :envvar:`TERM`, as a bytes " "object, truncated to 14 characters." msgstr "" -#: ../../library/curses.rst:599 +#: ../../library/curses.rst:585 msgid "" "Return the value of the Boolean capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-1`` if " @@ -668,7 +655,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:607 +#: ../../library/curses.rst:593 msgid "" "Return the value of the numeric capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-2`` if " @@ -676,7 +663,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:615 +#: ../../library/curses.rst:601 msgid "" "Return the value of the string capability corresponding to the terminfo " "capability name *capname* as a bytes object. Return ``None`` if *capname* " @@ -684,7 +671,7 @@ msgid "" "terminal description." msgstr "" -#: ../../library/curses.rst:623 +#: ../../library/curses.rst:609 msgid "" "Instantiate the bytes object *str* with the supplied parameters, where *str* " "should be a parameterized string obtained from the terminfo database. E.g. " @@ -692,13 +679,13 @@ msgid "" "exact result depending on terminal type." msgstr "" -#: ../../library/curses.rst:631 +#: ../../library/curses.rst:617 msgid "" "Specify that the file descriptor *fd* be used for typeahead checking. If " "*fd* is ``-1``, then no typeahead checking is done." msgstr "" -#: ../../library/curses.rst:634 +#: ../../library/curses.rst:620 msgid "" "The curses library does \"line-breakout optimization\" by looking for " "typeahead periodically while updating the screen. If input is found, and it " @@ -708,7 +695,7 @@ msgid "" "typeahead checking." msgstr "" -#: ../../library/curses.rst:643 +#: ../../library/curses.rst:629 msgid "" "Return a bytes object which is a printable representation of the character " "*ch*. Control characters are represented as a caret followed by the " @@ -716,35 +703,35 @@ msgid "" "are." msgstr "" -#: ../../library/curses.rst:650 +#: ../../library/curses.rst:636 msgid "Push *ch* so the next :meth:`~window.getch` will return it." msgstr "" -#: ../../library/curses.rst:654 +#: ../../library/curses.rst:640 msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr "" -#: ../../library/curses.rst:659 +#: ../../library/curses.rst:645 msgid "" "Update :envvar:`LINES` and :envvar:`COLS`. Useful for detecting manual " "screen resize." msgstr "" -#: ../../library/curses.rst:666 +#: ../../library/curses.rst:652 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." msgstr "" -#: ../../library/curses.rst:670 +#: ../../library/curses.rst:656 msgid "Only one *ch* can be pushed before :meth:`!get_wch` is called." msgstr "" -#: ../../library/curses.rst:677 +#: ../../library/curses.rst:663 msgid "" "Push a :const:`KEY_MOUSE` event onto the input queue, associating the given " "state data with it." msgstr "" -#: ../../library/curses.rst:683 +#: ../../library/curses.rst:669 msgid "" "If used, this function should be called before :func:`initscr` or newterm " "are called. When *flag* is ``False``, the values of lines and columns " @@ -754,7 +741,7 @@ msgid "" "to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" -#: ../../library/curses.rst:693 +#: ../../library/curses.rst:679 msgid "" "Allow use of default values for colors on terminals supporting this feature. " "Use this to support transparency in your application. The default color is " @@ -763,7 +750,7 @@ msgid "" "*x* to a red foreground color on the default background." msgstr "" -#: ../../library/curses.rst:702 +#: ../../library/curses.rst:688 msgid "" "Initialize curses and call another callable object, *func*, which should be " "the rest of your curses-using application. If the application raises an " @@ -777,50 +764,50 @@ msgid "" "echo, and disables the terminal keypad." msgstr "" -#: ../../library/curses.rst:716 +#: ../../library/curses.rst:702 msgid "Window Objects" msgstr "" -#: ../../library/curses.rst:718 +#: ../../library/curses.rst:704 msgid "" "Window objects, as returned by :func:`initscr` and :func:`newwin` above, " "have the following methods and attributes:" msgstr "" -#: ../../library/curses.rst:725 +#: ../../library/curses.rst:711 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any " "character previously painted at that location. By default, the character " "position and attributes are the current settings for the window object." msgstr "" -#: ../../library/curses.rst:731 +#: ../../library/curses.rst:717 msgid "" "Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the character is printed." msgstr "" -#: ../../library/curses.rst:739 +#: ../../library/curses.rst:725 msgid "" "Paint at most *n* characters of the character string *str* at ``(y, x)`` " "with attributes *attr*, overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:747 +#: ../../library/curses.rst:733 msgid "" "Paint the character string *str* at ``(y, x)`` with attributes *attr*, " "overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:752 +#: ../../library/curses.rst:738 msgid "" "Writing outside the window, subwindow, or pad raises :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the string is printed." msgstr "" -#: ../../library/curses.rst:756 +#: ../../library/curses.rst:742 msgid "" "A `bug in ncurses `_, the backend for " "this Python module, can cause SegFaults when resizing windows. This is fixed " @@ -830,44 +817,44 @@ msgid "" "line." msgstr "" -#: ../../library/curses.rst:766 +#: ../../library/curses.rst:752 msgid "" "Remove attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:772 +#: ../../library/curses.rst:758 msgid "" "Add attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:778 +#: ../../library/curses.rst:764 msgid "" "Set the \"background\" set of attributes to *attr*. This set is initially " "``0`` (no attributes)." msgstr "" -#: ../../library/curses.rst:784 +#: ../../library/curses.rst:770 msgid "" "Set the background property of the window to the character *ch*, with " "attributes *attr*. The change is then applied to every character position " "in that window:" msgstr "" -#: ../../library/curses.rst:788 +#: ../../library/curses.rst:774 msgid "" "The attribute of every character in the window is changed to the new " "background attribute." msgstr "" -#: ../../library/curses.rst:791 +#: ../../library/curses.rst:777 msgid "" "Wherever the former background character appears, it is changed to the new " "background character." msgstr "" -#: ../../library/curses.rst:797 +#: ../../library/curses.rst:783 msgid "" "Set the window's background. A window's background consists of a character " "and any combination of attributes. The attribute part of the background is " @@ -878,128 +865,128 @@ msgid "" "delete line/character operations." msgstr "" -#: ../../library/curses.rst:807 +#: ../../library/curses.rst:793 msgid "" "Draw a border around the edges of the window. Each parameter specifies the " "character to use for a specific part of the border; see the table below for " "more details." msgstr "" -#: ../../library/curses.rst:813 +#: ../../library/curses.rst:799 msgid "" "A ``0`` value for any parameter will cause the default character to be used " "for that parameter. Keyword parameters can *not* be used. The defaults are " "listed in this table:" msgstr "" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:804 msgid "Parameter" msgstr "參數" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:804 msgid "Description" msgstr "描述" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:804 msgid "Default value" msgstr "" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:806 msgid "*ls*" msgstr "*ls*" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:806 msgid "Left side" msgstr "" -#: ../../library/curses.rst:820 ../../library/curses.rst:822 +#: ../../library/curses.rst:806 ../../library/curses.rst:808 msgid ":const:`ACS_VLINE`" msgstr ":const:`ACS_VLINE`" -#: ../../library/curses.rst:822 +#: ../../library/curses.rst:808 msgid "*rs*" msgstr "*rs*" -#: ../../library/curses.rst:822 +#: ../../library/curses.rst:808 msgid "Right side" msgstr "" -#: ../../library/curses.rst:824 +#: ../../library/curses.rst:810 msgid "*ts*" msgstr "*ts*" -#: ../../library/curses.rst:824 +#: ../../library/curses.rst:810 msgid "Top" msgstr "" -#: ../../library/curses.rst:824 ../../library/curses.rst:826 +#: ../../library/curses.rst:810 ../../library/curses.rst:812 msgid ":const:`ACS_HLINE`" msgstr ":const:`ACS_HLINE`" -#: ../../library/curses.rst:826 +#: ../../library/curses.rst:812 msgid "*bs*" msgstr "*bs*" -#: ../../library/curses.rst:826 +#: ../../library/curses.rst:812 msgid "Bottom" msgstr "" -#: ../../library/curses.rst:828 +#: ../../library/curses.rst:814 msgid "*tl*" msgstr "*tl*" -#: ../../library/curses.rst:828 +#: ../../library/curses.rst:814 msgid "Upper-left corner" msgstr "" -#: ../../library/curses.rst:828 +#: ../../library/curses.rst:814 msgid ":const:`ACS_ULCORNER`" msgstr ":const:`ACS_ULCORNER`" -#: ../../library/curses.rst:830 +#: ../../library/curses.rst:816 msgid "*tr*" msgstr "*tr*" -#: ../../library/curses.rst:830 +#: ../../library/curses.rst:816 msgid "Upper-right corner" msgstr "" -#: ../../library/curses.rst:830 +#: ../../library/curses.rst:816 msgid ":const:`ACS_URCORNER`" msgstr ":const:`ACS_URCORNER`" -#: ../../library/curses.rst:832 +#: ../../library/curses.rst:818 msgid "*bl*" msgstr "*bl*" -#: ../../library/curses.rst:832 +#: ../../library/curses.rst:818 msgid "Bottom-left corner" msgstr "" -#: ../../library/curses.rst:832 +#: ../../library/curses.rst:818 msgid ":const:`ACS_LLCORNER`" msgstr ":const:`ACS_LLCORNER`" -#: ../../library/curses.rst:834 +#: ../../library/curses.rst:820 msgid "*br*" msgstr "*br*" -#: ../../library/curses.rst:834 +#: ../../library/curses.rst:820 msgid "Bottom-right corner" msgstr "" -#: ../../library/curses.rst:834 +#: ../../library/curses.rst:820 msgid ":const:`ACS_LRCORNER`" msgstr ":const:`ACS_LRCORNER`" -#: ../../library/curses.rst:840 +#: ../../library/curses.rst:826 msgid "" "Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* " "and *bs* are *horch*. The default corner characters are always used by this " "function." msgstr "" -#: ../../library/curses.rst:849 +#: ../../library/curses.rst:835 msgid "" "Set the attributes of *num* characters at the current cursor position, or at " "position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " @@ -1009,45 +996,45 @@ msgid "" "be redisplayed by the next window refresh." msgstr "" -#: ../../library/curses.rst:859 +#: ../../library/curses.rst:845 msgid "" "Like :meth:`erase`, but also cause the whole window to be repainted upon " "next call to :meth:`refresh`." msgstr "" -#: ../../library/curses.rst:865 +#: ../../library/curses.rst:851 msgid "" "If *flag* is ``True``, the next call to :meth:`refresh` will clear the " "window completely." msgstr "" -#: ../../library/curses.rst:871 +#: ../../library/curses.rst:857 msgid "" "Erase from cursor to the end of the window: all lines below the cursor are " "deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" -#: ../../library/curses.rst:877 +#: ../../library/curses.rst:863 msgid "Erase from cursor to the end of the line." msgstr "" -#: ../../library/curses.rst:882 +#: ../../library/curses.rst:868 msgid "" "Update the current cursor position of all the ancestors of the window to " "reflect the current cursor position of the window." msgstr "" -#: ../../library/curses.rst:888 +#: ../../library/curses.rst:874 msgid "Delete any character at ``(y, x)``." msgstr "" -#: ../../library/curses.rst:893 +#: ../../library/curses.rst:879 msgid "" "Delete the line under the cursor. All following lines are moved up by one " "line." msgstr "" -#: ../../library/curses.rst:899 +#: ../../library/curses.rst:885 msgid "" "An abbreviation for \"derive window\", :meth:`derwin` is the same as " "calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to " @@ -1055,13 +1042,13 @@ msgid "" "a window object for the derived window." msgstr "" -#: ../../library/curses.rst:907 +#: ../../library/curses.rst:893 msgid "" "Add character *ch* with attribute *attr*, and immediately call :meth:" "`refresh` on the window." msgstr "" -#: ../../library/curses.rst:913 +#: ../../library/curses.rst:899 msgid "" "Test whether the given pair of screen-relative character-cell coordinates " "are enclosed by the given window, returning ``True`` or ``False``. It is " @@ -1069,31 +1056,31 @@ msgid "" "location of a mouse event." msgstr "" -#: ../../library/curses.rst:918 +#: ../../library/curses.rst:904 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" -#: ../../library/curses.rst:924 +#: ../../library/curses.rst:910 msgid "" "Encoding used to encode method arguments (Unicode strings and characters). " "The encoding attribute is inherited from the parent window when a subwindow " -"is created, for example with :meth:`window.subwin`. By default, the locale " -"encoding is used (see :func:`locale.getpreferredencoding`)." +"is created, for example with :meth:`window.subwin`. By default, current " +"locale encoding is used (see :func:`locale.getencoding`)." msgstr "" -#: ../../library/curses.rst:934 +#: ../../library/curses.rst:920 msgid "Clear the window." msgstr "" -#: ../../library/curses.rst:939 +#: ../../library/curses.rst:925 msgid "Return a tuple ``(y, x)`` of co-ordinates of upper-left corner." msgstr "" -#: ../../library/curses.rst:944 +#: ../../library/curses.rst:930 msgid "Return the given window's current background character/attribute pair." msgstr "" -#: ../../library/curses.rst:949 +#: ../../library/curses.rst:935 msgid "" "Get a character. Note that the integer returned does *not* have to be in " "ASCII range: function keys, keypad keys and so on are represented by numbers " @@ -1101,14 +1088,14 @@ msgid "" "otherwise wait until a key is pressed." msgstr "" -#: ../../library/curses.rst:957 +#: ../../library/curses.rst:943 msgid "" "Get a wide character. Return a character for most keys, or an integer for " "function keys, keypad keys, and other special keys. In no-delay mode, raise " "an exception if there is no input." msgstr "" -#: ../../library/curses.rst:966 +#: ../../library/curses.rst:952 msgid "" "Get a character, returning a string instead of an integer, as :meth:`getch` " "does. Function keys, keypad keys and other special keys return a multibyte " @@ -1116,35 +1103,35 @@ msgid "" "there is no input." msgstr "" -#: ../../library/curses.rst:974 +#: ../../library/curses.rst:960 msgid "Return a tuple ``(y, x)`` of the height and width of the window." msgstr "" -#: ../../library/curses.rst:979 +#: ../../library/curses.rst:965 msgid "" "Return the beginning coordinates of this window relative to its parent " "window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no " "parent." msgstr "" -#: ../../library/curses.rst:989 +#: ../../library/curses.rst:975 msgid "" "Read a bytes object from the user, with primitive line editing capacity." msgstr "" -#: ../../library/curses.rst:994 +#: ../../library/curses.rst:980 msgid "" "Return a tuple ``(y, x)`` of current cursor position relative to the " "window's upper-left corner." msgstr "" -#: ../../library/curses.rst:1001 +#: ../../library/curses.rst:987 msgid "" "Display a horizontal line starting at ``(y, x)`` with length *n* consisting " "of the character *ch*." msgstr "" -#: ../../library/curses.rst:1007 +#: ../../library/curses.rst:993 msgid "" "If *flag* is ``False``, curses no longer considers using the hardware insert/" "delete character feature of the terminal; if *flag* is ``True``, use of " @@ -1152,13 +1139,13 @@ msgid "" "initialized, use of character insert/delete is enabled by default." msgstr "" -#: ../../library/curses.rst:1015 +#: ../../library/curses.rst:1001 msgid "" "If *flag* is ``True``, :mod:`curses` will try and use hardware line editing " "facilities. Otherwise, line insertion/deletion are disabled." msgstr "" -#: ../../library/curses.rst:1021 +#: ../../library/curses.rst:1007 msgid "" "If *flag* is ``True``, any change in the window image automatically causes " "the window to be refreshed; you no longer have to call :meth:`refresh` " @@ -1166,19 +1153,19 @@ msgid "" "calls to wrefresh. This option is disabled by default." msgstr "" -#: ../../library/curses.rst:1029 +#: ../../library/curses.rst:1015 msgid "" "Return the character at the given position in the window. The bottom 8 bits " "are the character proper, and upper bits are the attributes." msgstr "" -#: ../../library/curses.rst:1036 +#: ../../library/curses.rst:1022 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line " "from position *x* right by one character." msgstr "" -#: ../../library/curses.rst:1042 +#: ../../library/curses.rst:1028 msgid "" "Insert *nlines* lines into the specified window above the current line. The " "*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " @@ -1187,13 +1174,13 @@ msgid "" "remains the same." msgstr "" -#: ../../library/curses.rst:1051 +#: ../../library/curses.rst:1037 msgid "" "Insert a blank line under the cursor. All following lines are moved down by " "one line." msgstr "" -#: ../../library/curses.rst:1058 +#: ../../library/curses.rst:1044 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor, up to *n* characters. If *n* is " @@ -1203,7 +1190,7 @@ msgid "" "if specified)." msgstr "" -#: ../../library/curses.rst:1068 +#: ../../library/curses.rst:1054 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor. All characters to the right of the " @@ -1212,7 +1199,7 @@ msgid "" "specified)." msgstr "" -#: ../../library/curses.rst:1077 +#: ../../library/curses.rst:1063 msgid "" "Return a bytes object of characters, extracted from the window starting at " "the current cursor position, or at *y*, *x* if specified. Attributes are " @@ -1220,76 +1207,76 @@ msgid "" "string at most *n* characters long (exclusive of the trailing NUL)." msgstr "" -#: ../../library/curses.rst:1085 +#: ../../library/curses.rst:1071 msgid "" "Return ``True`` if the specified line was modified since the last call to :" "meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" -#: ../../library/curses.rst:1092 +#: ../../library/curses.rst:1078 msgid "" "Return ``True`` if the specified window was modified since the last call to :" "meth:`refresh`; otherwise return ``False``." msgstr "" -#: ../../library/curses.rst:1098 +#: ../../library/curses.rst:1084 msgid "" "If *flag* is ``True``, escape sequences generated by some keys (keypad, " "function keys) will be interpreted by :mod:`curses`. If *flag* is ``False``, " "escape sequences will be left as is in the input stream." msgstr "" -#: ../../library/curses.rst:1105 +#: ../../library/curses.rst:1091 msgid "" "If *flag* is ``True``, cursor is left where it is on update, instead of " "being at \"cursor position.\" This reduces cursor movement where possible. " "If possible the cursor will be made invisible." msgstr "" -#: ../../library/curses.rst:1109 +#: ../../library/curses.rst:1095 msgid "" "If *flag* is ``False``, cursor will always be at \"cursor position\" after " "an update." msgstr "" -#: ../../library/curses.rst:1114 +#: ../../library/curses.rst:1100 msgid "Move cursor to ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1119 +#: ../../library/curses.rst:1105 msgid "" "Move the window inside its parent window. The screen-relative parameters of " "the window are not changed. This routine is used to display different parts " "of the parent window at the same physical position on the screen." msgstr "" -#: ../../library/curses.rst:1126 +#: ../../library/curses.rst:1112 msgid "Move the window so its upper-left corner is at ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1131 +#: ../../library/curses.rst:1117 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." msgstr "" -#: ../../library/curses.rst:1136 +#: ../../library/curses.rst:1122 msgid "If *flag* is ``True``, escape sequences will not be timed out." msgstr "" -#: ../../library/curses.rst:1138 +#: ../../library/curses.rst:1124 msgid "" "If *flag* is ``False``, after a few milliseconds, an escape sequence will " "not be interpreted, and will be left in the input stream as is." msgstr "" -#: ../../library/curses.rst:1144 +#: ../../library/curses.rst:1130 msgid "" "Mark for refresh but wait. This function updates the data structure " "representing the desired state of the window, but does not force an update " "of the physical screen. To accomplish that, call :func:`doupdate`." msgstr "" -#: ../../library/curses.rst:1151 +#: ../../library/curses.rst:1137 msgid "" "Overlay the window on top of *destwin*. The windows need not be the same " "size, only the overlapping region is copied. This copy is non-destructive, " @@ -1297,7 +1284,7 @@ msgid "" "contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1156 +#: ../../library/curses.rst:1142 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overlay` can be used. *sminrow* and *smincol* are the upper-left " @@ -1305,7 +1292,7 @@ msgid "" "in the destination window." msgstr "" -#: ../../library/curses.rst:1164 +#: ../../library/curses.rst:1150 msgid "" "Overwrite the window on top of *destwin*. The windows need not be the same " "size, in which case only the overlapping region is copied. This copy is " @@ -1313,7 +1300,7 @@ msgid "" "the old contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1169 +#: ../../library/curses.rst:1155 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overwrite` can be used. *sminrow* and *smincol* are the upper-left " @@ -1321,31 +1308,31 @@ msgid "" "the destination window." msgstr "" -#: ../../library/curses.rst:1177 +#: ../../library/curses.rst:1163 msgid "" "Write all data associated with the window into the provided file object. " "This information can be later retrieved using the :func:`getwin` function." msgstr "" -#: ../../library/curses.rst:1183 +#: ../../library/curses.rst:1169 msgid "" "Indicate that the *num* screen lines, starting at line *beg*, are corrupted " "and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1189 +#: ../../library/curses.rst:1175 msgid "" "Touch the entire window, causing it to be completely redrawn on the next :" "meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1195 +#: ../../library/curses.rst:1181 msgid "" "Update the display immediately (sync actual screen with previous drawing/" "deleting methods)." msgstr "" -#: ../../library/curses.rst:1198 +#: ../../library/curses.rst:1184 msgid "" "The 6 optional arguments can only be specified when the window is a pad " "created with :func:`newpad`. The additional parameters are needed to " @@ -1360,7 +1347,7 @@ msgid "" "*smincol* are treated as if they were zero." msgstr "" -#: ../../library/curses.rst:1212 +#: ../../library/curses.rst:1198 msgid "" "Reallocate storage for a curses window to adjust its dimensions to the " "specified values. If either dimension is larger than the current values, " @@ -1368,11 +1355,11 @@ msgid "" "rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" -#: ../../library/curses.rst:1220 +#: ../../library/curses.rst:1206 msgid "Scroll the screen or scrolling region upward by *lines* lines." msgstr "" -#: ../../library/curses.rst:1225 +#: ../../library/curses.rst:1211 msgid "" "Control what happens when the cursor of a window is moved off the edge of " "the window or scrolling region, either as a result of a newline action on " @@ -1382,54 +1369,54 @@ msgid "" "scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." msgstr "" -#: ../../library/curses.rst:1235 +#: ../../library/curses.rst:1221 msgid "" "Set the scrolling region from line *top* to line *bottom*. All scrolling " "actions will take place in this region." msgstr "" -#: ../../library/curses.rst:1241 +#: ../../library/curses.rst:1227 msgid "" "Turn off the standout attribute. On some terminals this has the side effect " "of turning off all attributes." msgstr "" -#: ../../library/curses.rst:1247 +#: ../../library/curses.rst:1233 msgid "Turn on attribute *A_STANDOUT*." msgstr "" -#: ../../library/curses.rst:1253 ../../library/curses.rst:1260 +#: ../../library/curses.rst:1239 ../../library/curses.rst:1246 msgid "" "Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, " "and whose width/height is *ncols*/*nlines*." msgstr "" -#: ../../library/curses.rst:1263 +#: ../../library/curses.rst:1249 msgid "" "By default, the sub-window will extend from the specified position to the " "lower right corner of the window." msgstr "" -#: ../../library/curses.rst:1269 +#: ../../library/curses.rst:1255 msgid "" "Touch each location in the window that has been touched in any of its " "ancestor windows. This routine is called by :meth:`refresh`, so it should " "almost never be necessary to call it manually." msgstr "" -#: ../../library/curses.rst:1276 +#: ../../library/curses.rst:1262 msgid "" "If *flag* is ``True``, then :meth:`syncup` is called automatically whenever " "there is a change in the window." msgstr "" -#: ../../library/curses.rst:1282 +#: ../../library/curses.rst:1268 msgid "" "Touch all locations in ancestors of the window that have been changed in " "the window." msgstr "" -#: ../../library/curses.rst:1288 +#: ../../library/curses.rst:1274 msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " @@ -1439,7 +1426,7 @@ msgid "" "still no input at the end of that time." msgstr "" -#: ../../library/curses.rst:1298 +#: ../../library/curses.rst:1284 msgid "" "Pretend *count* lines have been changed, starting with line *start*. If " "*changed* is supplied, it specifies whether the affected lines are marked as " @@ -1447,51 +1434,51 @@ msgid "" "``=False``)." msgstr "" -#: ../../library/curses.rst:1305 +#: ../../library/curses.rst:1291 msgid "" "Pretend the whole window has been changed, for purposes of drawing " "optimizations." msgstr "" -#: ../../library/curses.rst:1311 +#: ../../library/curses.rst:1297 msgid "" "Mark all lines in the window as unchanged since the last call to :meth:" "`refresh`." msgstr "" -#: ../../library/curses.rst:1318 +#: ../../library/curses.rst:1304 msgid "" "Display a vertical line starting at ``(y, x)`` with length *n* consisting of " "the character *ch*." msgstr "" -#: ../../library/curses.rst:1323 +#: ../../library/curses.rst:1309 msgid "Constants" msgstr "" -#: ../../library/curses.rst:1325 +#: ../../library/curses.rst:1311 msgid "The :mod:`curses` module defines the following data members:" msgstr "" -#: ../../library/curses.rst:1330 +#: ../../library/curses.rst:1316 msgid "" "Some curses routines that return an integer, such as :meth:`~window." "getch`, return :const:`ERR` upon failure." msgstr "" -#: ../../library/curses.rst:1336 +#: ../../library/curses.rst:1322 msgid "" "Some curses routines that return an integer, such as :func:`napms`, " "return :const:`OK` upon success." msgstr "" -#: ../../library/curses.rst:1342 +#: ../../library/curses.rst:1328 msgid "" "A bytes object representing the current version of the module. Also " "available as :const:`__version__`." msgstr "" -#: ../../library/curses.rst:1348 +#: ../../library/curses.rst:1334 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " @@ -1499,966 +1486,966 @@ msgid "" "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" -#: ../../library/curses.rst:1353 +#: ../../library/curses.rst:1339 msgid "Availability: if the ncurses library is used." msgstr "" -#: ../../library/curses.rst:1358 +#: ../../library/curses.rst:1344 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" -#: ../../library/curses.rst:1362 +#: ../../library/curses.rst:1348 msgid "Attribute" msgstr "" -#: ../../library/curses.rst:1362 ../../library/curses.rst:1410 -#: ../../library/curses.rst:1654 +#: ../../library/curses.rst:1348 ../../library/curses.rst:1396 +#: ../../library/curses.rst:1640 msgid "Meaning" msgstr "" -#: ../../library/curses.rst:1364 +#: ../../library/curses.rst:1350 msgid "``A_ALTCHARSET``" msgstr "``A_ALTCHARSET``" -#: ../../library/curses.rst:1364 +#: ../../library/curses.rst:1350 msgid "Alternate character set mode" msgstr "" -#: ../../library/curses.rst:1366 +#: ../../library/curses.rst:1352 msgid "``A_BLINK``" msgstr "``A_BLINK``" -#: ../../library/curses.rst:1366 +#: ../../library/curses.rst:1352 msgid "Blink mode" msgstr "" -#: ../../library/curses.rst:1368 +#: ../../library/curses.rst:1354 msgid "``A_BOLD``" msgstr "``A_BOLD``" -#: ../../library/curses.rst:1368 +#: ../../library/curses.rst:1354 msgid "Bold mode" msgstr "" -#: ../../library/curses.rst:1370 +#: ../../library/curses.rst:1356 msgid "``A_DIM``" msgstr "``A_DIM``" -#: ../../library/curses.rst:1370 +#: ../../library/curses.rst:1356 msgid "Dim mode" msgstr "" -#: ../../library/curses.rst:1372 +#: ../../library/curses.rst:1358 msgid "``A_INVIS``" msgstr "``A_INVIS``" -#: ../../library/curses.rst:1372 +#: ../../library/curses.rst:1358 msgid "Invisible or blank mode" msgstr "" -#: ../../library/curses.rst:1374 +#: ../../library/curses.rst:1360 msgid "``A_ITALIC``" msgstr "``A_ITALIC``" -#: ../../library/curses.rst:1374 +#: ../../library/curses.rst:1360 msgid "Italic mode" msgstr "" -#: ../../library/curses.rst:1376 +#: ../../library/curses.rst:1362 msgid "``A_NORMAL``" msgstr "``A_NORMAL``" -#: ../../library/curses.rst:1376 +#: ../../library/curses.rst:1362 msgid "Normal attribute" msgstr "" -#: ../../library/curses.rst:1378 +#: ../../library/curses.rst:1364 msgid "``A_PROTECT``" msgstr "``A_PROTECT``" -#: ../../library/curses.rst:1378 +#: ../../library/curses.rst:1364 msgid "Protected mode" msgstr "" -#: ../../library/curses.rst:1380 +#: ../../library/curses.rst:1366 msgid "``A_REVERSE``" msgstr "``A_REVERSE``" -#: ../../library/curses.rst:1380 +#: ../../library/curses.rst:1366 msgid "Reverse background and foreground colors" msgstr "" -#: ../../library/curses.rst:1383 +#: ../../library/curses.rst:1369 msgid "``A_STANDOUT``" msgstr "``A_STANDOUT``" -#: ../../library/curses.rst:1383 +#: ../../library/curses.rst:1369 msgid "Standout mode" msgstr "" -#: ../../library/curses.rst:1385 +#: ../../library/curses.rst:1371 msgid "``A_UNDERLINE``" msgstr "``A_UNDERLINE``" -#: ../../library/curses.rst:1385 +#: ../../library/curses.rst:1371 msgid "Underline mode" msgstr "" -#: ../../library/curses.rst:1387 +#: ../../library/curses.rst:1373 msgid "``A_HORIZONTAL``" msgstr "``A_HORIZONTAL``" -#: ../../library/curses.rst:1387 +#: ../../library/curses.rst:1373 msgid "Horizontal highlight" msgstr "" -#: ../../library/curses.rst:1389 +#: ../../library/curses.rst:1375 msgid "``A_LEFT``" msgstr "``A_LEFT``" -#: ../../library/curses.rst:1389 +#: ../../library/curses.rst:1375 msgid "Left highlight" msgstr "" -#: ../../library/curses.rst:1391 +#: ../../library/curses.rst:1377 msgid "``A_LOW``" msgstr "``A_LOW``" -#: ../../library/curses.rst:1391 +#: ../../library/curses.rst:1377 msgid "Low highlight" msgstr "" -#: ../../library/curses.rst:1393 +#: ../../library/curses.rst:1379 msgid "``A_RIGHT``" msgstr "``A_RIGHT``" -#: ../../library/curses.rst:1393 +#: ../../library/curses.rst:1379 msgid "Right highlight" msgstr "" -#: ../../library/curses.rst:1395 +#: ../../library/curses.rst:1381 msgid "``A_TOP``" msgstr "``A_TOP``" -#: ../../library/curses.rst:1395 +#: ../../library/curses.rst:1381 msgid "Top highlight" msgstr "" -#: ../../library/curses.rst:1397 +#: ../../library/curses.rst:1383 msgid "``A_VERTICAL``" msgstr "``A_VERTICAL``" -#: ../../library/curses.rst:1397 +#: ../../library/curses.rst:1383 msgid "Vertical highlight" msgstr "" -#: ../../library/curses.rst:1399 ../../library/curses.rst:1415 +#: ../../library/curses.rst:1385 ../../library/curses.rst:1401 msgid "``A_CHARTEXT``" msgstr "``A_CHARTEXT``" -#: ../../library/curses.rst:1399 ../../library/curses.rst:1415 +#: ../../library/curses.rst:1385 ../../library/curses.rst:1401 msgid "Bit-mask to extract a character" msgstr "" -#: ../../library/curses.rst:1403 +#: ../../library/curses.rst:1389 msgid "``A_ITALIC`` was added." msgstr "" -#: ../../library/curses.rst:1406 +#: ../../library/curses.rst:1392 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" -#: ../../library/curses.rst:1410 +#: ../../library/curses.rst:1396 msgid "Bit-mask" msgstr "" -#: ../../library/curses.rst:1412 +#: ../../library/curses.rst:1398 msgid "``A_ATTRIBUTES``" msgstr "``A_ATTRIBUTES``" -#: ../../library/curses.rst:1412 +#: ../../library/curses.rst:1398 msgid "Bit-mask to extract attributes" msgstr "" -#: ../../library/curses.rst:1418 +#: ../../library/curses.rst:1404 msgid "``A_COLOR``" msgstr "``A_COLOR``" -#: ../../library/curses.rst:1418 +#: ../../library/curses.rst:1404 msgid "Bit-mask to extract color-pair field information" msgstr "" -#: ../../library/curses.rst:1422 +#: ../../library/curses.rst:1408 msgid "" "Keys are referred to by integer constants with names starting with " "``KEY_``. The exact keycaps available are system dependent." msgstr "" -#: ../../library/curses.rst:1428 +#: ../../library/curses.rst:1414 msgid "Key constant" msgstr "" -#: ../../library/curses.rst:1428 +#: ../../library/curses.rst:1414 msgid "Key" msgstr "" -#: ../../library/curses.rst:1430 +#: ../../library/curses.rst:1416 msgid "``KEY_MIN``" msgstr "``KEY_MIN``" -#: ../../library/curses.rst:1430 +#: ../../library/curses.rst:1416 msgid "Minimum key value" msgstr "" -#: ../../library/curses.rst:1432 +#: ../../library/curses.rst:1418 msgid "``KEY_BREAK``" msgstr "``KEY_BREAK``" -#: ../../library/curses.rst:1432 +#: ../../library/curses.rst:1418 msgid "Break key (unreliable)" msgstr "" -#: ../../library/curses.rst:1434 +#: ../../library/curses.rst:1420 msgid "``KEY_DOWN``" msgstr "``KEY_DOWN``" -#: ../../library/curses.rst:1434 +#: ../../library/curses.rst:1420 msgid "Down-arrow" msgstr "" -#: ../../library/curses.rst:1436 +#: ../../library/curses.rst:1422 msgid "``KEY_UP``" msgstr "``KEY_UP``" -#: ../../library/curses.rst:1436 +#: ../../library/curses.rst:1422 msgid "Up-arrow" msgstr "" -#: ../../library/curses.rst:1438 +#: ../../library/curses.rst:1424 msgid "``KEY_LEFT``" msgstr "``KEY_LEFT``" -#: ../../library/curses.rst:1438 +#: ../../library/curses.rst:1424 msgid "Left-arrow" msgstr "" -#: ../../library/curses.rst:1440 +#: ../../library/curses.rst:1426 msgid "``KEY_RIGHT``" msgstr "``KEY_RIGHT``" -#: ../../library/curses.rst:1440 +#: ../../library/curses.rst:1426 msgid "Right-arrow" msgstr "" -#: ../../library/curses.rst:1442 +#: ../../library/curses.rst:1428 msgid "``KEY_HOME``" msgstr "``KEY_HOME``" -#: ../../library/curses.rst:1442 +#: ../../library/curses.rst:1428 msgid "Home key (upward+left arrow)" msgstr "" -#: ../../library/curses.rst:1444 +#: ../../library/curses.rst:1430 msgid "``KEY_BACKSPACE``" msgstr "``KEY_BACKSPACE``" -#: ../../library/curses.rst:1444 +#: ../../library/curses.rst:1430 msgid "Backspace (unreliable)" msgstr "" -#: ../../library/curses.rst:1446 +#: ../../library/curses.rst:1432 msgid "``KEY_F0``" msgstr "``KEY_F0``" -#: ../../library/curses.rst:1446 +#: ../../library/curses.rst:1432 msgid "Function keys. Up to 64 function keys are supported." msgstr "" -#: ../../library/curses.rst:1449 +#: ../../library/curses.rst:1435 msgid "``KEY_Fn``" msgstr "``KEY_Fn``" -#: ../../library/curses.rst:1449 +#: ../../library/curses.rst:1435 msgid "Value of function key *n*" msgstr "" -#: ../../library/curses.rst:1451 +#: ../../library/curses.rst:1437 msgid "``KEY_DL``" msgstr "``KEY_DL``" -#: ../../library/curses.rst:1451 +#: ../../library/curses.rst:1437 msgid "Delete line" msgstr "" -#: ../../library/curses.rst:1453 +#: ../../library/curses.rst:1439 msgid "``KEY_IL``" msgstr "``KEY_IL``" -#: ../../library/curses.rst:1453 +#: ../../library/curses.rst:1439 msgid "Insert line" msgstr "" -#: ../../library/curses.rst:1455 +#: ../../library/curses.rst:1441 msgid "``KEY_DC``" msgstr "``KEY_DC``" -#: ../../library/curses.rst:1455 +#: ../../library/curses.rst:1441 msgid "Delete character" msgstr "" -#: ../../library/curses.rst:1457 +#: ../../library/curses.rst:1443 msgid "``KEY_IC``" msgstr "``KEY_IC``" -#: ../../library/curses.rst:1457 +#: ../../library/curses.rst:1443 msgid "Insert char or enter insert mode" msgstr "" -#: ../../library/curses.rst:1459 +#: ../../library/curses.rst:1445 msgid "``KEY_EIC``" msgstr "``KEY_EIC``" -#: ../../library/curses.rst:1459 +#: ../../library/curses.rst:1445 msgid "Exit insert char mode" msgstr "" -#: ../../library/curses.rst:1461 +#: ../../library/curses.rst:1447 msgid "``KEY_CLEAR``" msgstr "``KEY_CLEAR``" -#: ../../library/curses.rst:1461 +#: ../../library/curses.rst:1447 msgid "Clear screen" msgstr "" -#: ../../library/curses.rst:1463 +#: ../../library/curses.rst:1449 msgid "``KEY_EOS``" msgstr "``KEY_EOS``" -#: ../../library/curses.rst:1463 +#: ../../library/curses.rst:1449 msgid "Clear to end of screen" msgstr "" -#: ../../library/curses.rst:1465 +#: ../../library/curses.rst:1451 msgid "``KEY_EOL``" msgstr "``KEY_EOL``" -#: ../../library/curses.rst:1465 +#: ../../library/curses.rst:1451 msgid "Clear to end of line" msgstr "" -#: ../../library/curses.rst:1467 +#: ../../library/curses.rst:1453 msgid "``KEY_SF``" msgstr "``KEY_SF``" -#: ../../library/curses.rst:1467 +#: ../../library/curses.rst:1453 msgid "Scroll 1 line forward" msgstr "" -#: ../../library/curses.rst:1469 +#: ../../library/curses.rst:1455 msgid "``KEY_SR``" msgstr "``KEY_SR``" -#: ../../library/curses.rst:1469 +#: ../../library/curses.rst:1455 msgid "Scroll 1 line backward (reverse)" msgstr "" -#: ../../library/curses.rst:1471 +#: ../../library/curses.rst:1457 msgid "``KEY_NPAGE``" msgstr "``KEY_NPAGE``" -#: ../../library/curses.rst:1471 +#: ../../library/curses.rst:1457 msgid "Next page" msgstr "" -#: ../../library/curses.rst:1473 +#: ../../library/curses.rst:1459 msgid "``KEY_PPAGE``" msgstr "``KEY_PPAGE``" -#: ../../library/curses.rst:1473 +#: ../../library/curses.rst:1459 msgid "Previous page" msgstr "" -#: ../../library/curses.rst:1475 +#: ../../library/curses.rst:1461 msgid "``KEY_STAB``" msgstr "``KEY_STAB``" -#: ../../library/curses.rst:1475 +#: ../../library/curses.rst:1461 msgid "Set tab" msgstr "" -#: ../../library/curses.rst:1477 +#: ../../library/curses.rst:1463 msgid "``KEY_CTAB``" msgstr "``KEY_CTAB``" -#: ../../library/curses.rst:1477 +#: ../../library/curses.rst:1463 msgid "Clear tab" msgstr "" -#: ../../library/curses.rst:1479 +#: ../../library/curses.rst:1465 msgid "``KEY_CATAB``" msgstr "``KEY_CATAB``" -#: ../../library/curses.rst:1479 +#: ../../library/curses.rst:1465 msgid "Clear all tabs" msgstr "" -#: ../../library/curses.rst:1481 +#: ../../library/curses.rst:1467 msgid "``KEY_ENTER``" msgstr "``KEY_ENTER``" -#: ../../library/curses.rst:1481 +#: ../../library/curses.rst:1467 msgid "Enter or send (unreliable)" msgstr "" -#: ../../library/curses.rst:1483 +#: ../../library/curses.rst:1469 msgid "``KEY_SRESET``" msgstr "``KEY_SRESET``" -#: ../../library/curses.rst:1483 +#: ../../library/curses.rst:1469 msgid "Soft (partial) reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1485 +#: ../../library/curses.rst:1471 msgid "``KEY_RESET``" msgstr "``KEY_RESET``" -#: ../../library/curses.rst:1485 +#: ../../library/curses.rst:1471 msgid "Reset or hard reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1487 +#: ../../library/curses.rst:1473 msgid "``KEY_PRINT``" msgstr "``KEY_PRINT``" -#: ../../library/curses.rst:1487 +#: ../../library/curses.rst:1473 msgid "Print" msgstr "" -#: ../../library/curses.rst:1489 +#: ../../library/curses.rst:1475 msgid "``KEY_LL``" msgstr "``KEY_LL``" -#: ../../library/curses.rst:1489 +#: ../../library/curses.rst:1475 msgid "Home down or bottom (lower left)" msgstr "" -#: ../../library/curses.rst:1491 +#: ../../library/curses.rst:1477 msgid "``KEY_A1``" msgstr "``KEY_A1``" -#: ../../library/curses.rst:1491 +#: ../../library/curses.rst:1477 msgid "Upper left of keypad" msgstr "" -#: ../../library/curses.rst:1493 +#: ../../library/curses.rst:1479 msgid "``KEY_A3``" msgstr "``KEY_A3``" -#: ../../library/curses.rst:1493 +#: ../../library/curses.rst:1479 msgid "Upper right of keypad" msgstr "" -#: ../../library/curses.rst:1495 +#: ../../library/curses.rst:1481 msgid "``KEY_B2``" msgstr "``KEY_B2``" -#: ../../library/curses.rst:1495 +#: ../../library/curses.rst:1481 msgid "Center of keypad" msgstr "" -#: ../../library/curses.rst:1497 +#: ../../library/curses.rst:1483 msgid "``KEY_C1``" msgstr "``KEY_C1``" -#: ../../library/curses.rst:1497 +#: ../../library/curses.rst:1483 msgid "Lower left of keypad" msgstr "" -#: ../../library/curses.rst:1499 +#: ../../library/curses.rst:1485 msgid "``KEY_C3``" msgstr "``KEY_C3``" -#: ../../library/curses.rst:1499 +#: ../../library/curses.rst:1485 msgid "Lower right of keypad" msgstr "" -#: ../../library/curses.rst:1501 +#: ../../library/curses.rst:1487 msgid "``KEY_BTAB``" msgstr "``KEY_BTAB``" -#: ../../library/curses.rst:1501 +#: ../../library/curses.rst:1487 msgid "Back tab" msgstr "" -#: ../../library/curses.rst:1503 +#: ../../library/curses.rst:1489 msgid "``KEY_BEG``" msgstr "``KEY_BEG``" -#: ../../library/curses.rst:1503 +#: ../../library/curses.rst:1489 msgid "Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1505 +#: ../../library/curses.rst:1491 msgid "``KEY_CANCEL``" msgstr "``KEY_CANCEL``" -#: ../../library/curses.rst:1505 +#: ../../library/curses.rst:1491 msgid "Cancel" msgstr "" -#: ../../library/curses.rst:1507 +#: ../../library/curses.rst:1493 msgid "``KEY_CLOSE``" msgstr "``KEY_CLOSE``" -#: ../../library/curses.rst:1507 +#: ../../library/curses.rst:1493 msgid "Close" msgstr "" -#: ../../library/curses.rst:1509 +#: ../../library/curses.rst:1495 msgid "``KEY_COMMAND``" msgstr "``KEY_COMMAND``" -#: ../../library/curses.rst:1509 +#: ../../library/curses.rst:1495 msgid "Cmd (command)" msgstr "" -#: ../../library/curses.rst:1511 +#: ../../library/curses.rst:1497 msgid "``KEY_COPY``" msgstr "``KEY_COPY``" -#: ../../library/curses.rst:1511 +#: ../../library/curses.rst:1497 msgid "Copy" msgstr "" -#: ../../library/curses.rst:1513 +#: ../../library/curses.rst:1499 msgid "``KEY_CREATE``" msgstr "``KEY_CREATE``" -#: ../../library/curses.rst:1513 +#: ../../library/curses.rst:1499 msgid "Create" msgstr "" -#: ../../library/curses.rst:1515 +#: ../../library/curses.rst:1501 msgid "``KEY_END``" msgstr "``KEY_END``" -#: ../../library/curses.rst:1515 +#: ../../library/curses.rst:1501 msgid "End" msgstr "" -#: ../../library/curses.rst:1517 +#: ../../library/curses.rst:1503 msgid "``KEY_EXIT``" msgstr "``KEY_EXIT``" -#: ../../library/curses.rst:1517 +#: ../../library/curses.rst:1503 msgid "Exit" msgstr "" -#: ../../library/curses.rst:1519 +#: ../../library/curses.rst:1505 msgid "``KEY_FIND``" msgstr "``KEY_FIND``" -#: ../../library/curses.rst:1519 +#: ../../library/curses.rst:1505 msgid "Find" msgstr "" -#: ../../library/curses.rst:1521 +#: ../../library/curses.rst:1507 msgid "``KEY_HELP``" msgstr "``KEY_HELP``" -#: ../../library/curses.rst:1521 +#: ../../library/curses.rst:1507 msgid "Help" msgstr "" -#: ../../library/curses.rst:1523 +#: ../../library/curses.rst:1509 msgid "``KEY_MARK``" msgstr "``KEY_MARK``" -#: ../../library/curses.rst:1523 +#: ../../library/curses.rst:1509 msgid "Mark" msgstr "" -#: ../../library/curses.rst:1525 +#: ../../library/curses.rst:1511 msgid "``KEY_MESSAGE``" msgstr "``KEY_MESSAGE``" -#: ../../library/curses.rst:1525 +#: ../../library/curses.rst:1511 msgid "Message" msgstr "" -#: ../../library/curses.rst:1527 +#: ../../library/curses.rst:1513 msgid "``KEY_MOVE``" msgstr "``KEY_MOVE``" -#: ../../library/curses.rst:1527 +#: ../../library/curses.rst:1513 msgid "Move" msgstr "" -#: ../../library/curses.rst:1529 +#: ../../library/curses.rst:1515 msgid "``KEY_NEXT``" msgstr "``KEY_NEXT``" -#: ../../library/curses.rst:1529 +#: ../../library/curses.rst:1515 msgid "Next" msgstr "" -#: ../../library/curses.rst:1531 +#: ../../library/curses.rst:1517 msgid "``KEY_OPEN``" msgstr "``KEY_OPEN``" -#: ../../library/curses.rst:1531 +#: ../../library/curses.rst:1517 msgid "Open" msgstr "" -#: ../../library/curses.rst:1533 +#: ../../library/curses.rst:1519 msgid "``KEY_OPTIONS``" msgstr "``KEY_OPTIONS``" -#: ../../library/curses.rst:1533 +#: ../../library/curses.rst:1519 msgid "Options" msgstr "" -#: ../../library/curses.rst:1535 +#: ../../library/curses.rst:1521 msgid "``KEY_PREVIOUS``" msgstr "``KEY_PREVIOUS``" -#: ../../library/curses.rst:1535 +#: ../../library/curses.rst:1521 msgid "Prev (previous)" msgstr "" -#: ../../library/curses.rst:1537 +#: ../../library/curses.rst:1523 msgid "``KEY_REDO``" msgstr "``KEY_REDO``" -#: ../../library/curses.rst:1537 +#: ../../library/curses.rst:1523 msgid "Redo" msgstr "" -#: ../../library/curses.rst:1539 +#: ../../library/curses.rst:1525 msgid "``KEY_REFERENCE``" msgstr "``KEY_REFERENCE``" -#: ../../library/curses.rst:1539 +#: ../../library/curses.rst:1525 msgid "Ref (reference)" msgstr "" -#: ../../library/curses.rst:1541 +#: ../../library/curses.rst:1527 msgid "``KEY_REFRESH``" msgstr "``KEY_REFRESH``" -#: ../../library/curses.rst:1541 +#: ../../library/curses.rst:1527 msgid "Refresh" msgstr "" -#: ../../library/curses.rst:1543 +#: ../../library/curses.rst:1529 msgid "``KEY_REPLACE``" msgstr "``KEY_REPLACE``" -#: ../../library/curses.rst:1543 +#: ../../library/curses.rst:1529 msgid "Replace" msgstr "" -#: ../../library/curses.rst:1545 +#: ../../library/curses.rst:1531 msgid "``KEY_RESTART``" msgstr "``KEY_RESTART``" -#: ../../library/curses.rst:1545 +#: ../../library/curses.rst:1531 msgid "Restart" msgstr "" -#: ../../library/curses.rst:1547 +#: ../../library/curses.rst:1533 msgid "``KEY_RESUME``" msgstr "``KEY_RESUME``" -#: ../../library/curses.rst:1547 +#: ../../library/curses.rst:1533 msgid "Resume" msgstr "" -#: ../../library/curses.rst:1549 +#: ../../library/curses.rst:1535 msgid "``KEY_SAVE``" msgstr "``KEY_SAVE``" -#: ../../library/curses.rst:1549 +#: ../../library/curses.rst:1535 msgid "Save" msgstr "" -#: ../../library/curses.rst:1551 +#: ../../library/curses.rst:1537 msgid "``KEY_SBEG``" msgstr "``KEY_SBEG``" -#: ../../library/curses.rst:1551 +#: ../../library/curses.rst:1537 msgid "Shifted Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1553 +#: ../../library/curses.rst:1539 msgid "``KEY_SCANCEL``" msgstr "``KEY_SCANCEL``" -#: ../../library/curses.rst:1553 +#: ../../library/curses.rst:1539 msgid "Shifted Cancel" msgstr "" -#: ../../library/curses.rst:1555 +#: ../../library/curses.rst:1541 msgid "``KEY_SCOMMAND``" msgstr "``KEY_SCOMMAND``" -#: ../../library/curses.rst:1555 +#: ../../library/curses.rst:1541 msgid "Shifted Command" msgstr "" -#: ../../library/curses.rst:1557 +#: ../../library/curses.rst:1543 msgid "``KEY_SCOPY``" msgstr "``KEY_SCOPY``" -#: ../../library/curses.rst:1557 +#: ../../library/curses.rst:1543 msgid "Shifted Copy" msgstr "" -#: ../../library/curses.rst:1559 +#: ../../library/curses.rst:1545 msgid "``KEY_SCREATE``" msgstr "``KEY_SCREATE``" -#: ../../library/curses.rst:1559 +#: ../../library/curses.rst:1545 msgid "Shifted Create" msgstr "" -#: ../../library/curses.rst:1561 +#: ../../library/curses.rst:1547 msgid "``KEY_SDC``" msgstr "``KEY_SDC``" -#: ../../library/curses.rst:1561 +#: ../../library/curses.rst:1547 msgid "Shifted Delete char" msgstr "" -#: ../../library/curses.rst:1563 +#: ../../library/curses.rst:1549 msgid "``KEY_SDL``" msgstr "``KEY_SDL``" -#: ../../library/curses.rst:1563 +#: ../../library/curses.rst:1549 msgid "Shifted Delete line" msgstr "" -#: ../../library/curses.rst:1565 +#: ../../library/curses.rst:1551 msgid "``KEY_SELECT``" msgstr "``KEY_SELECT``" -#: ../../library/curses.rst:1565 +#: ../../library/curses.rst:1551 msgid "Select" msgstr "" -#: ../../library/curses.rst:1567 +#: ../../library/curses.rst:1553 msgid "``KEY_SEND``" msgstr "``KEY_SEND``" -#: ../../library/curses.rst:1567 +#: ../../library/curses.rst:1553 msgid "Shifted End" msgstr "" -#: ../../library/curses.rst:1569 +#: ../../library/curses.rst:1555 msgid "``KEY_SEOL``" msgstr "``KEY_SEOL``" -#: ../../library/curses.rst:1569 +#: ../../library/curses.rst:1555 msgid "Shifted Clear line" msgstr "" -#: ../../library/curses.rst:1571 +#: ../../library/curses.rst:1557 msgid "``KEY_SEXIT``" msgstr "``KEY_SEXIT``" -#: ../../library/curses.rst:1571 +#: ../../library/curses.rst:1557 msgid "Shifted Exit" msgstr "" -#: ../../library/curses.rst:1573 +#: ../../library/curses.rst:1559 msgid "``KEY_SFIND``" msgstr "``KEY_SFIND``" -#: ../../library/curses.rst:1573 +#: ../../library/curses.rst:1559 msgid "Shifted Find" msgstr "" -#: ../../library/curses.rst:1575 +#: ../../library/curses.rst:1561 msgid "``KEY_SHELP``" msgstr "``KEY_SHELP``" -#: ../../library/curses.rst:1575 +#: ../../library/curses.rst:1561 msgid "Shifted Help" msgstr "" -#: ../../library/curses.rst:1577 +#: ../../library/curses.rst:1563 msgid "``KEY_SHOME``" msgstr "``KEY_SHOME``" -#: ../../library/curses.rst:1577 +#: ../../library/curses.rst:1563 msgid "Shifted Home" msgstr "" -#: ../../library/curses.rst:1579 +#: ../../library/curses.rst:1565 msgid "``KEY_SIC``" msgstr "``KEY_SIC``" -#: ../../library/curses.rst:1579 +#: ../../library/curses.rst:1565 msgid "Shifted Input" msgstr "" -#: ../../library/curses.rst:1581 +#: ../../library/curses.rst:1567 msgid "``KEY_SLEFT``" msgstr "``KEY_SLEFT``" -#: ../../library/curses.rst:1581 +#: ../../library/curses.rst:1567 msgid "Shifted Left arrow" msgstr "" -#: ../../library/curses.rst:1583 +#: ../../library/curses.rst:1569 msgid "``KEY_SMESSAGE``" msgstr "``KEY_SMESSAGE``" -#: ../../library/curses.rst:1583 +#: ../../library/curses.rst:1569 msgid "Shifted Message" msgstr "" -#: ../../library/curses.rst:1585 +#: ../../library/curses.rst:1571 msgid "``KEY_SMOVE``" msgstr "``KEY_SMOVE``" -#: ../../library/curses.rst:1585 +#: ../../library/curses.rst:1571 msgid "Shifted Move" msgstr "" -#: ../../library/curses.rst:1587 +#: ../../library/curses.rst:1573 msgid "``KEY_SNEXT``" msgstr "``KEY_SNEXT``" -#: ../../library/curses.rst:1587 +#: ../../library/curses.rst:1573 msgid "Shifted Next" msgstr "" -#: ../../library/curses.rst:1589 +#: ../../library/curses.rst:1575 msgid "``KEY_SOPTIONS``" msgstr "``KEY_SOPTIONS``" -#: ../../library/curses.rst:1589 +#: ../../library/curses.rst:1575 msgid "Shifted Options" msgstr "" -#: ../../library/curses.rst:1591 +#: ../../library/curses.rst:1577 msgid "``KEY_SPREVIOUS``" msgstr "``KEY_SPREVIOUS``" -#: ../../library/curses.rst:1591 +#: ../../library/curses.rst:1577 msgid "Shifted Prev" msgstr "" -#: ../../library/curses.rst:1593 +#: ../../library/curses.rst:1579 msgid "``KEY_SPRINT``" msgstr "``KEY_SPRINT``" -#: ../../library/curses.rst:1593 +#: ../../library/curses.rst:1579 msgid "Shifted Print" msgstr "" -#: ../../library/curses.rst:1595 +#: ../../library/curses.rst:1581 msgid "``KEY_SREDO``" msgstr "``KEY_SREDO``" -#: ../../library/curses.rst:1595 +#: ../../library/curses.rst:1581 msgid "Shifted Redo" msgstr "" -#: ../../library/curses.rst:1597 +#: ../../library/curses.rst:1583 msgid "``KEY_SREPLACE``" msgstr "``KEY_SREPLACE``" -#: ../../library/curses.rst:1597 +#: ../../library/curses.rst:1583 msgid "Shifted Replace" msgstr "" -#: ../../library/curses.rst:1599 +#: ../../library/curses.rst:1585 msgid "``KEY_SRIGHT``" msgstr "``KEY_SRIGHT``" -#: ../../library/curses.rst:1599 +#: ../../library/curses.rst:1585 msgid "Shifted Right arrow" msgstr "" -#: ../../library/curses.rst:1601 +#: ../../library/curses.rst:1587 msgid "``KEY_SRSUME``" msgstr "``KEY_SRSUME``" -#: ../../library/curses.rst:1601 +#: ../../library/curses.rst:1587 msgid "Shifted Resume" msgstr "" -#: ../../library/curses.rst:1603 +#: ../../library/curses.rst:1589 msgid "``KEY_SSAVE``" msgstr "``KEY_SSAVE``" -#: ../../library/curses.rst:1603 +#: ../../library/curses.rst:1589 msgid "Shifted Save" msgstr "" -#: ../../library/curses.rst:1605 +#: ../../library/curses.rst:1591 msgid "``KEY_SSUSPEND``" msgstr "``KEY_SSUSPEND``" -#: ../../library/curses.rst:1605 +#: ../../library/curses.rst:1591 msgid "Shifted Suspend" msgstr "" -#: ../../library/curses.rst:1607 +#: ../../library/curses.rst:1593 msgid "``KEY_SUNDO``" msgstr "``KEY_SUNDO``" -#: ../../library/curses.rst:1607 +#: ../../library/curses.rst:1593 msgid "Shifted Undo" msgstr "" -#: ../../library/curses.rst:1609 +#: ../../library/curses.rst:1595 msgid "``KEY_SUSPEND``" msgstr "``KEY_SUSPEND``" -#: ../../library/curses.rst:1609 +#: ../../library/curses.rst:1595 msgid "Suspend" msgstr "" -#: ../../library/curses.rst:1611 +#: ../../library/curses.rst:1597 msgid "``KEY_UNDO``" msgstr "``KEY_UNDO``" -#: ../../library/curses.rst:1611 +#: ../../library/curses.rst:1597 msgid "Undo" msgstr "" -#: ../../library/curses.rst:1613 +#: ../../library/curses.rst:1599 msgid "``KEY_MOUSE``" msgstr "``KEY_MOUSE``" -#: ../../library/curses.rst:1613 +#: ../../library/curses.rst:1599 msgid "Mouse event has occurred" msgstr "" -#: ../../library/curses.rst:1615 +#: ../../library/curses.rst:1601 msgid "``KEY_RESIZE``" msgstr "``KEY_RESIZE``" -#: ../../library/curses.rst:1615 +#: ../../library/curses.rst:1601 msgid "Terminal resize event" msgstr "" -#: ../../library/curses.rst:1617 +#: ../../library/curses.rst:1603 msgid "``KEY_MAX``" msgstr "``KEY_MAX``" -#: ../../library/curses.rst:1617 +#: ../../library/curses.rst:1603 msgid "Maximum key value" msgstr "" -#: ../../library/curses.rst:1620 +#: ../../library/curses.rst:1606 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " "are normally at least four function keys (:const:`KEY_F1`, :const:`KEY_F2`, :" @@ -2469,64 +2456,64 @@ msgid "" "function keys); also, the following keypad mappings are standard:" msgstr "" -#: ../../library/curses.rst:1629 +#: ../../library/curses.rst:1615 msgid "Keycap" msgstr "" -#: ../../library/curses.rst:1629 ../../library/curses.rst:1746 -#: ../../library/curses.rst:1870 +#: ../../library/curses.rst:1615 ../../library/curses.rst:1732 +#: ../../library/curses.rst:1856 msgid "Constant" msgstr "" -#: ../../library/curses.rst:1631 +#: ../../library/curses.rst:1617 msgid ":kbd:`Insert`" msgstr ":kbd:`Insert`" -#: ../../library/curses.rst:1631 +#: ../../library/curses.rst:1617 msgid "KEY_IC" msgstr "KEY_IC" -#: ../../library/curses.rst:1633 +#: ../../library/curses.rst:1619 msgid ":kbd:`Delete`" msgstr ":kbd:`Delete`" -#: ../../library/curses.rst:1633 +#: ../../library/curses.rst:1619 msgid "KEY_DC" msgstr "KEY_DC" -#: ../../library/curses.rst:1635 +#: ../../library/curses.rst:1621 msgid ":kbd:`Home`" msgstr ":kbd:`Home`" -#: ../../library/curses.rst:1635 +#: ../../library/curses.rst:1621 msgid "KEY_HOME" msgstr "KEY_HOME" -#: ../../library/curses.rst:1637 +#: ../../library/curses.rst:1623 msgid ":kbd:`End`" msgstr ":kbd:`End`" -#: ../../library/curses.rst:1637 +#: ../../library/curses.rst:1623 msgid "KEY_END" msgstr "KEY_END" -#: ../../library/curses.rst:1639 +#: ../../library/curses.rst:1625 msgid ":kbd:`Page Up`" msgstr ":kbd:`Page Up`" -#: ../../library/curses.rst:1639 +#: ../../library/curses.rst:1625 msgid "KEY_PPAGE" msgstr "KEY_PPAGE" -#: ../../library/curses.rst:1641 +#: ../../library/curses.rst:1627 msgid ":kbd:`Page Down`" msgstr ":kbd:`Page Down`" -#: ../../library/curses.rst:1641 +#: ../../library/curses.rst:1627 msgid "KEY_NPAGE" msgstr "KEY_NPAGE" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1630 msgid "" "The following table lists characters from the alternate character set. These " "are inherited from the VT100 terminal, and will generally be available on " @@ -2534,435 +2521,435 @@ msgid "" "available, curses falls back on a crude printable ASCII approximation." msgstr "" -#: ../../library/curses.rst:1651 +#: ../../library/curses.rst:1637 msgid "These are available only after :func:`initscr` has been called." msgstr "" -#: ../../library/curses.rst:1654 +#: ../../library/curses.rst:1640 msgid "ACS code" msgstr "" -#: ../../library/curses.rst:1656 +#: ../../library/curses.rst:1642 msgid "``ACS_BBSS``" msgstr "``ACS_BBSS``" -#: ../../library/curses.rst:1656 +#: ../../library/curses.rst:1642 msgid "alternate name for upper right corner" msgstr "" -#: ../../library/curses.rst:1658 +#: ../../library/curses.rst:1644 msgid "``ACS_BLOCK``" msgstr "``ACS_BLOCK``" -#: ../../library/curses.rst:1658 +#: ../../library/curses.rst:1644 msgid "solid square block" msgstr "" -#: ../../library/curses.rst:1660 +#: ../../library/curses.rst:1646 msgid "``ACS_BOARD``" msgstr "``ACS_BOARD``" -#: ../../library/curses.rst:1660 +#: ../../library/curses.rst:1646 msgid "board of squares" msgstr "" -#: ../../library/curses.rst:1662 +#: ../../library/curses.rst:1648 msgid "``ACS_BSBS``" msgstr "``ACS_BSBS``" -#: ../../library/curses.rst:1662 +#: ../../library/curses.rst:1648 msgid "alternate name for horizontal line" msgstr "" -#: ../../library/curses.rst:1664 +#: ../../library/curses.rst:1650 msgid "``ACS_BSSB``" msgstr "``ACS_BSSB``" -#: ../../library/curses.rst:1664 +#: ../../library/curses.rst:1650 msgid "alternate name for upper left corner" msgstr "" -#: ../../library/curses.rst:1666 +#: ../../library/curses.rst:1652 msgid "``ACS_BSSS``" msgstr "``ACS_BSSS``" -#: ../../library/curses.rst:1666 +#: ../../library/curses.rst:1652 msgid "alternate name for top tee" msgstr "" -#: ../../library/curses.rst:1668 +#: ../../library/curses.rst:1654 msgid "``ACS_BTEE``" msgstr "``ACS_BTEE``" -#: ../../library/curses.rst:1668 +#: ../../library/curses.rst:1654 msgid "bottom tee" msgstr "" -#: ../../library/curses.rst:1670 +#: ../../library/curses.rst:1656 msgid "``ACS_BULLET``" msgstr "``ACS_BULLET``" -#: ../../library/curses.rst:1670 +#: ../../library/curses.rst:1656 msgid "bullet" msgstr "" -#: ../../library/curses.rst:1672 +#: ../../library/curses.rst:1658 msgid "``ACS_CKBOARD``" msgstr "``ACS_CKBOARD``" -#: ../../library/curses.rst:1672 +#: ../../library/curses.rst:1658 msgid "checker board (stipple)" msgstr "" -#: ../../library/curses.rst:1674 +#: ../../library/curses.rst:1660 msgid "``ACS_DARROW``" msgstr "``ACS_DARROW``" -#: ../../library/curses.rst:1674 +#: ../../library/curses.rst:1660 msgid "arrow pointing down" msgstr "" -#: ../../library/curses.rst:1676 +#: ../../library/curses.rst:1662 msgid "``ACS_DEGREE``" msgstr "``ACS_DEGREE``" -#: ../../library/curses.rst:1676 +#: ../../library/curses.rst:1662 msgid "degree symbol" msgstr "" -#: ../../library/curses.rst:1678 +#: ../../library/curses.rst:1664 msgid "``ACS_DIAMOND``" msgstr "``ACS_DIAMOND``" -#: ../../library/curses.rst:1678 +#: ../../library/curses.rst:1664 msgid "diamond" msgstr "" -#: ../../library/curses.rst:1680 +#: ../../library/curses.rst:1666 msgid "``ACS_GEQUAL``" msgstr "``ACS_GEQUAL``" -#: ../../library/curses.rst:1680 +#: ../../library/curses.rst:1666 msgid "greater-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1682 +#: ../../library/curses.rst:1668 msgid "``ACS_HLINE``" msgstr "``ACS_HLINE``" -#: ../../library/curses.rst:1682 +#: ../../library/curses.rst:1668 msgid "horizontal line" msgstr "" -#: ../../library/curses.rst:1684 +#: ../../library/curses.rst:1670 msgid "``ACS_LANTERN``" msgstr "``ACS_LANTERN``" -#: ../../library/curses.rst:1684 +#: ../../library/curses.rst:1670 msgid "lantern symbol" msgstr "" -#: ../../library/curses.rst:1686 +#: ../../library/curses.rst:1672 msgid "``ACS_LARROW``" msgstr "``ACS_LARROW``" -#: ../../library/curses.rst:1686 +#: ../../library/curses.rst:1672 msgid "left arrow" msgstr "" -#: ../../library/curses.rst:1688 +#: ../../library/curses.rst:1674 msgid "``ACS_LEQUAL``" msgstr "``ACS_LEQUAL``" -#: ../../library/curses.rst:1688 +#: ../../library/curses.rst:1674 msgid "less-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1690 +#: ../../library/curses.rst:1676 msgid "``ACS_LLCORNER``" msgstr "``ACS_LLCORNER``" -#: ../../library/curses.rst:1690 +#: ../../library/curses.rst:1676 msgid "lower left-hand corner" msgstr "" -#: ../../library/curses.rst:1692 +#: ../../library/curses.rst:1678 msgid "``ACS_LRCORNER``" msgstr "``ACS_LRCORNER``" -#: ../../library/curses.rst:1692 +#: ../../library/curses.rst:1678 msgid "lower right-hand corner" msgstr "" -#: ../../library/curses.rst:1694 +#: ../../library/curses.rst:1680 msgid "``ACS_LTEE``" msgstr "``ACS_LTEE``" -#: ../../library/curses.rst:1694 +#: ../../library/curses.rst:1680 msgid "left tee" msgstr "" -#: ../../library/curses.rst:1696 +#: ../../library/curses.rst:1682 msgid "``ACS_NEQUAL``" msgstr "``ACS_NEQUAL``" -#: ../../library/curses.rst:1696 +#: ../../library/curses.rst:1682 msgid "not-equal sign" msgstr "" -#: ../../library/curses.rst:1698 +#: ../../library/curses.rst:1684 msgid "``ACS_PI``" msgstr "``ACS_PI``" -#: ../../library/curses.rst:1698 +#: ../../library/curses.rst:1684 msgid "letter pi" msgstr "" -#: ../../library/curses.rst:1700 +#: ../../library/curses.rst:1686 msgid "``ACS_PLMINUS``" msgstr "``ACS_PLMINUS``" -#: ../../library/curses.rst:1700 +#: ../../library/curses.rst:1686 msgid "plus-or-minus sign" msgstr "" -#: ../../library/curses.rst:1702 +#: ../../library/curses.rst:1688 msgid "``ACS_PLUS``" msgstr "``ACS_PLUS``" -#: ../../library/curses.rst:1702 +#: ../../library/curses.rst:1688 msgid "big plus sign" msgstr "" -#: ../../library/curses.rst:1704 +#: ../../library/curses.rst:1690 msgid "``ACS_RARROW``" msgstr "``ACS_RARROW``" -#: ../../library/curses.rst:1704 +#: ../../library/curses.rst:1690 msgid "right arrow" msgstr "" -#: ../../library/curses.rst:1706 +#: ../../library/curses.rst:1692 msgid "``ACS_RTEE``" msgstr "``ACS_RTEE``" -#: ../../library/curses.rst:1706 +#: ../../library/curses.rst:1692 msgid "right tee" msgstr "" -#: ../../library/curses.rst:1708 +#: ../../library/curses.rst:1694 msgid "``ACS_S1``" msgstr "``ACS_S1``" -#: ../../library/curses.rst:1708 +#: ../../library/curses.rst:1694 msgid "scan line 1" msgstr "" -#: ../../library/curses.rst:1710 +#: ../../library/curses.rst:1696 msgid "``ACS_S3``" msgstr "``ACS_S3``" -#: ../../library/curses.rst:1710 +#: ../../library/curses.rst:1696 msgid "scan line 3" msgstr "" -#: ../../library/curses.rst:1712 +#: ../../library/curses.rst:1698 msgid "``ACS_S7``" msgstr "``ACS_S7``" -#: ../../library/curses.rst:1712 +#: ../../library/curses.rst:1698 msgid "scan line 7" msgstr "" -#: ../../library/curses.rst:1714 +#: ../../library/curses.rst:1700 msgid "``ACS_S9``" msgstr "``ACS_S9``" -#: ../../library/curses.rst:1714 +#: ../../library/curses.rst:1700 msgid "scan line 9" msgstr "" -#: ../../library/curses.rst:1716 +#: ../../library/curses.rst:1702 msgid "``ACS_SBBS``" msgstr "``ACS_SBBS``" -#: ../../library/curses.rst:1716 +#: ../../library/curses.rst:1702 msgid "alternate name for lower right corner" msgstr "" -#: ../../library/curses.rst:1718 +#: ../../library/curses.rst:1704 msgid "``ACS_SBSB``" msgstr "``ACS_SBSB``" -#: ../../library/curses.rst:1718 +#: ../../library/curses.rst:1704 msgid "alternate name for vertical line" msgstr "" -#: ../../library/curses.rst:1720 +#: ../../library/curses.rst:1706 msgid "``ACS_SBSS``" msgstr "``ACS_SBSS``" -#: ../../library/curses.rst:1720 +#: ../../library/curses.rst:1706 msgid "alternate name for right tee" msgstr "" -#: ../../library/curses.rst:1722 +#: ../../library/curses.rst:1708 msgid "``ACS_SSBB``" msgstr "``ACS_SSBB``" -#: ../../library/curses.rst:1722 +#: ../../library/curses.rst:1708 msgid "alternate name for lower left corner" msgstr "" -#: ../../library/curses.rst:1724 +#: ../../library/curses.rst:1710 msgid "``ACS_SSBS``" msgstr "``ACS_SSBS``" -#: ../../library/curses.rst:1724 +#: ../../library/curses.rst:1710 msgid "alternate name for bottom tee" msgstr "" -#: ../../library/curses.rst:1726 +#: ../../library/curses.rst:1712 msgid "``ACS_SSSB``" msgstr "``ACS_SSSB``" -#: ../../library/curses.rst:1726 +#: ../../library/curses.rst:1712 msgid "alternate name for left tee" msgstr "" -#: ../../library/curses.rst:1728 +#: ../../library/curses.rst:1714 msgid "``ACS_SSSS``" msgstr "``ACS_SSSS``" -#: ../../library/curses.rst:1728 +#: ../../library/curses.rst:1714 msgid "alternate name for crossover or big plus" msgstr "" -#: ../../library/curses.rst:1730 +#: ../../library/curses.rst:1716 msgid "``ACS_STERLING``" msgstr "``ACS_STERLING``" -#: ../../library/curses.rst:1730 +#: ../../library/curses.rst:1716 msgid "pound sterling" msgstr "" -#: ../../library/curses.rst:1732 +#: ../../library/curses.rst:1718 msgid "``ACS_TTEE``" msgstr "``ACS_TTEE``" -#: ../../library/curses.rst:1732 +#: ../../library/curses.rst:1718 msgid "top tee" msgstr "" -#: ../../library/curses.rst:1734 +#: ../../library/curses.rst:1720 msgid "``ACS_UARROW``" msgstr "``ACS_UARROW``" -#: ../../library/curses.rst:1734 +#: ../../library/curses.rst:1720 msgid "up arrow" msgstr "" -#: ../../library/curses.rst:1736 +#: ../../library/curses.rst:1722 msgid "``ACS_ULCORNER``" msgstr "``ACS_ULCORNER``" -#: ../../library/curses.rst:1736 +#: ../../library/curses.rst:1722 msgid "upper left corner" msgstr "" -#: ../../library/curses.rst:1738 +#: ../../library/curses.rst:1724 msgid "``ACS_URCORNER``" msgstr "``ACS_URCORNER``" -#: ../../library/curses.rst:1738 +#: ../../library/curses.rst:1724 msgid "upper right corner" msgstr "" -#: ../../library/curses.rst:1740 +#: ../../library/curses.rst:1726 msgid "``ACS_VLINE``" msgstr "``ACS_VLINE``" -#: ../../library/curses.rst:1740 +#: ../../library/curses.rst:1726 msgid "vertical line" msgstr "" -#: ../../library/curses.rst:1743 +#: ../../library/curses.rst:1729 msgid "The following table lists the predefined colors:" msgstr "" -#: ../../library/curses.rst:1746 +#: ../../library/curses.rst:1732 msgid "Color" msgstr "顏色" -#: ../../library/curses.rst:1748 +#: ../../library/curses.rst:1734 msgid "``COLOR_BLACK``" msgstr "``COLOR_BLACK``" -#: ../../library/curses.rst:1748 +#: ../../library/curses.rst:1734 msgid "Black" msgstr "黑" -#: ../../library/curses.rst:1750 +#: ../../library/curses.rst:1736 msgid "``COLOR_BLUE``" msgstr "``COLOR_BLUE``" -#: ../../library/curses.rst:1750 +#: ../../library/curses.rst:1736 msgid "Blue" msgstr "藍" -#: ../../library/curses.rst:1752 +#: ../../library/curses.rst:1738 msgid "``COLOR_CYAN``" msgstr "``COLOR_CYAN``" -#: ../../library/curses.rst:1752 +#: ../../library/curses.rst:1738 msgid "Cyan (light greenish blue)" msgstr "" -#: ../../library/curses.rst:1754 +#: ../../library/curses.rst:1740 msgid "``COLOR_GREEN``" msgstr "``COLOR_GREEN``" -#: ../../library/curses.rst:1754 +#: ../../library/curses.rst:1740 msgid "Green" msgstr "綠" -#: ../../library/curses.rst:1756 +#: ../../library/curses.rst:1742 msgid "``COLOR_MAGENTA``" msgstr "``COLOR_MAGENTA``" -#: ../../library/curses.rst:1756 +#: ../../library/curses.rst:1742 msgid "Magenta (purplish red)" msgstr "" -#: ../../library/curses.rst:1758 +#: ../../library/curses.rst:1744 msgid "``COLOR_RED``" msgstr "``COLOR_RED``" -#: ../../library/curses.rst:1758 +#: ../../library/curses.rst:1744 msgid "Red" msgstr "紅" -#: ../../library/curses.rst:1760 +#: ../../library/curses.rst:1746 msgid "``COLOR_WHITE``" msgstr "``COLOR_WHITE``" -#: ../../library/curses.rst:1760 +#: ../../library/curses.rst:1746 msgid "White" msgstr "白" -#: ../../library/curses.rst:1762 +#: ../../library/curses.rst:1748 msgid "``COLOR_YELLOW``" msgstr "``COLOR_YELLOW``" -#: ../../library/curses.rst:1762 +#: ../../library/curses.rst:1748 msgid "Yellow" msgstr "" -#: ../../library/curses.rst:1767 +#: ../../library/curses.rst:1753 msgid ":mod:`curses.textpad` --- Text input widget for curses programs" msgstr "" -#: ../../library/curses.rst:1775 +#: ../../library/curses.rst:1761 msgid "" "The :mod:`curses.textpad` module provides a :class:`Textbox` class that " "handles elementary text editing in a curses window, supporting a set of " @@ -2972,11 +2959,11 @@ msgid "" "purposes." msgstr "" -#: ../../library/curses.rst:1781 +#: ../../library/curses.rst:1767 msgid "The module :mod:`curses.textpad` defines the following function:" msgstr "" -#: ../../library/curses.rst:1786 +#: ../../library/curses.rst:1772 msgid "" "Draw a rectangle. The first argument must be a window object; the remaining " "arguments are coordinates relative to that window. The second and third " @@ -2988,15 +2975,15 @@ msgid "" "will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" -#: ../../library/curses.rst:1799 +#: ../../library/curses.rst:1785 msgid "Textbox objects" msgstr "" -#: ../../library/curses.rst:1801 +#: ../../library/curses.rst:1787 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -#: ../../library/curses.rst:1806 +#: ../../library/curses.rst:1792 msgid "" "Return a textbox widget object. The *win* argument should be a curses :ref:" "`window ` object in which the textbox is to be " @@ -3005,11 +2992,11 @@ msgid "" "instance's :attr:`stripspaces` flag is initially on." msgstr "" -#: ../../library/curses.rst:1812 +#: ../../library/curses.rst:1798 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -#: ../../library/curses.rst:1817 +#: ../../library/curses.rst:1803 msgid "" "This is the entry point you will normally use. It accepts editing " "keystrokes until one of the termination keystrokes is entered. If " @@ -3020,167 +3007,167 @@ msgid "" "`stripspaces` attribute." msgstr "" -#: ../../library/curses.rst:1828 +#: ../../library/curses.rst:1814 msgid "" "Process a single command keystroke. Here are the supported special " "keystrokes:" msgstr "" -#: ../../library/curses.rst:1832 ../../library/curses.rst:1870 +#: ../../library/curses.rst:1818 ../../library/curses.rst:1856 msgid "Keystroke" msgstr "" -#: ../../library/curses.rst:1832 +#: ../../library/curses.rst:1818 msgid "Action" msgstr "" -#: ../../library/curses.rst:1834 +#: ../../library/curses.rst:1820 msgid ":kbd:`Control-A`" msgstr ":kbd:`Control-A`" -#: ../../library/curses.rst:1834 +#: ../../library/curses.rst:1820 msgid "Go to left edge of window." msgstr "" -#: ../../library/curses.rst:1836 ../../library/curses.rst:1872 +#: ../../library/curses.rst:1822 ../../library/curses.rst:1858 msgid ":kbd:`Control-B`" msgstr ":kbd:`Control-B`" -#: ../../library/curses.rst:1836 +#: ../../library/curses.rst:1822 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" -#: ../../library/curses.rst:1839 +#: ../../library/curses.rst:1825 msgid ":kbd:`Control-D`" msgstr ":kbd:`Control-D`" -#: ../../library/curses.rst:1839 +#: ../../library/curses.rst:1825 msgid "Delete character under cursor." msgstr "" -#: ../../library/curses.rst:1841 +#: ../../library/curses.rst:1827 msgid ":kbd:`Control-E`" msgstr ":kbd:`Control-E`" -#: ../../library/curses.rst:1841 +#: ../../library/curses.rst:1827 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" -#: ../../library/curses.rst:1844 ../../library/curses.rst:1874 +#: ../../library/curses.rst:1830 ../../library/curses.rst:1860 msgid ":kbd:`Control-F`" msgstr ":kbd:`Control-F`" -#: ../../library/curses.rst:1844 +#: ../../library/curses.rst:1830 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" -#: ../../library/curses.rst:1847 +#: ../../library/curses.rst:1833 msgid ":kbd:`Control-G`" msgstr ":kbd:`Control-G`" -#: ../../library/curses.rst:1847 +#: ../../library/curses.rst:1833 msgid "Terminate, returning the window contents." msgstr "" -#: ../../library/curses.rst:1849 +#: ../../library/curses.rst:1835 msgid ":kbd:`Control-H`" msgstr ":kbd:`Control-H`" -#: ../../library/curses.rst:1849 +#: ../../library/curses.rst:1835 msgid "Delete character backward." msgstr "" -#: ../../library/curses.rst:1851 +#: ../../library/curses.rst:1837 msgid ":kbd:`Control-J`" msgstr ":kbd:`Control-J`" -#: ../../library/curses.rst:1851 +#: ../../library/curses.rst:1837 msgid "Terminate if the window is 1 line, otherwise insert newline." msgstr "" -#: ../../library/curses.rst:1854 +#: ../../library/curses.rst:1840 msgid ":kbd:`Control-K`" msgstr ":kbd:`Control-K`" -#: ../../library/curses.rst:1854 +#: ../../library/curses.rst:1840 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" -#: ../../library/curses.rst:1857 +#: ../../library/curses.rst:1843 msgid ":kbd:`Control-L`" msgstr ":kbd:`Control-L`" -#: ../../library/curses.rst:1857 +#: ../../library/curses.rst:1843 msgid "Refresh screen." msgstr "" -#: ../../library/curses.rst:1859 ../../library/curses.rst:1878 +#: ../../library/curses.rst:1845 ../../library/curses.rst:1864 msgid ":kbd:`Control-N`" msgstr ":kbd:`Control-N`" -#: ../../library/curses.rst:1859 +#: ../../library/curses.rst:1845 msgid "Cursor down; move down one line." msgstr "" -#: ../../library/curses.rst:1861 +#: ../../library/curses.rst:1847 msgid ":kbd:`Control-O`" msgstr ":kbd:`Control-O`" -#: ../../library/curses.rst:1861 +#: ../../library/curses.rst:1847 msgid "Insert a blank line at cursor location." msgstr "" -#: ../../library/curses.rst:1863 ../../library/curses.rst:1876 +#: ../../library/curses.rst:1849 ../../library/curses.rst:1862 msgid ":kbd:`Control-P`" msgstr ":kbd:`Control-P`" -#: ../../library/curses.rst:1863 +#: ../../library/curses.rst:1849 msgid "Cursor up; move up one line." msgstr "" -#: ../../library/curses.rst:1866 +#: ../../library/curses.rst:1852 msgid "" "Move operations do nothing if the cursor is at an edge where the movement is " "not possible. The following synonyms are supported where possible:" msgstr "" -#: ../../library/curses.rst:1872 +#: ../../library/curses.rst:1858 msgid ":const:`KEY_LEFT`" msgstr ":const:`KEY_LEFT`" -#: ../../library/curses.rst:1874 +#: ../../library/curses.rst:1860 msgid ":const:`KEY_RIGHT`" msgstr ":const:`KEY_RIGHT`" -#: ../../library/curses.rst:1876 +#: ../../library/curses.rst:1862 msgid ":const:`KEY_UP`" msgstr ":const:`KEY_UP`" -#: ../../library/curses.rst:1878 +#: ../../library/curses.rst:1864 msgid ":const:`KEY_DOWN`" msgstr ":const:`KEY_DOWN`" -#: ../../library/curses.rst:1880 +#: ../../library/curses.rst:1866 msgid ":const:`KEY_BACKSPACE`" msgstr ":const:`KEY_BACKSPACE`" -#: ../../library/curses.rst:1880 +#: ../../library/curses.rst:1866 msgid ":kbd:`Control-h`" msgstr ":kbd:`Control-h`" -#: ../../library/curses.rst:1883 +#: ../../library/curses.rst:1869 msgid "" "All other keystrokes are treated as a command to insert the given character " "and move right (with line wrapping)." msgstr "" -#: ../../library/curses.rst:1889 +#: ../../library/curses.rst:1875 msgid "" "Return the window contents as a string; whether blanks in the window are " "included is affected by the :attr:`stripspaces` member." msgstr "" -#: ../../library/curses.rst:1895 +#: ../../library/curses.rst:1881 msgid "" "This attribute is a flag which controls the interpretation of blanks in the " "window. When it is on, trailing blanks on each line are ignored; any cursor " diff --git a/library/dataclasses.po b/library/dataclasses.po index 6768cfc880..c17b08c751 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,7 +21,7 @@ msgstr "" #: ../../library/dataclasses.rst:10 msgid "**Source code:** :source:`Lib/dataclasses.py`" -msgstr "" +msgstr "**原始碼:**\\ :source:`Lib/dataclasses.py`" #: ../../library/dataclasses.rst:14 msgid "" @@ -217,7 +217,7 @@ msgstr "" msgid "" "``kw_only``: If true (the default value is ``False``), then all fields will " "be marked as keyword-only. If a field is marked as keyword-only, then the " -"only affect is that the :meth:`__init__` parameter generated from a keyword-" +"only effect is that the :meth:`__init__` parameter generated from a keyword-" "only field must be specified with a keyword when :meth:`__init__` is " "called. There is no effect on any other aspect of dataclasses. See the :" "term:`parameter` glossary entry for details. Also see the :const:`KW_ONLY` " @@ -234,24 +234,42 @@ msgstr "" #: ../../library/dataclasses.rst:191 msgid "" +"If a field name is already included in the ``__slots__`` of a base class, it " +"will not be included in the generated ``__slots__`` to prevent `overriding " +"them `_. Therefore, do not use ``__slots__`` to retrieve the field names of " +"a dataclass. Use :func:`fields` instead. To be able to determine inherited " +"slots, base class ``__slots__`` may be any iterable, but *not* an iterator." +msgstr "" + +#: ../../library/dataclasses.rst:201 +msgid "" +"``weakref_slot``: If true (the default is ``False``), add a slot named " +"\"__weakref__\", which is required to make an instance weakref-able. It is " +"an error to specify ``weakref_slot=True`` without also specifying " +"``slots=True``." +msgstr "" + +#: ../../library/dataclasses.rst:208 +msgid "" "``field``\\s may optionally specify a default value, using normal Python " "syntax::" msgstr "" -#: ../../library/dataclasses.rst:199 +#: ../../library/dataclasses.rst:216 msgid "" "In this example, both ``a`` and ``b`` will be included in the added :meth:" "`__init__` method, which will be defined as::" msgstr "" -#: ../../library/dataclasses.rst:204 +#: ../../library/dataclasses.rst:221 msgid "" ":exc:`TypeError` will be raised if a field without a default value follows a " "field with a default value. This is true whether this occurs in a single " "class, or as a result of class inheritance." msgstr "" -#: ../../library/dataclasses.rst:210 +#: ../../library/dataclasses.rst:227 msgid "" "For common and simple use cases, no other functionality is required. There " "are, however, some dataclass features that require additional per-field " @@ -260,7 +278,7 @@ msgid "" "function. For example::" msgstr "" -#: ../../library/dataclasses.rst:223 +#: ../../library/dataclasses.rst:240 msgid "" "As shown above, the :const:`MISSING` value is a sentinel object used to " "detect if some parameters are provided by the user. This sentinel is used " @@ -268,18 +286,18 @@ msgid "" "meaning. No code should directly use the :const:`MISSING` value." msgstr "" -#: ../../library/dataclasses.rst:228 +#: ../../library/dataclasses.rst:245 msgid "The parameters to :func:`field` are:" msgstr "" -#: ../../library/dataclasses.rst:230 +#: ../../library/dataclasses.rst:247 msgid "" "``default``: If provided, this will be the default value for this field. " "This is needed because the :meth:`field` call itself replaces the normal " "position of the default value." msgstr "" -#: ../../library/dataclasses.rst:234 +#: ../../library/dataclasses.rst:251 msgid "" "``default_factory``: If provided, it must be a zero-argument callable that " "will be called when a default value is needed for this field. Among other " @@ -288,19 +306,19 @@ msgid "" "``default_factory``." msgstr "" -#: ../../library/dataclasses.rst:240 +#: ../../library/dataclasses.rst:257 msgid "" "``init``: If true (the default), this field is included as a parameter to " "the generated :meth:`__init__` method." msgstr "" -#: ../../library/dataclasses.rst:243 +#: ../../library/dataclasses.rst:260 msgid "" "``repr``: If true (the default), this field is included in the string " "returned by the generated :meth:`__repr__` method." msgstr "" -#: ../../library/dataclasses.rst:246 +#: ../../library/dataclasses.rst:263 msgid "" "``hash``: This can be a bool or ``None``. If true, this field is included " "in the generated :meth:`__hash__` method. If ``None`` (the default), use " @@ -309,7 +327,7 @@ msgid "" "Setting this value to anything other than ``None`` is discouraged." msgstr "" -#: ../../library/dataclasses.rst:253 +#: ../../library/dataclasses.rst:270 msgid "" "One possible reason to set ``hash=False`` but ``compare=True`` would be if a " "field is expensive to compute a hash value for, that field is needed for " @@ -318,13 +336,13 @@ msgid "" "used for comparisons." msgstr "" -#: ../../library/dataclasses.rst:259 +#: ../../library/dataclasses.rst:276 msgid "" "``compare``: If true (the default), this field is included in the generated " "equality and comparison methods (:meth:`__eq__`, :meth:`__gt__`, et al.)." msgstr "" -#: ../../library/dataclasses.rst:263 +#: ../../library/dataclasses.rst:280 msgid "" "``metadata``: This can be a mapping or None. None is treated as an empty " "dict. This value is wrapped in :func:`~types.MappingProxyType` to make it " @@ -334,13 +352,13 @@ msgid "" "the metadata." msgstr "" -#: ../../library/dataclasses.rst:271 +#: ../../library/dataclasses.rst:288 msgid "" "``kw_only``: If true, this field will be marked as keyword-only. This is " "used when the generated :meth:`__init__` method's parameters are computed." msgstr "" -#: ../../library/dataclasses.rst:277 +#: ../../library/dataclasses.rst:294 msgid "" "If the default value of a field is specified by a call to :func:`field()`, " "then the class attribute for this field will be replaced by the specified " @@ -351,13 +369,13 @@ msgid "" "after::" msgstr "" -#: ../../library/dataclasses.rst:293 +#: ../../library/dataclasses.rst:310 msgid "" "The class attribute ``C.z`` will be ``10``, the class attribute ``C.t`` will " "be ``20``, and the class attributes ``C.x`` and ``C.y`` will not be set." msgstr "" -#: ../../library/dataclasses.rst:299 +#: ../../library/dataclasses.rst:316 msgid "" ":class:`Field` objects describe each defined field. These objects are " "created internally, and are returned by the :func:`fields` module-level " @@ -365,28 +383,28 @@ msgid "" "directly. Its documented attributes are:" msgstr "" -#: ../../library/dataclasses.rst:304 +#: ../../library/dataclasses.rst:321 msgid "``name``: The name of the field." msgstr "" -#: ../../library/dataclasses.rst:306 +#: ../../library/dataclasses.rst:323 msgid "``type``: The type of the field." msgstr "" -#: ../../library/dataclasses.rst:308 +#: ../../library/dataclasses.rst:325 msgid "" "``default``, ``default_factory``, ``init``, ``repr``, ``hash``, ``compare``, " "``metadata``, and ``kw_only`` have the identical meaning and values as they " "do in the :func:`field` function." msgstr "" -#: ../../library/dataclasses.rst:312 +#: ../../library/dataclasses.rst:329 msgid "" "Other attributes may exist, but they are private and must not be inspected " "or relied on." msgstr "" -#: ../../library/dataclasses.rst:317 +#: ../../library/dataclasses.rst:334 msgid "" "Returns a tuple of :class:`Field` objects that define the fields for this " "dataclass. Accepts either a dataclass, or an instance of a dataclass. " @@ -394,7 +412,7 @@ msgid "" "not return pseudo-fields which are ``ClassVar`` or ``InitVar``." msgstr "" -#: ../../library/dataclasses.rst:324 +#: ../../library/dataclasses.rst:341 msgid "" "Converts the dataclass ``obj`` to a dict (by using the factory function " "``dict_factory``). Each dataclass is converted to a dict of its fields, as " @@ -402,21 +420,21 @@ msgid "" "into. Other objects are copied with :func:`copy.deepcopy`." msgstr "" -#: ../../library/dataclasses.rst:330 +#: ../../library/dataclasses.rst:347 msgid "Example of using :func:`asdict` on nested dataclasses::" msgstr "" -#: ../../library/dataclasses.rst:347 ../../library/dataclasses.rst:367 +#: ../../library/dataclasses.rst:364 ../../library/dataclasses.rst:384 msgid "To create a shallow copy, the following workaround may be used::" msgstr "" -#: ../../library/dataclasses.rst:351 +#: ../../library/dataclasses.rst:368 msgid "" ":func:`asdict` raises :exc:`TypeError` if ``obj`` is not a dataclass " "instance." msgstr "" -#: ../../library/dataclasses.rst:356 +#: ../../library/dataclasses.rst:373 msgid "" "Converts the dataclass ``obj`` to a tuple (by using the factory function " "``tuple_factory``). Each dataclass is converted to a tuple of its field " @@ -424,17 +442,17 @@ msgid "" "objects are copied with :func:`copy.deepcopy`." msgstr "" -#: ../../library/dataclasses.rst:362 +#: ../../library/dataclasses.rst:379 msgid "Continuing from the previous example::" msgstr "" -#: ../../library/dataclasses.rst:371 +#: ../../library/dataclasses.rst:388 msgid "" ":func:`astuple` raises :exc:`TypeError` if ``obj`` is not a dataclass " "instance." msgstr "" -#: ../../library/dataclasses.rst:376 +#: ../../library/dataclasses.rst:393 msgid "" "Creates a new dataclass with name ``cls_name``, fields as defined in " "``fields``, base classes as given in ``bases``, and initialized with a " @@ -442,11 +460,11 @@ msgid "" "elements are each either ``name``, ``(name, type)``, or ``(name, type, " "Field)``. If just ``name`` is supplied, ``typing.Any`` is used for " "``type``. The values of ``init``, ``repr``, ``eq``, ``order``, " -"``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, and ``slots`` " -"have the same meaning as they do in :func:`dataclass`." +"``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, ``slots``, and " +"``weakref_slot`` have the same meaning as they do in :func:`dataclass`." msgstr "" -#: ../../library/dataclasses.rst:386 +#: ../../library/dataclasses.rst:403 msgid "" "This function is not strictly required, because any Python mechanism for " "creating a new class with ``__annotations__`` can then apply the :func:" @@ -454,11 +472,11 @@ msgid "" "provided as a convenience. For example::" msgstr "" -#: ../../library/dataclasses.rst:398 +#: ../../library/dataclasses.rst:415 msgid "Is equivalent to::" msgstr "" -#: ../../library/dataclasses.rst:411 +#: ../../library/dataclasses.rst:428 msgid "" "Creates a new object of the same type as ``obj``, replacing fields with " "values from ``changes``. If ``obj`` is not a Data Class, raises :exc:" @@ -466,27 +484,27 @@ msgid "" "`TypeError`." msgstr "" -#: ../../library/dataclasses.rst:416 +#: ../../library/dataclasses.rst:433 msgid "" "The newly returned object is created by calling the :meth:`__init__` method " "of the dataclass. This ensures that :meth:`__post_init__`, if present, is " "also called." msgstr "" -#: ../../library/dataclasses.rst:420 +#: ../../library/dataclasses.rst:437 msgid "" "Init-only variables without default values, if any exist, must be specified " "on the call to :func:`replace` so that they can be passed to :meth:" "`__init__` and :meth:`__post_init__`." msgstr "" -#: ../../library/dataclasses.rst:424 +#: ../../library/dataclasses.rst:441 msgid "" "It is an error for ``changes`` to contain any fields that are defined as " "having ``init=False``. A :exc:`ValueError` will be raised in this case." msgstr "" -#: ../../library/dataclasses.rst:428 +#: ../../library/dataclasses.rst:445 msgid "" "Be forewarned about how ``init=False`` fields work during a call to :func:" "`replace`. They are not copied from the source object, but rather are " @@ -497,24 +515,24 @@ msgid "" "instance copying." msgstr "" -#: ../../library/dataclasses.rst:439 +#: ../../library/dataclasses.rst:456 msgid "" "Return ``True`` if its parameter is a dataclass or an instance of one, " "otherwise return ``False``." msgstr "" -#: ../../library/dataclasses.rst:442 +#: ../../library/dataclasses.rst:459 msgid "" "If you need to know if a class is an instance of a dataclass (and not a " "dataclass itself), then add a further check for ``not isinstance(obj, " "type)``::" msgstr "" -#: ../../library/dataclasses.rst:451 +#: ../../library/dataclasses.rst:468 msgid "A sentinel value signifying a missing default or default_factory." msgstr "" -#: ../../library/dataclasses.rst:455 +#: ../../library/dataclasses.rst:472 msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " "with the type of :const:`KW_ONLY` are marked as keyword-only fields. Note " @@ -525,30 +543,30 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/dataclasses.rst:464 +#: ../../library/dataclasses.rst:481 msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "" -#: ../../library/dataclasses.rst:475 +#: ../../library/dataclasses.rst:492 msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`KW_ONLY`." msgstr "" -#: ../../library/dataclasses.rst:482 +#: ../../library/dataclasses.rst:499 msgid "" "Raised when an implicitly defined :meth:`__setattr__` or :meth:`__delattr__` " "is called on a dataclass which was defined with ``frozen=True``. It is a " "subclass of :exc:`AttributeError`." msgstr "" -#: ../../library/dataclasses.rst:487 +#: ../../library/dataclasses.rst:504 msgid "Post-init processing" msgstr "" -#: ../../library/dataclasses.rst:489 +#: ../../library/dataclasses.rst:506 msgid "" "The generated :meth:`__init__` code will call a method named :meth:" "`__post_init__`, if :meth:`__post_init__` is defined on the class. It will " @@ -558,13 +576,13 @@ msgid "" "generated, then :meth:`__post_init__` will not automatically be called." msgstr "" -#: ../../library/dataclasses.rst:497 +#: ../../library/dataclasses.rst:514 msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "" -#: ../../library/dataclasses.rst:509 +#: ../../library/dataclasses.rst:526 msgid "" "The :meth:`__init__` method generated by :func:`dataclass` does not call " "base class :meth:`__init__` methods. If the base class has an :meth:" @@ -572,25 +590,25 @@ msgid "" "a :meth:`__post_init__` method::" msgstr "" -#: ../../library/dataclasses.rst:526 +#: ../../library/dataclasses.rst:543 msgid "" "Note, however, that in general the dataclass-generated :meth:`__init__` " "methods don't need to be called, since the derived dataclass will take care " "of initializing all fields of any base class that is a dataclass itself." msgstr "" -#: ../../library/dataclasses.rst:530 +#: ../../library/dataclasses.rst:547 msgid "" "See the section below on init-only variables for ways to pass parameters to :" "meth:`__post_init__`. Also see the warning about how :func:`replace` " "handles ``init=False`` fields." msgstr "" -#: ../../library/dataclasses.rst:535 +#: ../../library/dataclasses.rst:552 msgid "Class variables" msgstr "" -#: ../../library/dataclasses.rst:537 +#: ../../library/dataclasses.rst:554 msgid "" "One of two places where :func:`dataclass` actually inspects the type of a " "field is to determine if a field is a class variable as defined in :pep:" @@ -600,11 +618,11 @@ msgid "" "pseudo-fields are not returned by the module-level :func:`fields` function." msgstr "" -#: ../../library/dataclasses.rst:546 +#: ../../library/dataclasses.rst:563 msgid "Init-only variables" msgstr "" -#: ../../library/dataclasses.rst:548 +#: ../../library/dataclasses.rst:565 msgid "" "The other place where :func:`dataclass` inspects a type annotation is to " "determine if a field is an init-only variable. It does this by seeing if " @@ -616,23 +634,23 @@ msgid "" "`__post_init__` method. They are not otherwise used by dataclasses." msgstr "" -#: ../../library/dataclasses.rst:558 +#: ../../library/dataclasses.rst:575 msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" msgstr "" -#: ../../library/dataclasses.rst:573 +#: ../../library/dataclasses.rst:590 msgid "" "In this case, :func:`fields` will return :class:`Field` objects for ``i`` " "and ``j``, but not for ``database``." msgstr "" -#: ../../library/dataclasses.rst:577 +#: ../../library/dataclasses.rst:594 msgid "Frozen instances" msgstr "" -#: ../../library/dataclasses.rst:579 +#: ../../library/dataclasses.rst:596 msgid "" "It is not possible to create truly immutable Python objects. However, by " "passing ``frozen=True`` to the :meth:`dataclass` decorator you can emulate " @@ -641,18 +659,18 @@ msgid "" "`FrozenInstanceError` when invoked." msgstr "" -#: ../../library/dataclasses.rst:585 +#: ../../library/dataclasses.rst:602 msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" "`__init__` cannot use simple assignment to initialize fields, and must use :" "meth:`object.__setattr__`." msgstr "" -#: ../../library/dataclasses.rst:590 +#: ../../library/dataclasses.rst:607 msgid "Inheritance" msgstr "" -#: ../../library/dataclasses.rst:592 +#: ../../library/dataclasses.rst:609 msgid "" "When the dataclass is being created by the :meth:`dataclass` decorator, it " "looks through all of the class's base classes in reverse MRO (that is, " @@ -664,21 +682,21 @@ msgid "" "derived classes override base classes. An example::" msgstr "" -#: ../../library/dataclasses.rst:612 +#: ../../library/dataclasses.rst:629 msgid "" "The final list of fields is, in order, ``x``, ``y``, ``z``. The final type " "of ``x`` is ``int``, as specified in class ``C``." msgstr "" -#: ../../library/dataclasses.rst:615 +#: ../../library/dataclasses.rst:632 msgid "The generated :meth:`__init__` method for ``C`` will look like::" msgstr "" -#: ../../library/dataclasses.rst:620 +#: ../../library/dataclasses.rst:637 msgid "Re-ordering of keyword-only parameters in :meth:`__init__`" msgstr "" -#: ../../library/dataclasses.rst:622 +#: ../../library/dataclasses.rst:639 msgid "" "After the parameters needed for :meth:`__init__` are computed, any keyword-" "only parameters are moved to come after all regular (non-keyword-only) " @@ -686,41 +704,41 @@ msgid "" "implemented in Python: they must come after non-keyword-only parameters." msgstr "" -#: ../../library/dataclasses.rst:628 +#: ../../library/dataclasses.rst:645 msgid "" "In this example, ``Base.y``, ``Base.w``, and ``D.t`` are keyword-only " "fields, and ``Base.x`` and ``D.z`` are regular fields::" msgstr "" -#: ../../library/dataclasses.rst:643 +#: ../../library/dataclasses.rst:660 msgid "The generated :meth:`__init__` method for ``D`` will look like::" msgstr "" -#: ../../library/dataclasses.rst:647 +#: ../../library/dataclasses.rst:664 msgid "" "Note that the parameters have been re-ordered from how they appear in the " "list of fields: parameters derived from regular fields are followed by " "parameters derived from keyword-only fields." msgstr "" -#: ../../library/dataclasses.rst:651 +#: ../../library/dataclasses.rst:668 msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`__init__` parameter list." msgstr "" -#: ../../library/dataclasses.rst:656 +#: ../../library/dataclasses.rst:673 msgid "Default factory functions" msgstr "" -#: ../../library/dataclasses.rst:658 +#: ../../library/dataclasses.rst:675 msgid "" "If a :func:`field` specifies a ``default_factory``, it is called with zero " "arguments when a default value for the field is needed. For example, to " "create a new instance of a list, use::" msgstr "" -#: ../../library/dataclasses.rst:664 +#: ../../library/dataclasses.rst:681 msgid "" "If a field is excluded from :meth:`__init__` (using ``init=False``) and the " "field also specifies ``default_factory``, then the default factory function " @@ -728,31 +746,31 @@ msgid "" "happens because there is no other way to give the field an initial value." msgstr "" -#: ../../library/dataclasses.rst:671 +#: ../../library/dataclasses.rst:688 msgid "Mutable default values" msgstr "" -#: ../../library/dataclasses.rst:673 +#: ../../library/dataclasses.rst:690 msgid "" "Python stores default member variable values in class attributes. Consider " "this example, not using dataclasses::" msgstr "" -#: ../../library/dataclasses.rst:688 +#: ../../library/dataclasses.rst:705 msgid "" "Note that the two instances of class ``C`` share the same class variable " "``x``, as expected." msgstr "" -#: ../../library/dataclasses.rst:691 +#: ../../library/dataclasses.rst:708 msgid "Using dataclasses, *if* this code was valid::" msgstr "" -#: ../../library/dataclasses.rst:699 +#: ../../library/dataclasses.rst:716 msgid "it would generate code similar to::" msgstr "" -#: ../../library/dataclasses.rst:710 +#: ../../library/dataclasses.rst:727 msgid "" "This has the same issue as the original example using class ``C``. That is, " "two instances of class ``D`` that do not specify a value for ``x`` when " @@ -760,42 +778,49 @@ msgid "" "dataclasses just use normal Python class creation they also share this " "behavior. There is no general way for Data Classes to detect this " "condition. Instead, the :func:`dataclass` decorator will raise a :exc:" -"`TypeError` if it detects a default parameter of type ``list``, ``dict``, or " -"``set``. This is a partial solution, but it does protect against many common " -"errors." +"`TypeError` if it detects an unhashable default parameter. The assumption " +"is that if a value is unhashable, it is mutable. This is a partial " +"solution, but it does protect against many common errors." msgstr "" -#: ../../library/dataclasses.rst:721 +#: ../../library/dataclasses.rst:738 msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "" -#: ../../library/dataclasses.rst:731 +#: ../../library/dataclasses.rst:747 +msgid "" +"Instead of looking for and disallowing objects of type ``list``, ``dict``, " +"or ``set``, unhashable objects are now not allowed as default values. " +"Unhashability is used to approximate mutability." +msgstr "" + +#: ../../library/dataclasses.rst:754 msgid "Descriptor-typed fields" msgstr "" -#: ../../library/dataclasses.rst:733 +#: ../../library/dataclasses.rst:756 msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " "default value have the following special behaviors:" msgstr "" -#: ../../library/dataclasses.rst:736 +#: ../../library/dataclasses.rst:759 msgid "" "The value for the field passed to the dataclass's ``__init__`` method is " "passed to the descriptor's ``__set__`` method rather than overwriting the " "descriptor object." msgstr "" -#: ../../library/dataclasses.rst:739 +#: ../../library/dataclasses.rst:762 msgid "" "Similarly, when getting or setting the field, the descriptor's ``__get__`` " "or ``__set__`` method is called rather than returning or overwriting the " "descriptor object." msgstr "" -#: ../../library/dataclasses.rst:742 +#: ../../library/dataclasses.rst:765 msgid "" "To determine whether a field contains a default value, ``dataclasses`` will " "call the descriptor's ``__get__`` method using its class access form (i.e. " @@ -805,7 +830,7 @@ msgid "" "default value will be provided for the field." msgstr "" -#: ../../library/dataclasses.rst:777 +#: ../../library/dataclasses.rst:800 msgid "" "Note that if a field is annotated with a descriptor type, but is not " "assigned a descriptor object as its default value, the field will act like a " diff --git a/library/datetime.po b/library/datetime.po index 9bda6e2dbc..ff7ce0f1f3 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-30 00:15+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -140,18 +140,22 @@ msgid "" "object. :const:`MAXYEAR` is ``9999``." msgstr "" -#: ../../library/datetime.rst:88 +#: ../../library/datetime.rst:89 +msgid "Alias for the UTC timezone singleton :attr:`datetime.timezone.utc`." +msgstr "" + +#: ../../library/datetime.rst:94 msgid "Available Types" msgstr "" -#: ../../library/datetime.rst:93 +#: ../../library/datetime.rst:99 msgid "" "An idealized naive date, assuming the current Gregorian calendar always was, " "and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, and :" "attr:`day`." msgstr "" -#: ../../library/datetime.rst:101 +#: ../../library/datetime.rst:107 msgid "" "An idealized time, independent of any particular day, assuming that every " "day has exactly 24\\*60\\*60 seconds. (There is no notion of \"leap seconds" @@ -159,20 +163,20 @@ msgid "" "`microsecond`, and :attr:`.tzinfo`." msgstr "" -#: ../../library/datetime.rst:110 +#: ../../library/datetime.rst:116 msgid "" "A combination of a date and a time. Attributes: :attr:`year`, :attr:" "`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:" "`microsecond`, and :attr:`.tzinfo`." msgstr "" -#: ../../library/datetime.rst:118 +#: ../../library/datetime.rst:124 msgid "" "A duration expressing the difference between two :class:`date`, :class:`." "time`, or :class:`.datetime` instances to microsecond resolution." msgstr "" -#: ../../library/datetime.rst:125 +#: ../../library/datetime.rst:131 msgid "" "An abstract base class for time zone information objects. These are used by " "the :class:`.datetime` and :class:`.time` classes to provide a customizable " @@ -180,157 +184,157 @@ msgid "" "daylight saving time)." msgstr "" -#: ../../library/datetime.rst:133 +#: ../../library/datetime.rst:139 msgid "" "A class that implements the :class:`tzinfo` abstract base class as a fixed " "offset from the UTC." msgstr "" -#: ../../library/datetime.rst:138 ../../library/datetime.rst:156 +#: ../../library/datetime.rst:144 ../../library/datetime.rst:162 msgid "Objects of these types are immutable." msgstr "" -#: ../../library/datetime.rst:140 +#: ../../library/datetime.rst:146 msgid "Subclass relationships::" msgstr "" -#: ../../library/datetime.rst:151 +#: ../../library/datetime.rst:157 msgid "Common Properties" msgstr "" -#: ../../library/datetime.rst:153 +#: ../../library/datetime.rst:159 msgid "" "The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone` " "types share these common features:" msgstr "" -#: ../../library/datetime.rst:157 +#: ../../library/datetime.rst:163 msgid "" "Objects of these types are hashable, meaning that they can be used as " "dictionary keys." msgstr "" -#: ../../library/datetime.rst:159 +#: ../../library/datetime.rst:165 msgid "" "Objects of these types support efficient pickling via the :mod:`pickle` " "module." msgstr "" -#: ../../library/datetime.rst:162 +#: ../../library/datetime.rst:168 msgid "Determining if an Object is Aware or Naive" msgstr "" -#: ../../library/datetime.rst:164 +#: ../../library/datetime.rst:170 msgid "Objects of the :class:`date` type are always naive." msgstr "" -#: ../../library/datetime.rst:166 +#: ../../library/datetime.rst:172 msgid "" "An object of type :class:`.time` or :class:`.datetime` may be aware or naive." msgstr "" -#: ../../library/datetime.rst:168 +#: ../../library/datetime.rst:174 msgid "A :class:`.datetime` object *d* is aware if both of the following hold:" msgstr "" -#: ../../library/datetime.rst:170 +#: ../../library/datetime.rst:176 msgid "``d.tzinfo`` is not ``None``" msgstr "``d.tzinfo`` 不是 ``None``" -#: ../../library/datetime.rst:171 +#: ../../library/datetime.rst:177 msgid "``d.tzinfo.utcoffset(d)`` does not return ``None``" msgstr "``d.tzinfo.utcoffset(d)`` 不會回傳 ``None``" -#: ../../library/datetime.rst:173 +#: ../../library/datetime.rst:179 msgid "Otherwise, *d* is naive." msgstr "" -#: ../../library/datetime.rst:175 +#: ../../library/datetime.rst:181 msgid "A :class:`.time` object *t* is aware if both of the following hold:" msgstr "" -#: ../../library/datetime.rst:177 +#: ../../library/datetime.rst:183 msgid "``t.tzinfo`` is not ``None``" msgstr "``t.tzinfo`` 不是 ``None``" -#: ../../library/datetime.rst:178 +#: ../../library/datetime.rst:184 msgid "``t.tzinfo.utcoffset(None)`` does not return ``None``." msgstr "``t.tzinfo.utcoffset(None)`` 沒有回傳 ``None``\\ 。" -#: ../../library/datetime.rst:180 +#: ../../library/datetime.rst:186 msgid "Otherwise, *t* is naive." msgstr "" -#: ../../library/datetime.rst:182 +#: ../../library/datetime.rst:188 msgid "" "The distinction between aware and naive doesn't apply to :class:`timedelta` " "objects." msgstr "" -#: ../../library/datetime.rst:188 +#: ../../library/datetime.rst:194 msgid ":class:`timedelta` Objects" msgstr ":class:`timedelta` 物件" -#: ../../library/datetime.rst:190 +#: ../../library/datetime.rst:196 msgid "" "A :class:`timedelta` object represents a duration, the difference between " "two dates or times." msgstr "" -#: ../../library/datetime.rst:195 +#: ../../library/datetime.rst:201 msgid "" "All arguments are optional and default to ``0``. Arguments may be integers " "or floats, and may be positive or negative." msgstr "" -#: ../../library/datetime.rst:198 +#: ../../library/datetime.rst:204 msgid "" "Only *days*, *seconds* and *microseconds* are stored internally. Arguments " "are converted to those units:" msgstr "" -#: ../../library/datetime.rst:201 +#: ../../library/datetime.rst:207 msgid "A millisecond is converted to 1000 microseconds." msgstr "" -#: ../../library/datetime.rst:202 +#: ../../library/datetime.rst:208 msgid "A minute is converted to 60 seconds." msgstr "" -#: ../../library/datetime.rst:203 +#: ../../library/datetime.rst:209 msgid "An hour is converted to 3600 seconds." msgstr "" -#: ../../library/datetime.rst:204 +#: ../../library/datetime.rst:210 msgid "A week is converted to 7 days." msgstr "" -#: ../../library/datetime.rst:206 +#: ../../library/datetime.rst:212 msgid "" "and days, seconds and microseconds are then normalized so that the " "representation is unique, with" msgstr "" -#: ../../library/datetime.rst:209 +#: ../../library/datetime.rst:215 msgid "``0 <= microseconds < 1000000``" msgstr "``0 <= microseconds < 1000000``" -#: ../../library/datetime.rst:210 +#: ../../library/datetime.rst:216 msgid "``0 <= seconds < 3600*24`` (the number of seconds in one day)" msgstr "" -#: ../../library/datetime.rst:211 +#: ../../library/datetime.rst:217 msgid "``-999999999 <= days <= 999999999``" msgstr "``-999999999 <= days <= 999999999``" -#: ../../library/datetime.rst:213 +#: ../../library/datetime.rst:219 msgid "" "The following example illustrates how any arguments besides *days*, " "*seconds* and *microseconds* are \"merged\" and normalized into those three " "resulting attributes::" msgstr "" -#: ../../library/datetime.rst:231 +#: ../../library/datetime.rst:237 msgid "" "If any argument is a float and there are fractional microseconds, the " "fractional microseconds left over from all arguments are combined and their " @@ -339,281 +343,281 @@ msgid "" "processes are exact (no information is lost)." msgstr "" -#: ../../library/datetime.rst:238 +#: ../../library/datetime.rst:244 msgid "" "If the normalized value of days lies outside the indicated range, :exc:" "`OverflowError` is raised." msgstr "" -#: ../../library/datetime.rst:241 +#: ../../library/datetime.rst:247 msgid "" "Note that normalization of negative values may be surprising at first. For " "example::" msgstr "" -#: ../../library/datetime.rst:250 ../../library/datetime.rst:544 -#: ../../library/datetime.rst:1051 ../../library/datetime.rst:1669 -#: ../../library/datetime.rst:2262 +#: ../../library/datetime.rst:256 ../../library/datetime.rst:552 +#: ../../library/datetime.rst:1059 ../../library/datetime.rst:1677 +#: ../../library/datetime.rst:2281 msgid "Class attributes:" msgstr "" -#: ../../library/datetime.rst:254 +#: ../../library/datetime.rst:260 msgid "The most negative :class:`timedelta` object, ``timedelta(-999999999)``." msgstr "" -#: ../../library/datetime.rst:259 +#: ../../library/datetime.rst:265 msgid "" "The most positive :class:`timedelta` object, ``timedelta(days=999999999, " "hours=23, minutes=59, seconds=59, microseconds=999999)``." msgstr "" -#: ../../library/datetime.rst:265 +#: ../../library/datetime.rst:271 msgid "" "The smallest possible difference between non-equal :class:`timedelta` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:268 +#: ../../library/datetime.rst:274 msgid "" "Note that, because of normalization, ``timedelta.max`` > ``-timedelta.min``. " "``-timedelta.max`` is not representable as a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:271 ../../library/datetime.rst:562 -#: ../../library/datetime.rst:1071 ../../library/datetime.rst:1689 +#: ../../library/datetime.rst:277 ../../library/datetime.rst:570 +#: ../../library/datetime.rst:1079 ../../library/datetime.rst:1697 msgid "Instance attributes (read-only):" msgstr "" -#: ../../library/datetime.rst:274 +#: ../../library/datetime.rst:280 msgid "Attribute" msgstr "屬性" -#: ../../library/datetime.rst:274 +#: ../../library/datetime.rst:280 msgid "Value" msgstr "" -#: ../../library/datetime.rst:276 +#: ../../library/datetime.rst:282 msgid "``days``" msgstr "``days``" -#: ../../library/datetime.rst:276 +#: ../../library/datetime.rst:282 msgid "Between -999999999 and 999999999 inclusive" msgstr "" -#: ../../library/datetime.rst:278 +#: ../../library/datetime.rst:284 msgid "``seconds``" msgstr "``seconds``" -#: ../../library/datetime.rst:278 +#: ../../library/datetime.rst:284 msgid "Between 0 and 86399 inclusive" msgstr "" -#: ../../library/datetime.rst:280 +#: ../../library/datetime.rst:286 msgid "``microseconds``" msgstr "``microseconds``" -#: ../../library/datetime.rst:280 +#: ../../library/datetime.rst:286 msgid "Between 0 and 999999 inclusive" msgstr "" -#: ../../library/datetime.rst:283 ../../library/datetime.rst:579 -#: ../../library/datetime.rst:1124 +#: ../../library/datetime.rst:289 ../../library/datetime.rst:587 +#: ../../library/datetime.rst:1132 msgid "Supported operations:" msgstr "" -#: ../../library/datetime.rst:288 ../../library/datetime.rst:582 -#: ../../library/datetime.rst:1127 +#: ../../library/datetime.rst:294 ../../library/datetime.rst:590 +#: ../../library/datetime.rst:1135 msgid "Operation" msgstr "" -#: ../../library/datetime.rst:288 ../../library/datetime.rst:582 -#: ../../library/datetime.rst:1127 +#: ../../library/datetime.rst:294 ../../library/datetime.rst:590 +#: ../../library/datetime.rst:1135 msgid "Result" msgstr "" -#: ../../library/datetime.rst:290 +#: ../../library/datetime.rst:296 msgid "``t1 = t2 + t3``" msgstr "``t1 = t2 + t3``" -#: ../../library/datetime.rst:290 +#: ../../library/datetime.rst:296 msgid "" "Sum of *t2* and *t3*. Afterwards *t1*-*t2* == *t3* and *t1*-*t3* == *t2* are " "true. (1)" msgstr "" -#: ../../library/datetime.rst:293 +#: ../../library/datetime.rst:299 msgid "``t1 = t2 - t3``" msgstr "``t1 = t2 - t3``" -#: ../../library/datetime.rst:293 +#: ../../library/datetime.rst:299 msgid "" "Difference of *t2* and *t3*. Afterwards *t1* == *t2* - *t3* and *t2* == *t1* " "+ *t3* are true. (1)(6)" msgstr "" -#: ../../library/datetime.rst:297 +#: ../../library/datetime.rst:303 msgid "``t1 = t2 * i or t1 = i * t2``" msgstr "``t1 = t2 * i or t1 = i * t2``" -#: ../../library/datetime.rst:297 +#: ../../library/datetime.rst:303 msgid "" "Delta multiplied by an integer. Afterwards *t1* // i == *t2* is true, " "provided ``i != 0``." msgstr "" -#: ../../library/datetime.rst:301 +#: ../../library/datetime.rst:307 msgid "In general, *t1* \\* i == *t1* \\* (i-1) + *t1* is true. (1)" msgstr "" -#: ../../library/datetime.rst:304 +#: ../../library/datetime.rst:310 msgid "``t1 = t2 * f or t1 = f * t2``" msgstr "``t1 = t2 * f or t1 = f * t2``" -#: ../../library/datetime.rst:304 +#: ../../library/datetime.rst:310 msgid "" "Delta multiplied by a float. The result is rounded to the nearest multiple " "of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:308 +#: ../../library/datetime.rst:314 msgid "``f = t2 / t3``" msgstr "``f = t2 / t3``" -#: ../../library/datetime.rst:308 +#: ../../library/datetime.rst:314 msgid "" "Division (3) of overall duration *t2* by interval unit *t3*. Returns a :" "class:`float` object." msgstr "" -#: ../../library/datetime.rst:312 +#: ../../library/datetime.rst:318 msgid "``t1 = t2 / f or t1 = t2 / i``" msgstr "``t1 = t2 / f or t1 = t2 / i``" -#: ../../library/datetime.rst:312 +#: ../../library/datetime.rst:318 msgid "" "Delta divided by a float or an int. The result is rounded to the nearest " "multiple of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:316 +#: ../../library/datetime.rst:322 msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``" msgstr "``t1 = t2 // i`` or ``t1 = t2 // t3``" -#: ../../library/datetime.rst:316 +#: ../../library/datetime.rst:322 msgid "" "The floor is computed and the remainder (if any) is thrown away. In the " "second case, an integer is returned. (3)" msgstr "" -#: ../../library/datetime.rst:320 +#: ../../library/datetime.rst:326 msgid "``t1 = t2 % t3``" msgstr "``t1 = t2 % t3``" -#: ../../library/datetime.rst:320 +#: ../../library/datetime.rst:326 msgid "The remainder is computed as a :class:`timedelta` object. (3)" msgstr "" -#: ../../library/datetime.rst:323 +#: ../../library/datetime.rst:329 msgid "``q, r = divmod(t1, t2)``" msgstr "``q, r = divmod(t1, t2)``" -#: ../../library/datetime.rst:323 +#: ../../library/datetime.rst:329 msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " "t2``. q is an integer and r is a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:328 +#: ../../library/datetime.rst:334 msgid "``+t1``" msgstr "``+t1``" -#: ../../library/datetime.rst:328 +#: ../../library/datetime.rst:334 msgid "Returns a :class:`timedelta` object with the same value. (2)" msgstr "" -#: ../../library/datetime.rst:331 +#: ../../library/datetime.rst:337 msgid "``-t1``" msgstr "``-t1``" -#: ../../library/datetime.rst:331 +#: ../../library/datetime.rst:337 msgid "" "equivalent to :class:`timedelta`\\ (-*t1.days*, -*t1.seconds*, -*t1." "microseconds*), and to *t1*\\* -1. (1)(4)" msgstr "" -#: ../../library/datetime.rst:336 +#: ../../library/datetime.rst:342 msgid "``abs(t)``" msgstr "``abs(t)``" -#: ../../library/datetime.rst:336 +#: ../../library/datetime.rst:342 msgid "" "equivalent to +\\ *t* when ``t.days >= 0``, and to -*t* when ``t.days < 0``. " "(2)" msgstr "" -#: ../../library/datetime.rst:339 +#: ../../library/datetime.rst:345 msgid "``str(t)``" msgstr "``str(t)``" -#: ../../library/datetime.rst:339 +#: ../../library/datetime.rst:345 msgid "" "Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is " "negative for negative ``t``. (5)" msgstr "" -#: ../../library/datetime.rst:343 +#: ../../library/datetime.rst:349 msgid "``repr(t)``" msgstr "``repr(t)``" -#: ../../library/datetime.rst:343 +#: ../../library/datetime.rst:349 msgid "" "Returns a string representation of the :class:`timedelta` object as a " "constructor call with canonical attribute values." msgstr "" -#: ../../library/datetime.rst:349 ../../library/datetime.rst:596 -#: ../../library/datetime.rst:2475 +#: ../../library/datetime.rst:355 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:2494 msgid "Notes:" msgstr "註解:" -#: ../../library/datetime.rst:352 +#: ../../library/datetime.rst:358 msgid "This is exact but may overflow." msgstr "" -#: ../../library/datetime.rst:355 +#: ../../library/datetime.rst:361 msgid "This is exact and cannot overflow." msgstr "" -#: ../../library/datetime.rst:358 +#: ../../library/datetime.rst:364 msgid "Division by 0 raises :exc:`ZeroDivisionError`." msgstr "" -#: ../../library/datetime.rst:361 +#: ../../library/datetime.rst:367 msgid "-*timedelta.max* is not representable as a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:370 msgid "" "String representations of :class:`timedelta` objects are normalized " "similarly to their internal representation. This leads to somewhat unusual " "results for negative timedeltas. For example::" msgstr "" -#: ../../library/datetime.rst:374 +#: ../../library/datetime.rst:380 msgid "" "The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-" "t3)`` except when t3 is equal to ``timedelta.max``; in that case the former " "will produce a result while the latter will overflow." msgstr "" -#: ../../library/datetime.rst:378 +#: ../../library/datetime.rst:384 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " "support certain additions and subtractions with :class:`date` and :class:`." "datetime` objects (see below)." msgstr "" -#: ../../library/datetime.rst:382 +#: ../../library/datetime.rst:388 msgid "" "Floor division and true division of a :class:`timedelta` object by another :" "class:`timedelta` object are now supported, as are remainder operations and " @@ -621,119 +625,119 @@ msgid "" "`timedelta` object by a :class:`float` object are now supported." msgstr "" -#: ../../library/datetime.rst:389 +#: ../../library/datetime.rst:395 msgid "" "Comparisons of :class:`timedelta` objects are supported, with some caveats." msgstr "" -#: ../../library/datetime.rst:391 +#: ../../library/datetime.rst:397 msgid "" "The comparisons ``==`` or ``!=`` *always* return a :class:`bool`, no matter " "the type of the compared object::" msgstr "" -#: ../../library/datetime.rst:402 +#: ../../library/datetime.rst:408 msgid "" "For all other comparisons (such as ``<`` and ``>``), when a :class:" "`timedelta` object is compared to an object of a different type, :exc:" "`TypeError` is raised::" msgstr "" -#: ../../library/datetime.rst:413 +#: ../../library/datetime.rst:419 msgid "" "In Boolean contexts, a :class:`timedelta` object is considered to be true if " "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: ../../library/datetime.rst:416 ../../library/datetime.rst:625 -#: ../../library/datetime.rst:1198 ../../library/datetime.rst:1786 +#: ../../library/datetime.rst:422 ../../library/datetime.rst:633 +#: ../../library/datetime.rst:1206 ../../library/datetime.rst:1805 msgid "Instance methods:" msgstr "" -#: ../../library/datetime.rst:420 +#: ../../library/datetime.rst:426 msgid "" "Return the total number of seconds contained in the duration. Equivalent to " "``td / timedelta(seconds=1)``. For interval units other than seconds, use " "the division form directly (e.g. ``td / timedelta(microseconds=1)``)." msgstr "" -#: ../../library/datetime.rst:424 +#: ../../library/datetime.rst:430 msgid "" "Note that for very large time intervals (greater than 270 years on most " "platforms) this method will lose microsecond accuracy." msgstr "" -#: ../../library/datetime.rst:430 +#: ../../library/datetime.rst:436 msgid "Examples of usage: :class:`timedelta`" msgstr "用法範例:\\ :class:`timedelta`" -#: ../../library/datetime.rst:432 +#: ../../library/datetime.rst:438 msgid "An additional example of normalization::" msgstr "" -#: ../../library/datetime.rst:444 +#: ../../library/datetime.rst:450 msgid "Examples of :class:`timedelta` arithmetic::" msgstr "" -#: ../../library/datetime.rst:463 +#: ../../library/datetime.rst:469 msgid ":class:`date` Objects" msgstr ":class:`date` 物件" -#: ../../library/datetime.rst:465 +#: ../../library/datetime.rst:471 msgid "" "A :class:`date` object represents a date (year, month and day) in an " "idealized calendar, the current Gregorian calendar indefinitely extended in " "both directions." msgstr "" -#: ../../library/datetime.rst:469 +#: ../../library/datetime.rst:475 msgid "" "January 1 of year 1 is called day number 1, January 2 of year 1 is called " "day number 2, and so on. [#]_" msgstr "" -#: ../../library/datetime.rst:474 +#: ../../library/datetime.rst:480 msgid "" "All arguments are required. Arguments must be integers, in the following " "ranges:" msgstr "" -#: ../../library/datetime.rst:477 +#: ../../library/datetime.rst:483 msgid "``MINYEAR <= year <= MAXYEAR``" msgstr "``MINYEAR <= year <= MAXYEAR``" -#: ../../library/datetime.rst:478 +#: ../../library/datetime.rst:484 msgid "``1 <= month <= 12``" msgstr "``1 <= month <= 12``" -#: ../../library/datetime.rst:479 +#: ../../library/datetime.rst:485 msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: ../../library/datetime.rst:481 ../../library/datetime.rst:843 +#: ../../library/datetime.rst:487 ../../library/datetime.rst:849 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:484 ../../library/datetime.rst:848 +#: ../../library/datetime.rst:490 ../../library/datetime.rst:854 msgid "Other constructors, all class methods:" msgstr "" -#: ../../library/datetime.rst:488 +#: ../../library/datetime.rst:494 msgid "Return the current local date." msgstr "" -#: ../../library/datetime.rst:490 +#: ../../library/datetime.rst:496 msgid "This is equivalent to ``date.fromtimestamp(time.time())``." msgstr "" -#: ../../library/datetime.rst:494 +#: ../../library/datetime.rst:500 msgid "" "Return the local date corresponding to the POSIX timestamp, such as is " "returned by :func:`time.time`." msgstr "" -#: ../../library/datetime.rst:497 +#: ../../library/datetime.rst:503 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`localtime` function, and :exc:" @@ -743,7 +747,7 @@ msgid "" "ignored by :meth:`fromtimestamp`." msgstr "" -#: ../../library/datetime.rst:504 +#: ../../library/datetime.rst:510 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -751,98 +755,96 @@ msgid "" "`localtime` failure." msgstr "" -#: ../../library/datetime.rst:513 +#: ../../library/datetime.rst:519 msgid "" "Return the date corresponding to the proleptic Gregorian ordinal, where " "January 1 of year 1 has ordinal 1." msgstr "" -#: ../../library/datetime.rst:516 +#: ../../library/datetime.rst:522 msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " "For any date *d*, ``date.fromordinal(d.toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:523 +#: ../../library/datetime.rst:529 msgid "" -"Return a :class:`date` corresponding to a *date_string* given in the format " -"``YYYY-MM-DD``::" +"Return a :class:`date` corresponding to a *date_string* given in any valid " +"ISO 8601 format, except ordinal dates (e.g. ``YYYY-DDD``)::" msgstr "" -#: ../../library/datetime.rst:530 -msgid "" -"This is the inverse of :meth:`date.isoformat`. It only supports the format " -"``YYYY-MM-DD``." +#: ../../library/datetime.rst:541 +msgid "Previously, this method only supported the format ``YYYY-MM-DD``." msgstr "" -#: ../../library/datetime.rst:538 +#: ../../library/datetime.rst:546 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " "year, week and day. This is the inverse of the function :meth:`date." "isocalendar`." msgstr "" -#: ../../library/datetime.rst:548 +#: ../../library/datetime.rst:556 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" -#: ../../library/datetime.rst:553 +#: ../../library/datetime.rst:561 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -#: ../../library/datetime.rst:558 +#: ../../library/datetime.rst:566 msgid "" "The smallest possible difference between non-equal date objects, " "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:566 ../../library/datetime.rst:1075 +#: ../../library/datetime.rst:574 ../../library/datetime.rst:1083 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:571 ../../library/datetime.rst:1080 +#: ../../library/datetime.rst:579 ../../library/datetime.rst:1088 msgid "Between 1 and 12 inclusive." msgstr "" -#: ../../library/datetime.rst:576 ../../library/datetime.rst:1085 +#: ../../library/datetime.rst:584 ../../library/datetime.rst:1093 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" -#: ../../library/datetime.rst:584 +#: ../../library/datetime.rst:592 msgid "``date2 = date1 + timedelta``" msgstr "``date2 = date1 + timedelta``" -#: ../../library/datetime.rst:584 +#: ../../library/datetime.rst:592 msgid "*date2* will be ``timedelta.days`` days after *date1*. (1)" msgstr "" -#: ../../library/datetime.rst:587 +#: ../../library/datetime.rst:595 msgid "``date2 = date1 - timedelta``" msgstr "``date2 = date1 - timedelta``" -#: ../../library/datetime.rst:587 +#: ../../library/datetime.rst:595 msgid "Computes *date2* such that ``date2 + timedelta == date1``. (2)" msgstr "" -#: ../../library/datetime.rst:590 +#: ../../library/datetime.rst:598 msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:590 ../../library/datetime.rst:1133 +#: ../../library/datetime.rst:598 ../../library/datetime.rst:1141 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:600 msgid "``date1 < date2``" msgstr "``date1 < date2``" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:600 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. (4)" msgstr "" -#: ../../library/datetime.rst:599 +#: ../../library/datetime.rst:607 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " @@ -851,17 +853,17 @@ msgid "" "`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" -#: ../../library/datetime.rst:606 +#: ../../library/datetime.rst:614 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "" -#: ../../library/datetime.rst:609 +#: ../../library/datetime.rst:617 msgid "" "This is exact, and cannot overflow. timedelta.seconds and timedelta." "microseconds are 0, and date2 + timedelta == date1 after." msgstr "" -#: ../../library/datetime.rst:613 +#: ../../library/datetime.rst:621 msgid "" "In other words, ``date1 < date2`` if and only if ``date1.toordinal() < date2." "toordinal()``. Date comparison raises :exc:`TypeError` if the other " @@ -874,80 +876,80 @@ msgid "" "`True`, respectively." msgstr "" -#: ../../library/datetime.rst:623 +#: ../../library/datetime.rst:631 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: ../../library/datetime.rst:629 +#: ../../library/datetime.rst:637 msgid "" "Return a date with the same value, except for those parameters given new " "values by whichever keyword arguments are specified." msgstr "" -#: ../../library/datetime.rst:632 ../../library/datetime.rst:1829 +#: ../../library/datetime.rst:640 ../../library/datetime.rst:1848 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/datetime.rst:642 ../../library/datetime.rst:1311 +#: ../../library/datetime.rst:650 ../../library/datetime.rst:1319 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." msgstr "" -#: ../../library/datetime.rst:644 +#: ../../library/datetime.rst:652 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:646 ../../library/datetime.rst:1313 +#: ../../library/datetime.rst:654 ../../library/datetime.rst:1321 msgid "``d.timetuple()`` is equivalent to::" msgstr "" "``d.timetuple()`` 等價於:\n" "\n" "::" -#: ../../library/datetime.rst:650 +#: ../../library/datetime.rst:658 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with ``1`` for January 1st." msgstr "" -#: ../../library/datetime.rst:656 +#: ../../library/datetime.rst:664 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " "1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:663 +#: ../../library/datetime.rst:671 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" "meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:670 +#: ../../library/datetime.rst:678 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" "meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:677 +#: ../../library/datetime.rst:685 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: ../../library/datetime.rst:680 +#: ../../library/datetime.rst:688 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: ../../library/datetime.rst:682 +#: ../../library/datetime.rst:690 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -956,45 +958,41 @@ msgid "" "Gregorian year." msgstr "" -#: ../../library/datetime.rst:687 +#: ../../library/datetime.rst:695 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: ../../library/datetime.rst:696 +#: ../../library/datetime.rst:704 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: ../../library/datetime.rst:701 +#: ../../library/datetime.rst:709 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "" -#: ../../library/datetime.rst:707 -msgid "This is the inverse of :meth:`date.fromisoformat`." -msgstr "" - -#: ../../library/datetime.rst:711 +#: ../../library/datetime.rst:717 msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" -#: ../../library/datetime.rst:716 +#: ../../library/datetime.rst:722 msgid "Return a string representing the date::" msgstr "" -#: ../../library/datetime.rst:722 ../../library/datetime.rst:1497 +#: ../../library/datetime.rst:728 ../../library/datetime.rst:1505 msgid "``d.ctime()`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:726 +#: ../../library/datetime.rst:732 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " "the C standard." msgstr "" -#: ../../library/datetime.rst:733 +#: ../../library/datetime.rst:739 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " @@ -1002,7 +1000,7 @@ msgid "" "strptime-behavior`." msgstr "" -#: ../../library/datetime.rst:741 +#: ../../library/datetime.rst:747 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals `__." +#: ../../library/datetime.rst:1002 +msgid "Ordinal dates are not currently supported." +msgstr "" + +#: ../../library/datetime.rst:1003 ../../library/datetime.rst:1776 +msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1009 ../../library/datetime.rst:1426 -#: ../../library/datetime.rst:1773 +#: ../../library/datetime.rst:1005 ../../library/datetime.rst:1434 +#: ../../library/datetime.rst:1778 msgid "Examples::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/datetime.rst:1028 +#: ../../library/datetime.rst:1029 +msgid "" +"Previously, this method only supported formats that could be emitted by :" +"meth:`date.isoformat()` or :meth:`datetime.isoformat()`." +msgstr "" + +#: ../../library/datetime.rst:1036 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1304,20 +1307,20 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1037 +#: ../../library/datetime.rst:1045 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1040 +#: ../../library/datetime.rst:1048 msgid "This is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/datetime.rst:1044 +#: ../../library/datetime.rst:1052 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1325,44 +1328,44 @@ msgid "" "behavior`." msgstr "" -#: ../../library/datetime.rst:1055 +#: ../../library/datetime.rst:1063 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1061 +#: ../../library/datetime.rst:1069 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1067 +#: ../../library/datetime.rst:1075 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1090 ../../library/datetime.rst:1693 +#: ../../library/datetime.rst:1098 ../../library/datetime.rst:1701 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1095 ../../library/datetime.rst:1100 -#: ../../library/datetime.rst:1698 ../../library/datetime.rst:1703 +#: ../../library/datetime.rst:1103 ../../library/datetime.rst:1108 +#: ../../library/datetime.rst:1706 ../../library/datetime.rst:1711 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1105 ../../library/datetime.rst:1708 +#: ../../library/datetime.rst:1113 ../../library/datetime.rst:1716 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1110 +#: ../../library/datetime.rst:1118 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1116 ../../library/datetime.rst:1719 +#: ../../library/datetime.rst:1124 ../../library/datetime.rst:1727 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1371,38 +1374,38 @@ msgid "" "(later) of the two moments with the same wall time representation." msgstr "" -#: ../../library/datetime.rst:1129 +#: ../../library/datetime.rst:1137 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1129 ../../library/datetime.rst:2310 -#: ../../library/datetime.rst:2315 ../../library/datetime.rst:2327 -#: ../../library/datetime.rst:2332 ../../library/datetime.rst:2392 -#: ../../library/datetime.rst:2397 ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:1137 ../../library/datetime.rst:2329 +#: ../../library/datetime.rst:2334 ../../library/datetime.rst:2346 +#: ../../library/datetime.rst:2351 ../../library/datetime.rst:2411 +#: ../../library/datetime.rst:2416 ../../library/datetime.rst:2420 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1131 +#: ../../library/datetime.rst:1139 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1131 ../../library/datetime.rst:2343 +#: ../../library/datetime.rst:1139 ../../library/datetime.rst:2362 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1133 +#: ../../library/datetime.rst:1141 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" -#: ../../library/datetime.rst:1135 +#: ../../library/datetime.rst:1143 msgid "``datetime1 < datetime2``" msgstr "``datetime1 < datetime2``" -#: ../../library/datetime.rst:1135 +#: ../../library/datetime.rst:1143 msgid "Compares :class:`.datetime` to :class:`.datetime`. (4)" msgstr "" -#: ../../library/datetime.rst:1140 +#: ../../library/datetime.rst:1148 msgid "" "datetime2 is a duration of timedelta removed from datetime1, moving forward " "in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. " @@ -1413,7 +1416,7 @@ msgid "" "the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1149 +#: ../../library/datetime.rst:1157 msgid "" "Computes the datetime2 such that datetime2 + timedelta == datetime1. As for " "addition, the result has the same :attr:`~.datetime.tzinfo` attribute as the " @@ -1421,14 +1424,14 @@ msgid "" "aware." msgstr "" -#: ../../library/datetime.rst:1154 +#: ../../library/datetime.rst:1162 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1158 +#: ../../library/datetime.rst:1166 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " @@ -1436,7 +1439,7 @@ msgid "" "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: ../../library/datetime.rst:1163 +#: ../../library/datetime.rst:1171 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes " @@ -1445,20 +1448,20 @@ msgid "" "overflows." msgstr "" -#: ../../library/datetime.rst:1169 +#: ../../library/datetime.rst:1177 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time." msgstr "" -#: ../../library/datetime.rst:1172 +#: ../../library/datetime.rst:1180 msgid "" "If one comparand is naive and the other is aware, :exc:`TypeError` is raised " "if an order comparison is attempted. For equality comparisons, naive " "instances are never equal to aware instances." msgstr "" -#: ../../library/datetime.rst:1176 +#: ../../library/datetime.rst:1184 msgid "" "If both comparands are aware, and have the same :attr:`~.datetime.tzinfo` " "attribute, the common :attr:`~.datetime.tzinfo` attribute is ignored and the " @@ -1468,13 +1471,13 @@ msgid "" "utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1182 +#: ../../library/datetime.rst:1190 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1188 +#: ../../library/datetime.rst:1196 msgid "" "In order to stop comparison from falling back to the default scheme of " "comparing object addresses, datetime comparison normally raises :exc:" @@ -1487,27 +1490,27 @@ msgid "" "cases return :const:`False` or :const:`True`, respectively." msgstr "" -#: ../../library/datetime.rst:1202 +#: ../../library/datetime.rst:1210 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1207 +#: ../../library/datetime.rst:1215 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1210 ../../library/datetime.rst:1219 +#: ../../library/datetime.rst:1218 ../../library/datetime.rst:1227 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1216 +#: ../../library/datetime.rst:1224 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1227 +#: ../../library/datetime.rst:1235 msgid "" "Return a datetime with the same attributes, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1515,21 +1518,21 @@ msgid "" "datetime with no conversion of date and time data." msgstr "" -#: ../../library/datetime.rst:1238 +#: ../../library/datetime.rst:1246 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1242 +#: ../../library/datetime.rst:1250 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system timezone." msgstr "" -#: ../../library/datetime.rst:1246 +#: ../../library/datetime.rst:1254 msgid "" "If called without arguments (or with ``tz=None``) the system local timezone " "is assumed for the target timezone. The ``.tzinfo`` attribute of the " @@ -1537,7 +1540,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1251 +#: ../../library/datetime.rst:1259 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -1546,7 +1549,7 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1257 +#: ../../library/datetime.rst:1265 msgid "" "If you merely want to attach a time zone object *tz* to a datetime *dt* " "without adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If " @@ -1554,56 +1557,56 @@ msgid "" "without conversion of date and time data, use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1262 +#: ../../library/datetime.rst:1270 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1274 +#: ../../library/datetime.rst:1282 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1277 +#: ../../library/datetime.rst:1285 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1284 +#: ../../library/datetime.rst:1292 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1288 ../../library/datetime.rst:1871 -#: ../../library/datetime.rst:1977 ../../library/datetime.rst:2222 -#: ../../library/datetime.rst:2234 ../../library/datetime.rst:2531 +#: ../../library/datetime.rst:1296 ../../library/datetime.rst:1890 +#: ../../library/datetime.rst:1996 ../../library/datetime.rst:2241 +#: ../../library/datetime.rst:2253 ../../library/datetime.rst:2550 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1294 +#: ../../library/datetime.rst:1302 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1298 ../../library/datetime.rst:1881 -#: ../../library/datetime.rst:2031 +#: ../../library/datetime.rst:1306 ../../library/datetime.rst:1900 +#: ../../library/datetime.rst:2050 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1304 +#: ../../library/datetime.rst:1312 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: ../../library/datetime.rst:1319 +#: ../../library/datetime.rst:1327 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with ``1`` for January 1st. The :" @@ -1613,14 +1616,14 @@ msgid "" "attr:`tm_isdst` is set to ``1``; else :attr:`tm_isdst` is set to ``0``." msgstr "" -#: ../../library/datetime.rst:1330 +#: ../../library/datetime.rst:1338 msgid "" "If :class:`.datetime` instance *d* is naive, this is the same as ``d." "timetuple()`` except that :attr:`tm_isdst` is forced to 0 regardless of what " "``d.dst()`` returns. DST is never in effect for a UTC time." msgstr "" -#: ../../library/datetime.rst:1334 +#: ../../library/datetime.rst:1342 msgid "" "If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " @@ -1629,7 +1632,7 @@ msgid "" "spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1343 +#: ../../library/datetime.rst:1351 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1639,20 +1642,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1352 +#: ../../library/datetime.rst:1360 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1357 +#: ../../library/datetime.rst:1365 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: ../../library/datetime.rst:1361 +#: ../../library/datetime.rst:1369 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -1661,18 +1664,18 @@ msgid "" "`OverflowError` for times far in the past or far in the future." msgstr "" -#: ../../library/datetime.rst:1368 +#: ../../library/datetime.rst:1376 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1375 +#: ../../library/datetime.rst:1383 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1381 +#: ../../library/datetime.rst:1389 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " @@ -1680,145 +1683,145 @@ msgid "" "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1389 +#: ../../library/datetime.rst:1397 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1395 +#: ../../library/datetime.rst:1403 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1401 +#: ../../library/datetime.rst:1409 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1408 +#: ../../library/datetime.rst:1416 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1414 +#: ../../library/datetime.rst:1422 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1416 +#: ../../library/datetime.rst:1424 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1417 +#: ../../library/datetime.rst:1425 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1419 +#: ../../library/datetime.rst:1427 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" -#: ../../library/datetime.rst:1422 +#: ../../library/datetime.rst:1430 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" msgstr "" -#: ../../library/datetime.rst:1424 +#: ../../library/datetime.rst:1432 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1434 +#: ../../library/datetime.rst:1442 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1448 ../../library/datetime.rst:1809 +#: ../../library/datetime.rst:1456 ../../library/datetime.rst:1828 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1452 ../../library/datetime.rst:1813 +#: ../../library/datetime.rst:1460 ../../library/datetime.rst:1832 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1454 ../../library/datetime.rst:1815 +#: ../../library/datetime.rst:1462 ../../library/datetime.rst:1834 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1455 ../../library/datetime.rst:1816 +#: ../../library/datetime.rst:1463 ../../library/datetime.rst:1835 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1456 ../../library/datetime.rst:1817 +#: ../../library/datetime.rst:1464 ../../library/datetime.rst:1836 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1458 ../../library/datetime.rst:1819 +#: ../../library/datetime.rst:1466 ../../library/datetime.rst:1838 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1460 ../../library/datetime.rst:1821 +#: ../../library/datetime.rst:1468 ../../library/datetime.rst:1840 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1464 ../../library/datetime.rst:1825 +#: ../../library/datetime.rst:1472 ../../library/datetime.rst:1844 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1466 +#: ../../library/datetime.rst:1474 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1476 ../../library/datetime.rst:1840 +#: ../../library/datetime.rst:1484 ../../library/datetime.rst:1859 msgid "Added the *timespec* argument." msgstr "新增 *timespec* 引數。" -#: ../../library/datetime.rst:1482 +#: ../../library/datetime.rst:1490 msgid "" "For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1488 +#: ../../library/datetime.rst:1496 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1494 +#: ../../library/datetime.rst:1502 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1501 +#: ../../library/datetime.rst:1509 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: ../../library/datetime.rst:1507 +#: ../../library/datetime.rst:1515 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. For a complete list of formatting directives, see :ref:" "`strftime-strptime-behavior`." msgstr "" -#: ../../library/datetime.rst:1514 +#: ../../library/datetime.rst:1522 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -1826,70 +1829,70 @@ msgid "" "of formatting directives, see :ref:`strftime-strptime-behavior`." msgstr "" -#: ../../library/datetime.rst:1521 +#: ../../library/datetime.rst:1529 msgid "Examples of Usage: :class:`.datetime`" msgstr "" -#: ../../library/datetime.rst:1523 +#: ../../library/datetime.rst:1531 msgid "Examples of working with :class:`~datetime.datetime` objects:" msgstr "" -#: ../../library/datetime.rst:1576 +#: ../../library/datetime.rst:1584 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1623 +#: ../../library/datetime.rst:1631 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1649 +#: ../../library/datetime.rst:1657 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1651 +#: ../../library/datetime.rst:1659 msgid "" "A :class:`time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1656 +#: ../../library/datetime.rst:1664 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1666 +#: ../../library/datetime.rst:1674 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to ``0`` except *tzinfo*, which defaults to :const:`None`." msgstr "" -#: ../../library/datetime.rst:1674 +#: ../../library/datetime.rst:1682 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1679 +#: ../../library/datetime.rst:1687 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1684 +#: ../../library/datetime.rst:1692 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1713 +#: ../../library/datetime.rst:1721 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1727 +#: ../../library/datetime.rst:1735 msgid "" ":class:`.time` objects support comparison of :class:`.time` to :class:`." "time`, where *a* is considered less than *b* when *a* precedes *b* in time. " @@ -1898,7 +1901,7 @@ msgid "" "instances are never equal to aware instances." msgstr "" -#: ../../library/datetime.rst:1733 +#: ../../library/datetime.rst:1741 msgid "" "If both comparands are aware, and have the same :attr:`~time.tzinfo` " "attribute, the common :attr:`~time.tzinfo` attribute is ignored and the base " @@ -1912,18 +1915,18 @@ msgid "" "respectively." msgstr "" -#: ../../library/datetime.rst:1743 +#: ../../library/datetime.rst:1751 msgid "" "Equality comparisons between aware and naive :class:`~datetime.time` " "instances don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1747 +#: ../../library/datetime.rst:1755 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1749 +#: ../../library/datetime.rst:1757 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -1931,24 +1934,35 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1756 +#: ../../library/datetime.rst:1764 msgid "Other constructor:" msgstr "" -#: ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:1768 +msgid "" +"Return a :class:`.time` corresponding to a *time_string* in any valid ISO " +"8601 format, with the following exceptions:" +msgstr "" + +#: ../../library/datetime.rst:1772 msgid "" -"Return a :class:`.time` corresponding to a *time_string* in one of the " -"formats emitted by :meth:`time.isoformat`. Specifically, this function " -"supports strings in the format:" +"The leading `T`, normally required in cases where there may be ambiguity " +"between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1770 +#: ../../library/datetime.rst:1774 msgid "" -"This does *not* support parsing arbitrary ISO 8601 strings. It is only " -"intended as the inverse operation of :meth:`time.isoformat`." +"Fractional seconds may have any number of digits (anything beyond 6 will be " +"truncated)." msgstr "" -#: ../../library/datetime.rst:1791 +#: ../../library/datetime.rst:1800 +msgid "" +"Previously, this method only supported formats that could be emitted by :" +"meth:`time.isoformat()`." +msgstr "" + +#: ../../library/datetime.rst:1810 msgid "" "Return a :class:`.time` with the same value, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1956,46 +1970,46 @@ msgid "" "aware :class:`.time`, without conversion of the time data." msgstr "" -#: ../../library/datetime.rst:1802 +#: ../../library/datetime.rst:1821 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1804 +#: ../../library/datetime.rst:1823 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1805 +#: ../../library/datetime.rst:1824 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1806 +#: ../../library/datetime.rst:1825 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1807 +#: ../../library/datetime.rst:1826 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1827 +#: ../../library/datetime.rst:1846 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1846 +#: ../../library/datetime.rst:1865 msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1851 +#: ../../library/datetime.rst:1870 msgid "" "Return a string representing the time, controlled by an explicit format " "string. For a complete list of formatting directives, see :ref:`strftime-" "strptime-behavior`." msgstr "" -#: ../../library/datetime.rst:1858 +#: ../../library/datetime.rst:1877 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals ` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2114 +#: ../../library/datetime.rst:2133 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -2265,7 +2279,7 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2128 +#: ../../library/datetime.rst:2147 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -2274,7 +2288,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2147 +#: ../../library/datetime.rst:2166 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -2289,13 +2303,13 @@ msgid "" "transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2169 +#: ../../library/datetime.rst:2188 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2172 +#: ../../library/datetime.rst:2191 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~datetime.fold` attribute or avoid using hybrid :" @@ -2305,28 +2319,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2186 +#: ../../library/datetime.rst:2205 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2181 +#: ../../library/datetime.rst:2200 msgid "" "The :mod:`datetime` module has a basic :class:`timezone` class (for handling " "arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` attribute (a " "UTC timezone instance)." msgstr "" -#: ../../library/datetime.rst:2185 +#: ../../library/datetime.rst:2204 msgid "" "``zoneinfo`` brings the *IANA timezone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2192 +#: ../../library/datetime.rst:2211 msgid "`IANA timezone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2189 +#: ../../library/datetime.rst:2208 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -2335,24 +2349,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2199 +#: ../../library/datetime.rst:2218 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2201 +#: ../../library/datetime.rst:2220 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a timezone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2205 +#: ../../library/datetime.rst:2224 msgid "" "Objects of this class cannot be used to represent timezone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2212 +#: ../../library/datetime.rst:2231 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -2360,25 +2374,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2217 +#: ../../library/datetime.rst:2236 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2228 ../../library/datetime.rst:2239 +#: ../../library/datetime.rst:2247 ../../library/datetime.rst:2258 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2231 +#: ../../library/datetime.rst:2250 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2242 +#: ../../library/datetime.rst:2261 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -2387,138 +2401,138 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2248 +#: ../../library/datetime.rst:2267 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain `'UTC'`, not ``'UTC" "+00:00'``." msgstr "" -#: ../../library/datetime.rst:2255 +#: ../../library/datetime.rst:2274 msgid "Always returns ``None``." msgstr "" -#: ../../library/datetime.rst:2259 +#: ../../library/datetime.rst:2278 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2266 +#: ../../library/datetime.rst:2285 msgid "The UTC timezone, ``timezone(timedelta(0))``." msgstr "" -#: ../../library/datetime.rst:2275 +#: ../../library/datetime.rst:2294 msgid ":meth:`strftime` and :meth:`strptime` Behavior" msgstr ":meth:`strftime` 與 :meth:`strptime` 的行為" -#: ../../library/datetime.rst:2277 +#: ../../library/datetime.rst:2296 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2281 +#: ../../library/datetime.rst:2300 msgid "" "Conversely, the :meth:`datetime.strptime` class method creates a :class:`." "datetime` object from a string representing a date and time and a " "corresponding format string." msgstr "" -#: ../../library/datetime.rst:2285 +#: ../../library/datetime.rst:2304 msgid "" "The table below provides a high-level comparison of :meth:`strftime` versus :" "meth:`strptime`:" msgstr "" -#: ../../library/datetime.rst:2289 +#: ../../library/datetime.rst:2308 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2289 +#: ../../library/datetime.rst:2308 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2291 +#: ../../library/datetime.rst:2310 msgid "Usage" msgstr "" -#: ../../library/datetime.rst:2291 +#: ../../library/datetime.rst:2310 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2291 +#: ../../library/datetime.rst:2310 msgid "" "Parse a string into a :class:`.datetime` object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2293 +#: ../../library/datetime.rst:2312 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2293 +#: ../../library/datetime.rst:2312 msgid "Instance method" msgstr "" -#: ../../library/datetime.rst:2293 +#: ../../library/datetime.rst:2312 msgid "Class method" msgstr "" -#: ../../library/datetime.rst:2295 +#: ../../library/datetime.rst:2314 msgid "Method of" msgstr "" -#: ../../library/datetime.rst:2295 +#: ../../library/datetime.rst:2314 msgid ":class:`date`; :class:`.datetime`; :class:`.time`" msgstr "" -#: ../../library/datetime.rst:2295 +#: ../../library/datetime.rst:2314 msgid ":class:`.datetime`" msgstr ":class:`.datetime`" -#: ../../library/datetime.rst:2297 +#: ../../library/datetime.rst:2316 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2297 +#: ../../library/datetime.rst:2316 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2297 +#: ../../library/datetime.rst:2316 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2302 +#: ../../library/datetime.rst:2321 msgid ":meth:`strftime` and :meth:`strptime` Format Codes" msgstr "" -#: ../../library/datetime.rst:2304 +#: ../../library/datetime.rst:2323 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2308 ../../library/datetime.rst:2411 +#: ../../library/datetime.rst:2327 ../../library/datetime.rst:2430 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2308 ../../library/datetime.rst:2411 +#: ../../library/datetime.rst:2327 ../../library/datetime.rst:2430 msgid "Meaning" msgstr "" -#: ../../library/datetime.rst:2308 ../../library/datetime.rst:2411 +#: ../../library/datetime.rst:2327 ../../library/datetime.rst:2430 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2308 ../../library/datetime.rst:2411 +#: ../../library/datetime.rst:2327 ../../library/datetime.rst:2430 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2310 +#: ../../library/datetime.rst:2329 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2310 +#: ../../library/datetime.rst:2329 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -2530,11 +2544,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2315 +#: ../../library/datetime.rst:2334 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2315 +#: ../../library/datetime.rst:2334 msgid "Weekday as locale's full name." msgstr "" @@ -2546,42 +2560,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2320 +#: ../../library/datetime.rst:2339 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2320 +#: ../../library/datetime.rst:2339 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2320 +#: ../../library/datetime.rst:2339 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2324 +#: ../../library/datetime.rst:2343 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2324 +#: ../../library/datetime.rst:2343 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2324 +#: ../../library/datetime.rst:2343 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2324 ../../library/datetime.rst:2337 -#: ../../library/datetime.rst:2340 ../../library/datetime.rst:2346 -#: ../../library/datetime.rst:2349 ../../library/datetime.rst:2355 -#: ../../library/datetime.rst:2373 +#: ../../library/datetime.rst:2343 ../../library/datetime.rst:2356 +#: ../../library/datetime.rst:2359 ../../library/datetime.rst:2365 +#: ../../library/datetime.rst:2368 ../../library/datetime.rst:2374 +#: ../../library/datetime.rst:2392 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2327 +#: ../../library/datetime.rst:2346 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2327 +#: ../../library/datetime.rst:2346 msgid "Month as locale's abbreviated name." msgstr "" @@ -2593,11 +2607,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2332 +#: ../../library/datetime.rst:2351 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2332 +#: ../../library/datetime.rst:2351 msgid "Month as locale's full name." msgstr "" @@ -2609,67 +2623,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2356 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2356 msgid "Month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2337 ../../library/datetime.rst:2349 +#: ../../library/datetime.rst:2356 ../../library/datetime.rst:2368 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2340 +#: ../../library/datetime.rst:2359 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2340 +#: ../../library/datetime.rst:2359 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2340 +#: ../../library/datetime.rst:2359 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2343 +#: ../../library/datetime.rst:2362 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2343 +#: ../../library/datetime.rst:2362 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2343 ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2362 ../../library/datetime.rst:2432 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2346 +#: ../../library/datetime.rst:2365 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2346 +#: ../../library/datetime.rst:2365 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2346 +#: ../../library/datetime.rst:2365 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2349 +#: ../../library/datetime.rst:2368 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2349 +#: ../../library/datetime.rst:2368 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2352 +#: ../../library/datetime.rst:2371 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2352 +#: ../../library/datetime.rst:2371 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -2681,127 +2695,127 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2352 +#: ../../library/datetime.rst:2371 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2355 +#: ../../library/datetime.rst:2374 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2355 +#: ../../library/datetime.rst:2374 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2355 ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2374 ../../library/datetime.rst:2377 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2377 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2377 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2377 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2361 +#: ../../library/datetime.rst:2380 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2361 +#: ../../library/datetime.rst:2380 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2361 +#: ../../library/datetime.rst:2380 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2361 +#: ../../library/datetime.rst:2380 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2365 ../../library/datetime.rst:2529 +#: ../../library/datetime.rst:2384 ../../library/datetime.rst:2548 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2365 +#: ../../library/datetime.rst:2384 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2365 +#: ../../library/datetime.rst:2384 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2365 ../../library/datetime.rst:2370 +#: ../../library/datetime.rst:2384 ../../library/datetime.rst:2389 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2370 ../../library/datetime.rst:2553 +#: ../../library/datetime.rst:2389 ../../library/datetime.rst:2572 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2370 +#: ../../library/datetime.rst:2389 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2370 +#: ../../library/datetime.rst:2389 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2373 +#: ../../library/datetime.rst:2392 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2373 +#: ../../library/datetime.rst:2392 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2373 +#: ../../library/datetime.rst:2392 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2395 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2395 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2376 ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2395 ../../library/datetime.rst:2403 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2376 ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2395 ../../library/datetime.rst:2403 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2403 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2403 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2411 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2411 msgid "Locale's appropriate date and time representation." msgstr "" @@ -2813,11 +2827,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2397 +#: ../../library/datetime.rst:2416 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2397 +#: ../../library/datetime.rst:2416 msgid "Locale's appropriate date representation." msgstr "" @@ -2833,11 +2847,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2420 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2420 msgid "Locale's appropriate time representation." msgstr "" @@ -2849,69 +2863,69 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2423 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2423 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2423 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2407 +#: ../../library/datetime.rst:2426 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2432 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2432 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2432 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2418 +#: ../../library/datetime.rst:2437 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2418 +#: ../../library/datetime.rst:2437 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2418 +#: ../../library/datetime.rst:2437 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2421 +#: ../../library/datetime.rst:2440 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2421 +#: ../../library/datetime.rst:2440 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2421 +#: ../../library/datetime.rst:2440 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2421 +#: ../../library/datetime.rst:2440 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2447 msgid "" "These may not be available on all platforms when used with the :meth:" "`strftime` method. The ISO 8601 year and ISO 8601 week directives are not " @@ -2920,7 +2934,7 @@ msgid "" "a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2433 +#: ../../library/datetime.rst:2452 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :func:`strftime` function, and " @@ -2930,40 +2944,40 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2458 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``\\ 、\\ ``%u`` 與 ``%V``\\ 。" -#: ../../library/datetime.rst:2443 +#: ../../library/datetime.rst:2462 msgid "Technical Detail" msgstr "" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2464 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`timetuple` method." msgstr "" -#: ../../library/datetime.rst:2449 +#: ../../library/datetime.rst:2468 msgid "" "For the :meth:`datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2472 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2476 msgid "" "except when the format includes sub-second components or timezone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2461 +#: ../../library/datetime.rst:2480 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`time` objects have no such values. If they're used " @@ -2971,14 +2985,14 @@ msgid "" "day." msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2484 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " "values. If they're used anyway, ``0`` is substituted for them." msgstr "" -#: ../../library/datetime.rst:2469 +#: ../../library/datetime.rst:2488 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -2987,7 +3001,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2478 +#: ../../library/datetime.rst:2497 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -2998,37 +3012,37 @@ msgid "" "to determine the current locale's encoding)." msgstr "" -#: ../../library/datetime.rst:2487 +#: ../../library/datetime.rst:2506 msgid "" "The :meth:`strptime` method can parse years in the full [1, 9999] range, but " "years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2490 +#: ../../library/datetime.rst:2509 msgid "" "In previous versions, :meth:`strftime` method was restricted to years >= " "1900." msgstr "" -#: ../../library/datetime.rst:2494 +#: ../../library/datetime.rst:2513 msgid "" "In version 3.2, :meth:`strftime` method was restricted to years >= 1000." msgstr "" -#: ../../library/datetime.rst:2499 +#: ../../library/datetime.rst:2518 msgid "" "When used with the :meth:`strptime` method, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " "hour." msgstr "" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2522 msgid "" "Unlike the :mod:`time` module, the :mod:`datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2507 +#: ../../library/datetime.rst:2526 msgid "" "When used with the :meth:`strptime` method, the ``%f`` directive accepts " "from one to six digits and zero pads on the right. ``%f`` is an extension to " @@ -3036,17 +3050,17 @@ msgid "" "in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2514 +#: ../../library/datetime.rst:2533 msgid "" "For a naive object, the ``%z`` and ``%Z`` format codes are replaced by empty " "strings." msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2536 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2539 msgid "" ":meth:`utcoffset` is transformed into a string of the form ``±HHMM[SS[." "ffffff]]``, where ``HH`` is a 2-digit string giving the number of UTC offset " @@ -3060,7 +3074,7 @@ msgid "" "``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2553 msgid "" "When the ``%z`` directive is provided to the :meth:`strptime` method, the " "UTC offsets can have a colon as a separator between hours, minutes and " @@ -3068,47 +3082,47 @@ msgid "" "hour. In addition, providing ``'Z'`` is identical to ``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2542 +#: ../../library/datetime.rst:2561 msgid "" "In :meth:`strftime`, ``%Z`` is replaced by an empty string if :meth:`tzname` " "returns ``None``; otherwise ``%Z`` is replaced by the returned value, which " "must be a string." msgstr "" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2565 msgid ":meth:`strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2548 +#: ../../library/datetime.rst:2567 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2549 +#: ../../library/datetime.rst:2568 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2570 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2555 +#: ../../library/datetime.rst:2574 msgid "" "When the ``%z`` directive is provided to the :meth:`strptime` method, an " "aware :class:`.datetime` object will be produced. The ``tzinfo`` of the " "result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2561 +#: ../../library/datetime.rst:2580 msgid "" "When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used " "in calculations when the day of the week and the calendar year (``%Y``) are " "specified." msgstr "" -#: ../../library/datetime.rst:2566 +#: ../../library/datetime.rst:2585 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:" @@ -3116,22 +3130,22 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/datetime.rst:2572 +#: ../../library/datetime.rst:2591 msgid "" "When used with the :meth:`strptime` method, the leading zero is optional " "for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, ``%J``, ``%U``, " "``%W``, and ``%V``. Format ``%y`` does require a leading zero." msgstr "" -#: ../../library/datetime.rst:2577 +#: ../../library/datetime.rst:2596 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2578 +#: ../../library/datetime.rst:2597 msgid "If, that is, we ignore the effects of Relativity" msgstr "" -#: ../../library/datetime.rst:2580 +#: ../../library/datetime.rst:2599 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -3140,14 +3154,14 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2586 +#: ../../library/datetime.rst:2605 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2590 +#: ../../library/datetime.rst:2609 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since ``1900`` is " "not a leap year." diff --git a/library/dbm.po b/library/dbm.po index 74a1235e78..254f93f6e6 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -58,79 +58,84 @@ msgid "" "name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``." msgstr "" -#: ../../library/dbm.rst:39 -msgid "Open the database file *file* and return a corresponding object." +#: ../../library/dbm.rst:36 ../../library/dbm.rst:210 ../../library/dbm.rst:309 +#: ../../library/dbm.rst:393 +msgid "Accepts :term:`path-like object` for filename." msgstr "" #: ../../library/dbm.rst:41 +msgid "Open the database file *file* and return a corresponding object." +msgstr "" + +#: ../../library/dbm.rst:43 msgid "" "If the database file already exists, the :func:`whichdb` function is used to " "determine its type and the appropriate module is used; if it does not exist, " "the first module listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:45 ../../library/dbm.rst:161 ../../library/dbm.rst:346 +#: ../../library/dbm.rst:47 ../../library/dbm.rst:166 ../../library/dbm.rst:357 msgid "The optional *flag* argument can be:" msgstr "" -#: ../../library/dbm.rst:48 ../../library/dbm.rst:164 ../../library/dbm.rst:183 -#: ../../library/dbm.rst:279 ../../library/dbm.rst:349 +#: ../../library/dbm.rst:50 ../../library/dbm.rst:169 ../../library/dbm.rst:188 +#: ../../library/dbm.rst:287 ../../library/dbm.rst:360 msgid "Value" msgstr "" -#: ../../library/dbm.rst:48 ../../library/dbm.rst:164 ../../library/dbm.rst:183 -#: ../../library/dbm.rst:279 ../../library/dbm.rst:349 +#: ../../library/dbm.rst:50 ../../library/dbm.rst:169 ../../library/dbm.rst:188 +#: ../../library/dbm.rst:287 ../../library/dbm.rst:360 msgid "Meaning" msgstr "" -#: ../../library/dbm.rst:50 ../../library/dbm.rst:166 ../../library/dbm.rst:281 -#: ../../library/dbm.rst:351 +#: ../../library/dbm.rst:52 ../../library/dbm.rst:171 ../../library/dbm.rst:289 +#: ../../library/dbm.rst:362 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/dbm.rst:50 ../../library/dbm.rst:166 ../../library/dbm.rst:281 -#: ../../library/dbm.rst:351 +#: ../../library/dbm.rst:52 ../../library/dbm.rst:171 ../../library/dbm.rst:289 +#: ../../library/dbm.rst:362 msgid "Open existing database for reading only (default)" msgstr "" -#: ../../library/dbm.rst:53 ../../library/dbm.rst:169 ../../library/dbm.rst:284 -#: ../../library/dbm.rst:354 +#: ../../library/dbm.rst:55 ../../library/dbm.rst:174 ../../library/dbm.rst:292 +#: ../../library/dbm.rst:365 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/dbm.rst:53 ../../library/dbm.rst:169 ../../library/dbm.rst:284 -#: ../../library/dbm.rst:354 +#: ../../library/dbm.rst:55 ../../library/dbm.rst:174 ../../library/dbm.rst:292 +#: ../../library/dbm.rst:365 msgid "Open existing database for reading and writing" msgstr "" -#: ../../library/dbm.rst:56 ../../library/dbm.rst:172 ../../library/dbm.rst:287 -#: ../../library/dbm.rst:357 +#: ../../library/dbm.rst:58 ../../library/dbm.rst:177 ../../library/dbm.rst:295 +#: ../../library/dbm.rst:368 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/dbm.rst:56 ../../library/dbm.rst:172 ../../library/dbm.rst:287 -#: ../../library/dbm.rst:357 +#: ../../library/dbm.rst:58 ../../library/dbm.rst:177 ../../library/dbm.rst:295 +#: ../../library/dbm.rst:368 msgid "Open database for reading and writing, creating it if it doesn't exist" msgstr "" -#: ../../library/dbm.rst:59 ../../library/dbm.rst:175 ../../library/dbm.rst:290 -#: ../../library/dbm.rst:360 +#: ../../library/dbm.rst:61 ../../library/dbm.rst:180 ../../library/dbm.rst:298 +#: ../../library/dbm.rst:371 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/dbm.rst:59 ../../library/dbm.rst:175 ../../library/dbm.rst:290 -#: ../../library/dbm.rst:360 +#: ../../library/dbm.rst:61 ../../library/dbm.rst:180 ../../library/dbm.rst:298 +#: ../../library/dbm.rst:371 msgid "Always create a new, empty database, open for reading and writing" msgstr "" -#: ../../library/dbm.rst:63 ../../library/dbm.rst:294 ../../library/dbm.rst:364 +#: ../../library/dbm.rst:65 ../../library/dbm.rst:302 ../../library/dbm.rst:375 msgid "" "The optional *mode* argument is the Unix mode of the file, used only when " "the database has to be created. It defaults to octal ``0o666`` (and will be " "modified by the prevailing umask)." msgstr "" -#: ../../library/dbm.rst:68 +#: ../../library/dbm.rst:70 msgid "" "The object returned by :func:`.open` supports the same basic functionality " "as dictionaries; keys and their corresponding values can be stored, " @@ -138,63 +143,67 @@ msgid "" "method are available, as well as :meth:`get` and :meth:`setdefault`." msgstr "" -#: ../../library/dbm.rst:73 +#: ../../library/dbm.rst:75 msgid "" ":meth:`get` and :meth:`setdefault` are now available in all database modules." msgstr "" -#: ../../library/dbm.rst:76 +#: ../../library/dbm.rst:78 msgid "" "Deleting a key from a read-only database raises database module specific " "error instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:80 +#: ../../library/dbm.rst:82 +msgid "Accepts :term:`path-like object` for file." +msgstr "" + +#: ../../library/dbm.rst:85 msgid "" "Key and values are always stored as bytes. This means that when strings are " "used they are implicitly converted to the default encoding before being " "stored." msgstr "" -#: ../../library/dbm.rst:84 +#: ../../library/dbm.rst:89 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:87 +#: ../../library/dbm.rst:92 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`.open`." msgstr "" -#: ../../library/dbm.rst:91 +#: ../../library/dbm.rst:96 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:121 +#: ../../library/dbm.rst:126 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:122 +#: ../../library/dbm.rst:127 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:125 +#: ../../library/dbm.rst:130 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:129 +#: ../../library/dbm.rst:134 msgid ":mod:`dbm.gnu` --- GNU's reinterpretation of dbm" msgstr "" -#: ../../library/dbm.rst:135 +#: ../../library/dbm.rst:140 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" -#: ../../library/dbm.rst:139 +#: ../../library/dbm.rst:144 msgid "" "This module is quite similar to the :mod:`dbm` module, but uses the GNU " "library ``gdbm`` instead to provide some additional functionality. Please " @@ -202,7 +211,7 @@ msgid "" "incompatible." msgstr "" -#: ../../library/dbm.rst:143 +#: ../../library/dbm.rst:148 msgid "" "The :mod:`dbm.gnu` module provides an interface to the GNU DBM library. " "``dbm.gnu.gdbm`` objects behave like mappings (dictionaries), except that " @@ -211,73 +220,73 @@ msgid "" "and :meth:`values` methods are not supported." msgstr "" -#: ../../library/dbm.rst:152 +#: ../../library/dbm.rst:157 msgid "" "Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:158 +#: ../../library/dbm.rst:163 msgid "" "Open a ``gdbm`` database and return a :class:`gdbm` object. The *filename* " "argument is the name of the database file." msgstr "" -#: ../../library/dbm.rst:179 +#: ../../library/dbm.rst:184 msgid "" "The following additional characters may be appended to the flag to control " "how the database is opened:" msgstr "" -#: ../../library/dbm.rst:185 +#: ../../library/dbm.rst:190 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/dbm.rst:185 +#: ../../library/dbm.rst:190 msgid "" "Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:188 +#: ../../library/dbm.rst:193 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/dbm.rst:188 +#: ../../library/dbm.rst:193 msgid "" "Synchronized mode. This will cause changes to the database to be immediately " "written to the file." msgstr "" -#: ../../library/dbm.rst:192 +#: ../../library/dbm.rst:197 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/dbm.rst:192 +#: ../../library/dbm.rst:197 msgid "Do not lock database." msgstr "不要鎖住資料庫" -#: ../../library/dbm.rst:195 +#: ../../library/dbm.rst:200 msgid "" "Not all flags are valid for all versions of ``gdbm``. The module constant :" "const:`open_flags` is a string of supported flag characters. The exception :" "exc:`error` is raised if an invalid flag is specified." msgstr "" -#: ../../library/dbm.rst:199 +#: ../../library/dbm.rst:204 msgid "" "The optional *mode* argument is the Unix mode of the file, used only when " "the database has to be created. It defaults to octal ``0o666``." msgstr "" -#: ../../library/dbm.rst:202 +#: ../../library/dbm.rst:207 msgid "" "In addition to the dictionary-like methods, ``gdbm`` objects have the " "following methods:" msgstr "" -#: ../../library/dbm.rst:207 +#: ../../library/dbm.rst:215 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by ``gdbm``'s internal " @@ -285,14 +294,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:214 +#: ../../library/dbm.rst:222 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:225 +#: ../../library/dbm.rst:233 msgid "" "If you have carried out a lot of deletions and would like to shrink the " "space used by the ``gdbm`` file, this routine will reorganize the database. " @@ -301,25 +310,25 @@ msgid "" "reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:233 +#: ../../library/dbm.rst:241 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:238 +#: ../../library/dbm.rst:246 msgid "Close the ``gdbm`` database." msgstr "" -#: ../../library/dbm.rst:241 +#: ../../library/dbm.rst:249 msgid ":mod:`dbm.ndbm` --- Interface based on ndbm" msgstr "" -#: ../../library/dbm.rst:247 +#: ../../library/dbm.rst:255 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:251 +#: ../../library/dbm.rst:259 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the Unix \"(n)dbm\" " "library. Dbm objects behave like mappings (dictionaries), except that keys " @@ -328,7 +337,7 @@ msgid "" "are not supported." msgstr "" -#: ../../library/dbm.rst:256 +#: ../../library/dbm.rst:264 msgid "" "This module can be used with the \"classic\" ndbm interface or the GNU GDBM " "compatibility interface. On Unix, the :program:`configure` script will " @@ -336,47 +345,47 @@ msgid "" "module." msgstr "" -#: ../../library/dbm.rst:262 +#: ../../library/dbm.rst:270 msgid "" "Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:268 +#: ../../library/dbm.rst:276 msgid "Name of the ``ndbm`` implementation library used." msgstr "" -#: ../../library/dbm.rst:273 +#: ../../library/dbm.rst:281 msgid "" "Open a dbm database and return a ``ndbm`` object. The *filename* argument " "is the name of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:276 +#: ../../library/dbm.rst:284 msgid "The optional *flag* argument must be one of these values:" msgstr "" -#: ../../library/dbm.rst:298 +#: ../../library/dbm.rst:306 msgid "" "In addition to the dictionary-like methods, ``ndbm`` objects provide the " "following method:" msgstr "" -#: ../../library/dbm.rst:303 +#: ../../library/dbm.rst:314 msgid "Close the ``ndbm`` database." msgstr "" -#: ../../library/dbm.rst:307 +#: ../../library/dbm.rst:318 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr "" -#: ../../library/dbm.rst:312 +#: ../../library/dbm.rst:323 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:318 +#: ../../library/dbm.rst:329 msgid "" "The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" "mod:`dbm` module when a more robust module is not available. The :mod:`dbm." @@ -384,7 +393,7 @@ msgid "" "the other database modules." msgstr "" -#: ../../library/dbm.rst:325 +#: ../../library/dbm.rst:336 msgid "" "The :mod:`dbm.dumb` module provides a persistent dictionary-like interface " "which is written entirely in Python. Unlike other modules such as :mod:`dbm." @@ -392,18 +401,18 @@ msgid "" "the keys and values are always stored as bytes." msgstr "" -#: ../../library/dbm.rst:330 +#: ../../library/dbm.rst:341 msgid "The module defines the following:" msgstr "" -#: ../../library/dbm.rst:335 +#: ../../library/dbm.rst:346 msgid "" "Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:341 +#: ../../library/dbm.rst:352 msgid "" "Open a ``dumbdbm`` database and return a dumbdbm object. The *filename* " "argument is the basename of the database file (without any specific " @@ -411,38 +420,38 @@ msgid "" "and :file:`.dir` extensions are created." msgstr "" -#: ../../library/dbm.rst:369 +#: ../../library/dbm.rst:380 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:373 +#: ../../library/dbm.rst:384 msgid "" ":func:`.open` always creates a new database when the flag has the value " "``'n'``." msgstr "" -#: ../../library/dbm.rst:377 +#: ../../library/dbm.rst:388 msgid "" "A database opened with flags ``'r'`` is now read-only. Opening with flags " "``'r'`` and ``'w'`` no longer creates a database if it does not exist." msgstr "" -#: ../../library/dbm.rst:382 +#: ../../library/dbm.rst:396 msgid "" "In addition to the methods provided by the :class:`collections.abc." "MutableMapping` class, :class:`dumbdbm` objects provide the following " "methods:" msgstr "" -#: ../../library/dbm.rst:388 +#: ../../library/dbm.rst:402 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`Shelve.sync` method." msgstr "" -#: ../../library/dbm.rst:393 +#: ../../library/dbm.rst:407 msgid "Close the ``dumbdbm`` database." msgstr "" diff --git a/library/decimal.po b/library/decimal.po index 30065ebfcd..15079d6aa8 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-26 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -838,12 +838,12 @@ msgstr "" msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:862 ../../library/decimal.rst:1441 +#: ../../library/decimal.rst:862 ../../library/decimal.rst:1457 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:864 ../../library/decimal.rst:1443 +#: ../../library/decimal.rst:864 ../../library/decimal.rst:1459 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " @@ -924,23 +924,41 @@ msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " "previous context when exiting the with-statement. If no context is " -"specified, a copy of the current context is used." +"specified, a copy of the current context is used. The *kwargs* argument is " +"used to set the attributes of the new context." msgstr "" -#: ../../library/decimal.rst:936 +#: ../../library/decimal.rst:937 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: ../../library/decimal.rst:946 +#: ../../library/decimal.rst:947 +msgid "Using keyword arguments, the code would be the following::" +msgstr "" + +#: ../../library/decimal.rst:955 +msgid "" +"Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" +"`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" +"`ValueError` if *kwargs* supplies an invalid value for an attribute." +msgstr "" + +#: ../../library/decimal.rst:959 +msgid "" +":meth:`localcontext` now supports setting context attributes through the use " +"of keyword arguments." +msgstr "" + +#: ../../library/decimal.rst:962 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: ../../library/decimal.rst:952 +#: ../../library/decimal.rst:968 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -949,12 +967,12 @@ msgid "" "`Subnormal`." msgstr "" -#: ../../library/decimal.rst:958 +#: ../../library/decimal.rst:974 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: ../../library/decimal.rst:963 +#: ../../library/decimal.rst:979 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -962,7 +980,7 @@ msgid "" "exceptions are not raised during computations)." msgstr "" -#: ../../library/decimal.rst:968 +#: ../../library/decimal.rst:984 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of :const:`NaN` or :const:`Infinity` instead of " @@ -970,7 +988,7 @@ msgid "" "presence of conditions that would otherwise halt the program." msgstr "" -#: ../../library/decimal.rst:976 +#: ../../library/decimal.rst:992 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -978,7 +996,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/decimal.rst:980 +#: ../../library/decimal.rst:996 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -986,65 +1004,65 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: ../../library/decimal.rst:985 +#: ../../library/decimal.rst:1001 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: ../../library/decimal.rst:988 +#: ../../library/decimal.rst:1004 msgid "" "The default values are :attr:`prec`\\ =\\ :const:`28`, :attr:`rounding`\\ =" "\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:`Overflow`, :class:" "`InvalidOperation`, and :class:`DivisionByZero`." msgstr "" -#: ../../library/decimal.rst:993 +#: ../../library/decimal.rst:1009 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: ../../library/decimal.rst:999 +#: ../../library/decimal.rst:1015 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1003 +#: ../../library/decimal.rst:1019 msgid "" "*prec* is an integer in the range [:const:`1`, :const:`MAX_PREC`] that sets " "the precision for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1006 +#: ../../library/decimal.rst:1022 msgid "" "The *rounding* option is one of the constants listed in the section " "`Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1009 +#: ../../library/decimal.rst:1025 msgid "" "The *traps* and *flags* fields list any signals to be set. Generally, new " "contexts should only set traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1012 +#: ../../library/decimal.rst:1028 msgid "" "The *Emin* and *Emax* fields are integers specifying the outer limits " "allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, :" "const:`0`], *Emax* in the range [:const:`0`, :const:`MAX_EMAX`]." msgstr "" -#: ../../library/decimal.rst:1016 +#: ../../library/decimal.rst:1032 msgid "" "The *capitals* field is either :const:`0` or :const:`1` (the default). If " "set to :const:`1`, exponents are printed with a capital :const:`E`; " "otherwise, a lowercase :const:`e` is used: :const:`Decimal('6.02e+23')`." msgstr "" -#: ../../library/decimal.rst:1020 +#: ../../library/decimal.rst:1036 msgid "" "The *clamp* field is either :const:`0` (the default) or :const:`1`. If set " "to :const:`1`, the exponent ``e`` of a :class:`Decimal` instance " @@ -1058,13 +1076,13 @@ msgid "" "significant trailing zeros. For example::" msgstr "" -#: ../../library/decimal.rst:1035 +#: ../../library/decimal.rst:1051 msgid "" "A *clamp* value of :const:`1` allows compatibility with the fixed-width " "decimal interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1038 +#: ../../library/decimal.rst:1054 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1077,30 +1095,30 @@ msgid "" "a Decimal instance is accepted." msgstr "" -#: ../../library/decimal.rst:1051 +#: ../../library/decimal.rst:1067 msgid "Resets all of the flags to :const:`0`." msgstr "" -#: ../../library/decimal.rst:1055 +#: ../../library/decimal.rst:1071 msgid "Resets all of the traps to :const:`0`." msgstr "" -#: ../../library/decimal.rst:1061 +#: ../../library/decimal.rst:1077 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1065 +#: ../../library/decimal.rst:1081 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1069 +#: ../../library/decimal.rst:1085 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: ../../library/decimal.rst:1073 +#: ../../library/decimal.rst:1089 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1109,14 +1127,14 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1087 +#: ../../library/decimal.rst:1103 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: ../../library/decimal.rst:1093 +#: ../../library/decimal.rst:1109 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1124,18 +1142,18 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1113 +#: ../../library/decimal.rst:1129 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -#: ../../library/decimal.rst:1119 +#: ../../library/decimal.rst:1135 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1121 +#: ../../library/decimal.rst:1137 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1145,189 +1163,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1131 +#: ../../library/decimal.rst:1147 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1136 +#: ../../library/decimal.rst:1152 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1141 +#: ../../library/decimal.rst:1157 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1146 +#: ../../library/decimal.rst:1162 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1151 +#: ../../library/decimal.rst:1167 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1156 +#: ../../library/decimal.rst:1172 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1161 +#: ../../library/decimal.rst:1177 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1166 +#: ../../library/decimal.rst:1182 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1171 +#: ../../library/decimal.rst:1187 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1176 +#: ../../library/decimal.rst:1192 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1181 +#: ../../library/decimal.rst:1197 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1186 +#: ../../library/decimal.rst:1202 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1191 +#: ../../library/decimal.rst:1207 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1196 +#: ../../library/decimal.rst:1212 msgid "Returns `e ** x`." msgstr "" -#: ../../library/decimal.rst:1201 +#: ../../library/decimal.rst:1217 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1206 +#: ../../library/decimal.rst:1222 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1211 +#: ../../library/decimal.rst:1227 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1216 +#: ../../library/decimal.rst:1232 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1221 +#: ../../library/decimal.rst:1237 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1226 +#: ../../library/decimal.rst:1242 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1231 +#: ../../library/decimal.rst:1247 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1236 +#: ../../library/decimal.rst:1252 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1241 +#: ../../library/decimal.rst:1257 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1246 +#: ../../library/decimal.rst:1262 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1251 +#: ../../library/decimal.rst:1267 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1256 +#: ../../library/decimal.rst:1272 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1261 +#: ../../library/decimal.rst:1277 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1266 +#: ../../library/decimal.rst:1282 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1271 +#: ../../library/decimal.rst:1287 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1276 +#: ../../library/decimal.rst:1292 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1281 +#: ../../library/decimal.rst:1297 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1286 +#: ../../library/decimal.rst:1302 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1291 +#: ../../library/decimal.rst:1307 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1296 ../../library/decimal.rst:1306 +#: ../../library/decimal.rst:1312 ../../library/decimal.rst:1322 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1301 +#: ../../library/decimal.rst:1317 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1311 +#: ../../library/decimal.rst:1327 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1316 +#: ../../library/decimal.rst:1332 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1321 +#: ../../library/decimal.rst:1337 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1326 +#: ../../library/decimal.rst:1342 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1331 +#: ../../library/decimal.rst:1347 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1336 +#: ../../library/decimal.rst:1352 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1341 +#: ../../library/decimal.rst:1357 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1346 +#: ../../library/decimal.rst:1362 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: ../../library/decimal.rst:1353 +#: ../../library/decimal.rst:1369 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1355 +#: ../../library/decimal.rst:1371 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1336,42 +1354,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1361 +#: ../../library/decimal.rst:1377 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1364 +#: ../../library/decimal.rst:1380 msgid "" "The C module computes :meth:`power` in terms of the correctly rounded :meth:" "`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " "always correctly rounded\"." msgstr "" -#: ../../library/decimal.rst:1369 +#: ../../library/decimal.rst:1385 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1372 +#: ../../library/decimal.rst:1388 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1373 +#: ../../library/decimal.rst:1389 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1374 +#: ../../library/decimal.rst:1390 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1375 +#: ../../library/decimal.rst:1391 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1377 +#: ../../library/decimal.rst:1393 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1380,110 +1398,110 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1387 +#: ../../library/decimal.rst:1403 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1392 +#: ../../library/decimal.rst:1408 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1397 +#: ../../library/decimal.rst:1413 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1399 +#: ../../library/decimal.rst:1415 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1405 +#: ../../library/decimal.rst:1421 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: ../../library/decimal.rst:1411 +#: ../../library/decimal.rst:1427 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1416 +#: ../../library/decimal.rst:1432 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1421 +#: ../../library/decimal.rst:1437 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1426 +#: ../../library/decimal.rst:1442 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1431 +#: ../../library/decimal.rst:1447 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1436 +#: ../../library/decimal.rst:1452 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1450 +#: ../../library/decimal.rst:1466 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1455 +#: ../../library/decimal.rst:1471 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1462 +#: ../../library/decimal.rst:1478 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1464 +#: ../../library/decimal.rst:1480 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: ../../library/decimal.rst:1468 +#: ../../library/decimal.rst:1484 msgid "32-bit" msgstr "" -#: ../../library/decimal.rst:1468 +#: ../../library/decimal.rst:1484 msgid "64-bit" msgstr "" -#: ../../library/decimal.rst:1470 ../../library/decimal.rst:1472 +#: ../../library/decimal.rst:1486 ../../library/decimal.rst:1488 msgid ":const:`425000000`" msgstr ":const:`425000000`" -#: ../../library/decimal.rst:1470 ../../library/decimal.rst:1472 +#: ../../library/decimal.rst:1486 ../../library/decimal.rst:1488 msgid ":const:`999999999999999999`" msgstr ":const:`999999999999999999`" -#: ../../library/decimal.rst:1474 +#: ../../library/decimal.rst:1490 msgid ":const:`-425000000`" msgstr ":const:`-425000000`" -#: ../../library/decimal.rst:1474 +#: ../../library/decimal.rst:1490 msgid ":const:`-999999999999999999`" msgstr ":const:`-999999999999999999`" -#: ../../library/decimal.rst:1476 +#: ../../library/decimal.rst:1492 msgid ":const:`-849999999`" msgstr ":const:`-849999999`" -#: ../../library/decimal.rst:1476 +#: ../../library/decimal.rst:1492 msgid ":const:`-1999999999999999997`" msgstr ":const:`-1999999999999999997`" -#: ../../library/decimal.rst:1482 +#: ../../library/decimal.rst:1498 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1488 +#: ../../library/decimal.rst:1504 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1492,59 +1510,59 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1493 +#: ../../library/decimal.rst:1509 msgid "backported to 3.7 and 3.8." msgstr "" -#: ../../library/decimal.rst:1497 +#: ../../library/decimal.rst:1513 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1501 +#: ../../library/decimal.rst:1517 msgid "Round towards :const:`Infinity`." msgstr "" -#: ../../library/decimal.rst:1505 +#: ../../library/decimal.rst:1521 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1509 +#: ../../library/decimal.rst:1525 msgid "Round towards :const:`-Infinity`." msgstr "" -#: ../../library/decimal.rst:1513 +#: ../../library/decimal.rst:1529 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1517 +#: ../../library/decimal.rst:1533 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1521 +#: ../../library/decimal.rst:1537 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1525 +#: ../../library/decimal.rst:1541 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1529 +#: ../../library/decimal.rst:1545 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: ../../library/decimal.rst:1536 +#: ../../library/decimal.rst:1552 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1538 +#: ../../library/decimal.rst:1554 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1541 +#: ../../library/decimal.rst:1557 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -1552,7 +1570,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1546 +#: ../../library/decimal.rst:1562 msgid "" "If the context's trap enabler is set for the signal, then the condition " "causes a Python exception to be raised. For example, if the :class:" @@ -1560,26 +1578,26 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1554 +#: ../../library/decimal.rst:1570 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1556 +#: ../../library/decimal.rst:1572 msgid "" "Typically, clamping occurs when an exponent falls outside the context's :" "attr:`Emin` and :attr:`Emax` limits. If possible, the exponent is reduced " "to fit by adding zeros to the coefficient." msgstr "" -#: ../../library/decimal.rst:1563 +#: ../../library/decimal.rst:1579 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1568 +#: ../../library/decimal.rst:1584 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1570 +#: ../../library/decimal.rst:1586 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns :const:`Infinity` " @@ -1587,32 +1605,32 @@ msgid "" "calculation." msgstr "" -#: ../../library/decimal.rst:1577 +#: ../../library/decimal.rst:1593 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1579 +#: ../../library/decimal.rst:1595 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: ../../library/decimal.rst:1586 +#: ../../library/decimal.rst:1602 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1588 +#: ../../library/decimal.rst:1604 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns :const:`NaN`. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1604 +#: ../../library/decimal.rst:1620 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1606 +#: ../../library/decimal.rst:1622 msgid "" "Indicates the exponent is larger than :attr:`Emax` after rounding has " "occurred. If not trapped, the result depends on the rounding mode, either " @@ -1621,11 +1639,11 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1615 +#: ../../library/decimal.rst:1631 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1617 +#: ../../library/decimal.rst:1633 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding :const:`5.00` to :const:`5.0`). If not trapped, returns " @@ -1633,31 +1651,31 @@ msgid "" "digits." msgstr "" -#: ../../library/decimal.rst:1625 +#: ../../library/decimal.rst:1641 msgid "Exponent was lower than :attr:`Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1627 +#: ../../library/decimal.rst:1643 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1633 +#: ../../library/decimal.rst:1649 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1635 +#: ../../library/decimal.rst:1651 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1641 +#: ../../library/decimal.rst:1657 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1643 +#: ../../library/decimal.rst:1659 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -1668,26 +1686,26 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1651 +#: ../../library/decimal.rst:1667 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " "conversions are silent. All other mixed operations raise :exc:" "`FloatOperation`." msgstr "" -#: ../../library/decimal.rst:1655 +#: ../../library/decimal.rst:1671 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1676 +#: ../../library/decimal.rst:1692 msgid "Floating Point Notes" msgstr "" -#: ../../library/decimal.rst:1680 +#: ../../library/decimal.rst:1696 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1682 +#: ../../library/decimal.rst:1698 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent :const:`0.1` exactly); however, some " @@ -1695,7 +1713,7 @@ msgid "" "fixed precision." msgstr "" -#: ../../library/decimal.rst:1686 +#: ../../library/decimal.rst:1702 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -1704,24 +1722,24 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1710 +#: ../../library/decimal.rst:1726 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: ../../library/decimal.rst:1730 +#: ../../library/decimal.rst:1746 msgid "Special values" msgstr "" -#: ../../library/decimal.rst:1732 +#: ../../library/decimal.rst:1748 msgid "" "The number system for the :mod:`decimal` module provides special values " "including :const:`NaN`, :const:`sNaN`, :const:`-Infinity`, :const:" "`Infinity`, and two zeros, :const:`+0` and :const:`-0`." msgstr "" -#: ../../library/decimal.rst:1736 +#: ../../library/decimal.rst:1752 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -1730,14 +1748,14 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1741 +#: ../../library/decimal.rst:1757 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: ../../library/decimal.rst:1745 +#: ../../library/decimal.rst:1761 msgid "" "Some operations are indeterminate and return :const:`NaN`, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -1748,14 +1766,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1753 +#: ../../library/decimal.rst:1769 msgid "" "A variant is :const:`sNaN` which signals rather than remaining quiet after " "every operation. This is a useful return value when an invalid result needs " "to interrupt a calculation for special handling." msgstr "" -#: ../../library/decimal.rst:1757 +#: ../../library/decimal.rst:1773 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a :const:`NaN` is involved. A test for equality where one of the " @@ -1772,7 +1790,7 @@ msgid "" "methods instead." msgstr "" -#: ../../library/decimal.rst:1770 +#: ../../library/decimal.rst:1786 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -1780,7 +1798,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1775 +#: ../../library/decimal.rst:1791 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -1789,11 +1807,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1790 +#: ../../library/decimal.rst:1806 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1792 +#: ../../library/decimal.rst:1808 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -1801,20 +1819,20 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1796 +#: ../../library/decimal.rst:1812 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1799 +#: ../../library/decimal.rst:1815 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " "current thread." msgstr "" -#: ../../library/decimal.rst:1803 +#: ../../library/decimal.rst:1819 msgid "" "The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " @@ -1823,50 +1841,50 @@ msgid "" "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1828 +#: ../../library/decimal.rst:1844 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1830 +#: ../../library/decimal.rst:1846 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: ../../library/decimal.rst:1985 +#: ../../library/decimal.rst:2001 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:1987 +#: ../../library/decimal.rst:2003 msgid "" "Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: ../../library/decimal.rst:1990 +#: ../../library/decimal.rst:2006 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:1996 +#: ../../library/decimal.rst:2012 msgid "" "Q. In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: ../../library/decimal.rst:2000 +#: ../../library/decimal.rst:2016 msgid "" "A. The :meth:`quantize` method rounds to a fixed number of decimal places. " "If the :const:`Inexact` trap is set, it is also useful for validation:" msgstr "" -#: ../../library/decimal.rst:2018 +#: ../../library/decimal.rst:2034 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2021 +#: ../../library/decimal.rst:2037 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -1874,13 +1892,13 @@ msgid "" "places and need to be followed-up with a :meth:`quantize` step:" msgstr "" -#: ../../library/decimal.rst:2039 +#: ../../library/decimal.rst:2055 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`quantize` step:" msgstr "" -#: ../../library/decimal.rst:2052 +#: ../../library/decimal.rst:2068 msgid "" "Q. There are many ways to express the same value. The numbers :const:" "`200`, :const:`200.000`, :const:`2E2`, and :const:`.02E+4` all have the same " @@ -1888,19 +1906,19 @@ msgid "" "recognizable canonical value?" msgstr "" -#: ../../library/decimal.rst:2057 +#: ../../library/decimal.rst:2073 msgid "" "A. The :meth:`normalize` method maps all equivalent values to a single " "representative:" msgstr "" -#: ../../library/decimal.rst:2064 +#: ../../library/decimal.rst:2080 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2067 +#: ../../library/decimal.rst:2083 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing :" @@ -1908,31 +1926,31 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2072 +#: ../../library/decimal.rst:2088 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: ../../library/decimal.rst:2082 +#: ../../library/decimal.rst:2098 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2084 +#: ../../library/decimal.rst:2100 msgid "" "A. Yes, any binary floating point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: ../../library/decimal.rst:2093 +#: ../../library/decimal.rst:2109 msgid "" "Q. Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: ../../library/decimal.rst:2096 +#: ../../library/decimal.rst:2112 msgid "" "A. The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " @@ -1940,14 +1958,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2101 +#: ../../library/decimal.rst:2117 msgid "" "Q. I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: ../../library/decimal.rst:2105 +#: ../../library/decimal.rst:2121 msgid "" "A. Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " @@ -1956,23 +1974,23 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2118 +#: ../../library/decimal.rst:2134 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2127 +#: ../../library/decimal.rst:2143 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2133 +#: ../../library/decimal.rst:2149 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2135 +#: ../../library/decimal.rst:2151 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,7 +28,7 @@ msgstr ":mod:`dis` --- Python bytecode的反組譯器" msgid "**Source code:** :source:`Lib/dis.py`" msgstr "**原始碼:**\\ :source:`Lib/dis.py`" -#: ../../library/dis.rst:11 +#: ../../library/dis.rst:17 msgid "" "The :mod:`dis` module supports the analysis of CPython :term:`bytecode` by " "disassembling it. The CPython bytecode which this module takes as an input " @@ -38,7 +38,7 @@ msgstr "" ":mod:`dis` 模組支援反組譯分析 CPython :term:`bytecode`。CPython bytecode 作為" "輸入的模組被定義於 :file:`Include/opcode.h` 並且被編譯器和直譯器所使用。" -#: ../../library/dis.rst:18 +#: ../../library/dis.rst:24 msgid "" "Bytecode is an implementation detail of the CPython interpreter. No " "guarantees are made that bytecode will not be added, removed, or changed " @@ -46,58 +46,66 @@ msgid "" "work across Python VMs or Python releases." msgstr "" -#: ../../library/dis.rst:23 +#: ../../library/dis.rst:29 msgid "" "Use 2 bytes for each instruction. Previously the number of bytes varied by " "instruction." msgstr "" -#: ../../library/dis.rst:27 +#: ../../library/dis.rst:33 msgid "" "The argument of jump, exception handling and loop instructions is now the " "instruction offset rather than the byte offset." msgstr "" -#: ../../library/dis.rst:32 +#: ../../library/dis.rst:37 +msgid "" +"Some instructions are accompanied by one or more inline cache entries, which " +"take the form of :opcode:`CACHE` instructions. These instructions are hidden " +"by default, but can be shown by passing ``show_caches=True`` to any :mod:" +"`dis` utility." +msgstr "" + +#: ../../library/dis.rst:44 msgid "Example: Given the function :func:`myfunc`::" msgstr "" -#: ../../library/dis.rst:37 +#: ../../library/dis.rst:49 msgid "" "the following command can be used to display the disassembly of :func:" -"`myfunc`::" +"`myfunc`:" msgstr "" -#: ../../library/dis.rst:46 +#: ../../library/dis.rst:63 msgid "(The \"2\" is a line number)." msgstr "" -#: ../../library/dis.rst:49 +#: ../../library/dis.rst:66 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:53 +#: ../../library/dis.rst:70 msgid "" "The bytecode analysis API allows pieces of Python code to be wrapped in a :" "class:`Bytecode` object that provides easy access to details of the compiled " "code." msgstr "" -#: ../../library/dis.rst:60 +#: ../../library/dis.rst:77 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:64 +#: ../../library/dis.rst:81 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:68 ../../library/dis.rst:229 +#: ../../library/dis.rst:85 ../../library/dis.rst:262 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -105,56 +113,59 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:73 +#: ../../library/dis.rst:90 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:79 +#: ../../library/dis.rst:96 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:84 +#: ../../library/dis.rst:101 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:88 +#: ../../library/dis.rst:105 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:92 +#: ../../library/dis.rst:109 msgid "" "Return a formatted view of the bytecode operations (the same as printed by :" "func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:97 +#: ../../library/dis.rst:114 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:100 ../../library/dis.rst:134 -#: ../../library/dis.rst:180 +#: ../../library/dis.rst:117 ../../library/dis.rst:158 +#: ../../library/dis.rst:204 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:103 -msgid "Example::" -msgstr "" -"範例:\n" -"\n" -"::" +#: ../../library/dis.rst:120 ../../library/dis.rst:207 +#: ../../library/dis.rst:223 ../../library/dis.rst:250 +#: ../../library/dis.rst:269 +msgid "Added the ``show_caches`` parameter." +msgstr "新增 ``show_caches`` 參數。" + +#: ../../library/dis.rst:123 +msgid "Example:" +msgstr "範例:" -#: ../../library/dis.rst:116 +#: ../../library/dis.rst:140 msgid "Analysis functions" msgstr "" -#: ../../library/dis.rst:118 +#: ../../library/dis.rst:142 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -162,39 +173,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:124 +#: ../../library/dis.rst:148 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:128 +#: ../../library/dis.rst:152 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:140 +#: ../../library/dis.rst:164 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:144 +#: ../../library/dis.rst:168 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:149 ../../library/dis.rst:174 -#: ../../library/dis.rst:193 ../../library/dis.rst:217 +#: ../../library/dis.rst:173 ../../library/dis.rst:198 +#: ../../library/dis.rst:220 ../../library/dis.rst:247 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:155 +#: ../../library/dis.rst:179 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -209,110 +220,110 @@ msgid "" "provided, this function disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:168 ../../library/dis.rst:190 -#: ../../library/dis.rst:214 +#: ../../library/dis.rst:192 ../../library/dis.rst:217 +#: ../../library/dis.rst:244 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:171 +#: ../../library/dis.rst:195 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:177 +#: ../../library/dis.rst:201 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:186 +#: ../../library/dis.rst:213 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:200 +#: ../../library/dis.rst:230 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:203 +#: ../../library/dis.rst:233 msgid "the line number, for the first instruction of each line" msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:234 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:205 +#: ../../library/dis.rst:235 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:206 +#: ../../library/dis.rst:236 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:207 +#: ../../library/dis.rst:237 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:208 +#: ../../library/dis.rst:238 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:209 +#: ../../library/dis.rst:239 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:211 +#: ../../library/dis.rst:241 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:223 +#: ../../library/dis.rst:256 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:226 +#: ../../library/dis.rst:259 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:239 +#: ../../library/dis.rst:275 msgid "" "This generator function uses the ``co_lines`` method of the code object " "*code* to find the offsets which are starts of lines in the source code. " "They are generated as ``(offset, lineno)`` pairs." msgstr "" -#: ../../library/dis.rst:243 +#: ../../library/dis.rst:279 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:246 +#: ../../library/dis.rst:282 msgid "" "The :pep:`626` ``co_lines`` method is used instead of the ``co_firstlineno`` " "and ``co_lnotab`` attributes of the code object." msgstr "" -#: ../../library/dis.rst:253 +#: ../../library/dis.rst:289 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:259 +#: ../../library/dis.rst:295 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:261 +#: ../../library/dis.rst:297 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -320,209 +331,173 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:268 +#: ../../library/dis.rst:304 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:275 +#: ../../library/dis.rst:311 msgid "Python Bytecode Instructions" msgstr "" -#: ../../library/dis.rst:277 +#: ../../library/dis.rst:313 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:282 +#: ../../library/dis.rst:318 msgid "Details for a bytecode operation" msgstr "" -#: ../../library/dis.rst:286 +#: ../../library/dis.rst:322 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:292 +#: ../../library/dis.rst:328 msgid "human readable name for operation" msgstr "" -#: ../../library/dis.rst:297 +#: ../../library/dis.rst:333 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:302 -msgid "resolved arg value (if known), otherwise same as arg" +#: ../../library/dis.rst:338 +msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:307 -msgid "human readable description of operation argument" +#: ../../library/dis.rst:343 +msgid "" +"human readable description of operation argument (if any), otherwise an " +"empty string." msgstr "" -#: ../../library/dis.rst:312 +#: ../../library/dis.rst:349 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:317 +#: ../../library/dis.rst:354 msgid "line started by this opcode (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:322 +#: ../../library/dis.rst:359 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:327 +#: ../../library/dis.rst:364 +msgid "" +":class:`dis.Positions` object holding the start and end locations that are " +"covered by this instruction." +msgstr "" + +#: ../../library/dis.rst:371 +msgid "Field ``positions`` is added." +msgstr "" + +#: ../../library/dis.rst:376 +msgid "In case the information is not available, some fields might be `None`." +msgstr "" + +#: ../../library/dis.rst:386 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:330 +#: ../../library/dis.rst:389 msgid "**General instructions**" msgstr "" -#: ../../library/dis.rst:334 -msgid "Do nothing code. Used as a placeholder by the bytecode optimizer." +#: ../../library/dis.rst:393 +msgid "" +"Do nothing code. Used as a placeholder by the bytecode optimizer, and to " +"generate line tracing events." msgstr "" -#: ../../library/dis.rst:339 +#: ../../library/dis.rst:399 msgid "Removes the top-of-stack (TOS) item." msgstr "" -#: ../../library/dis.rst:344 -msgid "Swaps the two top-most stack items." +#: ../../library/dis.rst:404 +msgid "" +"Push the *i*-th item to the top of the stack. The item is not removed from " +"its original location." msgstr "" -#: ../../library/dis.rst:349 -msgid "" -"Lifts second and third stack item one position up, moves top down to " -"position three." +#: ../../library/dis.rst:412 +msgid "Swap TOS with the item at position *i*." msgstr "" -#: ../../library/dis.rst:355 +#: ../../library/dis.rst:419 msgid "" -"Lifts second, third and fourth stack items one position up, moves top down " -"to position four." +"Rather than being an actual instruction, this opcode is used to mark extra " +"space for the interpreter to cache useful data directly in the bytecode " +"itself. It is automatically hidden by all ``dis`` utilities, but can be " +"viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:363 -msgid "Duplicates the reference on top of the stack." +#: ../../library/dis.rst:424 +msgid "" +"Logically, this space is part of the preceding instruction. Many opcodes " +"expect to be followed by an exact number of caches, and will instruct the " +"interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:370 +#: ../../library/dis.rst:428 msgid "" -"Duplicates the two references on top of the stack, leaving them in the same " -"order." +"Populated caches can look like arbitrary instructions, so great care should " +"be taken when reading or modifying raw, adaptive bytecode containing " +"quickened data." msgstr "" -#: ../../library/dis.rst:376 +#: ../../library/dis.rst:435 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:378 +#: ../../library/dis.rst:437 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:383 +#: ../../library/dis.rst:442 msgid "Implements ``TOS = +TOS``." msgstr "" -#: ../../library/dis.rst:388 +#: ../../library/dis.rst:447 msgid "Implements ``TOS = -TOS``." msgstr "" -#: ../../library/dis.rst:393 +#: ../../library/dis.rst:452 msgid "Implements ``TOS = not TOS``." msgstr "" -#: ../../library/dis.rst:398 +#: ../../library/dis.rst:457 msgid "Implements ``TOS = ~TOS``." msgstr "" -#: ../../library/dis.rst:403 +#: ../../library/dis.rst:462 msgid "Implements ``TOS = iter(TOS)``." msgstr "" -#: ../../library/dis.rst:408 +#: ../../library/dis.rst:467 msgid "" "If ``TOS`` is a :term:`generator iterator` or :term:`coroutine` object it is " "left as is. Otherwise, implements ``TOS = iter(TOS)``." msgstr "" -#: ../../library/dis.rst:414 -msgid "**Binary operations**" +#: ../../library/dis.rst:473 +msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:416 +#: ../../library/dis.rst:475 msgid "" "Binary operations remove the top of the stack (TOS) and the second top-most " "stack item (TOS1) from the stack. They perform the operation, and put the " "result back on the stack." msgstr "" -#: ../../library/dis.rst:422 -msgid "Implements ``TOS = TOS1 ** TOS``." -msgstr "" - -#: ../../library/dis.rst:427 -msgid "Implements ``TOS = TOS1 * TOS``." -msgstr "" - -#: ../../library/dis.rst:432 -msgid "Implements ``TOS = TOS1 @ TOS``." -msgstr "" - -#: ../../library/dis.rst:439 -msgid "Implements ``TOS = TOS1 // TOS``." -msgstr "" - -#: ../../library/dis.rst:444 -msgid "Implements ``TOS = TOS1 / TOS``." -msgstr "" - -#: ../../library/dis.rst:449 -msgid "Implements ``TOS = TOS1 % TOS``." -msgstr "" - -#: ../../library/dis.rst:454 -msgid "Implements ``TOS = TOS1 + TOS``." -msgstr "" - -#: ../../library/dis.rst:459 -msgid "Implements ``TOS = TOS1 - TOS``." -msgstr "" - -#: ../../library/dis.rst:464 -msgid "Implements ``TOS = TOS1[TOS]``." -msgstr "" - -#: ../../library/dis.rst:469 -msgid "Implements ``TOS = TOS1 << TOS``." -msgstr "" - -#: ../../library/dis.rst:474 -msgid "Implements ``TOS = TOS1 >> TOS``." -msgstr "" - #: ../../library/dis.rst:479 -msgid "Implements ``TOS = TOS1 & TOS``." -msgstr "" - -#: ../../library/dis.rst:484 -msgid "Implements ``TOS = TOS1 ^ TOS``." -msgstr "" - -#: ../../library/dis.rst:489 -msgid "Implements ``TOS = TOS1 | TOS``." -msgstr "" - -#: ../../library/dis.rst:492 -msgid "**In-place operations**" -msgstr "" - -#: ../../library/dis.rst:494 msgid "" "In-place operations are like binary operations, in that they remove TOS and " "TOS1, and push the result back on the stack, but the operation is done in-" @@ -530,142 +505,120 @@ msgid "" "to be) the original TOS1." msgstr "" -#: ../../library/dis.rst:501 -msgid "Implements in-place ``TOS = TOS1 ** TOS``." -msgstr "" - -#: ../../library/dis.rst:506 -msgid "Implements in-place ``TOS = TOS1 * TOS``." -msgstr "" - -#: ../../library/dis.rst:511 -msgid "Implements in-place ``TOS = TOS1 @ TOS``." -msgstr "" - -#: ../../library/dis.rst:518 -msgid "Implements in-place ``TOS = TOS1 // TOS``." -msgstr "" - -#: ../../library/dis.rst:523 -msgid "Implements in-place ``TOS = TOS1 / TOS``." -msgstr "" - -#: ../../library/dis.rst:528 -msgid "Implements in-place ``TOS = TOS1 % TOS``." -msgstr "" - -#: ../../library/dis.rst:533 -msgid "Implements in-place ``TOS = TOS1 + TOS``." -msgstr "" - -#: ../../library/dis.rst:538 -msgid "Implements in-place ``TOS = TOS1 - TOS``." +#: ../../library/dis.rst:487 +msgid "" +"Implements the binary and in-place operators (depending on the value of " +"*op*)." msgstr "" -#: ../../library/dis.rst:543 -msgid "Implements in-place ``TOS = TOS1 << TOS``." +#: ../../library/dis.rst:495 +msgid "Implements ``TOS = TOS1[TOS]``." msgstr "" -#: ../../library/dis.rst:548 -msgid "Implements in-place ``TOS = TOS1 >> TOS``." +#: ../../library/dis.rst:500 +msgid "Implements ``TOS1[TOS] = TOS2``." msgstr "" -#: ../../library/dis.rst:553 -msgid "Implements in-place ``TOS = TOS1 & TOS``." +#: ../../library/dis.rst:505 +msgid "Implements ``del TOS1[TOS]``." msgstr "" -#: ../../library/dis.rst:558 -msgid "Implements in-place ``TOS = TOS1 ^ TOS``." +#: ../../library/dis.rst:508 +msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:563 -msgid "Implements in-place ``TOS = TOS1 | TOS``." +#: ../../library/dis.rst:512 +msgid "" +"Implements ``TOS = get_awaitable(TOS)``, where ``get_awaitable(o)`` returns " +"``o`` if ``o`` is a coroutine object or a generator object with the " +"CO_ITERABLE_COROUTINE flag, or resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:568 -msgid "Implements ``TOS1[TOS] = TOS2``." +#: ../../library/dis.rst:517 +msgid "" +"If the ``where`` operand is nonzero, it indicates where the instruction " +"occurs:" msgstr "" -#: ../../library/dis.rst:573 -msgid "Implements ``del TOS1[TOS]``." +#: ../../library/dis.rst:520 +msgid "``1`` After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:576 -msgid "**Coroutine opcodes**" +#: ../../library/dis.rst:521 +msgid "``2`` After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:580 -msgid "" -"Implements ``TOS = get_awaitable(TOS)``, where ``get_awaitable(o)`` returns " -"``o`` if ``o`` is a coroutine object or a generator object with the " -"CO_ITERABLE_COROUTINE flag, or resolves ``o.__await__``." +#: ../../library/dis.rst:525 +msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:590 +#: ../../library/dis.rst:531 msgid "Implements ``TOS = TOS.__aiter__()``." msgstr "" -#: ../../library/dis.rst:593 +#: ../../library/dis.rst:534 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:600 +#: ../../library/dis.rst:541 msgid "" "Pushes ``get_awaitable(TOS.__anext__())`` to the stack. See " "``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:608 +#: ../../library/dis.rst:549 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " -"awaiting a next item. If TOS is :exc:`StopAsyncIteration` pop 7 values from " -"the stack and restore the exception state using the second three of them. " -"Otherwise re-raise the exception using the three values from the stack. An " +"awaiting a next item. If TOS is :exc:`StopAsyncIteration` pop 3 values from " +"the stack and restore the exception state using the second of them. " +"Otherwise re-raise the exception using the value from the stack. An " "exception handler block is removed from the block stack." msgstr "" -#: ../../library/dis.rst:619 +#: ../../library/dis.rst:557 ../../library/dis.rst:635 +#: ../../library/dis.rst:646 msgid "" -"Resolves ``__aenter__`` and ``__aexit__`` from the object on top of the " -"stack. Pushes ``__aexit__`` and result of ``__aenter__()`` to the stack." +"Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:627 -msgid "Creates a new frame object." +#: ../../library/dis.rst:562 +msgid "" +"Resolves ``__aenter__`` and ``__aexit__`` from the object on top of the " +"stack. Pushes ``__aexit__`` and result of ``__aenter__()`` to the stack." msgstr "" -#: ../../library/dis.rst:633 +#: ../../library/dis.rst:569 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:637 +#: ../../library/dis.rst:573 msgid "" "Implements the expression statement for the interactive mode. TOS is " "removed from the stack and printed. In non-interactive mode, an expression " "statement is terminated with :opcode:`POP_TOP`." msgstr "" -#: ../../library/dis.rst:644 +#: ../../library/dis.rst:580 msgid "" "Calls ``set.add(TOS1[-i], TOS)``. Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:649 +#: ../../library/dis.rst:585 msgid "" "Calls ``list.append(TOS1[-i], TOS)``. Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:654 +#: ../../library/dis.rst:590 msgid "" "Calls ``dict.__setitem__(TOS1[-i], TOS1, TOS)``. Used to implement dict " "comprehensions." msgstr "" -#: ../../library/dis.rst:658 +#: ../../library/dis.rst:594 msgid "Map value is TOS and map key is TOS1. Before, those were reversed." msgstr "" -#: ../../library/dis.rst:661 +#: ../../library/dis.rst:597 msgid "" "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" "`MAP_ADD` instructions, while the added value or key/value pair is popped " @@ -673,19 +626,15 @@ msgid "" "further iterations of the loop." msgstr "" -#: ../../library/dis.rst:669 +#: ../../library/dis.rst:605 msgid "Returns with TOS to the caller of the function." msgstr "" -#: ../../library/dis.rst:674 +#: ../../library/dis.rst:610 msgid "Pops TOS and yields it from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:679 -msgid "Pops TOS and delegates to it as a subiterator from a :term:`generator`." -msgstr "" - -#: ../../library/dis.rst:686 +#: ../../library/dis.rst:616 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -693,78 +642,101 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:696 +#: ../../library/dis.rst:626 msgid "" "Loads all symbols not starting with ``'_'`` directly from the module TOS to " "the local namespace. The module is popped after loading all names. This " "opcode implements ``from module import *``." msgstr "" -#: ../../library/dis.rst:703 +#: ../../library/dis.rst:633 msgid "" -"Removes one block from the block stack. Per frame, there is a stack of " -"blocks, denoting :keyword:`try` statements, and such." +"Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:709 +#: ../../library/dis.rst:640 msgid "" -"Removes one block from the block stack. The popped block must be an " -"exception handler block, as implicitly created when entering an except " -"handler. In addition to popping extraneous values from the frame stack, the " -"last three popped values are used to restore the exception state." +"Re-raises the exception currently on top of the stack. If oparg is non-zero, " +"pops an additional value from the stack which is used to set ``f_lasti`` of " +"the current frame." msgstr "" -#: ../../library/dis.rst:717 +#: ../../library/dis.rst:651 msgid "" -"Re-raises the exception currently on top of the stack. If oparg is non-zero, " -"restores ``f_lasti`` of the current frame to its value when the exception " -"was raised." +"Pops a value from the stack. Pushes the current exception to the top of the " +"stack. Pushes the value originally popped back to the stack. Used in " +"exception handlers." msgstr "" -#: ../../library/dis.rst:725 +#: ../../library/dis.rst:659 msgid "" -"Calls the function in position 7 on the stack with the top three items on " -"the stack as arguments. Used to implement the call ``context_manager." -"__exit__(*exc_info())`` when an exception has occurred in a :keyword:`with` " -"statement." +"Performs exception matching for ``except``. Tests whether the TOS1 is an " +"exception matching TOS. Pops TOS and pushes the boolean result of the test." +msgstr "" + +#: ../../library/dis.rst:666 +msgid "" +"Performs exception matching for ``except*``. Applies ``split(TOS)`` on the " +"exception group representing TOS1." +msgstr "" + +#: ../../library/dis.rst:669 +msgid "" +"In case of a match, pops two items from the stack and pushes the non-" +"matching subgroup (``None`` in case of full match) followed by the matching " +"subgroup. When there is no match, pops one item (the match type) and pushes " +"``None``." +msgstr "" + +#: ../../library/dis.rst:678 +msgid "" +"Combines the raised and reraised exceptions list from TOS, into an exception " +"group to propagate from a try-except* block. Uses the original exception " +"group from TOS1 to reconstruct the structure of reraised exceptions. Pops " +"two items from the stack and pushes the exception to reraise or ``None`` if " +"there isn't one." +msgstr "" + +#: ../../library/dis.rst:688 +msgid "" +"Calls the function in position 4 on the stack with arguments (type, val, tb) " +"representing the exception at the top of the stack. Used to implement the " +"call ``context_manager.__exit__(*exc_info())`` when an exception has " +"occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:735 +#: ../../library/dis.rst:695 +msgid "" +"The ``__exit__`` function is in position 4 of the stack rather than 7. " +"Exception representation on the stack now consist of one, not three, items." +msgstr "" + +#: ../../library/dis.rst:702 msgid "" "Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " "statement." msgstr "" -#: ../../library/dis.rst:743 +#: ../../library/dis.rst:710 msgid "" "Pushes :func:`builtins.__build_class__` onto the stack. It is later called " -"by :opcode:`CALL_FUNCTION` to construct a class." +"to construct a class." msgstr "" -#: ../../library/dis.rst:749 +#: ../../library/dis.rst:716 msgid "" "This opcode performs several operations before a with block starts. First, " "it loads :meth:`~object.__exit__` from the context manager and pushes it " "onto the stack for later use by :opcode:`WITH_EXCEPT_START`. Then, :meth:" -"`~object.__enter__` is called, and a finally block pointing to *delta* is " -"pushed. Finally, the result of calling the ``__enter__()`` method is pushed " -"onto the stack. The next opcode will either ignore it (:opcode:`POP_TOP`), " -"or store it in (a) variable(s) (:opcode:`STORE_FAST`, :opcode:`STORE_NAME`, " -"or :opcode:`UNPACK_SEQUENCE`)." +"`~object.__enter__` is called. Finally, the result of calling the " +"``__enter__()`` method is pushed onto the stack." msgstr "" -#: ../../library/dis.rst:763 -msgid "" -"TOS is a tuple of mapping keys, and TOS1 is the match subject. Replace TOS " -"with a :class:`dict` formed from the items of TOS1, but without any of the " -"keys in TOS." -msgstr "" - -#: ../../library/dis.rst:772 +#: ../../library/dis.rst:727 msgid "Push ``len(TOS)`` onto the stack." msgstr "" -#: ../../library/dis.rst:779 +#: ../../library/dis.rst:734 msgid "" "If TOS is an instance of :class:`collections.abc.Mapping` (or, more " "technically: if it has the :const:`Py_TPFLAGS_MAPPING` flag set in its :c:" @@ -772,7 +744,7 @@ msgid "" "push ``False``." msgstr "" -#: ../../library/dis.rst:789 +#: ../../library/dis.rst:744 msgid "" "If TOS is an instance of :class:`collections.abc.Sequence` and is *not* an " "instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, more " @@ -781,38 +753,39 @@ msgid "" "push ``False``." msgstr "" -#: ../../library/dis.rst:799 +#: ../../library/dis.rst:754 msgid "" "TOS is a tuple of mapping keys, and TOS1 is the match subject. If TOS1 " "contains all of the keys in TOS, push a :class:`tuple` containing the " -"corresponding values, followed by ``True``. Otherwise, push ``None``, " -"followed by ``False``." +"corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:807 -msgid "All of the following opcodes use their arguments." +#: ../../library/dis.rst:760 ../../library/dis.rst:1305 +msgid "" +"Previously, this instruction also pushed a boolean value indicating success " +"(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:811 +#: ../../library/dis.rst:767 msgid "" "Implements ``name = TOS``. *namei* is the index of *name* in the attribute :" "attr:`co_names` of the code object. The compiler tries to use :opcode:" "`STORE_FAST` or :opcode:`STORE_GLOBAL` if possible." msgstr "" -#: ../../library/dis.rst:818 +#: ../../library/dis.rst:774 msgid "" "Implements ``del name``, where *namei* is the index into :attr:`co_names` " "attribute of the code object." msgstr "" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:780 msgid "" "Unpacks TOS into *count* individual values, which are put onto the stack " "right-to-left." msgstr "" -#: ../../library/dis.rst:830 +#: ../../library/dis.rst:786 msgid "" "Implements assignment with a starred target: Unpacks an iterable in TOS into " "individual values, where the total number of values can be smaller than the " @@ -820,119 +793,119 @@ msgid "" "leftover items." msgstr "" -#: ../../library/dis.rst:835 +#: ../../library/dis.rst:791 msgid "" "The low byte of *counts* is the number of values before the list value, the " "high byte of *counts* the number of values after it. The resulting values " "are put onto the stack right-to-left." msgstr "" -#: ../../library/dis.rst:842 +#: ../../library/dis.rst:798 msgid "" "Implements ``TOS.name = TOS1``, where *namei* is the index of name in :attr:" "`co_names`." msgstr "" -#: ../../library/dis.rst:848 +#: ../../library/dis.rst:804 msgid "" "Implements ``del TOS.name``, using *namei* as index into :attr:`co_names`." msgstr "" -#: ../../library/dis.rst:853 +#: ../../library/dis.rst:809 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:858 +#: ../../library/dis.rst:814 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:863 +#: ../../library/dis.rst:819 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:868 +#: ../../library/dis.rst:824 msgid "Pushes the value associated with ``co_names[namei]`` onto the stack." msgstr "" -#: ../../library/dis.rst:873 +#: ../../library/dis.rst:829 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack." msgstr "" -#: ../../library/dis.rst:879 +#: ../../library/dis.rst:835 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:884 +#: ../../library/dis.rst:840 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:889 +#: ../../library/dis.rst:845 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., TOS3: TOS2, TOS1: TOS}``." msgstr "" -#: ../../library/dis.rst:893 +#: ../../library/dis.rst:849 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:900 +#: ../../library/dis.rst:856 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``TOS1``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:909 +#: ../../library/dis.rst:865 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:917 +#: ../../library/dis.rst:873 msgid "" "Pops a list from the stack and pushes a tuple containing the same values." msgstr "" -#: ../../library/dis.rst:924 +#: ../../library/dis.rst:880 msgid "Calls ``list.extend(TOS1[-i], TOS)``. Used to build lists." msgstr "" -#: ../../library/dis.rst:931 +#: ../../library/dis.rst:887 msgid "Calls ``set.update(TOS1[-i], TOS)``. Used to build sets." msgstr "" -#: ../../library/dis.rst:938 +#: ../../library/dis.rst:894 msgid "Calls ``dict.update(TOS1[-i], TOS)``. Used to build dicts." msgstr "" -#: ../../library/dis.rst:945 +#: ../../library/dis.rst:901 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:952 +#: ../../library/dis.rst:908 msgid "Replaces TOS with ``getattr(TOS, co_names[namei])``." msgstr "" -#: ../../library/dis.rst:957 +#: ../../library/dis.rst:913 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname]``." msgstr "" -#: ../../library/dis.rst:963 +#: ../../library/dis.rst:919 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:970 +#: ../../library/dis.rst:926 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:977 +#: ../../library/dis.rst:933 msgid "" "Imports the module ``co_names[namei]``. TOS and TOS1 are popped and provide " "the *fromlist* and *level* arguments of :func:`__import__`. The module " @@ -941,48 +914,86 @@ msgid "" "modifies the namespace." msgstr "" -#: ../../library/dis.rst:986 +#: ../../library/dis.rst:942 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in TOS. The " "resulting object is pushed onto the stack, to be subsequently stored by a :" "opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:993 +#: ../../library/dis.rst:949 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:998 -msgid "If TOS is true, sets the bytecode counter to *target*. TOS is popped." +#: ../../library/dis.rst:954 +msgid "Decrements bytecode counter by *delta*. Checks for interrupts." +msgstr "" + +#: ../../library/dis.rst:961 +msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1005 -msgid "If TOS is false, sets the bytecode counter to *target*. TOS is popped." +#: ../../library/dis.rst:968 +msgid "" +"If TOS is true, increments the bytecode counter by *delta*. TOS is popped." +msgstr "" + +#: ../../library/dis.rst:975 +msgid "" +"If TOS is true, decrements the bytecode counter by *delta*. TOS is popped." msgstr "" -#: ../../library/dis.rst:1011 +#: ../../library/dis.rst:982 msgid "" -"Tests whether the second value on the stack is an exception matching TOS, " -"and jumps if it is not. Pops two values from the stack." +"If TOS is false, increments the bytecode counter by *delta*. TOS is popped." msgstr "" -#: ../../library/dis.rst:1019 +#: ../../library/dis.rst:989 msgid "" -"If TOS is true, sets the bytecode counter to *target* and leaves TOS on the " -"stack. Otherwise (TOS is false), TOS is popped." +"If TOS is false, decrements the bytecode counter by *delta*. TOS is popped." msgstr "" -#: ../../library/dis.rst:1027 +#: ../../library/dis.rst:996 msgid "" -"If TOS is false, sets the bytecode counter to *target* and leaves TOS on the " -"stack. Otherwise (TOS is true), TOS is popped." +"If TOS is not ``None``, increments the bytecode counter by *delta*. TOS is " +"popped." msgstr "" -#: ../../library/dis.rst:1035 -msgid "Set bytecode counter to *target*." +#: ../../library/dis.rst:1003 +msgid "" +"If TOS is not ``None``, decrements the bytecode counter by *delta*. TOS is " +"popped." +msgstr "" + +#: ../../library/dis.rst:1010 +msgid "" +"If TOS is ``None``, increments the bytecode counter by *delta*. TOS is " +"popped." +msgstr "" + +#: ../../library/dis.rst:1017 +msgid "" +"If TOS is ``None``, decrements the bytecode counter by *delta*. TOS is " +"popped." msgstr "" -#: ../../library/dis.rst:1040 +#: ../../library/dis.rst:1024 +msgid "" +"If TOS is true, increments the bytecode counter by *delta* and leaves TOS on " +"the stack. Otherwise (TOS is false), TOS is popped." +msgstr "" + +#: ../../library/dis.rst:1029 ../../library/dis.rst:1039 +msgid "The oparg is now a relative delta rather than an absolute target." +msgstr "" + +#: ../../library/dis.rst:1034 +msgid "" +"If TOS is false, increments the bytecode counter by *delta* and leaves TOS " +"on the stack. Otherwise (TOS is true), TOS is popped." +msgstr "" + +#: ../../library/dis.rst:1045 msgid "" "TOS is an :term:`iterator`. Call its :meth:`~iterator.__next__` method. If " "this yields a new value, push it on the stack (leaving the iterator below " @@ -990,117 +1001,153 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1048 -msgid "Loads the global named ``co_names[namei]`` onto the stack." +#: ../../library/dis.rst:1053 +msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1053 +#: ../../library/dis.rst:1055 msgid "" -"Pushes a try block from a try-finally or try-except clause onto the block " -"stack. *delta* points to the finally block or the first except block." +"If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " +"before the global variable." msgstr "" -#: ../../library/dis.rst:1059 +#: ../../library/dis.rst:1061 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1064 +#: ../../library/dis.rst:1066 msgid "Stores TOS into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1069 +#: ../../library/dis.rst:1071 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1074 +#: ../../library/dis.rst:1076 msgid "" -"Pushes a reference to the cell contained in slot *i* of the cell and free " -"variable storage. The name of the variable is ``co_cellvars[i]`` if *i* is " -"less than the length of *co_cellvars*. Otherwise it is ``co_freevars[i - " -"len(co_cellvars)]``." +"Creates a new cell in slot ``i``. If that slot is empty then that value is " +"stored into the new cell." msgstr "" -#: ../../library/dis.rst:1082 +#: ../../library/dis.rst:1084 msgid "" -"Loads the cell contained in slot *i* of the cell and free variable storage. " +"Pushes a reference to the cell contained in slot ``i`` of the \"fast locals" +"\" storage. The name of the variable is ``co_fastlocalnames[i]``." +msgstr "" + +#: ../../library/dis.rst:1087 +msgid "" +"Note that ``LOAD_CLOSURE`` is effectively an alias for ``LOAD_FAST``. It " +"exists to keep bytecode a little more readable." +msgstr "" + +#: ../../library/dis.rst:1090 ../../library/dis.rst:1099 +#: ../../library/dis.rst:1111 ../../library/dis.rst:1120 +#: ../../library/dis.rst:1131 +msgid "``i`` is no longer offset by the length of ``co_varnames``." +msgstr "" + +#: ../../library/dis.rst:1096 +msgid "" +"Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1088 +#: ../../library/dis.rst:1105 msgid "" "Much like :opcode:`LOAD_DEREF` but first checks the locals dictionary before " "consulting the cell. This is used for loading free variables in class " "bodies." msgstr "" -#: ../../library/dis.rst:1097 +#: ../../library/dis.rst:1117 msgid "" -"Stores TOS into the cell contained in slot *i* of the cell and free variable " +"Stores TOS into the cell contained in slot ``i`` of the \"fast locals\" " "storage." msgstr "" -#: ../../library/dis.rst:1103 +#: ../../library/dis.rst:1126 msgid "" -"Empties the cell contained in slot *i* of the cell and free variable " -"storage. Used by the :keyword:`del` statement." +"Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " +"Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1111 +#: ../../library/dis.rst:1137 +msgid "" +"Copies the ``n`` free variables from the closure into the frame. Removes the " +"need for special code on the caller's side when calling closures." +msgstr "" + +#: ../../library/dis.rst:1146 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1114 +#: ../../library/dis.rst:1149 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1115 +#: ../../library/dis.rst:1150 msgid "1: ``raise TOS`` (raise exception instance or type at ``TOS``)" msgstr "" -#: ../../library/dis.rst:1116 +#: ../../library/dis.rst:1151 msgid "" "2: ``raise TOS1 from TOS`` (raise exception instance or type at ``TOS1`` " "with ``__cause__`` set to ``TOS``)" msgstr "" -#: ../../library/dis.rst:1122 +#: ../../library/dis.rst:1157 msgid "" -"Calls a callable object with positional arguments. *argc* indicates the " -"number of positional arguments. The top of the stack contains positional " -"arguments, with the right-most argument on top. Below the arguments is a " -"callable object to call. ``CALL_FUNCTION`` pops all arguments and the " -"callable object off the stack, calls the callable object with those " -"arguments, and pushes the return value returned by the callable object." +"Calls a callable object with the number of arguments specified by ``argc``, " +"including the named arguments specified by the preceding :opcode:`KW_NAMES`, " +"if any. On the stack are (in ascending order), either:" +msgstr "" + +#: ../../library/dis.rst:1162 +msgid "NULL" +msgstr "" + +#: ../../library/dis.rst:1163 ../../library/dis.rst:1169 +msgid "The callable" +msgstr "" + +#: ../../library/dis.rst:1164 +msgid "The positional arguments" msgstr "" -#: ../../library/dis.rst:1130 -msgid "This opcode is used only for calls with positional arguments." +#: ../../library/dis.rst:1165 ../../library/dis.rst:1172 +msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1136 +#: ../../library/dis.rst:1167 +msgid "or:" +msgstr "" + +#: ../../library/dis.rst:1170 +msgid "``self``" +msgstr "" + +#: ../../library/dis.rst:1171 +msgid "The remaining positional arguments" +msgstr "" + +#: ../../library/dis.rst:1174 msgid "" -"Calls a callable object with positional (if any) and keyword arguments. " -"*argc* indicates the total number of positional and keyword arguments. The " -"top element on the stack contains a tuple with the names of the keyword " -"arguments, which must be strings. Below that are the values for the keyword " -"arguments, in the order corresponding to the tuple. Below that are " -"positional arguments, with the right-most parameter on top. Below the " -"arguments is a callable object to call. ``CALL_FUNCTION_KW`` pops all " -"arguments and the callable object off the stack, calls the callable object " -"with those arguments, and pushes the return value returned by the callable " -"object." +"``argc`` is the total of the positional and named arguments, excluding " +"``self`` when a ``NULL`` is not present." msgstr "" -#: ../../library/dis.rst:1148 +#: ../../library/dis.rst:1177 msgid "" -"Keyword arguments are packed in a tuple instead of a dictionary, *argc* " -"indicates the total number of arguments." +"``CALL`` pops all arguments and the callable object off the stack, calls the " +"callable object with those arguments, and pushes the return value returned " +"by the callable object." msgstr "" -#: ../../library/dis.rst:1155 +#: ../../library/dis.rst:1186 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1112,70 +1159,80 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1170 +#: ../../library/dis.rst:1201 msgid "" "Loads a method named ``co_names[namei]`` from the TOS object. TOS is popped. " "This bytecode distinguishes two cases: if TOS has a method with the correct " "name, the bytecode pushes the unbound method and TOS. TOS will be used as " -"the first argument (``self``) by :opcode:`CALL_METHOD` when calling the " -"unbound method. Otherwise, ``NULL`` and the object return by the attribute " -"lookup are pushed." +"the first argument (``self``) by :opcode:`CALL` when calling the unbound " +"method. Otherwise, ``NULL`` and the object return by the attribute lookup " +"are pushed." +msgstr "" + +#: ../../library/dis.rst:1213 +msgid "" +"Prefixes :opcode:`CALL`. Logically this is a no op. It exists to enable " +"effective specialization of calls. ``argc`` is the number of arguments as " +"described in :opcode:`CALL`." +msgstr "" + +#: ../../library/dis.rst:1222 +msgid "" +"Pushes a ``NULL`` to the stack. Used in the call sequence to match the " +"``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1182 +#: ../../library/dis.rst:1231 msgid "" -"Calls a method. *argc* is the number of positional arguments. Keyword " -"arguments are not supported. This opcode is designed to be used with :" -"opcode:`LOAD_METHOD`. Positional arguments are on top of the stack. Below " -"them, the two items described in :opcode:`LOAD_METHOD` are on the stack " -"(either ``self`` and an unbound method object or ``NULL`` and an arbitrary " -"callable). All of them are popped and the return value is pushed." +"Prefixes :opcode:`PRECALL`. Stores a reference to ``co_consts[consti]`` into " +"an internal variable for use by :opcode:`CALL`. ``co_consts[consti]`` must " +"be a tuple of strings." msgstr "" -#: ../../library/dis.rst:1194 +#: ../../library/dis.rst:1240 msgid "" "Pushes a new function object on the stack. From bottom to top, the consumed " "stack must consist of values if the argument carries a specified flag value" msgstr "" -#: ../../library/dis.rst:1197 +#: ../../library/dis.rst:1243 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1199 +#: ../../library/dis.rst:1245 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1200 +#: ../../library/dis.rst:1246 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1201 +#: ../../library/dis.rst:1247 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1202 +#: ../../library/dis.rst:1248 msgid "the code associated with the function (at TOS1)" msgstr "" -#: ../../library/dis.rst:1203 +#: ../../library/dis.rst:1249 msgid "the :term:`qualified name` of the function (at TOS)" msgstr "" -#: ../../library/dis.rst:1205 +#: ../../library/dis.rst:1251 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1212 +#: ../../library/dis.rst:1258 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "``slice(TOS1, TOS)`` is pushed; if it is 3, ``slice(TOS2, TOS1, TOS)`` is " "pushed. See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1219 +#: ../../library/dis.rst:1265 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1183,113 +1240,142 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1227 +#: ../../library/dis.rst:1273 msgid "" "Used for implementing formatted literal strings (f-strings). Pops an " "optional *fmt_spec* from the stack, then a required *value*. *flags* is " "interpreted as follows:" msgstr "" -#: ../../library/dis.rst:1231 +#: ../../library/dis.rst:1277 msgid "``(flags & 0x03) == 0x00``: *value* is formatted as-is." msgstr "" -#: ../../library/dis.rst:1232 +#: ../../library/dis.rst:1278 msgid "" "``(flags & 0x03) == 0x01``: call :func:`str` on *value* before formatting it." msgstr "" -#: ../../library/dis.rst:1234 +#: ../../library/dis.rst:1280 msgid "" "``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before formatting " "it." msgstr "" -#: ../../library/dis.rst:1236 +#: ../../library/dis.rst:1282 msgid "" "``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before formatting " "it." msgstr "" -#: ../../library/dis.rst:1238 +#: ../../library/dis.rst:1284 msgid "" "``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use it, else " "use an empty *fmt_spec*." msgstr "" -#: ../../library/dis.rst:1241 +#: ../../library/dis.rst:1287 msgid "" "Formatting is performed using :c:func:`PyObject_Format`. The result is " "pushed on the stack." msgstr "" -#: ../../library/dis.rst:1249 +#: ../../library/dis.rst:1295 msgid "" "TOS is a tuple of keyword attribute names, TOS1 is the class being matched " "against, and TOS2 is the match subject. *count* is the number of positional " "sub-patterns." msgstr "" -#: ../../library/dis.rst:1253 +#: ../../library/dis.rst:1299 msgid "" -"Pop TOS. If TOS2 is an instance of TOS1 and has the positional and keyword " -"attributes required by *count* and TOS, set TOS to ``True`` and TOS1 to a " -"tuple of extracted attributes. Otherwise, set TOS to ``False``." +"Pop TOS, TOS1, and TOS2. If TOS2 is an instance of TOS1 and has the " +"positional and keyword attributes required by *count* and TOS, push a tuple " +"of extracted attributes. Otherwise, push ``None``." +msgstr "" + +#: ../../library/dis.rst:1312 +msgid "A no-op. Performs internal tracing, debugging and optimization checks." +msgstr "" + +#: ../../library/dis.rst:1314 +msgid "The ``where`` operand marks where the ``RESUME`` occurs:" +msgstr "" + +#: ../../library/dis.rst:1316 +msgid "``0`` The start of a function" msgstr "" -#: ../../library/dis.rst:1261 +#: ../../library/dis.rst:1317 +msgid "``1`` After a ``yield`` expression" +msgstr "" + +#: ../../library/dis.rst:1318 +msgid "``2`` After a ``yield from`` expression" +msgstr "" + +#: ../../library/dis.rst:1319 +msgid "``3`` After an ``await`` expression" +msgstr "" + +#: ../../library/dis.rst:1326 msgid "" -"Pops TOS. The ``kind`` operand corresponds to the type of generator or " -"coroutine. The legal kinds are 0 for generator, 1 for coroutine, and 2 for " -"async generator." +"Create a generator, coroutine, or async generator from the current frame. " +"Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1270 +#: ../../library/dis.rst:1334 msgid "" -"Lift the top *count* stack items one position up, and move TOS down to " -"position *count*." +"Sends ``None`` to the sub-generator of this generator. Used in ``yield " +"from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1278 +#: ../../library/dis.rst:1342 +msgid "" +"Wraps the value on top of the stack in an ``async_generator_wrapped_value``. " +"Used to yield in async generators." +msgstr "" + +#: ../../library/dis.rst:1350 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes which don't use their argument and those that do (``< " "HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1282 +#: ../../library/dis.rst:1354 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1290 +#: ../../library/dis.rst:1362 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1292 +#: ../../library/dis.rst:1364 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1297 +#: ../../library/dis.rst:1369 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1302 +#: ../../library/dis.rst:1374 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1307 +#: ../../library/dis.rst:1379 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1312 +#: ../../library/dis.rst:1384 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1317 +#: ../../library/dis.rst:1389 msgid "" "Sequence of bytecodes that access a free variable (note that 'free' in this " "context refers to names in the current scope that are referenced by inner " @@ -1297,22 +1383,22 @@ msgid "" "does *not* include references to global or builtin scopes)." msgstr "" -#: ../../library/dis.rst:1325 +#: ../../library/dis.rst:1397 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1330 +#: ../../library/dis.rst:1402 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1335 +#: ../../library/dis.rst:1407 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1340 +#: ../../library/dis.rst:1412 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1345 +#: ../../library/dis.rst:1417 msgid "Sequence of bytecodes of Boolean operations." msgstr "" diff --git a/library/doctest.po b/library/doctest.po index 9d07ed1ab5..4231c527a4 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -461,8 +461,8 @@ msgstr "" #: ../../library/doctest.rst:484 msgid "" -"For some :exc:`SyntaxError`\\ s, Python displays the character position of " -"the syntax error, using a ``^`` marker::" +"For some exceptions, Python displays the position of the error using ``^`` " +"markers and tildes::" msgstr "" #: ../../library/doctest.rst:493 @@ -473,11 +473,11 @@ msgid "" "location::" msgstr "" -#: ../../library/doctest.rst:509 +#: ../../library/doctest.rst:508 msgid "Option Flags" msgstr "" -#: ../../library/doctest.rst:511 +#: ../../library/doctest.rst:510 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" @@ -487,17 +487,17 @@ msgid "" "option." msgstr "" -#: ../../library/doctest.rst:517 +#: ../../library/doctest.rst:516 msgid "The ``-o`` command line option." msgstr "" -#: ../../library/doctest.rst:520 +#: ../../library/doctest.rst:519 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" -#: ../../library/doctest.rst:526 +#: ../../library/doctest.rst:525 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " @@ -509,7 +509,7 @@ msgid "" "not for several years." msgstr "" -#: ../../library/doctest.rst:538 +#: ../../library/doctest.rst:537 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " @@ -518,7 +518,7 @@ msgid "" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" -#: ../../library/doctest.rst:547 +#: ../../library/doctest.rst:546 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -528,7 +528,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: ../../library/doctest.rst:558 +#: ../../library/doctest.rst:557 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -537,14 +537,14 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: ../../library/doctest.rst:567 +#: ../../library/doctest.rst:566 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" -#: ../../library/doctest.rst:571 +#: ../../library/doctest.rst:570 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -554,20 +554,20 @@ msgid "" "these variations will work with the flag specified:" msgstr "" -#: ../../library/doctest.rst:593 +#: ../../library/doctest.rst:592 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" -#: ../../library/doctest.rst:597 +#: ../../library/doctest.rst:596 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: ../../library/doctest.rst:604 +#: ../../library/doctest.rst:603 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " @@ -576,32 +576,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: ../../library/doctest.rst:610 +#: ../../library/doctest.rst:609 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: ../../library/doctest.rst:615 +#: ../../library/doctest.rst:614 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: ../../library/doctest.rst:617 +#: ../../library/doctest.rst:616 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: ../../library/doctest.rst:622 +#: ../../library/doctest.rst:621 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: ../../library/doctest.rst:628 +#: ../../library/doctest.rst:627 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: ../../library/doctest.rst:634 +#: ../../library/doctest.rst:633 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -611,7 +611,7 @@ msgid "" "mismatching column positions." msgstr "" -#: ../../library/doctest.rst:643 +#: ../../library/doctest.rst:642 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -622,7 +622,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: ../../library/doctest.rst:654 +#: ../../library/doctest.rst:653 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " @@ -630,23 +630,23 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: ../../library/doctest.rst:659 +#: ../../library/doctest.rst:658 msgid "" "The doctest command line accepts the option ``-f`` as a shorthand for ``-o " "FAIL_FAST``." msgstr "" -#: ../../library/doctest.rst:667 +#: ../../library/doctest.rst:666 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: ../../library/doctest.rst:670 +#: ../../library/doctest.rst:669 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" -#: ../../library/doctest.rst:676 +#: ../../library/doctest.rst:675 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" @@ -655,35 +655,35 @@ msgid "" "be called using the following idiom::" msgstr "" -#: ../../library/doctest.rst:692 +#: ../../library/doctest.rst:691 msgid "Directives" msgstr "" -#: ../../library/doctest.rst:694 +#: ../../library/doctest.rst:693 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -#: ../../library/doctest.rst:705 +#: ../../library/doctest.rst:704 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" -#: ../../library/doctest.rst:709 +#: ../../library/doctest.rst:708 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" -#: ../../library/doctest.rst:712 +#: ../../library/doctest.rst:711 msgid "For example, this test passes:" msgstr "" -#: ../../library/doctest.rst:721 +#: ../../library/doctest.rst:720 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " @@ -691,26 +691,26 @@ msgid "" "a directive to do so:" msgstr "" -#: ../../library/doctest.rst:732 +#: ../../library/doctest.rst:731 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: ../../library/doctest.rst:741 +#: ../../library/doctest.rst:740 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: ../../library/doctest.rst:751 +#: ../../library/doctest.rst:750 msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" -#: ../../library/doctest.rst:762 +#: ../../library/doctest.rst:761 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " @@ -720,11 +720,11 @@ msgid "" "be useful." msgstr "" -#: ../../library/doctest.rst:772 +#: ../../library/doctest.rst:771 msgid "Warnings" msgstr "" -#: ../../library/doctest.rst:774 +#: ../../library/doctest.rst:773 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " @@ -734,51 +734,51 @@ msgid "" "test like ::" msgstr "" -#: ../../library/doctest.rst:783 +#: ../../library/doctest.rst:782 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: ../../library/doctest.rst:788 +#: ../../library/doctest.rst:787 msgid "instead. Another is to do ::" msgstr "" -#: ../../library/doctest.rst:794 +#: ../../library/doctest.rst:793 msgid "There are others, but you get the idea." msgstr "" -#: ../../library/doctest.rst:796 +#: ../../library/doctest.rst:795 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: ../../library/doctest.rst:806 +#: ../../library/doctest.rst:805 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: ../../library/doctest.rst:814 +#: ../../library/doctest.rst:813 msgid "" "Floating-point numbers are also subject to small output variations across " "platforms, because Python defers to the platform C library for float " "formatting, and C libraries vary widely in quality here. ::" msgstr "" -#: ../../library/doctest.rst:825 +#: ../../library/doctest.rst:824 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" -#: ../../library/doctest.rst:831 +#: ../../library/doctest.rst:830 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: ../../library/doctest.rst:838 +#: ../../library/doctest.rst:837 msgid "Basic API" msgstr "" -#: ../../library/doctest.rst:840 +#: ../../library/doctest.rst:839 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -786,25 +786,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: ../../library/doctest.rst:848 +#: ../../library/doctest.rst:847 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:851 +#: ../../library/doctest.rst:850 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: ../../library/doctest.rst:854 +#: ../../library/doctest.rst:853 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: ../../library/doctest.rst:857 +#: ../../library/doctest.rst:856 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -814,20 +814,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: ../../library/doctest.rst:864 +#: ../../library/doctest.rst:863 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:868 +#: ../../library/doctest.rst:867 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" -#: ../../library/doctest.rst:871 +#: ../../library/doctest.rst:870 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" @@ -836,7 +836,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: ../../library/doctest.rst:877 +#: ../../library/doctest.rst:876 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " @@ -844,7 +844,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: ../../library/doctest.rst:882 +#: ../../library/doctest.rst:881 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -857,27 +857,27 @@ msgid "" "tested." msgstr "" -#: ../../library/doctest.rst:891 +#: ../../library/doctest.rst:890 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" "v'`` is in ``sys.argv``." msgstr "" -#: ../../library/doctest.rst:895 +#: ../../library/doctest.rst:894 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" -#: ../../library/doctest.rst:899 +#: ../../library/doctest.rst:898 msgid "" "Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR " "` of option flags. See section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:903 +#: ../../library/doctest.rst:902 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " @@ -885,33 +885,33 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:908 ../../library/doctest.rst:1048 +#: ../../library/doctest.rst:907 ../../library/doctest.rst:1047 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:912 ../../library/doctest.rst:1052 +#: ../../library/doctest.rst:911 ../../library/doctest.rst:1051 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: ../../library/doctest.rst:918 +#: ../../library/doctest.rst:917 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:921 +#: ../../library/doctest.rst:920 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" -#: ../../library/doctest.rst:925 +#: ../../library/doctest.rst:924 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists and is " "not ``None``. ``m.__test__`` maps names (strings) to functions, classes and " @@ -919,22 +919,22 @@ msgid "" "are searched directly, as if they were docstrings." msgstr "" -#: ../../library/doctest.rst:930 +#: ../../library/doctest.rst:929 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: ../../library/doctest.rst:932 +#: ../../library/doctest.rst:931 msgid "Return ``(failure_count, test_count)``." msgstr "" -#: ../../library/doctest.rst:934 +#: ../../library/doctest.rst:933 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:937 +#: ../../library/doctest.rst:936 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " @@ -944,39 +944,39 @@ msgid "" "class:`DocTestFinder` constructor defaults to true." msgstr "" -#: ../../library/doctest.rst:944 +#: ../../library/doctest.rst:943 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" -#: ../../library/doctest.rst:951 +#: ../../library/doctest.rst:950 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" -#: ../../library/doctest.rst:954 +#: ../../library/doctest.rst:953 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: ../../library/doctest.rst:956 +#: ../../library/doctest.rst:955 msgid "" "Optional argument *name* is used in failure messages, and defaults to ``" "\"NoName\"``." msgstr "" -#: ../../library/doctest.rst:959 +#: ../../library/doctest.rst:958 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" -#: ../../library/doctest.rst:962 +#: ../../library/doctest.rst:961 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " @@ -984,16 +984,16 @@ msgid "" "found in *globs*." msgstr "" -#: ../../library/doctest.rst:966 +#: ../../library/doctest.rst:965 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: ../../library/doctest.rst:972 +#: ../../library/doctest.rst:971 msgid "Unittest API" msgstr "" -#: ../../library/doctest.rst:974 +#: ../../library/doctest.rst:973 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " @@ -1002,19 +1002,19 @@ msgid "" "discovery, include a :func:`load_tests` function in your test module::" msgstr "" -#: ../../library/doctest.rst:988 +#: ../../library/doctest.rst:987 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: ../../library/doctest.rst:994 +#: ../../library/doctest.rst:993 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" -#: ../../library/doctest.rst:997 +#: ../../library/doctest.rst:996 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " @@ -1023,21 +1023,21 @@ msgid "" "containing the test and a (sometimes approximate) line number." msgstr "" -#: ../../library/doctest.rst:1003 +#: ../../library/doctest.rst:1002 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1005 +#: ../../library/doctest.rst:1004 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1007 +#: ../../library/doctest.rst:1006 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1010 +#: ../../library/doctest.rst:1009 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1048,14 +1048,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1018 +#: ../../library/doctest.rst:1017 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1022 +#: ../../library/doctest.rst:1021 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1065,7 +1065,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1029 +#: ../../library/doctest.rst:1028 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1073,7 +1073,7 @@ msgid "" "test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1034 +#: ../../library/doctest.rst:1033 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1081,14 +1081,14 @@ msgid "" "access the test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1039 ../../library/doctest.rst:1073 +#: ../../library/doctest.rst:1038 ../../library/doctest.rst:1072 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1043 +#: ../../library/doctest.rst:1042 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1096,17 +1096,17 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1055 +#: ../../library/doctest.rst:1054 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1061 +#: ../../library/doctest.rst:1060 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1063 +#: ../../library/doctest.rst:1062 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " @@ -1115,42 +1115,42 @@ msgid "" "(sometimes approximate) line number." msgstr "" -#: ../../library/doctest.rst:1069 +#: ../../library/doctest.rst:1068 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1077 +#: ../../library/doctest.rst:1076 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1080 +#: ../../library/doctest.rst:1079 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1083 +#: ../../library/doctest.rst:1082 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -#: ../../library/doctest.rst:1086 +#: ../../library/doctest.rst:1085 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1088 +#: ../../library/doctest.rst:1087 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1093 +#: ../../library/doctest.rst:1092 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`doctest.DocTestCase` instances, and :class:`DocTestCase` is a " @@ -1159,14 +1159,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1099 +#: ../../library/doctest.rst:1098 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`doctest.DocFileCase` instances, and :class:`DocFileCase` is a " "subclass of :class:`DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1103 +#: ../../library/doctest.rst:1102 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`DocTestCase`. This is important for a subtle reason: when you run :" @@ -1179,23 +1179,23 @@ msgid "" "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1113 +#: ../../library/doctest.rst:1112 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1119 +#: ../../library/doctest.rst:1118 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1121 +#: ../../library/doctest.rst:1120 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1124 +#: ../../library/doctest.rst:1123 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` " @@ -1209,17 +1209,17 @@ msgid "" "`doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1135 +#: ../../library/doctest.rst:1134 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1142 +#: ../../library/doctest.rst:1141 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1144 +#: ../../library/doctest.rst:1143 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1227,85 +1227,85 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1149 +#: ../../library/doctest.rst:1148 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1152 +#: ../../library/doctest.rst:1151 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1155 +#: ../../library/doctest.rst:1154 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1158 +#: ../../library/doctest.rst:1157 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1161 +#: ../../library/doctest.rst:1160 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1165 +#: ../../library/doctest.rst:1164 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1168 +#: ../../library/doctest.rst:1167 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1171 +#: ../../library/doctest.rst:1170 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1174 +#: ../../library/doctest.rst:1173 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1190 +#: ../../library/doctest.rst:1189 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1195 +#: ../../library/doctest.rst:1194 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1199 +#: ../../library/doctest.rst:1198 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1205 +#: ../../library/doctest.rst:1204 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1211 +#: ../../library/doctest.rst:1210 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1313,57 +1313,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1219 +#: ../../library/doctest.rst:1218 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1225 +#: ../../library/doctest.rst:1224 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1232 +#: ../../library/doctest.rst:1231 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1239 +#: ../../library/doctest.rst:1238 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1246 +#: ../../library/doctest.rst:1245 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1251 +#: ../../library/doctest.rst:1250 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1256 +#: ../../library/doctest.rst:1255 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1262 +#: ../../library/doctest.rst:1261 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1269 +#: ../../library/doctest.rst:1268 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1371,7 +1371,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1277 +#: ../../library/doctest.rst:1276 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1380,20 +1380,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1286 +#: ../../library/doctest.rst:1285 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1293 +#: ../../library/doctest.rst:1292 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1299 +#: ../../library/doctest.rst:1298 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1402,11 +1402,11 @@ msgid "" "are set." msgstr "" -#: ../../library/doctest.rst:1308 +#: ../../library/doctest.rst:1307 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1313 +#: ../../library/doctest.rst:1312 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1414,48 +1414,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1318 +#: ../../library/doctest.rst:1317 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1321 +#: ../../library/doctest.rst:1320 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1324 +#: ../../library/doctest.rst:1323 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1327 +#: ../../library/doctest.rst:1326 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1331 +#: ../../library/doctest.rst:1330 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: ../../library/doctest.rst:1336 +#: ../../library/doctest.rst:1335 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1339 +#: ../../library/doctest.rst:1338 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1343 +#: ../../library/doctest.rst:1342 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -1463,26 +1463,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1347 +#: ../../library/doctest.rst:1346 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1349 +#: ../../library/doctest.rst:1348 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1353 +#: ../../library/doctest.rst:1352 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1355 +#: ../../library/doctest.rst:1354 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1357 +#: ../../library/doctest.rst:1356 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -1491,7 +1491,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1363 +#: ../../library/doctest.rst:1362 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -1501,34 +1501,34 @@ msgid "" "defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1374 +#: ../../library/doctest.rst:1373 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1379 +#: ../../library/doctest.rst:1378 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1383 ../../library/doctest.rst:1451 +#: ../../library/doctest.rst:1382 ../../library/doctest.rst:1450 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1388 +#: ../../library/doctest.rst:1387 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1391 +#: ../../library/doctest.rst:1390 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1398 +#: ../../library/doctest.rst:1397 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -1536,7 +1536,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1405 +#: ../../library/doctest.rst:1404 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -1544,17 +1544,17 @@ msgid "" "name identifying this string, and is only used for error messages." msgstr "" -#: ../../library/doctest.rst:1414 +#: ../../library/doctest.rst:1413 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1419 +#: ../../library/doctest.rst:1418 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1422 +#: ../../library/doctest.rst:1421 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -1564,7 +1564,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1428 +#: ../../library/doctest.rst:1427 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`TestRunner.run`; this function will " @@ -1575,14 +1575,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1436 +#: ../../library/doctest.rst:1435 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1440 +#: ../../library/doctest.rst:1439 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -1591,56 +1591,56 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1446 +#: ../../library/doctest.rst:1445 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1456 +#: ../../library/doctest.rst:1455 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1460 +#: ../../library/doctest.rst:1459 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1467 +#: ../../library/doctest.rst:1466 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1471 ../../library/doctest.rst:1482 +#: ../../library/doctest.rst:1470 ../../library/doctest.rst:1481 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1478 +#: ../../library/doctest.rst:1477 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1489 +#: ../../library/doctest.rst:1488 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1493 +#: ../../library/doctest.rst:1492 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -1648,13 +1648,13 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1501 +#: ../../library/doctest.rst:1500 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*." msgstr "" -#: ../../library/doctest.rst:1504 +#: ../../library/doctest.rst:1503 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -1662,39 +1662,39 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1509 +#: ../../library/doctest.rst:1508 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1513 +#: ../../library/doctest.rst:1512 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1520 +#: ../../library/doctest.rst:1519 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :term:`named tuple` ``TestResults(failed, " "attempted)``." msgstr "" -#: ../../library/doctest.rst:1523 +#: ../../library/doctest.rst:1522 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1530 +#: ../../library/doctest.rst:1529 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1535 +#: ../../library/doctest.rst:1534 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -1703,11 +1703,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1542 +#: ../../library/doctest.rst:1541 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1546 +#: ../../library/doctest.rst:1545 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -1716,28 +1716,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1555 +#: ../../library/doctest.rst:1554 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1563 +#: ../../library/doctest.rst:1562 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1565 +#: ../../library/doctest.rst:1564 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1567 +#: ../../library/doctest.rst:1566 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1570 +#: ../../library/doctest.rst:1569 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -1745,13 +1745,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1575 +#: ../../library/doctest.rst:1574 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1578 +#: ../../library/doctest.rst:1577 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -1759,21 +1759,21 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1593 +#: ../../library/doctest.rst:1592 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1626 +#: ../../library/doctest.rst:1625 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1632 +#: ../../library/doctest.rst:1631 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1634 +#: ../../library/doctest.rst:1633 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -1781,22 +1781,22 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1649 +#: ../../library/doctest.rst:1648 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1659 +#: ../../library/doctest.rst:1658 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1666 +#: ../../library/doctest.rst:1665 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1668 +#: ../../library/doctest.rst:1667 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -1806,17 +1806,17 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`f`, then ::" msgstr "" -#: ../../library/doctest.rst:1678 +#: ../../library/doctest.rst:1677 msgid "" "prints a script version of function :func:`f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1684 +#: ../../library/doctest.rst:1683 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1686 +#: ../../library/doctest.rst:1685 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -1824,13 +1824,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1691 +#: ../../library/doctest.rst:1690 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1694 +#: ../../library/doctest.rst:1693 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -1842,30 +1842,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1705 +#: ../../library/doctest.rst:1704 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1707 +#: ../../library/doctest.rst:1706 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1710 +#: ../../library/doctest.rst:1709 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1712 +#: ../../library/doctest.rst:1711 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1717 +#: ../../library/doctest.rst:1716 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -1873,7 +1873,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1725 +#: ../../library/doctest.rst:1724 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -1883,89 +1883,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1732 +#: ../../library/doctest.rst:1731 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1735 +#: ../../library/doctest.rst:1734 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1740 +#: ../../library/doctest.rst:1739 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1744 +#: ../../library/doctest.rst:1743 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1749 ../../library/doctest.rst:1773 +#: ../../library/doctest.rst:1748 ../../library/doctest.rst:1772 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1754 ../../library/doctest.rst:1778 +#: ../../library/doctest.rst:1753 ../../library/doctest.rst:1777 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1759 +#: ../../library/doctest.rst:1758 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1764 +#: ../../library/doctest.rst:1763 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1768 +#: ../../library/doctest.rst:1767 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1783 +#: ../../library/doctest.rst:1782 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1790 +#: ../../library/doctest.rst:1789 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1792 +#: ../../library/doctest.rst:1791 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1795 +#: ../../library/doctest.rst:1794 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1797 +#: ../../library/doctest.rst:1796 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1799 +#: ../../library/doctest.rst:1798 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1801 +#: ../../library/doctest.rst:1800 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1805 +#: ../../library/doctest.rst:1804 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -1977,7 +1977,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1813 +#: ../../library/doctest.rst:1812 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -1998,13 +1998,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1831 +#: ../../library/doctest.rst:1830 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1834 +#: ../../library/doctest.rst:1833 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2012,7 +2012,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1839 +#: ../../library/doctest.rst:1838 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2020,13 +2020,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1843 +#: ../../library/doctest.rst:1842 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1846 +#: ../../library/doctest.rst:1845 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2034,11 +2034,11 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1868 +#: ../../library/doctest.rst:1867 msgid "Footnotes" msgstr "註解" -#: ../../library/doctest.rst:1869 +#: ../../library/doctest.rst:1868 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " diff --git a/library/email.charset.po b/library/email.charset.po index 1d921a61c3..ebd63c7956 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,15 +98,15 @@ msgstr "" #: ../../library/email.charset.rst:60 msgid "" "If the character set must be encoded before it can be used in an email " -"header, this attribute will be set to ``charset.QP`` (for quoted-printable), " -"``charset.BASE64`` (for base64 encoding), or ``charset.SHORTEST`` for the " +"header, this attribute will be set to ``Charset.QP`` (for quoted-printable), " +"``Charset.BASE64`` (for base64 encoding), or ``Charset.SHORTEST`` for the " "shortest of QP or BASE64 encoding. Otherwise, it will be ``None``." msgstr "" #: ../../library/email.charset.rst:69 msgid "" "Same as *header_encoding*, but describes the encoding for the mail message's " -"body, which indeed may be different than the header encoding. ``charset." +"body, which indeed may be different than the header encoding. ``Charset." "SHORTEST`` is not allowed for *body_encoding*." msgstr "" @@ -240,8 +240,8 @@ msgstr "" #: ../../library/email.charset.rst:178 msgid "" -"Optional *header_enc* and *body_enc* is either ``charset.QP`` for quoted-" -"printable, ``charset.BASE64`` for base64 encoding, ``charset.SHORTEST`` for " +"Optional *header_enc* and *body_enc* is either ``Charset.QP`` for quoted-" +"printable, ``Charset.BASE64`` for base64 encoding, ``Charset.SHORTEST`` for " "the shortest of quoted-printable or base64 encoding, or ``None`` for no " "encoding. ``SHORTEST`` is only valid for *header_enc*. The default is " "``None`` for no encoding." diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index 89fbfe129f..c2bf9bfa5b 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -256,8 +256,9 @@ msgstr "" msgid "" "The ``decoded`` value of the header will have all encoded words decoded to " "unicode. :class:`~encodings.idna` encoded domain names are also decoded to " -"unicode. The ``decoded`` value is set by :attr:`~str.join`\\ ing the :class:" -"`str` value of the elements of the ``groups`` attribute with ``', '``." +"unicode. The ``decoded`` value is set by :ref:`joining ` " +"the :class:`str` value of the elements of the ``groups`` attribute with ``', " +"'``." msgstr "" #: ../../library/email.headerregistry.rst:213 diff --git a/library/email.mime.po b/library/email.mime.po index 4243ef231a..d10dbddb73 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:00+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,8 +94,8 @@ msgstr "" #: ../../library/email.mime.rst:57 ../../library/email.mime.rst:104 #: ../../library/email.mime.rst:135 ../../library/email.mime.rst:169 -#: ../../library/email.mime.rst:204 ../../library/email.mime.rst:224 -#: ../../library/email.mime.rst:258 +#: ../../library/email.mime.rst:205 ../../library/email.mime.rst:225 +#: ../../library/email.mime.rst:259 msgid "Added *policy* keyword-only parameter." msgstr "新增僅限關鍵字參數 *policy*\\ 。" @@ -143,8 +143,8 @@ msgid "" msgstr "" #: ../../library/email.mime.rst:98 ../../library/email.mime.rst:131 -#: ../../library/email.mime.rst:165 ../../library/email.mime.rst:199 -#: ../../library/email.mime.rst:222 ../../library/email.mime.rst:253 +#: ../../library/email.mime.rst:165 ../../library/email.mime.rst:200 +#: ../../library/email.mime.rst:223 ../../library/email.mime.rst:254 msgid "" "Optional *policy* argument defaults to :class:`compat32 `." @@ -195,11 +195,11 @@ msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEAudio` class is used to create MIME message objects of major type :" "mimetype:`audio`. *_audiodata* is a string containing the raw audio data. " -"If this data can be decoded by the standard Python module :mod:`sndhdr`, " -"then the subtype will be automatically included in the :mailheader:`Content-" -"Type` header. Otherwise you can explicitly specify the audio subtype via the " -"*_subtype* argument. If the minor type could not be guessed and *_subtype* " -"was not given, then :exc:`TypeError` is raised." +"If this data can be decoded as au, wav, aiff, or aifc, then the subtype will " +"be automatically included in the :mailheader:`Content-Type` header. " +"Otherwise you can explicitly specify the audio subtype via the *_subtype* " +"argument. If the minor type could not be guessed and *_subtype* was not " +"given, then :exc:`TypeError` is raised." msgstr "" #: ../../library/email.mime.rst:155 @@ -223,14 +223,15 @@ msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEImage` class is used to create MIME message objects of major type :" "mimetype:`image`. *_imagedata* is a string containing the raw image data. " -"If this data can be decoded by the standard Python module :mod:`imghdr`, " -"then the subtype will be automatically included in the :mailheader:`Content-" -"Type` header. Otherwise you can explicitly specify the image subtype via the " -"*_subtype* argument. If the minor type could not be guessed and *_subtype* " -"was not given, then :exc:`TypeError` is raised." +"If this data type can be detected (jpeg, png, gif, tiff, rgb, pbm, pgm, ppm, " +"rast, xbm, bmp, webp, and exr attempted), then the subtype will be " +"automatically included in the :mailheader:`Content-Type` header. Otherwise " +"you can explicitly specify the image subtype via the *_subtype* argument. If " +"the minor type could not be guessed and *_subtype* was not given, then :exc:" +"`TypeError` is raised." msgstr "" -#: ../../library/email.mime.rst:189 +#: ../../library/email.mime.rst:190 msgid "" "Optional *_encoder* is a callable (i.e. function) which will perform the " "actual encoding of the image data for transport. This callable takes one " @@ -242,17 +243,17 @@ msgid "" "encoders` module for a list of the built-in encoders." msgstr "" -#: ../../library/email.mime.rst:201 +#: ../../library/email.mime.rst:202 msgid "" "*_params* are passed straight through to the :class:`~email.mime.base." "MIMEBase` constructor." msgstr "" -#: ../../library/email.mime.rst:211 +#: ../../library/email.mime.rst:212 msgid "Module: :mod:`email.mime.message`" msgstr "模組:\\ :mod:`email.mime.message`" -#: ../../library/email.mime.rst:213 +#: ../../library/email.mime.rst:214 msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEMessage` class is used to create MIME objects of main type :mimetype:" @@ -261,17 +262,17 @@ msgid "" "`TypeError` is raised." msgstr "" -#: ../../library/email.mime.rst:219 +#: ../../library/email.mime.rst:220 msgid "" "Optional *_subtype* sets the subtype of the message; it defaults to :" "mimetype:`rfc822`." msgstr "" -#: ../../library/email.mime.rst:231 +#: ../../library/email.mime.rst:232 msgid "Module: :mod:`email.mime.text`" msgstr "模組:\\ :mod:`email.mime.text`" -#: ../../library/email.mime.rst:233 +#: ../../library/email.mime.rst:234 msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEText` class is used to create MIME objects of major type :mimetype:" @@ -284,7 +285,7 @@ msgid "" "Charset` instance." msgstr "" -#: ../../library/email.mime.rst:243 +#: ../../library/email.mime.rst:244 msgid "" "Unless the *_charset* argument is explicitly set to ``None``, the MIMEText " "object created will have both a :mailheader:`Content-Type` header with a " @@ -297,6 +298,6 @@ msgid "" "Encoding` header)." msgstr "" -#: ../../library/email.mime.rst:255 +#: ../../library/email.mime.rst:256 msgid "*_charset* also accepts :class:`~email.charset.Charset` instances." msgstr "" diff --git a/library/ensurepip.po b/library/ensurepip.po index bee55e3c49..102db9b60c 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -62,20 +62,31 @@ msgstr "" msgid "The original rationale and specification for this module." msgstr "" -#: ../../library/ensurepip.rst:41 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/ensurepip.rst:42 msgid "Command line interface" msgstr "" -#: ../../library/ensurepip.rst:43 +#: ../../library/ensurepip.rst:44 msgid "" "The command line interface is invoked using the interpreter's ``-m`` switch." msgstr "" -#: ../../library/ensurepip.rst:45 +#: ../../library/ensurepip.rst:46 msgid "The simplest possible invocation is::" msgstr "" -#: ../../library/ensurepip.rst:49 +#: ../../library/ensurepip.rst:50 msgid "" "This invocation will install ``pip`` if it is not already installed, but " "otherwise does nothing. To ensure the installed version of ``pip`` is at " @@ -83,7 +94,7 @@ msgid "" "upgrade`` option::" msgstr "" -#: ../../library/ensurepip.rst:56 +#: ../../library/ensurepip.rst:57 msgid "" "By default, ``pip`` is installed into the current virtual environment (if " "one is active) or into the system site packages (if there is no active " @@ -91,122 +102,122 @@ msgid "" "two additional command line options:" msgstr "" -#: ../../library/ensurepip.rst:61 +#: ../../library/ensurepip.rst:62 msgid "" "``--root ``: Installs ``pip`` relative to the given root directory " "rather than the root of the currently active virtual environment (if any) or " "the default root for the current Python installation." msgstr "" -#: ../../library/ensurepip.rst:64 +#: ../../library/ensurepip.rst:65 msgid "" "``--user``: Installs ``pip`` into the user site packages directory rather " "than globally for the current Python installation (this option is not " "permitted inside an active virtual environment)." msgstr "" -#: ../../library/ensurepip.rst:68 +#: ../../library/ensurepip.rst:69 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the version of Python used to invoke ``ensurepip``). The scripts " "installed can be controlled through two additional command line options:" msgstr "" -#: ../../library/ensurepip.rst:73 +#: ../../library/ensurepip.rst:74 msgid "" "``--altinstall``: if an alternate installation is requested, the ``pipX`` " "script will *not* be installed." msgstr "" -#: ../../library/ensurepip.rst:76 +#: ../../library/ensurepip.rst:77 msgid "" "``--default-pip``: if a \"default pip\" installation is requested, the " "``pip`` script will be installed in addition to the two regular scripts." msgstr "" -#: ../../library/ensurepip.rst:79 +#: ../../library/ensurepip.rst:80 msgid "" "Providing both of the script selection options will trigger an exception." msgstr "" -#: ../../library/ensurepip.rst:83 +#: ../../library/ensurepip.rst:84 msgid "Module API" msgstr "模組 API" -#: ../../library/ensurepip.rst:85 +#: ../../library/ensurepip.rst:86 msgid ":mod:`ensurepip` exposes two functions for programmatic use:" msgstr "" -#: ../../library/ensurepip.rst:89 +#: ../../library/ensurepip.rst:90 msgid "" "Returns a string specifying the available version of pip that will be " "installed when bootstrapping an environment." msgstr "" -#: ../../library/ensurepip.rst:96 +#: ../../library/ensurepip.rst:97 msgid "Bootstraps ``pip`` into the current or designated environment." msgstr "" -#: ../../library/ensurepip.rst:98 +#: ../../library/ensurepip.rst:99 msgid "" "*root* specifies an alternative root directory to install relative to. If " "*root* is ``None``, then installation uses the default install location for " "the current environment." msgstr "" -#: ../../library/ensurepip.rst:102 +#: ../../library/ensurepip.rst:103 msgid "" "*upgrade* indicates whether or not to upgrade an existing installation of an " "earlier version of ``pip`` to the available version." msgstr "" -#: ../../library/ensurepip.rst:105 +#: ../../library/ensurepip.rst:106 msgid "" "*user* indicates whether to use the user scheme rather than installing " "globally." msgstr "" -#: ../../library/ensurepip.rst:108 +#: ../../library/ensurepip.rst:109 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the current version of Python)." msgstr "" -#: ../../library/ensurepip.rst:111 +#: ../../library/ensurepip.rst:112 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." msgstr "" -#: ../../library/ensurepip.rst:113 +#: ../../library/ensurepip.rst:114 msgid "" "If *default_pip* is set, then ``pip`` will be installed in addition to the " "two regular scripts." msgstr "" -#: ../../library/ensurepip.rst:116 +#: ../../library/ensurepip.rst:117 msgid "" "Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." msgstr "" -#: ../../library/ensurepip.rst:119 +#: ../../library/ensurepip.rst:120 msgid "" "*verbosity* controls the level of output to :data:`sys.stdout` from the " "bootstrapping operation." msgstr "" -#: ../../library/ensurepip.rst:122 +#: ../../library/ensurepip.rst:134 msgid "" "Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with " "argument ``root``." msgstr "" -#: ../../library/ensurepip.rst:126 +#: ../../library/ensurepip.rst:127 msgid "" "The bootstrapping process has side effects on both ``sys.path`` and ``os." "environ``. Invoking the command line interface in a subprocess instead " "allows these side effects to be avoided." msgstr "" -#: ../../library/ensurepip.rst:132 +#: ../../library/ensurepip.rst:133 msgid "" "The bootstrapping process may install additional modules required by " "``pip``, but other software should not assume those dependencies will always " diff --git a/library/enum.po b/library/enum.po index 0fec16fca8..597c2c846f 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-19 00:09+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -28,1027 +28,862 @@ msgstr "**原始碼:**\\ :source:`Lib/enum.py`" #: ../../library/enum.rst:18 msgid "" -"An enumeration is a set of symbolic names (members) bound to unique, " -"constant values. Within an enumeration, the members can be compared by " -"identity, and the enumeration itself can be iterated over." +"This page contains the API reference information. For tutorial information " +"and discussion of more advanced topics, see" msgstr "" -#: ../../library/enum.rst:22 -msgid "Case of Enum Members" -msgstr "" - -#: ../../library/enum.rst:24 -msgid "" -"Because Enums are used to represent constants we recommend using UPPER_CASE " -"names for enum members, and will be using that style in our examples." +#: ../../library/enum.rst:21 +msgid ":ref:`Basic Tutorial `" msgstr "" -#: ../../library/enum.rst:30 -msgid "Module Contents" -msgstr "模組內容" - -#: ../../library/enum.rst:32 -msgid "" -"This module defines four enumeration classes that can be used to define " -"unique sets of names and values: :class:`Enum`, :class:`IntEnum`, :class:" -"`Flag`, and :class:`IntFlag`. It also defines one decorator, :func:" -"`unique`, and one helper, :class:`auto`." +#: ../../library/enum.rst:22 +msgid ":ref:`Advanced Tutorial `" msgstr "" -#: ../../library/enum.rst:39 -msgid "" -"Base class for creating enumerated constants. See section `Functional API`_ " -"for an alternate construction syntax." +#: ../../library/enum.rst:23 +msgid ":ref:`Enum Cookbook `" msgstr "" -#: ../../library/enum.rst:44 -msgid "" -"Base class for creating enumerated constants that are also subclasses of :" -"class:`int`." +#: ../../library/enum.rst:27 +msgid "An enumeration:" msgstr "" -#: ../../library/enum.rst:49 -msgid "" -"Base class for creating enumerated constants that can be combined using the " -"bitwise operators without losing their :class:`IntFlag` membership. :class:" -"`IntFlag` members are also subclasses of :class:`int`." +#: ../../library/enum.rst:29 +msgid "is a set of symbolic names (members) bound to unique values" msgstr "" -#: ../../library/enum.rst:55 -msgid "" -"Base class for creating enumerated constants that can be combined using the " -"bitwise operations without losing their :class:`Flag` membership." +#: ../../library/enum.rst:30 +msgid "can be iterated over to return its members in definition order" msgstr "" -#: ../../library/enum.rst:61 -msgid "" -"Enum class decorator that ensures only one name is bound to any one value." +#: ../../library/enum.rst:31 +msgid "uses *call* syntax to return members by value" msgstr "" -#: ../../library/enum.rst:65 -msgid "" -"Instances are replaced with an appropriate value for Enum members. By " -"default, the initial value starts at 1." -msgstr "" - -#: ../../library/enum.rst:67 -msgid "``Flag``, ``IntFlag``, ``auto``" -msgstr "``Flag``, ``IntFlag``, ``auto``" - -#: ../../library/enum.rst:71 -msgid "Creating an Enum" +#: ../../library/enum.rst:32 +msgid "uses *index* syntax to return members by name" msgstr "" -#: ../../library/enum.rst:73 +#: ../../library/enum.rst:34 msgid "" -"Enumerations are created using the :keyword:`class` syntax, which makes them " -"easy to read and write. An alternative creation method is described in " -"`Functional API`_. To define an enumeration, subclass :class:`Enum` as " -"follows::" +"Enumerations are created either by using :keyword:`class` syntax, or by " +"using function-call syntax::" msgstr "" -#: ../../library/enum.rst:85 -msgid "Enum member values" -msgstr "" - -#: ../../library/enum.rst:87 +#: ../../library/enum.rst:48 msgid "" -"Member values can be anything: :class:`int`, :class:`str`, etc.. If the " -"exact value is unimportant you may use :class:`auto` instances and an " -"appropriate value will be chosen for you. Care must be taken if you mix :" -"class:`auto` with other values." +"Even though we can use :keyword:`class` syntax to create Enums, Enums are " +"not normal Python classes. See :ref:`How are Enums different? ` for more details." msgstr "" -#: ../../library/enum.rst:92 +#: ../../library/enum.rst:52 msgid "Nomenclature" msgstr "" -#: ../../library/enum.rst:94 +#: ../../library/enum.rst:54 msgid "The class :class:`Color` is an *enumeration* (or *enum*)" msgstr "" -#: ../../library/enum.rst:95 +#: ../../library/enum.rst:55 msgid "" "The attributes :attr:`Color.RED`, :attr:`Color.GREEN`, etc., are " -"*enumeration members* (or *enum members*) and are functionally constants." +"*enumeration members* (or *members*) and are functionally constants." msgstr "" -#: ../../library/enum.rst:97 +#: ../../library/enum.rst:57 msgid "" "The enum members have *names* and *values* (the name of :attr:`Color.RED` is " "``RED``, the value of :attr:`Color.BLUE` is ``3``, etc.)" msgstr "" -#: ../../library/enum.rst:103 -msgid "" -"Even though we use the :keyword:`class` syntax to create Enums, Enums are " -"not normal Python classes. See `How are Enums different?`_ for more details." -msgstr "" +#: ../../library/enum.rst:64 +msgid "Module Contents" +msgstr "模組內容" -#: ../../library/enum.rst:107 -msgid "Enumeration members have human readable string representations::" -msgstr "" +#: ../../library/enum.rst:66 +msgid ":class:`EnumType`" +msgstr ":class:`EnumType`" -#: ../../library/enum.rst:112 -msgid "...while their ``repr`` has more information::" +#: ../../library/enum.rst:68 +msgid "The ``type`` for Enum and its subclasses." msgstr "" -#: ../../library/enum.rst:117 -msgid "The *type* of an enumeration member is the enumeration it belongs to::" -msgstr "" +#: ../../library/enum.rst:70 +msgid ":class:`Enum`" +msgstr ":class:`Enum`" -#: ../../library/enum.rst:125 -msgid "Enum members also have a property that contains just their item name::" +#: ../../library/enum.rst:72 +msgid "Base class for creating enumerated constants." msgstr "" -#: ../../library/enum.rst:130 -msgid "Enumerations support iteration, in definition order::" -msgstr "" +#: ../../library/enum.rst:74 +msgid ":class:`IntEnum`" +msgstr ":class:`IntEnum`" -#: ../../library/enum.rst:146 +#: ../../library/enum.rst:76 msgid "" -"Enumeration members are hashable, so they can be used in dictionaries and " -"sets::" +"Base class for creating enumerated constants that are also subclasses of :" +"class:`int`. (`Notes`_)" msgstr "" -#: ../../library/enum.rst:156 -msgid "Programmatic access to enumeration members and their attributes" -msgstr "" +#: ../../library/enum.rst:79 +msgid ":class:`StrEnum`" +msgstr ":class:`StrEnum`" -#: ../../library/enum.rst:158 +#: ../../library/enum.rst:81 msgid "" -"Sometimes it's useful to access members in enumerations programmatically (i." -"e. situations where ``Color.RED`` won't do because the exact color is not " -"known at program-writing time). ``Enum`` allows such access::" -msgstr "" - -#: ../../library/enum.rst:167 -msgid "If you want to access enum members by *name*, use item access::" +"Base class for creating enumerated constants that are also subclasses of :" +"class:`str`. (`Notes`_)" msgstr "" -#: ../../library/enum.rst:174 -msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::" -msgstr "" +#: ../../library/enum.rst:84 +msgid ":class:`Flag`" +msgstr ":class:`Flag`" -#: ../../library/enum.rst:184 -msgid "Duplicating enum members and values" +#: ../../library/enum.rst:86 +msgid "" +"Base class for creating enumerated constants that can be combined using the " +"bitwise operations without losing their :class:`Flag` membership." msgstr "" -#: ../../library/enum.rst:186 -msgid "Having two enum members with the same name is invalid::" -msgstr "" +#: ../../library/enum.rst:89 +msgid ":class:`IntFlag`" +msgstr ":class:`IntFlag`" -#: ../../library/enum.rst:196 +#: ../../library/enum.rst:91 msgid "" -"However, two enum members are allowed to have the same value. Given two " -"members A and B with the same value (and A defined first), B is an alias to " -"A. By-value lookup of the value of A and B will return A. By-name lookup " -"of B will also return A::" +"Base class for creating enumerated constants that can be combined using the " +"bitwise operators without losing their :class:`IntFlag` membership. :class:" +"`IntFlag` members are also subclasses of :class:`int`. (`Notes`_)" msgstr "" -#: ../../library/enum.rst:216 +#: ../../library/enum.rst:95 +msgid ":class:`EnumCheck`" +msgstr ":class:`EnumCheck`" + +#: ../../library/enum.rst:97 msgid "" -"Attempting to create a member with the same name as an already defined " -"attribute (another member, a method, etc.) or attempting to create an " -"attribute with the same name as a member is not allowed." +"An enumeration with the values ``CONTINUOUS``, ``NAMED_FLAGS``, and " +"``UNIQUE``, for use with :func:`verify` to ensure various constraints are " +"met by a given enumeration." msgstr "" -#: ../../library/enum.rst:222 -msgid "Ensuring unique enumeration values" -msgstr "" +#: ../../library/enum.rst:101 +msgid ":class:`FlagBoundary`" +msgstr ":class:`FlagBoundary`" -#: ../../library/enum.rst:224 +#: ../../library/enum.rst:103 msgid "" -"By default, enumerations allow multiple names as aliases for the same value. " -"When this behavior isn't desired, the following decorator can be used to " -"ensure each value is used only once in the enumeration:" +"An enumeration with the values ``STRICT``, ``CONFORM``, ``EJECT``, and " +"``KEEP`` which allows for more fine-grained control over how invalid values " +"are dealt with in an enumeration." msgstr "" -#: ../../library/enum.rst:230 -msgid "" -"A :keyword:`class` decorator specifically for enumerations. It searches an " -"enumeration's :attr:`__members__` gathering any aliases it finds; if any are " -"found :exc:`ValueError` is raised with the details::" -msgstr "" +#: ../../library/enum.rst:107 +msgid ":class:`auto`" +msgstr ":class:`auto`" -#: ../../library/enum.rst:248 -msgid "Using automatic values" +#: ../../library/enum.rst:109 +msgid "" +"Instances are replaced with an appropriate value for Enum members. :class:" +"`StrEnum` defaults to the lower-cased version of the member name, while " +"other Enums default to 1 and increase from there." msgstr "" -#: ../../library/enum.rst:250 -msgid "If the exact value is unimportant you can use :class:`auto`::" -msgstr "" +#: ../../library/enum.rst:113 +msgid ":func:`~enum.property`" +msgstr ":func:`~enum.property`" -#: ../../library/enum.rst:261 +#: ../../library/enum.rst:115 msgid "" -"The values are chosen by :func:`_generate_next_value_`, which can be " -"overridden::" +"Allows :class:`Enum` members to have attributes without conflicting with " +"member names." msgstr "" -#: ../../library/enum.rst:279 -msgid "" -"The goal of the default :meth:`_generate_next_value_` method is to provide " -"the next :class:`int` in sequence with the last :class:`int` provided, but " -"the way it does this is an implementation detail and may change." -msgstr "" +#: ../../library/enum.rst:118 +msgid ":func:`unique`" +msgstr ":func:`unique`" -#: ../../library/enum.rst:285 +#: ../../library/enum.rst:120 msgid "" -"The :meth:`_generate_next_value_` method must be defined before any members." -msgstr "" - -#: ../../library/enum.rst:288 -msgid "Iteration" +"Enum class decorator that ensures only one name is bound to any one value." msgstr "" -#: ../../library/enum.rst:290 -msgid "Iterating over the members of an enum does not provide the aliases::" -msgstr "" +#: ../../library/enum.rst:122 +msgid ":func:`verify`" +msgstr ":func:`verify`" -#: ../../library/enum.rst:295 +#: ../../library/enum.rst:124 msgid "" -"The special attribute ``__members__`` is a read-only ordered mapping of " -"names to members. It includes all names defined in the enumeration, " -"including the aliases::" +"Enum class decorator that checks user-selectable constraints on an " +"enumeration." msgstr "" -#: ../../library/enum.rst:307 -msgid "" -"The ``__members__`` attribute can be used for detailed programmatic access " -"to the enumeration members. For example, finding all the aliases::" -msgstr "" +#: ../../library/enum.rst:127 +msgid ":func:`member`" +msgstr ":func:`member`" -#: ../../library/enum.rst:315 -msgid "Comparisons" +#: ../../library/enum.rst:129 +msgid "Make ``obj`` a member. Can be used as a decorator." msgstr "" -#: ../../library/enum.rst:317 -msgid "Enumeration members are compared by identity::" -msgstr "" +#: ../../library/enum.rst:131 +msgid ":func:`nonmember`" +msgstr ":func:`nonmember`" -#: ../../library/enum.rst:326 -msgid "" -"Ordered comparisons between enumeration values are *not* supported. Enum " -"members are not integers (but see `IntEnum`_ below)::" +#: ../../library/enum.rst:133 +msgid "Do not make ``obj`` a member. Can be used as a decorator." msgstr "" -#: ../../library/enum.rst:334 -msgid "Equality comparisons are defined though::" -msgstr "" +#: ../../library/enum.rst:136 +msgid "``Flag``, ``IntFlag``, ``auto``" +msgstr "``Flag``, ``IntFlag``, ``auto``" -#: ../../library/enum.rst:343 +#: ../../library/enum.rst:137 msgid "" -"Comparisons against non-enumeration values will always compare not equal " -"(again, :class:`IntEnum` was explicitly designed to behave differently, see " -"below)::" +"``StrEnum``, ``EnumCheck``, ``FlagBoundary``, ``property``, ``member``, " +"``nonmember``" msgstr "" +"``StrEnum``, ``EnumCheck``, ``FlagBoundary``, ``property``, ``member``, " +"``nonmember``" -#: ../../library/enum.rst:352 -msgid "Allowed members and attributes of enumerations" +#: ../../library/enum.rst:142 +msgid "Data Types" msgstr "" -#: ../../library/enum.rst:354 +#: ../../library/enum.rst:147 msgid "" -"The examples above use integers for enumeration values. Using integers is " -"short and handy (and provided by default by the `Functional API`_), but not " -"strictly enforced. In the vast majority of use-cases, one doesn't care what " -"the actual value of an enumeration is. But if the value *is* important, " -"enumerations can have arbitrary values." +"*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible " +"to subclass *EnumType* -- see :ref:`Subclassing EnumType ` for details." msgstr "" -#: ../../library/enum.rst:360 +#: ../../library/enum.rst:151 msgid "" -"Enumerations are Python classes, and can have methods and special methods as " -"usual. If we have this enumeration::" +"*EnumType* is responsible for setting the correct :meth:`__repr__`, :meth:" +"`__str__`, :meth:`__format__`, and :meth:`__reduce__` methods on the final " +"*enum*, as well as creating the enum members, properly handling duplicates, " +"providing iteration over the enum class, etc." msgstr "" -#: ../../library/enum.rst:380 -msgid "Then::" -msgstr "" - -#: ../../library/enum.rst:389 -msgid "" -"The rules for what is allowed are as follows: names that start and end with " -"a single underscore are reserved by enum and cannot be used; all other " -"attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`__str__`, :meth:" -"`__add__`, etc.), descriptors (methods are also descriptors), and variable " -"names listed in :attr:`_ignore_`." +#: ../../library/enum.rst:158 +msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "" -#: ../../library/enum.rst:396 +#: ../../library/enum.rst:166 msgid "" -"Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` " -"then any value(s) given to the enum member will be passed into those " -"methods. See `Planet`_ for an example." -msgstr "" - -#: ../../library/enum.rst:402 -msgid "Restricted Enum subclassing" +"In Python 3.12 it will be possible to check for member values and not just " +"members; until then, a ``TypeError`` will be raised if a non-Enum-member is " +"used in a containment check." msgstr "" -#: ../../library/enum.rst:404 +#: ../../library/enum.rst:172 msgid "" -"A new :class:`Enum` class must have one base Enum class, up to one concrete " -"data type, and as many :class:`object`-based mixin classes as needed. The " -"order of these base classes is::" +"Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " +"names of the members in *cls*::" msgstr "" -#: ../../library/enum.rst:411 +#: ../../library/enum.rst:180 msgid "" -"Also, subclassing an enumeration is allowed only if the enumeration does not " -"define any members. So this is forbidden::" +"Returns the Enum member in *cls* matching *name*, or raises an :exc:" +"`AttributeError`::" msgstr "" -#: ../../library/enum.rst:421 -msgid "But this is allowed::" -msgstr "" - -#: ../../library/enum.rst:432 +#: ../../library/enum.rst:187 msgid "" -"Allowing subclassing of enums that define members would lead to a violation " -"of some important invariants of types and instances. On the other hand, it " -"makes sense to allow sharing some common behavior between a group of " -"enumerations. (See `OrderedEnum`_ for an example.)" +"Returns the Enum member in *cls* matching *name*, or raises an :exc:" +"`KeyError`::" msgstr "" -#: ../../library/enum.rst:439 -msgid "Pickling" +#: ../../library/enum.rst:194 +msgid "Returns each member in *cls* in definition order::" msgstr "" -#: ../../library/enum.rst:441 -msgid "Enumerations can be pickled and unpickled::" +#: ../../library/enum.rst:201 +msgid "Returns the number of member in *cls*::" msgstr "" -#: ../../library/enum.rst:448 -msgid "" -"The usual restrictions for pickling apply: picklable enums must be defined " -"in the top level of a module, since unpickling requires them to be " -"importable from that module." +#: ../../library/enum.rst:208 +msgid "Returns each member in *cls* in reverse definition order::" msgstr "" -#: ../../library/enum.rst:454 -msgid "" -"With pickle protocol version 4 it is possible to easily pickle enums nested " -"in other classes." +#: ../../library/enum.rst:216 +msgid "*Enum* is the base class for all *enum* enumerations." msgstr "" -#: ../../library/enum.rst:457 -msgid "" -"It is possible to modify how Enum members are pickled/unpickled by defining :" -"meth:`__reduce_ex__` in the enumeration class." +#: ../../library/enum.rst:220 +msgid "The name used to define the ``Enum`` member::" msgstr "" -#: ../../library/enum.rst:462 -msgid "Functional API" +#: ../../library/enum.rst:227 +msgid "The value given to the ``Enum`` member::" msgstr "" -#: ../../library/enum.rst:464 -msgid "" -"The :class:`Enum` class is callable, providing the following functional API::" +#: ../../library/enum.rst:232 +msgid "Enum member values" msgstr "" -#: ../../library/enum.rst:476 +#: ../../library/enum.rst:234 msgid "" -"The semantics of this API resemble :class:`~collections.namedtuple`. The " -"first argument of the call to :class:`Enum` is the name of the enumeration." +"Member values can be anything: :class:`int`, :class:`str`, etc.. If the " +"exact value is unimportant you may use :class:`auto` instances and an " +"appropriate value will be chosen for you. Care must be taken if you mix :" +"class:`auto` with other values." msgstr "" -#: ../../library/enum.rst:479 +#: ../../library/enum.rst:241 msgid "" -"The second argument is the *source* of enumeration member names. It can be " -"a whitespace-separated string of names, a sequence of names, a sequence of 2-" -"tuples with key/value pairs, or a mapping (e.g. dictionary) of names to " -"values. The last two options enable assigning arbitrary values to " -"enumerations; the others auto-assign increasing integers starting with 1 " -"(use the ``start`` parameter to specify a different starting value). A new " -"class derived from :class:`Enum` is returned. In other words, the above " -"assignment to :class:`Animal` is equivalent to::" +"``_ignore_`` is only used during creation and is removed from the " +"enumeration once creation is complete." msgstr "" -#: ../../library/enum.rst:495 +#: ../../library/enum.rst:244 msgid "" -"The reason for defaulting to ``1`` as the starting number and not ``0`` is " -"that ``0`` is ``False`` in a boolean sense, but enum members all evaluate to " -"``True``." +"``_ignore_`` is a list of names that will not become members, and whose " +"names will also be removed from the completed enumeration. See :ref:" +"`TimePeriod ` for an example." msgstr "" -#: ../../library/enum.rst:499 -msgid "" -"Pickling enums created with the functional API can be tricky as frame stack " -"implementation details are used to try and figure out which module the " -"enumeration is being created in (e.g. it will fail if you use a utility " -"function in separate module, and also may not work on IronPython or Jython). " -"The solution is to specify the module name explicitly as follows::" +#: ../../library/enum.rst:250 +msgid "This method is called in two different ways:" msgstr "" -#: ../../library/enum.rst:509 -msgid "" -"If ``module`` is not supplied, and Enum cannot determine what it is, the new " -"Enum members will not be unpicklable; to keep errors closer to the source, " -"pickling will be disabled." +#: ../../library/enum.rst:252 +msgid "to look up an existing member:" msgstr "" -#: ../../library/enum.rst:513 -msgid "" -"The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~definition.__qualname__` being set to the location where pickle will be " -"able to find the class. For example, if the class was made available in " -"class SomeData in the global scope::" -msgstr "" +#: ../../library/enum.rst:0 +msgid "cls" +msgstr "cls" -#: ../../library/enum.rst:520 -msgid "The complete signature is::" +#: ../../library/enum.rst:254 ../../library/enum.rst:259 +msgid "The enum class being called." msgstr "" #: ../../library/enum.rst:0 msgid "value" msgstr "" -#: ../../library/enum.rst:524 -msgid "What the new Enum class will record as its name." +#: ../../library/enum.rst:255 +msgid "The value to lookup." msgstr "" -#: ../../library/enum.rst:0 -msgid "names" +#: ../../library/enum.rst:257 +msgid "to use the ``cls`` enum to create a new enum:" msgstr "" -#: ../../library/enum.rst:526 -msgid "" -"The Enum members. This can be a whitespace or comma separated string " -"(values will start at 1 unless otherwise specified)::" +#: ../../library/enum.rst:260 +msgid "The name of the new Enum to create." msgstr "" -#: ../../library/enum.rst:531 -msgid "or an iterator of names::" -msgstr "" - -#: ../../library/enum.rst:535 -msgid "or an iterator of (name, value) pairs::" +#: ../../library/enum.rst:0 +msgid "names" msgstr "" -#: ../../library/enum.rst:539 -msgid "or a mapping::" +#: ../../library/enum.rst:261 +msgid "The names/values of the members for the new Enum." msgstr "" #: ../../library/enum.rst:0 msgid "module" msgstr "模組" -#: ../../library/enum.rst:543 -msgid "name of module where new Enum class can be found." +#: ../../library/enum.rst:262 +msgid "The name of the module the new Enum is created in." msgstr "" #: ../../library/enum.rst:0 msgid "qualname" msgstr "" -#: ../../library/enum.rst:545 -msgid "where in module new Enum class can be found." +#: ../../library/enum.rst:263 +msgid "The actual location in the module where this Enum can be found." msgstr "" #: ../../library/enum.rst:0 msgid "type" msgstr "" -#: ../../library/enum.rst:547 -msgid "type to mix in to new Enum class." +#: ../../library/enum.rst:264 +msgid "A mix-in type for the new Enum." msgstr "" #: ../../library/enum.rst:0 msgid "start" msgstr "" -#: ../../library/enum.rst:549 -msgid "number to start counting at if only names are passed in." +#: ../../library/enum.rst:265 +msgid "The first integer value for the Enum (used by :class:`auto`)" msgstr "" -#: ../../library/enum.rst:551 -msgid "The *start* parameter was added." -msgstr "新增 *start* 參數。" - -#: ../../library/enum.rst:556 -msgid "Derived Enumerations" +#: ../../library/enum.rst:0 +msgid "boundary" msgstr "" -#: ../../library/enum.rst:559 -msgid "IntEnum" -msgstr "IntEnum" - -#: ../../library/enum.rst:561 +#: ../../library/enum.rst:266 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass of :" -"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " -"extension, integer enumerations of different types can also be compared to " -"each other::" +"How to handle out-of-range values from bit operations (:class:`Flag` only)" msgstr "" -#: ../../library/enum.rst:582 +#: ../../library/enum.rst:270 msgid "" -"However, they still can't be compared to standard :class:`Enum` " -"enumerations::" +"Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " +"public methods defined on *self.__class__*::" msgstr "" -#: ../../library/enum.rst:595 -msgid "" -":class:`IntEnum` values behave like integers in other ways you'd expect::" +#: ../../library/enum.rst:0 +msgid "name" msgstr "" -#: ../../library/enum.rst:606 -msgid "IntFlag" -msgstr "IntFlag" - -#: ../../library/enum.rst:608 -msgid "" -"The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " -"based on :class:`int`. The difference being :class:`IntFlag` members can be " -"combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member. However, as the name implies, :class:`IntFlag` " -"members also subclass :class:`int` and can be used wherever an :class:`int` " -"is used. Any operation on an :class:`IntFlag` member besides the bit-wise " -"operations will lose the :class:`IntFlag` membership." +#: ../../library/enum.rst:290 +msgid "The name of the member being defined (e.g. 'RED')." msgstr "" -#: ../../library/enum.rst:618 -msgid "Sample :class:`IntFlag` class::" +#: ../../library/enum.rst:291 +msgid "The start value for the Enum; the default is 1." msgstr "" -#: ../../library/enum.rst:634 -msgid "It is also possible to name the combinations::" +#: ../../library/enum.rst:0 +msgid "count" msgstr "" -#: ../../library/enum.rst:646 -msgid "" -"Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation is :data:" -"`False`::" +#: ../../library/enum.rst:292 +msgid "The number of members currently defined, not including this one." msgstr "" -#: ../../library/enum.rst:654 -msgid "" -"Because :class:`IntFlag` members are also subclasses of :class:`int` they " -"can be combined with them::" +#: ../../library/enum.rst:0 +msgid "last_values" msgstr "" -#: ../../library/enum.rst:662 -msgid "Flag" +#: ../../library/enum.rst:293 +msgid "A list of the previous values." msgstr "" -#: ../../library/enum.rst:664 +#: ../../library/enum.rst:295 msgid "" -"The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" -"class:`IntFlag`, they cannot be combined with, nor compared against, any " -"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " -"specify the values directly it is recommended to use :class:`auto` as the " -"value and let :class:`Flag` select an appropriate value." +"A *staticmethod* that is used to determine the next value returned by :class:" +"`auto`::" msgstr "" -#: ../../library/enum.rst:673 +#: ../../library/enum.rst:310 msgid "" -"Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " -"no flags being set, the boolean evaluation is :data:`False`::" +"A *classmethod* that is used to further configure subsequent subclasses. By " +"default, does nothing." msgstr "" -#: ../../library/enum.rst:687 +#: ../../library/enum.rst:315 msgid "" -"Individual flags should have values that are powers of two (1, 2, 4, " -"8, ...), while combinations of flags won't::" +"A *classmethod* for looking up values not found in *cls*. By default it " +"does nothing, but can be overridden to implement custom search behavior::" msgstr "" -#: ../../library/enum.rst:699 +#: ../../library/enum.rst:336 msgid "" -"Giving a name to the \"no flags set\" condition does not change its boolean " -"value::" +"Returns the string used for *repr()* calls. By default, returns the *Enum* " +"name, member name, and value, but can be overridden::" msgstr "" -#: ../../library/enum.rst:715 +#: ../../library/enum.rst:351 msgid "" -"For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " -"recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " -"promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" -"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " -"will not do; for example, when integer constants are replaced with " -"enumerations, or for interoperability with other systems." -msgstr "" - -#: ../../library/enum.rst:725 -msgid "Others" +"Returns the string used for *str()* calls. By default, returns the *Enum* " +"name and member name, but can be overridden::" msgstr "" -#: ../../library/enum.rst:727 +#: ../../library/enum.rst:365 msgid "" -"While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " -"simple to implement independently::" +"Returns the string used for *format()* and *f-string* calls. By default, " +"returns :meth:`__str__` returns, but can be overridden::" msgstr "" -#: ../../library/enum.rst:733 +#: ../../library/enum.rst:379 msgid "" -"This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`StrEnum` that mixes in :class:`str` instead of :class:" -"`int`." -msgstr "" - -#: ../../library/enum.rst:736 -msgid "Some rules:" +"Using :class:`auto` with :class:`Enum` results in integers of increasing " +"value, starting with ``1``." msgstr "" -#: ../../library/enum.rst:738 +#: ../../library/enum.rst:385 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before :class:" -"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example " -"above." +"*IntEnum* is the same as *Enum*, but its members are also integers and can " +"be used anywhere that an integer can be used. If any integer operation is " +"performed with an *IntEnum* member, the resulting value loses its " +"enumeration status." msgstr "" -#: ../../library/enum.rst:741 +#: ../../library/enum.rst:405 msgid "" -"While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, e.g. :class:" -"`int` above. This restriction does not apply to mix-ins which only add " -"methods and don't specify another type." +"Using :class:`auto` with :class:`IntEnum` results in integers of increasing " +"value, starting with ``1``." msgstr "" -#: ../../library/enum.rst:745 +#: ../../library/enum.rst:408 ../../library/enum.rst:579 msgid "" -"When another data type is mixed in, the :attr:`value` attribute is *not the " -"same* as the enum member itself, although it is equivalent and will compare " -"equal." +":meth:`__str__` is now :func:`int.__str__` to better support the " +"*replacement of existing constants* use-case. :meth:`__format__` was " +"already :func:`int.__format__` for that same reason." msgstr "" -#: ../../library/enum.rst:748 +#: ../../library/enum.rst:415 msgid "" -"%-style formatting: `%s` and `%r` call the :class:`Enum` class's :meth:" -"`__str__` and :meth:`__repr__` respectively; other codes (such as `%i` or `" -"%h` for IntEnum) treat the enum member as its mixed-in type." +"*StrEnum* is the same as *Enum*, but its members are also strings and can be " +"used in most of the same places that a string can be used. The result of " +"any string operation performed on or with a *StrEnum* member is not part of " +"the enumeration." msgstr "" -#: ../../library/enum.rst:751 +#: ../../library/enum.rst:419 msgid "" -":ref:`Formatted string literals `, :meth:`str.format`, and :func:" -"`format` will use the mixed-in type's :meth:`__format__` unless :meth:" -"`__str__` or :meth:`__format__` is overridden in the subclass, in which case " -"the overridden methods or :class:`Enum` methods will be used. Use the !s " -"and !r format codes to force usage of the :class:`Enum` class's :meth:" -"`__str__` and :meth:`__repr__` methods." +"There are places in the stdlib that check for an exact :class:`str` instead " +"of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " +"``isinstance(str, unknown)``), and in those locations you will need to use " +"``str(StrEnum.member)``." msgstr "" -#: ../../library/enum.rst:759 -msgid "When to use :meth:`__new__` vs. :meth:`__init__`" +#: ../../library/enum.rst:426 +msgid "" +"Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " +"name as the value." msgstr "" -#: ../../library/enum.rst:761 +#: ../../library/enum.rst:429 msgid "" -":meth:`__new__` must be used whenever you want to customize the actual value " -"of the :class:`Enum` member. Any other modifications may go in either :meth:" -"`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred." +":meth:`__str__` is :func:`str.__str__` to better support the *replacement of " +"existing constants* use-case. :meth:`__format__` is likewise :func:`str." +"__format__` for that same reason." msgstr "" -#: ../../library/enum.rst:765 +#: ../../library/enum.rst:437 msgid "" -"For example, if you want to pass several items to the constructor, but only " -"want one of them to be the value::" +"*Flag* members support the bitwise operators ``&`` (*AND*), ``|`` (*OR*), " +"``^`` (*XOR*), and ``~`` (*INVERT*); the results of those operators are " +"members of the enumeration." msgstr "" -#: ../../library/enum.rst:791 -msgid "Interesting examples" +#: ../../library/enum.rst:443 +msgid "Returns *True* if value is in self::" msgstr "" -#: ../../library/enum.rst:793 -msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`IntFlag`, and :class:`Flag` " -"are expected to cover the majority of use-cases, they cannot cover them " -"all. Here are recipes for some different types of enumerations that can be " -"used directly, or as examples for creating one's own." +#: ../../library/enum.rst:463 +msgid "Returns all contained members::" msgstr "" -#: ../../library/enum.rst:800 -msgid "Omitting values" +#: ../../library/enum.rst:472 +msgid "Returns number of members in flag::" msgstr "" -#: ../../library/enum.rst:802 -msgid "" -"In many use-cases one doesn't care what the actual value of an enumeration " -"is. There are several ways to define this type of simple enumeration:" +#: ../../library/enum.rst:481 +msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "" -#: ../../library/enum.rst:805 -msgid "use instances of :class:`auto` for the value" +#: ../../library/enum.rst:493 +msgid "Returns current flag binary or'ed with other::" msgstr "" -#: ../../library/enum.rst:806 -msgid "use instances of :class:`object` as the value" +#: ../../library/enum.rst:500 +msgid "Returns current flag binary and'ed with other::" msgstr "" -#: ../../library/enum.rst:807 -msgid "use a descriptive string as the value" +#: ../../library/enum.rst:509 +msgid "Returns current flag binary xor'ed with other::" msgstr "" -#: ../../library/enum.rst:808 -msgid "" -"use a tuple as the value and a custom :meth:`__new__` to replace the tuple " -"with an :class:`int` value" +#: ../../library/enum.rst:518 +msgid "Returns all the flags in *type(self)* that are not in self::" msgstr "" -#: ../../library/enum.rst:811 +#: ../../library/enum.rst:529 msgid "" -"Using any of these methods signifies to the user that these values are not " -"important, and also enables one to add, remove, or reorder members without " -"having to renumber the remaining members." +"Function used to format any remaining unnamed numeric values. Default is " +"the value's repr; common choices are :func:`hex` and :func:`oct`." msgstr "" -#: ../../library/enum.rst:815 +#: ../../library/enum.rst:534 msgid "" -"Whichever method you choose, you should provide a :meth:`repr` that also " -"hides the (unimportant) value::" +"Using :class:`auto` with :class:`Flag` results in integers that are powers " +"of two, starting with ``1``." msgstr "" -#: ../../library/enum.rst:825 -msgid "Using :class:`auto`" +#: ../../library/enum.rst:537 +msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "" -#: ../../library/enum.rst:827 -msgid "Using :class:`auto` would look like::" -msgstr "" - -#: ../../library/enum.rst:839 -msgid "Using :class:`object`" +#: ../../library/enum.rst:545 +msgid "" +"*IntFlag* is the same as *Flag*, but its members are also integers and can " +"be used anywhere that an integer can be used." msgstr "" -#: ../../library/enum.rst:841 -msgid "Using :class:`object` would look like::" +#: ../../library/enum.rst:558 +msgid "" +"If any integer operation is performed with an *IntFlag* member, the result " +"is not an *IntFlag*::" msgstr "" -#: ../../library/enum.rst:853 -msgid "Using a descriptive string" +#: ../../library/enum.rst:564 +msgid "If a *Flag* operation is performed with an *IntFlag* member and:" msgstr "" -#: ../../library/enum.rst:855 -msgid "Using a string as the value would look like::" +#: ../../library/enum.rst:566 +msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "" -#: ../../library/enum.rst:869 -msgid "Using a custom :meth:`__new__`" +#: ../../library/enum.rst:567 +msgid "" +"the result is not a valid *IntFlag*: the result depends on the " +"*FlagBoundary* setting" msgstr "" -#: ../../library/enum.rst:871 -msgid "Using an auto-numbering :meth:`__new__` would look like::" +#: ../../library/enum.rst:569 +msgid "The *repr()* of unnamed zero-valued flags has changed. It is now:" msgstr "" -#: ../../library/enum.rst:890 +#: ../../library/enum.rst:576 msgid "" -"To make a more general purpose ``AutoNumber``, add ``*args`` to the " -"signature::" +"Using :class:`auto` with :class:`IntFlag` results in integers that are " +"powers of two, starting with ``1``." msgstr "" -#: ../../library/enum.rst:900 +#: ../../library/enum.rst:586 msgid "" -"Then when you inherit from ``AutoNumber`` you can write your own " -"``__init__`` to handle any extra arguments::" +"*EnumCheck* contains the options used by the :func:`verify` decorator to " +"ensure various constraints; failed constraints result in a :exc:`ValueError`." msgstr "" -#: ../../library/enum.rst:919 -msgid "" -"The :meth:`__new__` method, if defined, is used during creation of the Enum " -"members; it is then replaced by Enum's :meth:`__new__` which is used after " -"class creation for lookup of existing members." +#: ../../library/enum.rst:591 +msgid "Ensure that each value has only one name::" msgstr "" -#: ../../library/enum.rst:925 -msgid "OrderedEnum" -msgstr "OrderedEnum" - -#: ../../library/enum.rst:927 +#: ../../library/enum.rst:607 msgid "" -"An ordered enumeration that is not based on :class:`IntEnum` and so " -"maintains the normal :class:`Enum` invariants (such as not being comparable " -"to other enumerations)::" +"Ensure that there are no missing values between the lowest-valued member and " +"the highest-valued member::" msgstr "" -#: ../../library/enum.rst:961 -msgid "DuplicateFreeEnum" -msgstr "DuplicateFreeEnum" - -#: ../../library/enum.rst:963 +#: ../../library/enum.rst:622 msgid "" -"Raises an error if a duplicate member name is found instead of creating an " -"alias::" +"Ensure that any flag groups/masks contain only named flags -- useful when " +"values are specified instead of being generated by :func:`auto`" msgstr "" -#: ../../library/enum.rst:988 +#: ../../library/enum.rst:639 msgid "" -"This is a useful example for subclassing Enum to add or change other " -"behaviors as well as disallowing aliases. If the only desired change is " -"disallowing aliases, the :func:`unique` decorator can be used instead." -msgstr "" - -#: ../../library/enum.rst:994 -msgid "Planet" +"CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "" -#: ../../library/enum.rst:996 +#: ../../library/enum.rst:645 msgid "" -"If :meth:`__new__` or :meth:`__init__` is defined the value of the enum " -"member will be passed to those methods::" -msgstr "" - -#: ../../library/enum.rst:1024 -msgid "TimePeriod" -msgstr "TimePeriod" - -#: ../../library/enum.rst:1026 -msgid "An example to show the :attr:`_ignore_` attribute in use::" +"*FlagBoundary* controls how out-of-range values are handled in *Flag* and " +"its subclasses." msgstr "" -#: ../../library/enum.rst:1043 -msgid "How are Enums different?" -msgstr "" - -#: ../../library/enum.rst:1045 +#: ../../library/enum.rst:650 msgid "" -"Enums have a custom metaclass that affects many aspects of both derived Enum " -"classes and their instances (members)." +"Out-of-range values cause a :exc:`ValueError` to be raised. This is the " +"default for :class:`Flag`::" msgstr "" -#: ../../library/enum.rst:1050 -msgid "Enum Classes" -msgstr "" - -#: ../../library/enum.rst:1052 +#: ../../library/enum.rst:667 msgid "" -"The :class:`EnumMeta` metaclass is responsible for providing the :meth:" -"`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " -"allow one to do things with an :class:`Enum` class that fail on a typical " -"class, such as `list(Color)` or `some_enum_var in Color`. :class:`EnumMeta` " -"is responsible for ensuring that various other methods on the final :class:" -"`Enum` class are correct (such as :meth:`__new__`, :meth:`__getnewargs__`, :" -"meth:`__str__` and :meth:`__repr__`)." -msgstr "" - -#: ../../library/enum.rst:1062 -msgid "Enum Members (aka instances)" +"Out-of-range values have invalid values removed, leaving a valid *Flag* " +"value::" msgstr "" -#: ../../library/enum.rst:1064 +#: ../../library/enum.rst:680 msgid "" -"The most interesting thing about Enum members is that they are singletons. :" -"class:`EnumMeta` creates them all while it is creating the :class:`Enum` " -"class itself, and then puts a custom :meth:`__new__` in place to ensure that " -"no new ones are ever instantiated by returning only the existing member " -"instances." +"Out-of-range values lose their *Flag* membership and revert to :class:`int`. " +"This is the default for :class:`IntFlag`::" msgstr "" -#: ../../library/enum.rst:1072 -msgid "Finer Points" +#: ../../library/enum.rst:693 +msgid "" +"Out-of-range values are kept, and the *Flag* membership is kept. This is " +"used for some stdlib flags:" msgstr "" -#: ../../library/enum.rst:1075 +#: ../../library/enum.rst:709 msgid "Supported ``__dunder__`` names" msgstr "" -#: ../../library/enum.rst:1077 +#: ../../library/enum.rst:711 msgid "" ":attr:`__members__` is a read-only ordered mapping of ``member_name``:" "``member`` items. It is only available on the class." msgstr "" -#: ../../library/enum.rst:1080 +#: ../../library/enum.rst:714 msgid "" ":meth:`__new__`, if specified, must create and return the enum members; it " "is also a very good idea to set the member's :attr:`_value_` appropriately. " "Once all the members are created it is no longer used." msgstr "" -#: ../../library/enum.rst:1086 +#: ../../library/enum.rst:720 msgid "Supported ``_sunder_`` names" msgstr "" -#: ../../library/enum.rst:1088 +#: ../../library/enum.rst:722 msgid "``_name_`` -- name of the member" msgstr "" -#: ../../library/enum.rst:1089 +#: ../../library/enum.rst:723 msgid "" "``_value_`` -- value of the member; can be set / modified in ``__new__``" msgstr "" -#: ../../library/enum.rst:1091 +#: ../../library/enum.rst:725 msgid "" "``_missing_`` -- a lookup function used when a value is not found; may be " "overridden" msgstr "" -#: ../../library/enum.rst:1093 +#: ../../library/enum.rst:727 msgid "" "``_ignore_`` -- a list of names, either as a :class:`list` or a :class:" "`str`, that will not be transformed into members, and will be removed from " "the final class" msgstr "" -#: ../../library/enum.rst:1096 +#: ../../library/enum.rst:730 msgid "" "``_order_`` -- used in Python 2/3 code to ensure member order is consistent " "(class attribute, removed during class creation)" msgstr "" -#: ../../library/enum.rst:1098 +#: ../../library/enum.rst:732 +msgid "" +"``_generate_next_value_`` -- used to get an appropriate value for an enum " +"member; may be overridden" +msgstr "" + +#: ../../library/enum.rst:737 +msgid "" +"For standard :class:`Enum` classes the next value chosen is the last value " +"seen incremented by one." +msgstr "" + +#: ../../library/enum.rst:740 msgid "" -"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:" -"`auto` to get an appropriate value for an enum member; may be overridden" +"For :class:`Flag` classes the next value chosen will be the next highest " +"power-of-two, regardless of the last value seen." msgstr "" -#: ../../library/enum.rst:1102 +#: ../../library/enum.rst:743 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``\\ 、\\ ``_order_``\\ 、\\ ``_generate_next_value_``" -#: ../../library/enum.rst:1103 +#: ../../library/enum.rst:744 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:1105 +#: ../../library/enum.rst:749 +msgid "Utilities and Decorators" +msgstr "" + +#: ../../library/enum.rst:753 msgid "" -"To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute " -"can be provided. It will be checked against the actual order of the " -"enumeration and raise an error if the two do not match::" +"*auto* can be used in place of a value. If used, the *Enum* machinery will " +"call an *Enum*'s :meth:`_generate_next_value_` to get an appropriate value. " +"For *Enum* and *IntEnum* that appropriate value will be the last value plus " +"one; for *Flag* and *IntFlag* it will be the first power-of-two greater than " +"the last value; for *StrEnum* it will be the lower-cased version of the " +"member's name." msgstr "" -#: ../../library/enum.rst:1121 +#: ../../library/enum.rst:760 msgid "" -"In Python 2 code the :attr:`_order_` attribute is necessary as definition " -"order is lost before it can be recorded." +"``_generate_next_value_`` can be overridden to customize the values used by " +"*auto*." msgstr "" -#: ../../library/enum.rst:1126 -msgid "_Private__names" -msgstr "_Private__names" +#: ../../library/enum.rst:763 +msgid "" +"in 3.13 the default ``\"generate_next_value_`` will always return the " +"highest member value incremented by 1, and will fail if any member is an " +"incompatible type." +msgstr "" -#: ../../library/enum.rst:1128 +#: ../../library/enum.rst:769 msgid "" -":ref:`Private names ` will be normal attributes in " -"Python 3.11 instead of either an error or a member (depending on if the name " -"ends with an underscore). Using these names in 3.10 will issue a :exc:" -"`DeprecationWarning`." +"A decorator similar to the built-in *property*, but specifically for " +"enumerations. It allows member attributes to have the same names as members " +"themselves." msgstr "" -#: ../../library/enum.rst:1134 -msgid "``Enum`` member type" +#: ../../library/enum.rst:773 +msgid "" +"the *property* and the member must be defined in separate classes; for " +"example, the *value* and *name* attributes are defined in the *Enum* class, " +"and *Enum* subclasses can define members with the names ``value`` and " +"``name``." msgstr "" -#: ../../library/enum.rst:1136 +#: ../../library/enum.rst:782 msgid "" -":class:`Enum` members are instances of their :class:`Enum` class, and are " -"normally accessed as ``EnumClass.member``. Under certain circumstances they " -"can also be accessed as ``EnumClass.member.member``, but you should never do " -"this as that lookup may fail or, worse, return something besides the :class:" -"`Enum` member you are looking for (this is another good reason to use all-" -"uppercase names for members)::" +"A :keyword:`class` decorator specifically for enumerations. It searches an " +"enumeration's :attr:`__members__`, gathering any aliases it finds; if any " +"are found :exc:`ValueError` is raised with the details::" msgstr "" -#: ../../library/enum.rst:1155 -msgid "This behavior is deprecated and will be removed in 3.11." +#: ../../library/enum.rst:800 +msgid "" +"A :keyword:`class` decorator specifically for enumerations. Members from :" +"class:`EnumCheck` are used to specify which constraints should be checked on " +"the decorated enumeration." msgstr "" -#: ../../library/enum.rst:1161 -msgid "Boolean value of ``Enum`` classes and members" +#: ../../library/enum.rst:808 +msgid "A decorator for use in enums: its target will become a member." msgstr "" -#: ../../library/enum.rst:1163 -msgid "" -":class:`Enum` members that are mixed with non-:class:`Enum` types (such as :" -"class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " -"type's rules; otherwise, all members evaluate as :data:`True`. To make your " -"own Enum's boolean evaluation depend on the member's value add the following " -"to your class::" +#: ../../library/enum.rst:814 +msgid "A decorator for use in enums: its target will not become a member." msgstr "" -#: ../../library/enum.rst:1172 -msgid ":class:`Enum` classes always evaluate as :data:`True`." +#: ../../library/enum.rst:821 +msgid "Notes" msgstr "" -#: ../../library/enum.rst:1176 -msgid "``Enum`` classes with methods" +#: ../../library/enum.rst:823 +msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr "" -#: ../../library/enum.rst:1178 +#: ../../library/enum.rst:825 msgid "" -"If you give your :class:`Enum` subclass extra methods, like the `Planet`_ " -"class above, those methods will show up in a :func:`dir` of the member, but " -"not of the class::" +"These three enum types are designed to be drop-in replacements for existing " +"integer- and string-based values; as such, they have extra limitations:" msgstr "" -#: ../../library/enum.rst:1189 -msgid "Combining members of ``Flag``" +#: ../../library/enum.rst:828 +msgid "``__str__`` uses the value and not the name of the enum member" msgstr "" -#: ../../library/enum.rst:1191 +#: ../../library/enum.rst:830 msgid "" -"If a combination of Flag members is not named, the :func:`repr` will include " -"all named flags and all named combinations of flags that are in the value::" +"``__format__``, because it uses ``__str__``, will also use the value of the " +"enum member instead of its name" msgstr "" -#: ../../library/enum.rst:1209 +#: ../../library/enum.rst:833 msgid "" -"In 3.11 unnamed combinations of flags will only produce the canonical flag " -"members (aka single-value flags). So ``Color(7)`` will produce something " -"like ````." +"If you do not need/want those limitations, you can either create your own " +"base class by mixing in the ``int`` or ``str`` type yourself::" +msgstr "" + +#: ../../library/enum.rst:840 +msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "" + +#~ msgid "The *start* parameter was added." +#~ msgstr "新增 *start* 參數。" + +#~ msgid "OrderedEnum" +#~ msgstr "OrderedEnum" + +#~ msgid "DuplicateFreeEnum" +#~ msgstr "DuplicateFreeEnum" + +#~ msgid "TimePeriod" +#~ msgstr "TimePeriod" + +#~ msgid "_Private__names" +#~ msgstr "_Private__names" diff --git a/library/errno.po b/library/errno.po index 352d109812..fccb5e3bba 100644 --- a/library/errno.po +++ b/library/errno.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-06 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -572,3 +572,17 @@ msgstr "" #: ../../library/errno.rst:653 msgid "Quota exceeded" msgstr "" + +#: ../../library/errno.rst:657 +msgid "Interface output queue is full" +msgstr "" + +#: ../../library/errno.rst:663 +msgid "" +"Capabilities insufficient. This error is mapped to the exception :exc:" +"`PermissionError`." +msgstr "" + +#: ../../library/errno.rst:667 +msgid ":ref:`Availability `: WASI, FreeBSD" +msgstr ":ref:`適用 `:WASI, FreeBSD" diff --git a/library/exceptions.po b/library/exceptions.po index 7928fe9373..140e0e27ae 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-06 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -169,52 +169,65 @@ msgid "" "it to propagate to the caller. ::" msgstr "" -#: ../../library/exceptions.rst:132 +#: ../../library/exceptions.rst:131 +msgid "" +"Add the string ``note`` to the exception's notes which appear in the " +"standard traceback after the exception string. A :exc:`TypeError` is raised " +"if ``note`` is not a string." +msgstr "" + +#: ../../library/exceptions.rst:139 +msgid "" +"A list of the notes of this exception, which were added with :meth:" +"`add_note`. This attribute is created when :meth:`add_note` is called." +msgstr "" + +#: ../../library/exceptions.rst:147 msgid "" "All built-in, non-system-exiting exceptions are derived from this class. " "All user-defined exceptions should also be derived from this class." msgstr "" -#: ../../library/exceptions.rst:138 +#: ../../library/exceptions.rst:153 msgid "" "The base class for those built-in exceptions that are raised for various " "arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" "`FloatingPointError`." msgstr "" -#: ../../library/exceptions.rst:145 +#: ../../library/exceptions.rst:160 msgid "" "Raised when a :ref:`buffer ` related operation cannot be " "performed." msgstr "" -#: ../../library/exceptions.rst:151 +#: ../../library/exceptions.rst:166 msgid "" "The base class for the exceptions that are raised when a key or index used " "on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " "This can be raised directly by :func:`codecs.lookup`." msgstr "" -#: ../../library/exceptions.rst:157 +#: ../../library/exceptions.rst:172 msgid "Concrete exceptions" msgstr "" -#: ../../library/exceptions.rst:159 +#: ../../library/exceptions.rst:174 msgid "The following exceptions are the exceptions that are usually raised." msgstr "" -#: ../../library/exceptions.rst:165 +#: ../../library/exceptions.rst:180 msgid "Raised when an :keyword:`assert` statement fails." msgstr "" -#: ../../library/exceptions.rst:170 +#: ../../library/exceptions.rst:185 msgid "" "Raised when an attribute reference (see :ref:`attribute-references`) or " "assignment fails. (When an object does not support attribute references or " "attribute assignments at all, :exc:`TypeError` is raised.)" msgstr "" -#: ../../library/exceptions.rst:174 +#: ../../library/exceptions.rst:189 msgid "" "The :attr:`name` and :attr:`obj` attributes can be set using keyword-only " "arguments to the constructor. When set they represent the name of the " @@ -222,22 +235,22 @@ msgid "" "for said attribute, respectively." msgstr "" -#: ../../library/exceptions.rst:179 +#: ../../library/exceptions.rst:194 msgid "Added the :attr:`name` and :attr:`obj` attributes." msgstr "新增 :attr:`name` 與 :attr:`obj` 屬性。" -#: ../../library/exceptions.rst:184 +#: ../../library/exceptions.rst:199 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " "without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." "IOBase.readline` methods return an empty string when they hit EOF.)" msgstr "" -#: ../../library/exceptions.rst:191 +#: ../../library/exceptions.rst:206 msgid "Not currently used." msgstr "" -#: ../../library/exceptions.rst:196 +#: ../../library/exceptions.rst:211 msgid "" "Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" "`generator.close` and :meth:`coroutine.close`. It directly inherits from :" @@ -245,14 +258,14 @@ msgid "" "an error." msgstr "" -#: ../../library/exceptions.rst:204 +#: ../../library/exceptions.rst:219 msgid "" "Raised when the :keyword:`import` statement has troubles trying to load a " "module. Also raised when the \"from list\" in ``from ... import`` has a " "name that cannot be found." msgstr "" -#: ../../library/exceptions.rst:208 +#: ../../library/exceptions.rst:223 msgid "" "The :attr:`name` and :attr:`path` attributes can be set using keyword-only " "arguments to the constructor. When set they represent the name of the module " @@ -260,31 +273,31 @@ msgid "" "the exception, respectively." msgstr "" -#: ../../library/exceptions.rst:213 +#: ../../library/exceptions.rst:228 msgid "Added the :attr:`name` and :attr:`path` attributes." msgstr "新增 :attr:`name` 與 :attr:`path` 屬性。" -#: ../../library/exceptions.rst:218 +#: ../../library/exceptions.rst:233 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " "module could not be located. It is also raised when ``None`` is found in :" "data:`sys.modules`." msgstr "" -#: ../../library/exceptions.rst:227 +#: ../../library/exceptions.rst:242 msgid "" "Raised when a sequence subscript is out of range. (Slice indices are " "silently truncated to fall in the allowed range; if an index is not an " "integer, :exc:`TypeError` is raised.)" msgstr "" -#: ../../library/exceptions.rst:236 +#: ../../library/exceptions.rst:251 msgid "" "Raised when a mapping (dictionary) key is not found in the set of existing " "keys." msgstr "" -#: ../../library/exceptions.rst:243 +#: ../../library/exceptions.rst:258 msgid "" "Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" "kbd:`Delete`). During execution, a check for interrupts is made regularly. " @@ -293,7 +306,7 @@ msgid "" "the interpreter from exiting." msgstr "" -#: ../../library/exceptions.rst:251 +#: ../../library/exceptions.rst:266 msgid "" "Catching a :exc:`KeyboardInterrupt` requires special consideration. Because " "it can be raised at unpredictable points, it may, in some circumstances, " @@ -302,7 +315,7 @@ msgid "" "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" -#: ../../library/exceptions.rst:261 +#: ../../library/exceptions.rst:276 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " @@ -313,25 +326,25 @@ msgid "" "stack traceback can be printed, in case a run-away program was the cause." msgstr "" -#: ../../library/exceptions.rst:272 +#: ../../library/exceptions.rst:287 msgid "" "Raised when a local or global name is not found. This applies only to " "unqualified names. The associated value is an error message that includes " "the name that could not be found." msgstr "" -#: ../../library/exceptions.rst:276 +#: ../../library/exceptions.rst:291 msgid "" "The :attr:`name` attribute can be set using a keyword-only argument to the " "constructor. When set it represent the name of the variable that was " "attempted to be accessed." msgstr "" -#: ../../library/exceptions.rst:280 +#: ../../library/exceptions.rst:295 msgid "Added the :attr:`name` attribute." msgstr "新增 :attr:`name` 屬性。" -#: ../../library/exceptions.rst:286 +#: ../../library/exceptions.rst:301 msgid "" "This exception is derived from :exc:`RuntimeError`. In user defined base " "classes, abstract methods should raise this exception when they require " @@ -339,28 +352,28 @@ msgid "" "developed to indicate that the real implementation still needs to be added." msgstr "" -#: ../../library/exceptions.rst:293 +#: ../../library/exceptions.rst:308 msgid "" "It should not be used to indicate that an operator or method is not meant to " "be supported at all -- in that case either leave the operator / method " "undefined or, if a subclass, set it to :data:`None`." msgstr "" -#: ../../library/exceptions.rst:299 +#: ../../library/exceptions.rst:314 msgid "" "``NotImplementedError`` and ``NotImplemented`` are not interchangeable, even " "though they have similar names and purposes. See :data:`NotImplemented` for " "details on when to use it." msgstr "" -#: ../../library/exceptions.rst:308 +#: ../../library/exceptions.rst:323 msgid "" "This exception is raised when a system function returns a system-related " "error, including I/O failures such as \"file not found\" or \"disk full" "\" (not for illegal argument types or other incidental errors)." msgstr "" -#: ../../library/exceptions.rst:312 +#: ../../library/exceptions.rst:327 msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " @@ -369,7 +382,7 @@ msgid "" "constructor arguments." msgstr "" -#: ../../library/exceptions.rst:318 +#: ../../library/exceptions.rst:333 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " @@ -378,18 +391,18 @@ msgid "" "subclassing." msgstr "" -#: ../../library/exceptions.rst:326 +#: ../../library/exceptions.rst:341 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "" -#: ../../library/exceptions.rst:330 +#: ../../library/exceptions.rst:345 msgid "" "Under Windows, this gives you the native Windows error code. The :attr:`." "errno` attribute is then an approximate translation, in POSIX terms, of that " "native error code." msgstr "" -#: ../../library/exceptions.rst:334 +#: ../../library/exceptions.rst:349 msgid "" "Under Windows, if the *winerror* constructor argument is an integer, the :" "attr:`.errno` attribute is determined from the Windows error code, and the " @@ -397,14 +410,14 @@ msgid "" "ignored, and the :attr:`winerror` attribute does not exist." msgstr "" -#: ../../library/exceptions.rst:342 +#: ../../library/exceptions.rst:357 msgid "" "The corresponding error message, as provided by the operating system. It is " "formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" "`FormatMessage` under Windows." msgstr "" -#: ../../library/exceptions.rst:350 +#: ../../library/exceptions.rst:365 msgid "" "For exceptions that involve a file system path (such as :func:`open` or :" "func:`os.unlink`), :attr:`filename` is the file name passed to the function. " @@ -413,14 +426,14 @@ msgid "" "the function." msgstr "" -#: ../../library/exceptions.rst:357 +#: ../../library/exceptions.rst:372 msgid "" ":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." "error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" "`OSError`, and the constructor may return a subclass." msgstr "" -#: ../../library/exceptions.rst:363 +#: ../../library/exceptions.rst:378 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " "function, instead of the name encoded to or decoded from the :term:" @@ -428,7 +441,7 @@ msgid "" "argument and attribute was added." msgstr "" -#: ../../library/exceptions.rst:372 +#: ../../library/exceptions.rst:387 msgid "" "Raised when the result of an arithmetic operation is too large to be " "represented. This cannot occur for integers (which would rather raise :exc:" @@ -438,18 +451,18 @@ msgid "" "in C, most floating point operations are not checked." msgstr "" -#: ../../library/exceptions.rst:382 +#: ../../library/exceptions.rst:397 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " "interpreter detects that the maximum recursion depth (see :func:`sys." "getrecursionlimit`) is exceeded." msgstr "" -#: ../../library/exceptions.rst:386 +#: ../../library/exceptions.rst:401 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/exceptions.rst:392 +#: ../../library/exceptions.rst:407 msgid "" "This exception is raised when a weak reference proxy, created by the :func:" "`weakref.proxy` function, is used to access an attribute of the referent " @@ -457,65 +470,65 @@ msgid "" "references, see the :mod:`weakref` module." msgstr "" -#: ../../library/exceptions.rst:400 +#: ../../library/exceptions.rst:415 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " "wrong." msgstr "" -#: ../../library/exceptions.rst:407 +#: ../../library/exceptions.rst:422 msgid "" "Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" "`~iterator.__next__` method to signal that there are no further items " "produced by the iterator." msgstr "" -#: ../../library/exceptions.rst:411 +#: ../../library/exceptions.rst:426 msgid "" "The exception object has a single attribute :attr:`value`, which is given as " "an argument when constructing the exception, and defaults to :const:`None`." msgstr "" -#: ../../library/exceptions.rst:415 +#: ../../library/exceptions.rst:430 msgid "" "When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" "`StopIteration` instance is raised, and the value returned by the function " "is used as the :attr:`value` parameter to the constructor of the exception." msgstr "" -#: ../../library/exceptions.rst:420 +#: ../../library/exceptions.rst:435 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -#: ../../library/exceptions.rst:424 +#: ../../library/exceptions.rst:439 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "" -#: ../../library/exceptions.rst:428 +#: ../../library/exceptions.rst:443 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." msgstr "" -#: ../../library/exceptions.rst:432 +#: ../../library/exceptions.rst:447 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." msgstr "" -#: ../../library/exceptions.rst:438 +#: ../../library/exceptions.rst:453 msgid "" "Must be raised by :meth:`__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." msgstr "" -#: ../../library/exceptions.rst:445 +#: ../../library/exceptions.rst:460 msgid "" "Raised when the parser encounters a syntax error. This may occur in an :" "keyword:`import` statement, in a call to the built-in functions :func:" @@ -523,45 +536,45 @@ msgid "" "or standard input (also interactively)." msgstr "" -#: ../../library/exceptions.rst:451 +#: ../../library/exceptions.rst:466 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." msgstr "" -#: ../../library/exceptions.rst:456 +#: ../../library/exceptions.rst:471 msgid "The name of the file the syntax error occurred in." msgstr "" -#: ../../library/exceptions.rst:460 +#: ../../library/exceptions.rst:475 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" -#: ../../library/exceptions.rst:465 +#: ../../library/exceptions.rst:480 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." msgstr "" -#: ../../library/exceptions.rst:470 +#: ../../library/exceptions.rst:485 msgid "The source code text involved in the error." msgstr "" -#: ../../library/exceptions.rst:474 +#: ../../library/exceptions.rst:489 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." msgstr "" -#: ../../library/exceptions.rst:479 +#: ../../library/exceptions.rst:494 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." msgstr "" -#: ../../library/exceptions.rst:482 +#: ../../library/exceptions.rst:497 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -569,30 +582,30 @@ msgid "" "attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." msgstr "" -#: ../../library/exceptions.rst:487 +#: ../../library/exceptions.rst:502 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:492 +#: ../../library/exceptions.rst:507 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" -#: ../../library/exceptions.rst:498 +#: ../../library/exceptions.rst:513 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -#: ../../library/exceptions.rst:504 +#: ../../library/exceptions.rst:519 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " "a string indicating what went wrong (in low-level terms)." msgstr "" -#: ../../library/exceptions.rst:508 +#: ../../library/exceptions.rst:523 msgid "" "You should report this to the author or maintainer of your Python " "interpreter. Be sure to report the version of the Python interpreter (``sys." @@ -601,7 +614,7 @@ msgid "" "possible the source of the program that triggered the error." msgstr "" -#: ../../library/exceptions.rst:517 +#: ../../library/exceptions.rst:532 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " @@ -615,7 +628,7 @@ msgid "" "printed and the exit status is one." msgstr "" -#: ../../library/exceptions.rst:528 +#: ../../library/exceptions.rst:543 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -625,20 +638,20 @@ msgid "" "child process after a call to :func:`os.fork`)." msgstr "" -#: ../../library/exceptions.rst:537 +#: ../../library/exceptions.rst:552 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "" -#: ../../library/exceptions.rst:543 +#: ../../library/exceptions.rst:558 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -#: ../../library/exceptions.rst:546 +#: ../../library/exceptions.rst:561 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -646,7 +659,7 @@ msgid "" "implementation, :exc:`NotImplementedError` is the proper exception to raise." msgstr "" -#: ../../library/exceptions.rst:551 +#: ../../library/exceptions.rst:566 msgid "" "Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" "class:`int` is expected) should result in a :exc:`TypeError`, but passing " @@ -654,99 +667,99 @@ msgid "" "should result in a :exc:`ValueError`." msgstr "" -#: ../../library/exceptions.rst:558 +#: ../../library/exceptions.rst:573 msgid "" "Raised when a reference is made to a local variable in a function or method, " "but no value has been bound to that variable. This is a subclass of :exc:" "`NameError`." msgstr "" -#: ../../library/exceptions.rst:565 +#: ../../library/exceptions.rst:580 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." msgstr "" -#: ../../library/exceptions.rst:568 +#: ../../library/exceptions.rst:583 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -#: ../../library/exceptions.rst:574 +#: ../../library/exceptions.rst:589 msgid "The name of the encoding that raised the error." msgstr "" -#: ../../library/exceptions.rst:578 +#: ../../library/exceptions.rst:593 msgid "A string describing the specific codec error." msgstr "" -#: ../../library/exceptions.rst:582 +#: ../../library/exceptions.rst:597 msgid "The object the codec was attempting to encode or decode." msgstr "" -#: ../../library/exceptions.rst:586 +#: ../../library/exceptions.rst:601 msgid "The first index of invalid data in :attr:`object`." msgstr "" -#: ../../library/exceptions.rst:590 +#: ../../library/exceptions.rst:605 msgid "The index after the last invalid data in :attr:`object`." msgstr "" -#: ../../library/exceptions.rst:595 +#: ../../library/exceptions.rst:610 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: ../../library/exceptions.rst:601 +#: ../../library/exceptions.rst:616 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: ../../library/exceptions.rst:607 +#: ../../library/exceptions.rst:622 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: ../../library/exceptions.rst:613 +#: ../../library/exceptions.rst:628 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -#: ../../library/exceptions.rst:620 +#: ../../library/exceptions.rst:635 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " "operation." msgstr "" -#: ../../library/exceptions.rst:625 +#: ../../library/exceptions.rst:640 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -#: ../../library/exceptions.rst:634 +#: ../../library/exceptions.rst:649 msgid "Only available on Windows." msgstr "" -#: ../../library/exceptions.rst:638 +#: ../../library/exceptions.rst:653 msgid "OS exceptions" msgstr "" -#: ../../library/exceptions.rst:640 +#: ../../library/exceptions.rst:655 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "" -#: ../../library/exceptions.rst:645 +#: ../../library/exceptions.rst:660 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds to :c:data:`errno` :py:data:`~errno." @@ -754,36 +767,36 @@ msgid "" "data:`~errno.EINPROGRESS`." msgstr "" -#: ../../library/exceptions.rst:650 +#: ../../library/exceptions.rst:665 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" -#: ../../library/exceptions.rst:655 +#: ../../library/exceptions.rst:670 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " "from the :mod:`io` module." msgstr "" -#: ../../library/exceptions.rst:661 +#: ../../library/exceptions.rst:676 msgid "" "Raised when an operation on a child process failed. Corresponds to :c:data:" "`errno` :py:data:`~errno.ECHILD`." msgstr "" -#: ../../library/exceptions.rst:666 +#: ../../library/exceptions.rst:681 msgid "A base class for connection-related issues." msgstr "" -#: ../../library/exceptions.rst:668 +#: ../../library/exceptions.rst:683 msgid "" "Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" "`ConnectionRefusedError` and :exc:`ConnectionResetError`." msgstr "" -#: ../../library/exceptions.rst:673 +#: ../../library/exceptions.rst:688 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " @@ -791,58 +804,58 @@ msgid "" "`~errno.EPIPE` and :py:data:`~errno.ESHUTDOWN`." msgstr "" -#: ../../library/exceptions.rst:680 +#: ../../library/exceptions.rst:695 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "aborted by the peer. Corresponds to :c:data:`errno` :py:data:`~errno." "ECONNABORTED`." msgstr "" -#: ../../library/exceptions.rst:686 +#: ../../library/exceptions.rst:701 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "refused by the peer. Corresponds to :c:data:`errno` :py:data:`~errno." "ECONNREFUSED`." msgstr "" -#: ../../library/exceptions.rst:692 +#: ../../library/exceptions.rst:707 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:data:`~errno.ECONNRESET`." msgstr "" -#: ../../library/exceptions.rst:698 +#: ../../library/exceptions.rst:713 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:data:`~errno.EEXIST`." msgstr "" -#: ../../library/exceptions.rst:703 +#: ../../library/exceptions.rst:718 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:data:`~errno.ENOENT`." msgstr "" -#: ../../library/exceptions.rst:708 +#: ../../library/exceptions.rst:723 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:data:`~errno.EINTR`." msgstr "" -#: ../../library/exceptions.rst:711 +#: ../../library/exceptions.rst:726 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -#: ../../library/exceptions.rst:718 +#: ../../library/exceptions.rst:733 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:data:`~errno.EISDIR`." msgstr "" -#: ../../library/exceptions.rst:724 +#: ../../library/exceptions.rst:739 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -851,131 +864,238 @@ msgid "" "ENOTDIR`." msgstr "" -#: ../../library/exceptions.rst:732 +#: ../../library/exceptions.rst:747 msgid "" "Raised when trying to run an operation without the adequate access rights - " "for example filesystem permissions. Corresponds to :c:data:`errno` :py:data:" -"`~errno.EACCES` and :py:data:`~errno.EPERM`." +"`~errno.EACCES`, :py:data:`~errno.EPERM`, and :py:data:`~errno.ENOTCAPABLE`." +msgstr "" + +#: ../../library/exceptions.rst:752 +msgid "" +"WASI's :py:data:`~errno.ENOTCAPABLE` is now mapped to :exc:`PermissionError`." msgstr "" -#: ../../library/exceptions.rst:738 +#: ../../library/exceptions.rst:758 msgid "" "Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" "py:data:`~errno.ESRCH`." msgstr "" -#: ../../library/exceptions.rst:743 +#: ../../library/exceptions.rst:763 msgid "" "Raised when a system function timed out at the system level. Corresponds to :" "c:data:`errno` :py:data:`~errno.ETIMEDOUT`." msgstr "" -#: ../../library/exceptions.rst:746 +#: ../../library/exceptions.rst:766 msgid "All the above :exc:`OSError` subclasses were added." msgstr "" -#: ../../library/exceptions.rst:752 +#: ../../library/exceptions.rst:772 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr "" -#: ../../library/exceptions.rst:758 +#: ../../library/exceptions.rst:778 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:760 +#: ../../library/exceptions.rst:780 msgid "" "The following exceptions are used as warning categories; see the :ref:" "`warning-categories` documentation for more details." msgstr "" -#: ../../library/exceptions.rst:765 +#: ../../library/exceptions.rst:785 msgid "Base class for warning categories." msgstr "" -#: ../../library/exceptions.rst:770 +#: ../../library/exceptions.rst:790 msgid "Base class for warnings generated by user code." msgstr "" -#: ../../library/exceptions.rst:775 +#: ../../library/exceptions.rst:795 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "" -#: ../../library/exceptions.rst:778 +#: ../../library/exceptions.rst:798 msgid "" "Ignored by the default warning filters, except in the ``__main__`` module (:" "pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " "warning." msgstr "" -#: ../../library/exceptions.rst:782 ../../library/exceptions.rst:798 +#: ../../library/exceptions.rst:802 ../../library/exceptions.rst:818 msgid "The deprecation policy is described in :pep:`387`." msgstr "" -#: ../../library/exceptions.rst:787 +#: ../../library/exceptions.rst:807 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "" -#: ../../library/exceptions.rst:791 +#: ../../library/exceptions.rst:811 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " "already active deprecations." msgstr "" -#: ../../library/exceptions.rst:795 ../../library/exceptions.rst:821 -#: ../../library/exceptions.rst:848 +#: ../../library/exceptions.rst:815 ../../library/exceptions.rst:841 +#: ../../library/exceptions.rst:868 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." msgstr "" -#: ../../library/exceptions.rst:803 +#: ../../library/exceptions.rst:823 msgid "Base class for warnings about dubious syntax." msgstr "" -#: ../../library/exceptions.rst:808 +#: ../../library/exceptions.rst:828 msgid "Base class for warnings about dubious runtime behavior." msgstr "" -#: ../../library/exceptions.rst:813 +#: ../../library/exceptions.rst:833 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." msgstr "" -#: ../../library/exceptions.rst:819 +#: ../../library/exceptions.rst:839 msgid "Base class for warnings about probable mistakes in module imports." msgstr "" -#: ../../library/exceptions.rst:827 +#: ../../library/exceptions.rst:847 msgid "Base class for warnings related to Unicode." msgstr "" -#: ../../library/exceptions.rst:832 +#: ../../library/exceptions.rst:852 msgid "Base class for warnings related to encodings." msgstr "" -#: ../../library/exceptions.rst:834 +#: ../../library/exceptions.rst:854 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`\\ 。" -#: ../../library/exceptions.rst:841 +#: ../../library/exceptions.rst:861 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/exceptions.rst:846 +#: ../../library/exceptions.rst:866 msgid "Base class for warnings related to resource usage." msgstr "" -#: ../../library/exceptions.rst:856 +#: ../../library/exceptions.rst:875 +msgid "Exception groups" +msgstr "" + +#: ../../library/exceptions.rst:877 +msgid "" +"The following are used when it is necessary to raise multiple unrelated " +"exceptions. They are part of the exception hierarchy so they can be handled " +"with :keyword:`except` like all other exceptions. In addition, they are " +"recognised by :keyword:`except*`, which matches their subgroups " +"based on the types of the contained exceptions." +msgstr "" + +#: ../../library/exceptions.rst:886 +msgid "" +"Both of these exception types wrap the exceptions in the sequence ``excs``. " +"The ``msg`` parameter must be a string. The difference between the two " +"classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " +"it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:" +"`Exception` and it can only wrap subclasses of :exc:`Exception`. This design " +"is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" +"exc:`BaseExceptionGroup`." +msgstr "" + +#: ../../library/exceptions.rst:894 +msgid "" +"The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" +"`Exception` instances, so it can be used to make the selection automatic. " +"The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:" +"`TypeError` if any contained exception is not an :exc:`Exception` subclass." +msgstr "" + +#: ../../library/exceptions.rst:903 +msgid "The ``msg`` argument to the constructor. This is a read-only attribute." +msgstr "" + +#: ../../library/exceptions.rst:907 +msgid "" +"A tuple of the exceptions in the ``excs`` sequence given to the constructor. " +"This is a read-only attribute." +msgstr "" + +#: ../../library/exceptions.rst:912 +msgid "" +"Returns an exception group that contains only the exceptions from the " +"current group that match *condition*, or ``None`` if the result is empty." +msgstr "" + +#: ../../library/exceptions.rst:915 +msgid "" +"The condition can be either a function that accepts an exception and returns " +"true for those that should be in the subgroup, or it can be an exception " +"type or a tuple of exception types, which is used to check for a match using " +"the same check that is used in an ``except`` clause." +msgstr "" + +#: ../../library/exceptions.rst:920 +msgid "" +"The nesting structure of the current exception is preserved in the result, " +"as are the values of its :attr:`message`, :attr:`__traceback__`, :attr:" +"`__cause__`, :attr:`__context__` and :attr:`__notes__` fields. Empty nested " +"groups are omitted from the result." +msgstr "" + +#: ../../library/exceptions.rst:925 +msgid "" +"The condition is checked for all exceptions in the nested exception group, " +"including the top-level and any nested exception groups. If the condition is " +"true for such an exception group, it is included in the result in full." +msgstr "" + +#: ../../library/exceptions.rst:931 +msgid "" +"Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " +"``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" +"matching part." +msgstr "" + +#: ../../library/exceptions.rst:937 +msgid "" +"Returns an exception group with the same :attr:`message`, :attr:" +"`__traceback__`, :attr:`__cause__`, :attr:`__context__` and :attr:" +"`__notes__` but which wraps the exceptions in ``excs``." +msgstr "" + +#: ../../library/exceptions.rst:941 +msgid "" +"This method is used by :meth:`subgroup` and :meth:`split`. A subclass needs " +"to override it in order to make :meth:`subgroup` and :meth:`split` return " +"instances of the subclass rather than :exc:`ExceptionGroup`. ::" +msgstr "" + +#: ../../library/exceptions.rst:953 +msgid "" +"Note that :exc:`BaseExceptionGroup` defines :meth:`__new__`, so subclasses " +"that need a different constructor signature need to override that rather " +"than :meth:`__init__`. For example, the following defines an exception group " +"subclass which accepts an exit_code and and constructs the group's message " +"from it. ::" +msgstr "" + +#: ../../library/exceptions.rst:972 msgid "Exception hierarchy" msgstr "" -#: ../../library/exceptions.rst:858 +#: ../../library/exceptions.rst:974 msgid "The class hierarchy for built-in exceptions is:" msgstr "" diff --git a/library/fcntl.po b/library/fcntl.po index d1fa4959f9..e42f38f310 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,7 +30,18 @@ msgid "" "`ioctl(2)` Unix manual pages." msgstr "" -#: ../../library/fcntl.rst:21 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/fcntl.rst:23 msgid "" "All functions in this module take a file descriptor *fd* as their first " "argument. This can be an integer file descriptor, such as returned by ``sys." @@ -39,20 +50,20 @@ msgid "" "file descriptor." msgstr "" -#: ../../library/fcntl.rst:27 +#: ../../library/fcntl.rst:29 msgid "" "Operations in this module used to raise an :exc:`IOError` where they now " "raise an :exc:`OSError`." msgstr "" -#: ../../library/fcntl.rst:31 +#: ../../library/fcntl.rst:33 msgid "" "The fcntl module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " "``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file " "descriptors." msgstr "" -#: ../../library/fcntl.rst:36 +#: ../../library/fcntl.rst:38 msgid "" "On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains " "the path of a file from a file descriptor. On Linux(>=3.15), the fcntl " @@ -60,18 +71,25 @@ msgid "" "constants, which are used when working with open file description locks." msgstr "" -#: ../../library/fcntl.rst:43 +#: ../../library/fcntl.rst:45 msgid "" "On Linux >= 2.6.11, the fcntl module exposes the ``F_GETPIPE_SZ`` and " "``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's size " "respectively." msgstr "" -#: ../../library/fcntl.rst:48 +#: ../../library/fcntl.rst:50 +msgid "" +"On FreeBSD, the fcntl module exposes the ``F_DUP2FD`` and " +"``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, " +"the latter setting ``FD_CLOEXEC`` flag in addition." +msgstr "" + +#: ../../library/fcntl.rst:55 msgid "The module defines the following functions:" msgstr "" -#: ../../library/fcntl.rst:53 +#: ../../library/fcntl.rst:60 msgid "" "Perform the operation *cmd* on file descriptor *fd* (file objects providing " "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " @@ -90,23 +108,23 @@ msgid "" "result in a segmentation violation or a more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:70 +#: ../../library/fcntl.rst:77 msgid "If the :c:func:`fcntl` fails, an :exc:`OSError` is raised." msgstr "" -#: ../../library/fcntl.rst:72 +#: ../../library/fcntl.rst:90 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." msgstr "" -#: ../../library/fcntl.rst:77 +#: ../../library/fcntl.rst:84 msgid "" "This function is identical to the :func:`~fcntl.fcntl` function, except that " "the argument handling is even more complicated." msgstr "" -#: ../../library/fcntl.rst:80 +#: ../../library/fcntl.rst:87 msgid "" "The *request* parameter is limited to values that can fit in 32-bits. " "Additional constants of interest for use as the *request* argument can be " @@ -114,26 +132,26 @@ msgid "" "relevant C header files." msgstr "" -#: ../../library/fcntl.rst:85 +#: ../../library/fcntl.rst:92 msgid "" "The parameter *arg* can be one of an integer, an object supporting the read-" "only buffer interface (like :class:`bytes`) or an object supporting the read-" "write buffer interface (like :class:`bytearray`)." msgstr "" -#: ../../library/fcntl.rst:89 +#: ../../library/fcntl.rst:96 msgid "" "In all but the last case, behaviour is as for the :func:`~fcntl.fcntl` " "function." msgstr "" -#: ../../library/fcntl.rst:92 +#: ../../library/fcntl.rst:99 msgid "" "If a mutable buffer is passed, then the behaviour is determined by the value " "of the *mutate_flag* parameter." msgstr "" -#: ../../library/fcntl.rst:95 +#: ../../library/fcntl.rst:102 msgid "" "If it is false, the buffer's mutability is ignored and behaviour is as for a " "read-only buffer, except that the 1024 byte limit mentioned above is avoided " @@ -141,7 +159,7 @@ msgid "" "system wants to put there, things should work." msgstr "" -#: ../../library/fcntl.rst:100 +#: ../../library/fcntl.rst:107 msgid "" "If *mutate_flag* is true (the default), then the buffer is (in effect) " "passed to the underlying :func:`ioctl` system call, the latter's return code " @@ -152,24 +170,24 @@ msgid "" "copied back into the supplied buffer." msgstr "" -#: ../../library/fcntl.rst:108 +#: ../../library/fcntl.rst:115 msgid "If the :c:func:`ioctl` fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:110 +#: ../../library/fcntl.rst:117 msgid "An example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/fcntl.rst:123 +#: ../../library/fcntl.rst:141 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." msgstr "" -#: ../../library/fcntl.rst:128 +#: ../../library/fcntl.rst:135 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -177,17 +195,17 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: ../../library/fcntl.rst:133 +#: ../../library/fcntl.rst:140 msgid "If the :c:func:`flock` fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:135 +#: ../../library/fcntl.rst:153 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." msgstr "" -#: ../../library/fcntl.rst:140 +#: ../../library/fcntl.rst:147 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " "*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." @@ -195,19 +213,19 @@ msgid "" "*cmd* is one of the following values:" msgstr "" -#: ../../library/fcntl.rst:145 +#: ../../library/fcntl.rst:152 msgid ":const:`LOCK_UN` -- unlock" msgstr "" -#: ../../library/fcntl.rst:146 +#: ../../library/fcntl.rst:153 msgid ":const:`LOCK_SH` -- acquire a shared lock" msgstr "" -#: ../../library/fcntl.rst:147 +#: ../../library/fcntl.rst:154 msgid ":const:`LOCK_EX` -- acquire an exclusive lock" msgstr "" -#: ../../library/fcntl.rst:149 +#: ../../library/fcntl.rst:156 msgid "" "When *cmd* is :const:`LOCK_SH` or :const:`LOCK_EX`, it can also be bitwise " "ORed with :const:`LOCK_NB` to avoid blocking on lock acquisition. If :const:" @@ -219,44 +237,44 @@ msgid "" "for writing." msgstr "" -#: ../../library/fcntl.rst:158 +#: ../../library/fcntl.rst:165 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " "the lock starts, relative to *whence*, and *whence* is as with :func:`io." "IOBase.seek`, specifically:" msgstr "" -#: ../../library/fcntl.rst:162 +#: ../../library/fcntl.rst:169 msgid ":const:`0` -- relative to the start of the file (:data:`os.SEEK_SET`)" msgstr "" -#: ../../library/fcntl.rst:163 +#: ../../library/fcntl.rst:170 msgid "" ":const:`1` -- relative to the current buffer position (:data:`os.SEEK_CUR`)" msgstr "" -#: ../../library/fcntl.rst:164 +#: ../../library/fcntl.rst:171 msgid ":const:`2` -- relative to the end of the file (:data:`os.SEEK_END`)" msgstr "" -#: ../../library/fcntl.rst:166 +#: ../../library/fcntl.rst:173 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: ../../library/fcntl.rst:170 +#: ../../library/fcntl.rst:188 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." msgstr "" -#: ../../library/fcntl.rst:172 +#: ../../library/fcntl.rst:179 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: ../../library/fcntl.rst:182 +#: ../../library/fcntl.rst:189 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -264,11 +282,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: ../../library/fcntl.rst:193 +#: ../../library/fcntl.rst:200 msgid "Module :mod:`os`" msgstr ":mod:`os` 模組" -#: ../../library/fcntl.rst:191 +#: ../../library/fcntl.rst:198 msgid "" "If the locking flags :data:`~os.O_SHLOCK` and :data:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/fileinput.po b/library/fileinput.po index c4740b3f6d..31496d1c14 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -109,7 +109,7 @@ msgid "" "keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" -#: ../../library/fileinput.rst:74 ../../library/fileinput.rst:171 +#: ../../library/fileinput.rst:74 ../../library/fileinput.rst:170 msgid "Can be used as a context manager." msgstr "" @@ -117,8 +117,8 @@ msgstr "" msgid "The keyword parameters *mode* and *openhook* are now keyword-only." msgstr "" -#: ../../library/fileinput.rst:80 ../../library/fileinput.rst:183 -#: ../../library/fileinput.rst:213 +#: ../../library/fileinput.rst:80 ../../library/fileinput.rst:176 +#: ../../library/fileinput.rst:210 msgid "The keyword-only parameter *encoding* and *errors* are added." msgstr "" @@ -193,51 +193,49 @@ msgid "" "`filename`, :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:" "`isfirstline`, :meth:`isstdin`, :meth:`nextfile` and :meth:`close` " "correspond to the functions of the same name in the module. In addition it " -"has a :meth:`~io.TextIOBase.readline` method which returns the next input " -"line, and a :meth:`__getitem__` method which implements the sequence " -"behavior. The sequence must be accessed in strictly sequential order; random " -"access and :meth:`~io.TextIOBase.readline` cannot be mixed." +"is :term:`iterable` and has a :meth:`~io.TextIOBase.readline` method which " +"returns the next input line. The sequence must be accessed in strictly " +"sequential order; random access and :meth:`~io.TextIOBase.readline` cannot " +"be mixed." msgstr "" -#: ../../library/fileinput.rst:155 +#: ../../library/fileinput.rst:154 msgid "" "With *mode* you can specify which file mode will be passed to :func:`open`. " -"It must be one of ``'r'``, ``'rU'``, ``'U'`` and ``'rb'``." +"It must be one of ``'r'`` and ``'rb'``." msgstr "" -#: ../../library/fileinput.rst:158 +#: ../../library/fileinput.rst:157 msgid "" "The *openhook*, when given, must be a function that takes two arguments, " "*filename* and *mode*, and returns an accordingly opened file-like object. " "You cannot use *inplace* and *openhook* together." msgstr "" -#: ../../library/fileinput.rst:162 +#: ../../library/fileinput.rst:161 msgid "" "You can specify *encoding* and *errors* that is passed to :func:`open` or " "*openhook*." msgstr "" -#: ../../library/fileinput.rst:164 +#: ../../library/fileinput.rst:163 msgid "" "A :class:`FileInput` instance can be used as a context manager in the :" "keyword:`with` statement. In this example, *input* is closed after the :" "keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" -#: ../../library/fileinput.rst:174 -msgid "The ``'rU'`` and ``'U'`` modes." -msgstr "``'rU'`` 和 ``'U'`` 模式。" - -#: ../../library/fileinput.rst:177 -msgid "Support for :meth:`__getitem__` method is deprecated." +#: ../../library/fileinput.rst:173 +msgid "The keyword parameter *mode* and *openhook* are now keyword-only." msgstr "" -#: ../../library/fileinput.rst:180 -msgid "The keyword parameter *mode* and *openhook* are now keyword-only." +#: ../../library/fileinput.rst:179 +msgid "" +"The ``'rU'`` and ``'U'`` modes and the :meth:`__getitem__` method have been " +"removed." msgstr "" -#: ../../library/fileinput.rst:187 +#: ../../library/fileinput.rst:184 msgid "" "**Optional in-place filtering:** if the keyword argument ``inplace=True`` is " "passed to :func:`fileinput.input` or to the :class:`FileInput` constructor, " @@ -251,11 +249,11 @@ msgid "" "In-place filtering is disabled when standard input is read." msgstr "" -#: ../../library/fileinput.rst:199 +#: ../../library/fileinput.rst:196 msgid "The two following opening hooks are provided by this module:" msgstr "" -#: ../../library/fileinput.rst:203 +#: ../../library/fileinput.rst:200 msgid "" "Transparently opens files compressed with gzip and bzip2 (recognized by the " "extensions ``'.gz'`` and ``'.bz2'``) using the :mod:`gzip` and :mod:`bz2` " @@ -263,36 +261,39 @@ msgid "" "is opened normally (ie, using :func:`open` without any decompression)." msgstr "" -#: ../../library/fileinput.rst:208 +#: ../../library/fileinput.rst:205 msgid "" "The *encoding* and *errors* values are passed to :class:`io.TextIOWrapper` " "for compressed files and open for normal files." msgstr "" -#: ../../library/fileinput.rst:211 +#: ../../library/fileinput.rst:208 msgid "" "Usage example: ``fi = fileinput.FileInput(openhook=fileinput." "hook_compressed, encoding=\"utf-8\")``" msgstr "" -#: ../../library/fileinput.rst:219 +#: ../../library/fileinput.rst:216 msgid "" "Returns a hook which opens each file with :func:`open`, using the given " "*encoding* and *errors* to read the file." msgstr "" -#: ../../library/fileinput.rst:222 +#: ../../library/fileinput.rst:219 msgid "" "Usage example: ``fi = fileinput.FileInput(openhook=fileinput." "hook_encoded(\"utf-8\", \"surrogateescape\"))``" msgstr "" -#: ../../library/fileinput.rst:226 +#: ../../library/fileinput.rst:223 msgid "Added the optional *errors* parameter." msgstr "新增可選參數 *errors*\\ 。" -#: ../../library/fileinput.rst:229 +#: ../../library/fileinput.rst:226 msgid "" "This function is deprecated since :func:`fileinput.input` and :class:" "`FileInput` now have *encoding* and *errors* parameters." msgstr "" + +#~ msgid "The ``'rU'`` and ``'U'`` modes." +#~ msgstr "``'rU'`` 和 ``'U'`` 模式。" diff --git a/library/fnmatch.po b/library/fnmatch.po index 1045173129..e39281c7eb 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -88,7 +88,14 @@ msgid "" "and ``?`` patterns." msgstr "" -#: ../../library/fnmatch.rst:52 +#: ../../library/fnmatch.rst:49 +msgid "" +"Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is " +"used to cache the compiled regex patterns in the following functions: :func:" +"`fnmatch`, :func:`fnmatchcase`, :func:`filter`." +msgstr "" + +#: ../../library/fnmatch.rst:55 msgid "" "Test whether the *filename* string matches the *pattern* string, returning :" "const:`True` or :const:`False`. Both parameters are case-normalized using :" @@ -97,40 +104,40 @@ msgid "" "operating system." msgstr "" -#: ../../library/fnmatch.rst:58 +#: ../../library/fnmatch.rst:61 msgid "" "This example will print all file names in the current directory with the " "extension ``.txt``::" msgstr "" -#: ../../library/fnmatch.rst:71 +#: ../../library/fnmatch.rst:74 msgid "" "Test whether *filename* matches *pattern*, returning :const:`True` or :const:" "`False`; the comparison is case-sensitive and does not apply :func:`os.path." "normcase`." msgstr "" -#: ../../library/fnmatch.rst:78 +#: ../../library/fnmatch.rst:81 msgid "" "Construct a list from those elements of the iterable *names* that match " "*pattern*. It is the same as ``[n for n in names if fnmatch(n, pattern)]``, " "but implemented more efficiently." msgstr "" -#: ../../library/fnmatch.rst:84 +#: ../../library/fnmatch.rst:87 msgid "" "Return the shell-style *pattern* converted to a regular expression for using " "with :func:`re.match`." msgstr "" -#: ../../library/fnmatch.rst:87 +#: ../../library/fnmatch.rst:90 msgid "Example:" msgstr "範例:" -#: ../../library/fnmatch.rst:101 +#: ../../library/fnmatch.rst:104 msgid "Module :mod:`glob`" msgstr ":mod:`glob` 模組" -#: ../../library/fnmatch.rst:102 +#: ../../library/fnmatch.rst:105 msgid "Unix shell-style path expansion." msgstr "" diff --git a/library/fractions.po b/library/fractions.po index c04ed5c94a..ff4c819806 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -58,14 +58,15 @@ msgstr "" #: ../../library/fractions.rst:43 msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " -"``denominator`` (if present) are strings of decimal digits. In addition, " +"``denominator`` (if present) are strings of decimal digits (underscores may " +"be used to delimit digits as with integral literals in code). In addition, " "any string that represents a finite value and is accepted by the :class:" "`float` constructor is also accepted by the :class:`Fraction` constructor. " "In either form the input string may also have leading and/or trailing " "whitespace. Here are some examples::" msgstr "" -#: ../../library/fractions.rst:77 +#: ../../library/fractions.rst:78 msgid "" "The :class:`Fraction` class inherits from the abstract base class :class:" "`numbers.Rational`, and implements all of the methods and operations from " @@ -74,82 +75,94 @@ msgid "" "and methods:" msgstr "" -#: ../../library/fractions.rst:83 +#: ../../library/fractions.rst:84 msgid "" "The :class:`Fraction` constructor now accepts :class:`float` and :class:" "`decimal.Decimal` instances." msgstr "" -#: ../../library/fractions.rst:87 +#: ../../library/fractions.rst:88 msgid "" "The :func:`math.gcd` function is now used to normalize the *numerator* and " "*denominator*. :func:`math.gcd` always return a :class:`int` type. " "Previously, the GCD type depended on *numerator* and *denominator*." msgstr "" -#: ../../library/fractions.rst:94 +#: ../../library/fractions.rst:93 +msgid "" +"Underscores are now permitted when creating a :class:`Fraction` instance " +"from a string, following :PEP:`515` rules." +msgstr "" + +#: ../../library/fractions.rst:97 +msgid "" +":class:`Fraction` implements ``__int__`` now to satisfy ``typing." +"SupportsInt`` instance checks." +msgstr "" + +#: ../../library/fractions.rst:103 msgid "Numerator of the Fraction in lowest term." msgstr "" -#: ../../library/fractions.rst:98 +#: ../../library/fractions.rst:107 msgid "Denominator of the Fraction in lowest term." msgstr "" -#: ../../library/fractions.rst:103 +#: ../../library/fractions.rst:112 msgid "" "Return a tuple of two integers, whose ratio is equal to the Fraction and " "with a positive denominator." msgstr "" -#: ../../library/fractions.rst:110 +#: ../../library/fractions.rst:119 msgid "" "Alternative constructor which only accepts instances of :class:`float` or :" "class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " "the same value as ``Fraction(3, 10)``." msgstr "" -#: ../../library/fractions.rst:116 +#: ../../library/fractions.rst:125 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: ../../library/fractions.rst:122 +#: ../../library/fractions.rst:131 msgid "" "Alternative constructor which only accepts instances of :class:`decimal." "Decimal` or :class:`numbers.Integral`." msgstr "" -#: ../../library/fractions.rst:127 +#: ../../library/fractions.rst:136 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: ../../library/fractions.rst:134 +#: ../../library/fractions.rst:143 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: ../../library/fractions.rst:142 +#: ../../library/fractions.rst:151 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: ../../library/fractions.rst:155 +#: ../../library/fractions.rst:164 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: ../../library/fractions.rst:165 +#: ../../library/fractions.rst:174 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: ../../library/fractions.rst:172 +#: ../../library/fractions.rst:181 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " @@ -158,10 +171,10 @@ msgid "" "func:`round` function." msgstr "" -#: ../../library/fractions.rst:181 +#: ../../library/fractions.rst:190 msgid "Module :mod:`numbers`" msgstr ":mod:`numbers` 模組" -#: ../../library/fractions.rst:182 +#: ../../library/fractions.rst:191 msgid "The abstract base classes making up the numeric tower." msgstr "" diff --git a/library/ftplib.po b/library/ftplib.po index 09d757c2dc..9654515783 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -40,15 +40,26 @@ msgstr "" msgid "The default encoding is UTF-8, following :rfc:`2640`." msgstr "" -#: ../../library/ftplib.rst:24 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/ftplib.rst:26 msgid "Here's a sample session using the :mod:`ftplib` module::" msgstr "" -#: ../../library/ftplib.rst:46 +#: ../../library/ftplib.rst:48 msgid "The module defines the following items:" msgstr "" -#: ../../library/ftplib.rst:50 +#: ../../library/ftplib.rst:52 msgid "" "Return a new instance of the :class:`FTP` class. When *host* is given, the " "method call ``connect(host)`` is made. When *user* is given, additionally " @@ -61,20 +72,20 @@ msgid "" "specifies the encoding for directories and filenames." msgstr "" -#: ../../library/ftplib.rst:60 +#: ../../library/ftplib.rst:62 msgid "The :class:`FTP` class supports the :keyword:`with` statement, e.g.:" msgstr "" -#: ../../library/ftplib.rst:74 +#: ../../library/ftplib.rst:76 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/ftplib.rst:77 ../../library/ftplib.rst:103 -#: ../../library/ftplib.rst:212 +#: ../../library/ftplib.rst:79 ../../library/ftplib.rst:105 +#: ../../library/ftplib.rst:214 msgid "*source_address* parameter was added." msgstr "新增 *source_address* 參數。" -#: ../../library/ftplib.rst:80 ../../library/ftplib.rst:118 +#: ../../library/ftplib.rst:82 ../../library/ftplib.rst:120 msgid "" "If the *timeout* parameter is set to be zero, it will raise a :class:" "`ValueError` to prevent the creation of a non-blocking socket. The " @@ -82,7 +93,7 @@ msgid "" "UTF-8 to follow :rfc:`2640`." msgstr "" -#: ../../library/ftplib.rst:88 +#: ../../library/ftplib.rst:90 msgid "" "A :class:`FTP` subclass which adds TLS support to FTP as described in :rfc:" "`4217`. Connect as usual to port 21 implicitly securing the FTP control " @@ -94,54 +105,54 @@ msgid "" "best practices." msgstr "" -#: ../../library/ftplib.rst:97 +#: ../../library/ftplib.rst:99 msgid "" "*keyfile* and *certfile* are a legacy alternative to *context* -- they can " "point to PEM-formatted private key and certificate chain files " "(respectively) for the SSL connection." msgstr "" -#: ../../library/ftplib.rst:106 +#: ../../library/ftplib.rst:108 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/ftplib.rst:113 +#: ../../library/ftplib.rst:115 msgid "" "*keyfile* and *certfile* are deprecated in favor of *context*. Please use :" "meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." "create_default_context` select the system's trusted CA certificates for you." msgstr "" -#: ../../library/ftplib.rst:124 +#: ../../library/ftplib.rst:126 msgid "Here's a sample session using the :class:`FTP_TLS` class::" msgstr "" -#: ../../library/ftplib.rst:137 +#: ../../library/ftplib.rst:139 msgid "Exception raised when an unexpected reply is received from the server." msgstr "" -#: ../../library/ftplib.rst:142 +#: ../../library/ftplib.rst:144 msgid "" "Exception raised when an error code signifying a temporary error (response " "codes in the range 400--499) is received." msgstr "" -#: ../../library/ftplib.rst:148 +#: ../../library/ftplib.rst:150 msgid "" "Exception raised when an error code signifying a permanent error (response " "codes in the range 500--599) is received." msgstr "" -#: ../../library/ftplib.rst:154 +#: ../../library/ftplib.rst:156 msgid "" "Exception raised when a reply is received from the server that does not fit " "the response specifications of the File Transfer Protocol, i.e. begin with a " "digit in the range 1--5." msgstr "" -#: ../../library/ftplib.rst:161 +#: ../../library/ftplib.rst:163 msgid "" "The set of all exceptions (as a tuple) that methods of :class:`FTP` " "instances may raise as a result of problems with the FTP connection (as " @@ -149,22 +160,22 @@ msgid "" "four exceptions listed above as well as :exc:`OSError` and :exc:`EOFError`." msgstr "" -#: ../../library/ftplib.rst:171 +#: ../../library/ftplib.rst:173 msgid "Module :mod:`netrc`" msgstr ":mod:`netrc` 模組" -#: ../../library/ftplib.rst:170 +#: ../../library/ftplib.rst:172 msgid "" "Parser for the :file:`.netrc` file format. The file :file:`.netrc` is " "typically used by FTP clients to load user authentication information before " "prompting the user." msgstr "" -#: ../../library/ftplib.rst:178 +#: ../../library/ftplib.rst:180 msgid "FTP Objects" msgstr "FTP 物件" -#: ../../library/ftplib.rst:180 +#: ../../library/ftplib.rst:182 msgid "" "Several methods are available in two flavors: one for handling text files " "and another for binary files. These are named for the command which is used " @@ -172,11 +183,11 @@ msgid "" "version." msgstr "" -#: ../../library/ftplib.rst:184 +#: ../../library/ftplib.rst:186 msgid ":class:`FTP` instances have the following methods:" msgstr "" -#: ../../library/ftplib.rst:189 +#: ../../library/ftplib.rst:191 msgid "" "Set the instance's debugging level. This controls the amount of debugging " "output printed. The default, ``0``, produces no debugging output. A value " @@ -186,7 +197,7 @@ msgid "" "connection." msgstr "" -#: ../../library/ftplib.rst:198 +#: ../../library/ftplib.rst:200 msgid "" "Connect to the given host and port. The default port number is ``21``, as " "specified by the FTP protocol specification. It is rarely needed to specify " @@ -199,20 +210,20 @@ msgid "" "port)`` for the socket to bind to as its source address before connecting." msgstr "" -#: ../../library/ftplib.rst:210 +#: ../../library/ftplib.rst:223 msgid "" "Raises an :ref:`auditing event ` ``ftplib.connect`` with arguments " "``self``, ``host``, ``port``." msgstr "" -#: ../../library/ftplib.rst:218 +#: ../../library/ftplib.rst:220 msgid "" "Return the welcome message sent by the server in reply to the initial " "connection. (This message sometimes contains disclaimers or help " "information that may be relevant to the user.)" msgstr "" -#: ../../library/ftplib.rst:225 +#: ../../library/ftplib.rst:227 msgid "" "Log in as the given *user*. The *passwd* and *acct* parameters are optional " "and default to the empty string. If no *user* is specified, it defaults to " @@ -224,31 +235,31 @@ msgid "" "parameter supplies \"accounting information\"; few systems implement this." msgstr "" -#: ../../library/ftplib.rst:237 +#: ../../library/ftplib.rst:239 msgid "" "Abort a file transfer that is in progress. Using this does not always work, " "but it's worth a try." msgstr "" -#: ../../library/ftplib.rst:243 +#: ../../library/ftplib.rst:245 msgid "" "Send a simple command string to the server and return the response string." msgstr "" -#: ../../library/ftplib.rst:245 ../../library/ftplib.rst:254 +#: ../../library/ftplib.rst:258 ../../library/ftplib.rst:267 msgid "" "Raises an :ref:`auditing event ` ``ftplib.sendcmd`` with arguments " "``self``, ``cmd``." msgstr "" -#: ../../library/ftplib.rst:250 +#: ../../library/ftplib.rst:252 msgid "" "Send a simple command string to the server and handle the response. Return " "nothing if a response code corresponding to success (codes in the range " "200--299) is received. Raise :exc:`error_reply` otherwise." msgstr "" -#: ../../library/ftplib.rst:259 +#: ../../library/ftplib.rst:261 msgid "" "Retrieve a file in binary transfer mode. *cmd* should be an appropriate " "``RETR`` command: ``'RETR filename'``. The *callback* function is called for " @@ -260,7 +271,7 @@ msgid "" "`transfercmd` method." msgstr "" -#: ../../library/ftplib.rst:271 +#: ../../library/ftplib.rst:273 msgid "" "Retrieve a file or directory listing in the encoding specified by the " "*encoding* parameter at initialization. *cmd* should be an appropriate " @@ -272,13 +283,13 @@ msgid "" "*callback* prints the line to ``sys.stdout``." msgstr "" -#: ../../library/ftplib.rst:284 +#: ../../library/ftplib.rst:286 msgid "" "Enable \"passive\" mode if *val* is true, otherwise disable passive mode. " "Passive mode is on by default." msgstr "" -#: ../../library/ftplib.rst:290 +#: ../../library/ftplib.rst:292 msgid "" "Store a file in binary transfer mode. *cmd* should be an appropriate " "``STOR`` command: ``\"STOR filename\"``. *fp* is a :term:`file object` " @@ -289,11 +300,11 @@ msgid "" "*rest* means the same thing as in the :meth:`transfercmd` method." msgstr "" -#: ../../library/ftplib.rst:298 +#: ../../library/ftplib.rst:300 msgid "*rest* parameter added." msgstr "" -#: ../../library/ftplib.rst:304 +#: ../../library/ftplib.rst:306 msgid "" "Store a file in line mode. *cmd* should be an appropriate ``STOR`` command " "(see :meth:`storbinary`). Lines are read until EOF from the :term:`file " @@ -302,7 +313,7 @@ msgid "" "parameter callable that is called on each line after it is sent." msgstr "" -#: ../../library/ftplib.rst:313 +#: ../../library/ftplib.rst:315 msgid "" "Initiate a transfer over the data connection. If the transfer is active, " "send an ``EPRT`` or ``PORT`` command and the transfer command specified by " @@ -311,7 +322,7 @@ msgid "" "command. Either way, return the socket for the connection." msgstr "" -#: ../../library/ftplib.rst:319 +#: ../../library/ftplib.rst:321 msgid "" "If optional *rest* is given, a ``REST`` command is sent to the server, " "passing *rest* as an argument. *rest* is usually a byte offset into the " @@ -324,7 +335,7 @@ msgid "" "simply call :meth:`transfercmd` without a *rest* argument." msgstr "" -#: ../../library/ftplib.rst:332 +#: ../../library/ftplib.rst:334 msgid "" "Like :meth:`transfercmd`, but returns a tuple of the data connection and the " "expected size of the data. If the expected size could not be computed, " @@ -332,7 +343,7 @@ msgid "" "same thing as in :meth:`transfercmd`." msgstr "" -#: ../../library/ftplib.rst:340 +#: ../../library/ftplib.rst:342 msgid "" "List a directory in a standardized format by using ``MLSD`` command (:rfc:" "`3659`). If *path* is omitted the current directory is assumed. *facts* is " @@ -344,7 +355,7 @@ msgid "" "but server is not guaranteed to return all requested facts." msgstr "" -#: ../../library/ftplib.rst:354 +#: ../../library/ftplib.rst:356 msgid "" "Return a list of file names as returned by the ``NLST`` command. The " "optional *argument* is a directory to list (default is the current server " @@ -352,11 +363,11 @@ msgid "" "the ``NLST`` command." msgstr "" -#: ../../library/ftplib.rst:359 ../../library/ftplib.rst:371 +#: ../../library/ftplib.rst:361 ../../library/ftplib.rst:373 msgid "If your server supports the command, :meth:`mlsd` offers a better API." msgstr "" -#: ../../library/ftplib.rst:364 +#: ../../library/ftplib.rst:366 msgid "" "Produce a directory listing as returned by the ``LIST`` command, printing it " "to standard output. The optional *argument* is a directory to list (default " @@ -366,34 +377,34 @@ msgid "" "default prints to ``sys.stdout``. This method returns ``None``." msgstr "" -#: ../../library/ftplib.rst:376 +#: ../../library/ftplib.rst:378 msgid "Rename file *fromname* on the server to *toname*." msgstr "" -#: ../../library/ftplib.rst:381 +#: ../../library/ftplib.rst:383 msgid "" "Remove the file named *filename* from the server. If successful, returns " "the text of the response, otherwise raises :exc:`error_perm` on permission " "errors or :exc:`error_reply` on other errors." msgstr "" -#: ../../library/ftplib.rst:388 +#: ../../library/ftplib.rst:390 msgid "Set the current directory on the server." msgstr "" -#: ../../library/ftplib.rst:393 +#: ../../library/ftplib.rst:395 msgid "Create a new directory on the server." msgstr "" -#: ../../library/ftplib.rst:398 +#: ../../library/ftplib.rst:400 msgid "Return the pathname of the current directory on the server." msgstr "" -#: ../../library/ftplib.rst:403 +#: ../../library/ftplib.rst:405 msgid "Remove the directory named *dirname* on the server." msgstr "" -#: ../../library/ftplib.rst:408 +#: ../../library/ftplib.rst:410 msgid "" "Request the size of the file named *filename* on the server. On success, " "the size of the file is returned as an integer, otherwise ``None`` is " @@ -401,7 +412,7 @@ msgid "" "supported by many common server implementations." msgstr "" -#: ../../library/ftplib.rst:416 +#: ../../library/ftplib.rst:418 msgid "" "Send a ``QUIT`` command to the server and close the connection. This is the " "\"polite\" way to close a connection, but it may raise an exception if the " @@ -410,7 +421,7 @@ msgid "" "for subsequent calls (see below)." msgstr "" -#: ../../library/ftplib.rst:425 +#: ../../library/ftplib.rst:427 msgid "" "Close the connection unilaterally. This should not be applied to an already " "closed connection such as after a successful call to :meth:`~FTP.quit`. " @@ -419,43 +430,43 @@ msgid "" "connection by issuing another :meth:`login` method)." msgstr "" -#: ../../library/ftplib.rst:433 +#: ../../library/ftplib.rst:435 msgid "FTP_TLS Objects" msgstr "FTP_TLS 物件" -#: ../../library/ftplib.rst:435 +#: ../../library/ftplib.rst:437 msgid "" ":class:`FTP_TLS` class inherits from :class:`FTP`, defining these additional " "objects:" msgstr "" -#: ../../library/ftplib.rst:439 +#: ../../library/ftplib.rst:441 msgid "The SSL version to use (defaults to :attr:`ssl.PROTOCOL_SSLv23`)." msgstr "" -#: ../../library/ftplib.rst:443 +#: ../../library/ftplib.rst:445 msgid "" "Set up a secure control connection by using TLS or SSL, depending on what is " "specified in the :attr:`ssl_version` attribute." msgstr "" -#: ../../library/ftplib.rst:446 +#: ../../library/ftplib.rst:448 msgid "" "The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/ftplib.rst:453 +#: ../../library/ftplib.rst:455 msgid "" "Revert control channel back to plaintext. This can be useful to take " "advantage of firewalls that know how to handle NAT with non-secure FTP " "without opening fixed ports." msgstr "" -#: ../../library/ftplib.rst:461 +#: ../../library/ftplib.rst:463 msgid "Set up secure data connection." msgstr "" -#: ../../library/ftplib.rst:465 +#: ../../library/ftplib.rst:467 msgid "Set up clear text data connection." msgstr "" diff --git a/library/functions.po b/library/functions.po index 5f295956c3..70ee7c6692 100644 --- a/library/functions.po +++ b/library/functions.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-08 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-10-01 14:30+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -425,18 +425,18 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:87 +#: ../../library/functions.rst:88 msgid "" "When awaited, return the next item from the given :term:`asynchronous " "iterator`, or *default* if given and the iterator is exhausted." msgstr "" -#: ../../library/functions.rst:90 +#: ../../library/functions.rst:91 msgid "" "This is the async variant of the :func:`next` builtin, and behaves similarly." msgstr "" -#: ../../library/functions.rst:93 +#: ../../library/functions.rst:94 msgid "" "This calls the :meth:`~object.__anext__` method of *async_iterator*, " "returning an :term:`awaitable`. Awaiting this returns the next value of the " @@ -444,7 +444,7 @@ msgid "" "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -#: ../../library/functions.rst:102 +#: ../../library/functions.rst:103 msgid "" "Return ``True`` if any element of the *iterable* is true. If the iterable " "is empty, return ``False``. Equivalent to::" @@ -454,7 +454,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:114 +#: ../../library/functions.rst:115 msgid "" "As :func:`repr`, return a string containing a printable representation of an " "object, but escape the non-ASCII characters in the string returned by :func:" @@ -465,7 +465,7 @@ msgstr "" "非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" "函式生成的字串和 Python 2 的 :func:`repr` 回傳的結果相似。" -#: ../../library/functions.rst:122 +#: ../../library/functions.rst:123 msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -476,18 +476,18 @@ msgstr "" "算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:132 +#: ../../library/functions.rst:133 msgid "" "If the prefix \"0b\" is desired or not, you can use either of the following " "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:139 ../../library/functions.rst:808 -#: ../../library/functions.rst:1112 +#: ../../library/functions.rst:140 ../../library/functions.rst:831 +#: ../../library/functions.rst:1144 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" -#: ../../library/functions.rst:144 +#: ../../library/functions.rst:145 msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. *x* is converted " "using the standard :ref:`truth testing procedure `. If *x* is false " @@ -502,12 +502,12 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`bltin-boolean-values`)。" -#: ../../library/functions.rst:153 ../../library/functions.rst:675 -#: ../../library/functions.rst:892 +#: ../../library/functions.rst:154 ../../library/functions.rst:696 +#: ../../library/functions.rst:916 msgid "*x* is now a positional-only parameter." msgstr "" -#: ../../library/functions.rst:158 +#: ../../library/functions.rst:159 msgid "" "This function drops you into the debugger at the call site. Specifically, " "it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight " @@ -520,13 +520,13 @@ msgid "" "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:170 +#: ../../library/functions.rst:171 msgid "" "Raises an :ref:`auditing event ` ``builtins.breakpoint`` with " "argument ``breakpointhook``." msgstr "" -#: ../../library/functions.rst:178 +#: ../../library/functions.rst:181 msgid "" "Return a new array of bytes. The :class:`bytearray` class is a mutable " "sequence of integers in the range 0 <= x < 256. It has most of the usual " @@ -538,13 +538,13 @@ msgstr "" "`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" "見 :ref:`bytes-methods`。" -#: ../../library/functions.rst:183 +#: ../../library/functions.rst:186 msgid "" "The optional *source* parameter can be used to initialize the array in a few " "different ways:" msgstr "選擇性參數 *source* 可以被用來以不同的方式初始化陣列:" -#: ../../library/functions.rst:186 +#: ../../library/functions.rst:189 msgid "" "If it is a *string*, you must also give the *encoding* (and optionally, " "*errors*) parameters; :func:`bytearray` then converts the string to bytes " @@ -554,14 +554,14 @@ msgstr "" "*errors* );\\ :func:`bytearray` 會使用 :meth:`str.encode` method 來將 " "string 轉變成 bytes。" -#: ../../library/functions.rst:190 +#: ../../library/functions.rst:193 msgid "" "If it is an *integer*, the array will have that size and will be initialized " "with null bytes." msgstr "" "如果是一個 *integer*,陣列則會有該數值的長度,並以 null bytes 來當作初始值。" -#: ../../library/functions.rst:193 +#: ../../library/functions.rst:196 msgid "" "If it is an object conforming to the :ref:`buffer interface " "`, a read-only buffer of the object will be used to " @@ -570,7 +570,7 @@ msgstr "" "如果是一個符合 :ref:`buffer 介面 `\\ 的物件,該物件的唯讀 " "buffer 會被用來初始化 bytes 陣列。" -#: ../../library/functions.rst:196 +#: ../../library/functions.rst:199 msgid "" "If it is an *iterable*, it must be an iterable of integers in the range ``0 " "<= x < 256``, which are used as the initial contents of the array." @@ -578,15 +578,15 @@ msgstr "" "如果是一個 *iterable*,它的元素必須是範圍為 ``0 <= x < 256`` 的整數,並且會被" "用作陣列的初始值。" -#: ../../library/functions.rst:199 +#: ../../library/functions.rst:202 msgid "Without an argument, an array of size 0 is created." msgstr "如果沒有引數,則建立長度為 0 的陣列。" -#: ../../library/functions.rst:201 +#: ../../library/functions.rst:204 msgid "See also :ref:`binaryseq` and :ref:`typebytearray`." msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" -#: ../../library/functions.rst:208 +#: ../../library/functions.rst:213 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " "the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" @@ -597,20 +597,20 @@ msgstr "" "變序列。:class:`bytes` 是 :class:`bytearray` 的不可變版本 — 它的同樣具備不改" "變物件的 method,也有相同的索引和切片操作。" -#: ../../library/functions.rst:213 +#: ../../library/functions.rst:218 msgid "" "Accordingly, constructor arguments are interpreted as for :func:`bytearray`." msgstr "因此,建構函式的引數和 :func:`bytearray` 相同。" -#: ../../library/functions.rst:215 +#: ../../library/functions.rst:220 msgid "Bytes objects can also be created with literals, see :ref:`strings`." msgstr "Bytes 物件還可以用文字建立,參見 :ref:`strings`。" -#: ../../library/functions.rst:217 +#: ../../library/functions.rst:222 msgid "See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`." msgstr "可參考 :ref:`binaryseq`、\\ :ref:`typebytes` 和 :ref:`bytes-methods`。" -#: ../../library/functions.rst:222 +#: ../../library/functions.rst:227 msgid "" "Return :const:`True` if the *object* argument appears callable, :const:" "`False` if not. If this returns ``True``, it is still possible that a call " @@ -623,13 +623,13 @@ msgstr "" "會失敗。注意 class 是可呼叫的(呼叫 class 會回傳一個新的實例);如果實例的 " "class 有定義 :meth:`__call__` method,則它是可呼叫的。" -#: ../../library/functions.rst:228 +#: ../../library/functions.rst:233 msgid "" "This function was first removed in Python 3.0 and then brought back in " "Python 3.2." msgstr "這個函式一開始在 Python 3.0 被移除,但在 Python 3.2 又被重新加入。" -#: ../../library/functions.rst:235 +#: ../../library/functions.rst:240 msgid "" "Return the string representing a character whose Unicode code point is the " "integer *i*. For example, ``chr(97)`` returns the string ``'a'``, while " @@ -638,7 +638,7 @@ msgstr "" "回傳代表字元之 Unicode 編碼位置為整數 *i* 的字串。例如,``chr(97)`` 回傳字串 " "``'a'``,而 ``chr(8364)`` 回傳字串 ``'€'``。這是 :func:`ord` 的逆函式。" -#: ../../library/functions.rst:239 +#: ../../library/functions.rst:244 msgid "" "The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in " "base 16). :exc:`ValueError` will be raised if *i* is outside that range." @@ -646,11 +646,11 @@ msgstr "" "引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果 *i* 超過這個" "範圍,會觸發 :exc:`ValueError`。" -#: ../../library/functions.rst:245 +#: ../../library/functions.rst:250 msgid "Transform a method into a class method." msgstr "把一個 method 封裝成 class method(類別方法)。" -#: ../../library/functions.rst:247 +#: ../../library/functions.rst:252 msgid "" "A class method receives the class as an implicit first argument, just like " "an instance method receives the instance. To declare a class method, use " @@ -661,7 +661,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:255 +#: ../../library/functions.rst:260 msgid "" "The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -669,7 +669,7 @@ msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" -#: ../../library/functions.rst:258 +#: ../../library/functions.rst:263 msgid "" "A class method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). The instance is ignored except for its " @@ -680,7 +680,7 @@ msgstr "" "叫。實例除了它的 class 資訊,其他都會被忽略。如果一個 class method 在 " "subclass 上呼叫,subclass 會作為第一個引數傳入。" -#: ../../library/functions.rst:263 +#: ../../library/functions.rst:268 msgid "" "Class methods are different than C++ or Java static methods. If you want " "those, see :func:`staticmethod` in this section. For more information on " @@ -690,20 +690,26 @@ msgstr "" "method,請看本節的 :func:`staticmethod`。關於 class method 的更多資訊,請參" "考 :ref:`types`。" -#: ../../library/functions.rst:267 +#: ../../library/functions.rst:272 msgid "" "Class methods can now wrap other :term:`descriptors ` such as :" "func:`property`." msgstr "" -#: ../../library/functions.rst:271 +#: ../../library/functions.rst:276 msgid "" "Class methods now inherit the method attributes (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``) and " "have a new ``__wrapped__`` attribute." msgstr "" -#: ../../library/functions.rst:278 +#: ../../library/functions.rst:281 +msgid "" +"Class methods can no longer wrap other :term:`descriptors ` such " +"as :func:`property`." +msgstr "" + +#: ../../library/functions.rst:288 msgid "" "Compile the *source* into a code or AST object. Code objects can be " "executed by :func:`exec` or :func:`eval`. *source* can either be a normal " @@ -714,7 +720,7 @@ msgstr "" "`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" "`ast` module(模組)的文件瞭解如何使用 AST 物件。" -#: ../../library/functions.rst:283 +#: ../../library/functions.rst:293 msgid "" "The *filename* argument should give the file from which the code was read; " "pass some recognizable value if it wasn't read from a file (``''`` " @@ -723,7 +729,7 @@ msgstr "" "*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可" "辨識的值(經常會使用 ``''`` 來替代)。" -#: ../../library/functions.rst:287 +#: ../../library/functions.rst:297 msgid "" "The *mode* argument specifies what kind of code must be compiled; it can be " "``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " @@ -736,7 +742,7 @@ msgstr "" "式,可以是 ``'single'``(在最後一種情況下,如果運算式執行結果不是 ``None`` 則" "會被印出來)。" -#: ../../library/functions.rst:293 +#: ../../library/functions.rst:303 msgid "" "The optional arguments *flags* and *dont_inherit* control which :ref:" "`compiler options ` should be activated and which :ref:" @@ -750,7 +756,7 @@ msgid "" "in the surrounding code are ignored." msgstr "" -#: ../../library/functions.rst:304 +#: ../../library/functions.rst:314 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " @@ -765,7 +771,7 @@ msgstr "" "compiler_flag` 屬性來獲得。\\ :ref:`編譯器旗標 `\\ 可以" "在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" -#: ../../library/functions.rst:312 +#: ../../library/functions.rst:322 msgid "" "The argument *optimize* specifies the optimization level of the compiler; " "the default value of ``-1`` selects the optimization level of the " @@ -778,7 +784,7 @@ msgstr "" "``__debug__`` 為真值)、\\ ``1``\\ (assert 被刪除,\\ ``__debug__`` 為假值)" "或 ``2``\\ (文件字串也被刪除)。" -#: ../../library/functions.rst:318 +#: ../../library/functions.rst:328 msgid "" "This function raises :exc:`SyntaxError` if the compiled source is invalid, " "and :exc:`ValueError` if the source contains null bytes." @@ -786,26 +792,26 @@ msgstr "" "如果編譯的原始碼無效,此函式會觸發 :exc:`SyntaxError`,如果原始碼包含 null " "bytes,則會觸發 :exc:`ValueError`。" -#: ../../library/functions.rst:321 +#: ../../library/functions.rst:331 msgid "" "If you want to parse Python code into its AST representation, see :func:`ast." "parse`." msgstr "如果您想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" -#: ../../library/functions.rst:324 +#: ../../library/functions.rst:334 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source``, ``filename``." msgstr "" -#: ../../library/functions.rst:326 +#: ../../library/functions.rst:336 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source`` and ``filename``. This event may also be raised by implicit " "compilation." msgstr "" -#: ../../library/functions.rst:332 +#: ../../library/functions.rst:342 msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " @@ -815,7 +821,7 @@ msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" -#: ../../library/functions.rst:339 +#: ../../library/functions.rst:349 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string when compiling to an AST object due to stack depth " @@ -824,7 +830,7 @@ msgstr "" "如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python " "AST 編譯器的 stack 深度限制而崩潰。" -#: ../../library/functions.rst:343 +#: ../../library/functions.rst:353 msgid "" "Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " "does not have to end in a newline anymore. Added the *optimize* parameter." @@ -832,20 +838,20 @@ msgstr "" "允許使用 Windows 和 Mac 的換行符號。在 ``'exec'`` 模式不需要以換行符號結尾。" "增加了 *optimize* 參數。" -#: ../../library/functions.rst:347 +#: ../../library/functions.rst:357 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." msgstr "" "在之前的版本,*source* 中包含 null bytes 會觸發 :exc:`TypeError` 異常。" -#: ../../library/functions.rst:351 +#: ../../library/functions.rst:361 msgid "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " "support for top-level ``await``, ``async for``, and ``async with``." msgstr "" -#: ../../library/functions.rst:358 +#: ../../library/functions.rst:369 msgid "" "Return a complex number with the value *real* + *imag*\\*1j or convert a " "string or number to a complex number. If the first parameter is a string, " @@ -862,7 +868,7 @@ msgstr "" "預設值為零,建構函式會像 :class:`int` 和 :class:`float` 一樣進行數值轉換。如" "果兩個引數都省略,則回傳 ``0j``。" -#: ../../library/functions.rst:367 +#: ../../library/functions.rst:378 msgid "" "For a general Python object ``x``, ``complex(x)`` delegates to ``x." "__complex__()``. If ``__complex__()`` is not defined then it falls back to :" @@ -870,7 +876,7 @@ msgid "" "meth:`__index__`." msgstr "" -#: ../../library/functions.rst:374 +#: ../../library/functions.rst:385 msgid "" "When converting from a string, the string must not contain whitespace around " "the central ``+`` or ``-`` operator. For example, ``complex('1+2j')`` is " @@ -880,22 +886,22 @@ msgstr "" "``complex('1+2j')`` 是有效的,但 ``complex('1 + 2j')`` 會觸發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:379 +#: ../../library/functions.rst:390 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:381 ../../library/functions.rst:672 -#: ../../library/functions.rst:889 +#: ../../library/functions.rst:392 ../../library/functions.rst:693 +#: ../../library/functions.rst:913 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" -#: ../../library/functions.rst:384 +#: ../../library/functions.rst:395 msgid "" "Falls back to :meth:`__index__` if :meth:`__complex__` and :meth:`__float__` " "are not defined." msgstr "" -#: ../../library/functions.rst:391 +#: ../../library/functions.rst:402 msgid "" "This is a relative of :func:`setattr`. The arguments are an object and a " "string. The string must be the name of one of the object's attributes. The " @@ -908,7 +914,7 @@ msgstr "" "'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " "(identifier)(請見 :func:`setattr`)。" -#: ../../library/functions.rst:404 +#: ../../library/functions.rst:415 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -916,7 +922,7 @@ msgstr "" "建立一個新的 dictionary(字典)。\\ :class:`dict` 物件是一個 dictionary " "class。參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" -#: ../../library/functions.rst:407 +#: ../../library/functions.rst:418 msgid "" "For other containers see the built-in :class:`list`, :class:`set`, and :" "class:`tuple` classes, as well as the :mod:`collections` module." @@ -924,7 +930,7 @@ msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" -#: ../../library/functions.rst:413 +#: ../../library/functions.rst:425 msgid "" "Without arguments, return the list of names in the current local scope. " "With an argument, attempt to return a list of valid attributes for that " @@ -933,7 +939,7 @@ msgstr "" "如果沒有引數,則回傳當前本地作用域中的名稱列表。如果有引數,它會嘗試回傳該物" "件的有效屬性列表。" -#: ../../library/functions.rst:416 +#: ../../library/functions.rst:428 msgid "" "If the object has a method named :meth:`__dir__`, this method will be called " "and must return the list of attributes. This allows objects that implement a " @@ -944,7 +950,7 @@ msgstr "" "須回傳一個屬性列表。這允許實現自定義 :func:`__getattr__` 或 :func:" "`__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它們的屬性。" -#: ../../library/functions.rst:421 +#: ../../library/functions.rst:433 msgid "" "If the object does not provide :meth:`__dir__`, the function tries its best " "to gather information from the object's :attr:`~object.__dict__` attribute, " @@ -956,7 +962,7 @@ msgstr "" "__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有自定義 :" "func:`__getattr__`,那結果可能不準確。" -#: ../../library/functions.rst:426 +#: ../../library/functions.rst:438 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -965,13 +971,13 @@ msgstr "" "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" "整的資訊:" -#: ../../library/functions.rst:430 +#: ../../library/functions.rst:442 msgid "" "If the object is a module object, the list contains the names of the " "module's attributes." msgstr "如果物件是 module 物件,則列表包含 module 的屬性名稱。" -#: ../../library/functions.rst:433 +#: ../../library/functions.rst:445 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." @@ -979,7 +985,7 @@ msgstr "" "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" "有屬性。" -#: ../../library/functions.rst:436 +#: ../../library/functions.rst:448 msgid "" "Otherwise, the list contains the object's attributes' names, the names of " "its class's attributes, and recursively of the attributes of its class's " @@ -988,11 +994,11 @@ msgstr "" "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" "所有基礎 class 的屬性。" -#: ../../library/functions.rst:440 +#: ../../library/functions.rst:452 msgid "The resulting list is sorted alphabetically. For example:" msgstr "回傳的列表按字母表排序,例如:" -#: ../../library/functions.rst:459 +#: ../../library/functions.rst:471 msgid "" "Because :func:`dir` is supplied primarily as a convenience for use at an " "interactive prompt, it tries to supply an interesting set of names more than " @@ -1005,7 +1011,7 @@ msgstr "" "版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" "中。" -#: ../../library/functions.rst:469 +#: ../../library/functions.rst:481 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " @@ -1023,7 +1029,7 @@ msgstr "" "等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " "abs(b)``。" -#: ../../library/functions.rst:481 +#: ../../library/functions.rst:493 msgid "" "Return an enumerate object. *iterable* must be a sequence, an :term:" "`iterator`, or some other object which supports iteration. The :meth:" @@ -1036,14 +1042,14 @@ msgstr "" "meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數值" "(從 *start* 開始,預設為 0)和通過疊代 *iterable* 獲得的值。" -#: ../../library/functions.rst:493 +#: ../../library/functions.rst:505 msgid "Equivalent to::" msgstr "" "等價於:\n" "\n" "::" -#: ../../library/functions.rst:504 +#: ../../library/functions.rst:517 msgid "" "The arguments are a string and optional globals and locals. If provided, " "*globals* must be a dictionary. If provided, *locals* can be any mapping " @@ -1052,7 +1058,7 @@ msgstr "" "引數是一個字串,以及選擇性的 globals 和 locals。如果有提供選擇性引數," "*globals* 必須是一個 dictionary。*locals* 可以是任何映射 (mapping) 物件。" -#: ../../library/functions.rst:508 +#: ../../library/functions.rst:521 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1078,13 +1084,13 @@ msgstr "" "呼叫的環境中執行運算式。請注意,*eval()* 在封閉環境中無法存取\\ :term:`巢狀" "域 ` (non-locals)。" -#: ../../library/functions.rst:523 +#: ../../library/functions.rst:536 msgid "" "The return value is the result of the evaluated expression. Syntax errors " "are reported as exceptions. Example:" msgstr "" -#: ../../library/functions.rst:530 +#: ../../library/functions.rst:543 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1095,7 +1101,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:535 +#: ../../library/functions.rst:548 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1106,13 +1112,13 @@ msgstr "" "`locals` 函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :" "func:`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:540 +#: ../../library/functions.rst:553 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "" -#: ../../library/functions.rst:543 +#: ../../library/functions.rst:556 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1120,19 +1126,19 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:546 ../../library/functions.rst:582 +#: ../../library/functions.rst:559 ../../library/functions.rst:600 msgid "" "Raises an :ref:`auditing event ` ``exec`` with argument " "``code_object``." msgstr "" -#: ../../library/functions.rst:548 ../../library/functions.rst:584 +#: ../../library/functions.rst:561 ../../library/functions.rst:602 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." msgstr "" -#: ../../library/functions.rst:555 +#: ../../library/functions.rst:568 msgid "" "This function supports dynamic execution of Python code. *object* must be " "either a string or a code object. If it is a string, the string is parsed " @@ -1152,7 +1158,7 @@ msgstr "" "`yield` 和 :keyword:`return` 陳述式也不能在函式之外使用。該函式回傳值是 " "``None``。" -#: ../../library/functions.rst:566 +#: ../../library/functions.rst:579 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1171,7 +1177,7 @@ msgstr "" "地變數是相同的 dictionary。如果 exec 有兩個不同的 *globals* 和 *locals* 物" "件,程式碼就像嵌入在 class 定義中一樣執行。" -#: ../../library/functions.rst:576 +#: ../../library/functions.rst:589 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1184,7 +1190,15 @@ msgstr "" "func:`exec` 之前,可以通過將自己的 ``__builtins__`` dictionary 插入到 " "*globals* 中來控制可以使用哪些內建程式碼。" -#: ../../library/functions.rst:589 +#: ../../library/functions.rst:595 +msgid "" +"The *closure* argument specifies a closure--a tuple of cellvars. It's only " +"valid when the *object* is a code object containing free variables. The " +"length of the tuple must exactly match the number of free variables " +"referenced by the code object." +msgstr "" + +#: ../../library/functions.rst:607 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local dictionary, respectively, which may be useful to pass " @@ -1193,7 +1207,7 @@ msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域性和本地 " "dictionary,因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數。" -#: ../../library/functions.rst:595 +#: ../../library/functions.rst:613 msgid "" "The default *locals* act as described for function :func:`locals` below: " "modifications to the default *locals* dictionary should not be attempted. " @@ -1204,7 +1218,11 @@ msgstr "" "預設的 *locals* dictionary。如果您想在 :func:`exec` 函式回傳時知道程式碼對 " "*locals* 的變動,請明確地傳遞 *locals* dictionary 。" -#: ../../library/functions.rst:603 +#: ../../library/functions.rst:618 +msgid "Added the *closure* parameter." +msgstr "增加了 *closure* 參數。" + +#: ../../library/functions.rst:624 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "returns true. *iterable* may be either a sequence, a container which " @@ -1217,7 +1235,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個恆等函數,即 *iterable* 中所有假值元" "素會被移除。" -#: ../../library/functions.rst:609 +#: ../../library/functions.rst:630 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1228,7 +1246,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:614 +#: ../../library/functions.rst:635 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* returns false." @@ -1236,11 +1254,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 回傳 false 時才選取 " "*iterable* 中元素的互補函數。" -#: ../../library/functions.rst:624 +#: ../../library/functions.rst:645 msgid "Return a floating point number constructed from a number or string *x*." msgstr "回傳從數字或字串 *x* 生成的浮點數。" -#: ../../library/functions.rst:626 +#: ../../library/functions.rst:647 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1255,7 +1273,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法:" -#: ../../library/functions.rst:641 +#: ../../library/functions.rst:662 msgid "" "Here ``floatnumber`` is the form of a Python floating-point literal, " "described in :ref:`floating`. Case is not significant, so, for example, " @@ -1266,7 +1284,7 @@ msgstr "" "都可以,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表示正無窮" "大。" -#: ../../library/functions.rst:646 +#: ../../library/functions.rst:667 msgid "" "Otherwise, if the argument is an integer or a floating point number, a " "floating point number with the same value (within Python's floating point " @@ -1276,7 +1294,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會觸發 :exc:`OverflowError`。" -#: ../../library/functions.rst:651 +#: ../../library/functions.rst:672 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If ``__float__()`` is not defined then it falls back to :" @@ -1285,26 +1303,26 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 指派給 ``x.__float__()``。如果未定" "義 ``__float__()`` 則使用 :meth:`__index__`。" -#: ../../library/functions.rst:655 +#: ../../library/functions.rst:676 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:657 +#: ../../library/functions.rst:678 msgid "Examples::" msgstr "" "例如:\n" "\n" "::" -#: ../../library/functions.rst:670 +#: ../../library/functions.rst:691 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:699 msgid "Falls back to :meth:`__index__` if :meth:`__float__` is not defined." msgstr "" -#: ../../library/functions.rst:688 +#: ../../library/functions.rst:709 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1315,7 +1333,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:693 +#: ../../library/functions.rst:714 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1323,7 +1341,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:696 +#: ../../library/functions.rst:717 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1337,7 +1355,7 @@ msgstr "" "字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空,或是 " "*format_spec* 或回傳值不是字串,則會觸發 :exc:`TypeError`。" -#: ../../library/functions.rst:703 +#: ../../library/functions.rst:724 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1345,7 +1363,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會觸發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:712 +#: ../../library/functions.rst:733 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1355,7 +1373,7 @@ msgstr "" "素。\\ ``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:716 +#: ../../library/functions.rst:737 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1363,7 +1381,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:723 +#: ../../library/functions.rst:745 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1378,7 +1396,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:732 +#: ../../library/functions.rst:754 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1386,7 +1404,7 @@ msgid "" "`getattr`." msgstr "" -#: ../../library/functions.rst:740 +#: ../../library/functions.rst:762 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1395,7 +1413,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:747 +#: ../../library/functions.rst:769 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1406,7 +1424,7 @@ msgstr "" "則回傳 ``False``。(此功能是通過呼叫 ``getattr(object, name)`` 看是否有 :exc:" "`AttributeError` 來實現的。)" -#: ../../library/functions.rst:755 +#: ../../library/functions.rst:777 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1417,7 +1435,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:762 +#: ../../library/functions.rst:784 msgid "" "For objects with custom :meth:`__hash__` methods, note that :func:`hash` " "truncates the return value based on the bit width of the host machine. See :" @@ -1426,7 +1444,7 @@ msgstr "" "請注意,如果物件實現了自己的 :meth:`__hash__` method,:func:`hash` 根據執行機" "器的位元長度來擷取回傳值。另請參閱 :meth:`__hash__`。" -#: ../../library/functions.rst:768 +#: ../../library/functions.rst:791 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1440,7 +1458,7 @@ msgstr "" "鍵字或文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任意物" "件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:775 +#: ../../library/functions.rst:798 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1448,12 +1466,12 @@ msgid "" "parameters `." msgstr "" -#: ../../library/functions.rst:780 +#: ../../library/functions.rst:803 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "該函式透過 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:782 +#: ../../library/functions.rst:805 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1461,7 +1479,7 @@ msgstr "" "變更至 :mod:`pydoc` 和 :mod:`inspect` 使得可呼叫物件的簽名信息 (signature) 更" "加全面和一致。" -#: ../../library/functions.rst:789 +#: ../../library/functions.rst:812 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1471,7 +1489,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`__index__` method 並且回傳一個整數。" "舉例來說:" -#: ../../library/functions.rst:798 +#: ../../library/functions.rst:821 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1480,20 +1498,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:810 +#: ../../library/functions.rst:833 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:838 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:821 +#: ../../library/functions.rst:844 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1503,17 +1521,17 @@ msgstr "" "回傳物件的 \"標識值\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:826 +#: ../../library/functions.rst:849 msgid "This is the address of the object in memory." msgstr "" -#: ../../library/functions.rst:828 +#: ../../library/functions.rst:851 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" -#: ../../library/functions.rst:833 +#: ../../library/functions.rst:857 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1526,7 +1544,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:843 +#: ../../library/functions.rst:867 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1534,31 +1552,31 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:846 +#: ../../library/functions.rst:870 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt``." msgstr "" -#: ../../library/functions.rst:848 +#: ../../library/functions.rst:872 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" msgstr "" -#: ../../library/functions.rst:851 +#: ../../library/functions.rst:875 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "argument ``result``." msgstr "" -#: ../../library/functions.rst:853 +#: ../../library/functions.rst:877 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." msgstr "" -#: ../../library/functions.rst:860 +#: ../../library/functions.rst:884 msgid "" "Return an integer object constructed from a number or string *x*, or return " "``0`` if no arguments are given. If *x* defines :meth:`__int__`, ``int(x)`` " @@ -1571,7 +1589,7 @@ msgstr "" "了 :meth:`__index__` 則回傳 ``x.__index__()``。如果 *x* 定義了 :meth:" "`__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數則向零舍入。" -#: ../../library/functions.rst:867 +#: ../../library/functions.rst:891 msgid "" "If *x* is not a number or if *base* is given, then *x* must be a string, :" "class:`bytes`, or :class:`bytearray` instance representing an :ref:`integer " @@ -1596,11 +1614,11 @@ msgstr "" "2、8、10、16 進制中的一個,所以 ``int('010', 0)`` 是非法的,但 " "``int('010')`` 和 ``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:880 +#: ../../library/functions.rst:904 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱 :ref:`typesnumeric`。" -#: ../../library/functions.rst:882 +#: ../../library/functions.rst:906 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1612,11 +1630,15 @@ msgstr "" "使用 :meth:`base.__int__ ` 而不是 :meth:`base.__index__ " "`。" -#: ../../library/functions.rst:895 +#: ../../library/functions.rst:919 msgid "Falls back to :meth:`__index__` if :meth:`__int__` is not defined." msgstr "" -#: ../../library/functions.rst:898 +#: ../../library/functions.rst:922 +msgid "The delegation to :meth:`__trunc__` is deprecated." +msgstr "" + +#: ../../library/functions.rst:925 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1626,7 +1648,7 @@ msgid "" "documentation." msgstr "" -#: ../../library/functions.rst:909 +#: ../../library/functions.rst:935 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `)subclass 的實例,則回傳 ``True``。如果 " @@ -1643,13 +1666,13 @@ msgstr "" "物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," "若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" "是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會觸發 :exc:`TypeError` 異" -"常。" +"常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引發。" -#: ../../library/functions.rst:919 ../../library/functions.rst:933 +#: ../../library/functions.rst:946 ../../library/functions.rst:960 msgid "*classinfo* can be a :ref:`types-union`." msgstr "" -#: ../../library/functions.rst:925 +#: ../../library/functions.rst:952 msgid "" "Return ``True`` if *class* is a subclass (direct, indirect, or :term:" "`virtual `) of *classinfo*. A class is considered a " @@ -1664,7 +1687,7 @@ msgstr "" "*class* 是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會" "觸發 :exc:`TypeError`。" -#: ../../library/functions.rst:939 +#: ../../library/functions.rst:967 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1687,18 +1710,18 @@ msgstr "" "帶引數地呼叫 *object*\\ ;如果回傳的結果是 *sentinel* 則觸發 :exc:" "`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:952 +#: ../../library/functions.rst:980 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:954 +#: ../../library/functions.rst:982 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " "file until the end of file is reached::" msgstr "" -#: ../../library/functions.rst:966 +#: ../../library/functions.rst:994 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -1707,13 +1730,13 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:972 +#: ../../library/functions.rst:1000 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." msgstr "" -#: ../../library/functions.rst:980 +#: ../../library/functions.rst:1009 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -1721,7 +1744,7 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:986 +#: ../../library/functions.rst:1015 msgid "" "Update and return a dictionary representing the current local symbol table. " "Free variables are returned by :func:`locals` when it is called in function " @@ -1732,7 +1755,7 @@ msgstr "" "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,\\ :func:" "`locals` 和 :func:`globals` 是相同的 dictionary。" -#: ../../library/functions.rst:992 +#: ../../library/functions.rst:1021 msgid "" "The contents of this dictionary should not be modified; changes may not " "affect the values of local and free variables used by the interpreter." @@ -1740,28 +1763,28 @@ msgstr "" "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自由" "變數的值。" -#: ../../library/functions.rst:997 +#: ../../library/functions.rst:1026 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " -"yielding the results. If additional *iterable* arguments are passed, " +"yielding the results. If additional *iterables* arguments are passed, " "*function* must take that many arguments and is applied to the items from " "all iterables in parallel. With multiple iterables, the iterator stops when " "the shortest iterable is exhausted. For cases where the function inputs are " "already arranged into argument tuples, see :func:`itertools.starmap`\\." msgstr "" "產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " -"iterator。如果傳遞了額外的 *iterable* 引數,*function* 必須接受相同個數的引" +"iterator。如果傳遞了額外的 *iterables* 引數,*function* 必須接受相同個數的引" "數,並應用於所有 iterables 中同時獲取的元素。當有多個 iterables 時,最短的 " "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經是 tuple 的引數,請參" "閱 :func:`itertools.starmap`\\。" -#: ../../library/functions.rst:1008 +#: ../../library/functions.rst:1038 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個及以上引數中最大的。" -#: ../../library/functions.rst:1011 +#: ../../library/functions.rst:1041 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -1770,7 +1793,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1016 ../../library/functions.rst:1053 +#: ../../library/functions.rst:1046 ../../library/functions.rst:1084 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -1782,7 +1805,7 @@ msgstr "" "式,如同 :meth:`list.sort` 使用方式。*default* 引數是當 iterable 為空時回傳的" "值。如果 iterable 為空,並且沒有提供 *default*,則會觸發 :exc:`ValueError`。" -#: ../../library/functions.rst:1022 +#: ../../library/functions.rst:1052 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -1793,15 +1816,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1027 ../../library/functions.rst:1064 +#: ../../library/functions.rst:1057 ../../library/functions.rst:1095 msgid "The *default* keyword-only argument." msgstr "*default* 僅限關鍵字引數。" -#: ../../library/functions.rst:1030 ../../library/functions.rst:1067 +#: ../../library/functions.rst:1060 ../../library/functions.rst:1098 msgid "The *key* can be ``None``." msgstr "" -#: ../../library/functions.rst:1038 +#: ../../library/functions.rst:1068 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -1809,13 +1832,13 @@ msgstr "" "回傳由給定的引數建立之 \"memory view\" 物件。有關詳細資訊,請參閱 :ref:" "`typememoryview`。" -#: ../../library/functions.rst:1045 +#: ../../library/functions.rst:1076 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個及以上引數中最小的。" -#: ../../library/functions.rst:1048 +#: ../../library/functions.rst:1079 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -1824,7 +1847,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個或以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1059 +#: ../../library/functions.rst:1090 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -1835,7 +1858,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1073 +#: ../../library/functions.rst:1105 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -1845,7 +1868,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則觸發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1080 +#: ../../library/functions.rst:1112 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -1854,7 +1877,7 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1086 +#: ../../library/functions.rst:1118 msgid "" ":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " "assign arbitrary attributes to an instance of the :class:`object` class." @@ -1862,7 +1885,7 @@ msgstr "" "由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" "給 :class:`object` class 的實例。" -#: ../../library/functions.rst:1092 +#: ../../library/functions.rst:1124 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -1873,7 +1896,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1102 +#: ../../library/functions.rst:1134 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -1881,7 +1904,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1119 +#: ../../library/functions.rst:1151 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -1890,7 +1913,7 @@ msgstr "" "開啟 *file* 並回傳對應的 :term:`file object`。如果該檔案不能開啟,則觸發 :" "exc:`OSError`。關於使用此函式的更多方法請參閱\\ :ref:`tut-files`。" -#: ../../library/functions.rst:1123 +#: ../../library/functions.rst:1155 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -1903,7 +1926,7 @@ msgstr "" "果有提供檔案描述器,它會隨著回傳的 I/O 物件關閉而關閉,除非 *closefd* 被設為 " "``False``。)" -#: ../../library/functions.rst:1129 +#: ../../library/functions.rst:1161 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -1911,84 +1934,84 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-dependent: " -"``locale.getpreferredencoding(False)`` is called to get the current locale " -"encoding. (For reading and writing raw bytes use binary mode and leave " -"*encoding* unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-dependent: :func:" +"`locale.getencoding()` is called to get the current locale encoding. (For " +"reading and writing raw bytes use binary mode and leave *encoding* " +"unspecified.) The available modes are:" msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性創建 ``'x'``\\ 、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無" "論當前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果" -"沒有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 ``locale." -"getpreferredencoding(False)`` 來獲取當前的本地編碼。(要讀取和寫入原始 " +"沒有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:" +"`locale.getencoding()` 來獲取當前的本地編碼。(要讀取和寫入原始 " "bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1146 +#: ../../library/functions.rst:1178 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1146 +#: ../../library/functions.rst:1178 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1180 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1180 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1149 +#: ../../library/functions.rst:1181 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1149 +#: ../../library/functions.rst:1181 msgid "open for writing, truncating the file first" msgstr "" -#: ../../library/functions.rst:1150 +#: ../../library/functions.rst:1182 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1150 +#: ../../library/functions.rst:1182 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性創建,如果文件已存在則會失敗" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1183 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1183 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果文件存在則在末尾追加寫入內容" -#: ../../library/functions.rst:1152 +#: ../../library/functions.rst:1184 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1152 +#: ../../library/functions.rst:1184 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1153 +#: ../../library/functions.rst:1185 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1153 +#: ../../library/functions.rst:1185 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1186 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1186 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1157 +#: ../../library/functions.rst:1189 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -1997,7 +2020,7 @@ msgstr "" "預設的模式是 ``'r'``\\ (開啟並讀取文字,同 ``'rt'``)。對於二進位制寫入," "``'w+b'`` 模式開啟並把檔案內容變成 0 bytes,``'r+b'`` 則不會捨棄原始內容。" -#: ../../library/functions.rst:1161 +#: ../../library/functions.rst:1193 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2008,23 +2031,14 @@ msgid "" "specified *encoding* if given." msgstr "" -#: ../../library/functions.rst:1169 -msgid "" -"There is an additional mode character permitted, ``'U'``, which no longer " -"has any effect, and is considered deprecated. It previously enabled :term:" -"`universal newlines` in text mode, which became the default behavior in " -"Python 3.0. Refer to the documentation of the :ref:`newline ` parameter for further details." -msgstr "" - -#: ../../library/functions.rst:1177 +#: ../../library/functions.rst:1203 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " "platform-independent." msgstr "" -#: ../../library/functions.rst:1181 +#: ../../library/functions.rst:1207 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2037,7 +2051,7 @@ msgid "" "given, the default buffering policy works as follows:" msgstr "" -#: ../../library/functions.rst:1191 +#: ../../library/functions.rst:1217 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2045,23 +2059,23 @@ msgid "" "the buffer will typically be 4096 or 8192 bytes long." msgstr "" -#: ../../library/functions.rst:1196 +#: ../../library/functions.rst:1222 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " "described above for binary files." msgstr "" -#: ../../library/functions.rst:1200 +#: ../../library/functions.rst:1226 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " -"dependent (whatever :func:`locale.getpreferredencoding` returns), but any :" -"term:`text encoding` supported by Python can be used. See the :mod:`codecs` " -"module for the list of supported encodings." +"dependent (whatever :func:`locale.getencoding` returns), but any :term:`text " +"encoding` supported by Python can be used. See the :mod:`codecs` module for " +"the list of supported encodings." msgstr "" -#: ../../library/functions.rst:1207 +#: ../../library/functions.rst:1232 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2070,25 +2084,25 @@ msgid "" "register_error` is also valid. The standard names include:" msgstr "" -#: ../../library/functions.rst:1215 +#: ../../library/functions.rst:1240 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." msgstr "" -#: ../../library/functions.rst:1219 +#: ../../library/functions.rst:1244 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "" -#: ../../library/functions.rst:1222 +#: ../../library/functions.rst:1247 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" -#: ../../library/functions.rst:1225 +#: ../../library/functions.rst:1250 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2097,33 +2111,33 @@ msgid "" "an unknown encoding." msgstr "" -#: ../../library/functions.rst:1232 +#: ../../library/functions.rst:1257 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " "character reference ``&#nnn;``." msgstr "" -#: ../../library/functions.rst:1236 +#: ../../library/functions.rst:1261 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." msgstr "" -#: ../../library/functions.rst:1239 +#: ../../library/functions.rst:1264 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." msgstr "" -#: ../../library/functions.rst:1247 +#: ../../library/functions.rst:1272 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " "follows:" msgstr "" -#: ../../library/functions.rst:1251 +#: ../../library/functions.rst:1276 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2134,7 +2148,7 @@ msgid "" "given string, and the line ending is returned to the caller untranslated." msgstr "" -#: ../../library/functions.rst:1259 +#: ../../library/functions.rst:1284 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2143,7 +2157,7 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/functions.rst:1265 +#: ../../library/functions.rst:1290 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2151,7 +2165,7 @@ msgid "" "otherwise, an error will be raised." msgstr "" -#: ../../library/functions.rst:1270 +#: ../../library/functions.rst:1295 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2160,11 +2174,11 @@ msgid "" "similar to passing ``None``)." msgstr "" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1301 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1278 +#: ../../library/functions.rst:1303 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2174,7 +2188,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:1291 +#: ../../library/functions.rst:1316 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2189,7 +2203,7 @@ msgid "" "FileIO`, is returned." msgstr "" -#: ../../library/functions.rst:1312 +#: ../../library/functions.rst:1337 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2199,31 +2213,31 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1316 +#: ../../library/functions.rst:1341 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``file``, " "``mode``, ``flags``." msgstr "" -#: ../../library/functions.rst:1318 +#: ../../library/functions.rst:1343 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "" -#: ../../library/functions.rst:1324 +#: ../../library/functions.rst:1348 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1325 +#: ../../library/functions.rst:1349 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1326 +#: ../../library/functions.rst:1350 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去觸發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1327 +#: ../../library/functions.rst:1351 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2231,15 +2245,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (\\ ``'x'``\\ ),現在會觸發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1333 +#: ../../library/functions.rst:1356 msgid "The file is now non-inheritable." msgstr "檔案在當前版本開始禁止繼承。" -#: ../../library/functions.rst:1337 -msgid "The ``'U'`` mode." -msgstr "``'U'`` 模式。" - -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1360 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -2248,15 +2258,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程序沒有觸發例外,此函式現在會重試系統呼叫,而" "不是觸發 :exc:`InterruptedError`\\ (原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1363 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1367 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對實現了 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1368 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2264,7 +2274,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1356 +#: ../../library/functions.rst:1371 +msgid "The ``'U'`` mode has been removed." +msgstr "``'U'`` 模式被移除。" + +#: ../../library/functions.rst:1376 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2275,7 +2289,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、\\ ``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1364 +#: ../../library/functions.rst:1384 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2286,7 +2300,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1369 +#: ../../library/functions.rst:1389 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2299,7 +2313,7 @@ msgid "" "close to ``3j``." msgstr "" -#: ../../library/functions.rst:1379 +#: ../../library/functions.rst:1399 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2308,29 +2322,29 @@ msgid "" "*base* modulo *mod*." msgstr "" -#: ../../library/functions.rst:1385 +#: ../../library/functions.rst:1405 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "" -#: ../../library/functions.rst:1392 +#: ../../library/functions.rst:1412 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." msgstr "" -#: ../../library/functions.rst:1397 +#: ../../library/functions.rst:1417 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "" -#: ../../library/functions.rst:1404 +#: ../../library/functions.rst:1424 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " "keyword arguments." msgstr "" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1428 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2339,7 +2353,7 @@ msgid "" "*end*." msgstr "" -#: ../../library/functions.rst:1414 +#: ../../library/functions.rst:1434 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2347,38 +2361,38 @@ msgid "" "binary mode file objects. For these, use ``file.write(...)`` instead." msgstr "" -#: ../../library/functions.rst:1419 +#: ../../library/functions.rst:1439 msgid "" "Whether the output is buffered is usually determined by *file*, but if the " "*flush* keyword argument is true, the stream is forcibly flushed." msgstr "" -#: ../../library/functions.rst:1422 +#: ../../library/functions.rst:1442 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1428 +#: ../../library/functions.rst:1448 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1450 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " "attribute value. And *doc* creates a docstring for the attribute." msgstr "" -#: ../../library/functions.rst:1434 +#: ../../library/functions.rst:1454 msgid "A typical use is to define a managed attribute ``x``::" msgstr "" -#: ../../library/functions.rst:1451 +#: ../../library/functions.rst:1471 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." msgstr "" -#: ../../library/functions.rst:1454 +#: ../../library/functions.rst:1474 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2386,14 +2400,14 @@ msgid "" "term:`decorator`::" msgstr "" -#: ../../library/functions.rst:1467 +#: ../../library/functions.rst:1487 msgid "" "The ``@property`` decorator turns the :meth:`voltage` method into a \"getter" "\" for a read-only attribute with the same name, and it sets the docstring " "for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1471 +#: ../../library/functions.rst:1491 msgid "" "A property object has :attr:`~property.getter`, :attr:`~property.setter`, " "and :attr:`~property.deleter` methods usable as decorators that create a " @@ -2401,30 +2415,30 @@ msgid "" "decorated function. This is best explained with an example::" msgstr "" -#: ../../library/functions.rst:1493 +#: ../../library/functions.rst:1513 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1497 +#: ../../library/functions.rst:1517 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1500 +#: ../../library/functions.rst:1520 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1509 +#: ../../library/functions.rst:1529 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1515 +#: ../../library/functions.rst:1535 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -2437,7 +2451,7 @@ msgid "" "`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1548 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`__reversed__` method or supports the sequence protocol (the :meth:" @@ -2445,14 +2459,14 @@ msgid "" "starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1536 +#: ../../library/functions.rst:1556 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1540 +#: ../../library/functions.rst:1560 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -2463,13 +2477,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1549 +#: ../../library/functions.rst:1569 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1554 +#: ../../library/functions.rst:1574 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -2478,21 +2492,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1565 +#: ../../library/functions.rst:1586 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1569 +#: ../../library/functions.rst:1590 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1576 +#: ../../library/functions.rst:1597 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -2501,7 +2515,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1582 +#: ../../library/functions.rst:1603 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -2510,14 +2524,14 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1590 +#: ../../library/functions.rst:1611 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1599 +#: ../../library/functions.rst:1620 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " @@ -2530,35 +2544,35 @@ msgid "" "func:`itertools.islice` for an alternate version that returns an iterator." msgstr "" -#: ../../library/functions.rst:1612 +#: ../../library/functions.rst:1633 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1614 +#: ../../library/functions.rst:1635 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1616 +#: ../../library/functions.rst:1637 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1620 +#: ../../library/functions.rst:1641 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1623 +#: ../../library/functions.rst:1644 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1626 +#: ../../library/functions.rst:1647 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -2566,7 +2580,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1631 +#: ../../library/functions.rst:1652 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -2578,22 +2592,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1640 +#: ../../library/functions.rst:1661 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1644 +#: ../../library/functions.rst:1665 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1646 +#: ../../library/functions.rst:1667 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1653 +#: ../../library/functions.rst:1674 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -2601,21 +2615,21 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1656 +#: ../../library/functions.rst:1677 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, they can be called as regular " "functions (such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1660 +#: ../../library/functions.rst:1681 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1664 +#: ../../library/functions.rst:1685 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -2624,36 +2638,36 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1676 +#: ../../library/functions.rst:1697 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1678 +#: ../../library/functions.rst:1699 msgid "" "Static methods now inherit the method attributes (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " "new ``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" -#: ../../library/functions.rst:1693 +#: ../../library/functions.rst:1714 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1695 +#: ../../library/functions.rst:1716 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1701 +#: ../../library/functions.rst:1722 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1705 +#: ../../library/functions.rst:1726 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -2662,39 +2676,39 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1711 +#: ../../library/functions.rst:1732 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1716 +#: ../../library/functions.rst:1738 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1720 +#: ../../library/functions.rst:1742 msgid "" -"The *object-or-type* determines the :term:`method resolution order` to be " +"The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1724 +#: ../../library/functions.rst:1746 msgid "" -"For example, if :attr:`~class.__mro__` of *object-or-type* is ``D -> B -> C -" +"For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1728 +#: ../../library/functions.rst:1750 msgid "" -"The :attr:`~class.__mro__` attribute of the *object-or-type* lists the " +"The :attr:`~class.__mro__` attribute of the *object_or_type* lists the " "method resolution search order used by both :func:`getattr` and :func:" "`super`. The attribute is dynamic and can change whenever the inheritance " "hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1733 +#: ../../library/functions.rst:1755 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -2702,7 +2716,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1738 +#: ../../library/functions.rst:1760 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -2710,7 +2724,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1743 +#: ../../library/functions.rst:1765 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -2723,18 +2737,18 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1753 +#: ../../library/functions.rst:1775 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1782 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:1764 +#: ../../library/functions.rst:1786 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -2744,7 +2758,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:1771 +#: ../../library/functions.rst:1793 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -2754,33 +2768,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:1778 +#: ../../library/functions.rst:1800 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:1787 +#: ../../library/functions.rst:1810 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1796 +#: ../../library/functions.rst:1819 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__ `." msgstr "" -#: ../../library/functions.rst:1800 +#: ../../library/functions.rst:1823 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:1804 +#: ../../library/functions.rst:1827 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -2793,11 +2807,11 @@ msgid "" "identical :class:`type` objects:" msgstr "" -#: ../../library/functions.rst:1819 +#: ../../library/functions.rst:1842 msgid "See also :ref:`bltin-type-objects`." msgstr "另請參閱 :ref:`bltin-type-objects`。" -#: ../../library/functions.rst:1821 +#: ../../library/functions.rst:1844 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -2805,23 +2819,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:1826 +#: ../../library/functions.rst:1849 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:1828 +#: ../../library/functions.rst:1851 msgid "" "Subclasses of :class:`type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:1834 +#: ../../library/functions.rst:1858 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/functions.rst:1837 +#: ../../library/functions.rst:1861 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -2829,54 +2843,54 @@ msgid "" "`types.MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:1842 +#: ../../library/functions.rst:1866 msgid "" "Without an argument, :func:`vars` acts like :func:`locals`. Note, the " "locals dictionary is only useful for reads since updates to the locals " "dictionary are ignored." msgstr "" -#: ../../library/functions.rst:1846 +#: ../../library/functions.rst:1870 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:1852 +#: ../../library/functions.rst:1876 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:1855 +#: ../../library/functions.rst:1879 msgid "Example::" msgstr "" "例如:\n" "\n" "::" -#: ../../library/functions.rst:1864 +#: ../../library/functions.rst:1888 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1891 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:1871 +#: ../../library/functions.rst:1895 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:1875 +#: ../../library/functions.rst:1899 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -2884,51 +2898,51 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:1880 +#: ../../library/functions.rst:1904 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:1887 +#: ../../library/functions.rst:1911 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:1894 +#: ../../library/functions.rst:1918 msgid "" "Unlike the default behavior, it checks that the lengths of iterables are " "identical, raising a :exc:`ValueError` if they aren't:" msgstr "" -#: ../../library/functions.rst:1902 +#: ../../library/functions.rst:1926 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:1906 +#: ../../library/functions.rst:1930 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:1910 +#: ../../library/functions.rst:1934 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:1913 +#: ../../library/functions.rst:1937 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:1915 +#: ../../library/functions.rst:1939 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -2937,23 +2951,23 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:1921 +#: ../../library/functions.rst:1945 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:1932 +#: ../../library/functions.rst:1956 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:1944 +#: ../../library/functions.rst:1968 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1947 +#: ../../library/functions.rst:1971 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -2965,7 +2979,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1956 +#: ../../library/functions.rst:1980 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -2975,7 +2989,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:1963 +#: ../../library/functions.rst:1987 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -2984,7 +2998,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:1969 +#: ../../library/functions.rst:1993 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -2992,58 +3006,58 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:1974 +#: ../../library/functions.rst:1998 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:2003 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:1983 +#: ../../library/functions.rst:2007 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:1986 +#: ../../library/functions.rst:2010 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:1993 +#: ../../library/functions.rst:2017 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:1997 +#: ../../library/functions.rst:2021 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2000 +#: ../../library/functions.rst:2024 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2004 +#: ../../library/functions.rst:2028 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2009 +#: ../../library/functions.rst:2033 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2010 +#: ../../library/functions.rst:2034 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3051,3 +3065,6 @@ msgid "" msgstr "" "剖析器只接受 Unix 風格的行結束符。如果您從檔案中讀取程式碼,請確保用換行符轉" "換模式轉換 Windows 或 Mac 風格的換行符。" + +#~ msgid "The ``'U'`` mode." +#~ msgstr "``'U'`` 模式。" diff --git a/library/functools.po b/library/functools.po index 778e3c15fc..dbadeb7858 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-11 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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:264 +#: ../../library/functools.rst:39 ../../library/functools.rst:267 msgid "For example::" msgstr "" "舉例來說:\n" @@ -69,7 +69,7 @@ msgid "" msgstr "" #: ../../library/functools.rst:62 ../../library/functools.rst:127 -#: ../../library/functools.rst:356 +#: ../../library/functools.rst:359 msgid "Example::" msgstr "" "範例:\n" @@ -232,6 +232,12 @@ msgstr "" #: ../../library/functools.rst:194 msgid "" +"If a method is cached, the `self` instance argument is included in the " +"cache. See :ref:`faq-cache-method-calls`" +msgstr "" + +#: ../../library/functools.rst:197 +msgid "" "An `LRU (least recently used) cache `_ works best when the " "most recent calls are the best predictors of upcoming calls (for example, " @@ -240,7 +246,7 @@ msgid "" "long-running processes such as web servers." msgstr "" -#: ../../library/functools.rst:201 +#: ../../library/functools.rst:204 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 " @@ -248,44 +254,44 @@ msgid "" "objects on each call, or impure functions such as time() or random()." msgstr "" -#: ../../library/functools.rst:206 +#: ../../library/functools.rst:209 msgid "Example of an LRU cache for static web content::" msgstr "" -#: ../../library/functools.rst:225 +#: ../../library/functools.rst:228 msgid "" "Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " "programming `_ technique::" msgstr "" -#: ../../library/functools.rst:245 +#: ../../library/functools.rst:248 msgid "Added the *typed* option." msgstr "新增 *typed* 選項。" -#: ../../library/functools.rst:248 +#: ../../library/functools.rst:251 msgid "Added the *user_function* option." msgstr "新增 *user_function* 選項。" -#: ../../library/functools.rst:251 +#: ../../library/functools.rst:254 msgid "Added the function :func:`cache_parameters`" msgstr "新增 :func:`cache_parameters` 函式。" -#: ../../library/functools.rst:256 +#: ../../library/functools.rst:259 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:260 +#: ../../library/functools.rst:263 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:284 +#: ../../library/functools.rst:287 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 " @@ -294,7 +300,7 @@ msgid "" "rich comparison methods instead is likely to provide an easy speed boost." msgstr "" -#: ../../library/functools.rst:293 +#: ../../library/functools.rst:296 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 " @@ -302,13 +308,13 @@ msgid "" "the original method is abstract." msgstr "" -#: ../../library/functools.rst:300 +#: ../../library/functools.rst:303 msgid "" "Returning NotImplemented from the underlying comparison function for " "unrecognised types is now supported." msgstr "" -#: ../../library/functools.rst:306 +#: ../../library/functools.rst:309 msgid "" "Return a new :ref:`partial object` which when called will " "behave like *func* called with the positional arguments *args* and keyword " @@ -317,7 +323,7 @@ msgid "" "extend and override *keywords*. Roughly equivalent to::" msgstr "" -#: ../../library/functools.rst:322 +#: ../../library/functools.rst:325 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 " @@ -326,20 +332,20 @@ msgid "" "the *base* argument defaults to two:" msgstr "" -#: ../../library/functools.rst:337 +#: ../../library/functools.rst:340 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:341 +#: ../../library/functools.rst:344 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:344 +#: ../../library/functools.rst:347 msgid "" "When *func* is a descriptor (such as a normal Python function, :func:" "`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or another " @@ -348,7 +354,7 @@ msgid "" "objects>` returned as the result." msgstr "" -#: ../../library/functools.rst:350 +#: ../../library/functools.rst:353 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 " @@ -357,7 +363,7 @@ msgid "" "`partialmethod` constructor." msgstr "" -#: ../../library/functools.rst:381 +#: ../../library/functools.rst:384 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 " @@ -370,30 +376,30 @@ msgid "" "the first item is returned." msgstr "" -#: ../../library/functools.rst:390 +#: ../../library/functools.rst:393 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/functools.rst:402 +#: ../../library/functools.rst:405 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." msgstr "" -#: ../../library/functools.rst:407 +#: ../../library/functools.rst:410 msgid "" "Transform a function into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: ../../library/functools.rst:410 +#: ../../library/functools.rst:413 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:421 +#: ../../library/functools.rst:424 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 " @@ -401,32 +407,36 @@ msgid "" "first argument automatically::" msgstr "" -#: ../../library/functools.rst:439 +#: ../../library/functools.rst:442 +msgid ":data:`types.UnionType` and :data:`typing.Union` can also be used::" +msgstr "" + +#: ../../library/functools.rst:459 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:450 +#: ../../library/functools.rst:470 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:458 +#: ../../library/functools.rst:478 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:472 +#: ../../library/functools.rst:492 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "" -#: ../../library/functools.rst:492 +#: ../../library/functools.rst:512 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 " @@ -435,36 +445,42 @@ msgid "" "found." msgstr "" -#: ../../library/functools.rst:498 +#: ../../library/functools.rst:518 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:513 +#: ../../library/functools.rst:533 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" -#: ../../library/functools.rst:521 +#: ../../library/functools.rst:541 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "" -#: ../../library/functools.rst:535 +#: ../../library/functools.rst:555 msgid "The :func:`register` attribute now supports using type annotations." msgstr "" -#: ../../library/functools.rst:541 +#: ../../library/functools.rst:558 +msgid "" +"The :func:`register` attribute now supports :data:`types.UnionType` and :" +"data:`typing.Union` as type annotations." +msgstr "" + +#: ../../library/functools.rst:565 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: ../../library/functools.rst:544 +#: ../../library/functools.rst:568 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -472,7 +488,7 @@ msgid "" "argument::" msgstr "" -#: ../../library/functools.rst:562 +#: ../../library/functools.rst:586 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -481,14 +497,14 @@ msgid "" "rather than an instance of the class::" msgstr "" -#: ../../library/functools.rst:584 +#: ../../library/functools.rst:608 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " "and others." msgstr "" -#: ../../library/functools.rst:593 +#: ../../library/functools.rst:617 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -502,7 +518,7 @@ msgid "" "``__dict__``, i.e. the instance dictionary)." msgstr "" -#: ../../library/functools.rst:603 +#: ../../library/functools.rst:627 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -510,7 +526,7 @@ msgid "" "that refers to the function being wrapped." msgstr "" -#: ../../library/functools.rst:608 +#: ../../library/functools.rst:632 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 " @@ -519,7 +535,7 @@ msgid "" "is typically less than helpful." msgstr "" -#: ../../library/functools.rst:614 +#: ../../library/functools.rst:638 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 " @@ -528,26 +544,26 @@ msgid "" "wrapper function itself is missing any attributes named in *updated*." msgstr "" -#: ../../library/functools.rst:620 +#: ../../library/functools.rst:644 msgid "Automatic addition of the ``__wrapped__`` attribute." msgstr "" -#: ../../library/functools.rst:623 +#: ../../library/functools.rst:647 msgid "Copying of the ``__annotations__`` attribute by default." msgstr "" -#: ../../library/functools.rst:626 +#: ../../library/functools.rst:650 msgid "Missing attributes no longer trigger an :exc:`AttributeError`." msgstr "" -#: ../../library/functools.rst:629 +#: ../../library/functools.rst:653 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:637 +#: ../../library/functools.rst:661 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -555,42 +571,42 @@ msgid "" "updated=updated)``. For example::" msgstr "" -#: ../../library/functools.rst:663 +#: ../../library/functools.rst:687 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:671 +#: ../../library/functools.rst:695 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:673 +#: ../../library/functools.rst:697 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" msgstr "" -#: ../../library/functools.rst:679 +#: ../../library/functools.rst:703 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:685 +#: ../../library/functools.rst:709 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." msgstr "" -#: ../../library/functools.rst:691 +#: ../../library/functools.rst:715 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "" -#: ../../library/functools.rst:694 +#: ../../library/functools.rst:718 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/getpass.po b/library/getpass.po index 8ce65d5648..92fae955ba 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,11 +27,22 @@ msgstr ":mod:`getpass` --- 可攜式密碼輸入工具" msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "**原始碼:**\\ :source:`Lib/getpass.py`" -#: ../../library/getpass.rst:15 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/getpass.rst:17 msgid "The :mod:`getpass` module provides two functions:" msgstr ":mod:`getpass` 模組 (module) 提供了兩個函式:" -#: ../../library/getpass.rst:20 +#: ../../library/getpass.rst:21 msgid "" "Prompt the user for a password without echoing. The user is prompted using " "the string *prompt*, which defaults to ``'Password: '``. On Unix, the " @@ -46,7 +57,7 @@ msgstr "" "中。\\ *stream* 預設為主控終端機 (controlling terminal) (\\ :file:`/dev/tty`" "\\ ),如果不可用則為 ``sys.stderr`` (此引數在 Windows 上會被忽略)。" -#: ../../library/getpass.rst:27 +#: ../../library/getpass.rst:28 msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " "message to *stream* and reading from ``sys.stdin`` and issuing a :exc:" @@ -56,7 +67,7 @@ msgstr "" "息到 *stream*\\ ,並從 ``sys.stdin`` 讀取且同時發出 :exc:`GetPassWarning`" "\\ 。" -#: ../../library/getpass.rst:32 +#: ../../library/getpass.rst:33 msgid "" "If you call getpass from within IDLE, the input may be done in the terminal " "you launched IDLE from rather than the idle window itself." @@ -64,15 +75,15 @@ msgstr "" "如果你從 IDLE 內部呼叫 getpass,輸入可能會在你啟動 IDLE 的終端機中完成,而非" "在 IDLE 視窗中。" -#: ../../library/getpass.rst:37 +#: ../../library/getpass.rst:38 msgid "A :exc:`UserWarning` subclass issued when password input may be echoed." msgstr "當密碼輸入可能被回音時會發出的 :exc:`UserWarning` 子類別。" -#: ../../library/getpass.rst:42 +#: ../../library/getpass.rst:43 msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" -#: ../../library/getpass.rst:44 +#: ../../library/getpass.rst:45 msgid "" "This function checks the environment variables :envvar:`LOGNAME`, :envvar:" "`USER`, :envvar:`LNAME` and :envvar:`USERNAME`, in order, and returns the " @@ -85,7 +96,7 @@ msgstr "" "如果均未設定,則在支援 :mod:`pwd` 模組的系統上將會回傳來自密碼資料庫的登入名" "稱,否則將引發一個例外。" -#: ../../library/getpass.rst:51 +#: ../../library/getpass.rst:52 msgid "" "In general, this function should be preferred over :func:`os.getlogin()`." msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin()` 優先使用。" diff --git a/library/gettext.po b/library/gettext.po index 63da7d6578..39887b18d1 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -75,32 +75,24 @@ msgstr "" #: ../../library/gettext.rst:51 msgid "" -"Bind the *domain* to *codeset*, changing the encoding of byte strings " -"returned by the :func:`lgettext`, :func:`ldgettext`, :func:`lngettext` and :" -"func:`ldngettext` functions. If *codeset* is omitted, then the current " -"binding is returned." -msgstr "" - -#: ../../library/gettext.rst:61 -msgid "" "Change or query the current global domain. If *domain* is ``None``, then " "the current global domain is returned, otherwise the global domain is set to " "*domain*, which is returned." msgstr "" -#: ../../library/gettext.rst:69 +#: ../../library/gettext.rst:59 msgid "" "Return the localized translation of *message*, based on the current global " "domain, language, and locale directory. This function is usually aliased " "as :func:`_` in the local namespace (see examples below)." msgstr "" -#: ../../library/gettext.rst:76 +#: ../../library/gettext.rst:66 msgid "" "Like :func:`.gettext`, but look the message up in the specified *domain*." msgstr "" -#: ../../library/gettext.rst:81 +#: ../../library/gettext.rst:71 msgid "" "Like :func:`.gettext`, but consider plural forms. If a translation is found, " "apply the plural formula to *n*, and return the resulting message (some " @@ -108,7 +100,7 @@ msgid "" "return *singular* if *n* is 1; return *plural* otherwise." msgstr "" -#: ../../library/gettext.rst:86 +#: ../../library/gettext.rst:76 msgid "" "The Plural formula is taken from the catalog header. It is a C or Python " "expression that has a free variable *n*; the expression evaluates to the " @@ -118,52 +110,33 @@ msgid "" "variety of languages." msgstr "" -#: ../../library/gettext.rst:96 +#: ../../library/gettext.rst:86 msgid "" "Like :func:`ngettext`, but look the message up in the specified *domain*." msgstr "" -#: ../../library/gettext.rst:104 +#: ../../library/gettext.rst:94 msgid "" "Similar to the corresponding functions without the ``p`` in the prefix (that " "is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`), " "but the translation is restricted to the given message *context*." msgstr "" -#: ../../library/gettext.rst:116 -msgid "" -"Equivalent to the corresponding functions without the ``l`` prefix (:func:`." -"gettext`, :func:`dgettext`, :func:`ngettext` and :func:`dngettext`), but the " -"translation is returned as a byte string encoded in the preferred system " -"encoding if no other encoding was explicitly set with :func:" -"`bind_textdomain_codeset`." -msgstr "" - -#: ../../library/gettext.rst:124 -msgid "" -"These functions should be avoided in Python 3, because they return encoded " -"bytes. It's much better to use alternatives which return Unicode strings " -"instead, since most Python applications will want to manipulate human " -"readable text as strings instead of bytes. Further, it's possible that you " -"may get unexpected Unicode-related exceptions if there are encoding problems " -"with the translated strings." -msgstr "" - -#: ../../library/gettext.rst:134 +#: ../../library/gettext.rst:101 msgid "" "Note that GNU :program:`gettext` also defines a :func:`dcgettext` method, " "but this was deemed not useful and so it is currently unimplemented." msgstr "" -#: ../../library/gettext.rst:137 +#: ../../library/gettext.rst:104 msgid "Here's an example of typical usage for this API::" msgstr "" -#: ../../library/gettext.rst:148 +#: ../../library/gettext.rst:115 msgid "Class-based API" msgstr "" -#: ../../library/gettext.rst:150 +#: ../../library/gettext.rst:117 msgid "" "The class-based API of the :mod:`gettext` module gives you more flexibility " "and greater convenience than the GNU :program:`gettext` API. It is the " @@ -174,7 +147,7 @@ msgid "" "namespace as the function :func:`_`." msgstr "" -#: ../../library/gettext.rst:160 +#: ../../library/gettext.rst:127 msgid "" "This function implements the standard :file:`.mo` file search algorithm. It " "takes a *domain*, identical to what :func:`textdomain` takes. Optional " @@ -182,7 +155,7 @@ msgid "" "of strings, where each string is a language code." msgstr "" -#: ../../library/gettext.rst:165 +#: ../../library/gettext.rst:132 msgid "" "If *localedir* is not given, then the default system locale directory is " "used. [#]_ If *languages* is not given, then the following environment " @@ -193,17 +166,17 @@ msgid "" "colon to produce the expected list of language code strings." msgstr "" -#: ../../library/gettext.rst:173 +#: ../../library/gettext.rst:140 msgid "" ":func:`find` then expands and normalizes the languages, and then iterates " "through them, searching for an existing file built of these components:" msgstr "" -#: ../../library/gettext.rst:176 +#: ../../library/gettext.rst:143 msgid ":file:`{localedir}/{language}/LC_MESSAGES/{domain}.mo`" msgstr ":file:`{localedir}/{language}/LC_MESSAGES/{domain}.mo`" -#: ../../library/gettext.rst:178 +#: ../../library/gettext.rst:145 msgid "" "The first such file name that exists is returned by :func:`find`. If no such " "file is found, then ``None`` is returned. If *all* is given, it returns a " @@ -211,7 +184,7 @@ msgid "" "list or the environment variables." msgstr "" -#: ../../library/gettext.rst:186 +#: ../../library/gettext.rst:153 msgid "" "Return a :class:`*Translations` instance based on the *domain*, *localedir*, " "and *languages*, which are first passed to :func:`find` to get a list of the " @@ -223,7 +196,7 @@ msgid "" "`~NullTranslations.lgettext` and :meth:`~NullTranslations.lngettext` methods." msgstr "" -#: ../../library/gettext.rst:196 +#: ../../library/gettext.rst:163 msgid "" "If multiple files are found, later files are used as fallbacks for earlier " "ones. To allow setting the fallback, :func:`copy.copy` is used to clone each " @@ -231,53 +204,57 @@ msgid "" "with the cache." msgstr "" -#: ../../library/gettext.rst:201 +#: ../../library/gettext.rst:168 msgid "" "If no :file:`.mo` file is found, this function raises :exc:`OSError` if " "*fallback* is false (which is the default), and returns a :class:" "`NullTranslations` instance if *fallback* is true." msgstr "" -#: ../../library/gettext.rst:205 +#: ../../library/gettext.rst:172 msgid ":exc:`IOError` used to be raised instead of :exc:`OSError`." msgstr "" -#: ../../library/gettext.rst:209 ../../library/gettext.rst:232 -msgid "The *codeset* parameter." -msgstr "*codeset* 參數。" +#: ../../library/gettext.rst:175 +msgid "*codeset* parameter is removed." +msgstr "*codeset* 參數被移除。" -#: ../../library/gettext.rst:214 +#: ../../library/gettext.rst:180 msgid "" "This installs the function :func:`_` in Python's builtins namespace, based " -"on *domain*, *localedir*, and *codeset* which are passed to the function :" -"func:`translation`." +"on *domain* and *localedir* which are passed to the function :func:" +"`translation`." msgstr "" -#: ../../library/gettext.rst:218 +#: ../../library/gettext.rst:183 msgid "" "For the *names* parameter, please see the description of the translation " "object's :meth:`~NullTranslations.install` method." msgstr "" -#: ../../library/gettext.rst:221 +#: ../../library/gettext.rst:186 msgid "" "As seen below, you usually mark the strings in your application that are " "candidates for translation, by wrapping them in a call to the :func:`_` " "function, like this::" msgstr "" -#: ../../library/gettext.rst:227 +#: ../../library/gettext.rst:192 msgid "" "For convenience, you want the :func:`_` function to be installed in Python's " "builtins namespace, so it is easily accessible in all modules of your " "application." msgstr "" -#: ../../library/gettext.rst:236 +#: ../../library/gettext.rst:196 +msgid "*names* is now a keyword-only parameter." +msgstr "" + +#: ../../library/gettext.rst:200 msgid "The :class:`NullTranslations` class" msgstr "" -#: ../../library/gettext.rst:238 +#: ../../library/gettext.rst:202 msgid "" "Translation classes are what actually implement the translation of original " "source file message strings to translated message strings. The base class " @@ -286,7 +263,7 @@ msgid "" "classes. Here are the methods of :class:`!NullTranslations`:" msgstr "" -#: ../../library/gettext.rst:247 +#: ../../library/gettext.rst:211 msgid "" "Takes an optional :term:`file object` *fp*, which is ignored by the base " "class. Initializes \"protected\" instance variables *_info* and *_charset* " @@ -295,7 +272,7 @@ msgid "" "not ``None``." msgstr "" -#: ../../library/gettext.rst:255 +#: ../../library/gettext.rst:219 msgid "" "No-op in the base class, this method takes file object *fp*, and reads the " "data from the file, initializing its message catalog. If you have an " @@ -303,79 +280,55 @@ msgid "" "parse your format." msgstr "" -#: ../../library/gettext.rst:263 +#: ../../library/gettext.rst:227 msgid "" "Add *fallback* as the fallback object for the current translation object. A " "translation object should consult the fallback if it cannot provide a " "translation for a given message." msgstr "" -#: ../../library/gettext.rst:270 +#: ../../library/gettext.rst:234 msgid "" "If a fallback has been set, forward :meth:`!gettext` to the fallback. " "Otherwise, return *message*. Overridden in derived classes." msgstr "" -#: ../../library/gettext.rst:276 +#: ../../library/gettext.rst:240 msgid "" "If a fallback has been set, forward :meth:`!ngettext` to the fallback. " "Otherwise, return *singular* if *n* is 1; return *plural* otherwise. " "Overridden in derived classes." msgstr "" -#: ../../library/gettext.rst:283 +#: ../../library/gettext.rst:247 msgid "" "If a fallback has been set, forward :meth:`pgettext` to the fallback. " "Otherwise, return the translated message. Overridden in derived classes." msgstr "" -#: ../../library/gettext.rst:291 +#: ../../library/gettext.rst:255 msgid "" "If a fallback has been set, forward :meth:`npgettext` to the fallback. " "Otherwise, return the translated message. Overridden in derived classes." msgstr "" -#: ../../library/gettext.rst:300 -msgid "" -"Equivalent to :meth:`.gettext` and :meth:`.ngettext`, but the translation is " -"returned as a byte string encoded in the preferred system encoding if no " -"encoding was explicitly set with :meth:`set_output_charset`. Overridden in " -"derived classes." -msgstr "" - -#: ../../library/gettext.rst:307 ../../library/gettext.rst:463 -msgid "" -"These methods should be avoided in Python 3. See the warning for the :func:" -"`lgettext` function." -msgstr "" - -#: ../../library/gettext.rst:315 +#: ../../library/gettext.rst:263 msgid "" "Return the \"protected\" :attr:`_info` variable, a dictionary containing the " "metadata found in the message catalog file." msgstr "" -#: ../../library/gettext.rst:321 +#: ../../library/gettext.rst:269 msgid "Return the encoding of the message catalog file." msgstr "" -#: ../../library/gettext.rst:326 -msgid "" -"Return the encoding used to return translated messages in :meth:`.lgettext` " -"and :meth:`.lngettext`." -msgstr "" - -#: ../../library/gettext.rst:334 -msgid "Change the encoding used to return translated messages." -msgstr "" - -#: ../../library/gettext.rst:341 +#: ../../library/gettext.rst:274 msgid "" "This method installs :meth:`.gettext` into the built-in namespace, binding " "it to ``_``." msgstr "" -#: ../../library/gettext.rst:344 +#: ../../library/gettext.rst:277 msgid "" "If the *names* parameter is given, it must be a sequence containing the " "names of functions you want to install in the builtins namespace in addition " @@ -383,7 +336,7 @@ msgid "" "``'pgettext'``, ``'npgettext'``, ``'lgettext'``, and ``'lngettext'``." msgstr "" -#: ../../library/gettext.rst:349 +#: ../../library/gettext.rst:282 msgid "" "Note that this is only one way, albeit the most convenient way, to make the :" "func:`_` function available to your application. Because it affects the " @@ -392,21 +345,21 @@ msgid "" "this code to make :func:`_` available to their module::" msgstr "" -#: ../../library/gettext.rst:359 +#: ../../library/gettext.rst:292 msgid "" "This puts :func:`_` only in the module's global namespace and so only " "affects calls within this module." msgstr "" -#: ../../library/gettext.rst:362 +#: ../../library/gettext.rst:295 msgid "Added ``'pgettext'`` and ``'npgettext'``." msgstr "新增 ``'pgettext'`` 與 ``'npgettext'``\\ 。" -#: ../../library/gettext.rst:367 +#: ../../library/gettext.rst:300 msgid "The :class:`GNUTranslations` class" msgstr "" -#: ../../library/gettext.rst:369 +#: ../../library/gettext.rst:302 msgid "" "The :mod:`gettext` module provides one additional class derived from :class:" "`NullTranslations`: :class:`GNUTranslations`. This class overrides :meth:" @@ -414,7 +367,7 @@ msgid "" "in both big-endian and little-endian format." msgstr "" -#: ../../library/gettext.rst:374 +#: ../../library/gettext.rst:307 msgid "" ":class:`GNUTranslations` parses optional metadata out of the translation " "catalog. It is convention with GNU :program:`gettext` to include metadata as " @@ -427,31 +380,31 @@ msgid "" "to Unicode using this encoding, else ASCII is assumed." msgstr "" -#: ../../library/gettext.rst:384 +#: ../../library/gettext.rst:317 msgid "" "Since message ids are read as Unicode strings too, all :meth:`*gettext` " "methods will assume message ids as Unicode strings, not byte strings." msgstr "" -#: ../../library/gettext.rst:387 +#: ../../library/gettext.rst:320 msgid "" "The entire set of key/value pairs are placed into a dictionary and set as " "the \"protected\" :attr:`_info` instance variable." msgstr "" -#: ../../library/gettext.rst:390 +#: ../../library/gettext.rst:323 msgid "" "If the :file:`.mo` file's magic number is invalid, the major version number " "is unexpected, or if other problems occur while reading the file, " "instantiating a :class:`GNUTranslations` class can raise :exc:`OSError`." msgstr "" -#: ../../library/gettext.rst:396 +#: ../../library/gettext.rst:329 msgid "" "The following methods are overridden from the base class implementation:" msgstr "" -#: ../../library/gettext.rst:400 +#: ../../library/gettext.rst:333 msgid "" "Look up the *message* id in the catalog and return the corresponding message " "string, as a Unicode string. If there is no entry in the catalog for the " @@ -460,14 +413,14 @@ msgid "" "*message* id is returned." msgstr "" -#: ../../library/gettext.rst:409 +#: ../../library/gettext.rst:342 msgid "" "Do a plural-forms lookup of a message id. *singular* is used as the message " "id for purposes of lookup in the catalog, while *n* is used to determine " "which plural form to use. The returned message string is a Unicode string." msgstr "" -#: ../../library/gettext.rst:413 +#: ../../library/gettext.rst:346 msgid "" "If the message id is not found in the catalog, and a fallback is specified, " "the request is forwarded to the fallback's :meth:`~NullTranslations." @@ -475,14 +428,14 @@ msgid "" "*plural* is returned in all other cases." msgstr "" -#: ../../library/gettext.rst:418 +#: ../../library/gettext.rst:351 msgid "Here is an example::" msgstr "" "以下是個範例:\n" "\n" "::" -#: ../../library/gettext.rst:430 +#: ../../library/gettext.rst:363 msgid "" "Look up the *context* and *message* id in the catalog and return the " "corresponding message string, as a Unicode string. If there is no entry in " @@ -491,14 +444,14 @@ msgid "" "Otherwise, the *message* id is returned." msgstr "" -#: ../../library/gettext.rst:441 +#: ../../library/gettext.rst:374 msgid "" "Do a plural-forms lookup of a message id. *singular* is used as the message " "id for purposes of lookup in the catalog, while *n* is used to determine " "which plural form to use." msgstr "" -#: ../../library/gettext.rst:445 +#: ../../library/gettext.rst:378 msgid "" "If the message id for *context* is not found in the catalog, and a fallback " "is specified, the request is forwarded to the fallback's :meth:`npgettext` " @@ -506,53 +459,45 @@ msgid "" "returned in all other cases." msgstr "" -#: ../../library/gettext.rst:456 -msgid "" -"Equivalent to :meth:`.gettext` and :meth:`.ngettext`, but the translation is " -"returned as a byte string encoded in the preferred system encoding if no " -"encoding was explicitly set with :meth:`~NullTranslations." -"set_output_charset`." -msgstr "" - -#: ../../library/gettext.rst:470 +#: ../../library/gettext.rst:387 msgid "Solaris message catalog support" msgstr "" -#: ../../library/gettext.rst:472 +#: ../../library/gettext.rst:389 msgid "" "The Solaris operating system defines its own binary :file:`.mo` file format, " "but since no documentation can be found on this format, it is not supported " "at this time." msgstr "" -#: ../../library/gettext.rst:478 +#: ../../library/gettext.rst:395 msgid "The Catalog constructor" msgstr "" -#: ../../library/gettext.rst:482 +#: ../../library/gettext.rst:399 msgid "" "GNOME uses a version of the :mod:`gettext` module by James Henstridge, but " "this version has a slightly different API. Its documented usage was::" msgstr "" -#: ../../library/gettext.rst:490 +#: ../../library/gettext.rst:407 msgid "" "For compatibility with this older module, the function :func:`Catalog` is an " "alias for the :func:`translation` function described above." msgstr "" -#: ../../library/gettext.rst:493 +#: ../../library/gettext.rst:410 msgid "" "One difference between this module and Henstridge's: his catalog objects " "supported access through a mapping API, but this appears to be unused and so " "is not currently supported." msgstr "" -#: ../../library/gettext.rst:499 +#: ../../library/gettext.rst:416 msgid "Internationalizing your programs and modules" msgstr "" -#: ../../library/gettext.rst:501 +#: ../../library/gettext.rst:418 msgid "" "Internationalization (I18N) refers to the operation by which a program is " "made aware of multiple languages. Localization (L10N) refers to the " @@ -561,26 +506,26 @@ msgid "" "Python programs, you need to take the following steps:" msgstr "" -#: ../../library/gettext.rst:507 +#: ../../library/gettext.rst:424 msgid "" "prepare your program or module by specially marking translatable strings" msgstr "" -#: ../../library/gettext.rst:509 +#: ../../library/gettext.rst:426 msgid "" "run a suite of tools over your marked files to generate raw messages catalogs" msgstr "" -#: ../../library/gettext.rst:511 +#: ../../library/gettext.rst:428 msgid "create language-specific translations of the message catalogs" msgstr "" -#: ../../library/gettext.rst:513 +#: ../../library/gettext.rst:430 msgid "" "use the :mod:`gettext` module so that message strings are properly translated" msgstr "" -#: ../../library/gettext.rst:515 +#: ../../library/gettext.rst:432 msgid "" "In order to prepare your code for I18N, you need to look at all the strings " "in your files. Any string that needs to be translated should be marked by " @@ -588,14 +533,14 @@ msgid "" "For example::" msgstr "" -#: ../../library/gettext.rst:524 +#: ../../library/gettext.rst:441 msgid "" "In this example, the string ``'writing a log message'`` is marked as a " "candidate for translation, while the strings ``'mylog.txt'`` and ``'w'`` are " "not." msgstr "" -#: ../../library/gettext.rst:527 +#: ../../library/gettext.rst:444 msgid "" "There are a few tools to extract the strings meant for translation. The " "original GNU :program:`gettext` only supported C or C++ source code but its " @@ -608,7 +553,7 @@ msgid "" "utils>`__." msgstr "" -#: ../../library/gettext.rst:537 +#: ../../library/gettext.rst:454 msgid "" "(Python also includes pure-Python versions of these programs, called :" "program:`pygettext.py` and :program:`msgfmt.py`; some Python distributions " @@ -621,7 +566,7 @@ msgid "" "GNU :program:`gettext` package to internationalize your Python applications.)" msgstr "" -#: ../../library/gettext.rst:549 +#: ../../library/gettext.rst:466 msgid "" ":program:`xgettext`, :program:`pygettext`, and similar tools generate :file:" "`.po` files that are message catalogs. They are structured human-readable " @@ -629,7 +574,7 @@ msgid "" "placeholder for the translated versions of these strings." msgstr "" -#: ../../library/gettext.rst:555 +#: ../../library/gettext.rst:472 msgid "" "Copies of these :file:`.po` files are then handed over to the individual " "human translators who write translations for every supported natural " @@ -640,25 +585,25 @@ msgid "" "processing at run-time." msgstr "" -#: ../../library/gettext.rst:564 +#: ../../library/gettext.rst:481 msgid "" "How you use the :mod:`gettext` module in your code depends on whether you " "are internationalizing a single module or your entire application. The next " "two sections will discuss each case." msgstr "" -#: ../../library/gettext.rst:570 +#: ../../library/gettext.rst:487 msgid "Localizing your module" msgstr "" -#: ../../library/gettext.rst:572 +#: ../../library/gettext.rst:489 msgid "" "If you are localizing your module, you must take care not to make global " "changes, e.g. to the built-in namespace. You should not use the GNU :program:" "`gettext` API but instead the class-based API." msgstr "" -#: ../../library/gettext.rst:576 +#: ../../library/gettext.rst:493 msgid "" "Let's say your module is called \"spam\" and the module's various natural " "language translation :file:`.mo` files reside in :file:`/usr/share/locale` " @@ -666,11 +611,11 @@ msgid "" "your module::" msgstr "" -#: ../../library/gettext.rst:587 +#: ../../library/gettext.rst:504 msgid "Localizing your application" msgstr "" -#: ../../library/gettext.rst:589 +#: ../../library/gettext.rst:506 msgid "" "If you are localizing your application, you can install the :func:`_` " "function globally into the built-in namespace, usually in the main driver " @@ -678,52 +623,52 @@ msgid "" "just use ``_('...')`` without having to explicitly install it in each file." msgstr "" -#: ../../library/gettext.rst:594 +#: ../../library/gettext.rst:511 msgid "" "In the simple case then, you need only add the following bit of code to the " "main driver file of your application::" msgstr "" -#: ../../library/gettext.rst:600 +#: ../../library/gettext.rst:517 msgid "" "If you need to set the locale directory, you can pass it into the :func:" "`install` function::" msgstr "" -#: ../../library/gettext.rst:608 +#: ../../library/gettext.rst:525 msgid "Changing languages on the fly" msgstr "" -#: ../../library/gettext.rst:610 +#: ../../library/gettext.rst:527 msgid "" "If your program needs to support many languages at the same time, you may " "want to create multiple translation instances and then switch between them " "explicitly, like so::" msgstr "" -#: ../../library/gettext.rst:631 +#: ../../library/gettext.rst:548 msgid "Deferred translations" msgstr "" -#: ../../library/gettext.rst:633 +#: ../../library/gettext.rst:550 msgid "" "In most coding situations, strings are translated where they are coded. " "Occasionally however, you need to mark strings for translation, but defer " "actual translation until later. A classic example is::" msgstr "" -#: ../../library/gettext.rst:646 +#: ../../library/gettext.rst:563 msgid "" "Here, you want to mark the strings in the ``animals`` list as being " "translatable, but you don't actually want to translate them until they are " "printed." msgstr "" -#: ../../library/gettext.rst:650 +#: ../../library/gettext.rst:567 msgid "Here is one way you can handle this situation::" msgstr "" -#: ../../library/gettext.rst:666 +#: ../../library/gettext.rst:583 msgid "" "This works because the dummy definition of :func:`_` simply returns the " "string unchanged. And this dummy definition will temporarily override any " @@ -732,18 +677,18 @@ msgid "" "in the local namespace." msgstr "" -#: ../../library/gettext.rst:672 +#: ../../library/gettext.rst:589 msgid "" "Note that the second use of :func:`_` will not identify \"a\" as being " "translatable to the :program:`gettext` program, because the parameter is not " "a string literal." msgstr "" -#: ../../library/gettext.rst:676 +#: ../../library/gettext.rst:593 msgid "Another way to handle this is with the following example::" msgstr "" -#: ../../library/gettext.rst:690 +#: ../../library/gettext.rst:607 msgid "" "In this case, you are marking translatable strings with the function :func:" "`N_`, which won't conflict with any definition of :func:`_`. However, you " @@ -755,54 +700,54 @@ msgid "" "`MarkThisStringForTranslation`." msgstr "" -#: ../../library/gettext.rst:701 +#: ../../library/gettext.rst:618 msgid "Acknowledgements" msgstr "致謝" -#: ../../library/gettext.rst:703 +#: ../../library/gettext.rst:620 msgid "" "The following people contributed code, feedback, design suggestions, " "previous implementations, and valuable experience to the creation of this " "module:" msgstr "" -#: ../../library/gettext.rst:706 +#: ../../library/gettext.rst:623 msgid "Peter Funk" msgstr "Peter Funk" -#: ../../library/gettext.rst:708 +#: ../../library/gettext.rst:625 msgid "James Henstridge" msgstr "James Henstridge" -#: ../../library/gettext.rst:710 +#: ../../library/gettext.rst:627 msgid "Juan David Ibáñez Palomar" msgstr "Juan David Ibáñez Palomar" -#: ../../library/gettext.rst:712 +#: ../../library/gettext.rst:629 msgid "Marc-André Lemburg" msgstr "Marc-André Lemburg" -#: ../../library/gettext.rst:714 +#: ../../library/gettext.rst:631 msgid "Martin von Löwis" msgstr "Martin von Löwis" -#: ../../library/gettext.rst:716 +#: ../../library/gettext.rst:633 msgid "François Pinard" msgstr "François Pinard" -#: ../../library/gettext.rst:718 +#: ../../library/gettext.rst:635 msgid "Barry Warsaw" msgstr "Barry Warsaw" -#: ../../library/gettext.rst:720 +#: ../../library/gettext.rst:637 msgid "Gustavo Niemeyer" msgstr "Gustavo Niemeyer" -#: ../../library/gettext.rst:723 +#: ../../library/gettext.rst:640 msgid "Footnotes" msgstr "註解" -#: ../../library/gettext.rst:724 +#: ../../library/gettext.rst:641 msgid "" "The default locale directory is system dependent; for example, on RedHat " "Linux it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/" @@ -813,6 +758,6 @@ msgid "" "your application." msgstr "" -#: ../../library/gettext.rst:732 +#: ../../library/gettext.rst:649 msgid "See the footnote for :func:`bindtextdomain` above." msgstr "請見上方 :func:`bindtextdomain` 之註解。" diff --git a/library/glob.po b/library/glob.po index a12ca8b94c..a5988be3d4 100644 --- a/library/glob.po +++ b/library/glob.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -54,7 +54,7 @@ msgstr "" msgid "The :mod:`pathlib` module offers high-level path objects." msgstr "" -#: ../../library/glob.rst:44 +#: ../../library/glob.rst:45 msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " @@ -66,7 +66,7 @@ msgid "" "path name for that file be included is unspecified." msgstr "" -#: ../../library/glob.rst:53 +#: ../../library/glob.rst:54 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " "specifying the root directory for searching. It has the same effect on :" @@ -74,13 +74,13 @@ msgid "" "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" -#: ../../library/glob.rst:59 +#: ../../library/glob.rst:60 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/glob.rst:65 +#: ../../library/glob.rst:66 msgid "" "If *recursive* is true, the pattern \"``**``\" will match any files and zero " "or more directories, subdirectories and symbolic links to directories. If " @@ -88,39 +88,49 @@ msgid "" "will not match." msgstr "" -#: ../../library/glob.rst:70 ../../library/glob.rst:89 +#: ../../library/glob.rst:71 +msgid "" +"If *include_hidden* is true, \"``**``\" pattern will match hidden " +"directories." +msgstr "" + +#: ../../library/glob.rst:73 ../../library/glob.rst:96 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." msgstr "" -#: ../../library/glob.rst:71 ../../library/glob.rst:90 +#: ../../library/glob.rst:74 ../../library/glob.rst:97 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." msgstr "" -#: ../../library/glob.rst:74 +#: ../../library/glob.rst:77 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "" -#: ../../library/glob.rst:77 ../../library/glob.rst:92 +#: ../../library/glob.rst:80 ../../library/glob.rst:99 msgid "Support for recursive globs using \"``**``\"." msgstr "" -#: ../../library/glob.rst:80 ../../library/glob.rst:95 +#: ../../library/glob.rst:83 ../../library/glob.rst:102 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "新增 *root_dir* 與 *dir_fd* 參數。" -#: ../../library/glob.rst:86 +#: ../../library/glob.rst:86 ../../library/glob.rst:105 +msgid "Added the *include_hidden* parameter." +msgstr "新增 *include_hidden* 參數。" + +#: ../../library/glob.rst:93 msgid "" "Return an :term:`iterator` which yields the same values as :func:`glob` " "without actually storing them all simultaneously." msgstr "" -#: ../../library/glob.rst:101 +#: ../../library/glob.rst:111 msgid "" "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " "if you want to match an arbitrary literal string that may have special " @@ -129,7 +139,7 @@ msgid "" "c:/Quo vadis[?].txt'``." msgstr "" -#: ../../library/glob.rst:110 +#: ../../library/glob.rst:120 msgid "" "For example, consider a directory containing the following files: :file:`1." "gif`, :file:`2.txt`, :file:`card.gif` and a subdirectory :file:`sub` which " @@ -138,17 +148,17 @@ msgid "" "preserved. ::" msgstr "" -#: ../../library/glob.rst:128 +#: ../../library/glob.rst:138 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " "default. For example, consider a directory containing :file:`card.gif` and :" "file:`.card.gif`::" msgstr "" -#: ../../library/glob.rst:140 +#: ../../library/glob.rst:150 msgid "Module :mod:`fnmatch`" msgstr ":mod:`fnmatch` 模組" -#: ../../library/glob.rst:141 +#: ../../library/glob.rst:151 msgid "Shell-style filename (not path) expansion" msgstr "" diff --git a/library/grp.po b/library/grp.po index b9fbb983e4..1a7cd5661f 100644 --- a/library/grp.po +++ b/library/grp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-13 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -28,74 +28,85 @@ msgid "" "all Unix versions." msgstr "" -#: ../../library/grp.rst:13 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/grp.rst:15 msgid "" "Group database entries are reported as a tuple-like object, whose attributes " "correspond to the members of the ``group`` structure (Attribute field below, " "see ````):" msgstr "" -#: ../../library/grp.rst:18 +#: ../../library/grp.rst:20 msgid "Index" msgstr "" -#: ../../library/grp.rst:18 +#: ../../library/grp.rst:20 msgid "Attribute" msgstr "屬性" -#: ../../library/grp.rst:18 +#: ../../library/grp.rst:20 msgid "Meaning" msgstr "" -#: ../../library/grp.rst:20 +#: ../../library/grp.rst:22 msgid "0" msgstr "0" -#: ../../library/grp.rst:20 +#: ../../library/grp.rst:22 msgid "gr_name" msgstr "gr_name" -#: ../../library/grp.rst:20 +#: ../../library/grp.rst:22 msgid "the name of the group" msgstr "" -#: ../../library/grp.rst:22 +#: ../../library/grp.rst:24 msgid "1" msgstr "1" -#: ../../library/grp.rst:22 +#: ../../library/grp.rst:24 msgid "gr_passwd" msgstr "gr_passwd" -#: ../../library/grp.rst:22 +#: ../../library/grp.rst:24 msgid "the (encrypted) group password; often empty" msgstr "" -#: ../../library/grp.rst:25 +#: ../../library/grp.rst:27 msgid "2" msgstr "2" -#: ../../library/grp.rst:25 +#: ../../library/grp.rst:27 msgid "gr_gid" msgstr "gr_gid" -#: ../../library/grp.rst:25 +#: ../../library/grp.rst:27 msgid "the numerical group ID" msgstr "" -#: ../../library/grp.rst:27 +#: ../../library/grp.rst:29 msgid "3" msgstr "3" -#: ../../library/grp.rst:27 +#: ../../library/grp.rst:29 msgid "gr_mem" msgstr "gr_mem" -#: ../../library/grp.rst:27 +#: ../../library/grp.rst:29 msgid "all the group member's user names" msgstr "" -#: ../../library/grp.rst:31 +#: ../../library/grp.rst:33 msgid "" "The gid is an integer, name and password are strings, and the member list is " "a list of strings. (Note that most users are not explicitly listed as " @@ -106,43 +117,43 @@ msgid "" "`getgrgid`.)" msgstr "" -#: ../../library/grp.rst:38 +#: ../../library/grp.rst:40 msgid "It defines the following items:" msgstr "" -#: ../../library/grp.rst:43 +#: ../../library/grp.rst:45 msgid "" "Return the group database entry for the given numeric group ID. :exc:" "`KeyError` is raised if the entry asked for cannot be found." msgstr "" -#: ../../library/grp.rst:46 +#: ../../library/grp.rst:48 msgid "" ":exc:`TypeError` is raised for non-integer arguments like floats or strings." msgstr "" -#: ../../library/grp.rst:51 +#: ../../library/grp.rst:53 msgid "" "Return the group database entry for the given group name. :exc:`KeyError` is " "raised if the entry asked for cannot be found." msgstr "" -#: ../../library/grp.rst:57 +#: ../../library/grp.rst:59 msgid "Return a list of all available group entries, in arbitrary order." msgstr "" -#: ../../library/grp.rst:63 +#: ../../library/grp.rst:65 msgid "Module :mod:`pwd`" msgstr ":mod:`pwd` 模組" -#: ../../library/grp.rst:63 +#: ../../library/grp.rst:65 msgid "An interface to the user database, similar to this." msgstr "" -#: ../../library/grp.rst:65 +#: ../../library/grp.rst:67 msgid "Module :mod:`spwd`" msgstr ":mod:`spwd` 模組" -#: ../../library/grp.rst:66 +#: ../../library/grp.rst:68 msgid "An interface to the shadow password database, similar to this." msgstr "" diff --git a/library/gzip.po b/library/gzip.po index ce6767912a..80d5a11fcd 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -259,89 +259,107 @@ msgstr "" msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " -"the :class:`GzipFile` constructor above." +"the :class:`GzipFile` constructor above. When *mtime* is set to ``0``, this " +"function is equivalent to :func:`zlib.compress` with *wbits* set to ``31``. " +"The zlib function is faster." msgstr "" -#: ../../library/gzip.rst:180 +#: ../../library/gzip.rst:182 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:185 +#: ../../library/gzip.rst:184 +msgid "" +"Speed is improved by compressing all data at once instead of in a streamed " +"fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." +"compress` for better speed." +msgstr "" + +#: ../../library/gzip.rst:191 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " -"uncompressed data." +"uncompressed data. This function is capable of decompressing multi-member " +"gzip data (multiple gzip blocks concatenated together). When the data is " +"certain to contain only one member the :func:`zlib.decompress` function with " +"*wbits* set to 31 is faster." +msgstr "" + +#: ../../library/gzip.rst:198 +msgid "" +"Speed is improved by decompressing members at once in memory instead of in a " +"streamed fashion." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:205 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:196 +#: ../../library/gzip.rst:207 msgid "Example of how to read a compressed file::" msgstr "" -#: ../../library/gzip.rst:202 +#: ../../library/gzip.rst:213 msgid "Example of how to create a compressed GZIP file::" msgstr "" -#: ../../library/gzip.rst:209 +#: ../../library/gzip.rst:220 msgid "Example of how to GZIP compress an existing file::" msgstr "" -#: ../../library/gzip.rst:217 +#: ../../library/gzip.rst:228 msgid "Example of how to GZIP compress a binary string::" msgstr "" -#: ../../library/gzip.rst:226 +#: ../../library/gzip.rst:237 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:226 +#: ../../library/gzip.rst:237 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:233 +#: ../../library/gzip.rst:244 msgid "Command Line Interface" msgstr "" -#: ../../library/gzip.rst:235 +#: ../../library/gzip.rst:246 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:238 +#: ../../library/gzip.rst:249 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:242 +#: ../../library/gzip.rst:253 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:246 +#: ../../library/gzip.rst:257 msgid "Command line options" msgstr "" -#: ../../library/gzip.rst:250 +#: ../../library/gzip.rst:261 msgid "If *file* is not specified, read from :attr:`sys.stdin`." msgstr "" -#: ../../library/gzip.rst:254 +#: ../../library/gzip.rst:265 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:258 +#: ../../library/gzip.rst:269 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:262 +#: ../../library/gzip.rst:273 msgid "Decompress the given file." msgstr "" -#: ../../library/gzip.rst:266 +#: ../../library/gzip.rst:277 msgid "Show the help message." msgstr "" diff --git a/library/hashlib.po b/library/hashlib.po index f08062f454..5e55aa9c76 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,15 +113,15 @@ msgstr "" #: ../../library/hashlib.rst:94 msgid "" -"For example, to obtain the digest of the byte string ``b'Nobody inspects the " -"spammish repetition'``::" +"For example, to obtain the digest of the byte string ``b\"Nobody inspects " +"the spammish repetition\"``::" msgstr "" -#: ../../library/hashlib.rst:108 +#: ../../library/hashlib.rst:106 msgid "More condensed:" msgstr "" -#: ../../library/hashlib.rst:115 +#: ../../library/hashlib.rst:113 msgid "" "Is a generic constructor that takes the string *name* of the desired " "algorithm as its first parameter. It also exists to allow access to the " @@ -130,15 +130,15 @@ msgid "" "and should be preferred." msgstr "" -#: ../../library/hashlib.rst:121 +#: ../../library/hashlib.rst:119 msgid "Using :func:`new` with an algorithm provided by OpenSSL:" msgstr "" -#: ../../library/hashlib.rst:128 +#: ../../library/hashlib.rst:126 msgid "Hashlib provides the following constant attributes:" msgstr "" -#: ../../library/hashlib.rst:132 +#: ../../library/hashlib.rst:130 msgid "" "A set containing the names of the hash algorithms guaranteed to be supported " "by this module on all platforms. Note that 'md5' is in this list despite " @@ -146,7 +146,7 @@ msgid "" "excludes it." msgstr "" -#: ../../library/hashlib.rst:141 +#: ../../library/hashlib.rst:139 msgid "" "A set containing the names of the hash algorithms that are available in the " "running Python interpreter. These names will be recognized when passed to :" @@ -155,80 +155,80 @@ msgid "" "(thanks to OpenSSL)." msgstr "" -#: ../../library/hashlib.rst:149 +#: ../../library/hashlib.rst:147 msgid "" "The following values are provided as constant attributes of the hash objects " "returned by the constructors:" msgstr "" -#: ../../library/hashlib.rst:155 +#: ../../library/hashlib.rst:153 msgid "The size of the resulting hash in bytes." msgstr "" -#: ../../library/hashlib.rst:159 +#: ../../library/hashlib.rst:157 msgid "The internal block size of the hash algorithm in bytes." msgstr "" -#: ../../library/hashlib.rst:161 +#: ../../library/hashlib.rst:159 msgid "A hash object has the following attributes:" msgstr "" -#: ../../library/hashlib.rst:165 +#: ../../library/hashlib.rst:163 msgid "" "The canonical name of this hash, always lowercase and always suitable as a " "parameter to :func:`new` to create another hash of this type." msgstr "" -#: ../../library/hashlib.rst:168 +#: ../../library/hashlib.rst:166 msgid "" "The name attribute has been present in CPython since its inception, but " "until Python 3.4 was not formally specified, so may not exist on some " "platforms." msgstr "" -#: ../../library/hashlib.rst:173 +#: ../../library/hashlib.rst:171 msgid "A hash object has the following methods:" msgstr "" -#: ../../library/hashlib.rst:178 +#: ../../library/hashlib.rst:176 msgid "" "Update the hash object with the :term:`bytes-like object`. Repeated calls " "are equivalent to a single call with the concatenation of all the arguments: " "``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" -#: ../../library/hashlib.rst:183 +#: ../../library/hashlib.rst:181 msgid "" "The Python GIL is released to allow other threads to run while hash updates " "on data larger than 2047 bytes is taking place when using hash algorithms " "supplied by OpenSSL." msgstr "" -#: ../../library/hashlib.rst:191 +#: ../../library/hashlib.rst:189 msgid "" "Return the digest of the data passed to the :meth:`update` method so far. " "This is a bytes object of size :attr:`digest_size` which may contain bytes " "in the whole range from 0 to 255." msgstr "" -#: ../../library/hashlib.rst:198 ../../library/hashlib.rst:226 +#: ../../library/hashlib.rst:196 ../../library/hashlib.rst:224 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " "exchange the value safely in email or other non-binary environments." msgstr "" -#: ../../library/hashlib.rst:205 +#: ../../library/hashlib.rst:203 msgid "" "Return a copy (\"clone\") of the hash object. This can be used to " "efficiently compute the digests of data sharing a common initial substring." msgstr "" -#: ../../library/hashlib.rst:210 +#: ../../library/hashlib.rst:208 msgid "SHAKE variable length digests" msgstr "" -#: ../../library/hashlib.rst:212 +#: ../../library/hashlib.rst:210 msgid "" "The :func:`shake_128` and :func:`shake_256` algorithms provide variable " "length digests with length_in_bits//2 up to 128 or 256 bits of security. As " @@ -236,18 +236,54 @@ msgid "" "by the SHAKE algorithm." msgstr "" -#: ../../library/hashlib.rst:219 +#: ../../library/hashlib.rst:217 msgid "" "Return the digest of the data passed to the :meth:`update` method so far. " "This is a bytes object of size *length* which may contain bytes in the whole " "range from 0 to 255." msgstr "" +#: ../../library/hashlib.rst:230 +msgid "File hashing" +msgstr "" + #: ../../library/hashlib.rst:232 +msgid "" +"The hashlib module provides a helper function for efficient hashing of a " +"file or file-like object." +msgstr "" + +#: ../../library/hashlib.rst:237 +msgid "" +"Return a digest object that has been updated with contents of file object." +msgstr "" + +#: ../../library/hashlib.rst:239 +msgid "" +"*fileobj* must be a file-like object opened for reading in binary mode. It " +"accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " +"instances, SocketIO objects from :meth:`socket.socket.makefile`, and " +"similar. The function may bypass Python's I/O and use the file descriptor " +"from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " +"an unknown state after this function returns or raises. It is up to the " +"caller to close *fileobj*." +msgstr "" + +#: ../../library/hashlib.rst:247 +msgid "" +"*digest* must either be a hash algorithm name as a *str*, a hash " +"constructor, or a callable that returns a hash object." +msgstr "" + +#: ../../library/hashlib.rst:250 +msgid "Example:" +msgstr "範例:" + +#: ../../library/hashlib.rst:273 msgid "Key derivation" msgstr "" -#: ../../library/hashlib.rst:234 +#: ../../library/hashlib.rst:275 msgid "" "Key derivation and key stretching algorithms are designed for secure " "password hashing. Naive algorithms such as ``sha1(password)`` are not " @@ -256,13 +292,13 @@ msgid "" "%28cryptography%29>`_." msgstr "" -#: ../../library/hashlib.rst:242 +#: ../../library/hashlib.rst:283 msgid "" "The function provides PKCS#5 password-based key derivation function 2. It " "uses HMAC as pseudorandom function." msgstr "" -#: ../../library/hashlib.rst:245 +#: ../../library/hashlib.rst:286 msgid "" "The string *hash_name* is the desired name of the hash digest algorithm for " "HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as " @@ -271,7 +307,7 @@ msgid "" "proper source, e.g. :func:`os.urandom`." msgstr "" -#: ../../library/hashlib.rst:251 +#: ../../library/hashlib.rst:292 msgid "" "The number of *iterations* should be chosen based on the hash algorithm and " "computing power. As of 2022, hundreds of thousands of iterations of SHA-256 " @@ -280,32 +316,32 @@ msgid "" "the `stackexchange pbkdf2 iterations question`_ explain in detail." msgstr "" -#: ../../library/hashlib.rst:257 +#: ../../library/hashlib.rst:298 msgid "" "*dklen* is the length of the derived key. If *dklen* is ``None`` then the " "digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512." msgstr "" -#: ../../library/hashlib.rst:270 +#: ../../library/hashlib.rst:311 msgid "" "A fast implementation of *pbkdf2_hmac* is available with OpenSSL. The " "Python implementation uses an inline version of :mod:`hmac`. It is about " "three times slower and doesn't release the GIL." msgstr "" -#: ../../library/hashlib.rst:276 +#: ../../library/hashlib.rst:317 msgid "" "Slow Python implementation of *pbkdf2_hmac* is deprecated. In the future the " "function will only be available when Python is compiled with OpenSSL." msgstr "" -#: ../../library/hashlib.rst:282 +#: ../../library/hashlib.rst:323 msgid "" "The function provides scrypt password-based key derivation function as " "defined in :rfc:`7914`." msgstr "" -#: ../../library/hashlib.rst:285 +#: ../../library/hashlib.rst:326 msgid "" "*password* and *salt* must be :term:`bytes-like objects `. Applications and libraries should limit *password* to a sensible " @@ -313,138 +349,138 @@ msgid "" "source, e.g. :func:`os.urandom`." msgstr "" -#: ../../library/hashlib.rst:290 +#: ../../library/hashlib.rst:331 msgid "" "*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization " "factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). " "*dklen* is the length of the derived key." msgstr "" -#: ../../library/hashlib.rst:298 +#: ../../library/hashlib.rst:339 msgid "BLAKE2" msgstr "BLAKE2" -#: ../../library/hashlib.rst:305 +#: ../../library/hashlib.rst:346 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "" -#: ../../library/hashlib.rst:308 +#: ../../library/hashlib.rst:349 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," msgstr "" -#: ../../library/hashlib.rst:311 +#: ../../library/hashlib.rst:352 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." msgstr "" -#: ../../library/hashlib.rst:314 +#: ../../library/hashlib.rst:355 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." msgstr "" -#: ../../library/hashlib.rst:317 +#: ../../library/hashlib.rst:358 msgid "" "Hash objects from this module follow the API of standard library's :mod:" "`hashlib` objects." msgstr "" -#: ../../library/hashlib.rst:322 +#: ../../library/hashlib.rst:363 msgid "Creating hash objects" msgstr "" -#: ../../library/hashlib.rst:324 +#: ../../library/hashlib.rst:365 msgid "New hash objects are created by calling constructor functions:" msgstr "" -#: ../../library/hashlib.rst:338 +#: ../../library/hashlib.rst:379 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" msgstr "" -#: ../../library/hashlib.rst:341 +#: ../../library/hashlib.rst:382 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." msgstr "" -#: ../../library/hashlib.rst:344 +#: ../../library/hashlib.rst:385 msgid "*digest_size*: size of output digest in bytes." msgstr "" -#: ../../library/hashlib.rst:346 +#: ../../library/hashlib.rst:387 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" -#: ../../library/hashlib.rst:349 +#: ../../library/hashlib.rst:390 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." msgstr "" -#: ../../library/hashlib.rst:352 +#: ../../library/hashlib.rst:393 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" -#: ../../library/hashlib.rst:355 +#: ../../library/hashlib.rst:396 msgid "The following table shows limits for general parameters (in bytes):" msgstr "" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:399 msgid "Hash" msgstr "" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:399 msgid "digest_size" msgstr "digest_size" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:399 msgid "len(key)" msgstr "len(key)" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:399 msgid "len(salt)" msgstr "len(salt)" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:399 msgid "len(person)" msgstr "len(person)" -#: ../../library/hashlib.rst:360 +#: ../../library/hashlib.rst:401 msgid "BLAKE2b" msgstr "BLAKE2b" -#: ../../library/hashlib.rst:360 +#: ../../library/hashlib.rst:401 msgid "64" msgstr "64" -#: ../../library/hashlib.rst:360 +#: ../../library/hashlib.rst:401 msgid "16" msgstr "16" -#: ../../library/hashlib.rst:361 +#: ../../library/hashlib.rst:402 msgid "BLAKE2s" msgstr "BLAKE2s" -#: ../../library/hashlib.rst:361 +#: ../../library/hashlib.rst:402 msgid "32" msgstr "32" -#: ../../library/hashlib.rst:361 +#: ../../library/hashlib.rst:402 msgid "8" msgstr "8" -#: ../../library/hashlib.rst:366 +#: ../../library/hashlib.rst:407 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -454,49 +490,49 @@ msgid "" "the case for *key*.)" msgstr "" -#: ../../library/hashlib.rst:373 +#: ../../library/hashlib.rst:414 msgid "These sizes are available as module `constants`_ described below." msgstr "" -#: ../../library/hashlib.rst:375 +#: ../../library/hashlib.rst:416 msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "" -#: ../../library/hashlib.rst:377 +#: ../../library/hashlib.rst:418 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "" -#: ../../library/hashlib.rst:379 +#: ../../library/hashlib.rst:420 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "" -#: ../../library/hashlib.rst:382 +#: ../../library/hashlib.rst:423 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." msgstr "" -#: ../../library/hashlib.rst:385 +#: ../../library/hashlib.rst:426 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." msgstr "" -#: ../../library/hashlib.rst:388 +#: ../../library/hashlib.rst:429 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "" -#: ../../library/hashlib.rst:390 +#: ../../library/hashlib.rst:431 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." msgstr "" -#: ../../library/hashlib.rst:393 +#: ../../library/hashlib.rst:434 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(`False` for sequential mode)." @@ -506,42 +542,42 @@ msgstr "" msgid "Explanation of tree mode parameters." msgstr "" -#: ../../library/hashlib.rst:399 +#: ../../library/hashlib.rst:440 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." msgstr "" -#: ../../library/hashlib.rst:405 +#: ../../library/hashlib.rst:446 msgid "Constants" msgstr "常數" -#: ../../library/hashlib.rst:410 +#: ../../library/hashlib.rst:451 msgid "Salt length (maximum length accepted by constructors)." msgstr "" -#: ../../library/hashlib.rst:416 +#: ../../library/hashlib.rst:457 msgid "" "Personalization string length (maximum length accepted by constructors)." msgstr "" -#: ../../library/hashlib.rst:422 +#: ../../library/hashlib.rst:463 msgid "Maximum key size." msgstr "" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:469 msgid "Maximum digest size that the hash function can output." msgstr "" -#: ../../library/hashlib.rst:432 +#: ../../library/hashlib.rst:473 msgid "Examples" msgstr "範例" -#: ../../library/hashlib.rst:435 +#: ../../library/hashlib.rst:476 msgid "Simple hashing" msgstr "" -#: ../../library/hashlib.rst:437 +#: ../../library/hashlib.rst:478 msgid "" "To calculate hash of some data, you should first construct a hash object by " "calling the appropriate constructor function (:func:`blake2b` or :func:" @@ -550,41 +586,41 @@ msgid "" "`digest` (or :meth:`hexdigest` for hex-encoded string)." msgstr "" -#: ../../library/hashlib.rst:450 +#: ../../library/hashlib.rst:491 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" msgstr "" -#: ../../library/hashlib.rst:457 +#: ../../library/hashlib.rst:498 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "" -#: ../../library/hashlib.rst:470 +#: ../../library/hashlib.rst:511 msgid "Using different digest sizes" msgstr "" -#: ../../library/hashlib.rst:472 +#: ../../library/hashlib.rst:513 msgid "" "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " "32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " "changing the size of output, we can tell BLAKE2b to produce 20-byte digests:" msgstr "" -#: ../../library/hashlib.rst:486 +#: ../../library/hashlib.rst:527 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " "produce different outputs even if the output length is the same:" msgstr "" -#: ../../library/hashlib.rst:502 +#: ../../library/hashlib.rst:543 msgid "Keyed hashing" msgstr "" -#: ../../library/hashlib.rst:504 +#: ../../library/hashlib.rst:545 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " "replacement for `Hash-based message authentication code `_)" msgstr "" -#: ../../library/hashlib.rst:588 +#: ../../library/hashlib.rst:629 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." msgstr "" -#: ../../library/hashlib.rst:593 +#: ../../library/hashlib.rst:634 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " "passwords. See `BLAKE2 FAQ `_ for more information." msgstr "" -#: ../../library/hashlib.rst:616 +#: ../../library/hashlib.rst:657 msgid "Personalization" msgstr "" -#: ../../library/hashlib.rst:618 +#: ../../library/hashlib.rst:659 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " "hash function:" msgstr "" -#: ../../library/hashlib.rst:622 +#: ../../library/hashlib.rst:663 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -682,41 +718,41 @@ msgid "" "hash function used in the protocol summarily stops this type of attack." msgstr "" -#: ../../library/hashlib.rst:629 +#: ../../library/hashlib.rst:670 msgid "" "(`The Skein Hash Function Family `_, p. 21)" msgstr "" -#: ../../library/hashlib.rst:633 +#: ../../library/hashlib.rst:674 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "" -#: ../../library/hashlib.rst:647 +#: ../../library/hashlib.rst:688 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "" -#: ../../library/hashlib.rst:661 +#: ../../library/hashlib.rst:702 msgid "Tree mode" msgstr "" -#: ../../library/hashlib.rst:663 +#: ../../library/hashlib.rst:704 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "" -#: ../../library/hashlib.rst:669 +#: ../../library/hashlib.rst:710 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "" -#: ../../library/hashlib.rst:699 +#: ../../library/hashlib.rst:740 msgid "Credits" msgstr "" -#: ../../library/hashlib.rst:701 +#: ../../library/hashlib.rst:742 msgid "" "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " "Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " @@ -724,79 +760,79 @@ msgid "" "*Raphael C.-W. Phan*." msgstr "" -#: ../../library/hashlib.rst:706 +#: ../../library/hashlib.rst:747 msgid "" "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " "Bernstein*." msgstr "" -#: ../../library/hashlib.rst:708 +#: ../../library/hashlib.rst:749 msgid "" "The stdlib implementation is based on pyblake2_ module. It was written by " "*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " "documentation was copied from pyblake2_ and written by *Dmitry Chestnykh*." msgstr "" -#: ../../library/hashlib.rst:712 +#: ../../library/hashlib.rst:753 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "" -#: ../../library/hashlib.rst:714 +#: ../../library/hashlib.rst:755 msgid "" "The following public domain dedication applies for both C hash function " "implementation, extension code, and this documentation:" msgstr "" -#: ../../library/hashlib.rst:717 +#: ../../library/hashlib.rst:758 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " "worldwide. This software is distributed without any warranty." msgstr "" -#: ../../library/hashlib.rst:721 +#: ../../library/hashlib.rst:762 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" "zero/1.0/." msgstr "" -#: ../../library/hashlib.rst:725 +#: ../../library/hashlib.rst:766 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " "Commons Public Domain Dedication 1.0 Universal:" msgstr "" -#: ../../library/hashlib.rst:729 +#: ../../library/hashlib.rst:770 msgid "*Alexandr Sokolovskiy*" msgstr "" -#: ../../library/hashlib.rst:744 +#: ../../library/hashlib.rst:785 msgid "Module :mod:`hmac`" msgstr ":mod:`hmac` 模組" -#: ../../library/hashlib.rst:744 +#: ../../library/hashlib.rst:785 msgid "A module to generate message authentication codes using hashes." msgstr "" -#: ../../library/hashlib.rst:747 +#: ../../library/hashlib.rst:788 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/hashlib.rst:747 +#: ../../library/hashlib.rst:788 msgid "Another way to encode binary hashes for non-binary environments." msgstr "" -#: ../../library/hashlib.rst:750 +#: ../../library/hashlib.rst:791 msgid "https://blake2.net" msgstr "https://blake2.net" -#: ../../library/hashlib.rst:750 +#: ../../library/hashlib.rst:791 msgid "Official BLAKE2 website." msgstr "BLAKE2 官方網站。" -#: ../../library/hashlib.rst:753 +#: ../../library/hashlib.rst:794 msgid "" "https://csrc.nist.gov/csrc/media/publications/fips/180/2/archive/2002-08-01/" "documents/fips180-2.pdf" @@ -804,11 +840,11 @@ msgstr "" "https://csrc.nist.gov/csrc/media/publications/fips/180/2/archive/2002-08-01/" "documents/fips180-2.pdf" -#: ../../library/hashlib.rst:753 +#: ../../library/hashlib.rst:794 msgid "The FIPS 180-2 publication on Secure Hash Algorithms." msgstr "" -#: ../../library/hashlib.rst:757 +#: ../../library/hashlib.rst:798 msgid "" "https://en.wikipedia.org/wiki/" "Cryptographic_hash_function#Cryptographic_hash_algorithms" @@ -816,25 +852,25 @@ msgstr "" "https://en.wikipedia.org/wiki/" "Cryptographic_hash_function#Cryptographic_hash_algorithms" -#: ../../library/hashlib.rst:756 +#: ../../library/hashlib.rst:797 msgid "" "Wikipedia article with information on which algorithms have known issues and " "what that means regarding their use." msgstr "" -#: ../../library/hashlib.rst:760 +#: ../../library/hashlib.rst:801 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "https://www.ietf.org/rfc/rfc8018.txt" -#: ../../library/hashlib.rst:760 +#: ../../library/hashlib.rst:801 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "" -#: ../../library/hashlib.rst:762 +#: ../../library/hashlib.rst:803 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" -#: ../../library/hashlib.rst:763 +#: ../../library/hashlib.rst:804 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "" diff --git a/library/http.client.po b/library/http.client.po index 01d7983a9a..54280f908f 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-04 00:24+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,11 +45,22 @@ msgid "" "(through the :mod:`ssl` module)." msgstr "" -#: ../../library/http.client.rst:31 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/http.client.rst:33 msgid "The module provides the following classes:" msgstr "" -#: ../../library/http.client.rst:37 +#: ../../library/http.client.rst:39 msgid "" "An :class:`HTTPConnection` instance represents one transaction with an HTTP " "server. It should be instantiated by passing it a host and optional port " @@ -63,27 +74,27 @@ msgid "" "parameter sets the buffer size in bytes for sending a file-like message body." msgstr "" -#: ../../library/http.client.rst:49 +#: ../../library/http.client.rst:51 msgid "" "For example, the following calls all create instances that connect to the " "server at the same host and port::" msgstr "" -#: ../../library/http.client.rst:57 +#: ../../library/http.client.rst:59 msgid "*source_address* was added." msgstr "新增 *source_address*\\ 。" -#: ../../library/http.client.rst:60 +#: ../../library/http.client.rst:62 msgid "" "The *strict* parameter was removed. HTTP 0.9-style \"Simple Responses\" are " "no longer supported." msgstr "" -#: ../../library/http.client.rst:64 +#: ../../library/http.client.rst:66 msgid "*blocksize* parameter was added." msgstr "新增 *blocksize* 參數。" -#: ../../library/http.client.rst:73 +#: ../../library/http.client.rst:75 msgid "" "A subclass of :class:`HTTPConnection` that uses SSL for communication with " "secure servers. Default port is ``443``. If *context* is specified, it " @@ -91,84 +102,84 @@ msgid "" "options." msgstr "" -#: ../../library/http.client.rst:78 +#: ../../library/http.client.rst:80 msgid "Please read :ref:`ssl-security` for more information on best practices." msgstr "" -#: ../../library/http.client.rst:80 +#: ../../library/http.client.rst:82 msgid "*source_address*, *context* and *check_hostname* were added." msgstr "新增 *source_address*\\ 、\\ *context* 與 *check_hostname*\\ 。" -#: ../../library/http.client.rst:83 +#: ../../library/http.client.rst:85 msgid "" "This class now supports HTTPS virtual hosts if possible (that is, if :data:" "`ssl.HAS_SNI` is true)." msgstr "" -#: ../../library/http.client.rst:87 +#: ../../library/http.client.rst:89 msgid "" "The *strict* parameter was removed. HTTP 0.9-style \"Simple Responses\" are " "no longer supported." msgstr "" -#: ../../library/http.client.rst:91 +#: ../../library/http.client.rst:93 msgid "" "This class now performs all the necessary certificate and hostname checks by " "default. To revert to the previous, unverified, behavior :func:`ssl." "_create_unverified_context` can be passed to the *context* parameter." msgstr "" -#: ../../library/http.client.rst:97 +#: ../../library/http.client.rst:99 msgid "" "This class now enables TLS 1.3 :attr:`ssl.SSLContext.post_handshake_auth` " "for the default *context* or when *cert_file* is passed with a custom " "*context*." msgstr "" -#: ../../library/http.client.rst:102 +#: ../../library/http.client.rst:104 msgid "" "This class now sends an ALPN extension with protocol indicator ``http/1.1`` " "when no *context* is given. Custom *context* should set ALPN protocols with :" "meth:`~ssl.SSLContext.set_alpn_protocol`." msgstr "" -#: ../../library/http.client.rst:109 +#: ../../library/http.client.rst:111 msgid "" "*key_file* and *cert_file* are deprecated in favor of *context*. Please use :" "meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." "create_default_context` select the system's trusted CA certificates for you." msgstr "" -#: ../../library/http.client.rst:114 +#: ../../library/http.client.rst:116 msgid "" "The *check_hostname* parameter is also deprecated; the :attr:`ssl.SSLContext." "check_hostname` attribute of *context* should be used instead." msgstr "" -#: ../../library/http.client.rst:121 +#: ../../library/http.client.rst:123 msgid "" "Class whose instances are returned upon successful connection. Not " "instantiated directly by user." msgstr "" -#: ../../library/http.client.rst:124 +#: ../../library/http.client.rst:126 msgid "" "The *strict* parameter was removed. HTTP 0.9 style \"Simple Responses\" are " "no longer supported." msgstr "" -#: ../../library/http.client.rst:128 +#: ../../library/http.client.rst:130 msgid "This module provides the following function:" msgstr "" -#: ../../library/http.client.rst:132 +#: ../../library/http.client.rst:134 msgid "" "Parse the headers from a file pointer *fp* representing a HTTP request/" "response. The file has to be a :class:`BufferedIOBase` reader (i.e. not " "text) and must provide a valid :rfc:`2822` style header." msgstr "" -#: ../../library/http.client.rst:136 +#: ../../library/http.client.rst:138 msgid "" "This function returns an instance of :class:`http.client.HTTPMessage` that " "holds the header fields, but no payload (the same as :attr:`HTTPResponse." @@ -176,7 +187,7 @@ msgid "" "returning, the file pointer *fp* is ready to read the HTTP body." msgstr "" -#: ../../library/http.client.rst:143 +#: ../../library/http.client.rst:145 msgid "" ":meth:`parse_headers` does not parse the start-line of a HTTP message; it " "only parses the ``Name: value`` lines. The file has to be ready to read " @@ -184,46 +195,46 @@ msgid "" "calling the function." msgstr "" -#: ../../library/http.client.rst:148 +#: ../../library/http.client.rst:150 msgid "The following exceptions are raised as appropriate:" msgstr "" -#: ../../library/http.client.rst:153 +#: ../../library/http.client.rst:155 msgid "" "The base class of the other exceptions in this module. It is a subclass of :" "exc:`Exception`." msgstr "" -#: ../../library/http.client.rst:159 ../../library/http.client.rst:170 -#: ../../library/http.client.rst:175 ../../library/http.client.rst:180 -#: ../../library/http.client.rst:185 ../../library/http.client.rst:190 +#: ../../library/http.client.rst:161 ../../library/http.client.rst:172 +#: ../../library/http.client.rst:177 ../../library/http.client.rst:182 +#: ../../library/http.client.rst:187 ../../library/http.client.rst:192 msgid "A subclass of :exc:`HTTPException`." msgstr "" -#: ../../library/http.client.rst:164 +#: ../../library/http.client.rst:166 msgid "" "A subclass of :exc:`HTTPException`, raised if a port is given and is either " "non-numeric or empty." msgstr "" -#: ../../library/http.client.rst:195 ../../library/http.client.rst:200 -#: ../../library/http.client.rst:205 +#: ../../library/http.client.rst:197 ../../library/http.client.rst:202 +#: ../../library/http.client.rst:207 msgid "A subclass of :exc:`ImproperConnectionState`." msgstr "" -#: ../../library/http.client.rst:210 +#: ../../library/http.client.rst:212 msgid "" "A subclass of :exc:`HTTPException`. Raised if a server responds with a HTTP " "status code that we don't understand." msgstr "" -#: ../../library/http.client.rst:216 +#: ../../library/http.client.rst:218 msgid "" "A subclass of :exc:`HTTPException`. Raised if an excessively long line is " "received in the HTTP protocol from the server." msgstr "" -#: ../../library/http.client.rst:222 +#: ../../library/http.client.rst:224 msgid "" "A subclass of :exc:`ConnectionResetError` and :exc:`BadStatusLine`. Raised " "by :meth:`HTTPConnection.getresponse` when the attempt to read the response " @@ -231,52 +242,52 @@ msgid "" "has closed the connection." msgstr "" -#: ../../library/http.client.rst:227 +#: ../../library/http.client.rst:229 msgid "Previously, :exc:`BadStatusLine`\\ ``('')`` was raised." msgstr "" -#: ../../library/http.client.rst:231 +#: ../../library/http.client.rst:233 msgid "The constants defined in this module are:" msgstr "" -#: ../../library/http.client.rst:235 +#: ../../library/http.client.rst:237 msgid "The default port for the HTTP protocol (always ``80``)." msgstr "" -#: ../../library/http.client.rst:239 +#: ../../library/http.client.rst:241 msgid "The default port for the HTTPS protocol (always ``443``)." msgstr "" -#: ../../library/http.client.rst:243 +#: ../../library/http.client.rst:245 msgid "This dictionary maps the HTTP 1.1 status codes to the W3C names." msgstr "" -#: ../../library/http.client.rst:245 +#: ../../library/http.client.rst:247 msgid "" "Example: ``http.client.responses[http.client.NOT_FOUND]`` is ``'Not Found'``." msgstr "" -#: ../../library/http.client.rst:247 +#: ../../library/http.client.rst:249 msgid "" "See :ref:`http-status-codes` for a list of HTTP status codes that are " "available in this module as constants." msgstr "" -#: ../../library/http.client.rst:254 +#: ../../library/http.client.rst:256 msgid "HTTPConnection Objects" msgstr "HTTPConnection 物件" -#: ../../library/http.client.rst:256 +#: ../../library/http.client.rst:258 msgid ":class:`HTTPConnection` instances have the following methods:" msgstr "" -#: ../../library/http.client.rst:262 +#: ../../library/http.client.rst:264 msgid "" "This will send a request to the server using the HTTP request method " "*method* and the selector *url*." msgstr "" -#: ../../library/http.client.rst:265 +#: ../../library/http.client.rst:267 msgid "" "If *body* is specified, the specified data is sent after the headers are " "finished. It may be a :class:`str`, a :term:`bytes-like object`, an open :" @@ -291,13 +302,13 @@ msgid "" "iterable is exhausted." msgstr "" -#: ../../library/http.client.rst:277 +#: ../../library/http.client.rst:279 msgid "" "The *headers* argument should be a mapping of extra HTTP headers to send " "with the request." msgstr "" -#: ../../library/http.client.rst:280 +#: ../../library/http.client.rst:282 msgid "" "If *headers* contains neither Content-Length nor Transfer-Encoding, but " "there is a request body, one of those header fields will be added " @@ -310,7 +321,7 @@ msgid "" "Length." msgstr "" -#: ../../library/http.client.rst:292 +#: ../../library/http.client.rst:294 msgid "" "The *encode_chunked* argument is only relevant if Transfer-Encoding is " "specified in *headers*. If *encode_chunked* is ``False``, the " @@ -318,7 +329,7 @@ msgid "" "code. If it is ``True``, the body will be chunk-encoded." msgstr "" -#: ../../library/http.client.rst:298 +#: ../../library/http.client.rst:300 msgid "" "Chunked transfer encoding has been added to the HTTP protocol version 1.1. " "Unless the HTTP server is known to handle HTTP 1.1, the caller must either " @@ -326,11 +337,11 @@ msgid "" "that is not also a file as the body representation." msgstr "" -#: ../../library/http.client.rst:304 +#: ../../library/http.client.rst:306 msgid "*body* can now be an iterable." msgstr "" -#: ../../library/http.client.rst:307 +#: ../../library/http.client.rst:309 msgid "" "If neither Content-Length nor Transfer-Encoding are set in *headers*, file " "and iterable *body* objects are now chunk-encoded. The *encode_chunked* " @@ -338,26 +349,26 @@ msgid "" "file objects." msgstr "" -#: ../../library/http.client.rst:316 +#: ../../library/http.client.rst:318 msgid "" "Should be called after a request is sent to get the response from the " "server. Returns an :class:`HTTPResponse` instance." msgstr "" -#: ../../library/http.client.rst:321 +#: ../../library/http.client.rst:323 msgid "" "Note that you must have read the whole response before you can send a new " "request to the server." msgstr "" -#: ../../library/http.client.rst:324 +#: ../../library/http.client.rst:326 msgid "" "If a :exc:`ConnectionError` or subclass is raised, the :class:" "`HTTPConnection` object will be ready to reconnect when a new request is " "sent." msgstr "" -#: ../../library/http.client.rst:332 +#: ../../library/http.client.rst:334 msgid "" "Set the debugging level. The default debug level is ``0``, meaning no " "debugging output is printed. Any value greater than ``0`` will cause all " @@ -365,26 +376,26 @@ msgid "" "is passed to any new :class:`HTTPResponse` objects that are created." msgstr "" -#: ../../library/http.client.rst:342 +#: ../../library/http.client.rst:344 msgid "" "Set the host and the port for HTTP Connect Tunnelling. This allows running " "the connection through a proxy server." msgstr "" -#: ../../library/http.client.rst:345 +#: ../../library/http.client.rst:347 msgid "" "The host and port arguments specify the endpoint of the tunneled connection " "(i.e. the address included in the CONNECT request, *not* the address of the " "proxy server)." msgstr "" -#: ../../library/http.client.rst:349 +#: ../../library/http.client.rst:351 msgid "" "The headers argument should be a mapping of extra HTTP headers to send with " "the CONNECT request." msgstr "" -#: ../../library/http.client.rst:352 +#: ../../library/http.client.rst:354 msgid "" "For example, to tunnel through a HTTPS proxy server running locally on port " "8080, we would pass the address of the proxy to the :class:`HTTPSConnection` " @@ -392,34 +403,34 @@ msgid "" "the :meth:`~HTTPConnection.set_tunnel` method::" msgstr "" -#: ../../library/http.client.rst:367 +#: ../../library/http.client.rst:369 msgid "" "Connect to the server specified when the object was created. By default, " "this is called automatically when making a request if the client does not " "already have a connection." msgstr "" -#: ../../library/http.client.rst:371 +#: ../../library/http.client.rst:384 msgid "" "Raises an :ref:`auditing event ` ``http.client.connect`` with " "arguments ``self``, ``host``, ``port``." msgstr "" -#: ../../library/http.client.rst:376 +#: ../../library/http.client.rst:378 msgid "Close the connection to the server." msgstr "" -#: ../../library/http.client.rst:381 +#: ../../library/http.client.rst:383 msgid "Buffer size in bytes for sending a file-like message body." msgstr "" -#: ../../library/http.client.rst:386 +#: ../../library/http.client.rst:388 msgid "" "As an alternative to using the :meth:`request` method described above, you " "can also send your request step by step, by using the four functions below." msgstr "" -#: ../../library/http.client.rst:393 +#: ../../library/http.client.rst:395 msgid "" "This should be the first call after the connection to the server has been " "made. It sends a line to the server consisting of the *method* string, the " @@ -429,7 +440,7 @@ msgid "" "with non-False values." msgstr "" -#: ../../library/http.client.rst:403 +#: ../../library/http.client.rst:405 msgid "" "Send an :rfc:`822`\\ -style header to the server. It sends a line to the " "server consisting of the header, a colon and a space, and the first " @@ -437,14 +448,14 @@ msgid "" "consisting of a tab and an argument." msgstr "" -#: ../../library/http.client.rst:411 +#: ../../library/http.client.rst:413 msgid "" "Send a blank line to the server, signalling the end of the headers. The " "optional *message_body* argument can be used to pass a message body " "associated with the request." msgstr "" -#: ../../library/http.client.rst:415 +#: ../../library/http.client.rst:417 msgid "" "If *encode_chunked* is ``True``, the result of each iteration of " "*message_body* will be chunk-encoded as specified in :rfc:`7230`, Section " @@ -457,7 +468,7 @@ msgid "" "the chunk-encoded data immediately after *message_body*." msgstr "" -#: ../../library/http.client.rst:426 +#: ../../library/http.client.rst:428 msgid "" "Due to the chunked encoding specification, empty chunks yielded by an " "iterator body will be ignored by the chunk-encoder. This is to avoid " @@ -465,50 +476,50 @@ msgid "" "malformed encoding." msgstr "" -#: ../../library/http.client.rst:431 +#: ../../library/http.client.rst:433 msgid "Chunked encoding support. The *encode_chunked* parameter was added." msgstr "" -#: ../../library/http.client.rst:438 +#: ../../library/http.client.rst:440 msgid "" "Send data to the server. This should be used directly only after the :meth:" "`endheaders` method has been called and before :meth:`getresponse` is called." msgstr "" -#: ../../library/http.client.rst:442 +#: ../../library/http.client.rst:455 msgid "" "Raises an :ref:`auditing event ` ``http.client.send`` with " "arguments ``self``, ``data``." msgstr "" -#: ../../library/http.client.rst:448 +#: ../../library/http.client.rst:450 msgid "HTTPResponse Objects" msgstr "HTTPResponse 物件" -#: ../../library/http.client.rst:450 +#: ../../library/http.client.rst:452 msgid "" "An :class:`HTTPResponse` instance wraps the HTTP response from the server. " "It provides access to the request headers and the entity body. The response " "is an iterable object and can be used in a with statement." msgstr "" -#: ../../library/http.client.rst:455 +#: ../../library/http.client.rst:457 msgid "" "The :class:`io.BufferedIOBase` interface is now implemented and all of its " "reader operations are supported." msgstr "" -#: ../../library/http.client.rst:462 +#: ../../library/http.client.rst:464 msgid "Reads and returns the response body, or up to the next *amt* bytes." msgstr "" -#: ../../library/http.client.rst:466 +#: ../../library/http.client.rst:468 msgid "" "Reads up to the next len(b) bytes of the response body into the buffer *b*. " "Returns the number of bytes read." msgstr "" -#: ../../library/http.client.rst:473 +#: ../../library/http.client.rst:475 msgid "" "Return the value of the header *name*, or *default* if there is no header " "matching *name*. If there is more than one header with the name *name*, " @@ -516,87 +527,87 @@ msgid "" "than a single string, its elements are similarly returned joined by commas." msgstr "" -#: ../../library/http.client.rst:480 +#: ../../library/http.client.rst:482 msgid "Return a list of (header, value) tuples." msgstr "" -#: ../../library/http.client.rst:484 +#: ../../library/http.client.rst:486 msgid "Return the ``fileno`` of the underlying socket." msgstr "" -#: ../../library/http.client.rst:488 +#: ../../library/http.client.rst:490 msgid "" "A :class:`http.client.HTTPMessage` instance containing the response " "headers. :class:`http.client.HTTPMessage` is a subclass of :class:`email." "message.Message`." msgstr "" -#: ../../library/http.client.rst:494 +#: ../../library/http.client.rst:496 msgid "" "HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1." msgstr "" -#: ../../library/http.client.rst:498 +#: ../../library/http.client.rst:500 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/http.client.rst:502 +#: ../../library/http.client.rst:504 msgid "" "Headers of the response in the form of an :class:`email.message." "EmailMessage` instance." msgstr "" -#: ../../library/http.client.rst:506 +#: ../../library/http.client.rst:508 msgid "Status code returned by server." msgstr "" -#: ../../library/http.client.rst:510 +#: ../../library/http.client.rst:512 msgid "Reason phrase returned by server." msgstr "" -#: ../../library/http.client.rst:514 +#: ../../library/http.client.rst:516 msgid "" "A debugging hook. If :attr:`debuglevel` is greater than zero, messages will " "be printed to stdout as the response is read and parsed." msgstr "" -#: ../../library/http.client.rst:519 +#: ../../library/http.client.rst:521 msgid "Is ``True`` if the stream is closed." msgstr "" -#: ../../library/http.client.rst:523 +#: ../../library/http.client.rst:525 msgid "Deprecated in favor of :attr:`~HTTPResponse.url`." msgstr "" -#: ../../library/http.client.rst:528 +#: ../../library/http.client.rst:530 msgid "Deprecated in favor of :attr:`~HTTPResponse.headers`." msgstr "" -#: ../../library/http.client.rst:533 +#: ../../library/http.client.rst:535 msgid "Deprecated in favor of :attr:`~HTTPResponse.status`." msgstr "" -#: ../../library/http.client.rst:537 +#: ../../library/http.client.rst:539 msgid "Examples" msgstr "範例" -#: ../../library/http.client.rst:539 +#: ../../library/http.client.rst:541 msgid "Here is an example session that uses the ``GET`` method::" msgstr "" -#: ../../library/http.client.rst:564 +#: ../../library/http.client.rst:566 msgid "" "Here is an example session that uses the ``HEAD`` method. Note that the " "``HEAD`` method never returns any data. ::" msgstr "" -#: ../../library/http.client.rst:579 +#: ../../library/http.client.rst:581 msgid "Here is an example session that uses the ``POST`` method::" msgstr "" -#: ../../library/http.client.rst:595 +#: ../../library/http.client.rst:597 msgid "" "Client side HTTP ``PUT`` requests are very similar to ``POST`` requests. The " "difference lies only on the server side where HTTP servers will allow " @@ -606,11 +617,11 @@ msgid "" "``PUT`` method::" msgstr "" -#: ../../library/http.client.rst:616 +#: ../../library/http.client.rst:618 msgid "HTTPMessage Objects" msgstr "HTTPMessage 物件" -#: ../../library/http.client.rst:618 +#: ../../library/http.client.rst:620 msgid "" "An :class:`http.client.HTTPMessage` instance holds the headers from an HTTP " "response. It is implemented using the :class:`email.message.Message` class." diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index 6dc166bf3a..2f88ea9ea1 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-09 00:22+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -652,31 +652,32 @@ msgstr "" #: ../../library/http.cookiejar.rst:498 msgid "" -"Return whether *domain* is on the blocklist for setting or receiving cookies." +"Return ``True`` if *domain* is on the blocklist for setting or receiving " +"cookies." msgstr "" -#: ../../library/http.cookiejar.rst:503 +#: ../../library/http.cookiejar.rst:504 msgid "Return :const:`None`, or the sequence of allowed domains (as a tuple)." msgstr "" -#: ../../library/http.cookiejar.rst:508 +#: ../../library/http.cookiejar.rst:509 msgid "Set the sequence of allowed domains, or :const:`None`." msgstr "" -#: ../../library/http.cookiejar.rst:513 +#: ../../library/http.cookiejar.rst:514 msgid "" -"Return whether *domain* is not on the allowlist for setting or receiving " +"Return ``True`` if *domain* is not on the allowlist for setting or receiving " "cookies." msgstr "" -#: ../../library/http.cookiejar.rst:516 +#: ../../library/http.cookiejar.rst:517 msgid "" ":class:`DefaultCookiePolicy` instances have the following attributes, which " "are all initialised from the constructor arguments of the same name, and " "which may all be assigned to." msgstr "" -#: ../../library/http.cookiejar.rst:523 +#: ../../library/http.cookiejar.rst:524 msgid "" "If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` " "cookies (ie. cookies received in a :mailheader:`Set-Cookie` header with a " @@ -687,22 +688,22 @@ msgid "" "by default." msgstr "" -#: ../../library/http.cookiejar.rst:531 +#: ../../library/http.cookiejar.rst:532 msgid "General strictness switches:" msgstr "" -#: ../../library/http.cookiejar.rst:535 +#: ../../library/http.cookiejar.rst:536 msgid "" "Don't allow sites to set two-component domains with country-code top-level " "domains like ``.co.uk``, ``.gov.uk``, ``.co.nz``.etc. This is far from " "perfect and isn't guaranteed to work!" msgstr "" -#: ../../library/http.cookiejar.rst:540 +#: ../../library/http.cookiejar.rst:541 msgid ":rfc:`2965` protocol strictness switches:" msgstr "" -#: ../../library/http.cookiejar.rst:544 +#: ../../library/http.cookiejar.rst:545 msgid "" "Follow :rfc:`2965` rules on unverifiable transactions (usually, an " "unverifiable transaction is one resulting from a redirect or a request for " @@ -710,46 +711,46 @@ msgid "" "blocked on the basis of verifiability" msgstr "" -#: ../../library/http.cookiejar.rst:550 +#: ../../library/http.cookiejar.rst:551 msgid "Netscape protocol strictness switches:" msgstr "" -#: ../../library/http.cookiejar.rst:554 +#: ../../library/http.cookiejar.rst:555 msgid "" "Apply :rfc:`2965` rules on unverifiable transactions even to Netscape " "cookies." msgstr "" -#: ../../library/http.cookiejar.rst:559 +#: ../../library/http.cookiejar.rst:560 msgid "" "Flags indicating how strict to be with domain-matching rules for Netscape " "cookies. See below for acceptable values." msgstr "" -#: ../../library/http.cookiejar.rst:565 +#: ../../library/http.cookiejar.rst:566 msgid "" "Ignore cookies in Set-Cookie: headers that have names starting with ``'$'``." msgstr "" -#: ../../library/http.cookiejar.rst:570 +#: ../../library/http.cookiejar.rst:571 msgid "Don't allow setting cookies whose path doesn't path-match request URI." msgstr "" -#: ../../library/http.cookiejar.rst:572 +#: ../../library/http.cookiejar.rst:573 msgid "" ":attr:`strict_ns_domain` is a collection of flags. Its value is constructed " "by or-ing together (for example, ``DomainStrictNoDots|" "DomainStrictNonDomain`` means both flags are set)." msgstr "" -#: ../../library/http.cookiejar.rst:579 +#: ../../library/http.cookiejar.rst:580 msgid "" "When setting cookies, the 'host prefix' must not contain a dot (eg. ``www." "foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " "contains a dot)." msgstr "" -#: ../../library/http.cookiejar.rst:586 +#: ../../library/http.cookiejar.rst:587 msgid "" "Cookies that did not explicitly specify a ``domain`` cookie-attribute can " "only be returned to a domain equal to the domain that set the cookie (eg. " @@ -757,31 +758,31 @@ msgid "" "no ``domain`` cookie-attribute)." msgstr "" -#: ../../library/http.cookiejar.rst:594 +#: ../../library/http.cookiejar.rst:595 msgid "When setting cookies, require a full :rfc:`2965` domain-match." msgstr "" -#: ../../library/http.cookiejar.rst:596 +#: ../../library/http.cookiejar.rst:597 msgid "" "The following attributes are provided for convenience, and are the most " "useful combinations of the above flags:" msgstr "" -#: ../../library/http.cookiejar.rst:602 +#: ../../library/http.cookiejar.rst:603 msgid "" "Equivalent to 0 (ie. all of the above Netscape domain strictness flags " "switched off)." msgstr "" -#: ../../library/http.cookiejar.rst:608 +#: ../../library/http.cookiejar.rst:609 msgid "Equivalent to ``DomainStrictNoDots|DomainStrictNonDomain``." msgstr "等價於 ``DomainStrictNoDots|DomainStrictNonDomain``\\ 。" -#: ../../library/http.cookiejar.rst:612 +#: ../../library/http.cookiejar.rst:613 msgid "Cookie Objects" msgstr "Cookie 物件" -#: ../../library/http.cookiejar.rst:614 +#: ../../library/http.cookiejar.rst:615 msgid "" ":class:`Cookie` instances have Python attributes roughly corresponding to " "the standard cookie-attributes specified in the various cookie standards. " @@ -792,14 +793,14 @@ msgid "" "(Netscape) cookies." msgstr "" -#: ../../library/http.cookiejar.rst:622 +#: ../../library/http.cookiejar.rst:623 msgid "" "Assignment to these attributes should not be necessary other than in rare " "circumstances in a :class:`CookiePolicy` method. The class does not enforce " "internal consistency, so you should know what you're doing if you do that." msgstr "" -#: ../../library/http.cookiejar.rst:629 +#: ../../library/http.cookiejar.rst:630 msgid "" "Integer or :const:`None`. Netscape cookies have :attr:`version` 0. :rfc:" "`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute of 1. " @@ -807,51 +808,51 @@ msgid "" "Netscape cookies, in which case :attr:`version` is 0." msgstr "" -#: ../../library/http.cookiejar.rst:637 +#: ../../library/http.cookiejar.rst:638 msgid "Cookie name (a string)." msgstr "" -#: ../../library/http.cookiejar.rst:642 +#: ../../library/http.cookiejar.rst:643 msgid "Cookie value (a string), or :const:`None`." msgstr "" -#: ../../library/http.cookiejar.rst:647 +#: ../../library/http.cookiejar.rst:648 msgid "" "String representing a port or a set of ports (eg. '80', or '80,8080'), or :" "const:`None`." msgstr "" -#: ../../library/http.cookiejar.rst:653 +#: ../../library/http.cookiejar.rst:654 msgid "Cookie path (a string, eg. ``'/acme/rocket_launchers'``)." msgstr "" -#: ../../library/http.cookiejar.rst:658 +#: ../../library/http.cookiejar.rst:659 msgid "``True`` if cookie should only be returned over a secure connection." msgstr "" -#: ../../library/http.cookiejar.rst:663 +#: ../../library/http.cookiejar.rst:664 msgid "" "Integer expiry date in seconds since epoch, or :const:`None`. See also the :" "meth:`is_expired` method." msgstr "" -#: ../../library/http.cookiejar.rst:669 +#: ../../library/http.cookiejar.rst:670 msgid "``True`` if this is a session cookie." msgstr "" -#: ../../library/http.cookiejar.rst:674 +#: ../../library/http.cookiejar.rst:675 msgid "" "String comment from the server explaining the function of this cookie, or :" "const:`None`." msgstr "" -#: ../../library/http.cookiejar.rst:680 +#: ../../library/http.cookiejar.rst:681 msgid "" "URL linking to a comment from the server explaining the function of this " "cookie, or :const:`None`." msgstr "" -#: ../../library/http.cookiejar.rst:686 +#: ../../library/http.cookiejar.rst:687 msgid "" "``True`` if this cookie was received as an :rfc:`2109` cookie (ie. the " "cookie arrived in a :mailheader:`Set-Cookie` header, and the value of the " @@ -860,70 +861,70 @@ msgid "" "cookies, in which case :attr:`version` is 0." msgstr "" -#: ../../library/http.cookiejar.rst:695 +#: ../../library/http.cookiejar.rst:696 msgid "" "``True`` if a port or set of ports was explicitly specified by the server " "(in the :mailheader:`Set-Cookie` / :mailheader:`Set-Cookie2` header)." msgstr "" -#: ../../library/http.cookiejar.rst:701 +#: ../../library/http.cookiejar.rst:702 msgid "``True`` if a domain was explicitly specified by the server." msgstr "" -#: ../../library/http.cookiejar.rst:706 +#: ../../library/http.cookiejar.rst:707 msgid "" "``True`` if the domain explicitly specified by the server began with a dot " "(``'.'``)." msgstr "" -#: ../../library/http.cookiejar.rst:709 +#: ../../library/http.cookiejar.rst:710 msgid "" "Cookies may have additional non-standard cookie-attributes. These may be " "accessed using the following methods:" msgstr "" -#: ../../library/http.cookiejar.rst:715 +#: ../../library/http.cookiejar.rst:716 msgid "Return ``True`` if cookie has the named cookie-attribute." msgstr "" -#: ../../library/http.cookiejar.rst:720 +#: ../../library/http.cookiejar.rst:721 msgid "" "If cookie has the named cookie-attribute, return its value. Otherwise, " "return *default*." msgstr "" -#: ../../library/http.cookiejar.rst:726 +#: ../../library/http.cookiejar.rst:727 msgid "Set the value of the named cookie-attribute." msgstr "" -#: ../../library/http.cookiejar.rst:728 +#: ../../library/http.cookiejar.rst:729 msgid "The :class:`Cookie` class also defines the following method:" msgstr "" -#: ../../library/http.cookiejar.rst:733 +#: ../../library/http.cookiejar.rst:734 msgid "" "``True`` if cookie has passed the time at which the server requested it " "should expire. If *now* is given (in seconds since the epoch), return " "whether the cookie has expired at the specified time." msgstr "" -#: ../../library/http.cookiejar.rst:739 +#: ../../library/http.cookiejar.rst:740 msgid "Examples" msgstr "範例" -#: ../../library/http.cookiejar.rst:741 +#: ../../library/http.cookiejar.rst:742 msgid "" "The first example shows the most common usage of :mod:`http.cookiejar`::" msgstr "" -#: ../../library/http.cookiejar.rst:748 +#: ../../library/http.cookiejar.rst:749 msgid "" "This example illustrates how to open a URL using your Netscape, Mozilla, or " "Lynx cookies (assumes Unix/Netscape convention for location of the cookies " "file)::" msgstr "" -#: ../../library/http.cookiejar.rst:757 +#: ../../library/http.cookiejar.rst:758 msgid "" "The next example illustrates the use of :class:`DefaultCookiePolicy`. Turn " "on :rfc:`2965` cookies, be more strict about domains when setting and " diff --git a/library/http.po b/library/http.po index 7e868ba997..91587e064d 100644 --- a/library/http.po +++ b/library/http.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" -"PO-Revision-Date: 2022-06-11 15:26+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.1\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/http.rst:2 msgid ":mod:`http` --- HTTP modules" @@ -60,13 +60,11 @@ msgstr "" msgid ":mod:`http.cookiejar` provides persistence of cookies" msgstr ":mod:`http.cookiejar` 提供了 cookies 的持續留存 (persistence)" -#: ../../library/http.rst:24 +#: ../../library/http.rst:25 msgid "" -":mod:`http` is also a module that defines a number of HTTP status codes and " -"associated messages through the :class:`http.HTTPStatus` enum:" +"The :mod:`http` module also defines the following enums that help you work " +"with http related code:" msgstr "" -":mod:`http` 也是一個透過 :class:`http.HTTPStatus` 枚舉 (enum) 定義一些 HTTP " -"狀態碼及其相關訊息的模組:" #: ../../library/http.rst:31 msgid "" @@ -76,7 +74,7 @@ msgstr "" ":class:`enum.IntEnum` 的子類別,它定義了一組 HTTP 狀態碼、原理短語 (reason " "phrase) 以及英文長描述。" -#: ../../library/http.rst:34 +#: ../../library/http.rst:34 ../../library/http.rst:146 msgid "Usage::" msgstr "" "用法:\n" @@ -89,22 +87,22 @@ msgstr "HTTP 狀態碼" #: ../../library/http.rst:55 msgid "" -"Supported, `IANA-registered `_ status codes available in :class:`http." +"Supported, `IANA-registered status codes `_ available in :class:`http." "HTTPStatus` are:" msgstr "" -":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊 `_\\ 的狀態碼有:" +":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" #: ../../library/http.rst:60 msgid "Code" msgstr "狀態碼" -#: ../../library/http.rst:60 +#: ../../library/http.rst:60 ../../library/http.rst:170 msgid "Enum Name" msgstr "枚舉名稱" -#: ../../library/http.rst:60 +#: ../../library/http.rst:60 ../../library/http.rst:170 msgid "Details" msgstr "詳情" @@ -873,3 +871,104 @@ msgid "" "codes." msgstr "" "新增 ``103 EARLY_HINTS``、``418 IM_A_TEAPOT`` 與 ``425 TOO_EARLY`` 狀態碼。" + +#: ../../library/http.rst:144 +msgid "" +"A subclass of :class:`enum.StrEnum` that defines a set of HTTP methods and " +"descriptions written in English." +msgstr ":class:`enum.StrEnum` 的子類別,它定義了一組 HTTP 方法以及英文描述。" + +#: ../../library/http.rst:163 +msgid "HTTP methods" +msgstr "HTTP 方法" + +#: ../../library/http.rst:165 +msgid "" +"Supported, `IANA-registered methods `_ available in :class:`http.HTTPMethod` are:" +msgstr "" +":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" + +#: ../../library/http.rst:170 +msgid "Method" +msgstr "方法" + +#: ../../library/http.rst:172 +msgid "``GET``" +msgstr "``GET``" + +#: ../../library/http.rst:172 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.1" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.1 節" + +#: ../../library/http.rst:173 +msgid "``HEAD``" +msgstr "``HEAD``" + +#: ../../library/http.rst:173 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.2" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.2 節" + +#: ../../library/http.rst:174 +msgid "``POST``" +msgstr "``POST``" + +#: ../../library/http.rst:174 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.3" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.3 節" + +#: ../../library/http.rst:175 +msgid "``PUT``" +msgstr "``PUT``" + +#: ../../library/http.rst:175 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.4" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.4 節" + +#: ../../library/http.rst:176 +msgid "``DELETE``" +msgstr "``DELETE``" + +#: ../../library/http.rst:176 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.5" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" + +#: ../../library/http.rst:177 +msgid "``CONNECT``" +msgstr "``CONNECT``" + +#: ../../library/http.rst:177 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.6" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.6 節" + +#: ../../library/http.rst:178 +msgid "``OPTIONS``" +msgstr "``OPTIONS``" + +#: ../../library/http.rst:178 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.7" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" + +#: ../../library/http.rst:179 +msgid "``TRACE``" +msgstr "``TRACE``" + +#: ../../library/http.rst:179 +msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.8" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.8 節" + +#: ../../library/http.rst:180 +msgid "``PATCH``" +msgstr "``PATCH``" + +#: ../../library/http.rst:180 +msgid "HTTP/1.1 :rfc:`5789`" +msgstr "HTTP/1.1 :rfc:`5789`" + +#~ msgid "" +#~ ":mod:`http` is also a module that defines a number of HTTP status codes " +#~ "and associated messages through the :class:`http.HTTPStatus` enum:" +#~ msgstr "" +#~ ":mod:`http` 也是一個透過 :class:`http.HTTPStatus` 枚舉 (enum) 定義一些 " +#~ "HTTP 狀態碼及其相關訊息的模組:" diff --git a/library/http.server.po b/library/http.server.po index 4032212e59..cf44f1d9bf 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-09 00:22+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,14 +36,25 @@ msgid "" "ref:`basic security checks `." msgstr "" -#: ../../library/http.server.rst:25 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/http.server.rst:27 msgid "" "One class, :class:`HTTPServer`, is a :class:`socketserver.TCPServer` " "subclass. It creates and listens at the HTTP socket, dispatching the " "requests to a handler. Code to create and run the server looks like this::" msgstr "" -#: ../../library/http.server.rst:37 +#: ../../library/http.server.rst:39 msgid "" "This class builds on the :class:`~socketserver.TCPServer` class by storing " "the server address as instance variables named :attr:`server_name` and :attr:" @@ -51,7 +62,7 @@ msgid "" "the handler's :attr:`server` instance variable." msgstr "" -#: ../../library/http.server.rst:44 +#: ../../library/http.server.rst:46 msgid "" "This class is identical to HTTPServer but uses threads to handle requests by " "using the :class:`~socketserver.ThreadingMixIn`. This is useful to handle " @@ -59,14 +70,14 @@ msgid "" "indefinitely." msgstr "" -#: ../../library/http.server.rst:52 +#: ../../library/http.server.rst:54 msgid "" "The :class:`HTTPServer` and :class:`ThreadingHTTPServer` must be given a " "*RequestHandlerClass* on instantiation, of which this module provides three " "different variants:" msgstr "" -#: ../../library/http.server.rst:58 +#: ../../library/http.server.rst:60 msgid "" "This class is used to handle the HTTP requests that arrive at the server. " "By itself, it cannot respond to any actual HTTP requests; it must be " @@ -75,7 +86,7 @@ msgid "" "and methods for use by subclasses." msgstr "" -#: ../../library/http.server.rst:64 +#: ../../library/http.server.rst:66 msgid "" "The handler will parse the request and the headers, then call a method " "specific to the request type. The method name is constructed from the " @@ -85,28 +96,28 @@ msgid "" "override or extend the :meth:`__init__` method." msgstr "" -#: ../../library/http.server.rst:71 +#: ../../library/http.server.rst:73 msgid ":class:`BaseHTTPRequestHandler` has the following instance variables:" msgstr "" -#: ../../library/http.server.rst:75 +#: ../../library/http.server.rst:77 msgid "" "Contains a tuple of the form ``(host, port)`` referring to the client's " "address." msgstr "" -#: ../../library/http.server.rst:80 +#: ../../library/http.server.rst:82 msgid "Contains the server instance." msgstr "" -#: ../../library/http.server.rst:84 +#: ../../library/http.server.rst:86 msgid "" "Boolean that should be set before :meth:`handle_one_request` returns, " "indicating if another request may be expected, or if the connection should " "be shut down." msgstr "" -#: ../../library/http.server.rst:90 +#: ../../library/http.server.rst:92 msgid "" "Contains the string representation of the HTTP request line. The terminating " "CRLF is stripped. This attribute should be set by :meth:" @@ -114,23 +125,23 @@ msgid "" "set to the empty string." msgstr "" -#: ../../library/http.server.rst:97 +#: ../../library/http.server.rst:99 msgid "Contains the command (request type). For example, ``'GET'``." msgstr "" -#: ../../library/http.server.rst:101 +#: ../../library/http.server.rst:103 msgid "" "Contains the request path. If query component of the URL is present, then " "``path`` includes the query. Using the terminology of :rfc:`3986`, ``path`` " "here includes ``hier-part`` and the ``query``." msgstr "" -#: ../../library/http.server.rst:107 +#: ../../library/http.server.rst:109 msgid "" "Contains the version string from the request. For example, ``'HTTP/1.0'``." msgstr "" -#: ../../library/http.server.rst:111 +#: ../../library/http.server.rst:113 msgid "" "Holds an instance of the class specified by the :attr:`MessageClass` class " "variable. This instance parses and manages the headers in the HTTP request. " @@ -139,42 +150,42 @@ msgid "" "valid :rfc:`2822` style header." msgstr "" -#: ../../library/http.server.rst:119 +#: ../../library/http.server.rst:121 msgid "" "An :class:`io.BufferedIOBase` input stream, ready to read from the start of " "the optional input data." msgstr "" -#: ../../library/http.server.rst:124 +#: ../../library/http.server.rst:126 msgid "" "Contains the output stream for writing a response back to the client. Proper " "adherence to the HTTP protocol must be used when writing to this stream in " "order to achieve successful interoperation with HTTP clients." msgstr "" -#: ../../library/http.server.rst:129 +#: ../../library/http.server.rst:131 msgid "This is an :class:`io.BufferedIOBase` stream." msgstr "" -#: ../../library/http.server.rst:132 +#: ../../library/http.server.rst:134 msgid ":class:`BaseHTTPRequestHandler` has the following attributes:" msgstr ":class:`BaseHTTPRequestHandler` 擁有以下屬性:" -#: ../../library/http.server.rst:136 +#: ../../library/http.server.rst:138 msgid "" "Specifies the server software version. You may want to override this. The " "format is multiple whitespace-separated strings, where each string is of the " "form name[/version]. For example, ``'BaseHTTP/0.2'``." msgstr "" -#: ../../library/http.server.rst:142 +#: ../../library/http.server.rst:144 msgid "" "Contains the Python system version, in a form usable by the :attr:" "`version_string` method and the :attr:`server_version` class variable. For " "example, ``'Python/1.4'``." msgstr "" -#: ../../library/http.server.rst:148 +#: ../../library/http.server.rst:150 msgid "" "Specifies a format string that should be used by :meth:`send_error` method " "for building an error response to the client. The string is filled by " @@ -182,29 +193,31 @@ msgid "" "passed to :meth:`send_error`." msgstr "" -#: ../../library/http.server.rst:155 +#: ../../library/http.server.rst:157 msgid "" "Specifies the Content-Type HTTP header of error responses sent to the " "client. The default value is ``'text/html'``." msgstr "" -#: ../../library/http.server.rst:160 +#: ../../library/http.server.rst:162 msgid "" -"This specifies the HTTP protocol version used in responses. If set to " -"``'HTTP/1.1'``, the server will permit HTTP persistent connections; however, " -"your server *must* then include an accurate ``Content-Length`` header " -"(using :meth:`send_header`) in all of its responses to clients. For " -"backwards compatibility, the setting defaults to ``'HTTP/1.0'``." +"Specifies the HTTP version to which the server is conformant. It is sent in " +"responses to let the client know the server's communication capabilities for " +"future requests. If set to ``'HTTP/1.1'``, the server will permit HTTP " +"persistent connections; however, your server *must* then include an accurate " +"``Content-Length`` header (using :meth:`send_header`) in all of its " +"responses to clients. For backwards compatibility, the setting defaults to " +"``'HTTP/1.0'``." msgstr "" -#: ../../library/http.server.rst:168 +#: ../../library/http.server.rst:172 msgid "" "Specifies an :class:`email.message.Message`\\ -like class to parse HTTP " "headers. Typically, this is not overridden, and it defaults to :class:`http." "client.HTTPMessage`." msgstr "" -#: ../../library/http.server.rst:174 +#: ../../library/http.server.rst:178 msgid "" "This attribute contains a mapping of error code integers to two-element " "tuples containing a short and long message. For example, ``{code: " @@ -213,33 +226,33 @@ msgid "" "It is used by :meth:`send_response_only` and :meth:`send_error` methods." msgstr "" -#: ../../library/http.server.rst:180 +#: ../../library/http.server.rst:184 msgid "A :class:`BaseHTTPRequestHandler` instance has the following methods:" msgstr "" -#: ../../library/http.server.rst:184 +#: ../../library/http.server.rst:188 msgid "" "Calls :meth:`handle_one_request` once (or, if persistent connections are " "enabled, multiple times) to handle incoming HTTP requests. You should never " "need to override it; instead, implement appropriate :meth:`do_\\*` methods." msgstr "" -#: ../../library/http.server.rst:191 +#: ../../library/http.server.rst:195 msgid "" "This method will parse and dispatch the request to the appropriate :meth:`do_" "\\*` method. You should never need to override it." msgstr "" -#: ../../library/http.server.rst:196 +#: ../../library/http.server.rst:200 msgid "" -"When a HTTP/1.1 compliant server receives an ``Expect: 100-continue`` " +"When an HTTP/1.1 conformant server receives an ``Expect: 100-continue`` " "request header it responds back with a ``100 Continue`` followed by ``200 " "OK`` headers. This method can be overridden to raise an error if the server " "does not want the client to continue. For e.g. server can choose to send " "``417 Expectation Failed`` as a response header and ``return False``." msgstr "" -#: ../../library/http.server.rst:207 +#: ../../library/http.server.rst:211 msgid "" "Sends and logs a complete error reply to the client. The numeric *code* " "specifies the HTTP error code, with *message* as an optional, short, human " @@ -254,13 +267,13 @@ msgid "" "Reset Content``, ``304 Not Modified``." msgstr "" -#: ../../library/http.server.rst:219 +#: ../../library/http.server.rst:223 msgid "" "The error response includes a Content-Length header. Added the *explain* " "argument." msgstr "" -#: ../../library/http.server.rst:225 +#: ../../library/http.server.rst:229 msgid "" "Adds a response header to the headers buffer and logs the accepted request. " "The HTTP response line is written to the internal buffer, followed by " @@ -271,13 +284,13 @@ msgid "" "followed by an :meth:`end_headers` call." msgstr "" -#: ../../library/http.server.rst:234 +#: ../../library/http.server.rst:238 msgid "" "Headers are stored to an internal buffer and :meth:`end_headers` needs to be " "called explicitly." msgstr "" -#: ../../library/http.server.rst:240 +#: ../../library/http.server.rst:244 msgid "" "Adds the HTTP header to an internal buffer which will be written to the " "output stream when either :meth:`end_headers` or :meth:`flush_headers` is " @@ -286,11 +299,11 @@ msgid "" "`end_headers` MUST BE called in order to complete the operation." msgstr "" -#: ../../library/http.server.rst:246 +#: ../../library/http.server.rst:250 msgid "Headers are stored in an internal buffer." msgstr "" -#: ../../library/http.server.rst:251 +#: ../../library/http.server.rst:255 msgid "" "Sends the response header only, used for the purposes when ``100 Continue`` " "response is sent by the server to the client. The headers not buffered and " @@ -298,37 +311,37 @@ msgid "" "message corresponding the response *code* is sent." msgstr "" -#: ../../library/http.server.rst:260 +#: ../../library/http.server.rst:264 msgid "" "Adds a blank line (indicating the end of the HTTP headers in the response) " "to the headers buffer and calls :meth:`flush_headers()`." msgstr "" -#: ../../library/http.server.rst:264 +#: ../../library/http.server.rst:268 msgid "The buffered headers are written to the output stream." msgstr "" -#: ../../library/http.server.rst:269 +#: ../../library/http.server.rst:273 msgid "" "Finally send the headers to the output stream and flush the internal headers " "buffer." msgstr "" -#: ../../library/http.server.rst:276 +#: ../../library/http.server.rst:280 msgid "" "Logs an accepted (successful) request. *code* should specify the numeric " "HTTP code associated with the response. If a size of the response is " "available, then it should be passed as the *size* parameter." msgstr "" -#: ../../library/http.server.rst:282 +#: ../../library/http.server.rst:286 msgid "" "Logs an error when a request cannot be fulfilled. By default, it passes the " "message to :meth:`log_message`, so it takes the same arguments (*format* and " "additional values)." msgstr "" -#: ../../library/http.server.rst:289 +#: ../../library/http.server.rst:293 msgid "" "Logs an arbitrary message to ``sys.stderr``. This is typically overridden to " "create custom error logging mechanisms. The *format* argument is a standard " @@ -337,103 +350,103 @@ msgid "" "and current date and time are prefixed to every message logged." msgstr "" -#: ../../library/http.server.rst:297 +#: ../../library/http.server.rst:301 msgid "" "Returns the server software's version string. This is a combination of the :" "attr:`server_version` and :attr:`sys_version` attributes." msgstr "" -#: ../../library/http.server.rst:302 +#: ../../library/http.server.rst:306 msgid "" "Returns the date and time given by *timestamp* (which must be ``None`` or in " "the format returned by :func:`time.time`), formatted for a message header. " "If *timestamp* is omitted, it uses the current date and time." msgstr "" -#: ../../library/http.server.rst:306 +#: ../../library/http.server.rst:310 msgid "The result looks like ``'Sun, 06 Nov 1994 08:49:37 GMT'``." msgstr "" -#: ../../library/http.server.rst:310 +#: ../../library/http.server.rst:314 msgid "Returns the current date and time, formatted for logging." msgstr "" -#: ../../library/http.server.rst:314 +#: ../../library/http.server.rst:318 msgid "Returns the client address." msgstr "" -#: ../../library/http.server.rst:316 +#: ../../library/http.server.rst:320 msgid "" "Previously, a name lookup was performed. To avoid name resolution delays, it " "now always returns the IP address." msgstr "" -#: ../../library/http.server.rst:323 +#: ../../library/http.server.rst:327 msgid "" "This class serves files from the directory *directory* and below, or the " "current directory if *directory* is not provided, directly mapping the " "directory structure to HTTP requests." msgstr "" -#: ../../library/http.server.rst:327 +#: ../../library/http.server.rst:331 msgid "The *directory* parameter." msgstr "*directory* 參數。" -#: ../../library/http.server.rst:330 +#: ../../library/http.server.rst:334 msgid "The *directory* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/http.server.rst:333 +#: ../../library/http.server.rst:337 msgid "" "A lot of the work, such as parsing the request, is done by the base class :" "class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET` " "and :func:`do_HEAD` functions." msgstr "" -#: ../../library/http.server.rst:337 +#: ../../library/http.server.rst:341 msgid "" "The following are defined as class-level attributes of :class:" "`SimpleHTTPRequestHandler`:" msgstr "" -#: ../../library/http.server.rst:342 +#: ../../library/http.server.rst:346 msgid "" "This will be ``\"SimpleHTTP/\" + __version__``, where ``__version__`` is " "defined at the module level." msgstr "" -#: ../../library/http.server.rst:347 +#: ../../library/http.server.rst:351 msgid "" "A dictionary mapping suffixes into MIME types, contains custom overrides for " "the default system mappings. The mapping is used case-insensitively, and so " "should contain only lower-cased keys." msgstr "" -#: ../../library/http.server.rst:351 +#: ../../library/http.server.rst:355 msgid "" "This dictionary is no longer filled with the default system mappings, but " "only contains overrides." msgstr "" -#: ../../library/http.server.rst:355 +#: ../../library/http.server.rst:359 msgid "" "The :class:`SimpleHTTPRequestHandler` class defines the following methods:" msgstr "" -#: ../../library/http.server.rst:359 +#: ../../library/http.server.rst:363 msgid "" "This method serves the ``'HEAD'`` request type: it sends the headers it " "would send for the equivalent ``GET`` request. See the :meth:`do_GET` method " "for a more complete explanation of the possible headers." msgstr "" -#: ../../library/http.server.rst:365 +#: ../../library/http.server.rst:369 msgid "" "The request is mapped to a local file by interpreting the request as a path " "relative to the current working directory." msgstr "" -#: ../../library/http.server.rst:368 +#: ../../library/http.server.rst:372 msgid "" "If the request was mapped to a directory, the directory is checked for a " "file named ``index.html`` or ``index.htm`` (in that order). If found, the " @@ -443,7 +456,7 @@ msgid "" "func:`~os.listdir` fails." msgstr "" -#: ../../library/http.server.rst:375 +#: ../../library/http.server.rst:379 msgid "" "If the request was mapped to a file, it is opened. Any :exc:`OSError` " "exception in opening the requested file is mapped to a ``404``, ``'File not " @@ -454,51 +467,51 @@ msgid "" "*extensions_map* variable, and the file contents are returned." msgstr "" -#: ../../library/http.server.rst:383 +#: ../../library/http.server.rst:387 msgid "" "A ``'Content-type:'`` header with the guessed content type is output, " "followed by a ``'Content-Length:'`` header with the file's size and a " "``'Last-Modified:'`` header with the file's modification time." msgstr "" -#: ../../library/http.server.rst:387 +#: ../../library/http.server.rst:391 msgid "" "Then follows a blank line signifying the end of the headers, and then the " "contents of the file are output. If the file's MIME type starts with ``text/" "`` the file is opened in text mode; otherwise binary mode is used." msgstr "" -#: ../../library/http.server.rst:391 +#: ../../library/http.server.rst:395 msgid "" "For example usage, see the implementation of the ``test`` function in :" "source:`Lib/http/server.py`." msgstr "" -#: ../../library/http.server.rst:394 +#: ../../library/http.server.rst:398 msgid "Support of the ``'If-Modified-Since'`` header." msgstr "" -#: ../../library/http.server.rst:397 +#: ../../library/http.server.rst:401 msgid "" "The :class:`SimpleHTTPRequestHandler` class can be used in the following " "manner in order to create a very basic webserver serving files relative to " "the current directory::" msgstr "" -#: ../../library/http.server.rst:414 +#: ../../library/http.server.rst:418 msgid "" ":mod:`http.server` can also be invoked directly using the :option:`-m` " "switch of the interpreter. Similar to the previous example, this serves " "files relative to the current directory::" msgstr "" -#: ../../library/http.server.rst:420 +#: ../../library/http.server.rst:424 msgid "" "The server listens to port 8000 by default. The default can be overridden by " "passing the desired port number as an argument::" msgstr "" -#: ../../library/http.server.rst:425 +#: ../../library/http.server.rst:429 msgid "" "By default, the server binds itself to all interfaces. The option ``-b/--" "bind`` specifies a specific address to which it should bind. Both IPv4 and " @@ -506,40 +519,51 @@ msgid "" "server to bind to localhost only::" msgstr "" -#: ../../library/http.server.rst:432 +#: ../../library/http.server.rst:436 msgid "``--bind`` argument was introduced." msgstr "" -#: ../../library/http.server.rst:435 +#: ../../library/http.server.rst:439 msgid "``--bind`` argument enhanced to support IPv6" msgstr "" -#: ../../library/http.server.rst:438 +#: ../../library/http.server.rst:442 msgid "" "By default, the server uses the current directory. The option ``-d/--" "directory`` specifies a directory to which it should serve the files. For " "example, the following command uses a specific directory::" msgstr "" -#: ../../library/http.server.rst:444 +#: ../../library/http.server.rst:448 msgid "``--directory`` argument was introduced." msgstr "" -#: ../../library/http.server.rst:449 +#: ../../library/http.server.rst:451 +msgid "" +"By default, the server is conformant to HTTP/1.0. The option ``-p/--" +"protocol`` specifies the HTTP version to which the server is conformant. For " +"example, the following command runs an HTTP/1.1 conformant server::" +msgstr "" + +#: ../../library/http.server.rst:457 +msgid "``--protocol`` argument was introduced." +msgstr "" + +#: ../../library/http.server.rst:462 msgid "" "This class is used to serve either files or output of CGI scripts from the " "current directory and below. Note that mapping HTTP hierarchic structure to " "local directory structure is exactly as in :class:`SimpleHTTPRequestHandler`." msgstr "" -#: ../../library/http.server.rst:455 +#: ../../library/http.server.rst:468 msgid "" "CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute " "redirects (HTTP code 302), because code 200 (script output follows) is sent " "prior to execution of the CGI script. This pre-empts the status code." msgstr "" -#: ../../library/http.server.rst:460 +#: ../../library/http.server.rst:473 msgid "" "The class will however, run the CGI script, instead of serving it as a file, " "if it guesses it to be a CGI script. Only directory-based CGI are used --- " @@ -547,51 +571,51 @@ msgid "" "denoting CGI scripts." msgstr "" -#: ../../library/http.server.rst:465 +#: ../../library/http.server.rst:478 msgid "" "The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI " "scripts and serve the output, instead of serving files, if the request leads " "to somewhere below the ``cgi_directories`` path." msgstr "" -#: ../../library/http.server.rst:469 +#: ../../library/http.server.rst:482 msgid "The :class:`CGIHTTPRequestHandler` defines the following data member:" msgstr "" -#: ../../library/http.server.rst:473 +#: ../../library/http.server.rst:486 msgid "" "This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to " "treat as containing CGI scripts." msgstr "" -#: ../../library/http.server.rst:476 +#: ../../library/http.server.rst:489 msgid "The :class:`CGIHTTPRequestHandler` defines the following method:" msgstr "" -#: ../../library/http.server.rst:480 +#: ../../library/http.server.rst:493 msgid "" "This method serves the ``'POST'`` request type, only allowed for CGI " "scripts. Error 501, \"Can only POST to CGI scripts\", is output when trying " "to POST to a non-CGI url." msgstr "" -#: ../../library/http.server.rst:484 +#: ../../library/http.server.rst:497 msgid "" "Note that CGI scripts will be run with UID of user nobody, for security " "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:487 +#: ../../library/http.server.rst:500 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:495 +#: ../../library/http.server.rst:508 msgid "Security Considerations" msgstr "" -#: ../../library/http.server.rst:499 +#: ../../library/http.server.rst:512 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " diff --git a/library/imaplib.po b/library/imaplib.po index 14144275ad..420e523212 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,13 +35,24 @@ msgid "" "that the ``STATUS`` command is not supported in IMAP4." msgstr "" -#: ../../library/imaplib.rst:29 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/imaplib.rst:31 msgid "" "Three classes are provided by the :mod:`imaplib` module, :class:`IMAP4` is " "the base class:" msgstr "" -#: ../../library/imaplib.rst:35 +#: ../../library/imaplib.rst:37 msgid "" "This class implements the actual IMAP4 protocol. The connection is created " "and protocol version (IMAP4 or IMAP4rev1) is determined when the instance is " @@ -52,39 +63,39 @@ msgid "" "timeout is used." msgstr "" -#: ../../library/imaplib.rst:42 +#: ../../library/imaplib.rst:44 msgid "" "The :class:`IMAP4` class supports the :keyword:`with` statement. When used " "like this, the IMAP4 ``LOGOUT`` command is issued automatically when the :" "keyword:`!with` statement exits. E.g.::" msgstr "" -#: ../../library/imaplib.rst:52 +#: ../../library/imaplib.rst:54 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/imaplib.rst:55 ../../library/imaplib.rst:122 +#: ../../library/imaplib.rst:57 ../../library/imaplib.rst:124 msgid "The optional *timeout* parameter was added." msgstr "新增 *timeout* 選用參數。" -#: ../../library/imaplib.rst:58 +#: ../../library/imaplib.rst:60 msgid "Three exceptions are defined as attributes of the :class:`IMAP4` class:" msgstr "" -#: ../../library/imaplib.rst:63 +#: ../../library/imaplib.rst:65 msgid "" "Exception raised on any errors. The reason for the exception is passed to " "the constructor as a string." msgstr "" -#: ../../library/imaplib.rst:69 +#: ../../library/imaplib.rst:71 msgid "" "IMAP4 server errors cause this exception to be raised. This is a sub-class " "of :exc:`IMAP4.error`. Note that closing the instance and instantiating a " "new one will usually allow recovery from this exception." msgstr "" -#: ../../library/imaplib.rst:76 +#: ../../library/imaplib.rst:78 msgid "" "This exception is raised when a writable mailbox has its status changed by " "the server. This is a sub-class of :exc:`IMAP4.error`. Some other client " @@ -92,11 +103,11 @@ msgid "" "obtain write permission." msgstr "" -#: ../../library/imaplib.rst:82 +#: ../../library/imaplib.rst:84 msgid "There's also a subclass for secure connections:" msgstr "" -#: ../../library/imaplib.rst:88 +#: ../../library/imaplib.rst:90 msgid "" "This is a subclass derived from :class:`IMAP4` that connects over an SSL " "encrypted socket (to use this class you need a socket module that was " @@ -108,7 +119,7 @@ msgid "" "for best practices." msgstr "" -#: ../../library/imaplib.rst:97 +#: ../../library/imaplib.rst:99 msgid "" "*keyfile* and *certfile* are a legacy alternative to *ssl_context* - they " "can point to PEM-formatted private key and certificate chain files for the " @@ -117,63 +128,63 @@ msgid "" "*certfile* is provided along with *ssl_context*." msgstr "" -#: ../../library/imaplib.rst:103 +#: ../../library/imaplib.rst:105 msgid "" "The optional *timeout* parameter specifies a timeout in seconds for the " "connection attempt. If timeout is not given or is None, the global default " "socket timeout is used." msgstr "" -#: ../../library/imaplib.rst:107 +#: ../../library/imaplib.rst:109 msgid "*ssl_context* parameter was added." msgstr "新增 *ssl_context* 參數。" -#: ../../library/imaplib.rst:110 +#: ../../library/imaplib.rst:112 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/imaplib.rst:117 +#: ../../library/imaplib.rst:119 msgid "" "*keyfile* and *certfile* are deprecated in favor of *ssl_context*. Please " "use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." "create_default_context` select the system's trusted CA certificates for you." msgstr "" -#: ../../library/imaplib.rst:125 +#: ../../library/imaplib.rst:127 msgid "The second subclass allows for connections created by a child process:" msgstr "" -#: ../../library/imaplib.rst:130 +#: ../../library/imaplib.rst:132 msgid "" "This is a subclass derived from :class:`IMAP4` that connects to the ``stdin/" "stdout`` file descriptors created by passing *command* to ``subprocess." "Popen()``." msgstr "" -#: ../../library/imaplib.rst:135 +#: ../../library/imaplib.rst:137 msgid "The following utility functions are defined:" msgstr "" -#: ../../library/imaplib.rst:140 +#: ../../library/imaplib.rst:142 msgid "" "Parse an IMAP4 ``INTERNALDATE`` string and return corresponding local time. " "The return value is a :class:`time.struct_time` tuple or ``None`` if the " "string has wrong format." msgstr "" -#: ../../library/imaplib.rst:146 +#: ../../library/imaplib.rst:148 msgid "" "Converts an integer into a bytes representation using characters from the " "set [``A`` .. ``P``]." msgstr "" -#: ../../library/imaplib.rst:152 +#: ../../library/imaplib.rst:154 msgid "Converts an IMAP4 ``FLAGS`` response to a tuple of individual flags." msgstr "" -#: ../../library/imaplib.rst:157 +#: ../../library/imaplib.rst:159 msgid "" "Convert *date_time* to an IMAP4 ``INTERNALDATE`` representation. The return " "value is a string in the form: ``\"DD-Mmm-YYYY HH:MM:SS +HHMM\"`` (including " @@ -185,7 +196,7 @@ msgid "" "already be in the correct format." msgstr "" -#: ../../library/imaplib.rst:167 +#: ../../library/imaplib.rst:169 msgid "" "Note that IMAP4 message numbers change as the mailbox changes; in " "particular, after an ``EXPUNGE`` command performs deletions the remaining " @@ -193,30 +204,30 @@ msgid "" "the UID command." msgstr "" -#: ../../library/imaplib.rst:171 +#: ../../library/imaplib.rst:173 msgid "" "At the end of the module, there is a test section that contains a more " "extensive example of usage." msgstr "" -#: ../../library/imaplib.rst:177 +#: ../../library/imaplib.rst:179 msgid "" "Documents describing the protocol, sources for servers implementing it, by " "the University of Washington's IMAP Information Center can all be found at " "(**Source Code**) https://github.com/uw-imap/imap (**Not Maintained**)." msgstr "" -#: ../../library/imaplib.rst:185 +#: ../../library/imaplib.rst:187 msgid "IMAP4 Objects" msgstr "IMAP4 物件" -#: ../../library/imaplib.rst:187 +#: ../../library/imaplib.rst:189 msgid "" "All IMAP4rev1 commands are represented by methods of the same name, either " "upper-case or lower-case." msgstr "" -#: ../../library/imaplib.rst:190 +#: ../../library/imaplib.rst:192 msgid "" "All arguments to commands are converted to strings, except for " "``AUTHENTICATE``, and the last argument to ``APPEND`` which is passed as an " @@ -228,7 +239,7 @@ msgid "" "(eg: ``r'(\\Deleted)'``)." msgstr "" -#: ../../library/imaplib.rst:198 +#: ../../library/imaplib.rst:200 msgid "" "Each command returns a tuple: ``(type, [data, ...])`` where *type* is " "usually ``'OK'`` or ``'NO'``, and *data* is either the text from the command " @@ -237,7 +248,7 @@ msgid "" "response, and the second part contains the data (ie: 'literal' value)." msgstr "" -#: ../../library/imaplib.rst:204 +#: ../../library/imaplib.rst:206 msgid "" "The *message_set* options to commands below is a string specifying one or " "more messages to be acted upon. It may be a simple message number " @@ -246,30 +257,30 @@ msgid "" "an asterisk to indicate an infinite upper bound (``'3:*'``)." msgstr "" -#: ../../library/imaplib.rst:210 +#: ../../library/imaplib.rst:212 msgid "An :class:`IMAP4` instance has the following methods:" msgstr "" -#: ../../library/imaplib.rst:215 +#: ../../library/imaplib.rst:217 msgid "Append *message* to named mailbox." msgstr "" -#: ../../library/imaplib.rst:220 +#: ../../library/imaplib.rst:222 msgid "Authenticate command --- requires response processing." msgstr "" -#: ../../library/imaplib.rst:222 +#: ../../library/imaplib.rst:224 msgid "" "*mechanism* specifies which authentication mechanism is to be used - it " "should appear in the instance variable ``capabilities`` in the form " "``AUTH=mechanism``." msgstr "" -#: ../../library/imaplib.rst:225 +#: ../../library/imaplib.rst:227 msgid "*authobject* must be a callable object::" msgstr "" -#: ../../library/imaplib.rst:229 +#: ../../library/imaplib.rst:231 msgid "" "It will be called to process server continuation responses; the *response* " "argument it is passed will be ``bytes``. It should return ``bytes`` *data* " @@ -277,135 +288,135 @@ msgid "" "``None`` if the client abort response ``*`` should be sent instead." msgstr "" -#: ../../library/imaplib.rst:234 +#: ../../library/imaplib.rst:236 msgid "" "string usernames and passwords are now encoded to ``utf-8`` instead of being " "limited to ASCII." msgstr "" -#: ../../library/imaplib.rst:241 +#: ../../library/imaplib.rst:243 msgid "Checkpoint mailbox on server." msgstr "" -#: ../../library/imaplib.rst:246 +#: ../../library/imaplib.rst:248 msgid "" "Close currently selected mailbox. Deleted messages are removed from writable " "mailbox. This is the recommended command before ``LOGOUT``." msgstr "" -#: ../../library/imaplib.rst:252 +#: ../../library/imaplib.rst:254 msgid "Copy *message_set* messages onto end of *new_mailbox*." msgstr "" -#: ../../library/imaplib.rst:257 +#: ../../library/imaplib.rst:259 msgid "Create new mailbox named *mailbox*." msgstr "" -#: ../../library/imaplib.rst:262 +#: ../../library/imaplib.rst:264 msgid "Delete old mailbox named *mailbox*." msgstr "" -#: ../../library/imaplib.rst:267 +#: ../../library/imaplib.rst:269 msgid "Delete the ACLs (remove any rights) set for who on mailbox." msgstr "" -#: ../../library/imaplib.rst:272 +#: ../../library/imaplib.rst:274 msgid "" "Enable *capability* (see :rfc:`5161`). Most capabilities do not need to be " "enabled. Currently only the ``UTF8=ACCEPT`` capability is supported (see :" "RFC:`6855`)." msgstr "" -#: ../../library/imaplib.rst:276 +#: ../../library/imaplib.rst:278 msgid "The :meth:`enable` method itself, and :RFC:`6855` support." msgstr "" -#: ../../library/imaplib.rst:282 +#: ../../library/imaplib.rst:284 msgid "" "Permanently remove deleted items from selected mailbox. Generates an " "``EXPUNGE`` response for each deleted message. Returned data contains a list " "of ``EXPUNGE`` message numbers in order received." msgstr "" -#: ../../library/imaplib.rst:289 +#: ../../library/imaplib.rst:291 msgid "" "Fetch (parts of) messages. *message_parts* should be a string of message " "part names enclosed within parentheses, eg: ``\"(UID BODY[TEXT])\"``. " "Returned data are tuples of message part envelope and data." msgstr "" -#: ../../library/imaplib.rst:296 +#: ../../library/imaplib.rst:298 msgid "" "Get the ``ACL``\\ s for *mailbox*. The method is non-standard, but is " "supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:302 +#: ../../library/imaplib.rst:304 msgid "" "Retrieve the specified ``ANNOTATION``\\ s for *mailbox*. The method is non-" "standard, but is supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:308 +#: ../../library/imaplib.rst:310 msgid "" "Get the ``quota`` *root*'s resource usage and limits. This method is part of " "the IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:314 +#: ../../library/imaplib.rst:316 msgid "" "Get the list of ``quota`` ``roots`` for the named *mailbox*. This method is " "part of the IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:320 +#: ../../library/imaplib.rst:322 msgid "" "List mailbox names in *directory* matching *pattern*. *directory* defaults " "to the top-level mail folder, and *pattern* defaults to match anything. " "Returned data contains a list of ``LIST`` responses." msgstr "" -#: ../../library/imaplib.rst:327 +#: ../../library/imaplib.rst:329 msgid "" "Identify the client using a plaintext password. The *password* will be " "quoted." msgstr "" -#: ../../library/imaplib.rst:332 +#: ../../library/imaplib.rst:334 msgid "" "Force use of ``CRAM-MD5`` authentication when identifying the client to " "protect the password. Will only work if the server ``CAPABILITY`` response " "includes the phrase ``AUTH=CRAM-MD5``." msgstr "" -#: ../../library/imaplib.rst:339 +#: ../../library/imaplib.rst:341 msgid "Shutdown connection to server. Returns server ``BYE`` response." msgstr "" -#: ../../library/imaplib.rst:341 +#: ../../library/imaplib.rst:343 msgid "The method no longer ignores silently arbitrary exceptions." msgstr "" -#: ../../library/imaplib.rst:347 +#: ../../library/imaplib.rst:349 msgid "" "List subscribed mailbox names in directory matching pattern. *directory* " "defaults to the top level directory and *pattern* defaults to match any " "mailbox. Returned data are tuples of message part envelope and data." msgstr "" -#: ../../library/imaplib.rst:354 +#: ../../library/imaplib.rst:356 msgid "Show my ACLs for a mailbox (i.e. the rights that I have on mailbox)." msgstr "" -#: ../../library/imaplib.rst:359 +#: ../../library/imaplib.rst:361 msgid "Returns IMAP namespaces as defined in :rfc:`2342`." msgstr "" -#: ../../library/imaplib.rst:364 +#: ../../library/imaplib.rst:366 msgid "Send ``NOOP`` to server." msgstr "" -#: ../../library/imaplib.rst:369 +#: ../../library/imaplib.rst:371 msgid "" "Opens socket to *port* at *host*. The optional *timeout* parameter specifies " "a timeout in seconds for the connection attempt. If timeout is not given or " @@ -418,54 +429,54 @@ msgid "" "method." msgstr "" -#: ../../library/imaplib.rst:379 +#: ../../library/imaplib.rst:392 msgid "" "Raises an :ref:`auditing event ` ``imaplib.open`` with arguments " "``self``, ``host``, ``port``." msgstr "" -#: ../../library/imaplib.rst:381 +#: ../../library/imaplib.rst:383 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/imaplib.rst:386 +#: ../../library/imaplib.rst:388 msgid "" "Fetch truncated part of a message. Returned data is a tuple of message part " "envelope and data." msgstr "" -#: ../../library/imaplib.rst:392 +#: ../../library/imaplib.rst:394 msgid "" "Assume authentication as *user*. Allows an authorised administrator to proxy " "into any user's mailbox." msgstr "" -#: ../../library/imaplib.rst:398 +#: ../../library/imaplib.rst:400 msgid "" "Reads *size* bytes from the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:403 +#: ../../library/imaplib.rst:405 msgid "Reads one line from the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:408 +#: ../../library/imaplib.rst:410 msgid "" "Prompt server for an update. Returned data is ``None`` if no new messages, " "else value of ``RECENT`` response." msgstr "" -#: ../../library/imaplib.rst:414 +#: ../../library/imaplib.rst:416 msgid "Rename mailbox named *oldmailbox* to *newmailbox*." msgstr "" -#: ../../library/imaplib.rst:419 +#: ../../library/imaplib.rst:421 msgid "" "Return data for response *code* if received, or ``None``. Returns the given " "code, instead of the usual type." msgstr "" -#: ../../library/imaplib.rst:425 +#: ../../library/imaplib.rst:427 msgid "" "Search mailbox for matching messages. *charset* may be ``None``, in which " "case no ``CHARSET`` will be specified in the request to the server. The " @@ -475,66 +486,66 @@ msgid "" "`enable` command." msgstr "" -#: ../../library/imaplib.rst:432 +#: ../../library/imaplib.rst:434 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/imaplib.rst:443 +#: ../../library/imaplib.rst:445 msgid "" "Select a mailbox. Returned data is the count of messages in *mailbox* " "(``EXISTS`` response). The default *mailbox* is ``'INBOX'``. If the " "*readonly* flag is set, modifications to the mailbox are not allowed." msgstr "" -#: ../../library/imaplib.rst:450 +#: ../../library/imaplib.rst:452 msgid "Sends ``data`` to the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:452 +#: ../../library/imaplib.rst:465 msgid "" "Raises an :ref:`auditing event ` ``imaplib.send`` with arguments " "``self``, ``data``." msgstr "" -#: ../../library/imaplib.rst:457 +#: ../../library/imaplib.rst:459 msgid "" "Set an ``ACL`` for *mailbox*. The method is non-standard, but is supported " "by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:463 +#: ../../library/imaplib.rst:465 msgid "" "Set ``ANNOTATION``\\ s for *mailbox*. The method is non-standard, but is " "supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:469 +#: ../../library/imaplib.rst:471 msgid "" "Set the ``quota`` *root*'s resource *limits*. This method is part of the " "IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:475 +#: ../../library/imaplib.rst:477 msgid "" "Close connection established in ``open``. This method is implicitly called " "by :meth:`IMAP4.logout`. You may override this method." msgstr "" -#: ../../library/imaplib.rst:481 +#: ../../library/imaplib.rst:483 msgid "Returns socket instance used to connect to server." msgstr "" -#: ../../library/imaplib.rst:486 +#: ../../library/imaplib.rst:488 msgid "" "The ``sort`` command is a variant of ``search`` with sorting semantics for " "the results. Returned data contains a space separated list of matching " "message numbers." msgstr "" -#: ../../library/imaplib.rst:490 +#: ../../library/imaplib.rst:492 msgid "" "Sort has two arguments before the *search_criterion* argument(s); a " "parenthesized list of *sort_criteria*, and the searching *charset*. Note " @@ -546,39 +557,39 @@ msgid "" "searching criteria. It then returns the numbers of matching messages." msgstr "" -#: ../../library/imaplib.rst:499 ../../library/imaplib.rst:570 +#: ../../library/imaplib.rst:501 ../../library/imaplib.rst:572 msgid "This is an ``IMAP4rev1`` extension command." msgstr "" -#: ../../library/imaplib.rst:504 +#: ../../library/imaplib.rst:506 msgid "" "Send a ``STARTTLS`` command. The *ssl_context* argument is optional and " "should be a :class:`ssl.SSLContext` object. This will enable encryption on " "the IMAP connection. Please read :ref:`ssl-security` for best practices." msgstr "" -#: ../../library/imaplib.rst:511 +#: ../../library/imaplib.rst:513 msgid "" "The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/imaplib.rst:519 +#: ../../library/imaplib.rst:521 msgid "Request named status conditions for *mailbox*." msgstr "" -#: ../../library/imaplib.rst:524 +#: ../../library/imaplib.rst:526 msgid "" "Alters flag dispositions for messages in mailbox. *command* is specified by " "section 6.4.6 of :rfc:`2060` as being one of \"FLAGS\", \"+FLAGS\", or \"-" "FLAGS\", optionally with a suffix of \".SILENT\"." msgstr "" -#: ../../library/imaplib.rst:528 +#: ../../library/imaplib.rst:530 msgid "For example, to set the delete flag on all messages::" msgstr "" -#: ../../library/imaplib.rst:537 +#: ../../library/imaplib.rst:539 msgid "" "Creating flags containing ']' (for example: \"[test]\") violates :rfc:`3501` " "(the IMAP protocol). However, imaplib has historically allowed creation of " @@ -590,24 +601,24 @@ msgid "" "are sent from the server, since this improves real-world compatibility." msgstr "" -#: ../../library/imaplib.rst:549 +#: ../../library/imaplib.rst:551 msgid "Subscribe to new mailbox." msgstr "" -#: ../../library/imaplib.rst:554 +#: ../../library/imaplib.rst:556 msgid "" "The ``thread`` command is a variant of ``search`` with threading semantics " "for the results. Returned data contains a space separated list of thread " "members." msgstr "" -#: ../../library/imaplib.rst:557 +#: ../../library/imaplib.rst:559 msgid "" "Thread members consist of zero or more messages numbers, delimited by " "spaces, indicating successive parent and child." msgstr "" -#: ../../library/imaplib.rst:560 +#: ../../library/imaplib.rst:562 msgid "" "Thread has two arguments before the *search_criterion* argument(s); a " "*threading_algorithm*, and the searching *charset*. Note that unlike " @@ -620,7 +631,7 @@ msgid "" "specified threading algorithm." msgstr "" -#: ../../library/imaplib.rst:575 +#: ../../library/imaplib.rst:577 msgid "" "Execute command args with messages identified by UID, rather than message " "number. Returns response appropriate to command. At least one argument " @@ -628,11 +639,11 @@ msgid "" "an exception will be raised." msgstr "" -#: ../../library/imaplib.rst:583 +#: ../../library/imaplib.rst:585 msgid "Unsubscribe from old mailbox." msgstr "" -#: ../../library/imaplib.rst:587 +#: ../../library/imaplib.rst:589 msgid "" ":meth:`imaplib.IMAP4.unselect` frees server's resources associated with the " "selected mailbox and returns the server to the authenticated state. This " @@ -640,40 +651,40 @@ msgid "" "that no messages are permanently removed from the currently selected mailbox." msgstr "" -#: ../../library/imaplib.rst:597 +#: ../../library/imaplib.rst:599 msgid "" "Allow simple extension commands notified by server in ``CAPABILITY`` " "response." msgstr "" -#: ../../library/imaplib.rst:600 +#: ../../library/imaplib.rst:602 msgid "The following attributes are defined on instances of :class:`IMAP4`:" msgstr "" -#: ../../library/imaplib.rst:604 +#: ../../library/imaplib.rst:606 msgid "" "The most recent supported protocol in the ``CAPABILITY`` response from the " "server." msgstr "" -#: ../../library/imaplib.rst:610 +#: ../../library/imaplib.rst:612 msgid "" "Integer value to control debugging output. The initialize value is taken " "from the module variable ``Debug``. Values greater than three trace each " "command." msgstr "" -#: ../../library/imaplib.rst:616 +#: ../../library/imaplib.rst:618 msgid "" "Boolean value that is normally ``False``, but is set to ``True`` if an :meth:" "`enable` command is successfully issued for the ``UTF8=ACCEPT`` capability." msgstr "" -#: ../../library/imaplib.rst:626 +#: ../../library/imaplib.rst:628 msgid "IMAP4 Example" msgstr "IMAP4 範例" -#: ../../library/imaplib.rst:628 +#: ../../library/imaplib.rst:630 msgid "" "Here is a minimal example (without error checking) that opens a mailbox and " "retrieves and prints all messages::" diff --git a/library/imghdr.po b/library/imghdr.po index f2ed7529cf..173fc2b446 100644 --- a/library/imghdr.po +++ b/library/imghdr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:06+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`imghdr` --- 推測圖片種類" msgid "**Source code:** :source:`Lib/imghdr.py`" msgstr "**原始碼:**\\ :source:`Lib/imghdr.py`" -#: ../../library/imghdr.rst:10 +#: ../../library/imghdr.rst:13 msgid "" "The :mod:`imghdr` module is deprecated (see :pep:`PEP 594 <594#imghdr>` for " "details and alternatives)." diff --git a/library/imp.po b/library/imp.po index 53ad7c9077..4e8483c865 100644 --- a/library/imp.po +++ b/library/imp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,7 +26,7 @@ msgstr "" msgid "**Source code:** :source:`Lib/imp.py`" msgstr "**原始碼:**\\ :source:`Lib/imp.py`" -#: ../../library/imp.rst:10 +#: ../../library/imp.rst:12 msgid "The :mod:`imp` module is deprecated in favor of :mod:`importlib`." msgstr "" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index fd0be46fb1..460f36e01a 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -35,9 +35,9 @@ msgid "" "package metadata. Built in part on Python's import system, this library " "intends to replace similar functionality in the `entry point API`_ and " "`metadata API`_ of ``pkg_resources``. Along with :mod:`importlib.resources` " -"in Python 3.7 and newer (backported as `importlib_resources`_ for older " -"versions of Python), this can eliminate the need to use the older and less " -"efficient ``pkg_resources`` package." +"(with new features backported to the `importlib_resources`_ package), this " +"can eliminate the need to use the older and less efficient ``pkg_resources`` " +"package." msgstr "" #: ../../library/importlib.metadata.rst:25 diff --git a/library/importlib.po b/library/importlib.po index 5ed48eb29c..c1eb54be64 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-04 00:24+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,21 +26,25 @@ msgstr "" msgid "**Source code:** :source:`Lib/importlib/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/__init__.py`" -#: ../../library/importlib.rst:17 +#: ../../library/importlib.rst:18 msgid "Introduction" msgstr "簡介" -#: ../../library/importlib.rst:19 +#: ../../library/importlib.rst:20 +msgid "The purpose of the :mod:`importlib` package is three-fold." +msgstr "" + +#: ../../library/importlib.rst:22 msgid "" -"The purpose of the :mod:`importlib` package is two-fold. One is to provide " -"the implementation of the :keyword:`import` statement (and thus, by " -"extension, the :func:`__import__` function) in Python source code. This " -"provides an implementation of :keyword:`!import` which is portable to any " -"Python interpreter. This also provides an implementation which is easier to " -"comprehend than one implemented in a programming language other than Python." +"One is to provide the implementation of the :keyword:`import` statement (and " +"thus, by extension, the :func:`__import__` function) in Python source code. " +"This provides an implementation of :keyword:`!import` which is portable to " +"any Python interpreter. This also provides an implementation which is easier " +"to comprehend than one implemented in a programming language other than " +"Python." msgstr "" -#: ../../library/importlib.rst:26 +#: ../../library/importlib.rst:29 msgid "" "Two, the components to implement :keyword:`import` are exposed in this " "package, making it easier for users to create their own custom objects " @@ -49,144 +53,170 @@ msgid "" msgstr "" #: ../../library/importlib.rst:33 +msgid "" +"Three, the package contains modules exposing additional functionality for " +"managing aspects of Python packages:" +msgstr "" + +#: ../../library/importlib.rst:36 +msgid "" +":mod:`importlib.metadata` presents access to metadata from third-party " +"distributions." +msgstr "" + +#: ../../library/importlib.rst:38 +msgid "" +":mod:`importlib.resources` provides routines for accessing non-code " +"\"resources\" from Python packages." +msgstr "" + +#: ../../library/importlib.rst:44 msgid ":ref:`import`" msgstr ":ref:`import`" -#: ../../library/importlib.rst:33 +#: ../../library/importlib.rst:44 msgid "The language reference for the :keyword:`import` statement." msgstr "" -#: ../../library/importlib.rst:38 +#: ../../library/importlib.rst:49 msgid "" "`Packages specification `__" msgstr "" -#: ../../library/importlib.rst:36 +#: ../../library/importlib.rst:47 msgid "" "Original specification of packages. Some semantics have changed since the " "writing of this document (e.g. redirecting based on ``None`` in :data:`sys." "modules`)." msgstr "" -#: ../../library/importlib.rst:41 +#: ../../library/importlib.rst:52 msgid "The :func:`.__import__` function" msgstr "" -#: ../../library/importlib.rst:41 +#: ../../library/importlib.rst:52 msgid "The :keyword:`import` statement is syntactic sugar for this function." msgstr "" -#: ../../library/importlib.rst:44 +#: ../../library/importlib.rst:55 +msgid ":ref:`sys-path-init`" +msgstr "" + +#: ../../library/importlib.rst:55 +msgid "The initialization of :data:`sys.path`." +msgstr "" + +#: ../../library/importlib.rst:58 msgid ":pep:`235`" msgstr ":pep:`235`" -#: ../../library/importlib.rst:44 +#: ../../library/importlib.rst:58 msgid "Import on Case-Insensitive Platforms" msgstr "" -#: ../../library/importlib.rst:47 +#: ../../library/importlib.rst:61 msgid ":pep:`263`" msgstr ":pep:`263`" -#: ../../library/importlib.rst:47 +#: ../../library/importlib.rst:61 msgid "Defining Python Source Code Encodings" msgstr "" -#: ../../library/importlib.rst:50 +#: ../../library/importlib.rst:64 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../library/importlib.rst:50 +#: ../../library/importlib.rst:64 msgid "New Import Hooks" msgstr "" -#: ../../library/importlib.rst:53 +#: ../../library/importlib.rst:67 msgid ":pep:`328`" msgstr ":pep:`328`" -#: ../../library/importlib.rst:53 +#: ../../library/importlib.rst:67 msgid "Imports: Multi-Line and Absolute/Relative" msgstr "" -#: ../../library/importlib.rst:56 +#: ../../library/importlib.rst:70 msgid ":pep:`366`" msgstr ":pep:`366`" -#: ../../library/importlib.rst:56 +#: ../../library/importlib.rst:70 msgid "Main module explicit relative imports" msgstr "" -#: ../../library/importlib.rst:59 +#: ../../library/importlib.rst:73 msgid ":pep:`420`" msgstr ":pep:`420`" -#: ../../library/importlib.rst:59 +#: ../../library/importlib.rst:73 msgid "Implicit namespace packages" msgstr "" -#: ../../library/importlib.rst:62 +#: ../../library/importlib.rst:76 msgid ":pep:`451`" msgstr ":pep:`451`" -#: ../../library/importlib.rst:62 +#: ../../library/importlib.rst:76 msgid "A ModuleSpec Type for the Import System" msgstr "" -#: ../../library/importlib.rst:65 +#: ../../library/importlib.rst:79 msgid ":pep:`488`" msgstr ":pep:`488`" -#: ../../library/importlib.rst:65 +#: ../../library/importlib.rst:79 msgid "Elimination of PYO files" msgstr "" -#: ../../library/importlib.rst:68 +#: ../../library/importlib.rst:82 msgid ":pep:`489`" msgstr ":pep:`489`" -#: ../../library/importlib.rst:68 +#: ../../library/importlib.rst:82 msgid "Multi-phase extension module initialization" msgstr "" -#: ../../library/importlib.rst:71 +#: ../../library/importlib.rst:85 msgid ":pep:`552`" msgstr ":pep:`552`" -#: ../../library/importlib.rst:71 +#: ../../library/importlib.rst:85 msgid "Deterministic pycs" msgstr "" -#: ../../library/importlib.rst:74 +#: ../../library/importlib.rst:88 msgid ":pep:`3120`" msgstr ":pep:`3120`" -#: ../../library/importlib.rst:74 +#: ../../library/importlib.rst:88 msgid "Using UTF-8 as the Default Source Encoding" msgstr "" -#: ../../library/importlib.rst:76 +#: ../../library/importlib.rst:90 msgid ":pep:`3147`" msgstr ":pep:`3147`" -#: ../../library/importlib.rst:77 +#: ../../library/importlib.rst:91 msgid "PYC Repository Directories" msgstr "" -#: ../../library/importlib.rst:81 +#: ../../library/importlib.rst:95 msgid "Functions" msgstr "函式" -#: ../../library/importlib.rst:85 +#: ../../library/importlib.rst:99 msgid "An implementation of the built-in :func:`__import__` function." msgstr "" -#: ../../library/importlib.rst:88 +#: ../../library/importlib.rst:102 msgid "" "Programmatic importing of modules should use :func:`import_module` instead " "of this function." msgstr "" -#: ../../library/importlib.rst:93 +#: ../../library/importlib.rst:107 msgid "" "Import a module. The *name* argument specifies what module to import in " "absolute or relative terms (e.g. either ``pkg.mod`` or ``..mod``). If the " @@ -196,7 +226,7 @@ msgid "" "``pkg.mod``)." msgstr "" -#: ../../library/importlib.rst:101 +#: ../../library/importlib.rst:115 msgid "" "The :func:`import_module` function acts as a simplifying wrapper around :" "func:`importlib.__import__`. This means all semantics of the function are " @@ -206,7 +236,7 @@ msgid "" "returns the top-level package or module (e.g. ``pkg``)." msgstr "" -#: ../../library/importlib.rst:108 +#: ../../library/importlib.rst:122 msgid "" "If you are dynamically importing a module that was created since the " "interpreter began execution (e.g., created a Python source file), you may " @@ -214,11 +244,11 @@ msgid "" "noticed by the import system." msgstr "" -#: ../../library/importlib.rst:113 +#: ../../library/importlib.rst:127 msgid "Parent packages are automatically imported." msgstr "" -#: ../../library/importlib.rst:118 +#: ../../library/importlib.rst:132 msgid "" "Find the loader for a module, optionally within the specified *path*. If the " "module is in :attr:`sys.modules`, then ``sys.modules[name].__loader__`` is " @@ -227,7 +257,7 @@ msgid "" "is done. ``None`` is returned if no loader is found." msgstr "" -#: ../../library/importlib.rst:124 +#: ../../library/importlib.rst:138 msgid "" "A dotted name does not have its parents implicitly imported as that requires " "loading them and that may not be desired. To properly import a submodule you " @@ -235,17 +265,17 @@ msgid "" "argument to *path*." msgstr "" -#: ../../library/importlib.rst:131 +#: ../../library/importlib.rst:145 msgid "" "If ``__loader__`` is not set, raise :exc:`ValueError`, just like when the " "attribute is set to ``None``." msgstr "" -#: ../../library/importlib.rst:135 +#: ../../library/importlib.rst:149 msgid "Use :func:`importlib.util.find_spec` instead." msgstr "" -#: ../../library/importlib.rst:140 +#: ../../library/importlib.rst:154 msgid "" "Invalidate the internal caches of finders stored at :data:`sys.meta_path`. " "If a finder implements ``invalidate_caches()`` then it will be called to " @@ -254,7 +284,13 @@ msgid "" "will notice the new module's existence." msgstr "" -#: ../../library/importlib.rst:150 +#: ../../library/importlib.rst:162 +msgid "" +"Namespace packages created/installed in a different :data:`sys.path` " +"location after the same namespace was already imported are noticed." +msgstr "" + +#: ../../library/importlib.rst:168 msgid "" "Reload a previously imported *module*. The argument must be a module " "object, so it must have been successfully imported before. This is useful " @@ -264,11 +300,11 @@ msgid "" "causes a different object to be placed in :data:`sys.modules`)." msgstr "" -#: ../../library/importlib.rst:157 +#: ../../library/importlib.rst:175 msgid "When :func:`reload` is executed:" msgstr "" -#: ../../library/importlib.rst:159 +#: ../../library/importlib.rst:177 msgid "" "Python module's code is recompiled and the module-level code re-executed, " "defining a new set of objects which are bound to names in the module's " @@ -277,30 +313,30 @@ msgid "" "time." msgstr "" -#: ../../library/importlib.rst:165 +#: ../../library/importlib.rst:183 msgid "" "As with all other objects in Python the old objects are only reclaimed after " "their reference counts drop to zero." msgstr "" -#: ../../library/importlib.rst:168 +#: ../../library/importlib.rst:186 msgid "" "The names in the module namespace are updated to point to any new or changed " "objects." msgstr "" -#: ../../library/importlib.rst:171 +#: ../../library/importlib.rst:189 msgid "" "Other references to the old objects (such as names external to the module) " "are not rebound to refer to the new objects and must be updated in each " "namespace where they occur if that is desired." msgstr "" -#: ../../library/importlib.rst:175 +#: ../../library/importlib.rst:193 msgid "There are a number of other caveats:" msgstr "" -#: ../../library/importlib.rst:177 +#: ../../library/importlib.rst:195 msgid "" "When a module is reloaded, its dictionary (containing the module's global " "variables) is retained. Redefinitions of names will override the old " @@ -312,7 +348,7 @@ msgid "" "if desired::" msgstr "" -#: ../../library/importlib.rst:191 +#: ../../library/importlib.rst:209 msgid "" "It is generally not very useful to reload built-in or dynamically loaded " "modules. Reloading :mod:`sys`, :mod:`__main__`, :mod:`builtins` and other " @@ -321,7 +357,7 @@ msgid "" "when reloaded." msgstr "" -#: ../../library/importlib.rst:197 +#: ../../library/importlib.rst:215 msgid "" "If a module imports objects from another module using :keyword:`from` ... :" "keyword:`import` ..., calling :func:`reload` for the other module does not " @@ -330,7 +366,7 @@ msgid "" "and qualified names (*module.name*) instead." msgstr "" -#: ../../library/importlib.rst:203 +#: ../../library/importlib.rst:221 msgid "" "If a module instantiates instances of a class, reloading the module that " "defines the class does not affect the method definitions of the instances " @@ -338,66 +374,66 @@ msgid "" "derived classes." msgstr "" -#: ../../library/importlib.rst:209 +#: ../../library/importlib.rst:227 msgid "" ":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks a :" "class:`~importlib.machinery.ModuleSpec`." msgstr "" -#: ../../library/importlib.rst:215 +#: ../../library/importlib.rst:233 msgid ":mod:`importlib.abc` -- Abstract base classes related to import" msgstr "" -#: ../../library/importlib.rst:220 +#: ../../library/importlib.rst:238 msgid "**Source code:** :source:`Lib/importlib/abc.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/abc.py`" -#: ../../library/importlib.rst:225 +#: ../../library/importlib.rst:243 msgid "" "The :mod:`importlib.abc` module contains all of the core abstract base " "classes used by :keyword:`import`. Some subclasses of the core abstract base " "classes are also provided to help in implementing the core ABCs." msgstr "" -#: ../../library/importlib.rst:229 +#: ../../library/importlib.rst:247 msgid "ABC hierarchy::" msgstr "" -#: ../../library/importlib.rst:245 +#: ../../library/importlib.rst:263 msgid "An abstract base class representing a :term:`finder`." msgstr "" -#: ../../library/importlib.rst:247 +#: ../../library/importlib.rst:265 msgid "Use :class:`MetaPathFinder` or :class:`PathEntryFinder` instead." msgstr "" -#: ../../library/importlib.rst:252 +#: ../../library/importlib.rst:270 msgid "" "An abstract method for finding a :term:`loader` for the specified module. " "Originally specified in :pep:`302`, this method was meant for use in :data:" "`sys.meta_path` and in the path-based import subsystem." msgstr "" -#: ../../library/importlib.rst:256 +#: ../../library/importlib.rst:274 msgid "" "Returns ``None`` when called instead of raising :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:260 +#: ../../library/importlib.rst:278 msgid "" "Implement :meth:`MetaPathFinder.find_spec` or :meth:`PathEntryFinder." "find_spec` instead." msgstr "" -#: ../../library/importlib.rst:267 +#: ../../library/importlib.rst:285 msgid "An abstract base class representing a :term:`meta path finder`." msgstr "" -#: ../../library/importlib.rst:271 ../../library/importlib.rst:326 +#: ../../library/importlib.rst:289 ../../library/importlib.rst:344 msgid "No longer a subclass of :class:`Finder`." msgstr "" -#: ../../library/importlib.rst:276 +#: ../../library/importlib.rst:294 msgid "" "An abstract method for finding a :term:`spec ` for the " "specified module. If this is a top-level import, *path* will be ``None``. " @@ -409,7 +445,7 @@ msgid "" "implementing concrete ``MetaPathFinders``." msgstr "" -#: ../../library/importlib.rst:290 +#: ../../library/importlib.rst:308 msgid "" "A legacy method for finding a :term:`loader` for the specified module. If " "this is a top-level import, *path* will be ``None``. Otherwise, this is a " @@ -418,36 +454,36 @@ msgid "" "returned." msgstr "" -#: ../../library/importlib.rst:296 +#: ../../library/importlib.rst:314 msgid "" "If :meth:`find_spec` is defined, backwards-compatible functionality is " "provided." msgstr "" -#: ../../library/importlib.rst:299 +#: ../../library/importlib.rst:317 msgid "" "Returns ``None`` when called instead of raising :exc:`NotImplementedError`. " "Can use :meth:`find_spec` to provide functionality." msgstr "" -#: ../../library/importlib.rst:304 ../../library/importlib.rst:360 -#: ../../library/importlib.rst:368 ../../library/importlib.rst:1192 -#: ../../library/importlib.rst:1249 +#: ../../library/importlib.rst:322 ../../library/importlib.rst:378 +#: ../../library/importlib.rst:386 ../../library/importlib.rst:902 +#: ../../library/importlib.rst:959 msgid "Use :meth:`find_spec` instead." msgstr "" -#: ../../library/importlib.rst:309 +#: ../../library/importlib.rst:327 msgid "" "An optional method which, when called, should invalidate any internal cache " "used by the finder. Used by :func:`importlib.invalidate_caches` when " "invalidating the caches of all finders on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.rst:313 +#: ../../library/importlib.rst:331 msgid "Returns ``None`` when called instead of ``NotImplemented``." msgstr "" -#: ../../library/importlib.rst:319 +#: ../../library/importlib.rst:337 msgid "" "An abstract base class representing a :term:`path entry finder`. Though it " "bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder`` is " @@ -455,7 +491,7 @@ msgid "" "`importlib.machinery.PathFinder`." msgstr "" -#: ../../library/importlib.rst:331 +#: ../../library/importlib.rst:349 msgid "" "An abstract method for finding a :term:`spec ` for the " "specified module. The finder will search for the module only within the :" @@ -466,7 +502,7 @@ msgid "" "concrete ``PathEntryFinders``." msgstr "" -#: ../../library/importlib.rst:343 +#: ../../library/importlib.rst:361 msgid "" "A legacy method for finding a :term:`loader` for the specified module. " "Returns a 2-tuple of ``(loader, portion)`` where ``portion`` is a sequence " @@ -479,290 +515,206 @@ msgid "" "failure to find anything for the module)." msgstr "" -#: ../../library/importlib.rst:353 +#: ../../library/importlib.rst:371 msgid "" "If :meth:`find_spec` is defined then backwards-compatible functionality is " "provided." msgstr "" -#: ../../library/importlib.rst:356 +#: ../../library/importlib.rst:374 msgid "" "Returns ``(None, [])`` instead of raising :exc:`NotImplementedError`. Uses :" "meth:`find_spec` when available to provide functionality." msgstr "" -#: ../../library/importlib.rst:365 +#: ../../library/importlib.rst:383 msgid "" "A concrete implementation of :meth:`Finder.find_module` which is equivalent " "to ``self.find_loader(fullname)[0]``." msgstr "" -#: ../../library/importlib.rst:373 +#: ../../library/importlib.rst:391 msgid "" "An optional method which, when called, should invalidate any internal cache " "used by the finder. Used by :meth:`importlib.machinery.PathFinder." "invalidate_caches` when invalidating the caches of all cached finders." msgstr "" -#: ../../library/importlib.rst:381 +#: ../../library/importlib.rst:399 msgid "" "An abstract base class for a :term:`loader`. See :pep:`302` for the exact " "definition for a loader." msgstr "" -#: ../../library/importlib.rst:384 ../../library/importlib.rst:913 +#: ../../library/importlib.rst:402 msgid "" -"Loaders that wish to support resource reading should implement a " -"``get_resource_reader(fullname)`` method as specified by :class:`importlib." -"abc.ResourceReader`." +"Loaders that wish to support resource reading should implement a :meth:" +"`get_resource_reader` method as specified by :class:`importlib.resources.abc." +"ResourceReader`." msgstr "" -#: ../../library/importlib.rst:388 -msgid "Introduced the optional ``get_resource_reader()`` method." +#: ../../library/importlib.rst:406 +msgid "Introduced the optional :meth:`get_resource_reader` method." msgstr "" -#: ../../library/importlib.rst:393 +#: ../../library/importlib.rst:411 msgid "" "A method that returns the module object to use when importing a module. " "This method may return ``None``, indicating that default module creation " "semantics should take place." msgstr "" -#: ../../library/importlib.rst:399 -msgid "" -"Starting in Python 3.6, this method will not be optional when :meth:" -"`exec_module` is defined." +#: ../../library/importlib.rst:417 +msgid "This method is no longer optional when :meth:`exec_module` is defined." msgstr "" -#: ../../library/importlib.rst:405 +#: ../../library/importlib.rst:423 msgid "" "An abstract method that executes the module in its own namespace when a " "module is imported or reloaded. The module should already be initialized " -"when ``exec_module()`` is called. When this method exists, :meth:`~importlib." -"abc.Loader.create_module` must be defined." +"when :meth:`exec_module` is called. When this method exists, :meth:" +"`create_module` must be defined." msgstr "" -#: ../../library/importlib.rst:412 -msgid ":meth:`~importlib.abc.Loader.create_module` must also be defined." -msgstr ":meth:`~importlib.abc.Loader.create_module` 也必須被定義。" +#: ../../library/importlib.rst:430 +msgid ":meth:`create_module` must also be defined." +msgstr ":meth:`create_module` 也必須被定義。" -#: ../../library/importlib.rst:417 +#: ../../library/importlib.rst:435 msgid "" -"A legacy method for loading a module. If the module cannot be loaded, :exc:" +"A legacy method for loading a module. If the module cannot be loaded, :exc:" "`ImportError` is raised, otherwise the loaded module is returned." msgstr "" -#: ../../library/importlib.rst:421 +#: ../../library/importlib.rst:439 msgid "" "If the requested module already exists in :data:`sys.modules`, that module " "should be used and reloaded. Otherwise the loader should create a new module " "and insert it into :data:`sys.modules` before any loading begins, to prevent " -"recursion from the import. If the loader inserted a module and the load " +"recursion from the import. If the loader inserted a module and the load " "fails, it must be removed by the loader from :data:`sys.modules`; modules " "already in :data:`sys.modules` before the loader began execution should be " "left alone (see :func:`importlib.util.module_for_loader`)." msgstr "" -#: ../../library/importlib.rst:430 +#: ../../library/importlib.rst:448 msgid "" -"The loader should set several attributes on the module. (Note that some of " +"The loader should set several attributes on the module (note that some of " "these attributes can change when a module is reloaded):" msgstr "" -#: ../../library/importlib.rst:435 +#: ../../library/importlib.rst:454 msgid ":attr:`__name__`" msgstr ":attr:`__name__`" -#: ../../library/importlib.rst:435 -msgid "The name of the module." +#: ../../library/importlib.rst:453 +msgid "" +"The module's fully qualified name. It is ``'__main__'`` for an executed " +"module." msgstr "" -#: ../../library/importlib.rst:439 +#: ../../library/importlib.rst:459 msgid ":attr:`__file__`" msgstr ":attr:`__file__`" -#: ../../library/importlib.rst:438 +#: ../../library/importlib.rst:457 msgid "" -"The path to where the module data is stored (not set for built-in modules)." +"The location the :term:`loader` used to load the module. For example, for " +"modules loaded from a .py file this is the filename. It is not set on all " +"modules (e.g. built-in modules)." msgstr "" -#: ../../library/importlib.rst:443 +#: ../../library/importlib.rst:463 msgid ":attr:`__cached__`" msgstr ":attr:`__cached__`" -#: ../../library/importlib.rst:442 +#: ../../library/importlib.rst:462 msgid "" -"The path to where a compiled version of the module is/should be stored (not " -"set when the attribute would be inappropriate)." +"The filename of a compiled version of the module's code. It is not set on " +"all modules (e.g. built-in modules)." msgstr "" -#: ../../library/importlib.rst:447 +#: ../../library/importlib.rst:471 msgid ":attr:`__path__`" msgstr ":attr:`__path__`" -#: ../../library/importlib.rst:446 +#: ../../library/importlib.rst:466 msgid "" -"A list of strings specifying the search path within a package. This " -"attribute is not set on modules." +"The list of locations where the package's submodules will be found. Most of " +"the time this is a single directory. The import system passes this attribute " +"to ``__import__()`` and to finders in the same way as :attr:`sys.path` but " +"just for the package. It is not set on non-package modules so it can be used " +"as an indicator that the module is a package." msgstr "" -#: ../../library/importlib.rst:454 +#: ../../library/importlib.rst:476 msgid ":attr:`__package__`" msgstr ":attr:`__package__`" -#: ../../library/importlib.rst:450 +#: ../../library/importlib.rst:474 msgid "" -"The fully qualified name of the package under which the module was loaded as " -"a submodule (or the empty string for top-level modules). For packages, it is " -"the same as :attr:`__name__`. The :func:`importlib.util.module_for_loader` " -"decorator can handle the details for :attr:`__package__`." +"The fully qualified name of the package the module is in (or the empty " +"string for a top-level module). If the module is a package then this is the " +"same as :attr:`__name__`." msgstr "" -#: ../../library/importlib.rst:459 +#: ../../library/importlib.rst:479 msgid ":attr:`__loader__`" msgstr ":attr:`__loader__`" -#: ../../library/importlib.rst:457 -msgid "" -"The loader used to load the module. The :func:`importlib.util." -"module_for_loader` decorator can handle the details for :attr:`__package__`." +#: ../../library/importlib.rst:479 +msgid "The :term:`loader` used to load the module." msgstr "" -#: ../../library/importlib.rst:461 +#: ../../library/importlib.rst:481 msgid "" "When :meth:`exec_module` is available then backwards-compatible " "functionality is provided." msgstr "" -#: ../../library/importlib.rst:464 +#: ../../library/importlib.rst:484 msgid "" -"Raise :exc:`ImportError` when called instead of :exc:`NotImplementedError`. " +"Raise :exc:`ImportError` when called instead of :exc:`NotImplementedError`. " "Functionality provided when :meth:`exec_module` is available." msgstr "" -#: ../../library/importlib.rst:469 +#: ../../library/importlib.rst:489 msgid "" "The recommended API for loading a module is :meth:`exec_module` (and :meth:" -"`create_module`). Loaders should implement it instead of load_module(). " -"The import machinery takes care of all the other responsibilities of " -"load_module() when exec_module() is implemented." +"`create_module`). Loaders should implement it instead of :meth:" +"`load_module`. The import machinery takes care of all the other " +"responsibilities of :meth:`load_module` when :meth:`exec_module` is " +"implemented." msgstr "" -#: ../../library/importlib.rst:478 +#: ../../library/importlib.rst:498 msgid "" "A legacy method which when implemented calculates and returns the given " -"module's repr, as a string. The module type's default repr() will use the " -"result of this method as appropriate." +"module's representation, as a string. The module type's default :meth:" +"`__repr__` will use the result of this method as appropriate." msgstr "" -#: ../../library/importlib.rst:484 +#: ../../library/importlib.rst:504 msgid "Made optional instead of an abstractmethod." msgstr "" -#: ../../library/importlib.rst:487 +#: ../../library/importlib.rst:507 msgid "The import machinery now takes care of this automatically." msgstr "" -#: ../../library/importlib.rst:493 -msgid "*Superseded by TraversableResources*" -msgstr "" - -#: ../../library/importlib.rst:495 -msgid "" -"An :term:`abstract base class` to provide the ability to read *resources*." -msgstr "" - -#: ../../library/importlib.rst:498 -msgid "" -"From the perspective of this ABC, a *resource* is a binary artifact that is " -"shipped within a package. Typically this is something like a data file that " -"lives next to the ``__init__.py`` file of the package. The purpose of this " -"class is to help abstract out the accessing of such data files so that it " -"does not matter if the package and its data file(s) are stored in a e.g. zip " -"file versus on the file system." -msgstr "" - -#: ../../library/importlib.rst:506 -msgid "" -"For any of methods of this class, a *resource* argument is expected to be a :" -"term:`path-like object` which represents conceptually just a file name. This " -"means that no subdirectory paths should be included in the *resource* " -"argument. This is because the location of the package the reader is for, " -"acts as the \"directory\". Hence the metaphor for directories and file names " -"is packages and resources, respectively. This is also why instances of this " -"class are expected to directly correlate to a specific package (instead of " -"potentially representing multiple packages or a module)." -msgstr "" - -#: ../../library/importlib.rst:517 -msgid "" -"Loaders that wish to support resource reading are expected to provide a " -"method called ``get_resource_reader(fullname)`` which returns an object " -"implementing this ABC's interface. If the module specified by fullname is " -"not a package, this method should return :const:`None`. An object compatible " -"with this ABC should only be returned when the specified module is a package." -msgstr "" - -#: ../../library/importlib.rst:528 -msgid "" -"Returns an opened, :term:`file-like object` for binary reading of the " -"*resource*." -msgstr "" - -#: ../../library/importlib.rst:531 -msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." -msgstr "" - -#: ../../library/importlib.rst:536 -msgid "Returns the file system path to the *resource*." -msgstr "" - -#: ../../library/importlib.rst:538 -msgid "" -"If the resource does not concretely exist on the file system, raise :exc:" -"`FileNotFoundError`." -msgstr "" - -#: ../../library/importlib.rst:543 -msgid "" -"Returns ``True`` if the named *name* is considered a resource. :exc:" -"`FileNotFoundError` is raised if *name* does not exist." -msgstr "" - -#: ../../library/importlib.rst:548 -msgid "" -"Returns an :term:`iterable` of strings over the contents of the package. Do " -"note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for which :meth:" -"`is_resource` would be false." -msgstr "" - -#: ../../library/importlib.rst:554 -msgid "" -"Allowing non-resource names to be returned is to allow for situations where " -"how a package and its resources are stored are known a priori and the non-" -"resource names would be useful. For instance, returning subdirectory names " -"is allowed so that when it is known that the package and resources are " -"stored on the file system then those subdirectory names can be used directly." -msgstr "" - -#: ../../library/importlib.rst:562 -msgid "The abstract method returns an iterable of no items." -msgstr "" - -#: ../../library/importlib.rst:567 +#: ../../library/importlib.rst:513 msgid "" "An abstract base class for a :term:`loader` which implements the optional :" "pep:`302` protocol for loading arbitrary resources from the storage back-end." msgstr "" -#: ../../library/importlib.rst:571 +#: ../../library/importlib.rst:517 msgid "" "This ABC is deprecated in favour of supporting resource loading through :" -"class:`importlib.abc.ResourceReader`." +"class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.rst:577 +#: ../../library/importlib.rst:523 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " @@ -772,34 +724,34 @@ msgid "" "attribute or an item from a package's :attr:`__path__`." msgstr "" -#: ../../library/importlib.rst:585 +#: ../../library/importlib.rst:531 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:591 +#: ../../library/importlib.rst:537 msgid "" "An abstract base class for a :term:`loader` which implements the optional :" "pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:596 +#: ../../library/importlib.rst:542 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:602 +#: ../../library/importlib.rst:548 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:608 +#: ../../library/importlib.rst:554 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:613 +#: ../../library/importlib.rst:559 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -808,23 +760,23 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:619 ../../library/importlib.rst:628 -#: ../../library/importlib.rst:678 +#: ../../library/importlib.rst:565 ../../library/importlib.rst:574 +#: ../../library/importlib.rst:624 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:624 +#: ../../library/importlib.rst:570 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:633 +#: ../../library/importlib.rst:579 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:635 +#: ../../library/importlib.rst:581 msgid "" "The *data* argument can be whatever the :func:`compile` function supports (i." "e. string or bytes). The *path* argument should be the \"path\" to where the " @@ -832,106 +784,106 @@ msgid "" "in a zip file)." msgstr "" -#: ../../library/importlib.rst:640 +#: ../../library/importlib.rst:586 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:645 +#: ../../library/importlib.rst:591 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:650 +#: ../../library/importlib.rst:596 msgid "Implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:656 +#: ../../library/importlib.rst:602 msgid "Implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:658 +#: ../../library/importlib.rst:604 msgid "use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:664 +#: ../../library/importlib.rst:610 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:670 +#: ../../library/importlib.rst:616 msgid "" "An abstract method that is to return the value of :attr:`__file__` for the " "specified module. If no path is available, :exc:`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:674 +#: ../../library/importlib.rst:620 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:684 +#: ../../library/importlib.rst:630 msgid "" "An abstract base class which inherits from :class:`ResourceLoader` and :" "class:`ExecutionLoader`, providing concrete implementations of :meth:" "`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:688 +#: ../../library/importlib.rst:634 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:695 +#: ../../library/importlib.rst:641 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:699 +#: ../../library/importlib.rst:645 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:703 +#: ../../library/importlib.rst:649 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:705 +#: ../../library/importlib.rst:651 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:710 ../../library/importlib.rst:1394 +#: ../../library/importlib.rst:656 ../../library/importlib.rst:1104 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:714 +#: ../../library/importlib.rst:660 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:719 +#: ../../library/importlib.rst:665 msgid "" "An abstract base class for implementing source (and optionally bytecode) " "file loading. The class inherits from both :class:`ResourceLoader` and :" "class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:723 +#: ../../library/importlib.rst:669 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:726 +#: ../../library/importlib.rst:672 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:725 +#: ../../library/importlib.rst:671 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:728 +#: ../../library/importlib.rst:674 msgid "" "The abstract methods defined by this class are to add optional bytecode file " "support. Not implementing these optional methods (or causing them to raise :" @@ -943,83 +895,83 @@ msgid "" "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:739 +#: ../../library/importlib.rst:685 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:742 +#: ../../library/importlib.rst:688 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:744 +#: ../../library/importlib.rst:690 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:746 +#: ../../library/importlib.rst:692 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:751 ../../library/importlib.rst:764 +#: ../../library/importlib.rst:697 ../../library/importlib.rst:710 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:756 +#: ../../library/importlib.rst:702 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:759 +#: ../../library/importlib.rst:705 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:769 +#: ../../library/importlib.rst:715 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:773 +#: ../../library/importlib.rst:719 msgid "" "When writing to the path fails because the path is read-only (:attr:`errno." "EACCES`/:exc:`PermissionError`), do not propagate the exception." msgstr "" -#: ../../library/importlib.rst:777 +#: ../../library/importlib.rst:723 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:782 +#: ../../library/importlib.rst:728 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:786 +#: ../../library/importlib.rst:732 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:792 +#: ../../library/importlib.rst:738 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:794 +#: ../../library/importlib.rst:740 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:799 +#: ../../library/importlib.rst:745 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:803 +#: ../../library/importlib.rst:749 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " "determined to be a package if its file path (as provided by :meth:" @@ -1028,323 +980,59 @@ msgid "" "``__init__``." msgstr "" -#: ../../library/importlib.rst:812 -msgid "" -"An object with a subset of pathlib.Path methods suitable for traversing " -"directories and opening files." -msgstr "" - -#: ../../library/importlib.rst:819 -msgid "The base name of this object without any parent references." -msgstr "" - -#: ../../library/importlib.rst:823 -msgid "Yield Traversable objects in self." -msgstr "" - -#: ../../library/importlib.rst:827 -msgid "Return True if self is a directory." -msgstr "" - -#: ../../library/importlib.rst:831 -msgid "Return True if self is a file." -msgstr "" - -#: ../../library/importlib.rst:835 ../../library/importlib.rst:839 -msgid "Return Traversable child in self." -msgstr "" - -#: ../../library/importlib.rst:843 -msgid "" -"*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " -"suitable for reading (same as :attr:`pathlib.Path.open`)." -msgstr "" - -#: ../../library/importlib.rst:846 -msgid "" -"When opening as text, accepts encoding parameters such as those accepted by :" -"attr:`io.TextIOWrapper`." -msgstr "" - -#: ../../library/importlib.rst:851 -msgid "Read contents of self as bytes." -msgstr "" - -#: ../../library/importlib.rst:855 -msgid "Read contents of self as text." -msgstr "" - -#: ../../library/importlib.rst:857 ../../library/importlib.rst:873 -msgid "" -"Note: In Python 3.11 and later, this class is found in ``importlib.resources." -"abc``." -msgstr "" - -#: ../../library/importlib.rst:862 -msgid "" -"An abstract base class for resource readers capable of serving the ``files`` " -"interface. Subclasses ResourceReader and provides concrete implementations " -"of the ResourceReader's abstract methods. Therefore, any loader supplying " -"TraversableReader also supplies ResourceReader." -msgstr "" - -#: ../../library/importlib.rst:868 -msgid "" -"Loaders that wish to support resource reading are expected to implement this " -"interface." -msgstr "" - -#: ../../library/importlib.rst:877 -msgid ":mod:`importlib.resources` -- Resources" -msgstr "" - -#: ../../library/importlib.rst:882 -msgid "**Source code:** :source:`Lib/importlib/resources.py`" -msgstr "**原始碼:**\\ :source:`Lib/importlib/resources.py`" - -#: ../../library/importlib.rst:888 -msgid "" -"This module leverages Python's import system to provide access to " -"*resources* within *packages*. If you can import a package, you can access " -"resources within that package. Resources can be opened or read, in either " -"binary or text mode." -msgstr "" - -#: ../../library/importlib.rst:893 -msgid "" -"Resources are roughly akin to files inside directories, though it's " -"important to keep in mind that this is just a metaphor. Resources and " -"packages **do not** have to exist as physical files and directories on the " -"file system." -msgstr "" - -#: ../../library/importlib.rst:899 -msgid "" -"This module provides functionality similar to `pkg_resources `_ `Basic Resource " -"Access `_ without the performance overhead of that package. This " -"makes reading resources included in packages easier, with more stable and " -"consistent semantics." -msgstr "" - -#: ../../library/importlib.rst:907 -msgid "" -"The standalone backport of this module provides more information on `using " -"importlib.resources `_ and `migrating from pkg_resources to importlib.resources " -"`_." -msgstr "" - -#: ../../library/importlib.rst:917 -msgid "The following types are defined." -msgstr "" - -#: ../../library/importlib.rst:921 -msgid "" -"The ``Package`` type is defined as ``Union[str, ModuleType]``. This means " -"that where the function describes accepting a ``Package``, you can pass in " -"either a string or a module. Module objects must have a resolvable " -"``__spec__.submodule_search_locations`` that is not ``None``." -msgstr "" - -#: ../../library/importlib.rst:928 -msgid "" -"This type describes the resource names passed into the various functions in " -"this package. This is defined as ``Union[str, os.PathLike]``." -msgstr "" - -#: ../../library/importlib.rst:932 -msgid "The following functions are available." -msgstr "" - -#: ../../library/importlib.rst:937 -msgid "" -"Returns an :class:`importlib.abc.Traversable` object representing the " -"resource container for the package (think directory) and its resources " -"(think files). A Traversable may contain other containers (think " -"subdirectories)." -msgstr "" - -#: ../../library/importlib.rst:942 ../../library/importlib.rst:1043 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements." -msgstr "" - -#: ../../library/importlib.rst:949 -msgid "" -"Given a :class:`importlib.abc.Traversable` object representing a file, " -"typically from :func:`importlib.resources.files`, return a context manager " -"for use in a :keyword:`with` statement. The context manager provides a :" -"class:`pathlib.Path` object." -msgstr "" - -#: ../../library/importlib.rst:954 -msgid "" -"Exiting the context manager cleans up any temporary file created when the " -"resource was extracted from e.g. a zip file." -msgstr "" - -#: ../../library/importlib.rst:957 -msgid "" -"Use ``as_file`` when the Traversable methods (``read_text``, etc) are " -"insufficient and an actual file on the file system is required." -msgstr "" - -#: ../../library/importlib.rst:965 -msgid "Open for binary reading the *resource* within *package*." -msgstr "" - -#: ../../library/importlib.rst:967 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). This function returns a ``typing." -"BinaryIO`` instance, a binary I/O stream open for reading." -msgstr "" - -#: ../../library/importlib.rst:976 -msgid "" -"Open for text reading the *resource* within *package*. By default, the " -"resource is opened for reading as UTF-8." -msgstr "" - -#: ../../library/importlib.rst:979 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " -"same meaning as with built-in :func:`open`." -msgstr "" - -#: ../../library/importlib.rst:985 -msgid "" -"This function returns a ``typing.TextIO`` instance, a text I/O stream open " -"for reading." -msgstr "" - -#: ../../library/importlib.rst:991 -msgid "" -"Read and return the contents of the *resource* within *package* as ``bytes``." -msgstr "" - -#: ../../library/importlib.rst:994 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). This function returns the " -"contents of the resource as :class:`bytes`." -msgstr "" - -#: ../../library/importlib.rst:1003 -msgid "" -"Read and return the contents of *resource* within *package* as a ``str``. By " -"default, the contents are read as strict UTF-8." -msgstr "" - -#: ../../library/importlib.rst:1006 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " -"same meaning as with built-in :func:`open`. This function returns the " -"contents of the resource as :class:`str`." -msgstr "" - -#: ../../library/importlib.rst:1016 -msgid "" -"Return the path to the *resource* as an actual file system path. This " -"function returns a context manager for use in a :keyword:`with` statement. " -"The context manager provides a :class:`pathlib.Path` object." -msgstr "" - -#: ../../library/importlib.rst:1020 -msgid "" -"Exiting the context manager cleans up any temporary file created when the " -"resource needs to be extracted from e.g. a zip file." -msgstr "" - -#: ../../library/importlib.rst:1023 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory)." -msgstr "" - -#: ../../library/importlib.rst:1031 -msgid "" -"Return ``True`` if there is a resource named *name* in the package, " -"otherwise ``False``. Remember that directories are *not* resources! " -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements." -msgstr "" - -#: ../../library/importlib.rst:1039 -msgid "" -"Return an iterable over the named items within the package. The iterable " -"returns :class:`str` resources (e.g. files) and non-resources (e.g. " -"directories). The iterable does not recurse into subdirectories." -msgstr "" - -#: ../../library/importlib.rst:1048 +#: ../../library/importlib.rst:758 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:1053 +#: ../../library/importlib.rst:763 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:1057 +#: ../../library/importlib.rst:767 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:1062 +#: ../../library/importlib.rst:772 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:1069 +#: ../../library/importlib.rst:779 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:1074 ../../library/importlib.rst:1084 +#: ../../library/importlib.rst:784 ../../library/importlib.rst:794 msgid "Use :attr:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:1079 +#: ../../library/importlib.rst:789 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:1089 +#: ../../library/importlib.rst:799 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:1094 +#: ../../library/importlib.rst:804 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:1099 +#: ../../library/importlib.rst:809 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:1106 +#: ../../library/importlib.rst:816 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " @@ -1353,57 +1041,57 @@ msgid "" "`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:1117 +#: ../../library/importlib.rst:827 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " "listed in :data:`sys.builtin_module_names`. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:1122 ../../library/importlib.rst:1136 -#: ../../library/importlib.rst:1149 ../../library/importlib.rst:1164 +#: ../../library/importlib.rst:832 ../../library/importlib.rst:846 +#: ../../library/importlib.rst:859 ../../library/importlib.rst:874 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:1125 +#: ../../library/importlib.rst:835 msgid "" "As part of :pep:`489`, the builtin importer now implements :meth:`Loader." "create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:1132 +#: ../../library/importlib.rst:842 msgid "" "An :term:`importer` for frozen modules. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:1139 +#: ../../library/importlib.rst:849 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:1146 +#: ../../library/importlib.rst:856 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:1154 +#: ../../library/importlib.rst:864 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:1161 +#: ../../library/importlib.rst:871 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:1169 +#: ../../library/importlib.rst:879 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " @@ -1417,47 +1105,47 @@ msgid "" "cache and returned." msgstr "" -#: ../../library/importlib.rst:1183 +#: ../../library/importlib.rst:893 msgid "" "If the current working directory -- represented by an empty string -- is no " "longer valid then ``None`` is returned but no value is cached in :data:`sys." "path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:1190 +#: ../../library/importlib.rst:900 msgid "A legacy wrapper around :meth:`find_spec`." msgstr "" -#: ../../library/importlib.rst:1197 +#: ../../library/importlib.rst:907 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:1202 +#: ../../library/importlib.rst:912 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:1205 +#: ../../library/importlib.rst:915 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:1212 +#: ../../library/importlib.rst:922 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:1215 +#: ../../library/importlib.rst:925 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:1218 +#: ../../library/importlib.rst:928 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1465,7 +1153,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:1223 +#: ../../library/importlib.rst:933 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1478,255 +1166,278 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:1237 +#: ../../library/importlib.rst:947 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:1241 +#: ../../library/importlib.rst:951 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1247 +#: ../../library/importlib.rst:957 msgid "Attempt to find the loader to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1254 +#: ../../library/importlib.rst:964 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:1258 +#: ../../library/importlib.rst:968 msgid "" "A class method which returns a closure for use on :attr:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:1263 +#: ../../library/importlib.rst:973 msgid "" "If the argument to the closure is not an existing directory, :exc:" "`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:1269 +#: ../../library/importlib.rst:979 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:1277 +#: ../../library/importlib.rst:987 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1281 +#: ../../library/importlib.rst:991 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1285 +#: ../../library/importlib.rst:995 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1289 +#: ../../library/importlib.rst:999 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1293 +#: ../../library/importlib.rst:1003 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1297 ../../library/importlib.rst:1340 +#: ../../library/importlib.rst:1007 ../../library/importlib.rst:1050 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1302 ../../library/importlib.rst:1345 +#: ../../library/importlib.rst:1012 ../../library/importlib.rst:1055 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1307 +#: ../../library/importlib.rst:1017 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1310 +#: ../../library/importlib.rst:1020 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1319 +#: ../../library/importlib.rst:1029 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1323 +#: ../../library/importlib.rst:1033 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1327 +#: ../../library/importlib.rst:1037 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1331 +#: ../../library/importlib.rst:1041 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1335 +#: ../../library/importlib.rst:1045 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1350 +#: ../../library/importlib.rst:1060 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1353 +#: ../../library/importlib.rst:1063 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1360 +#: ../../library/importlib.rst:1070 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1364 +#: ../../library/importlib.rst:1074 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1368 +#: ../../library/importlib.rst:1078 msgid "" "Creates the module object from the given specification in accordance with :" "pep:`489`." msgstr "" -#: ../../library/importlib.rst:1375 +#: ../../library/importlib.rst:1085 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1381 +#: ../../library/importlib.rst:1091 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " "based on :attr:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1386 +#: ../../library/importlib.rst:1096 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1390 +#: ../../library/importlib.rst:1100 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1401 +#: ../../library/importlib.rst:1111 +msgid "" +"A concrete implementation of :class:`importlib.abc.InspectLoader` for " +"namespace packages. This is an alias for a private class and is only made " +"public for introspecting the ``__loader__`` attribute on namespace packages::" +msgstr "" + +#: ../../library/importlib.rst:1129 msgid "" "A specification for a module's import-system-related state. This is " -"typically exposed as the module's ``__spec__`` attribute. In the " +"typically exposed as the module's :attr:`__spec__` attribute. In the " "descriptions below, the names in parentheses give the corresponding " -"attribute available directly on the module object. E.g. ``module.__spec__." -"origin == module.__file__``. Note however that while the *values* are " +"attribute available directly on the module object, e.g. ``module.__spec__." +"origin == module.__file__``. Note, however, that while the *values* are " "usually equivalent, they can differ since there is no synchronization " -"between the two objects. Thus it is possible to update the module's " -"``__path__`` at runtime, and this will not be automatically reflected in " -"``__spec__.submodule_search_locations``." +"between the two objects. For example, it is possible to update the " +"module's :attr:`__file__` at runtime and this will not be automatically " +"reflected in the module's :attr:`__spec__.origin`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1415 -msgid "(``__name__``)" -msgstr "(``__name__``)" +#: ../../library/importlib.rst:1143 +msgid "(:attr:`__name__`)" +msgstr "(:attr:`__name__`)" -#: ../../library/importlib.rst:1417 -msgid "A string for the fully qualified name of the module." +#: ../../library/importlib.rst:1145 +msgid "" +"The module's fully qualified name. The :term:`finder` should always set this " +"attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1421 -msgid "(``__loader__``)" -msgstr "(``__loader__``)" +#: ../../library/importlib.rst:1150 +msgid "(:attr:`__loader__`)" +msgstr "(:attr:`__loader__`)" -#: ../../library/importlib.rst:1423 +#: ../../library/importlib.rst:1152 msgid "" -"The :term:`Loader ` that should be used when loading the module. :" -"term:`Finders ` should always set this." +"The :term:`loader` used to load the module. The :term:`finder` should always " +"set this attribute." msgstr "" -#: ../../library/importlib.rst:1428 -msgid "(``__file__``)" -msgstr "(``__file__``)" +#: ../../library/importlib.rst:1157 +msgid "(:attr:`__file__`)" +msgstr "(:attr:`__file__`)" -#: ../../library/importlib.rst:1430 +#: ../../library/importlib.rst:1159 msgid "" -"Name of the place from which the module is loaded, e.g. \"builtin\" for " -"built-in modules and the filename for modules loaded from source. Normally " -"\"origin\" should be set, but it may be ``None`` (the default) which " -"indicates it is unspecified (e.g. for namespace packages)." +"The location the :term:`loader` should use to load the module. For example, " +"for modules loaded from a .py file this is the filename. The :term:`finder` " +"should always set this attribute to a meaningful value for the :term:" +"`loader` to use. In the uncommon case that there is not one (like for " +"namespace packages), it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1437 -msgid "(``__path__``)" -msgstr "(``__path__``)" +#: ../../library/importlib.rst:1167 +msgid "(:attr:`__path__`)" +msgstr "(:attr:`__path__`)" -#: ../../library/importlib.rst:1439 +#: ../../library/importlib.rst:1169 msgid "" -"List of strings for where to find submodules, if a package (``None`` " -"otherwise)." +"The list of locations where the package's submodules will be found. Most of " +"the time this is a single directory. The :term:`finder` should set this " +"attribute to a list, even an empty one, to indicate to the import system " +"that the module is a package. It should be set to ``None`` for non-package " +"modules. It is set automatically later to a special object for namespace " +"packages." msgstr "" -#: ../../library/importlib.rst:1444 +#: ../../library/importlib.rst:1178 msgid "" -"Container of extra module-specific data for use during loading (or ``None``)." +"The :term:`finder` may set this attribute to an object containing " +"additional, module-specific data to use when loading the module. Otherwise " +"it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1449 -msgid "(``__cached__``)" -msgstr "(``__cached__``)" +#: ../../library/importlib.rst:1184 +msgid "(:attr:`__cached__`)" +msgstr "(:attr:`__cached__`)" -#: ../../library/importlib.rst:1451 -msgid "String for where the compiled module should be stored (or ``None``)." +#: ../../library/importlib.rst:1186 +msgid "" +"The filename of a compiled version of the module's code. The :term:`finder` " +"should always set this attribute but it may be ``None`` for modules that do " +"not need compiled code stored." msgstr "" -#: ../../library/importlib.rst:1455 -msgid "(``__package__``)" -msgstr "(``__package__``)" +#: ../../library/importlib.rst:1192 +msgid "(:attr:`__package__`)" +msgstr "(:attr:`__package__`)" -#: ../../library/importlib.rst:1457 +#: ../../library/importlib.rst:1194 msgid "" -"(Read-only) The fully qualified name of the package under which the module " -"should be loaded as a submodule (or the empty string for top-level modules). " -"For packages, it is the same as :attr:`__name__`." +"(Read-only) The fully qualified name of the package the module is in (or the " +"empty string for a top-level module). If the module is a package then this " +"is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1463 +#: ../../library/importlib.rst:1201 +msgid "``True`` if the spec's :attr:`origin` refers to a loadable location," +msgstr "" + +#: ../../library/importlib.rst:1201 msgid "" -"Boolean indicating whether or not the module's \"origin\" attribute refers " -"to a loadable location." +"``False`` otherwise. This value impacts how :attr:`origin` is interpreted " +"and how the module's :attr:`__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1467 +#: ../../library/importlib.rst:1206 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1473 +#: ../../library/importlib.rst:1212 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1477 +#: ../../library/importlib.rst:1216 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1482 +#: ../../library/importlib.rst:1221 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1489 +#: ../../library/importlib.rst:1228 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1736,7 +1447,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1496 +#: ../../library/importlib.rst:1235 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1749,7 +1460,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1506 +#: ../../library/importlib.rst:1245 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1758,18 +1469,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1514 +#: ../../library/importlib.rst:1253 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1518 ../../library/importlib.rst:1534 -#: ../../library/importlib.rst:1683 +#: ../../library/importlib.rst:1257 ../../library/importlib.rst:1273 +#: ../../library/importlib.rst:1423 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1524 +#: ../../library/importlib.rst:1263 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1779,39 +1490,39 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1539 +#: ../../library/importlib.rst:1278 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1547 +#: ../../library/importlib.rst:1286 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1549 +#: ../../library/importlib.rst:1288 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1554 +#: ../../library/importlib.rst:1293 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" -"`ImportError` is also raised a relative name would escape its containing " +"`ImportError` is also raised if a relative name would escape its containing " "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1561 +#: ../../library/importlib.rst:1301 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1568 +#: ../../library/importlib.rst:1308 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :attr:`sys.modules`, then " @@ -1821,30 +1532,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1575 +#: ../../library/importlib.rst:1315 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1578 +#: ../../library/importlib.rst:1318 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1582 +#: ../../library/importlib.rst:1322 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1589 +#: ../../library/importlib.rst:1329 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1592 +#: ../../library/importlib.rst:1332 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1852,14 +1563,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1597 +#: ../../library/importlib.rst:1337 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1605 +#: ../../library/importlib.rst:1345 msgid "" "A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to handle " "selecting the proper module object to load with. The decorated method is " @@ -1869,7 +1580,7 @@ msgid "" "work on static methods because of the assumption of two arguments." msgstr "" -#: ../../library/importlib.rst:1614 +#: ../../library/importlib.rst:1354 msgid "" "The decorated method will take in the **name** of the module to be loaded as " "expected for a :term:`loader`. If the module is not found in :data:`sys." @@ -1879,7 +1590,7 @@ msgid "" "available). These attributes are set unconditionally to support reloading." msgstr "" -#: ../../library/importlib.rst:1622 +#: ../../library/importlib.rst:1362 msgid "" "If an exception is raised by the decorated method and a module was added to :" "data:`sys.modules`, then the module will be removed to prevent a partially " @@ -1887,25 +1598,25 @@ msgid "" "was already in :data:`sys.modules` then it is left alone." msgstr "" -#: ../../library/importlib.rst:1627 +#: ../../library/importlib.rst:1367 msgid "" ":attr:`__loader__` and :attr:`__package__` are automatically set (when " "possible)." msgstr "" -#: ../../library/importlib.rst:1631 +#: ../../library/importlib.rst:1371 msgid "" "Set :attr:`__name__`, :attr:`__loader__` :attr:`__package__` unconditionally " "to support reloading." msgstr "" -#: ../../library/importlib.rst:1635 +#: ../../library/importlib.rst:1375 msgid "" "The import machinery now directly performs all the functionality provided by " "this function." msgstr "" -#: ../../library/importlib.rst:1641 +#: ../../library/importlib.rst:1381 msgid "" "A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to set the :" "attr:`__loader__` attribute on the returned module. If the attribute is " @@ -1914,23 +1625,23 @@ msgid "" "`__loader__` should be set to." msgstr "" -#: ../../library/importlib.rst:1648 +#: ../../library/importlib.rst:1388 msgid "" "Set ``__loader__`` if set to ``None``, as if the attribute does not exist." msgstr "" -#: ../../library/importlib.rst:1652 ../../library/importlib.rst:1661 +#: ../../library/importlib.rst:1392 ../../library/importlib.rst:1401 msgid "The import machinery takes care of this automatically." msgstr "" -#: ../../library/importlib.rst:1657 +#: ../../library/importlib.rst:1397 msgid "" "A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to set the :" "attr:`__package__` attribute on the returned module. If :attr:`__package__` " "is set and has a value other than ``None`` it will not be changed." msgstr "" -#: ../../library/importlib.rst:1666 +#: ../../library/importlib.rst:1406 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1939,7 +1650,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1676 +#: ../../library/importlib.rst:1416 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1947,20 +1658,20 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1688 +#: ../../library/importlib.rst:1428 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1696 +#: ../../library/importlib.rst:1436 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1699 +#: ../../library/importlib.rst:1439 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1973,7 +1684,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1710 +#: ../../library/importlib.rst:1450 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1982,72 +1693,70 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1718 +#: ../../library/importlib.rst:1458 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1725 +#: ../../library/importlib.rst:1465 msgid "" "A static method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1738 +#: ../../library/importlib.rst:1478 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1741 +#: ../../library/importlib.rst:1481 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1743 +#: ../../library/importlib.rst:1483 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1752 +#: ../../library/importlib.rst:1492 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1754 +#: ../../library/importlib.rst:1494 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1757 +#: ../../library/importlib.rst:1497 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1780 +#: ../../library/importlib.rst:1520 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1782 -msgid "" -"To import a Python source file directly, use the following recipe (Python " -"3.5 and newer only)::" +#: ../../library/importlib.rst:1522 +msgid "To import a Python source file directly, use the following recipe::" msgstr "" -#: ../../library/importlib.rst:1800 +#: ../../library/importlib.rst:1539 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1802 +#: ../../library/importlib.rst:1541 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1824 +#: ../../library/importlib.rst:1563 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1826 +#: ../../library/importlib.rst:1565 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -2061,16 +1770,35 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1858 +#: ../../library/importlib.rst:1597 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1860 +#: ../../library/importlib.rst:1599 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " "illustrate the various APIs that importlib exposes by providing an " -"approximate implementation of :func:`importlib.import_module` (Python 3.4 " -"and newer for the importlib usage, Python 3.6 and newer for other parts of " -"the code). ::" +"approximate implementation of :func:`importlib.import_module`::" msgstr "" + +#~ msgid "**Source code:** :source:`Lib/importlib/resources.py`" +#~ msgstr "**原始碼:**\\ :source:`Lib/importlib/resources.py`" + +#~ msgid "(``__name__``)" +#~ msgstr "(``__name__``)" + +#~ msgid "(``__loader__``)" +#~ msgstr "(``__loader__``)" + +#~ msgid "(``__file__``)" +#~ msgstr "(``__file__``)" + +#~ msgid "(``__path__``)" +#~ msgstr "(``__path__``)" + +#~ msgid "(``__cached__``)" +#~ msgstr "(``__cached__``)" + +#~ msgid "(``__package__``)" +#~ msgstr "(``__package__``)" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po new file mode 100644 index 0000000000..0735b31e4a --- /dev/null +++ b/library/importlib.resources.abc.po @@ -0,0 +1,182 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/importlib.resources.abc.rst:2 +msgid ":mod:`importlib.resources.abc` -- Abstract base classes for resources" +msgstr "" + +#: ../../library/importlib.resources.abc.rst:7 +msgid "**Source code:** :source:`Lib/importlib/resources/abc.py`" +msgstr "**原始碼:**\\ :source:`Lib/importlib/resources/abc.py`" + +#: ../../library/importlib.resources.abc.rst:15 +msgid "*Superseded by TraversableResources*" +msgstr "" + +#: ../../library/importlib.resources.abc.rst:17 +msgid "" +"An :term:`abstract base class` to provide the ability to read *resources*." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:20 +msgid "" +"From the perspective of this ABC, a *resource* is a binary artifact that is " +"shipped within a package. Typically this is something like a data file that " +"lives next to the ``__init__.py`` file of the package. The purpose of this " +"class is to help abstract out the accessing of such data files so that it " +"does not matter if the package and its data file(s) are stored in a e.g. zip " +"file versus on the file system." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:28 +msgid "" +"For any of methods of this class, a *resource* argument is expected to be a :" +"term:`path-like object` which represents conceptually just a file name. This " +"means that no subdirectory paths should be included in the *resource* " +"argument. This is because the location of the package the reader is for, " +"acts as the \"directory\". Hence the metaphor for directories and file names " +"is packages and resources, respectively. This is also why instances of this " +"class are expected to directly correlate to a specific package (instead of " +"potentially representing multiple packages or a module)." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:39 +msgid "" +"Loaders that wish to support resource reading are expected to provide a " +"method called ``get_resource_reader(fullname)`` which returns an object " +"implementing this ABC's interface. If the module specified by fullname is " +"not a package, this method should return :const:`None`. An object compatible " +"with this ABC should only be returned when the specified module is a package." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:50 +msgid "" +"Returns an opened, :term:`file-like object` for binary reading of the " +"*resource*." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:53 +msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:58 +msgid "Returns the file system path to the *resource*." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:60 +msgid "" +"If the resource does not concretely exist on the file system, raise :exc:" +"`FileNotFoundError`." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:65 +msgid "" +"Returns ``True`` if the named *name* is considered a resource. :exc:" +"`FileNotFoundError` is raised if *name* does not exist." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:70 +msgid "" +"Returns an :term:`iterable` of strings over the contents of the package. Do " +"note that it is not required that all names returned by the iterator be " +"actual resources, e.g. it is acceptable to return names for which :meth:" +"`is_resource` would be false." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:76 +msgid "" +"Allowing non-resource names to be returned is to allow for situations where " +"how a package and its resources are stored are known a priori and the non-" +"resource names would be useful. For instance, returning subdirectory names " +"is allowed so that when it is known that the package and resources are " +"stored on the file system then those subdirectory names can be used directly." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:84 +msgid "The abstract method returns an iterable of no items." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:89 +msgid "" +"An object with a subset of pathlib.Path methods suitable for traversing " +"directories and opening files." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:96 +msgid "Abstract. The base name of this object without any parent references." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:100 +msgid "Yield Traversable objects in self." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:104 +msgid "Return True if self is a directory." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:108 +msgid "Return True if self is a file." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:112 +#: ../../library/importlib.resources.abc.rst:116 +msgid "Return Traversable child in self." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:120 +msgid "" +"*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " +"suitable for reading (same as :attr:`pathlib.Path.open`)." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:123 +msgid "" +"When opening as text, accepts encoding parameters such as those accepted by :" +"attr:`io.TextIOWrapper`." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:128 +msgid "Read contents of self as bytes." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:132 +msgid "Read contents of self as text." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:137 +msgid "" +"An abstract base class for resource readers capable of serving the :meth:" +"`importlib.resources.files` interface. Subclasses :class:`importlib." +"resources.abc.ResourceReader` and provides concrete implementations of the :" +"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " +"Therefore, any loader supplying :class:`importlib.abc.TraversableReader` " +"also supplies ResourceReader." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:144 +msgid "" +"Loaders that wish to support resource reading are expected to implement this " +"interface." +msgstr "" + +#: ../../library/importlib.resources.abc.rst:151 +msgid "" +"Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " +"package." +msgstr "" diff --git a/library/importlib.resources.po b/library/importlib.resources.po new file mode 100644 index 0000000000..a726bc3717 --- /dev/null +++ b/library/importlib.resources.po @@ -0,0 +1,255 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/importlib.resources.rst:2 +msgid ":mod:`importlib.resources` -- Resources" +msgstr "" + +#: ../../library/importlib.resources.rst:7 +msgid "**Source code:** :source:`Lib/importlib/resources/__init__.py`" +msgstr "**原始碼:**\\ :source:`Lib/importlib/resources/__init__.py`" + +#: ../../library/importlib.resources.rst:13 +msgid "" +"This module leverages Python's import system to provide access to " +"*resources* within *packages*. If you can import a package, you can access " +"resources within that package. Resources can be opened or read, in either " +"binary or text mode." +msgstr "" + +#: ../../library/importlib.resources.rst:18 +msgid "" +"Resources are roughly akin to files inside directories, though it's " +"important to keep in mind that this is just a metaphor. Resources and " +"packages **do not** have to exist as physical files and directories on the " +"file system: for example, a package and its resources can be imported from a " +"zip file using :py:mod:`zipimport`." +msgstr "" + +#: ../../library/importlib.resources.rst:26 +msgid "" +"This module provides functionality similar to `pkg_resources `_ `Basic Resource " +"Access `_ without the performance overhead of that package. This " +"makes reading resources included in packages easier, with more stable and " +"consistent semantics." +msgstr "" + +#: ../../library/importlib.resources.rst:34 +msgid "" +"The standalone backport of this module provides more information on `using " +"importlib.resources `_ and `migrating from pkg_resources to importlib.resources " +"`_." +msgstr "" + +#: ../../library/importlib.resources.rst:40 +msgid "" +":class:`Loaders ` that wish to support resource " +"reading should implement a ``get_resource_reader(fullname)`` method as " +"specified by :class:`importlib.resources.abc.ResourceReader`." +msgstr "" + +#: ../../library/importlib.resources.rst:46 +msgid "" +"Whenever a function accepts a ``Package`` argument, you can pass in either " +"a :class:`module object ` or a module name as a string. " +"You can only pass module objects whose ``__spec__." +"submodule_search_locations`` is not ``None``." +msgstr "" + +#: ../../library/importlib.resources.rst:51 +msgid "The ``Package`` type is defined as ``Union[str, ModuleType]``." +msgstr "" + +#: ../../library/importlib.resources.rst:55 +msgid "" +"Returns a :class:`~importlib.resources.abc.Traversable` object representing " +"the resource container for the package (think directory) and its resources " +"(think files). A Traversable may contain other containers (think " +"subdirectories)." +msgstr "" + +#: ../../library/importlib.resources.rst:60 +msgid "" +"*package* is either a name or a module object which conforms to the :data:" +"`Package` requirements." +msgstr "" + +#: ../../library/importlib.resources.rst:67 +msgid "" +"Given a :class:`~importlib.resources.abc.Traversable` object representing a " +"file, typically from :func:`importlib.resources.files`, return a context " +"manager for use in a :keyword:`with` statement. The context manager provides " +"a :class:`pathlib.Path` object." +msgstr "" + +#: ../../library/importlib.resources.rst:72 +msgid "" +"Exiting the context manager cleans up any temporary file created when the " +"resource was extracted from e.g. a zip file." +msgstr "" + +#: ../../library/importlib.resources.rst:75 +msgid "" +"Use ``as_file`` when the Traversable methods (``read_text``, etc) are " +"insufficient and an actual file on the file system is required." +msgstr "" + +#: ../../library/importlib.resources.rst:82 +msgid "Deprecated functions" +msgstr "已棄用函式" + +#: ../../library/importlib.resources.rst:84 +msgid "" +"An older, deprecated set of functions is still available, but is scheduled " +"for removal in a future version of Python. The main drawback of these " +"functions is that they do not support directories: they assume all resources " +"are located directly within a *package*." +msgstr "" + +#: ../../library/importlib.resources.rst:91 +msgid "" +"For *resource* arguments of the functions below, you can pass in the name of " +"a resource as a string or a :class:`path-like object `." +msgstr "" + +#: ../../library/importlib.resources.rst:95 +msgid "The ``Resource`` type is defined as ``Union[str, os.PathLike]``." +msgstr "" + +#: ../../library/importlib.resources.rst:99 +msgid "Open for binary reading the *resource* within *package*." +msgstr "" + +#: ../../library/importlib.resources.rst:101 +msgid "" +"*package* is either a name or a module object which conforms to the " +"``Package`` requirements. *resource* is the name of the resource to open " +"within *package*; it may not contain path separators and it may not have sub-" +"resources (i.e. it cannot be a directory). This function returns a ``typing." +"BinaryIO`` instance, a binary I/O stream open for reading." +msgstr "" + +#: ../../library/importlib.resources.rst:109 +#: ../../library/importlib.resources.rst:130 +#: ../../library/importlib.resources.rst:148 +#: ../../library/importlib.resources.rst:167 +#: ../../library/importlib.resources.rst:203 +#: ../../library/importlib.resources.rst:219 +msgid "Calls to this function can be replaced by::" +msgstr "" + +#: ../../library/importlib.resources.rst:116 +msgid "" +"Open for text reading the *resource* within *package*. By default, the " +"resource is opened for reading as UTF-8." +msgstr "" + +#: ../../library/importlib.resources.rst:119 +msgid "" +"*package* is either a name or a module object which conforms to the " +"``Package`` requirements. *resource* is the name of the resource to open " +"within *package*; it may not contain path separators and it may not have sub-" +"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " +"same meaning as with built-in :func:`open`." +msgstr "" + +#: ../../library/importlib.resources.rst:125 +msgid "" +"This function returns a ``typing.TextIO`` instance, a text I/O stream open " +"for reading." +msgstr "" + +#: ../../library/importlib.resources.rst:137 +msgid "" +"Read and return the contents of the *resource* within *package* as ``bytes``." +msgstr "" + +#: ../../library/importlib.resources.rst:140 +msgid "" +"*package* is either a name or a module object which conforms to the " +"``Package`` requirements. *resource* is the name of the resource to open " +"within *package*; it may not contain path separators and it may not have sub-" +"resources (i.e. it cannot be a directory). This function returns the " +"contents of the resource as :class:`bytes`." +msgstr "" + +#: ../../library/importlib.resources.rst:155 +msgid "" +"Read and return the contents of *resource* within *package* as a ``str``. By " +"default, the contents are read as strict UTF-8." +msgstr "" + +#: ../../library/importlib.resources.rst:158 +msgid "" +"*package* is either a name or a module object which conforms to the " +"``Package`` requirements. *resource* is the name of the resource to open " +"within *package*; it may not contain path separators and it may not have sub-" +"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " +"same meaning as with built-in :func:`open`. This function returns the " +"contents of the resource as :class:`str`." +msgstr "" + +#: ../../library/importlib.resources.rst:174 +msgid "" +"Return the path to the *resource* as an actual file system path. This " +"function returns a context manager for use in a :keyword:`with` statement. " +"The context manager provides a :class:`pathlib.Path` object." +msgstr "" + +#: ../../library/importlib.resources.rst:178 +msgid "" +"Exiting the context manager cleans up any temporary file created when the " +"resource needs to be extracted from e.g. a zip file." +msgstr "" + +#: ../../library/importlib.resources.rst:181 +msgid "" +"*package* is either a name or a module object which conforms to the " +"``Package`` requirements. *resource* is the name of the resource to open " +"within *package*; it may not contain path separators and it may not have sub-" +"resources (i.e. it cannot be a directory)." +msgstr "" + +#: ../../library/importlib.resources.rst:188 +msgid "Calls to this function can be replaced using :func:`as_file`::" +msgstr "" + +#: ../../library/importlib.resources.rst:195 +msgid "" +"Return ``True`` if there is a resource named *name* in the package, " +"otherwise ``False``. This function does not consider directories to be " +"resources. *package* is either a name or a module object which conforms to " +"the ``Package`` requirements." +msgstr "" + +#: ../../library/importlib.resources.rst:210 +msgid "" +"Return an iterable over the named items within the package. The iterable " +"returns :class:`str` resources (e.g. files) and non-resources (e.g. " +"directories). The iterable does not recurse into subdirectories." +msgstr "" + +#: ../../library/importlib.resources.rst:214 +msgid "" +"*package* is either a name or a module object which conforms to the " +"``Package`` requirements." +msgstr "" diff --git a/library/inspect.po b/library/inspect.po index c79292ed95..fdb3576ef7 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" -"PO-Revision-Date: 2018-05-23 16:04+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,6 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/inspect.rst:2 msgid ":mod:`inspect` --- Inspect live objects" @@ -74,13 +75,13 @@ msgstr "模組" #: ../../library/inspect.rst:43 ../../library/inspect.rst:48 #: ../../library/inspect.rst:58 ../../library/inspect.rst:76 -#: ../../library/inspect.rst:234 +#: ../../library/inspect.rst:238 msgid "__doc__" msgstr "__doc__" #: ../../library/inspect.rst:43 ../../library/inspect.rst:48 #: ../../library/inspect.rst:58 ../../library/inspect.rst:76 -#: ../../library/inspect.rst:234 +#: ../../library/inspect.rst:238 msgid "documentation string" msgstr "" @@ -97,8 +98,8 @@ msgid "class" msgstr "" #: ../../library/inspect.rst:50 ../../library/inspect.rst:60 -#: ../../library/inspect.rst:78 ../../library/inspect.rst:203 -#: ../../library/inspect.rst:217 ../../library/inspect.rst:236 +#: ../../library/inspect.rst:78 ../../library/inspect.rst:207 +#: ../../library/inspect.rst:221 ../../library/inspect.rst:240 msgid "__name__" msgstr "__name__" @@ -107,14 +108,14 @@ msgid "name with which this class was defined" msgstr "" #: ../../library/inspect.rst:53 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:205 -#: ../../library/inspect.rst:219 ../../library/inspect.rst:239 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:209 +#: ../../library/inspect.rst:223 ../../library/inspect.rst:243 msgid "__qualname__" msgstr "__qualname__" #: ../../library/inspect.rst:53 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:205 -#: ../../library/inspect.rst:219 ../../library/inspect.rst:239 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:209 +#: ../../library/inspect.rst:223 ../../library/inspect.rst:243 msgid "qualified name" msgstr "" @@ -143,7 +144,7 @@ msgstr "__func__" msgid "function object containing implementation of method" msgstr "" -#: ../../library/inspect.rst:69 ../../library/inspect.rst:241 +#: ../../library/inspect.rst:69 ../../library/inspect.rst:245 msgid "__self__" msgstr "__self__" @@ -253,8 +254,8 @@ msgstr "tb_next" msgid "next inner traceback object (called by this level)" msgstr "" -#: ../../library/inspect.rst:122 ../../library/inspect.rst:207 -#: ../../library/inspect.rst:224 +#: ../../library/inspect.rst:122 ../../library/inspect.rst:211 +#: ../../library/inspect.rst:228 msgid "frame" msgstr "" @@ -314,8 +315,8 @@ msgstr "f_trace" msgid "tracing function for this frame, or ``None``" msgstr "" -#: ../../library/inspect.rst:146 ../../library/inspect.rst:211 -#: ../../library/inspect.rst:228 +#: ../../library/inspect.rst:146 ../../library/inspect.rst:215 +#: ../../library/inspect.rst:232 msgid "code" msgstr "" @@ -419,136 +420,144 @@ msgid "name with which this code object was defined" msgstr "" #: ../../library/inspect.rst:190 +msgid "co_qualname" +msgstr "co_qualname" + +#: ../../library/inspect.rst:190 +msgid "fully qualified name with which this code object was defined" +msgstr "" + +#: ../../library/inspect.rst:194 msgid "co_names" msgstr "co_names" -#: ../../library/inspect.rst:190 +#: ../../library/inspect.rst:194 msgid "tuple of names other than arguments and function locals" msgstr "" -#: ../../library/inspect.rst:194 +#: ../../library/inspect.rst:198 msgid "co_nlocals" msgstr "co_nlocals" -#: ../../library/inspect.rst:194 +#: ../../library/inspect.rst:198 msgid "number of local variables" msgstr "" -#: ../../library/inspect.rst:196 +#: ../../library/inspect.rst:200 msgid "co_stacksize" msgstr "co_stacksize" -#: ../../library/inspect.rst:196 +#: ../../library/inspect.rst:200 msgid "virtual machine stack space required" msgstr "" -#: ../../library/inspect.rst:199 +#: ../../library/inspect.rst:203 msgid "co_varnames" msgstr "co_varnames" -#: ../../library/inspect.rst:199 +#: ../../library/inspect.rst:203 msgid "tuple of names of arguments and local variables" msgstr "" -#: ../../library/inspect.rst:203 +#: ../../library/inspect.rst:207 msgid "generator" msgstr "" -#: ../../library/inspect.rst:203 ../../library/inspect.rst:217 +#: ../../library/inspect.rst:207 ../../library/inspect.rst:221 msgid "name" msgstr "" -#: ../../library/inspect.rst:207 +#: ../../library/inspect.rst:211 msgid "gi_frame" msgstr "gi_frame" -#: ../../library/inspect.rst:209 +#: ../../library/inspect.rst:213 msgid "gi_running" msgstr "gi_running" -#: ../../library/inspect.rst:209 +#: ../../library/inspect.rst:213 msgid "is the generator running?" msgstr "" -#: ../../library/inspect.rst:211 +#: ../../library/inspect.rst:215 msgid "gi_code" msgstr "gi_code" -#: ../../library/inspect.rst:213 +#: ../../library/inspect.rst:217 msgid "gi_yieldfrom" msgstr "gi_yieldfrom" -#: ../../library/inspect.rst:213 +#: ../../library/inspect.rst:217 msgid "object being iterated by ``yield from``, or ``None``" msgstr "" -#: ../../library/inspect.rst:217 +#: ../../library/inspect.rst:221 msgid "coroutine" msgstr "" -#: ../../library/inspect.rst:221 +#: ../../library/inspect.rst:225 msgid "cr_await" msgstr "cr_await" -#: ../../library/inspect.rst:221 +#: ../../library/inspect.rst:225 msgid "object being awaited on, or ``None``" msgstr "" -#: ../../library/inspect.rst:224 +#: ../../library/inspect.rst:228 msgid "cr_frame" msgstr "cr_frame" -#: ../../library/inspect.rst:226 +#: ../../library/inspect.rst:230 msgid "cr_running" msgstr "cr_running" -#: ../../library/inspect.rst:226 +#: ../../library/inspect.rst:230 msgid "is the coroutine running?" msgstr "" -#: ../../library/inspect.rst:228 +#: ../../library/inspect.rst:232 msgid "cr_code" msgstr "cr_code" -#: ../../library/inspect.rst:230 +#: ../../library/inspect.rst:234 msgid "cr_origin" msgstr "cr_origin" -#: ../../library/inspect.rst:230 +#: ../../library/inspect.rst:234 msgid "where coroutine was created, or ``None``. See |coroutine-origin-link|" msgstr "" -#: ../../library/inspect.rst:234 +#: ../../library/inspect.rst:238 msgid "builtin" msgstr "" -#: ../../library/inspect.rst:236 +#: ../../library/inspect.rst:240 msgid "original name of this function or method" msgstr "" -#: ../../library/inspect.rst:241 +#: ../../library/inspect.rst:245 msgid "instance to which a method is bound, or ``None``" msgstr "" -#: ../../library/inspect.rst:248 +#: ../../library/inspect.rst:252 msgid "Add ``__qualname__`` and ``gi_yieldfrom`` attributes to generators." msgstr "" -#: ../../library/inspect.rst:250 +#: ../../library/inspect.rst:254 msgid "" "The ``__name__`` attribute of generators is now set from the function name, " "instead of the code name, and it can now be modified." msgstr "" -#: ../../library/inspect.rst:255 +#: ../../library/inspect.rst:259 msgid "Add ``cr_origin`` attribute to coroutines." msgstr "" -#: ../../library/inspect.rst:259 +#: ../../library/inspect.rst:263 msgid "Add ``__builtins__`` attribute to functions." msgstr "" -#: ../../library/inspect.rst:263 +#: ../../library/inspect.rst:267 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name. If the optional *predicate* argument—which will be called " @@ -556,14 +565,31 @@ msgid "" "the predicate returns a true value are included." msgstr "" -#: ../../library/inspect.rst:270 +#: ../../library/inspect.rst:274 msgid "" ":func:`getmembers` will only return class attributes defined in the " "metaclass when the argument is a class and those attributes have been listed " "in the metaclass' custom :meth:`__dir__`." msgstr "" -#: ../../library/inspect.rst:277 +#: ../../library/inspect.rst:281 +msgid "" +"Return all the members of an object in a list of ``(name, value)`` pairs " +"sorted by name without triggering dynamic lookup via the descriptor " +"protocol, __getattr__ or __getattribute__. Optionally, only return members " +"that satisfy a given predicate." +msgstr "" + +#: ../../library/inspect.rst:288 +msgid "" +":func:`getmembers_static` may not be able to retrieve all members that " +"getmembers can fetch (like dynamically created attributes) and may find " +"members that getmembers can't (like descriptors that raise AttributeError). " +"It can also return descriptor objects instead of instance members in some " +"cases." +msgstr "" + +#: ../../library/inspect.rst:299 msgid "" "Return the name of the module named by the file *path*, without including " "the names of enclosing packages. The file extension is checked against all " @@ -572,134 +598,145 @@ msgid "" "``None`` is returned." msgstr "" -#: ../../library/inspect.rst:283 +#: ../../library/inspect.rst:305 msgid "" "Note that this function *only* returns a meaningful name for actual Python " "modules - paths that potentially refer to Python packages will still return " "``None``." msgstr "" -#: ../../library/inspect.rst:287 +#: ../../library/inspect.rst:309 msgid "The function is based directly on :mod:`importlib`." msgstr "" -#: ../../library/inspect.rst:293 +#: ../../library/inspect.rst:315 msgid "Return ``True`` if the object is a module." msgstr "" -#: ../../library/inspect.rst:298 +#: ../../library/inspect.rst:320 msgid "" "Return ``True`` if the object is a class, whether built-in or created in " "Python code." msgstr "" -#: ../../library/inspect.rst:304 +#: ../../library/inspect.rst:326 msgid "Return ``True`` if the object is a bound method written in Python." msgstr "" -#: ../../library/inspect.rst:309 +#: ../../library/inspect.rst:331 msgid "" "Return ``True`` if the object is a Python function, which includes functions " "created by a :term:`lambda` expression." msgstr "" -#: ../../library/inspect.rst:315 +#: ../../library/inspect.rst:337 msgid "Return ``True`` if the object is a Python generator function." msgstr "" -#: ../../library/inspect.rst:317 +#: ../../library/inspect.rst:339 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:324 +#: ../../library/inspect.rst:346 msgid "Return ``True`` if the object is a generator." msgstr "" -#: ../../library/inspect.rst:329 +#: ../../library/inspect.rst:351 msgid "" "Return ``True`` if the object is a :term:`coroutine function` (a function " "defined with an :keyword:`async def` syntax)." msgstr "" -#: ../../library/inspect.rst:334 +#: ../../library/inspect.rst:356 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:341 +#: ../../library/inspect.rst:363 msgid "" "Return ``True`` if the object is a :term:`coroutine` created by an :keyword:" "`async def` function." msgstr "" -#: ../../library/inspect.rst:349 +#: ../../library/inspect.rst:371 msgid "" "Return ``True`` if the object can be used in :keyword:`await` expression." msgstr "" -#: ../../library/inspect.rst:351 +#: ../../library/inspect.rst:373 msgid "" "Can also be used to distinguish generator-based coroutines from regular " "generators::" msgstr "" -#: ../../library/inspect.rst:368 +#: ../../library/inspect.rst:390 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator` function, " "for example::" msgstr "" -#: ../../library/inspect.rst:379 +#: ../../library/inspect.rst:401 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:386 +#: ../../library/inspect.rst:408 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " "created by an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:393 +#: ../../library/inspect.rst:415 msgid "Return ``True`` if the object is a traceback." msgstr "" -#: ../../library/inspect.rst:398 +#: ../../library/inspect.rst:420 msgid "Return ``True`` if the object is a frame." msgstr "" -#: ../../library/inspect.rst:403 +#: ../../library/inspect.rst:425 msgid "Return ``True`` if the object is a code." msgstr "" -#: ../../library/inspect.rst:408 +#: ../../library/inspect.rst:430 msgid "" "Return ``True`` if the object is a built-in function or a bound built-in " "method." msgstr "" -#: ../../library/inspect.rst:413 +#: ../../library/inspect.rst:435 +msgid "" +"Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`." +msgstr "" + +#: ../../library/inspect.rst:437 +msgid "" +"These are instances of :class:`~types.MethodWrapperType`, such as :meth:" +"`~object().__str__`, :meth:`~object().__eq__` and :meth:`~object().__repr__`" +msgstr "" + +#: ../../library/inspect.rst:443 msgid "" "Return ``True`` if the object is a user-defined or built-in function or " "method." msgstr "" -#: ../../library/inspect.rst:418 +#: ../../library/inspect.rst:448 msgid "Return ``True`` if the object is an abstract base class." msgstr "" -#: ../../library/inspect.rst:423 +#: ../../library/inspect.rst:453 msgid "" "Return ``True`` if the object is a method descriptor, but not if :func:" "`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin` are " "true." msgstr "" -#: ../../library/inspect.rst:427 +#: ../../library/inspect.rst:457 msgid "" "This, for example, is true of ``int.__add__``. An object passing this test " "has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` " @@ -707,7 +744,7 @@ msgid "" "__name__` attribute is usually sensible, and :attr:`__doc__` often is." msgstr "" -#: ../../library/inspect.rst:433 +#: ../../library/inspect.rst:463 msgid "" "Methods implemented via descriptors that also pass one of the other tests " "return ``False`` from the :func:`ismethoddescriptor` test, simply because " @@ -715,11 +752,11 @@ msgid "" "`__func__` attribute (etc) when an object passes :func:`ismethod`." msgstr "" -#: ../../library/inspect.rst:441 +#: ../../library/inspect.rst:471 msgid "Return ``True`` if the object is a data descriptor." msgstr "" -#: ../../library/inspect.rst:443 +#: ../../library/inspect.rst:473 msgid "" "Data descriptors have a :attr:`~object.__set__` or a :attr:`~object." "__delete__` method. Examples are properties (defined in Python), getsets, " @@ -730,33 +767,33 @@ msgid "" "and members have both of these attributes), but this is not guaranteed." msgstr "" -#: ../../library/inspect.rst:454 +#: ../../library/inspect.rst:484 msgid "Return ``True`` if the object is a getset descriptor." msgstr "" -#: ../../library/inspect.rst:458 +#: ../../library/inspect.rst:488 msgid "" "getsets are attributes defined in extension modules via :c:type:" "`PyGetSetDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:465 +#: ../../library/inspect.rst:495 msgid "Return ``True`` if the object is a member descriptor." msgstr "" -#: ../../library/inspect.rst:469 +#: ../../library/inspect.rst:499 msgid "" "Member descriptors are attributes defined in extension modules via :c:type:" "`PyMemberDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:477 +#: ../../library/inspect.rst:507 msgid "Retrieving source code" msgstr "" -#: ../../library/inspect.rst:481 +#: ../../library/inspect.rst:511 msgid "" "Get the documentation string for an object, cleaned up with :func:" "`cleandoc`. If the documentation string for an object is not provided and " @@ -765,11 +802,11 @@ msgid "" "documentation string is invalid or missing." msgstr "" -#: ../../library/inspect.rst:487 +#: ../../library/inspect.rst:517 msgid "Documentation strings are now inherited if not overridden." msgstr "" -#: ../../library/inspect.rst:493 +#: ../../library/inspect.rst:523 msgid "" "Return in a single string any lines of comments immediately preceding the " "object's source code (for a class, function, or method), or at the top of " @@ -778,27 +815,27 @@ msgid "" "been defined in C or the interactive shell." msgstr "" -#: ../../library/inspect.rst:502 +#: ../../library/inspect.rst:532 msgid "" "Return the name of the (text or binary) file in which an object was defined. " "This will fail with a :exc:`TypeError` if the object is a built-in module, " "class, or function." msgstr "" -#: ../../library/inspect.rst:509 +#: ../../library/inspect.rst:539 msgid "" "Try to guess which module an object was defined in. Return ``None`` if the " "module cannot be determined." msgstr "" -#: ../../library/inspect.rst:515 +#: ../../library/inspect.rst:545 msgid "" "Return the name of the Python source file in which an object was defined or " "``None`` if no way can be identified to get the source. This will fail with " "a :exc:`TypeError` if the object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:523 +#: ../../library/inspect.rst:553 msgid "" "Return a list of source lines and starting line number for an object. The " "argument may be a module, class, method, function, traceback, frame, or code " @@ -808,13 +845,13 @@ msgid "" "code cannot be retrieved." msgstr "" -#: ../../library/inspect.rst:530 ../../library/inspect.rst:542 +#: ../../library/inspect.rst:560 ../../library/inspect.rst:572 msgid "" ":exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the " "former." msgstr "" -#: ../../library/inspect.rst:537 +#: ../../library/inspect.rst:567 msgid "" "Return the text of the source code for an object. The argument may be a " "module, class, method, function, traceback, frame, or code object. The " @@ -822,13 +859,13 @@ msgid "" "the source code cannot be retrieved." msgstr "" -#: ../../library/inspect.rst:549 +#: ../../library/inspect.rst:579 msgid "" "Clean up indentation from docstrings that are indented to line up with " "blocks of code." msgstr "" -#: ../../library/inspect.rst:552 +#: ../../library/inspect.rst:582 msgid "" "All leading whitespace is removed from the first line. Any leading " "whitespace that can be uniformly removed from the second line onwards is " @@ -836,28 +873,28 @@ msgid "" "Also, all tabs are expanded to spaces." msgstr "" -#: ../../library/inspect.rst:561 +#: ../../library/inspect.rst:591 msgid "Introspecting callables with the Signature object" msgstr "" -#: ../../library/inspect.rst:565 +#: ../../library/inspect.rst:595 msgid "" "The Signature object represents the call signature of a callable object and " "its return annotation. To retrieve a Signature object, use the :func:" "`signature` function." msgstr "" -#: ../../library/inspect.rst:571 +#: ../../library/inspect.rst:601 msgid "Return a :class:`Signature` object for the given ``callable``::" msgstr "" -#: ../../library/inspect.rst:588 +#: ../../library/inspect.rst:618 msgid "" "Accepts a wide range of Python callables, from plain functions and classes " "to :func:`functools.partial` objects." msgstr "" -#: ../../library/inspect.rst:591 +#: ../../library/inspect.rst:621 msgid "" "For objects defined in modules using stringized annotations (``from " "__future__ import annotations``), :func:`signature` will attempt to " @@ -868,7 +905,7 @@ msgid "" "instructions on how to use these parameters." msgstr "" -#: ../../library/inspect.rst:600 +#: ../../library/inspect.rst:630 msgid "" "Raises :exc:`ValueError` if no signature can be provided, and :exc:" "`TypeError` if that type of object is not supported. Also, if the " @@ -877,39 +914,39 @@ msgid "" "exception." msgstr "" -#: ../../library/inspect.rst:606 +#: ../../library/inspect.rst:636 msgid "" "A slash(/) in the signature of a function denotes that the parameters prior " "to it are positional-only. For more info, see :ref:`the FAQ entry on " "positional-only parameters `." msgstr "" -#: ../../library/inspect.rst:610 +#: ../../library/inspect.rst:640 msgid "" "``follow_wrapped`` parameter. Pass ``False`` to get a signature of " "``callable`` specifically (``callable.__wrapped__`` will not be used to " "unwrap decorated callables.)" msgstr "" -#: ../../library/inspect.rst:615 +#: ../../library/inspect.rst:645 msgid "``globals``, ``locals``, and ``eval_str`` parameters." msgstr "" -#: ../../library/inspect.rst:620 +#: ../../library/inspect.rst:650 msgid "" "Some callables may not be introspectable in certain implementations of " "Python. For example, in CPython, some built-in functions defined in C " "provide no metadata about their arguments." msgstr "" -#: ../../library/inspect.rst:627 +#: ../../library/inspect.rst:657 msgid "" "A Signature object represents the call signature of a function and its " "return annotation. For each parameter accepted by the function it stores a :" "class:`Parameter` object in its :attr:`parameters` collection." msgstr "" -#: ../../library/inspect.rst:631 +#: ../../library/inspect.rst:661 msgid "" "The optional *parameters* argument is a sequence of :class:`Parameter` " "objects, which is validated to check that there are no parameters with " @@ -918,54 +955,54 @@ msgid "" "defaults follow parameters without defaults." msgstr "" -#: ../../library/inspect.rst:637 +#: ../../library/inspect.rst:667 msgid "" "The optional *return_annotation* argument, can be an arbitrary Python " "object, is the \"return\" annotation of the callable." msgstr "" -#: ../../library/inspect.rst:640 +#: ../../library/inspect.rst:670 msgid "" "Signature objects are *immutable*. Use :meth:`Signature.replace` to make a " "modified copy." msgstr "" -#: ../../library/inspect.rst:643 +#: ../../library/inspect.rst:673 msgid "Signature objects are picklable and hashable." msgstr "" -#: ../../library/inspect.rst:648 +#: ../../library/inspect.rst:678 msgid "A special class-level marker to specify absence of a return annotation." msgstr "" -#: ../../library/inspect.rst:652 +#: ../../library/inspect.rst:682 msgid "" "An ordered mapping of parameters' names to the corresponding :class:" "`Parameter` objects. Parameters appear in strict definition order, " "including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:656 ../../library/inspect.rst:1000 +#: ../../library/inspect.rst:686 ../../library/inspect.rst:1010 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " "had always been preserved in Python 3." msgstr "" -#: ../../library/inspect.rst:663 +#: ../../library/inspect.rst:693 msgid "" "The \"return\" annotation for the callable. If the callable has no \"return" "\" annotation, this attribute is set to :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:668 +#: ../../library/inspect.rst:698 msgid "" "Create a mapping from positional and keyword arguments to parameters. " "Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the " "signature, or raises a :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:674 +#: ../../library/inspect.rst:704 msgid "" "Works the same way as :meth:`Signature.bind`, but allows the omission of " "some required arguments (mimics :func:`functools.partial` behavior.) " @@ -973,7 +1010,7 @@ msgid "" "arguments do not match the signature." msgstr "" -#: ../../library/inspect.rst:681 +#: ../../library/inspect.rst:711 msgid "" "Create a new Signature instance based on the instance replace was invoked " "on. It is possible to pass different ``parameters`` and/or " @@ -982,7 +1019,7 @@ msgid "" "attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:698 +#: ../../library/inspect.rst:728 msgid "" "Return a :class:`Signature` (or its subclass) object for a given callable " "``obj``. Pass ``follow_wrapped=False`` to get a signature of ``obj`` " @@ -990,138 +1027,138 @@ msgid "" "will be used as the namespaces when resolving annotations." msgstr "" -#: ../../library/inspect.rst:703 +#: ../../library/inspect.rst:733 msgid "This method simplifies subclassing of :class:`Signature`::" msgstr "" -#: ../../library/inspect.rst:712 +#: ../../library/inspect.rst:742 msgid "``globalns`` and ``localns`` parameters." msgstr "" -#: ../../library/inspect.rst:718 +#: ../../library/inspect.rst:748 msgid "" "Parameter objects are *immutable*. Instead of modifying a Parameter object, " "you can use :meth:`Parameter.replace` to create a modified copy." msgstr "" -#: ../../library/inspect.rst:721 +#: ../../library/inspect.rst:751 msgid "Parameter objects are picklable and hashable." msgstr "" -#: ../../library/inspect.rst:726 +#: ../../library/inspect.rst:756 msgid "" "A special class-level marker to specify absence of default values and " "annotations." msgstr "" -#: ../../library/inspect.rst:731 +#: ../../library/inspect.rst:761 msgid "" "The name of the parameter as a string. The name must be a valid Python " "identifier." msgstr "" -#: ../../library/inspect.rst:736 +#: ../../library/inspect.rst:766 msgid "" "CPython generates implicit parameter names of the form ``.0`` on the code " "objects used to implement comprehensions and generator expressions." msgstr "" -#: ../../library/inspect.rst:740 +#: ../../library/inspect.rst:770 msgid "" "These parameter names are exposed by this module as names like ``implicit0``." msgstr "" -#: ../../library/inspect.rst:746 +#: ../../library/inspect.rst:776 msgid "" "The default value for the parameter. If the parameter has no default value, " "this attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:751 +#: ../../library/inspect.rst:781 msgid "" "The annotation for the parameter. If the parameter has no annotation, this " "attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:756 +#: ../../library/inspect.rst:786 msgid "" "Describes how argument values are bound to the parameter. Possible values " "(accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``):" msgstr "" -#: ../../library/inspect.rst:762 +#: ../../library/inspect.rst:792 msgid "Name" msgstr "名稱" -#: ../../library/inspect.rst:762 +#: ../../library/inspect.rst:792 msgid "Meaning" msgstr "意義" -#: ../../library/inspect.rst:764 +#: ../../library/inspect.rst:794 msgid "*POSITIONAL_ONLY*" msgstr "*POSITIONAL_ONLY*" -#: ../../library/inspect.rst:764 +#: ../../library/inspect.rst:794 msgid "" "Value must be supplied as a positional argument. Positional only parameters " "are those which appear before a ``/`` entry (if present) in a Python " "function definition." msgstr "" -#: ../../library/inspect.rst:769 +#: ../../library/inspect.rst:799 msgid "*POSITIONAL_OR_KEYWORD*" msgstr "*POSITIONAL_OR_KEYWORD*" -#: ../../library/inspect.rst:769 +#: ../../library/inspect.rst:799 msgid "" "Value may be supplied as either a keyword or positional argument (this is " "the standard binding behaviour for functions implemented in Python.)" msgstr "" -#: ../../library/inspect.rst:774 +#: ../../library/inspect.rst:804 msgid "*VAR_POSITIONAL*" msgstr "*VAR_POSITIONAL*" -#: ../../library/inspect.rst:774 +#: ../../library/inspect.rst:804 msgid "" "A tuple of positional arguments that aren't bound to any other parameter. " "This corresponds to a ``*args`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:779 +#: ../../library/inspect.rst:809 msgid "*KEYWORD_ONLY*" msgstr "*KEYWORD_ONLY*" -#: ../../library/inspect.rst:779 +#: ../../library/inspect.rst:809 msgid "" "Value must be supplied as a keyword argument. Keyword only parameters are " "those which appear after a ``*`` or ``*args`` entry in a Python function " "definition." msgstr "" -#: ../../library/inspect.rst:784 +#: ../../library/inspect.rst:814 msgid "*VAR_KEYWORD*" msgstr "*VAR_KEYWORD*" -#: ../../library/inspect.rst:784 +#: ../../library/inspect.rst:814 msgid "" "A dict of keyword arguments that aren't bound to any other parameter. This " "corresponds to a ``**kwargs`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:790 +#: ../../library/inspect.rst:820 msgid "Example: print all keyword-only arguments without default values::" msgstr "" -#: ../../library/inspect.rst:804 +#: ../../library/inspect.rst:834 msgid "Describes a enum value of Parameter.kind." msgstr "" -#: ../../library/inspect.rst:808 +#: ../../library/inspect.rst:838 msgid "Example: print all descriptions of arguments::" msgstr "" -#: ../../library/inspect.rst:823 +#: ../../library/inspect.rst:853 msgid "" "Create a new Parameter instance based on the instance replaced was invoked " "on. To override a :class:`Parameter` attribute, pass the corresponding " @@ -1129,94 +1166,94 @@ msgid "" "pass :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:841 +#: ../../library/inspect.rst:871 msgid "" "In Python 3.3 Parameter objects were allowed to have ``name`` set to " "``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``. This is no longer " "permitted." msgstr "" -#: ../../library/inspect.rst:848 +#: ../../library/inspect.rst:878 msgid "" "Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call. " "Holds the mapping of arguments to the function's parameters." msgstr "" -#: ../../library/inspect.rst:853 +#: ../../library/inspect.rst:883 msgid "" "A mutable mapping of parameters' names to arguments' values. Contains only " "explicitly bound arguments. Changes in :attr:`arguments` will reflect in :" "attr:`args` and :attr:`kwargs`." msgstr "" -#: ../../library/inspect.rst:857 +#: ../../library/inspect.rst:887 msgid "" "Should be used in conjunction with :attr:`Signature.parameters` for any " "argument processing purposes." msgstr "" -#: ../../library/inspect.rst:862 +#: ../../library/inspect.rst:892 msgid "" "Arguments for which :meth:`Signature.bind` or :meth:`Signature.bind_partial` " "relied on a default value are skipped. However, if needed, use :meth:" "`BoundArguments.apply_defaults` to add them." msgstr "" -#: ../../library/inspect.rst:867 +#: ../../library/inspect.rst:897 msgid "" ":attr:`arguments` is now of type :class:`dict`. Formerly, it was of type :" "class:`collections.OrderedDict`." msgstr "" -#: ../../library/inspect.rst:873 +#: ../../library/inspect.rst:903 msgid "" "A tuple of positional arguments values. Dynamically computed from the :attr:" "`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:878 +#: ../../library/inspect.rst:908 msgid "" "A dict of keyword arguments values. Dynamically computed from the :attr:" "`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:883 +#: ../../library/inspect.rst:913 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:887 +#: ../../library/inspect.rst:917 msgid "Set default values for missing arguments." msgstr "" -#: ../../library/inspect.rst:889 +#: ../../library/inspect.rst:919 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:892 +#: ../../library/inspect.rst:922 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:905 +#: ../../library/inspect.rst:935 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions::" msgstr "" -#: ../../library/inspect.rst:918 +#: ../../library/inspect.rst:948 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:919 +#: ../../library/inspect.rst:949 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:925 +#: ../../library/inspect.rst:955 msgid "Classes and functions" msgstr "" -#: ../../library/inspect.rst:929 +#: ../../library/inspect.rst:959 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1227,44 +1264,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:940 -msgid "" -"Get the names and default values of a Python function's parameters. A :term:" -"`named tuple` ``ArgSpec(args, varargs, keywords, defaults)`` is returned. " -"*args* is a list of the parameter names. *varargs* and *keywords* are the " -"names of the ``*`` and ``**`` parameters or ``None``. *defaults* is a tuple " -"of default argument values or ``None`` if there are no default arguments; if " -"this tuple has *n* elements, they correspond to the last *n* elements listed " -"in *args*." -msgstr "" - -#: ../../library/inspect.rst:948 -msgid "" -"Use :func:`getfullargspec` for an updated API that is usually a drop-in " -"replacement, but also correctly handles function annotations and keyword-" -"only parameters." -msgstr "" - -#: ../../library/inspect.rst:953 -msgid "" -"Alternatively, use :func:`signature` and :ref:`Signature Object `, which provide a more structured introspection API for " -"callables." -msgstr "" - -#: ../../library/inspect.rst:960 +#: ../../library/inspect.rst:970 msgid "" "Get the names and default values of a Python function's parameters. A :term:" "`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:963 +#: ../../library/inspect.rst:973 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:966 +#: ../../library/inspect.rst:976 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1279,7 +1291,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:981 +#: ../../library/inspect.rst:991 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1289,14 +1301,14 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:988 +#: ../../library/inspect.rst:998 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:993 +#: ../../library/inspect.rst:1003 msgid "" "This method was previously documented as deprecated in favour of :func:" "`signature` in Python 3.5, but that decision has been reversed in order to " @@ -1304,7 +1316,7 @@ msgid "" "code migrating away from the legacy :func:`getargspec` API." msgstr "" -#: ../../library/inspect.rst:1008 +#: ../../library/inspect.rst:1018 msgid "" "Get information about arguments passed into a particular frame. A :term:" "`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " @@ -1313,47 +1325,18 @@ msgid "" "dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1015 ../../library/inspect.rst:1052 +#: ../../library/inspect.rst:1025 ../../library/inspect.rst:1035 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1020 -msgid "" -"Format a pretty argument spec from the values returned by :func:" -"`getfullargspec`." -msgstr "" - -#: ../../library/inspect.rst:1023 -msgid "" -"The first seven arguments are (``args``, ``varargs``, ``varkw``, " -"``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``)." -msgstr "" - -#: ../../library/inspect.rst:1026 -msgid "" -"The other six arguments are functions that are called to turn argument " -"names, ``*`` argument name, ``**`` argument name, default values, return " -"annotation and individual annotations into strings, respectively." -msgstr "" - #: ../../library/inspect.rst:1030 -msgid "For example:" -msgstr "" - -#: ../../library/inspect.rst:1039 -msgid "" -"Use :func:`signature` and :ref:`Signature Object `, which provide a better introspecting API for callables." -msgstr "" - -#: ../../library/inspect.rst:1047 msgid "" "Format a pretty argument spec from the four values returned by :func:" "`getargvalues`. The format\\* arguments are the corresponding optional " "formatting functions that are called to turn names and values into strings." msgstr "" -#: ../../library/inspect.rst:1057 +#: ../../library/inspect.rst:1040 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1361,7 +1344,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1065 +#: ../../library/inspect.rst:1048 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1374,11 +1357,11 @@ msgid "" "example::" msgstr "" -#: ../../library/inspect.rst:1088 +#: ../../library/inspect.rst:1071 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "" -#: ../../library/inspect.rst:1094 +#: ../../library/inspect.rst:1077 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1390,18 +1373,18 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1103 +#: ../../library/inspect.rst:1086 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "" -#: ../../library/inspect.rst:1110 +#: ../../library/inspect.rst:1093 msgid "" "Get the object wrapped by *func*. It follows the chain of :attr:" "`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1113 +#: ../../library/inspect.rst:1096 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " @@ -1411,68 +1394,68 @@ msgid "" "``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1120 +#: ../../library/inspect.rst:1103 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "" -#: ../../library/inspect.rst:1127 +#: ../../library/inspect.rst:1110 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1129 +#: ../../library/inspect.rst:1112 msgid "" "``obj`` may be a callable, class, or module. Passing in an object of any " "other type raises :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:1132 +#: ../../library/inspect.rst:1115 msgid "" "Returns a dict. ``get_annotations()`` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/inspect.rst:1136 +#: ../../library/inspect.rst:1119 msgid "This function handles several details for you:" msgstr "" -#: ../../library/inspect.rst:1138 +#: ../../library/inspect.rst:1121 msgid "" "If ``eval_str`` is true, values of type ``str`` will be un-stringized using :" "func:`eval()`. This is intended for use with stringized annotations (``from " "__future__ import annotations``)." msgstr "" -#: ../../library/inspect.rst:1142 +#: ../../library/inspect.rst:1125 msgid "" "If ``obj`` doesn't have an annotations dict, returns an empty dict. " "(Functions and methods always have an annotations dict; classes, modules, " "and other types of callables may not.)" msgstr "" -#: ../../library/inspect.rst:1146 +#: ../../library/inspect.rst:1129 msgid "" "Ignores inherited annotations on classes. If a class doesn't have its own " "annotations dict, returns an empty dict." msgstr "" -#: ../../library/inspect.rst:1148 +#: ../../library/inspect.rst:1131 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/inspect.rst:1150 +#: ../../library/inspect.rst:1133 msgid "Always, always, always returns a freshly created dict." msgstr "" -#: ../../library/inspect.rst:1152 +#: ../../library/inspect.rst:1135 msgid "" "``eval_str`` controls whether or not values of type ``str`` are replaced " "with the result of calling :func:`eval()` on those values:" msgstr "" -#: ../../library/inspect.rst:1155 +#: ../../library/inspect.rst:1138 msgid "" "If eval_str is true, :func:`eval()` is called on values of type ``str``. " "(Note that ``get_annotations`` doesn't catch exceptions; if :func:`eval()` " @@ -1480,12 +1463,12 @@ msgid "" "call.)" msgstr "" -#: ../../library/inspect.rst:1159 +#: ../../library/inspect.rst:1142 msgid "" "If eval_str is false (the default), values of type ``str`` are unchanged." msgstr "" -#: ../../library/inspect.rst:1161 +#: ../../library/inspect.rst:1144 msgid "" "``globals`` and ``locals`` are passed in to :func:`eval()`; see the " "documentation for :func:`eval()` for more information. If ``globals`` or " @@ -1493,49 +1476,125 @@ msgid "" "specific default, contingent on ``type(obj)``:" msgstr "" -#: ../../library/inspect.rst:1166 +#: ../../library/inspect.rst:1149 msgid "If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``." msgstr "" -#: ../../library/inspect.rst:1167 +#: ../../library/inspect.rst:1150 msgid "" "If ``obj`` is a class, ``globals`` defaults to ``sys.modules[obj.__module__]." "__dict__`` and ``locals`` defaults to the ``obj`` class namespace." msgstr "" -#: ../../library/inspect.rst:1170 +#: ../../library/inspect.rst:1153 msgid "" "If ``obj`` is a callable, ``globals`` defaults to ``obj.__globals__``, " "although if ``obj`` is a wrapped function (using ``functools." "update_wrapper()``) it is first unwrapped." msgstr "" -#: ../../library/inspect.rst:1174 +#: ../../library/inspect.rst:1157 msgid "" "Calling ``get_annotations`` is best practice for accessing the annotations " "dict of any object. See :ref:`annotations-howto` for more information on " "annotations best practices." msgstr "" -#: ../../library/inspect.rst:1184 +#: ../../library/inspect.rst:1167 msgid "The interpreter stack" msgstr "" -#: ../../library/inspect.rst:1186 +#: ../../library/inspect.rst:1169 +msgid "" +"Some of the following functions return :class:`FrameInfo` objects. For " +"backwards compatibility these objects allow tuple-like operations on all " +"attributes except ``positions``. This behavior is considered deprecated and " +"may be removed in the future." +msgstr "" + +#: ../../library/inspect.rst:1178 +msgid "The :ref:`frame object ` that the record corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1182 +msgid "" +"The file name associated with the code being executed by the frame this " +"record corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1187 +msgid "" +"The line number of the current line associated with the code being executed " +"by the frame this record corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1192 +msgid "" +"The function name that is being executed by the frame this record " +"corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1196 +msgid "" +"A list of lines of context from the source code that's being executed by the " +"frame this record corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1201 ../../library/inspect.rst:1239 msgid "" -"When the following functions return \"frame records,\" each record is a :" -"term:`named tuple` ``FrameInfo(frame, filename, lineno, function, " -"code_context, index)``. The tuple contains the frame object, the filename, " -"the line number of the current line, the function name, a list of lines of " -"context from the source code, and the index of the current line within that " +"The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1194 +#: ../../library/inspect.rst:1205 +msgid "" +"A :class:`dis.Positions` object containing the start line number, end line " +"number, start column offset, and end column offset associated with the " +"instruction being executed by the frame this record corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1209 msgid "Return a named tuple instead of a tuple." msgstr "" -#: ../../library/inspect.rst:1199 +#: ../../library/inspect.rst:1212 +msgid "" +"Changed the return object from a named tuple to a regular object (that is " +"backwards compatible with the previous named tuple)." +msgstr "" + +#: ../../library/inspect.rst:1220 +msgid "" +"The file name associated with the code being executed by the frame this " +"traceback corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1225 +msgid "" +"The line number of the current line associated with the code being executed " +"by the frame this traceback corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1230 +msgid "" +"The function name that is being executed by the frame this traceback " +"corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1234 +msgid "" +"A list of lines of context from the source code that's being executed by the " +"frame this traceback corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1243 +msgid "" +"A :class:`dis.Positions` object containing the start line number, end line " +"number, start column offset, and end column offset associated with the " +"instruction being executed by the frame this traceback corresponds to." +msgstr "" + +#: ../../library/inspect.rst:1250 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1547,7 +1606,7 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1207 +#: ../../library/inspect.rst:1258 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " "local variables) can be made deterministic by removing the cycle in a :" @@ -1555,54 +1614,63 @@ msgid "" "disabled when Python was compiled or using :func:`gc.disable`. For example::" msgstr "" -#: ../../library/inspect.rst:1219 +#: ../../library/inspect.rst:1270 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1223 +#: ../../library/inspect.rst:1274 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1230 +#: ../../library/inspect.rst:1281 msgid "" -"Get information about a frame or traceback object. A :term:`named tuple` " -"``Traceback(filename, lineno, function, code_context, index)`` is returned." +"Get information about a frame or traceback object. A :class:`Traceback` " +"object is returned." msgstr "" -#: ../../library/inspect.rst:1236 +#: ../../library/inspect.rst:1284 +msgid "A :class:`Traceback` object is returned instead of a named tuple." +msgstr "" + +#: ../../library/inspect.rst:1289 msgid "" -"Get a list of frame records for a frame and all outer frames. These frames " -"represent the calls that lead to the creation of *frame*. The first entry in " -"the returned list represents *frame*; the last entry represents the " -"outermost call on *frame*'s stack." +"Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " +"These frames represent the calls that lead to the creation of *frame*. The " +"first entry in the returned list represents *frame*; the last entry " +"represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1241 ../../library/inspect.rst:1254 -#: ../../library/inspect.rst:1278 ../../library/inspect.rst:1291 +#: ../../library/inspect.rst:1294 ../../library/inspect.rst:1309 +#: ../../library/inspect.rst:1335 ../../library/inspect.rst:1350 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1249 +#: ../../library/inspect.rst:1299 ../../library/inspect.rst:1314 +#: ../../library/inspect.rst:1340 ../../library/inspect.rst:1355 +msgid "A list of :class:`FrameInfo` objects is returned." +msgstr "" + +#: ../../library/inspect.rst:1304 msgid "" -"Get a list of frame records for a traceback's frame and all inner frames. " -"These frames represent calls made as a consequence of *frame*. The first " -"entry in the list represents *traceback*; the last entry represents where " -"the exception was raised." +"Get a list of :class:`FrameInfo` objects for a traceback's frame and all " +"inner frames. These frames represent calls made as a consequence of " +"*frame*. The first entry in the list represents *traceback*; the last entry " +"represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1262 +#: ../../library/inspect.rst:1319 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1266 +#: ../../library/inspect.rst:1323 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -1610,26 +1678,26 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1274 +#: ../../library/inspect.rst:1331 msgid "" -"Return a list of frame records for the caller's stack. The first entry in " -"the returned list represents the caller; the last entry represents the " -"outermost call on the stack." +"Return a list of :class:`FrameInfo` objects for the caller's stack. The " +"first entry in the returned list represents the caller; the last entry " +"represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1286 +#: ../../library/inspect.rst:1345 msgid "" -"Return a list of frame records for the stack between the current frame and " -"the frame in which an exception currently being handled was raised in. The " -"first entry in the list represents the caller; the last entry represents " -"where the exception was raised." +"Return a list of :class:`FrameInfo` objects for the stack between the " +"current frame and the frame in which an exception currently being handled " +"was raised in. The first entry in the list represents the caller; the last " +"entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1298 +#: ../../library/inspect.rst:1359 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1300 +#: ../../library/inspect.rst:1361 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " @@ -1637,20 +1705,20 @@ msgid "" "`__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1305 +#: ../../library/inspect.rst:1366 msgid "" "For cases where you want passive introspection, like documentation tools, " "this can be inconvenient. :func:`getattr_static` has the same signature as :" "func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1311 +#: ../../library/inspect.rst:1372 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`__getattr__` or :meth:`__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1314 +#: ../../library/inspect.rst:1375 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -1658,31 +1726,31 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1320 +#: ../../library/inspect.rst:1381 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1326 +#: ../../library/inspect.rst:1387 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1330 +#: ../../library/inspect.rst:1391 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1356 +#: ../../library/inspect.rst:1417 msgid "Current State of Generators and Coroutines" msgstr "" -#: ../../library/inspect.rst:1358 +#: ../../library/inspect.rst:1419 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -1691,31 +1759,31 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1366 +#: ../../library/inspect.rst:1427 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1372 ../../library/inspect.rst:1387 +#: ../../library/inspect.rst:1433 ../../library/inspect.rst:1448 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1369 +#: ../../library/inspect.rst:1430 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1370 +#: ../../library/inspect.rst:1431 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1371 +#: ../../library/inspect.rst:1432 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1372 +#: ../../library/inspect.rst:1433 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1378 +#: ../../library/inspect.rst:1439 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -1723,30 +1791,30 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1384 +#: ../../library/inspect.rst:1445 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1385 +#: ../../library/inspect.rst:1446 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1386 +#: ../../library/inspect.rst:1447 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1387 +#: ../../library/inspect.rst:1448 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1391 +#: ../../library/inspect.rst:1452 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1397 +#: ../../library/inspect.rst:1458 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -1754,14 +1822,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1402 +#: ../../library/inspect.rst:1463 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1408 +#: ../../library/inspect.rst:1469 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -1769,76 +1837,72 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1417 +#: ../../library/inspect.rst:1478 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1426 +#: ../../library/inspect.rst:1487 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1428 +#: ../../library/inspect.rst:1489 msgid "" "Python code objects have a ``co_flags`` attribute, which is a bitmap of the " "following flags:" msgstr "" -#: ../../library/inspect.rst:1433 +#: ../../library/inspect.rst:1494 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1437 +#: ../../library/inspect.rst:1498 msgid "" "If set, a new dict will be created for the frame's ``f_locals`` when the " "code object is executed." msgstr "" -#: ../../library/inspect.rst:1442 +#: ../../library/inspect.rst:1503 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1446 +#: ../../library/inspect.rst:1507 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1450 +#: ../../library/inspect.rst:1511 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1454 +#: ../../library/inspect.rst:1515 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1459 -msgid "The flag is set if there are no free or cell variables." -msgstr "" - -#: ../../library/inspect.rst:1463 +#: ../../library/inspect.rst:1520 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1471 +#: ../../library/inspect.rst:1528 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1480 +#: ../../library/inspect.rst:1537 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1487 +#: ../../library/inspect.rst:1544 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -1846,24 +1910,24 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1497 +#: ../../library/inspect.rst:1554 msgid "Command Line Interface" msgstr "" -#: ../../library/inspect.rst:1499 +#: ../../library/inspect.rst:1556 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1504 +#: ../../library/inspect.rst:1561 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1510 +#: ../../library/inspect.rst:1567 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/intro.po b/library/intro.po index 1ab26028e3..d8e1e5e450 100644 --- a/library/intro.po +++ b/library/intro.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 08:56+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2021-10-26 17:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,3 +135,79 @@ msgid "" msgstr "" "如果沒有分別註釋的話,有標明「適用:Unix」註釋的所有函式也都於 macOS 上支援," "因其建於 Unix 核心之上。" + +#: ../../library/intro.rst:63 +msgid "" +"If an availability note contains both a minimum Kernel version and a minimum " +"libc version, then both conditions must hold. For example a feature with " +"note *Availability: Linux >= 3.17 with glibc >= 2.27* requires both Linux " +"3.17 or newer and glibc 2.27 or newer." +msgstr "" + +#: ../../library/intro.rst:71 +msgid "WebAssembly platforms" +msgstr "" + +#: ../../library/intro.rst:73 +msgid "" +"The `WebAssembly`_ platforms ``wasm32-emscripten`` (`Emscripten`_) and " +"``wasm32-wasi`` (`WASI`_) provide a subset of POSIX APIs. WebAssembly " +"runtimes and browsers are sandboxed and have limited access to the host and " +"external resources. Any Python standard library module that uses processes, " +"threading, networking, signals, or other forms of inter-process " +"communication (IPC), is either not available or may not work as on other " +"Unix-like systems. File I/O, file system, and Unix permission-related " +"functions are restricted, too. Emscripten does not permit blocking I/O. " +"Other blocking operations like :func:`~time.sleep` block the browser event " +"loop." +msgstr "" + +#: ../../library/intro.rst:83 +msgid "" +"The properties and behavior of Python on WebAssembly platforms depend on the " +"`Emscripten`_-SDK or `WASI`_-SDK version, WASM runtimes (browser, NodeJS, " +"`wasmtime`_), and Python build time flags. WebAssembly, Emscripten, and WASI " +"are evolving standards; some features like networking may be supported in " +"the future." +msgstr "" + +#: ../../library/intro.rst:89 +msgid "" +"For Python in the browser, users should consider `Pyodide`_ or `PyScript`_. " +"PyScript is built on top of Pyodide, which itself is built on top of CPython " +"and Emscripten. Pyodide provides access to browsers' JavaScript and DOM APIs " +"as well as limited networking capabilities with JavaScript's " +"``XMLHttpRequest`` and ``Fetch`` APIs." +msgstr "" + +#: ../../library/intro.rst:95 +msgid "" +"Process-related APIs are not available or always fail with an error. That " +"includes APIs that spawn new processes (:func:`~os.fork`, :func:`~os." +"execve`), wait for processes (:func:`~os.waitpid`), send signals (:func:`~os." +"kill`), or otherwise interact with processes. The :mod:`subprocess` is " +"importable but does not work." +msgstr "" + +#: ../../library/intro.rst:101 +msgid "" +"The :mod:`socket` module is available, but is limited and behaves " +"differently from other platforms. On Emscripten, sockets are always non-" +"blocking and require additional JavaScript code and helpers on the server to " +"proxy TCP through WebSockets; see `Emscripten Networking`_ for more " +"information. WASI snapshot preview 1 only permits sockets from an existing " +"file descriptor." +msgstr "" + +#: ../../library/intro.rst:108 +msgid "" +"Some functions are stubs that either don't do anything and always return " +"hardcoded values." +msgstr "" + +#: ../../library/intro.rst:111 +msgid "" +"Functions related to file descriptors, file permissions, file ownership, and " +"links are limited and don't support some operations. For example, WASI does " +"not permit symlinks with absolute file names." +msgstr "" diff --git a/library/io.po b/library/io.po index 73502d9acb..18c47885bd 100644 --- a/library/io.po +++ b/library/io.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-07 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,7 +63,7 @@ msgid "" "since :exc:`IOError` is now an alias of :exc:`OSError`." msgstr "" -#: ../../library/io.rst:51 ../../library/io.rst:848 ../../library/io.rst:1109 +#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1122 msgid "Text I/O" msgstr "" @@ -92,7 +92,7 @@ msgid "" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:72 ../../library/io.rst:1097 +#: ../../library/io.rst:72 ../../library/io.rst:1110 msgid "Binary I/O" msgstr "" @@ -152,8 +152,7 @@ msgstr "" #: ../../library/io.rst:114 msgid "" "The default encoding of :class:`TextIOWrapper` and :func:`open` is locale-" -"specific (:func:`locale.getpreferredencoding(False) `)." +"specific (:func:`locale.getencoding`)." msgstr "" #: ../../library/io.rst:117 @@ -166,34 +165,39 @@ msgstr "" #: ../../library/io.rst:126 msgid "" -"Additionally, while there is no concrete plan as of yet, Python may change " -"the default text file encoding to UTF-8 in the future." -msgstr "" - -#: ../../library/io.rst:129 -msgid "" "Accordingly, it is highly recommended that you specify the encoding " "explicitly when opening text files. If you want to use UTF-8, pass " "``encoding=\"utf-8\"``. To use the current locale encoding, ``encoding=" -"\"locale\"`` is supported in Python 3.10." +"\"locale\"`` is supported since Python 3.10." +msgstr "" + +#: ../../library/io.rst:135 +msgid ":ref:`utf8-mode`" msgstr "" #: ../../library/io.rst:134 msgid "" -"When you need to run existing code on Windows that attempts to open UTF-8 " -"files using the default locale encoding, you can enable the UTF-8 mode. See :" -"ref:`UTF-8 mode on Windows `." +"Python UTF-8 Mode can be used to change the default encoding to UTF-8 from " +"locale-specific encoding." msgstr "" -#: ../../library/io.rst:141 -msgid "Opt-in EncodingWarning" +#: ../../library/io.rst:137 +msgid ":pep:`686`" +msgstr "" + +#: ../../library/io.rst:138 +msgid "Python 3.15 will make :ref:`utf8-mode` default." msgstr "" #: ../../library/io.rst:143 +msgid "Opt-in EncodingWarning" +msgstr "" + +#: ../../library/io.rst:145 msgid "See :pep:`597` for more details." msgstr "更多資訊請見 :pep:`597`\\ 。" -#: ../../library/io.rst:146 +#: ../../library/io.rst:148 msgid "" "To find where the default locale encoding is used, you can enable the ``-X " "warn_default_encoding`` command line option or set the :envvar:" @@ -201,7 +205,7 @@ msgid "" "`EncodingWarning` when the default encoding is used." msgstr "" -#: ../../library/io.rst:151 +#: ../../library/io.rst:153 msgid "" "If you are providing an API that uses :func:`open` or :class:`TextIOWrapper` " "and passes ``encoding=None`` as a parameter, you can use :func:" @@ -210,45 +214,45 @@ msgid "" "consider using UTF-8 by default (i.e. ``encoding=\"utf-8\"``) for new APIs." msgstr "" -#: ../../library/io.rst:160 +#: ../../library/io.rst:162 msgid "High-level Module Interface" msgstr "" -#: ../../library/io.rst:164 +#: ../../library/io.rst:166 msgid "" "An int containing the default buffer size used by the module's buffered I/O " "classes. :func:`open` uses the file's blksize (as obtained by :func:`os." "stat`) if possible." msgstr "" -#: ../../library/io.rst:171 +#: ../../library/io.rst:173 msgid "This is an alias for the builtin :func:`open` function." msgstr "" -#: ../../library/io.rst:173 +#: ../../library/io.rst:175 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." msgstr "" -#: ../../library/io.rst:175 +#: ../../library/io.rst:177 msgid "" "This function raises an :ref:`auditing event ` ``open`` with " "arguments ``path``, ``mode`` and ``flags``. The ``mode`` and ``flags`` " "arguments may have been modified or inferred from the original call." msgstr "" -#: ../../library/io.rst:182 +#: ../../library/io.rst:184 msgid "" "Opens the provided file with mode ``'rb'``. This function should be used " "when the intent is to treat the contents as executable code." msgstr "" -#: ../../library/io.rst:185 +#: ../../library/io.rst:187 msgid "``path`` should be a :class:`str` and an absolute path." msgstr "" -#: ../../library/io.rst:187 +#: ../../library/io.rst:189 msgid "" "The behavior of this function may be overridden by an earlier call to the :c:" "func:`PyFile_SetOpenCodeHook`. However, assuming that ``path`` is a :class:" @@ -257,62 +261,69 @@ msgid "" "additional validation or preprocessing of the file." msgstr "" -#: ../../library/io.rst:198 +#: ../../library/io.rst:200 msgid "" "This is a helper function for callables that use :func:`open` or :class:" "`TextIOWrapper` and have an ``encoding=None`` parameter." msgstr "" -#: ../../library/io.rst:201 +#: ../../library/io.rst:203 msgid "" -"This function returns *encoding* if it is not ``None`` and ``\"locale\"`` if " -"*encoding* is ``None``." +"This function returns *encoding* if it is not ``None``. Otherwise, it " +"returns ``\"locale\"`` or ``\"utf-8\"`` depending on :ref:`UTF-8 Mode `." msgstr "" -#: ../../library/io.rst:204 +#: ../../library/io.rst:207 msgid "" "This function emits an :class:`EncodingWarning` if :data:`sys.flags." -"warn_default_encoding ` is true and *encoding* is None. " +"warn_default_encoding ` is true and *encoding* is ``None``. " "*stacklevel* specifies where the warning is emitted. For example::" msgstr "" -#: ../../library/io.rst:214 +#: ../../library/io.rst:217 msgid "" "In this example, an :class:`EncodingWarning` is emitted for the caller of " "``read_text()``." msgstr "" -#: ../../library/io.rst:217 +#: ../../library/io.rst:220 msgid "See :ref:`io-text-encoding` for more information." msgstr "更多資訊請見 :ref:`io-text-encoding`\\ 。" #: ../../library/io.rst:224 msgid "" +":func:`text_encoding` returns \"utf-8\" when UTF-8 mode is enabled and " +"*encoding* is ``None``." +msgstr "" + +#: ../../library/io.rst:231 +msgid "" "This is a compatibility alias for the builtin :exc:`BlockingIOError` " "exception." msgstr "" -#: ../../library/io.rst:230 +#: ../../library/io.rst:237 msgid "" "An exception inheriting :exc:`OSError` and :exc:`ValueError` that is raised " "when an unsupported operation is called on a stream." msgstr "" -#: ../../library/io.rst:237 +#: ../../library/io.rst:244 msgid ":mod:`sys`" msgstr ":mod:`sys`" -#: ../../library/io.rst:237 +#: ../../library/io.rst:244 msgid "" "contains the standard IO streams: :data:`sys.stdin`, :data:`sys.stdout`, " "and :data:`sys.stderr`." msgstr "" -#: ../../library/io.rst:242 +#: ../../library/io.rst:249 msgid "Class hierarchy" msgstr "" -#: ../../library/io.rst:244 +#: ../../library/io.rst:251 msgid "" "The implementation of I/O streams is organized as a hierarchy of classes. " "First :term:`abstract base classes ` (ABCs), which are " @@ -320,7 +331,7 @@ msgid "" "providing the standard stream implementations." msgstr "" -#: ../../library/io.rst:251 +#: ../../library/io.rst:258 msgid "" "The abstract base classes also provide default implementations of some " "methods in order to help implementation of concrete stream classes. For " @@ -328,7 +339,7 @@ msgid "" "meth:`~IOBase.readinto` and :meth:`~IOBase.readline`." msgstr "" -#: ../../library/io.rst:256 +#: ../../library/io.rst:263 msgid "" "At the top of the I/O hierarchy is the abstract base class :class:`IOBase`. " "It defines the basic interface to a stream. Note, however, that there is no " @@ -337,14 +348,14 @@ msgid "" "operation." msgstr "" -#: ../../library/io.rst:261 +#: ../../library/io.rst:268 msgid "" "The :class:`RawIOBase` ABC extends :class:`IOBase`. It deals with the " "reading and writing of bytes to a stream. :class:`FileIO` subclasses :class:" "`RawIOBase` to provide an interface to files in the machine's file system." msgstr "" -#: ../../library/io.rst:265 +#: ../../library/io.rst:272 msgid "" "The :class:`BufferedIOBase` ABC extends :class:`IOBase`. It deals with " "buffering on a raw binary stream (:class:`RawIOBase`). Its subclasses, :" @@ -355,7 +366,7 @@ msgid "" "class:`BytesIO`, is a stream of in-memory bytes." msgstr "" -#: ../../library/io.rst:273 +#: ../../library/io.rst:280 msgid "" "The :class:`TextIOBase` ABC extends :class:`IOBase`. It deals with streams " "whose bytes represent text, and handles encoding and decoding to and from " @@ -364,102 +375,102 @@ msgid "" "Finally, :class:`StringIO` is an in-memory stream for text." msgstr "" -#: ../../library/io.rst:279 +#: ../../library/io.rst:286 msgid "" "Argument names are not part of the specification, and only the arguments of :" "func:`open` are intended to be used as keyword arguments." msgstr "" -#: ../../library/io.rst:282 +#: ../../library/io.rst:289 msgid "" "The following table summarizes the ABCs provided by the :mod:`io` module:" msgstr "" -#: ../../library/io.rst:287 +#: ../../library/io.rst:294 msgid "ABC" msgstr "ABC" -#: ../../library/io.rst:287 +#: ../../library/io.rst:294 msgid "Inherits" msgstr "" -#: ../../library/io.rst:287 +#: ../../library/io.rst:294 msgid "Stub Methods" msgstr "" -#: ../../library/io.rst:287 +#: ../../library/io.rst:294 msgid "Mixin Methods and Properties" msgstr "" -#: ../../library/io.rst:289 ../../library/io.rst:294 ../../library/io.rst:296 -#: ../../library/io.rst:298 +#: ../../library/io.rst:296 ../../library/io.rst:301 ../../library/io.rst:303 +#: ../../library/io.rst:305 msgid ":class:`IOBase`" msgstr ":class:`IOBase`" -#: ../../library/io.rst:289 +#: ../../library/io.rst:296 msgid "``fileno``, ``seek``, and ``truncate``" msgstr "``fileno``\\ 、\\ ``seek`` 和 ``truncate``" -#: ../../library/io.rst:289 +#: ../../library/io.rst:296 msgid "" "``close``, ``closed``, ``__enter__``, ``__exit__``, ``flush``, ``isatty``, " "``__iter__``, ``__next__``, ``readable``, ``readline``, ``readlines``, " "``seekable``, ``tell``, ``writable``, and ``writelines``" msgstr "" -#: ../../library/io.rst:294 +#: ../../library/io.rst:301 msgid ":class:`RawIOBase`" msgstr ":class:`RawIOBase`" -#: ../../library/io.rst:294 +#: ../../library/io.rst:301 msgid "``readinto`` and ``write``" msgstr "``readinto`` 和 ``write``" -#: ../../library/io.rst:294 +#: ../../library/io.rst:301 msgid "Inherited :class:`IOBase` methods, ``read``, and ``readall``" msgstr "" -#: ../../library/io.rst:296 +#: ../../library/io.rst:303 msgid ":class:`BufferedIOBase`" msgstr ":class:`BufferedIOBase`" -#: ../../library/io.rst:296 +#: ../../library/io.rst:303 msgid "``detach``, ``read``, ``read1``, and ``write``" msgstr "``detach``\\ 、\\ ``read``\\ 、\\ ``read1`` 和 ``write``" -#: ../../library/io.rst:296 +#: ../../library/io.rst:303 msgid "Inherited :class:`IOBase` methods, ``readinto``, and ``readinto1``" msgstr "" -#: ../../library/io.rst:298 +#: ../../library/io.rst:305 msgid ":class:`TextIOBase`" msgstr ":class:`TextIOBase`" -#: ../../library/io.rst:298 +#: ../../library/io.rst:305 msgid "``detach``, ``read``, ``readline``, and ``write``" msgstr "``detach``\\ 、\\ ``read``\\ 、\\ ``readline`` 和 ``write``" -#: ../../library/io.rst:298 +#: ../../library/io.rst:305 msgid "" "Inherited :class:`IOBase` methods, ``encoding``, ``errors``, and ``newlines``" msgstr "" -#: ../../library/io.rst:305 +#: ../../library/io.rst:312 msgid "I/O Base Classes" msgstr "" -#: ../../library/io.rst:309 +#: ../../library/io.rst:316 msgid "The abstract base class for all I/O classes." msgstr "" -#: ../../library/io.rst:311 +#: ../../library/io.rst:318 msgid "" "This class provides empty abstract implementations for many methods that " "derived classes can override selectively; the default implementations " "represent a file that cannot be read, written or seeked." msgstr "" -#: ../../library/io.rst:316 +#: ../../library/io.rst:323 msgid "" "Even though :class:`IOBase` does not declare :meth:`read` or :meth:`write` " "because their signatures will vary, implementations and clients should " @@ -468,20 +479,20 @@ msgid "" "they do not support are called." msgstr "" -#: ../../library/io.rst:322 +#: ../../library/io.rst:329 msgid "" "The basic type used for binary data read from or written to a file is :class:" "`bytes`. Other :term:`bytes-like objects ` are accepted " "as method arguments too. Text I/O classes work with :class:`str` data." msgstr "" -#: ../../library/io.rst:326 +#: ../../library/io.rst:333 msgid "" "Note that calling any method (even inquiries) on a closed stream is " "undefined. Implementations may raise :exc:`ValueError` in this case." msgstr "" -#: ../../library/io.rst:329 +#: ../../library/io.rst:336 msgid "" ":class:`IOBase` (and its subclasses) supports the iterator protocol, meaning " "that an :class:`IOBase` object can be iterated over yielding the lines in a " @@ -490,140 +501,140 @@ msgid "" "character strings). See :meth:`~IOBase.readline` below." msgstr "" -#: ../../library/io.rst:335 +#: ../../library/io.rst:342 msgid "" ":class:`IOBase` is also a context manager and therefore supports the :" "keyword:`with` statement. In this example, *file* is closed after the :" "keyword:`!with` statement's suite is finished---even if an exception occurs::" msgstr "" -#: ../../library/io.rst:342 +#: ../../library/io.rst:349 msgid ":class:`IOBase` provides these data attributes and methods:" msgstr "" -#: ../../library/io.rst:346 +#: ../../library/io.rst:353 msgid "" "Flush and close this stream. This method has no effect if the file is " "already closed. Once the file is closed, any operation on the file (e.g. " "reading or writing) will raise a :exc:`ValueError`." msgstr "" -#: ../../library/io.rst:350 +#: ../../library/io.rst:357 msgid "" "As a convenience, it is allowed to call this method more than once; only the " "first call, however, will have an effect." msgstr "" -#: ../../library/io.rst:355 +#: ../../library/io.rst:362 msgid "``True`` if the stream is closed." msgstr "" -#: ../../library/io.rst:359 +#: ../../library/io.rst:366 msgid "" "Return the underlying file descriptor (an integer) of the stream if it " "exists. An :exc:`OSError` is raised if the IO object does not use a file " "descriptor." msgstr "" -#: ../../library/io.rst:365 +#: ../../library/io.rst:372 msgid "" "Flush the write buffers of the stream if applicable. This does nothing for " "read-only and non-blocking streams." msgstr "" -#: ../../library/io.rst:370 +#: ../../library/io.rst:377 msgid "" "Return ``True`` if the stream is interactive (i.e., connected to a terminal/" "tty device)." msgstr "" -#: ../../library/io.rst:375 +#: ../../library/io.rst:382 msgid "" "Return ``True`` if the stream can be read from. If ``False``, :meth:`read` " "will raise :exc:`OSError`." msgstr "" -#: ../../library/io.rst:380 +#: ../../library/io.rst:387 msgid "" "Read and return one line from the stream. If *size* is specified, at most " "*size* bytes will be read." msgstr "" -#: ../../library/io.rst:383 +#: ../../library/io.rst:390 msgid "" "The line terminator is always ``b'\\n'`` for binary files; for text files, " "the *newline* argument to :func:`open` can be used to select the line " "terminator(s) recognized." msgstr "" -#: ../../library/io.rst:389 +#: ../../library/io.rst:396 msgid "" "Read and return a list of lines from the stream. *hint* can be specified to " "control the number of lines read: no more lines will be read if the total " "size (in bytes/characters) of all lines so far exceeds *hint*." msgstr "" -#: ../../library/io.rst:393 +#: ../../library/io.rst:400 msgid "" "*hint* values of ``0`` or less, as well as ``None``, are treated as no hint." msgstr "" -#: ../../library/io.rst:396 +#: ../../library/io.rst:403 msgid "" "Note that it's already possible to iterate on file objects using ``for line " "in file: ...`` without calling ``file.readlines()``." msgstr "" -#: ../../library/io.rst:401 +#: ../../library/io.rst:408 msgid "" "Change the stream position to the given byte *offset*. *offset* is " "interpreted relative to the position indicated by *whence*. The default " "value for *whence* is :data:`SEEK_SET`. Values for *whence* are:" msgstr "" -#: ../../library/io.rst:405 +#: ../../library/io.rst:412 msgid "" ":data:`SEEK_SET` or ``0`` -- start of the stream (the default); *offset* " "should be zero or positive" msgstr "" -#: ../../library/io.rst:407 +#: ../../library/io.rst:414 msgid "" ":data:`SEEK_CUR` or ``1`` -- current stream position; *offset* may be " "negative" msgstr "" -#: ../../library/io.rst:409 +#: ../../library/io.rst:416 msgid "" ":data:`SEEK_END` or ``2`` -- end of the stream; *offset* is usually negative" msgstr "" -#: ../../library/io.rst:412 +#: ../../library/io.rst:419 msgid "Return the new absolute position." msgstr "" -#: ../../library/io.rst:414 ../../library/io.rst:923 +#: ../../library/io.rst:421 ../../library/io.rst:930 msgid "The ``SEEK_*`` constants." msgstr "" -#: ../../library/io.rst:417 +#: ../../library/io.rst:424 msgid "" "Some operating systems could support additional values, like :data:`os." "SEEK_HOLE` or :data:`os.SEEK_DATA`. The valid values for a file could depend " "on it being open in text or binary mode." msgstr "" -#: ../../library/io.rst:424 +#: ../../library/io.rst:431 msgid "" "Return ``True`` if the stream supports random access. If ``False``, :meth:" "`seek`, :meth:`tell` and :meth:`truncate` will raise :exc:`OSError`." msgstr "" -#: ../../library/io.rst:429 +#: ../../library/io.rst:436 msgid "Return the current stream position." msgstr "" -#: ../../library/io.rst:433 +#: ../../library/io.rst:440 msgid "" "Resize the stream to the given *size* in bytes (or the current position if " "*size* is not specified). The current stream position isn't changed. This " @@ -632,34 +643,34 @@ msgid "" "additional bytes are zero-filled). The new file size is returned." msgstr "" -#: ../../library/io.rst:440 +#: ../../library/io.rst:447 msgid "Windows will now zero-fill files when extending." msgstr "" -#: ../../library/io.rst:445 +#: ../../library/io.rst:452 msgid "" "Return ``True`` if the stream supports writing. If ``False``, :meth:`write` " "and :meth:`truncate` will raise :exc:`OSError`." msgstr "" -#: ../../library/io.rst:450 +#: ../../library/io.rst:457 msgid "" "Write a list of lines to the stream. Line separators are not added, so it " "is usual for each of the lines provided to have a line separator at the end." msgstr "" -#: ../../library/io.rst:456 +#: ../../library/io.rst:463 msgid "" "Prepare for object destruction. :class:`IOBase` provides a default " "implementation of this method that calls the instance's :meth:`~IOBase." "close` method." msgstr "" -#: ../../library/io.rst:463 +#: ../../library/io.rst:470 msgid "Base class for raw binary streams. It inherits :class:`IOBase`." msgstr "" -#: ../../library/io.rst:465 +#: ../../library/io.rst:472 msgid "" "Raw binary streams typically provide low-level access to an underlying OS " "device or API, and do not try to encapsulate it in high-level primitives " @@ -667,13 +678,13 @@ msgid "" "text streams, described later in this page)." msgstr "" -#: ../../library/io.rst:470 +#: ../../library/io.rst:477 msgid "" ":class:`RawIOBase` provides these methods in addition to those from :class:" "`IOBase`:" msgstr "" -#: ../../library/io.rst:475 +#: ../../library/io.rst:482 msgid "" "Read up to *size* bytes from the object and return them. As a convenience, " "if *size* is unspecified or -1, all bytes until EOF are returned. Otherwise, " @@ -681,25 +692,25 @@ msgid "" "if the operating system call returns fewer than *size* bytes." msgstr "" -#: ../../library/io.rst:480 +#: ../../library/io.rst:487 msgid "" "If 0 bytes are returned, and *size* was not 0, this indicates end of file. " "If the object is in non-blocking mode and no bytes are available, ``None`` " "is returned." msgstr "" -#: ../../library/io.rst:484 +#: ../../library/io.rst:491 msgid "" "The default implementation defers to :meth:`readall` and :meth:`readinto`." msgstr "" -#: ../../library/io.rst:489 +#: ../../library/io.rst:496 msgid "" "Read and return all the bytes from the stream until EOF, using multiple " "calls to the stream if necessary." msgstr "" -#: ../../library/io.rst:494 +#: ../../library/io.rst:501 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b*, and " "return the number of bytes read. For example, *b* might be a :class:" @@ -707,7 +718,7 @@ msgid "" "available, ``None`` is returned." msgstr "" -#: ../../library/io.rst:502 +#: ../../library/io.rst:509 msgid "" "Write the given :term:`bytes-like object`, *b*, to the underlying raw " "stream, and return the number of bytes written. This can be less than the " @@ -718,13 +729,13 @@ msgid "" "the implementation should only access *b* during the method call." msgstr "" -#: ../../library/io.rst:515 +#: ../../library/io.rst:522 msgid "" "Base class for binary streams that support some kind of buffering. It " "inherits :class:`IOBase`." msgstr "" -#: ../../library/io.rst:518 +#: ../../library/io.rst:525 msgid "" "The main difference with :class:`RawIOBase` is that methods :meth:`read`, :" "meth:`readinto` and :meth:`write` will try (respectively) to read as much " @@ -732,7 +743,7 @@ msgid "" "perhaps more than one system call." msgstr "" -#: ../../library/io.rst:523 +#: ../../library/io.rst:530 msgid "" "In addition, those methods can raise :exc:`BlockingIOError` if the " "underlying raw stream is in non-blocking mode and cannot take or give enough " @@ -740,55 +751,55 @@ msgid "" "``None``." msgstr "" -#: ../../library/io.rst:528 +#: ../../library/io.rst:535 msgid "" "Besides, the :meth:`read` method does not have a default implementation that " "defers to :meth:`readinto`." msgstr "" -#: ../../library/io.rst:531 +#: ../../library/io.rst:538 msgid "" "A typical :class:`BufferedIOBase` implementation should not inherit from a :" "class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` " "and :class:`BufferedReader` do." msgstr "" -#: ../../library/io.rst:535 +#: ../../library/io.rst:542 msgid "" ":class:`BufferedIOBase` provides or overrides these data attributes and " "methods in addition to those from :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:540 +#: ../../library/io.rst:547 msgid "" "The underlying raw stream (a :class:`RawIOBase` instance) that :class:" "`BufferedIOBase` deals with. This is not part of the :class:" "`BufferedIOBase` API and may not exist on some implementations." msgstr "" -#: ../../library/io.rst:546 +#: ../../library/io.rst:553 msgid "Separate the underlying raw stream from the buffer and return it." msgstr "" -#: ../../library/io.rst:548 +#: ../../library/io.rst:555 msgid "" "After the raw stream has been detached, the buffer is in an unusable state." msgstr "" -#: ../../library/io.rst:551 +#: ../../library/io.rst:558 msgid "" "Some buffers, like :class:`BytesIO`, do not have the concept of a single raw " "stream to return from this method. They raise :exc:`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:559 +#: ../../library/io.rst:566 msgid "" "Read and return up to *size* bytes. If the argument is omitted, ``None``, " "or negative, data is read and returned until EOF is reached. An empty :" "class:`bytes` object is returned if the stream is already at EOF." msgstr "" -#: ../../library/io.rst:563 +#: ../../library/io.rst:570 msgid "" "If the argument is positive, and the underlying raw stream is not " "interactive, multiple raw reads may be issued to satisfy the byte count " @@ -797,13 +808,13 @@ msgid "" "imminent." msgstr "" -#: ../../library/io.rst:569 ../../library/io.rst:592 ../../library/io.rst:602 +#: ../../library/io.rst:576 ../../library/io.rst:599 ../../library/io.rst:609 msgid "" "A :exc:`BlockingIOError` is raised if the underlying raw stream is in non " "blocking-mode, and has no data available at the moment." msgstr "" -#: ../../library/io.rst:574 +#: ../../library/io.rst:581 msgid "" "Read and return up to *size* bytes, with at most one call to the underlying " "raw stream's :meth:`~RawIOBase.read` (or :meth:`~RawIOBase.readinto`) " @@ -811,26 +822,26 @@ msgid "" "top of a :class:`BufferedIOBase` object." msgstr "" -#: ../../library/io.rst:580 +#: ../../library/io.rst:587 msgid "" "If *size* is ``-1`` (the default), an arbitrary number of bytes are returned " "(more than zero unless EOF is reached)." msgstr "" -#: ../../library/io.rst:585 +#: ../../library/io.rst:592 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and " "return the number of bytes read. For example, *b* might be a :class:" "`bytearray`." msgstr "" -#: ../../library/io.rst:589 +#: ../../library/io.rst:596 msgid "" "Like :meth:`read`, multiple reads may be issued to the underlying raw " "stream, unless the latter is interactive." msgstr "" -#: ../../library/io.rst:597 +#: ../../library/io.rst:604 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b*, " "using at most one call to the underlying raw stream's :meth:`~RawIOBase." @@ -838,7 +849,7 @@ msgid "" "read." msgstr "" -#: ../../library/io.rst:609 +#: ../../library/io.rst:616 msgid "" "Write the given :term:`bytes-like object`, *b*, and return the number of " "bytes written (always equal to the length of *b* in bytes, since if the " @@ -847,41 +858,41 @@ msgid "" "or held in a buffer for performance and latency reasons." msgstr "" -#: ../../library/io.rst:616 +#: ../../library/io.rst:623 msgid "" "When in non-blocking mode, a :exc:`BlockingIOError` is raised if the data " "needed to be written to the raw stream but it couldn't accept all the data " "without blocking." msgstr "" -#: ../../library/io.rst:620 +#: ../../library/io.rst:627 msgid "" "The caller may release or mutate *b* after this method returns, so the " "implementation should only access *b* during the method call." msgstr "" -#: ../../library/io.rst:625 +#: ../../library/io.rst:632 msgid "Raw File I/O" msgstr "" -#: ../../library/io.rst:629 +#: ../../library/io.rst:636 msgid "" "A raw binary stream representing an OS-level file containing bytes data. It " "inherits :class:`RawIOBase`." msgstr "" -#: ../../library/io.rst:632 +#: ../../library/io.rst:639 msgid "The *name* can be one of two things:" msgstr "" -#: ../../library/io.rst:634 +#: ../../library/io.rst:641 msgid "" "a character string or :class:`bytes` object representing the path to the " "file which will be opened. In this case closefd must be ``True`` (the " "default) otherwise an error will be raised." msgstr "" -#: ../../library/io.rst:637 +#: ../../library/io.rst:644 msgid "" "an integer representing the number of an existing OS-level file descriptor " "to which the resulting :class:`FileIO` object will give access. When the " @@ -889,7 +900,7 @@ msgid "" "set to ``False``." msgstr "" -#: ../../library/io.rst:642 +#: ../../library/io.rst:649 msgid "" "The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading " "(default), writing, exclusive creation or appending. The file will be " @@ -900,13 +911,13 @@ msgid "" "``'+'`` to the mode to allow simultaneous reading and writing." msgstr "" -#: ../../library/io.rst:650 +#: ../../library/io.rst:657 msgid "" "The :meth:`read` (when called with a positive argument), :meth:`readinto` " "and :meth:`write` methods on this class will only make one system call." msgstr "" -#: ../../library/io.rst:653 +#: ../../library/io.rst:660 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -915,380 +926,379 @@ msgid "" "similar to passing ``None``)." msgstr "" -#: ../../library/io.rst:659 +#: ../../library/io.rst:666 msgid "The newly created file is :ref:`non-inheritable `." msgstr "" -#: ../../library/io.rst:661 +#: ../../library/io.rst:668 msgid "" "See the :func:`open` built-in function for examples on using the *opener* " "parameter." msgstr "" -#: ../../library/io.rst:664 +#: ../../library/io.rst:671 msgid "The *opener* parameter was added. The ``'x'`` mode was added." msgstr "" -#: ../../library/io.rst:668 +#: ../../library/io.rst:675 msgid "The file is now non-inheritable." msgstr "" -#: ../../library/io.rst:671 +#: ../../library/io.rst:678 msgid "" ":class:`FileIO` provides these data attributes in addition to those from :" "class:`RawIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:676 +#: ../../library/io.rst:683 msgid "The mode as given in the constructor." msgstr "" -#: ../../library/io.rst:680 +#: ../../library/io.rst:687 msgid "" "The file name. This is the file descriptor of the file when no name is " "given in the constructor." msgstr "" -#: ../../library/io.rst:685 +#: ../../library/io.rst:692 msgid "Buffered Streams" msgstr "" -#: ../../library/io.rst:687 +#: ../../library/io.rst:694 msgid "" "Buffered I/O streams provide a higher-level interface to an I/O device than " "raw I/O does." msgstr "" -#: ../../library/io.rst:692 +#: ../../library/io.rst:699 msgid "" "A binary stream using an in-memory bytes buffer. It inherits :class:" "`BufferedIOBase`. The buffer is discarded when the :meth:`~IOBase.close` " "method is called." msgstr "" -#: ../../library/io.rst:696 +#: ../../library/io.rst:703 msgid "" "The optional argument *initial_bytes* is a :term:`bytes-like object` that " "contains initial data." msgstr "" -#: ../../library/io.rst:699 +#: ../../library/io.rst:706 msgid "" ":class:`BytesIO` provides or overrides these methods in addition to those " "from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:704 +#: ../../library/io.rst:711 msgid "" "Return a readable and writable view over the contents of the buffer without " "copying them. Also, mutating the view will transparently update the " "contents of the buffer::" msgstr "" -#: ../../library/io.rst:715 +#: ../../library/io.rst:722 msgid "" "As long as the view exists, the :class:`BytesIO` object cannot be resized or " "closed." msgstr "" -#: ../../library/io.rst:722 +#: ../../library/io.rst:729 msgid "Return :class:`bytes` containing the entire contents of the buffer." msgstr "" -#: ../../library/io.rst:727 +#: ../../library/io.rst:734 msgid "In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.read`." msgstr "" -#: ../../library/io.rst:729 ../../library/io.rst:772 +#: ../../library/io.rst:736 ../../library/io.rst:779 msgid "The *size* argument is now optional." msgstr "" -#: ../../library/io.rst:734 +#: ../../library/io.rst:741 msgid "" "In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.readinto`." msgstr "" -#: ../../library/io.rst:740 +#: ../../library/io.rst:747 msgid "" "A buffered binary stream providing higher-level access to a readable, non " "seekable :class:`RawIOBase` raw binary stream. It inherits :class:" "`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:744 +#: ../../library/io.rst:751 msgid "" "When reading data from this object, a larger amount of data may be requested " "from the underlying raw stream, and kept in an internal buffer. The buffered " "data can then be returned directly on subsequent reads." msgstr "" -#: ../../library/io.rst:748 +#: ../../library/io.rst:755 msgid "" "The constructor creates a :class:`BufferedReader` for the given readable " "*raw* stream and *buffer_size*. If *buffer_size* is omitted, :data:" "`DEFAULT_BUFFER_SIZE` is used." msgstr "" -#: ../../library/io.rst:752 +#: ../../library/io.rst:759 msgid "" ":class:`BufferedReader` provides or overrides these methods in addition to " "those from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:757 +#: ../../library/io.rst:764 msgid "" "Return bytes from the stream without advancing the position. At most one " "single read on the raw stream is done to satisfy the call. The number of " "bytes returned may be less or more than requested." msgstr "" -#: ../../library/io.rst:763 +#: ../../library/io.rst:770 msgid "" "Read and return *size* bytes, or if *size* is not given or negative, until " "EOF or if the read call would block in non-blocking mode." msgstr "" -#: ../../library/io.rst:768 +#: ../../library/io.rst:775 msgid "" "Read and return up to *size* bytes with only one call on the raw stream. If " "at least one byte is buffered, only buffered bytes are returned. Otherwise, " "one raw stream read call is made." msgstr "" -#: ../../library/io.rst:778 +#: ../../library/io.rst:785 msgid "" "A buffered binary stream providing higher-level access to a writeable, non " "seekable :class:`RawIOBase` raw binary stream. It inherits :class:" "`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:782 +#: ../../library/io.rst:789 msgid "" "When writing to this object, data is normally placed into an internal " "buffer. The buffer will be written out to the underlying :class:`RawIOBase` " "object under various conditions, including:" msgstr "" -#: ../../library/io.rst:786 +#: ../../library/io.rst:793 msgid "when the buffer gets too small for all pending data;" msgstr "" -#: ../../library/io.rst:787 +#: ../../library/io.rst:794 msgid "when :meth:`flush()` is called;" msgstr "" -#: ../../library/io.rst:788 +#: ../../library/io.rst:795 msgid "" "when a :meth:`seek()` is requested (for :class:`BufferedRandom` objects);" msgstr "" -#: ../../library/io.rst:789 +#: ../../library/io.rst:796 msgid "when the :class:`BufferedWriter` object is closed or destroyed." msgstr "" -#: ../../library/io.rst:791 +#: ../../library/io.rst:798 msgid "" "The constructor creates a :class:`BufferedWriter` for the given writeable " "*raw* stream. If the *buffer_size* is not given, it defaults to :data:" "`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:795 +#: ../../library/io.rst:802 msgid "" ":class:`BufferedWriter` provides or overrides these methods in addition to " "those from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:800 +#: ../../library/io.rst:807 msgid "" "Force bytes held in the buffer into the raw stream. A :exc:" "`BlockingIOError` should be raised if the raw stream blocks." msgstr "" -#: ../../library/io.rst:805 +#: ../../library/io.rst:812 msgid "" "Write the :term:`bytes-like object`, *b*, and return the number of bytes " "written. When in non-blocking mode, a :exc:`BlockingIOError` is raised if " "the buffer needs to be written out but the raw stream blocks." msgstr "" -#: ../../library/io.rst:813 +#: ../../library/io.rst:820 msgid "" "A buffered binary stream providing higher-level access to a seekable :class:" "`RawIOBase` raw binary stream. It inherits :class:`BufferedReader` and :" "class:`BufferedWriter`." msgstr "" -#: ../../library/io.rst:817 +#: ../../library/io.rst:824 msgid "" "The constructor creates a reader and writer for a seekable raw stream, given " "in the first argument. If the *buffer_size* is omitted it defaults to :data:" "`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:821 +#: ../../library/io.rst:828 msgid "" ":class:`BufferedRandom` is capable of anything :class:`BufferedReader` or :" "class:`BufferedWriter` can do. In addition, :meth:`seek` and :meth:`tell` " "are guaranteed to be implemented." msgstr "" -#: ../../library/io.rst:828 +#: ../../library/io.rst:835 msgid "" "A buffered binary stream providing higher-level access to two non seekable :" "class:`RawIOBase` raw binary streams---one readable, the other writeable. It " "inherits :class:`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:832 +#: ../../library/io.rst:839 msgid "" "*reader* and *writer* are :class:`RawIOBase` objects that are readable and " "writeable respectively. If the *buffer_size* is omitted it defaults to :" "data:`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:836 +#: ../../library/io.rst:843 msgid "" ":class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\\'s " "methods except for :meth:`~BufferedIOBase.detach`, which raises :exc:" "`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:842 +#: ../../library/io.rst:849 msgid "" ":class:`BufferedRWPair` does not attempt to synchronize accesses to its " "underlying raw streams. You should not pass it the same object as reader " "and writer; use :class:`BufferedRandom` instead." msgstr "" -#: ../../library/io.rst:852 +#: ../../library/io.rst:859 msgid "" "Base class for text streams. This class provides a character and line based " "interface to stream I/O. It inherits :class:`IOBase`." msgstr "" -#: ../../library/io.rst:855 +#: ../../library/io.rst:862 msgid "" ":class:`TextIOBase` provides or overrides these data attributes and methods " "in addition to those from :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:860 +#: ../../library/io.rst:867 msgid "" "The name of the encoding used to decode the stream's bytes into strings, and " "to encode strings into bytes." msgstr "" -#: ../../library/io.rst:865 +#: ../../library/io.rst:872 msgid "The error setting of the decoder or encoder." msgstr "" -#: ../../library/io.rst:869 +#: ../../library/io.rst:876 msgid "" "A string, a tuple of strings, or ``None``, indicating the newlines " "translated so far. Depending on the implementation and the initial " "constructor flags, this may not be available." msgstr "" -#: ../../library/io.rst:875 +#: ../../library/io.rst:882 msgid "" "The underlying binary buffer (a :class:`BufferedIOBase` instance) that :" "class:`TextIOBase` deals with. This is not part of the :class:`TextIOBase` " "API and may not exist in some implementations." msgstr "" -#: ../../library/io.rst:881 +#: ../../library/io.rst:888 msgid "" "Separate the underlying binary buffer from the :class:`TextIOBase` and " "return it." msgstr "" -#: ../../library/io.rst:884 +#: ../../library/io.rst:891 msgid "" "After the underlying buffer has been detached, the :class:`TextIOBase` is in " "an unusable state." msgstr "" -#: ../../library/io.rst:887 +#: ../../library/io.rst:894 msgid "" "Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not " "have the concept of an underlying buffer and calling this method will raise :" "exc:`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:895 +#: ../../library/io.rst:902 msgid "" "Read and return at most *size* characters from the stream as a single :class:" "`str`. If *size* is negative or ``None``, reads until EOF." msgstr "" -#: ../../library/io.rst:900 +#: ../../library/io.rst:907 msgid "" "Read until newline or EOF and return a single ``str``. If the stream is " "already at EOF, an empty string is returned." msgstr "" -#: ../../library/io.rst:903 +#: ../../library/io.rst:910 msgid "If *size* is specified, at most *size* characters will be read." msgstr "" -#: ../../library/io.rst:907 +#: ../../library/io.rst:914 msgid "" "Change the stream position to the given *offset*. Behaviour depends on the " "*whence* parameter. The default value for *whence* is :data:`SEEK_SET`." msgstr "" -#: ../../library/io.rst:911 +#: ../../library/io.rst:918 msgid "" ":data:`SEEK_SET` or ``0``: seek from the start of the stream (the default); " "*offset* must either be a number returned by :meth:`TextIOBase.tell`, or " "zero. Any other *offset* value produces undefined behaviour." msgstr "" -#: ../../library/io.rst:915 +#: ../../library/io.rst:922 msgid "" ":data:`SEEK_CUR` or ``1``: \"seek\" to the current position; *offset* must " "be zero, which is a no-operation (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:918 +#: ../../library/io.rst:925 msgid "" ":data:`SEEK_END` or ``2``: seek to the end of the stream; *offset* must be " "zero (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:921 +#: ../../library/io.rst:928 msgid "Return the new absolute position as an opaque number." msgstr "" -#: ../../library/io.rst:928 +#: ../../library/io.rst:935 msgid "" "Return the current stream position as an opaque number. The number does not " "usually represent a number of bytes in the underlying binary storage." msgstr "" -#: ../../library/io.rst:934 +#: ../../library/io.rst:941 msgid "" "Write the string *s* to the stream and return the number of characters " "written." msgstr "" -#: ../../library/io.rst:941 +#: ../../library/io.rst:948 msgid "" "A buffered text stream providing higher-level access to a :class:" "`BufferedIOBase` buffered binary stream. It inherits :class:`TextIOBase`." msgstr "" -#: ../../library/io.rst:945 +#: ../../library/io.rst:952 msgid "" "*encoding* gives the name of the encoding that the stream will be decoded or " -"encoded with. It defaults to :func:`locale.getpreferredencoding(False) " -"`. ``encoding=\"locale\"`` can be used to " -"specify the current locale's encoding explicitly. See :ref:`io-text-" -"encoding` for more information." +"encoded with. It defaults to :func:`locale.getencoding()`. ``encoding=" +"\"locale\"`` can be used to specify the current locale's encoding " +"explicitly. See :ref:`io-text-encoding` for more information." msgstr "" -#: ../../library/io.rst:951 +#: ../../library/io.rst:957 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` " @@ -1303,13 +1313,13 @@ msgid "" "that has been registered with :func:`codecs.register_error` is also valid." msgstr "" -#: ../../library/io.rst:967 +#: ../../library/io.rst:973 msgid "" "*newline* controls how line endings are handled. It can be ``None``, " "``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/io.rst:970 +#: ../../library/io.rst:976 msgid "" "When reading input from the stream, if *newline* is ``None``, :term:" "`universal newlines` mode is enabled. Lines in the input can end in " @@ -1321,7 +1331,7 @@ msgid "" "returned to the caller untranslated." msgstr "" -#: ../../library/io.rst:979 +#: ../../library/io.rst:985 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -1330,24 +1340,24 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/io.rst:985 +#: ../../library/io.rst:991 msgid "" "If *line_buffering* is ``True``, :meth:`flush` is implied when a call to " "write contains a newline character or a carriage return." msgstr "" -#: ../../library/io.rst:988 +#: ../../library/io.rst:994 msgid "" "If *write_through* is ``True``, calls to :meth:`write` are guaranteed not to " "be buffered: any data written on the :class:`TextIOWrapper` object is " "immediately handled to its underlying binary *buffer*." msgstr "" -#: ../../library/io.rst:992 +#: ../../library/io.rst:998 msgid "The *write_through* argument has been added." msgstr "" -#: ../../library/io.rst:995 +#: ../../library/io.rst:1001 msgid "" "The default *encoding* is now ``locale.getpreferredencoding(False)`` instead " "of ``locale.getpreferredencoding()``. Don't change temporary the locale " @@ -1355,111 +1365,120 @@ msgid "" "instead of the user preferred encoding." msgstr "" -#: ../../library/io.rst:1001 +#: ../../library/io.rst:1007 msgid "" "The *encoding* argument now supports the ``\"locale\"`` dummy encoding name." msgstr "" -#: ../../library/io.rst:1004 +#: ../../library/io.rst:1010 msgid "" ":class:`TextIOWrapper` provides these data attributes and methods in " "addition to those from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1009 +#: ../../library/io.rst:1015 msgid "Whether line buffering is enabled." msgstr "" -#: ../../library/io.rst:1013 +#: ../../library/io.rst:1019 msgid "Whether writes are passed immediately to the underlying binary buffer." msgstr "" -#: ../../library/io.rst:1021 +#: ../../library/io.rst:1027 msgid "" "Reconfigure this text stream using new settings for *encoding*, *errors*, " "*newline*, *line_buffering* and *write_through*." msgstr "" -#: ../../library/io.rst:1024 +#: ../../library/io.rst:1030 msgid "" "Parameters not specified keep current settings, except ``errors='strict'`` " "is used when *encoding* is specified but *errors* is not specified." msgstr "" -#: ../../library/io.rst:1028 +#: ../../library/io.rst:1034 msgid "" "It is not possible to change the encoding or newline if some data has " "already been read from the stream. On the other hand, changing encoding " "after write is possible." msgstr "" -#: ../../library/io.rst:1032 +#: ../../library/io.rst:1038 msgid "" "This method does an implicit stream flush before setting the new parameters." msgstr "" -#: ../../library/io.rst:1040 +#: ../../library/io.rst:1043 +msgid "The method supports ``encoding=\"locale\"`` option." +msgstr "" + +#: ../../library/io.rst:1049 msgid "" "A text stream using an in-memory text buffer. It inherits :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:1043 +#: ../../library/io.rst:1052 msgid "" "The text buffer is discarded when the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:1046 +#: ../../library/io.rst:1055 msgid "" "The initial value of the buffer can be set by providing *initial_value*. If " "newline translation is enabled, newlines will be encoded as if by :meth:" -"`~TextIOBase.write`. The stream is positioned at the start of the buffer." +"`~TextIOBase.write`. The stream is positioned at the start of the buffer " +"which emulates opening an existing file in a `w+` mode, making it ready for " +"an immediate write from the beginning or for a write that would overwrite " +"the initial value. To emulate opening a file in an `a+` mode ready for " +"appending, use `f.seek(0, io.SEEK_END)` to reposition the stream at the end " +"of the buffer." msgstr "" -#: ../../library/io.rst:1051 +#: ../../library/io.rst:1064 msgid "" "The *newline* argument works like that of :class:`TextIOWrapper`, except " "that when writing output to the stream, if *newline* is ``None``, newlines " "are written as ``\\n`` on all platforms." msgstr "" -#: ../../library/io.rst:1055 +#: ../../library/io.rst:1068 msgid "" ":class:`StringIO` provides this method in addition to those from :class:" "`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1060 +#: ../../library/io.rst:1073 msgid "" "Return a ``str`` containing the entire contents of the buffer. Newlines are " "decoded as if by :meth:`~TextIOBase.read`, although the stream position is " "not changed." msgstr "" -#: ../../library/io.rst:1064 +#: ../../library/io.rst:1077 msgid "Example usage::" msgstr "" "使用範例:\n" "\n" "::" -#: ../../library/io.rst:1086 +#: ../../library/io.rst:1099 msgid "" "A helper codec that decodes newlines for :term:`universal newlines` mode. It " "inherits :class:`codecs.IncrementalDecoder`." msgstr "" -#: ../../library/io.rst:1091 +#: ../../library/io.rst:1104 msgid "Performance" msgstr "" -#: ../../library/io.rst:1093 +#: ../../library/io.rst:1106 msgid "" "This section discusses the performance of the provided concrete I/O " "implementations." msgstr "" -#: ../../library/io.rst:1099 +#: ../../library/io.rst:1112 msgid "" "By reading and writing only large chunks of data even when the user asks for " "a single byte, buffered I/O hides any inefficiency in calling and executing " @@ -1472,7 +1491,7 @@ msgid "" "data." msgstr "" -#: ../../library/io.rst:1111 +#: ../../library/io.rst:1124 msgid "" "Text I/O over a binary storage (such as a file) is significantly slower than " "binary I/O over the same storage, because it requires conversions between " @@ -1482,23 +1501,23 @@ msgid "" "to the reconstruction algorithm used." msgstr "" -#: ../../library/io.rst:1118 +#: ../../library/io.rst:1131 msgid "" ":class:`StringIO`, however, is a native in-memory unicode container and will " "exhibit similar speed to :class:`BytesIO`." msgstr "" -#: ../../library/io.rst:1122 +#: ../../library/io.rst:1135 msgid "Multi-threading" msgstr "" -#: ../../library/io.rst:1124 +#: ../../library/io.rst:1137 msgid "" ":class:`FileIO` objects are thread-safe to the extent that the operating " "system calls (such as ``read(2)`` under Unix) they wrap are thread-safe too." msgstr "" -#: ../../library/io.rst:1127 +#: ../../library/io.rst:1140 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) " @@ -1506,15 +1525,15 @@ msgid "" "them from multiple threads at once." msgstr "" -#: ../../library/io.rst:1132 +#: ../../library/io.rst:1145 msgid ":class:`TextIOWrapper` objects are not thread-safe." msgstr "" -#: ../../library/io.rst:1135 +#: ../../library/io.rst:1148 msgid "Reentrancy" msgstr "" -#: ../../library/io.rst:1137 +#: ../../library/io.rst:1150 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) are " @@ -1525,7 +1544,7 @@ msgid "" "from entering the buffered object." msgstr "" -#: ../../library/io.rst:1145 +#: ../../library/io.rst:1158 msgid "" "The above implicitly extends to text files, since the :func:`open()` " "function will wrap a buffered object inside a :class:`TextIOWrapper`. This " diff --git a/library/json.po b/library/json.po index 78c3206e22..d25aeb93d4 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -131,7 +131,7 @@ msgstr "" msgid "" "If *check_circular* is false (default: ``True``), then the circular " "reference check for container types will be skipped and a circular reference " -"will result in an :exc:`RecursionError` (or worse)." +"will result in a :exc:`RecursionError` (or worse)." msgstr "" #: ../../library/json.rst:162 @@ -509,7 +509,7 @@ msgstr "" msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " -"prevent an infinite recursion (which would cause an :exc:`RecursionError`). " +"prevent an infinite recursion (which would cause a :exc:`RecursionError`). " "Otherwise, no such check takes place." msgstr "" diff --git a/library/locale.po b/library/locale.po index 238b4f77d1..9b5faf8afb 100644 --- a/library/locale.po +++ b/library/locale.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-03 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -491,21 +491,21 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: ../../library/locale.rst:300 ../../library/locale.rst:311 +#: ../../library/locale.rst:300 ../../library/locale.rst:313 msgid "" "Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " "*language code* and *encoding* may be ``None`` if their values cannot be " "determined." msgstr "" -#: ../../library/locale.rst:307 +#: ../../library/locale.rst:309 msgid "" "Returns the current setting for the given locale category as sequence " "containing *language code*, *encoding*. *category* may be one of the :const:" "`LC_\\*` values except :const:`LC_ALL`. It defaults to :const:`LC_CTYPE`." msgstr "" -#: ../../library/locale.rst:318 +#: ../../library/locale.rst:320 msgid "" "Return the :term:`locale encoding` used for text data, according to user " "preferences. User preferences are expressed differently on different " @@ -513,56 +513,82 @@ msgid "" "this function only returns a guess." msgstr "" -#: ../../library/locale.rst:323 +#: ../../library/locale.rst:325 msgid "" "On some systems, it is necessary to invoke :func:`setlocale` to obtain the " "user preferences, so this function is not thread-safe. If invoking setlocale " "is not necessary or desired, *do_setlocale* should be set to ``False``." msgstr "" -#: ../../library/locale.rst:327 +#: ../../library/locale.rst:329 msgid "" "On Android or if the :ref:`Python UTF-8 Mode ` is enabled, always " -"return ``'UTF-8'``, the :term:`locale encoding` and the *do_setlocale* " +"return ``'utf-8'``, the :term:`locale encoding` and the *do_setlocale* " "argument are ignored." msgstr "" -#: ../../library/locale.rst:331 +#: ../../library/locale.rst:333 ../../library/locale.rst:351 msgid "" "The :ref:`Python preinitialization ` configures the LC_CTYPE " "locale. See also the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../library/locale.rst:334 +#: ../../library/locale.rst:336 msgid "" -"The function now always returns ``UTF-8`` on Android or if the :ref:`Python " -"UTF-8 Mode ` is enabled." +"The function now always returns ``\"utf-8\"`` on Android or if the :ref:" +"`Python UTF-8 Mode ` is enabled." msgstr "" -#: ../../library/locale.rst:341 +#: ../../library/locale.rst:343 +msgid "Get the current :term:`locale encoding`:" +msgstr "" + +#: ../../library/locale.rst:345 +msgid "On Android and VxWorks, return ``\"utf-8\"``." +msgstr "" + +#: ../../library/locale.rst:346 +msgid "" +"On Unix, return the encoding of the current :data:`LC_CTYPE` locale. Return " +"``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string: for " +"example, if the current LC_CTYPE locale is not supported." +msgstr "" + +#: ../../library/locale.rst:349 +msgid "On Windows, return the ANSI code page." +msgstr "" + +#: ../../library/locale.rst:354 +msgid "" +"This function is similar to :func:`getpreferredencoding(False) " +"` except this function ignores the :ref:`Python UTF-8 " +"Mode `." +msgstr "" + +#: ../../library/locale.rst:363 msgid "" "Returns a normalized locale code for the given locale name. The returned " "locale code is formatted for use with :func:`setlocale`. If normalization " "fails, the original name is returned unchanged." msgstr "" -#: ../../library/locale.rst:345 +#: ../../library/locale.rst:367 msgid "" "If the given encoding is not known, the function defaults to the default " "encoding for the locale code just like :func:`setlocale`." msgstr "" -#: ../../library/locale.rst:351 +#: ../../library/locale.rst:373 msgid "Sets the locale for *category* to the default setting." msgstr "" -#: ../../library/locale.rst:353 +#: ../../library/locale.rst:375 msgid "" "The default setting is determined by calling :func:`getdefaultlocale`. " "*category* defaults to :const:`LC_ALL`." msgstr "" -#: ../../library/locale.rst:359 +#: ../../library/locale.rst:383 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -570,7 +596,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:367 +#: ../../library/locale.rst:391 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -578,7 +604,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:376 +#: ../../library/locale.rst:400 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating " @@ -586,44 +612,44 @@ msgid "" "is true, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:381 +#: ../../library/locale.rst:405 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:384 +#: ../../library/locale.rst:408 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:387 +#: ../../library/locale.rst:411 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:393 +#: ../../library/locale.rst:417 msgid "" "Please note that this function works like :meth:`format_string` but will " "only work for exactly one ``%char`` specifier. For example, ``'%f'`` and " "``'%.0f'`` are both valid specifiers, but ``'%f KiB'`` is not." msgstr "" -#: ../../library/locale.rst:397 +#: ../../library/locale.rst:421 msgid "For whole format strings, use :func:`format_string`." msgstr "" -#: ../../library/locale.rst:399 +#: ../../library/locale.rst:423 msgid "Use :meth:`format_string` instead." msgstr "" -#: ../../library/locale.rst:405 +#: ../../library/locale.rst:429 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:407 +#: ../../library/locale.rst:431 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is true (which is not the default), grouping " @@ -631,68 +657,68 @@ msgid "" "default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:412 +#: ../../library/locale.rst:436 msgid "" "Note that this function will not work with the 'C' locale, so you have to " "set a locale via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:418 +#: ../../library/locale.rst:442 msgid "" "Formats a floating point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:424 +#: ../../library/locale.rst:448 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:432 +#: ../../library/locale.rst:456 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:440 +#: ../../library/locale.rst:464 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:446 +#: ../../library/locale.rst:470 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:453 +#: ../../library/locale.rst:477 msgid "" "Locale category for the character type functions. Depending on the settings " "of this category, the functions of module :mod:`string` dealing with case " "change their behaviour." msgstr "" -#: ../../library/locale.rst:460 +#: ../../library/locale.rst:484 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:466 +#: ../../library/locale.rst:490 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:472 +#: ../../library/locale.rst:496 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:478 +#: ../../library/locale.rst:502 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -700,7 +726,7 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:486 +#: ../../library/locale.rst:510 msgid "" "Locale category for formatting numbers. The functions :func:`.format`, :" "func:`atoi`, :func:`atof` and :func:`.str` of the :mod:`locale` module are " @@ -708,7 +734,7 @@ msgid "" "affected." msgstr "" -#: ../../library/locale.rst:494 +#: ../../library/locale.rst:518 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -718,24 +744,24 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:503 +#: ../../library/locale.rst:527 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: ../../library/locale.rst:507 +#: ../../library/locale.rst:531 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/locale.rst:520 +#: ../../library/locale.rst:544 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:522 +#: ../../library/locale.rst:546 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -743,7 +769,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:527 +#: ../../library/locale.rst:551 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -753,7 +779,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:534 +#: ../../library/locale.rst:558 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -761,7 +787,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:539 +#: ../../library/locale.rst:563 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -772,14 +798,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:546 +#: ../../library/locale.rst:570 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`.format`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:550 +#: ../../library/locale.rst:574 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -790,11 +816,11 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:561 +#: ../../library/locale.rst:585 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:563 +#: ../../library/locale.rst:587 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -802,7 +828,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:568 +#: ../../library/locale.rst:592 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -812,11 +838,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: ../../library/locale.rst:579 +#: ../../library/locale.rst:603 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:587 +#: ../../library/locale.rst:611 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`!gettext`, :" @@ -827,7 +853,7 @@ msgid "" "for locating message catalogs." msgstr "" -#: ../../library/locale.rst:594 +#: ../../library/locale.rst:618 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/logging.config.po b/library/logging.config.po index 3dcc6bae82..06e5211737 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-05 09:06+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -408,7 +408,7 @@ msgid "" "corresponding Handler instance." msgstr "" -#: ../../library/logging.config.rst:278 ../../library/logging.config.rst:320 +#: ../../library/logging.config.rst:278 ../../library/logging.config.rst:323 msgid "The configuring dict is searched for the following keys:" msgstr "" @@ -430,13 +430,17 @@ msgstr "" msgid "``filters`` (optional). A list of ids of the filters for this handler." msgstr "" -#: ../../library/logging.config.rst:291 +#: ../../library/logging.config.rst:291 ../../library/logging.config.rst:332 +msgid "``filters`` can take filter instances in addition to ids." +msgstr "" + +#: ../../library/logging.config.rst:294 msgid "" "All *other* keys are passed through as keyword arguments to the handler's " "constructor. For example, given the snippet:" msgstr "" -#: ../../library/logging.config.rst:310 +#: ../../library/logging.config.rst:313 msgid "" "the handler with id ``console`` is instantiated as a :class:`logging." "StreamHandler`, using ``sys.stdout`` as the underlying stream. The handler " @@ -445,44 +449,44 @@ msgid "" "maxBytes=1024, backupCount=3``." msgstr "" -#: ../../library/logging.config.rst:316 +#: ../../library/logging.config.rst:319 msgid "" "*loggers* - the corresponding value will be a dict in which each key is a " "logger name and each value is a dict describing how to configure the " "corresponding Logger instance." msgstr "" -#: ../../library/logging.config.rst:322 +#: ../../library/logging.config.rst:325 msgid "``level`` (optional). The level of the logger." msgstr "" -#: ../../library/logging.config.rst:324 +#: ../../library/logging.config.rst:327 msgid "``propagate`` (optional). The propagation setting of the logger." msgstr "" -#: ../../library/logging.config.rst:326 +#: ../../library/logging.config.rst:329 msgid "``filters`` (optional). A list of ids of the filters for this logger." msgstr "" -#: ../../library/logging.config.rst:329 +#: ../../library/logging.config.rst:335 msgid "" "``handlers`` (optional). A list of ids of the handlers for this logger." msgstr "" -#: ../../library/logging.config.rst:332 +#: ../../library/logging.config.rst:338 msgid "" "The specified loggers will be configured according to the level, " "propagation, filters and handlers specified." msgstr "" -#: ../../library/logging.config.rst:335 +#: ../../library/logging.config.rst:341 msgid "" "*root* - this will be the configuration for the root logger. Processing of " "the configuration will be as for any logger, except that the ``propagate`` " "setting will not be applicable." msgstr "" -#: ../../library/logging.config.rst:339 +#: ../../library/logging.config.rst:345 msgid "" "*incremental* - whether the configuration is to be interpreted as " "incremental to the existing configuration. This value defaults to " @@ -491,13 +495,13 @@ msgid "" "`fileConfig` API." msgstr "" -#: ../../library/logging.config.rst:345 +#: ../../library/logging.config.rst:351 msgid "" "If the specified value is ``True``, the configuration is processed as " "described in the section on :ref:`logging-config-dict-incremental`." msgstr "" -#: ../../library/logging.config.rst:348 +#: ../../library/logging.config.rst:354 msgid "" "*disable_existing_loggers* - whether any existing non-root loggers are to be " "disabled. This setting mirrors the parameter of the same name in :func:" @@ -505,11 +509,11 @@ msgid "" "ignored if *incremental* is ``True``." msgstr "" -#: ../../library/logging.config.rst:356 +#: ../../library/logging.config.rst:362 msgid "Incremental Configuration" msgstr "" -#: ../../library/logging.config.rst:358 +#: ../../library/logging.config.rst:364 msgid "" "It is difficult to provide complete flexibility for incremental " "configuration. For example, because objects such as filters and formatters " @@ -517,7 +521,7 @@ msgid "" "to such anonymous objects when augmenting a configuration." msgstr "" -#: ../../library/logging.config.rst:364 +#: ../../library/logging.config.rst:370 msgid "" "Furthermore, there is not a compelling case for arbitrarily altering the " "object graph of loggers, handlers, filters, formatters at run-time, once a " @@ -528,7 +532,7 @@ msgid "" "worth the complexity it adds to the implementation." msgstr "" -#: ../../library/logging.config.rst:373 +#: ../../library/logging.config.rst:379 msgid "" "Thus, when the ``incremental`` key of a configuration dict is present and is " "``True``, the system will completely ignore any ``formatters`` and " @@ -537,7 +541,7 @@ msgid "" "``loggers`` and ``root`` entries." msgstr "" -#: ../../library/logging.config.rst:379 +#: ../../library/logging.config.rst:385 msgid "" "Using a value in the configuration dict lets configurations to be sent over " "the wire as pickled dicts to a socket listener. Thus, the logging verbosity " @@ -545,11 +549,11 @@ msgid "" "and restart the application." msgstr "" -#: ../../library/logging.config.rst:387 +#: ../../library/logging.config.rst:393 msgid "Object connections" msgstr "" -#: ../../library/logging.config.rst:389 +#: ../../library/logging.config.rst:395 msgid "" "The schema describes a set of logging objects - loggers, handlers, " "formatters, filters - which are connected to each other in an object graph. " @@ -565,17 +569,17 @@ msgid "" "source and the destination object with that id." msgstr "" -#: ../../library/logging.config.rst:403 +#: ../../library/logging.config.rst:409 msgid "So, for example, consider the following YAML snippet:" msgstr "" -#: ../../library/logging.config.rst:424 +#: ../../library/logging.config.rst:430 msgid "" "(Note: YAML used here because it's a little more readable than the " "equivalent Python source form for the dictionary.)" msgstr "" -#: ../../library/logging.config.rst:427 +#: ../../library/logging.config.rst:433 msgid "" "The ids for loggers are the logger names which would be used " "programmatically to obtain a reference to those loggers, e.g. ``foo.bar." @@ -586,7 +590,7 @@ msgid "" "configuration call is complete." msgstr "" -#: ../../library/logging.config.rst:435 +#: ../../library/logging.config.rst:441 msgid "" "The above snippet indicates that logger named ``foo.bar.baz`` should have " "two handlers attached to it, which are described by the handler ids ``h1`` " @@ -594,11 +598,11 @@ msgid "" "the formatter for ``h2`` is that described by id ``precise``." msgstr "" -#: ../../library/logging.config.rst:445 +#: ../../library/logging.config.rst:451 msgid "User-defined objects" msgstr "" -#: ../../library/logging.config.rst:447 +#: ../../library/logging.config.rst:453 msgid "" "The schema supports user-defined objects for handlers, filters and " "formatters. (Loggers do not need to have different types for different " @@ -606,7 +610,7 @@ msgid "" "defined logger classes.)" msgstr "" -#: ../../library/logging.config.rst:452 +#: ../../library/logging.config.rst:458 msgid "" "Objects to be configured are described by dictionaries which detail their " "configuration. In some places, the logging system will be able to infer " @@ -619,7 +623,7 @@ msgid "" "made available under the special key ``'()'``. Here's a concrete example:" msgstr "" -#: ../../library/logging.config.rst:478 +#: ../../library/logging.config.rst:484 msgid "" "The above YAML snippet defines three formatters. The first, with id " "``brief``, is a standard :class:`logging.Formatter` instance with the " @@ -630,14 +634,14 @@ msgid "" "configuration sub-dictionaries::" msgstr "" -#: ../../library/logging.config.rst:490 +#: ../../library/logging.config.rst:496 msgid "and::" msgstr "" "和:\n" "\n" "::" -#: ../../library/logging.config.rst:497 +#: ../../library/logging.config.rst:503 msgid "" "respectively, and as these dictionaries do not contain the special key " "``'()'``, the instantiation is inferred from the context: as a result, " @@ -646,7 +650,7 @@ msgid "" "is::" msgstr "" -#: ../../library/logging.config.rst:510 +#: ../../library/logging.config.rst:516 msgid "" "and this contains the special key ``'()'``, which means that user-defined " "instantiation is wanted. In this case, the specified factory callable will " @@ -658,7 +662,7 @@ msgid "" "assumed to be returned by the call::" msgstr "" -#: ../../library/logging.config.rst:522 +#: ../../library/logging.config.rst:528 msgid "" "The key ``'()'`` has been used as the special key because it is not a valid " "keyword parameter name, and so will not clash with the names of the keyword " @@ -666,7 +670,13 @@ msgid "" "corresponding value is a callable." msgstr "" -#: ../../library/logging.config.rst:527 +#: ../../library/logging.config.rst:533 +msgid "" +"The ``filters`` member of ``handlers`` and ``loggers`` can take filter " +"instances in addition to ids." +msgstr "" + +#: ../../library/logging.config.rst:537 msgid "" "You can also specify a special key ``'.'`` whose value is a dictionary is a " "mapping of attribute names to values. If found, the specified attributes " @@ -674,17 +684,17 @@ msgid "" "following configuration::" msgstr "" -#: ../../library/logging.config.rst:543 +#: ../../library/logging.config.rst:553 msgid "" "the returned formatter will have attribute ``foo`` set to ``'bar'`` and " "attribute ``baz`` set to ``'bozz'``." msgstr "" -#: ../../library/logging.config.rst:550 +#: ../../library/logging.config.rst:560 msgid "Access to external objects" msgstr "" -#: ../../library/logging.config.rst:552 +#: ../../library/logging.config.rst:562 msgid "" "There are times where a configuration needs to refer to objects external to " "the configuration, for example ``sys.stderr``. If the configuration dict is " @@ -699,7 +709,7 @@ msgid "" "import mechanisms." msgstr "" -#: ../../library/logging.config.rst:565 +#: ../../library/logging.config.rst:575 msgid "" "The handling of such prefixes is done in a way analogous to protocol " "handling: there is a generic mechanism to look for prefixes which match the " @@ -709,11 +719,11 @@ msgid "" "prefix is not recognised, then the string value will be left as-is." msgstr "" -#: ../../library/logging.config.rst:577 +#: ../../library/logging.config.rst:587 msgid "Access to internal objects" msgstr "" -#: ../../library/logging.config.rst:579 +#: ../../library/logging.config.rst:589 msgid "" "As well as external objects, there is sometimes also a need to refer to " "objects in the configuration. This will be done implicitly by the " @@ -724,7 +734,7 @@ msgid "" "and resolve to the appropriate destination object." msgstr "" -#: ../../library/logging.config.rst:587 +#: ../../library/logging.config.rst:597 msgid "" "However, a more generic mechanism is needed for user-defined objects which " "are not known to the :mod:`logging` module. For example, consider :class:" @@ -738,7 +748,7 @@ msgid "" "resolution system allows the user to specify:" msgstr "" -#: ../../library/logging.config.rst:609 +#: ../../library/logging.config.rst:619 msgid "" "The literal string ``'cfg://handlers.file'`` will be resolved in an " "analogous way to strings with the ``ext://`` prefix, but looking in the " @@ -747,7 +757,7 @@ msgid "" "format``. Thus, given the following snippet:" msgstr "" -#: ../../library/logging.config.rst:627 +#: ../../library/logging.config.rst:637 msgid "" "in the configuration, the string ``'cfg://handlers'`` would resolve to the " "dict with key ``handlers``, the string ``'cfg://handlers.email`` would " @@ -763,7 +773,7 @@ msgid "" "to the string value if needed." msgstr "" -#: ../../library/logging.config.rst:641 +#: ../../library/logging.config.rst:651 msgid "" "Given a string ``cfg://handlers.myhandler.mykey.123``, this will resolve to " "``config_dict['handlers']['myhandler']['mykey']['123']``. If the string is " @@ -773,11 +783,11 @@ msgid "" "['mykey']['123']`` if that fails." msgstr "" -#: ../../library/logging.config.rst:653 +#: ../../library/logging.config.rst:663 msgid "Import resolution and custom importers" msgstr "" -#: ../../library/logging.config.rst:655 +#: ../../library/logging.config.rst:665 msgid "" "Import resolution, by default, uses the builtin :func:`__import__` function " "to do its importing. You may want to replace this with your own importing " @@ -789,17 +799,17 @@ msgid "" "instance level, you need to wrap it with :func:`staticmethod`. For example::" msgstr "" -#: ../../library/logging.config.rst:670 +#: ../../library/logging.config.rst:680 msgid "" "You don't need to wrap with :func:`staticmethod` if you're setting the " "import callable on a configurator *instance*." msgstr "" -#: ../../library/logging.config.rst:677 +#: ../../library/logging.config.rst:687 msgid "Configuration file format" msgstr "" -#: ../../library/logging.config.rst:679 +#: ../../library/logging.config.rst:689 msgid "" "The configuration file format understood by :func:`fileConfig` is based on :" "mod:`configparser` functionality. The file must contain sections called " @@ -816,7 +826,7 @@ msgid "" "specified in a section called ``[logger_root]``." msgstr "" -#: ../../library/logging.config.rst:694 +#: ../../library/logging.config.rst:704 msgid "" "The :func:`fileConfig` API is older than the :func:`dictConfig` API and does " "not provide functionality to cover certain aspects of logging. For example, " @@ -829,25 +839,25 @@ msgid "" "when it's convenient to do so." msgstr "" -#: ../../library/logging.config.rst:704 +#: ../../library/logging.config.rst:714 msgid "Examples of these sections in the file are given below." msgstr "" -#: ../../library/logging.config.rst:717 +#: ../../library/logging.config.rst:727 msgid "" "The root logger must specify a level and a list of handlers. An example of a " "root logger section is given below." msgstr "" -#: ../../library/logging.config.rst:726 +#: ../../library/logging.config.rst:736 msgid "" "The ``level`` entry can be one of ``DEBUG, INFO, WARNING, ERROR, CRITICAL`` " "or ``NOTSET``. For the root logger only, ``NOTSET`` means that all messages " -"will be logged. Level values are :func:`eval`\\ uated in the context of the " -"``logging`` package's namespace." +"will be logged. Level values are :ref:`evaluated ` in the context " +"of the ``logging`` package's namespace." msgstr "" -#: ../../library/logging.config.rst:731 +#: ../../library/logging.config.rst:741 msgid "" "The ``handlers`` entry is a comma-separated list of handler names, which " "must appear in the ``[handlers]`` section. These names must appear in the " @@ -855,13 +865,13 @@ msgid "" "file." msgstr "" -#: ../../library/logging.config.rst:736 +#: ../../library/logging.config.rst:746 msgid "" "For loggers other than the root logger, some additional information is " "required. This is illustrated by the following example." msgstr "" -#: ../../library/logging.config.rst:747 +#: ../../library/logging.config.rst:757 msgid "" "The ``level`` and ``handlers`` entries are interpreted as for the root " "logger, except that if a non-root logger's level is specified as ``NOTSET``, " @@ -874,20 +884,20 @@ msgid "" "application to get the logger." msgstr "" -#: ../../library/logging.config.rst:756 +#: ../../library/logging.config.rst:766 msgid "" "Sections which specify handler configuration are exemplified by the " "following." msgstr "" -#: ../../library/logging.config.rst:766 +#: ../../library/logging.config.rst:776 msgid "" "The ``class`` entry indicates the handler's class (as determined by :func:" "`eval` in the ``logging`` package's namespace). The ``level`` is interpreted " "as for loggers, and ``NOTSET`` is taken to mean 'log everything'." msgstr "" -#: ../../library/logging.config.rst:770 +#: ../../library/logging.config.rst:780 msgid "" "The ``formatter`` entry indicates the key name of the formatter for this " "handler. If blank, a default formatter (``logging._defaultFormatter``) is " @@ -895,35 +905,36 @@ msgid "" "and have a corresponding section in the configuration file." msgstr "" -#: ../../library/logging.config.rst:775 +#: ../../library/logging.config.rst:785 msgid "" -"The ``args`` entry, when :func:`eval`\\ uated in the context of the " +"The ``args`` entry, when :ref:`evaluated ` in the context of the " "``logging`` package's namespace, is the list of arguments to the constructor " "for the handler class. Refer to the constructors for the relevant handlers, " "or to the examples below, to see how typical entries are constructed. If not " "provided, it defaults to ``()``." msgstr "" -#: ../../library/logging.config.rst:781 +#: ../../library/logging.config.rst:791 msgid "" -"The optional ``kwargs`` entry, when :func:`eval`\\ uated in the context of " -"the ``logging`` package's namespace, is the keyword argument dict to the " -"constructor for the handler class. If not provided, it defaults to ``{}``." +"The optional ``kwargs`` entry, when :ref:`evaluated ` in the " +"context of the ``logging`` package's namespace, is the keyword argument dict " +"to the constructor for the handler class. If not provided, it defaults to " +"``{}``." msgstr "" -#: ../../library/logging.config.rst:838 +#: ../../library/logging.config.rst:848 msgid "" "Sections which specify formatter configuration are typified by the following." msgstr "" -#: ../../library/logging.config.rst:849 +#: ../../library/logging.config.rst:859 msgid "" "The arguments for the formatter configuration are the same as the keys in " "the dictionary schema :ref:`formatters section `." msgstr "" -#: ../../library/logging.config.rst:855 +#: ../../library/logging.config.rst:865 msgid "" "Due to the use of :func:`eval` as described above, there are potential " "security risks which result from using the :func:`listen` to send and " @@ -932,18 +943,18 @@ msgid "" "`listen` documentation for more information." msgstr "" -#: ../../library/logging.config.rst:864 +#: ../../library/logging.config.rst:874 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.config.rst:864 +#: ../../library/logging.config.rst:874 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.config.rst:866 +#: ../../library/logging.config.rst:876 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.config.rst:867 +#: ../../library/logging.config.rst:877 msgid "Useful handlers included with the logging module." msgstr "" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index cb15349d67..2aeb9a10cf 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-04 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1428,7 +1428,7 @@ msgid "" msgstr "" #: ../../library/logging.handlers.rst:1034 -#: ../../library/logging.handlers.rst:1123 +#: ../../library/logging.handlers.rst:1117 msgid "" "If you are using :mod:`multiprocessing`, you should avoid using :class:" "`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`." @@ -1490,18 +1490,11 @@ msgid "" "customized queue implementation." msgstr "" -#: ../../library/logging.handlers.rst:1085 -msgid "" -"When created via configuration using :func:`~logging.config.dictConfig`, " -"this attribute will contain a :class:`QueueListener` instance for use with " -"this handler. Otherwise, it will be ``None``." -msgstr "" - -#: ../../library/logging.handlers.rst:1094 +#: ../../library/logging.handlers.rst:1088 msgid "QueueListener" msgstr "QueueListener" -#: ../../library/logging.handlers.rst:1098 +#: ../../library/logging.handlers.rst:1092 msgid "" "The :class:`QueueListener` class, located in the :mod:`logging.handlers` " "module, supports receiving logging messages from a queue, such as those " @@ -1512,7 +1505,7 @@ msgid "" "works hand-in-hand with :class:`QueueHandler`." msgstr "" -#: ../../library/logging.handlers.rst:1106 +#: ../../library/logging.handlers.rst:1100 msgid "" "Along with the :class:`QueueHandler` class, :class:`QueueListener` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1522,7 +1515,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: ../../library/logging.handlers.rst:1115 +#: ../../library/logging.handlers.rst:1109 msgid "" "Returns a new instance of the :class:`QueueListener` class. The instance is " "initialized with the queue to send messages to and a list of handlers which " @@ -1533,7 +1526,7 @@ msgid "" "class:`~queue.SimpleQueue` instances for *queue*." msgstr "" -#: ../../library/logging.handlers.rst:1126 +#: ../../library/logging.handlers.rst:1120 msgid "" "If ``respect_handler_level`` is ``True``, a handler's level is respected " "(compared with the level for the message) when deciding whether to pass " @@ -1541,82 +1534,82 @@ msgid "" "versions - to always pass each message to each handler." msgstr "" -#: ../../library/logging.handlers.rst:1131 +#: ../../library/logging.handlers.rst:1125 msgid "The ``respect_handler_level`` argument was added." msgstr "新增 ``respect_handler_level`` 引數。" -#: ../../library/logging.handlers.rst:1136 +#: ../../library/logging.handlers.rst:1130 msgid "Dequeues a record and return it, optionally blocking." msgstr "" -#: ../../library/logging.handlers.rst:1138 +#: ../../library/logging.handlers.rst:1132 msgid "" "The base implementation uses ``get()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1144 +#: ../../library/logging.handlers.rst:1138 msgid "Prepare a record for handling." msgstr "" -#: ../../library/logging.handlers.rst:1146 +#: ../../library/logging.handlers.rst:1140 msgid "" "This implementation just returns the passed-in record. You may want to " "override this method if you need to do any custom marshalling or " "manipulation of the record before passing it to the handlers." msgstr "" -#: ../../library/logging.handlers.rst:1152 +#: ../../library/logging.handlers.rst:1146 msgid "Handle a record." msgstr "" -#: ../../library/logging.handlers.rst:1154 +#: ../../library/logging.handlers.rst:1148 msgid "" "This just loops through the handlers offering them the record to handle. The " "actual object passed to the handlers is that which is returned from :meth:" "`prepare`." msgstr "" -#: ../../library/logging.handlers.rst:1160 +#: ../../library/logging.handlers.rst:1154 msgid "Starts the listener." msgstr "" -#: ../../library/logging.handlers.rst:1162 +#: ../../library/logging.handlers.rst:1156 msgid "" "This starts up a background thread to monitor the queue for LogRecords to " "process." msgstr "" -#: ../../library/logging.handlers.rst:1167 +#: ../../library/logging.handlers.rst:1161 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1169 +#: ../../library/logging.handlers.rst:1163 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1175 +#: ../../library/logging.handlers.rst:1169 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1186 +#: ../../library/logging.handlers.rst:1180 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1186 +#: ../../library/logging.handlers.rst:1180 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1188 +#: ../../library/logging.handlers.rst:1182 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1189 +#: ../../library/logging.handlers.rst:1183 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index a12b472f73..445bd5e5d5 100644 --- a/library/logging.po +++ b/library/logging.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-21 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1093,11 +1093,11 @@ msgstr "" msgid "Attribute name" msgstr "" -#: ../../library/logging.rst:879 ../../library/logging.rst:1262 +#: ../../library/logging.rst:879 ../../library/logging.rst:1270 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:879 ../../library/logging.rst:1262 +#: ../../library/logging.rst:879 ../../library/logging.rst:1270 msgid "Description" msgstr "描述" @@ -1643,10 +1643,17 @@ msgid "" msgstr "" #: ../../library/logging.rst:1203 +msgid "" +"Returns a mapping from level names to their corresponding logging levels. " +"For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " +"mapping is copied from an internal mapping on each call to this function." +msgstr "" + +#: ../../library/logging.rst:1211 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1205 +#: ../../library/logging.rst:1213 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1656,20 +1663,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1212 +#: ../../library/logging.rst:1220 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1216 +#: ../../library/logging.rst:1224 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1219 +#: ../../library/logging.rst:1227 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1678,7 +1685,7 @@ msgid "" "versa." msgstr "" -#: ../../library/logging.rst:1225 +#: ../../library/logging.rst:1233 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1686,7 +1693,7 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1233 +#: ../../library/logging.rst:1241 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1694,7 +1701,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1241 +#: ../../library/logging.rst:1249 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1703,13 +1710,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1247 +#: ../../library/logging.rst:1255 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1250 +#: ../../library/logging.rst:1258 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1718,54 +1725,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1257 +#: ../../library/logging.rst:1265 msgid "The following keyword arguments are supported." msgstr "" -#: ../../library/logging.rst:1264 +#: ../../library/logging.rst:1272 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1264 +#: ../../library/logging.rst:1272 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1268 +#: ../../library/logging.rst:1276 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1268 +#: ../../library/logging.rst:1276 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1272 +#: ../../library/logging.rst:1280 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1272 +#: ../../library/logging.rst:1280 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1277 +#: ../../library/logging.rst:1285 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1277 +#: ../../library/logging.rst:1285 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1280 +#: ../../library/logging.rst:1288 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1280 +#: ../../library/logging.rst:1288 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1299 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1299 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1297 +#: ../../library/logging.rst:1305 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1297 +#: ../../library/logging.rst:1305 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -1805,33 +1812,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1306 +#: ../../library/logging.rst:1314 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1306 +#: ../../library/logging.rst:1314 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1312 +#: ../../library/logging.rst:1320 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1312 +#: ../../library/logging.rst:1320 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1317 +#: ../../library/logging.rst:1325 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1317 +#: ../../library/logging.rst:1325 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -1840,39 +1847,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1328 +#: ../../library/logging.rst:1336 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1331 +#: ../../library/logging.rst:1339 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1337 +#: ../../library/logging.rst:1345 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1340 +#: ../../library/logging.rst:1348 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1345 +#: ../../library/logging.rst:1353 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1349 +#: ../../library/logging.rst:1357 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1356 +#: ../../library/logging.rst:1364 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`__init__` such that only a name " @@ -1884,32 +1891,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1367 +#: ../../library/logging.rst:1375 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1377 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1371 +#: ../../library/logging.rst:1379 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1376 +#: ../../library/logging.rst:1384 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1386 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1380 +#: ../../library/logging.rst:1388 msgid "The logger name." msgstr "" @@ -1917,7 +1924,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1389 msgid "The logging level (numeric)." msgstr "" @@ -1925,7 +1932,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1382 +#: ../../library/logging.rst:1390 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -1933,19 +1940,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1383 +#: ../../library/logging.rst:1391 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1384 +#: ../../library/logging.rst:1392 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1385 +#: ../../library/logging.rst:1393 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1386 +#: ../../library/logging.rst:1394 msgid "An exception tuple, or ``None``." msgstr "" @@ -1953,7 +1960,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1387 +#: ../../library/logging.rst:1395 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -1961,7 +1968,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1389 +#: ../../library/logging.rst:1397 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -1971,15 +1978,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1391 +#: ../../library/logging.rst:1399 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1395 +#: ../../library/logging.rst:1403 msgid "Module-Level Attributes" msgstr "" -#: ../../library/logging.rst:1399 +#: ../../library/logging.rst:1407 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -1990,22 +1997,22 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1410 +#: ../../library/logging.rst:1418 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1412 +#: ../../library/logging.rst:1420 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1417 +#: ../../library/logging.rst:1425 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1420 +#: ../../library/logging.rst:1428 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2014,46 +2021,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1425 +#: ../../library/logging.rst:1433 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1433 +#: ../../library/logging.rst:1441 msgid "Module :mod:`logging.config`" msgstr "" -#: ../../library/logging.rst:1433 +#: ../../library/logging.rst:1441 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1436 +#: ../../library/logging.rst:1444 msgid "Module :mod:`logging.handlers`" msgstr "" -#: ../../library/logging.rst:1436 +#: ../../library/logging.rst:1444 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1440 +#: ../../library/logging.rst:1448 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1439 +#: ../../library/logging.rst:1447 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1445 +#: ../../library/logging.rst:1453 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1443 +#: ../../library/logging.rst:1451 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/mailcap.po b/library/mailcap.po index 9db1824d29..8170608734 100644 --- a/library/mailcap.po +++ b/library/mailcap.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-21 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -26,7 +26,7 @@ msgstr "" msgid "**Source code:** :source:`Lib/mailcap.py`" msgstr "**原始碼:**\\ :source:`Lib/mailcap.py`" -#: ../../library/mailcap.rst:10 +#: ../../library/mailcap.rst:14 msgid "" "The :mod:`mailcap` module is deprecated (see :pep:`PEP 594 <594#mailcap>` " "for details). The :mod:`mimetypes` module provides an alternative." diff --git a/library/math.po b/library/math.po index 694707035a..e78bfbcb4c 100644 --- a/library/math.po +++ b/library/math.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,8 +72,7 @@ msgstr "" #: ../../library/math.rst:47 msgid "" "Also called the binomial coefficient because it is equivalent to the " -"coefficient of k-th term in polynomial expansion of the expression ``(1 + x) " -"** n``." +"coefficient of k-th term in polynomial expansion of ``(1 + x)ⁿ``." msgstr "" #: ../../library/math.rst:51 ../../library/math.rst:260 @@ -95,7 +94,7 @@ msgstr "" #: ../../library/math.rst:71 msgid "" -"Return *x* factorial as an integer. Raises :exc:`ValueError` if *x* is not " +"Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " "integral or is negative." msgstr "" @@ -434,13 +433,21 @@ msgid "Power and logarithmic functions" msgstr "" #: ../../library/math.rst:349 +msgid "Return the cube root of *x*." +msgstr "" + +#: ../../library/math.rst:356 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:356 +#: ../../library/math.rst:363 +msgid "Return *2* raised to the power *x*." +msgstr "" + +#: ../../library/math.rst:370 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -449,83 +456,90 @@ msgid "" "compute this quantity to full precision::" msgstr "" -#: ../../library/math.rst:373 +#: ../../library/math.rst:387 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:375 +#: ../../library/math.rst:389 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:381 +#: ../../library/math.rst:395 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:387 +#: ../../library/math.rst:401 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:394 +#: ../../library/math.rst:408 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:400 +#: ../../library/math.rst:414 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:406 +#: ../../library/math.rst:420 msgid "" -"Return ``x`` raised to the power ``y``. Exceptional cases follow Annex 'F' " -"of the C99 standard as far as possible. In particular, ``pow(1.0, x)`` and " +"Return ``x`` raised to the power ``y``. Exceptional cases follow the IEEE " +"754 standard as far as possible. In particular, ``pow(1.0, x)`` and " "``pow(x, 0.0)`` always return ``1.0``, even when ``x`` is a zero or a NaN. " "If both ``x`` and ``y`` are finite, ``x`` is negative, and ``y`` is not an " "integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:413 +#: ../../library/math.rst:427 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:420 +#: ../../library/math.rst:431 +msgid "" +"The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " +"return ``inf`` instead of raising :exc:`ValueError`, for consistency with " +"IEEE 754." +msgstr "" + +#: ../../library/math.rst:439 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:424 +#: ../../library/math.rst:443 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:428 +#: ../../library/math.rst:447 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:434 +#: ../../library/math.rst:453 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:440 +#: ../../library/math.rst:459 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:446 +#: ../../library/math.rst:465 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -535,121 +549,121 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:456 +#: ../../library/math.rst:475 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:461 +#: ../../library/math.rst:480 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:465 +#: ../../library/math.rst:484 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:474 +#: ../../library/math.rst:493 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:478 +#: ../../library/math.rst:497 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:482 +#: ../../library/math.rst:501 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:486 +#: ../../library/math.rst:505 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:494 +#: ../../library/math.rst:513 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:499 +#: ../../library/math.rst:518 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:503 +#: ../../library/math.rst:522 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:507 +#: ../../library/math.rst:526 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:512 +#: ../../library/math.rst:531 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:516 +#: ../../library/math.rst:535 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:518 +#: ../../library/math.rst:537 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:524 +#: ../../library/math.rst:543 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:529 +#: ../../library/math.rst:548 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:534 +#: ../../library/math.rst:553 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:539 +#: ../../library/math.rst:558 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:544 +#: ../../library/math.rst:563 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:549 +#: ../../library/math.rst:568 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:553 +#: ../../library/math.rst:572 msgid "Special functions" msgstr "" -#: ../../library/math.rst:557 +#: ../../library/math.rst:576 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:560 +#: ../../library/math.rst:579 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:573 +#: ../../library/math.rst:592 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -658,31 +672,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:584 +#: ../../library/math.rst:603 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:592 +#: ../../library/math.rst:611 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:599 +#: ../../library/math.rst:618 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:603 +#: ../../library/math.rst:622 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:608 +#: ../../library/math.rst:627 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:613 +#: ../../library/math.rst:632 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -691,13 +705,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:624 +#: ../../library/math.rst:643 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:632 +#: ../../library/math.rst:651 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,18 @@ msgstr "" msgid ":mod:`mmap` --- Memory-mapped file support" msgstr "" -#: ../../library/mmap.rst:9 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/mmap.rst:11 msgid "" "Memory-mapped file objects behave like both :class:`bytearray` and like :" "term:`file objects `. You can use mmap objects in most places " @@ -34,7 +45,7 @@ msgid "" "file to different positions." msgstr "" -#: ../../library/mmap.rst:17 +#: ../../library/mmap.rst:19 msgid "" "A memory-mapped file is created by the :class:`~mmap.mmap` constructor, " "which is different on Unix and on Windows. In either case you must provide " @@ -45,7 +56,7 @@ msgid "" "(the file still needs to be closed when done)." msgstr "" -#: ../../library/mmap.rst:26 +#: ../../library/mmap.rst:28 msgid "" "If you want to create a memory-mapping for a writable, buffered file, you " "should :func:`~io.IOBase.flush` the file first. This is necessary to ensure " @@ -53,7 +64,7 @@ msgid "" "mapping." msgstr "" -#: ../../library/mmap.rst:31 +#: ../../library/mmap.rst:33 msgid "" "For both the Unix and Windows versions of the constructor, *access* may be " "specified as an optional keyword parameter. *access* accepts one of four " @@ -69,17 +80,17 @@ msgid "" "update the underlying file." msgstr "" -#: ../../library/mmap.rst:44 +#: ../../library/mmap.rst:46 msgid "Added :const:`ACCESS_DEFAULT` constant." msgstr "新增 :const:`ACCESS_DEFAULT` 常數。" -#: ../../library/mmap.rst:47 +#: ../../library/mmap.rst:49 msgid "" "To map anonymous memory, -1 should be passed as the fileno along with the " "length." msgstr "" -#: ../../library/mmap.rst:51 +#: ../../library/mmap.rst:53 msgid "" "**(Windows version)** Maps *length* bytes from the file specified by the " "file handle *fileno*, and creates a mmap object. If *length* is larger than " @@ -89,7 +100,7 @@ msgid "" "exception (you cannot create an empty mapping on Windows)." msgstr "" -#: ../../library/mmap.rst:58 +#: ../../library/mmap.rst:60 msgid "" "*tagname*, if specified and not ``None``, is a string giving a tag name for " "the mapping. Windows allows you to have many different mappings against the " @@ -100,7 +111,7 @@ msgid "" "Windows." msgstr "" -#: ../../library/mmap.rst:66 +#: ../../library/mmap.rst:68 msgid "" "*offset* may be specified as a non-negative integer offset. mmap references " "will be relative to the offset from the beginning of the file. *offset* " @@ -108,13 +119,13 @@ msgid "" "`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:70 ../../library/mmap.rst:161 +#: ../../library/mmap.rst:83 ../../library/mmap.rst:174 msgid "" "Raises an :ref:`auditing event ` ``mmap.__new__`` with arguments " "``fileno``, ``length``, ``access``, ``offset``." msgstr "" -#: ../../library/mmap.rst:75 +#: ../../library/mmap.rst:77 msgid "" "**(Unix version)** Maps *length* bytes from the file specified by the file " "descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the " @@ -122,7 +133,7 @@ msgid "" "`~mmap.mmap` is called." msgstr "" -#: ../../library/mmap.rst:80 +#: ../../library/mmap.rst:82 msgid "" "*flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a " "private copy-on-write mapping, so changes to the contents of the mmap object " @@ -133,7 +144,7 @@ msgid "" "constants>`." msgstr "" -#: ../../library/mmap.rst:88 +#: ../../library/mmap.rst:90 msgid "" "*prot*, if specified, gives the desired memory protection; the two most " "useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify " @@ -141,7 +152,7 @@ msgid "" "\\| PROT_WRITE`." msgstr "" -#: ../../library/mmap.rst:93 +#: ../../library/mmap.rst:95 msgid "" "*access* may be specified in lieu of *flags* and *prot* as an optional " "keyword parameter. It is an error to specify both *flags*, *prot* and " @@ -149,7 +160,7 @@ msgid "" "use this parameter." msgstr "" -#: ../../library/mmap.rst:98 +#: ../../library/mmap.rst:100 msgid "" "*offset* may be specified as a non-negative integer offset. mmap references " "will be relative to the offset from the beginning of the file. *offset* " @@ -157,48 +168,48 @@ msgid "" "which is equal to :const:`PAGESIZE` on Unix systems." msgstr "" -#: ../../library/mmap.rst:103 +#: ../../library/mmap.rst:105 msgid "" "To ensure validity of the created memory mapping the file specified by the " "descriptor *fileno* is internally automatically synchronized with the " "physical backing store on macOS." msgstr "" -#: ../../library/mmap.rst:107 +#: ../../library/mmap.rst:109 msgid "This example shows a simple way of using :class:`~mmap.mmap`::" msgstr "" -#: ../../library/mmap.rst:132 +#: ../../library/mmap.rst:134 msgid "" ":class:`~mmap.mmap` can also be used as a context manager in a :keyword:" "`with` statement::" msgstr "" -#: ../../library/mmap.rst:140 +#: ../../library/mmap.rst:142 msgid "Context manager support." msgstr "" -#: ../../library/mmap.rst:144 +#: ../../library/mmap.rst:146 msgid "" "The next example demonstrates how to create an anonymous map and exchange " "data between the parent and child processes::" msgstr "" -#: ../../library/mmap.rst:163 +#: ../../library/mmap.rst:165 msgid "Memory-mapped file objects support the following methods:" msgstr "" -#: ../../library/mmap.rst:167 +#: ../../library/mmap.rst:169 msgid "" "Closes the mmap. Subsequent calls to other methods of the object will result " "in a ValueError exception being raised. This will not close the open file." msgstr "" -#: ../../library/mmap.rst:174 +#: ../../library/mmap.rst:176 msgid "``True`` if the file is closed." msgstr "" -#: ../../library/mmap.rst:181 +#: ../../library/mmap.rst:183 msgid "" "Returns the lowest index in the object where the subsequence *sub* is found, " "such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -206,12 +217,12 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:186 ../../library/mmap.rst:267 -#: ../../library/mmap.rst:299 +#: ../../library/mmap.rst:188 ../../library/mmap.rst:277 +#: ../../library/mmap.rst:309 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: ../../library/mmap.rst:192 +#: ../../library/mmap.rst:194 msgid "" "Flushes changes made to the in-memory copy of a file back to disk. Without " "use of this call there is no guarantee that changes are written back before " @@ -221,20 +232,20 @@ msgid "" "`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:199 +#: ../../library/mmap.rst:201 msgid "" "``None`` is returned to indicate success. An exception is raised when the " "call failed." msgstr "" -#: ../../library/mmap.rst:202 +#: ../../library/mmap.rst:204 msgid "" "Previously, a nonzero value was returned on success; zero was returned on " "error under Windows. A zero value was returned on success; an exception was " "raised on error under Unix." msgstr "" -#: ../../library/mmap.rst:210 +#: ../../library/mmap.rst:212 msgid "" "Send advice *option* to the kernel about the memory region beginning at " "*start* and extending *length* bytes. *option* must be one of the :ref:" @@ -243,18 +254,18 @@ msgid "" "(including Linux), *start* must be a multiple of the :const:`PAGESIZE`." msgstr "" -#: ../../library/mmap.rst:217 +#: ../../library/mmap.rst:219 msgid "Availability: Systems with the ``madvise()`` system call." msgstr "" -#: ../../library/mmap.rst:224 +#: ../../library/mmap.rst:226 msgid "" "Copy the *count* bytes starting at offset *src* to the destination index " "*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to " "move will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:231 +#: ../../library/mmap.rst:233 msgid "" "Return a :class:`bytes` containing up to *n* bytes starting from the current " "file position. If the argument is omitted, ``None`` or negative, return all " @@ -262,31 +273,45 @@ msgid "" "position is updated to point after the bytes that were returned." msgstr "" -#: ../../library/mmap.rst:237 +#: ../../library/mmap.rst:239 msgid "Argument can be omitted or ``None``." msgstr "" -#: ../../library/mmap.rst:242 +#: ../../library/mmap.rst:244 msgid "" "Returns a byte at the current file position as an integer, and advances the " "file position by 1." msgstr "" -#: ../../library/mmap.rst:248 +#: ../../library/mmap.rst:250 msgid "" "Returns a single line, starting at the current file position and up to the " "next newline. The file position is updated to point after the bytes that " "were returned." msgstr "" -#: ../../library/mmap.rst:255 +#: ../../library/mmap.rst:257 msgid "" "Resizes the map and the underlying file, if any. If the mmap was created " "with :const:`ACCESS_READ` or :const:`ACCESS_COPY`, resizing the map will " "raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:262 +#: ../../library/mmap.rst:261 +msgid "" +"**On Windows**: Resizing the map will raise an :exc:`OSError` if there are " +"other maps against the same named file. Resizing an anonymous map (ie " +"against the pagefile) will silently create a new map with the original data " +"copied over up to the length of the new size." +msgstr "" + +#: ../../library/mmap.rst:266 +msgid "" +"Correctly fails if attempting to resize when another map is held Allows " +"resize against an anonymous map on Windows" +msgstr "" + +#: ../../library/mmap.rst:272 msgid "" "Returns the highest index in the object where the subsequence *sub* is " "found, such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -294,7 +319,7 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:273 +#: ../../library/mmap.rst:283 msgid "" "Set the file's current position. *whence* argument is optional and defaults " "to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are " @@ -302,17 +327,17 @@ msgid "" "SEEK_END`` or ``2`` (seek relative to the file's end)." msgstr "" -#: ../../library/mmap.rst:281 +#: ../../library/mmap.rst:291 msgid "" "Return the length of the file, which can be larger than the size of the " "memory-mapped area." msgstr "" -#: ../../library/mmap.rst:287 +#: ../../library/mmap.rst:297 msgid "Returns the current position of the file pointer." msgstr "" -#: ../../library/mmap.rst:292 +#: ../../library/mmap.rst:302 msgid "" "Write the bytes in *bytes* into memory at the current position of the file " "pointer and return the number of bytes written (never less than " @@ -322,11 +347,11 @@ msgid "" "it will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:302 +#: ../../library/mmap.rst:312 msgid "The number of bytes written is now returned." msgstr "" -#: ../../library/mmap.rst:308 +#: ../../library/mmap.rst:318 msgid "" "Write the integer *byte* into memory at the current position of the file " "pointer; the file position is advanced by ``1``. If the mmap was created " @@ -334,30 +359,34 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:316 +#: ../../library/mmap.rst:326 msgid "MADV_* Constants" msgstr "" -#: ../../library/mmap.rst:343 +#: ../../library/mmap.rst:353 msgid "" "These options can be passed to :meth:`mmap.madvise`. Not every option will " "be present on every system." msgstr "" -#: ../../library/mmap.rst:346 +#: ../../library/mmap.rst:356 msgid "Availability: Systems with the madvise() system call." msgstr "" -#: ../../library/mmap.rst:353 +#: ../../library/mmap.rst:363 msgid "MAP_* Constants" msgstr "" -#: ../../library/mmap.rst:363 +#: ../../library/mmap.rst:374 msgid "" "These are the various flags that can be passed to :meth:`mmap.mmap`. Note " "that some options might not be present on some systems." msgstr "" -#: ../../library/mmap.rst:365 +#: ../../library/mmap.rst:376 msgid "Added MAP_POPULATE constant." msgstr "新增 MAP_POPULATE 常數。" + +#: ../../library/mmap.rst:379 +msgid "Added MAP_STACK constant." +msgstr "新增 MAP_STACK 常數。" diff --git a/library/msilib.po b/library/msilib.po index 92640314f9..4166097ece 100644 --- a/library/msilib.po +++ b/library/msilib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,12 +26,13 @@ msgstr ":mod:`msilib` --- 讀寫 Microsoft Installer 檔案" msgid "**Source code:** :source:`Lib/msilib/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/msilib/__init__.py`" -#: ../../library/msilib.rst:16 +#: ../../library/msilib.rst:19 msgid "" "The :mod:`msilib` module is deprecated (see :pep:`PEP 594 <594#msilib>` for " "details)." msgstr "" -":mod:`msilib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#msilib>`\\ )。" +":mod:`msilib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#msilib>`" +"\\ )。" #: ../../library/msilib.rst:22 msgid "" @@ -45,46 +46,45 @@ msgstr "" #: ../../library/msilib.rst:27 msgid "" "This package aims to provide complete access to all tables in an ``.msi`` " -"file, therefore, it is a fairly low-level API. Two primary applications of " -"this package are the :mod:`distutils` command ``bdist_msi``, and the " -"creation of Python installer package itself (although that currently uses a " -"different version of ``msilib``)." +"file, therefore, it is a fairly low-level API. One primary application of " +"this package is the creation of Python installer package itself (although " +"that currently uses a different version of ``msilib``)." msgstr "" -#: ../../library/msilib.rst:33 +#: ../../library/msilib.rst:32 msgid "" "The package contents can be roughly split into four parts: low-level CAB " "routines, low-level MSI routines, higher-level MSI routines, and standard " "table structures." msgstr "" -#: ../../library/msilib.rst:40 +#: ../../library/msilib.rst:39 msgid "" "Create a new CAB file named *cabname*. *files* must be a list of tuples, " "each containing the name of the file on disk, and the name of the file " "inside the CAB file." msgstr "" -#: ../../library/msilib.rst:44 +#: ../../library/msilib.rst:43 msgid "" "The files are added to the CAB file in the order they appear in the list. " "All files are added into a single CAB file, using the MSZIP compression " "algorithm." msgstr "" -#: ../../library/msilib.rst:47 +#: ../../library/msilib.rst:46 msgid "" "Callbacks to Python for the various steps of MSI creation are currently not " "exposed." msgstr "" -#: ../../library/msilib.rst:53 +#: ../../library/msilib.rst:52 msgid "" "Return the string representation of a new unique identifier. This wraps the " "Windows API functions :c:func:`UuidCreate` and :c:func:`UuidToString`." msgstr "" -#: ../../library/msilib.rst:59 +#: ../../library/msilib.rst:58 msgid "" "Return a new database object by calling MsiOpenDatabase. *path* is the " "file name of the MSI file; *persist* can be one of the constants " @@ -95,84 +95,84 @@ msgid "" "new one created." msgstr "" -#: ../../library/msilib.rst:70 +#: ../../library/msilib.rst:69 msgid "" "Return a new record object by calling :c:func:`MSICreateRecord`. *count* is " "the number of fields of the record." msgstr "" -#: ../../library/msilib.rst:76 +#: ../../library/msilib.rst:75 msgid "" "Create and return a new database *name*, initialize it with *schema*, and " "set the properties *ProductName*, *ProductCode*, *ProductVersion*, and " "*Manufacturer*." msgstr "" -#: ../../library/msilib.rst:80 +#: ../../library/msilib.rst:79 msgid "" "*schema* must be a module object containing ``tables`` and " "``_Validation_records`` attributes; typically, :mod:`msilib.schema` should " "be used." msgstr "" -#: ../../library/msilib.rst:84 +#: ../../library/msilib.rst:83 msgid "" "The database will contain just the schema and the validation records when " "this function returns." msgstr "" -#: ../../library/msilib.rst:90 +#: ../../library/msilib.rst:89 msgid "Add all *records* to the table named *table* in *database*." msgstr "" -#: ../../library/msilib.rst:92 +#: ../../library/msilib.rst:91 msgid "" "The *table* argument must be one of the predefined tables in the MSI schema, " "e.g. ``'Feature'``, ``'File'``, ``'Component'``, ``'Dialog'``, " "``'Control'``, etc." msgstr "" -#: ../../library/msilib.rst:96 +#: ../../library/msilib.rst:95 msgid "" "*records* should be a list of tuples, each one containing all fields of a " "record according to the schema of the table. For optional fields, ``None`` " "can be passed." msgstr "" -#: ../../library/msilib.rst:100 +#: ../../library/msilib.rst:99 msgid "Field values can be ints, strings, or instances of the Binary class." msgstr "" -#: ../../library/msilib.rst:105 +#: ../../library/msilib.rst:104 msgid "" "Represents entries in the Binary table; inserting such an object using :func:" "`add_data` reads the file named *filename* into the table." msgstr "" -#: ../../library/msilib.rst:111 +#: ../../library/msilib.rst:110 msgid "" "Add all table content from *module* to *database*. *module* must contain an " "attribute *tables* listing all tables for which content should be added, and " "one attribute per table that has the actual content." msgstr "" -#: ../../library/msilib.rst:115 +#: ../../library/msilib.rst:114 msgid "This is typically used to install the sequence tables." msgstr "" -#: ../../library/msilib.rst:120 +#: ../../library/msilib.rst:119 msgid "" "Add the file *path* into the ``_Stream`` table of *database*, with the " "stream name *name*." msgstr "" -#: ../../library/msilib.rst:126 +#: ../../library/msilib.rst:125 msgid "" "Return a new UUID, in the format that MSI typically requires (i.e. in curly " -"braces, and with all hexdigits in upper-case)." +"braces, and with all hexdigits in uppercase)." msgstr "" -#: ../../library/msilib.rst:132 +#: ../../library/msilib.rst:131 msgid "" "`FCICreate `_ " "`UuidCreate `_" msgstr "" -#: ../../library/msilib.rst:139 +#: ../../library/msilib.rst:138 msgid "Database Objects" msgstr "" -#: ../../library/msilib.rst:144 +#: ../../library/msilib.rst:143 msgid "" "Return a view object, by calling :c:func:`MSIDatabaseOpenView`. *sql* is the " "SQL statement to execute." msgstr "" -#: ../../library/msilib.rst:150 +#: ../../library/msilib.rst:149 msgid "" "Commit the changes pending in the current transaction, by calling :c:func:" "`MSIDatabaseCommit`." msgstr "" -#: ../../library/msilib.rst:156 +#: ../../library/msilib.rst:155 msgid "" "Return a new summary information object, by calling :c:func:" "`MsiGetSummaryInformation`. *count* is the maximum number of updated values." msgstr "" -#: ../../library/msilib.rst:162 +#: ../../library/msilib.rst:161 msgid "Close the database object, through :c:func:`MsiCloseHandle`." msgstr "" -#: ../../library/msilib.rst:168 +#: ../../library/msilib.rst:167 msgid "" "`MSIDatabaseOpenView `_ `MSIDatabaseCommit `_" msgstr "" -#: ../../library/msilib.rst:176 +#: ../../library/msilib.rst:175 msgid "View Objects" msgstr "" -#: ../../library/msilib.rst:181 +#: ../../library/msilib.rst:180 msgid "" "Execute the SQL query of the view, through :c:func:`MSIViewExecute`. If " "*params* is not ``None``, it is a record describing actual values of the " "parameter tokens in the query." msgstr "" -#: ../../library/msilib.rst:188 +#: ../../library/msilib.rst:187 msgid "" "Return a record describing the columns of the view, through calling :c:func:" "`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or " "``MSICOLINFO_TYPES``." msgstr "" -#: ../../library/msilib.rst:195 +#: ../../library/msilib.rst:194 msgid "" "Return a result record of the query, through calling :c:func:`MsiViewFetch`." msgstr "" -#: ../../library/msilib.rst:200 +#: ../../library/msilib.rst:199 msgid "" "Modify the view, by calling :c:func:`MsiViewModify`. *kind* can be one of " "``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``, " @@ -249,15 +249,15 @@ msgid "" "``MSIMODIFY_VALIDATE_FIELD``, or ``MSIMODIFY_VALIDATE_DELETE``." msgstr "" -#: ../../library/msilib.rst:207 +#: ../../library/msilib.rst:206 msgid "*data* must be a record describing the new data." msgstr "" -#: ../../library/msilib.rst:212 +#: ../../library/msilib.rst:211 msgid "Close the view, through :c:func:`MsiViewClose`." msgstr "" -#: ../../library/msilib.rst:217 +#: ../../library/msilib.rst:216 msgid "" "`MsiViewExecute `_ `MSIViewGetColumnInfo `_" msgstr "" -#: ../../library/msilib.rst:226 +#: ../../library/msilib.rst:225 msgid "Summary Information Objects" msgstr "" -#: ../../library/msilib.rst:231 +#: ../../library/msilib.rst:230 msgid "" "Return a property of the summary, through :c:func:" "`MsiSummaryInfoGetProperty`. *field* is the name of the property, and can be " @@ -283,26 +283,26 @@ msgid "" "``PID_WORDCOUNT``, ``PID_CHARCOUNT``, ``PID_APPNAME``, or ``PID_SECURITY``." msgstr "" -#: ../../library/msilib.rst:242 +#: ../../library/msilib.rst:241 msgid "" "Return the number of summary properties, through :c:func:" "`MsiSummaryInfoGetPropertyCount`." msgstr "" -#: ../../library/msilib.rst:248 +#: ../../library/msilib.rst:247 msgid "" "Set a property through :c:func:`MsiSummaryInfoSetProperty`. *field* can have " "the same values as in :meth:`GetProperty`, *value* is the new value of the " "property. Possible value types are integer and string." msgstr "" -#: ../../library/msilib.rst:255 +#: ../../library/msilib.rst:254 msgid "" "Write the modified properties to the summary information stream, using :c:" "func:`MsiSummaryInfoPersist`." msgstr "" -#: ../../library/msilib.rst:261 +#: ../../library/msilib.rst:260 msgid "" "`MsiSummaryInfoGetProperty `_ `MsiSummaryInfoGetPropertyCount `_" msgstr "" -#: ../../library/msilib.rst:269 +#: ../../library/msilib.rst:268 msgid "Record Objects" msgstr "" -#: ../../library/msilib.rst:274 +#: ../../library/msilib.rst:273 msgid "" "Return the number of fields of the record, through :c:func:" "`MsiRecordGetFieldCount`." msgstr "" -#: ../../library/msilib.rst:280 +#: ../../library/msilib.rst:279 msgid "" "Return the value of *field* as an integer where possible. *field* must be " "an integer." msgstr "" -#: ../../library/msilib.rst:286 +#: ../../library/msilib.rst:285 msgid "" "Return the value of *field* as a string where possible. *field* must be an " "integer." msgstr "" -#: ../../library/msilib.rst:292 +#: ../../library/msilib.rst:291 msgid "" "Set *field* to *value* through :c:func:`MsiRecordSetString`. *field* must be " "an integer; *value* a string." msgstr "" -#: ../../library/msilib.rst:298 +#: ../../library/msilib.rst:297 msgid "" "Set *field* to the contents of the file named *value*, through :c:func:" "`MsiRecordSetStream`. *field* must be an integer; *value* a string." msgstr "" -#: ../../library/msilib.rst:304 +#: ../../library/msilib.rst:303 msgid "" "Set *field* to *value* through :c:func:`MsiRecordSetInteger`. Both *field* " "and *value* must be an integer." msgstr "" -#: ../../library/msilib.rst:310 +#: ../../library/msilib.rst:309 msgid "" "Set all fields of the record to 0, through :c:func:`MsiRecordClearData`." msgstr "" -#: ../../library/msilib.rst:315 +#: ../../library/msilib.rst:314 msgid "" "`MsiRecordGetFieldCount `_ `MsiRecordSetString `_" msgstr "" -#: ../../library/msilib.rst:324 +#: ../../library/msilib.rst:323 msgid "Errors" msgstr "" -#: ../../library/msilib.rst:326 +#: ../../library/msilib.rst:325 msgid "" "All wrappers around MSI functions raise :exc:`MSIError`; the string inside " "the exception will contain more detail." msgstr "" -#: ../../library/msilib.rst:333 +#: ../../library/msilib.rst:332 msgid "CAB Objects" msgstr "CAB 物件" -#: ../../library/msilib.rst:338 +#: ../../library/msilib.rst:337 msgid "" "The class :class:`CAB` represents a CAB file. During MSI construction, files " "will be added simultaneously to the ``Files`` table, and to a CAB file. " @@ -390,34 +390,34 @@ msgid "" "added to the MSI file." msgstr "" -#: ../../library/msilib.rst:343 +#: ../../library/msilib.rst:342 msgid "*name* is the name of the CAB file in the MSI file." msgstr "" -#: ../../library/msilib.rst:348 +#: ../../library/msilib.rst:347 msgid "" "Add the file with the pathname *full* to the CAB file, under the name " "*logical*. If there is already a file named *logical*, a new file name is " "created." msgstr "" -#: ../../library/msilib.rst:352 +#: ../../library/msilib.rst:351 msgid "" "Return the index of the file in the CAB file, and the new name of the file " "inside the CAB file." msgstr "" -#: ../../library/msilib.rst:358 +#: ../../library/msilib.rst:357 msgid "" "Generate a CAB file, add it as a stream to the MSI file, put it into the " "``Media`` table, and remove the generated file from the disk." msgstr "" -#: ../../library/msilib.rst:365 +#: ../../library/msilib.rst:364 msgid "Directory Objects" msgstr "" -#: ../../library/msilib.rst:370 +#: ../../library/msilib.rst:369 msgid "" "Create a new directory in the Directory table. There is a current component " "at each point in time for the directory, which is either explicitly created " @@ -429,7 +429,7 @@ msgid "" "table. *componentflags* specifies the default flags that new components get." msgstr "" -#: ../../library/msilib.rst:382 +#: ../../library/msilib.rst:381 msgid "" "Add an entry to the Component table, and make this component the current " "component for this directory. If no component name is given, the directory " @@ -438,7 +438,7 @@ msgid "" "is given, the KeyPath is left null in the Component table." msgstr "" -#: ../../library/msilib.rst:391 +#: ../../library/msilib.rst:390 msgid "" "Add a file to the current component of the directory, starting a new one if " "there is no current component. By default, the file name in the source and " @@ -447,17 +447,17 @@ msgid "" "*language* can be specified for the entry in the File table." msgstr "" -#: ../../library/msilib.rst:400 +#: ../../library/msilib.rst:399 msgid "" "Add a list of files to the current component as specified in the glob " "pattern. Individual files can be excluded in the *exclude* list." msgstr "" -#: ../../library/msilib.rst:406 +#: ../../library/msilib.rst:405 msgid "Remove ``.pyc`` files on uninstall." msgstr "" -#: ../../library/msilib.rst:411 +#: ../../library/msilib.rst:410 msgid "" "`Directory Table `_ `File Table `_" msgstr "" -#: ../../library/msilib.rst:419 +#: ../../library/msilib.rst:418 msgid "Features" msgstr "" -#: ../../library/msilib.rst:424 +#: ../../library/msilib.rst:423 msgid "" "Add a new record to the ``Feature`` table, using the values *id*, *parent." "id*, *title*, *desc*, *display*, *level*, *directory*, and *attributes*. The " @@ -478,106 +478,104 @@ msgid "" "of :class:`Directory`." msgstr "" -#: ../../library/msilib.rst:432 +#: ../../library/msilib.rst:431 msgid "" "Make this feature the current feature of :mod:`msilib`. New components are " "automatically added to the default feature, unless a feature is explicitly " "specified." msgstr "" -#: ../../library/msilib.rst:439 +#: ../../library/msilib.rst:438 msgid "" "`Feature Table `_" msgstr "" -#: ../../library/msilib.rst:444 +#: ../../library/msilib.rst:443 msgid "GUI classes" msgstr "" -#: ../../library/msilib.rst:446 +#: ../../library/msilib.rst:445 msgid "" ":mod:`msilib` provides several classes that wrap the GUI tables in an MSI " -"database. However, no standard user interface is provided; use :mod:" -"`~distutils.command.bdist_msi` to create MSI files with a user-interface for " -"installing Python packages." +"database. However, no standard user interface is provided." msgstr "" -#: ../../library/msilib.rst:454 +#: ../../library/msilib.rst:451 msgid "" "Base class of the dialog controls. *dlg* is the dialog object the control " "belongs to, and *name* is the control's name." msgstr "" -#: ../../library/msilib.rst:460 +#: ../../library/msilib.rst:457 msgid "Make an entry into the ``ControlEvent`` table for this control." msgstr "" -#: ../../library/msilib.rst:465 +#: ../../library/msilib.rst:462 msgid "Make an entry into the ``EventMapping`` table for this control." msgstr "" -#: ../../library/msilib.rst:470 +#: ../../library/msilib.rst:467 msgid "Make an entry into the ``ControlCondition`` table for this control." msgstr "" -#: ../../library/msilib.rst:475 +#: ../../library/msilib.rst:472 msgid "" "Create a radio button control named *name*. *property* is the installer " "property that gets set when a radio button is selected." msgstr "" -#: ../../library/msilib.rst:481 +#: ../../library/msilib.rst:478 msgid "" "Add a radio button named *name* to the group, at the coordinates *x*, *y*, " "*width*, *height*, and with the label *text*. If *value* is ``None``, it " "defaults to *name*." msgstr "" -#: ../../library/msilib.rst:488 +#: ../../library/msilib.rst:485 msgid "" "Return a new :class:`Dialog` object. An entry in the ``Dialog`` table is " "made, with the specified coordinates, dialog attributes, title, name of the " "first, default, and cancel controls." msgstr "" -#: ../../library/msilib.rst:495 +#: ../../library/msilib.rst:492 msgid "" "Return a new :class:`Control` object. An entry in the ``Control`` table is " "made with the specified parameters." msgstr "" -#: ../../library/msilib.rst:498 +#: ../../library/msilib.rst:495 msgid "" "This is a generic method; for specific types, specialized methods are " "provided." msgstr "" -#: ../../library/msilib.rst:504 +#: ../../library/msilib.rst:501 msgid "Add and return a ``Text`` control." msgstr "" -#: ../../library/msilib.rst:509 +#: ../../library/msilib.rst:506 msgid "Add and return a ``Bitmap`` control." msgstr "" -#: ../../library/msilib.rst:514 +#: ../../library/msilib.rst:511 msgid "Add and return a ``Line`` control." msgstr "" -#: ../../library/msilib.rst:519 +#: ../../library/msilib.rst:516 msgid "Add and return a ``PushButton`` control." msgstr "" -#: ../../library/msilib.rst:524 +#: ../../library/msilib.rst:521 msgid "Add and return a ``RadioButtonGroup`` control." msgstr "" -#: ../../library/msilib.rst:529 +#: ../../library/msilib.rst:526 msgid "Add and return a ``CheckBox`` control." msgstr "" -#: ../../library/msilib.rst:534 +#: ../../library/msilib.rst:531 msgid "" "`Dialog Table `_ `Control Table `_" msgstr "" -#: ../../library/msilib.rst:545 +#: ../../library/msilib.rst:542 msgid "Precomputed tables" msgstr "" -#: ../../library/msilib.rst:547 +#: ../../library/msilib.rst:544 msgid "" ":mod:`msilib` provides a few subpackages that contain only schema and table " "definitions. Currently, these definitions are based on MSI version 2.0." msgstr "" -#: ../../library/msilib.rst:553 +#: ../../library/msilib.rst:550 msgid "" "This is the standard MSI schema for MSI 2.0, with the *tables* variable " "providing a list of table definitions, and *_Validation_records* providing " "the data for MSI validation." msgstr "" -#: ../../library/msilib.rst:560 +#: ../../library/msilib.rst:557 msgid "" "This module contains table contents for the standard sequence tables: " "*AdminExecuteSequence*, *AdminUISequence*, *AdvtExecuteSequence*, " "*InstallExecuteSequence*, and *InstallUISequence*." msgstr "" -#: ../../library/msilib.rst:567 +#: ../../library/msilib.rst:564 msgid "" "This module contains definitions for the UIText and ActionText tables, for " "the standard installer actions." diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 14c1519045..4e14175634 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-05 00:24+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,11 +26,22 @@ msgstr "" msgid "**Source code:** :source:`Lib/multiprocessing/`" msgstr "**原始碼:**\\ :source:`Lib/multiprocessing/`" -#: ../../library/multiprocessing.rst:12 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/multiprocessing.rst:14 msgid "Introduction" msgstr "簡介" -#: ../../library/multiprocessing.rst:14 +#: ../../library/multiprocessing.rst:16 msgid "" ":mod:`multiprocessing` is a package that supports spawning processes using " "an API similar to the :mod:`threading` module. The :mod:`multiprocessing` " @@ -41,7 +52,7 @@ msgid "" "given machine. It runs on both Unix and Windows." msgstr "" -#: ../../library/multiprocessing.rst:23 +#: ../../library/multiprocessing.rst:25 msgid "" "The :mod:`multiprocessing` module also introduces APIs which do not have " "analogs in the :mod:`threading` module. A prime example of this is the :" @@ -54,11 +65,11 @@ msgid "" "`~multiprocessing.pool.Pool`, ::" msgstr "" -#: ../../library/multiprocessing.rst:41 +#: ../../library/multiprocessing.rst:43 msgid "will print to standard output ::" msgstr "" -#: ../../library/multiprocessing.rst:48 +#: ../../library/multiprocessing.rst:50 msgid "" ":class:`concurrent.futures.ProcessPoolExecutor` offers a higher level " "interface to push tasks to a background process without blocking execution " @@ -68,11 +79,11 @@ msgid "" "from waiting for the results." msgstr "" -#: ../../library/multiprocessing.rst:57 +#: ../../library/multiprocessing.rst:59 msgid "The :class:`Process` class" msgstr "" -#: ../../library/multiprocessing.rst:59 +#: ../../library/multiprocessing.rst:61 msgid "" "In :mod:`multiprocessing`, processes are spawned by creating a :class:" "`Process` object and then calling its :meth:`~Process.start` method. :class:" @@ -80,32 +91,32 @@ msgid "" "of a multiprocess program is ::" msgstr "" -#: ../../library/multiprocessing.rst:74 +#: ../../library/multiprocessing.rst:76 msgid "" "To show the individual process IDs involved, here is an expanded example::" msgstr "" -#: ../../library/multiprocessing.rst:95 +#: ../../library/multiprocessing.rst:97 msgid "" "For an explanation of why the ``if __name__ == '__main__'`` part is " "necessary, see :ref:`multiprocessing-programming`." msgstr "" -#: ../../library/multiprocessing.rst:101 +#: ../../library/multiprocessing.rst:103 msgid "Contexts and start methods" msgstr "" -#: ../../library/multiprocessing.rst:105 +#: ../../library/multiprocessing.rst:107 msgid "" "Depending on the platform, :mod:`multiprocessing` supports three ways to " "start a process. These *start methods* are" msgstr "" -#: ../../library/multiprocessing.rst:116 +#: ../../library/multiprocessing.rst:118 msgid "*spawn*" msgstr "" -#: ../../library/multiprocessing.rst:109 +#: ../../library/multiprocessing.rst:111 msgid "" "The parent process starts a fresh Python interpreter process. The child " "process will only inherit those resources necessary to run the process " @@ -115,15 +126,15 @@ msgid "" "or *forkserver*." msgstr "" -#: ../../library/multiprocessing.rst:116 +#: ../../library/multiprocessing.rst:118 msgid "Available on Unix and Windows. The default on Windows and macOS." msgstr "" -#: ../../library/multiprocessing.rst:125 +#: ../../library/multiprocessing.rst:127 msgid "*fork*" msgstr "" -#: ../../library/multiprocessing.rst:119 +#: ../../library/multiprocessing.rst:121 msgid "" "The parent process uses :func:`os.fork` to fork the Python interpreter. The " "child process, when it begins, is effectively identical to the parent " @@ -131,15 +142,15 @@ msgid "" "Note that safely forking a multithreaded process is problematic." msgstr "" -#: ../../library/multiprocessing.rst:125 +#: ../../library/multiprocessing.rst:127 msgid "Available on Unix only. The default on Unix." msgstr "" -#: ../../library/multiprocessing.rst:136 +#: ../../library/multiprocessing.rst:138 msgid "*forkserver*" msgstr "" -#: ../../library/multiprocessing.rst:128 +#: ../../library/multiprocessing.rst:130 msgid "" "When the program starts and selects the *forkserver* start method, a server " "process is started. From then on, whenever a new process is needed, the " @@ -148,27 +159,27 @@ msgid "" "use :func:`os.fork`. No unnecessary resources are inherited." msgstr "" -#: ../../library/multiprocessing.rst:135 +#: ../../library/multiprocessing.rst:137 msgid "" "Available on Unix platforms which support passing file descriptors over Unix " "pipes." msgstr "" -#: ../../library/multiprocessing.rst:140 ../../library/multiprocessing.rst:1053 +#: ../../library/multiprocessing.rst:142 ../../library/multiprocessing.rst:1070 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:144 +#: ../../library/multiprocessing.rst:146 msgid "" "*spawn* added on all Unix platforms, and *forkserver* added for some Unix " "platforms. Child processes no longer inherit all of the parents inheritable " "handles on Windows." msgstr "" -#: ../../library/multiprocessing.rst:150 +#: ../../library/multiprocessing.rst:152 msgid "" "On Unix using the *spawn* or *forkserver* start methods will also start a " "*resource tracker* process which tracks the unlinked named system resources " @@ -183,25 +194,25 @@ msgid "" "space in the main memory.)" msgstr "" -#: ../../library/multiprocessing.rst:163 +#: ../../library/multiprocessing.rst:165 msgid "" "To select a start method you use the :func:`set_start_method` in the ``if " "__name__ == '__main__'`` clause of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:180 +#: ../../library/multiprocessing.rst:182 msgid "" ":func:`set_start_method` should not be used more than once in the program." msgstr "" -#: ../../library/multiprocessing.rst:183 +#: ../../library/multiprocessing.rst:185 msgid "" "Alternatively, you can use :func:`get_context` to obtain a context object. " "Context objects have the same API as the multiprocessing module, and allow " "one to use multiple start methods in the same program. ::" msgstr "" -#: ../../library/multiprocessing.rst:201 +#: ../../library/multiprocessing.rst:203 msgid "" "Note that objects related to one context may not be compatible with " "processes for a different context. In particular, locks created using the " @@ -209,13 +220,13 @@ msgid "" "*forkserver* start methods." msgstr "" -#: ../../library/multiprocessing.rst:206 +#: ../../library/multiprocessing.rst:208 msgid "" "A library which wants to use a particular start method should probably use :" "func:`get_context` to avoid interfering with the choice of the library user." msgstr "" -#: ../../library/multiprocessing.rst:212 +#: ../../library/multiprocessing.rst:214 msgid "" "The ``'spawn'`` and ``'forkserver'`` start methods cannot currently be used " "with \"frozen\" executables (i.e., binaries produced by packages like " @@ -223,41 +234,41 @@ msgid "" "work." msgstr "" -#: ../../library/multiprocessing.rst:219 +#: ../../library/multiprocessing.rst:221 msgid "Exchanging objects between processes" msgstr "" -#: ../../library/multiprocessing.rst:221 +#: ../../library/multiprocessing.rst:223 msgid "" ":mod:`multiprocessing` supports two types of communication channel between " "processes:" msgstr "" -#: ../../library/multiprocessing.rst:224 +#: ../../library/multiprocessing.rst:226 msgid "**Queues**" msgstr "" -#: ../../library/multiprocessing.rst:226 +#: ../../library/multiprocessing.rst:228 msgid "" "The :class:`Queue` class is a near clone of :class:`queue.Queue`. For " "example::" msgstr "" -#: ../../library/multiprocessing.rst:241 +#: ../../library/multiprocessing.rst:243 msgid "Queues are thread and process safe." msgstr "" -#: ../../library/multiprocessing.rst:243 +#: ../../library/multiprocessing.rst:245 msgid "**Pipes**" msgstr "" -#: ../../library/multiprocessing.rst:245 +#: ../../library/multiprocessing.rst:247 msgid "" "The :func:`Pipe` function returns a pair of connection objects connected by " "a pipe which by default is duplex (two-way). For example::" msgstr "" -#: ../../library/multiprocessing.rst:261 +#: ../../library/multiprocessing.rst:263 msgid "" "The two connection objects returned by :func:`Pipe` represent the two ends " "of the pipe. Each connection object has :meth:`~Connection.send` and :meth:" @@ -267,55 +278,55 @@ msgid "" "corruption from processes using different ends of the pipe at the same time." msgstr "" -#: ../../library/multiprocessing.rst:271 +#: ../../library/multiprocessing.rst:273 msgid "Synchronization between processes" msgstr "" -#: ../../library/multiprocessing.rst:273 +#: ../../library/multiprocessing.rst:275 msgid "" ":mod:`multiprocessing` contains equivalents of all the synchronization " "primitives from :mod:`threading`. For instance one can use a lock to ensure " "that only one process prints to standard output at a time::" msgstr "" -#: ../../library/multiprocessing.rst:292 +#: ../../library/multiprocessing.rst:294 msgid "" "Without using the lock output from the different processes is liable to get " "all mixed up." msgstr "" -#: ../../library/multiprocessing.rst:297 +#: ../../library/multiprocessing.rst:299 msgid "Sharing state between processes" msgstr "" -#: ../../library/multiprocessing.rst:299 +#: ../../library/multiprocessing.rst:301 msgid "" "As mentioned above, when doing concurrent programming it is usually best to " "avoid using shared state as far as possible. This is particularly true when " "using multiple processes." msgstr "" -#: ../../library/multiprocessing.rst:303 +#: ../../library/multiprocessing.rst:305 msgid "" "However, if you really do need to use some shared data then :mod:" "`multiprocessing` provides a couple of ways of doing so." msgstr "" -#: ../../library/multiprocessing.rst:306 +#: ../../library/multiprocessing.rst:308 msgid "**Shared memory**" msgstr "" -#: ../../library/multiprocessing.rst:308 +#: ../../library/multiprocessing.rst:310 msgid "" "Data can be stored in a shared memory map using :class:`Value` or :class:" "`Array`. For example, the following code ::" msgstr "" -#: ../../library/multiprocessing.rst:329 ../../library/multiprocessing.rst:375 +#: ../../library/multiprocessing.rst:331 ../../library/multiprocessing.rst:377 msgid "will print ::" msgstr "" -#: ../../library/multiprocessing.rst:334 +#: ../../library/multiprocessing.rst:336 msgid "" "The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are " "typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a " @@ -323,25 +334,25 @@ msgid "" "objects will be process and thread-safe." msgstr "" -#: ../../library/multiprocessing.rst:339 +#: ../../library/multiprocessing.rst:341 msgid "" "For more flexibility in using shared memory one can use the :mod:" "`multiprocessing.sharedctypes` module which supports the creation of " "arbitrary ctypes objects allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:343 +#: ../../library/multiprocessing.rst:345 msgid "**Server process**" msgstr "" -#: ../../library/multiprocessing.rst:345 +#: ../../library/multiprocessing.rst:347 msgid "" "A manager object returned by :func:`Manager` controls a server process which " "holds Python objects and allows other processes to manipulate them using " "proxies." msgstr "" -#: ../../library/multiprocessing.rst:349 +#: ../../library/multiprocessing.rst:351 msgid "" "A manager returned by :func:`Manager` will support types :class:`list`, :" "class:`dict`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :" @@ -350,7 +361,7 @@ msgid "" "`Array`. For example, ::" msgstr "" -#: ../../library/multiprocessing.rst:380 +#: ../../library/multiprocessing.rst:382 msgid "" "Server process managers are more flexible than using shared memory objects " "because they can be made to support arbitrary object types. Also, a single " @@ -358,31 +369,31 @@ msgid "" "They are, however, slower than using shared memory." msgstr "" -#: ../../library/multiprocessing.rst:387 +#: ../../library/multiprocessing.rst:389 msgid "Using a pool of workers" msgstr "" -#: ../../library/multiprocessing.rst:389 +#: ../../library/multiprocessing.rst:391 msgid "" "The :class:`~multiprocessing.pool.Pool` class represents a pool of worker " "processes. It has methods which allows tasks to be offloaded to the worker " "processes in a few different ways." msgstr "" -#: ../../library/multiprocessing.rst:393 +#: ../../library/multiprocessing.rst:395 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/multiprocessing.rst:437 +#: ../../library/multiprocessing.rst:439 msgid "" "Note that the methods of a pool should only ever be used by the process " "which created it." msgstr "" -#: ../../library/multiprocessing.rst:442 +#: ../../library/multiprocessing.rst:444 msgid "" "Functionality within this package requires that the ``__main__`` module be " "importable by the children. This is covered in :ref:`multiprocessing-" @@ -391,35 +402,35 @@ msgid "" "work in the interactive interpreter. For example::" msgstr "" -#: ../../library/multiprocessing.rst:465 +#: ../../library/multiprocessing.rst:467 msgid "" "(If you try this it will actually output three full tracebacks interleaved " "in a semi-random fashion, and then you may have to stop the parent process " "somehow.)" msgstr "" -#: ../../library/multiprocessing.rst:471 +#: ../../library/multiprocessing.rst:473 msgid "Reference" msgstr "" -#: ../../library/multiprocessing.rst:473 +#: ../../library/multiprocessing.rst:475 msgid "" "The :mod:`multiprocessing` package mostly replicates the API of the :mod:" "`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:478 +#: ../../library/multiprocessing.rst:480 msgid ":class:`Process` and exceptions" msgstr ":class:`Process` 與例外" -#: ../../library/multiprocessing.rst:483 +#: ../../library/multiprocessing.rst:485 msgid "" "Process objects represent activity that is run in a separate process. The :" "class:`Process` class has equivalents of all the methods of :class:" "`threading.Thread`." msgstr "" -#: ../../library/multiprocessing.rst:487 +#: ../../library/multiprocessing.rst:489 msgid "" "The constructor should always be called with keyword arguments. *group* " "should always be ``None``; it exists solely for compatibility with :class:" @@ -433,26 +444,29 @@ msgid "" "creating process." msgstr "" -#: ../../library/multiprocessing.rst:498 -msgid "By default, no arguments are passed to *target*." +#: ../../library/multiprocessing.rst:500 +msgid "" +"By default, no arguments are passed to *target*. The *args* argument, which " +"defaults to ``()``, can be used to specify a list or tuple of the arguments " +"to pass to *target*." msgstr "" -#: ../../library/multiprocessing.rst:500 +#: ../../library/multiprocessing.rst:504 msgid "" "If a subclass overrides the constructor, it must make sure it invokes the " "base class constructor (:meth:`Process.__init__`) before doing anything else " "to the process." msgstr "" -#: ../../library/multiprocessing.rst:504 +#: ../../library/multiprocessing.rst:508 msgid "Added the *daemon* argument." msgstr "新增 *daemon* 引數。" -#: ../../library/multiprocessing.rst:509 +#: ../../library/multiprocessing.rst:513 msgid "Method representing the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:511 +#: ../../library/multiprocessing.rst:515 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the target " @@ -460,17 +474,30 @@ msgid "" "*args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/multiprocessing.rst:518 +#: ../../library/multiprocessing.rst:520 +msgid "" +"Using a list or tuple as the *args* argument passed to :class:`Process` " +"achieves the same effect." +msgstr "" + +#: ../../library/multiprocessing.rst:523 +msgid "Example::" +msgstr "" +"範例:\n" +"\n" +"::" + +#: ../../library/multiprocessing.rst:535 msgid "Start the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:520 +#: ../../library/multiprocessing.rst:537 msgid "" "This must be called at most once per process object. It arranges for the " "object's :meth:`run` method to be invoked in a separate process." msgstr "" -#: ../../library/multiprocessing.rst:525 +#: ../../library/multiprocessing.rst:542 msgid "" "If the optional argument *timeout* is ``None`` (the default), the method " "blocks until the process whose :meth:`join` method is called terminates. If " @@ -480,23 +507,23 @@ msgid "" "terminated." msgstr "" -#: ../../library/multiprocessing.rst:532 +#: ../../library/multiprocessing.rst:549 msgid "A process can be joined many times." msgstr "" -#: ../../library/multiprocessing.rst:534 +#: ../../library/multiprocessing.rst:551 msgid "" "A process cannot join itself because this would cause a deadlock. It is an " "error to attempt to join a process before it has been started." msgstr "" -#: ../../library/multiprocessing.rst:539 +#: ../../library/multiprocessing.rst:556 msgid "" "The process's name. The name is a string used for identification purposes " "only. It has no semantics. Multiple processes may be given the same name." msgstr "" -#: ../../library/multiprocessing.rst:543 +#: ../../library/multiprocessing.rst:560 msgid "" "The initial name is set by the constructor. If no explicit name is provided " "to the constructor, a name of the form 'Process-N\\ :sub:`1`:N\\ :sub:" @@ -504,33 +531,33 @@ msgid "" "child of its parent." msgstr "" -#: ../../library/multiprocessing.rst:550 +#: ../../library/multiprocessing.rst:567 msgid "Return whether the process is alive." msgstr "" -#: ../../library/multiprocessing.rst:552 +#: ../../library/multiprocessing.rst:569 msgid "" "Roughly, a process object is alive from the moment the :meth:`start` method " "returns until the child process terminates." msgstr "" -#: ../../library/multiprocessing.rst:557 +#: ../../library/multiprocessing.rst:574 msgid "" "The process's daemon flag, a Boolean value. This must be set before :meth:" "`start` is called." msgstr "" -#: ../../library/multiprocessing.rst:560 +#: ../../library/multiprocessing.rst:577 msgid "The initial value is inherited from the creating process." msgstr "" -#: ../../library/multiprocessing.rst:562 +#: ../../library/multiprocessing.rst:579 msgid "" "When a process exits, it attempts to terminate all of its daemonic child " "processes." msgstr "" -#: ../../library/multiprocessing.rst:565 +#: ../../library/multiprocessing.rst:582 msgid "" "Note that a daemonic process is not allowed to create child processes. " "Otherwise a daemonic process would leave its children orphaned if it gets " @@ -539,92 +566,92 @@ msgid "" "(and not joined) if non-daemonic processes have exited." msgstr "" -#: ../../library/multiprocessing.rst:571 +#: ../../library/multiprocessing.rst:588 msgid "" "In addition to the :class:`threading.Thread` API, :class:`Process` objects " "also support the following attributes and methods:" msgstr "" -#: ../../library/multiprocessing.rst:576 +#: ../../library/multiprocessing.rst:593 msgid "" "Return the process ID. Before the process is spawned, this will be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:581 +#: ../../library/multiprocessing.rst:598 msgid "" "The child's exit code. This will be ``None`` if the process has not yet " "terminated." msgstr "" -#: ../../library/multiprocessing.rst:584 +#: ../../library/multiprocessing.rst:601 msgid "" "If the child's :meth:`run` method returned normally, the exit code will be " "0. If it terminated via :func:`sys.exit` with an integer argument *N*, the " "exit code will be *N*." msgstr "" -#: ../../library/multiprocessing.rst:588 +#: ../../library/multiprocessing.rst:605 msgid "" "If the child terminated due to an exception not caught within :meth:`run`, " "the exit code will be 1. If it was terminated by signal *N*, the exit code " "will be the negative value *-N*." msgstr "" -#: ../../library/multiprocessing.rst:594 +#: ../../library/multiprocessing.rst:611 msgid "The process's authentication key (a byte string)." msgstr "" -#: ../../library/multiprocessing.rst:596 +#: ../../library/multiprocessing.rst:613 msgid "" "When :mod:`multiprocessing` is initialized the main process is assigned a " "random string using :func:`os.urandom`." msgstr "" -#: ../../library/multiprocessing.rst:599 +#: ../../library/multiprocessing.rst:616 msgid "" "When a :class:`Process` object is created, it will inherit the " "authentication key of its parent process, although this may be changed by " "setting :attr:`authkey` to another byte string." msgstr "" -#: ../../library/multiprocessing.rst:603 +#: ../../library/multiprocessing.rst:620 msgid "See :ref:`multiprocessing-auth-keys`." msgstr "參閱 :ref:`multiprocessing-auth-keys`\\ 。" -#: ../../library/multiprocessing.rst:607 +#: ../../library/multiprocessing.rst:624 msgid "" "A numeric handle of a system object which will become \"ready\" when the " "process ends." msgstr "" -#: ../../library/multiprocessing.rst:610 +#: ../../library/multiprocessing.rst:627 msgid "" "You can use this value if you want to wait on several events at once using :" "func:`multiprocessing.connection.wait`. Otherwise calling :meth:`join()` is " "simpler." msgstr "" -#: ../../library/multiprocessing.rst:614 +#: ../../library/multiprocessing.rst:631 msgid "" "On Windows, this is an OS handle usable with the ``WaitForSingleObject`` and " "``WaitForMultipleObjects`` family of API calls. On Unix, this is a file " "descriptor usable with primitives from the :mod:`select` module." msgstr "" -#: ../../library/multiprocessing.rst:622 +#: ../../library/multiprocessing.rst:639 msgid "" "Terminate the process. On Unix this is done using the ``SIGTERM`` signal; " "on Windows :c:func:`TerminateProcess` is used. Note that exit handlers and " "finally clauses, etc., will not be executed." msgstr "" -#: ../../library/multiprocessing.rst:626 +#: ../../library/multiprocessing.rst:643 msgid "" "Note that descendant processes of the process will *not* be terminated -- " "they will simply become orphaned." msgstr "" -#: ../../library/multiprocessing.rst:631 +#: ../../library/multiprocessing.rst:648 msgid "" "If this method is used when the associated process is using a pipe or queue " "then the pipe or queue is liable to become corrupted and may become unusable " @@ -633,11 +660,11 @@ msgid "" "deadlock." msgstr "" -#: ../../library/multiprocessing.rst:639 +#: ../../library/multiprocessing.rst:656 msgid "Same as :meth:`terminate()` but using the ``SIGKILL`` signal on Unix." msgstr "" -#: ../../library/multiprocessing.rst:645 +#: ../../library/multiprocessing.rst:662 msgid "" "Close the :class:`Process` object, releasing all resources associated with " "it. :exc:`ValueError` is raised if the underlying process is still " @@ -645,59 +672,59 @@ msgid "" "attributes of the :class:`Process` object will raise :exc:`ValueError`." msgstr "" -#: ../../library/multiprocessing.rst:653 +#: ../../library/multiprocessing.rst:670 msgid "" "Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`, :meth:" "`terminate` and :attr:`exitcode` methods should only be called by the " "process that created the process object." msgstr "" -#: ../../library/multiprocessing.rst:657 +#: ../../library/multiprocessing.rst:674 msgid "Example usage of some of the methods of :class:`Process`:" msgstr "" -#: ../../library/multiprocessing.rst:677 +#: ../../library/multiprocessing.rst:694 msgid "The base class of all :mod:`multiprocessing` exceptions." msgstr "" -#: ../../library/multiprocessing.rst:681 +#: ../../library/multiprocessing.rst:698 msgid "" "Exception raised by :meth:`Connection.recv_bytes_into()` when the supplied " "buffer object is too small for the message read." msgstr "" -#: ../../library/multiprocessing.rst:684 +#: ../../library/multiprocessing.rst:701 msgid "" "If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will " "give the message as a byte string." msgstr "" -#: ../../library/multiprocessing.rst:689 +#: ../../library/multiprocessing.rst:706 msgid "Raised when there is an authentication error." msgstr "" -#: ../../library/multiprocessing.rst:693 +#: ../../library/multiprocessing.rst:710 msgid "Raised by methods with a timeout when the timeout expires." msgstr "" -#: ../../library/multiprocessing.rst:696 +#: ../../library/multiprocessing.rst:713 msgid "Pipes and Queues" msgstr "" -#: ../../library/multiprocessing.rst:698 +#: ../../library/multiprocessing.rst:715 msgid "" "When using multiple processes, one generally uses message passing for " "communication between processes and avoids having to use any synchronization " "primitives like locks." msgstr "" -#: ../../library/multiprocessing.rst:702 +#: ../../library/multiprocessing.rst:719 msgid "" "For passing messages one can use :func:`Pipe` (for a connection between two " "processes) or a queue (which allows multiple producers and consumers)." msgstr "" -#: ../../library/multiprocessing.rst:705 +#: ../../library/multiprocessing.rst:722 msgid "" "The :class:`Queue`, :class:`SimpleQueue` and :class:`JoinableQueue` types " "are multi-producer, multi-consumer :abbr:`FIFO (first-in, first-out)` queues " @@ -707,7 +734,7 @@ msgid "" "Queue` class." msgstr "" -#: ../../library/multiprocessing.rst:712 +#: ../../library/multiprocessing.rst:729 msgid "" "If you use :class:`JoinableQueue` then you **must** call :meth:" "`JoinableQueue.task_done` for each task removed from the queue or else the " @@ -715,20 +742,20 @@ msgid "" "overflow, raising an exception." msgstr "" -#: ../../library/multiprocessing.rst:717 +#: ../../library/multiprocessing.rst:734 msgid "" "Note that one can also create a shared queue by using a manager object -- " "see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:722 +#: ../../library/multiprocessing.rst:739 msgid "" ":mod:`multiprocessing` uses the usual :exc:`queue.Empty` and :exc:`queue." "Full` exceptions to signal a timeout. They are not available in the :mod:" "`multiprocessing` namespace so you need to import them from :mod:`queue`." msgstr "" -#: ../../library/multiprocessing.rst:729 +#: ../../library/multiprocessing.rst:746 msgid "" "When an object is put on a queue, the object is pickled and a background " "thread later flushes the pickled data to an underlying pipe. This has some " @@ -737,14 +764,14 @@ msgid "" "a queue created with a :ref:`manager `." msgstr "" -#: ../../library/multiprocessing.rst:736 +#: ../../library/multiprocessing.rst:753 msgid "" "After putting an object on an empty queue there may be an infinitesimal " "delay before the queue's :meth:`~Queue.empty` method returns :const:`False` " "and :meth:`~Queue.get_nowait` can return without raising :exc:`queue.Empty`." msgstr "" -#: ../../library/multiprocessing.rst:741 +#: ../../library/multiprocessing.rst:758 msgid "" "If multiple processes are enqueuing objects, it is possible for the objects " "to be received at the other end out-of-order. However, objects enqueued by " @@ -752,7 +779,7 @@ msgid "" "other." msgstr "" -#: ../../library/multiprocessing.rst:748 +#: ../../library/multiprocessing.rst:765 msgid "" "If a process is killed using :meth:`Process.terminate` or :func:`os.kill` " "while it is trying to use a :class:`Queue`, then the data in the queue is " @@ -760,7 +787,7 @@ msgid "" "exception when it tries to use the queue later on." msgstr "" -#: ../../library/multiprocessing.rst:755 +#: ../../library/multiprocessing.rst:772 msgid "" "As mentioned above, if a child process has put items on a queue (and it has " "not used :meth:`JoinableQueue.cancel_join_thread ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1107 +#: ../../library/multiprocessing.rst:1127 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1110 +#: ../../library/multiprocessing.rst:1130 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1115 +#: ../../library/multiprocessing.rst:1135 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1122 +#: ../../library/multiprocessing.rst:1142 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1126 +#: ../../library/multiprocessing.rst:1146 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1128 +#: ../../library/multiprocessing.rst:1148 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1132 +#: ../../library/multiprocessing.rst:1152 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1134 +#: ../../library/multiprocessing.rst:1154 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1138 +#: ../../library/multiprocessing.rst:1158 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1143 +#: ../../library/multiprocessing.rst:1163 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1145 +#: ../../library/multiprocessing.rst:1165 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -1238,7 +1269,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1152 +#: ../../library/multiprocessing.rst:1172 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1246,19 +1277,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1157 +#: ../../library/multiprocessing.rst:1177 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1161 +#: ../../library/multiprocessing.rst:1181 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1168 +#: ../../library/multiprocessing.rst:1188 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1266,45 +1297,45 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1174 +#: ../../library/multiprocessing.rst:1194 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1179 +#: ../../library/multiprocessing.rst:1199 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1183 +#: ../../library/multiprocessing.rst:1203 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1187 +#: ../../library/multiprocessing.rst:1207 msgid "" "Connection objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1192 +#: ../../library/multiprocessing.rst:1212 msgid "For example:" msgstr "" -#: ../../library/multiprocessing.rst:1217 +#: ../../library/multiprocessing.rst:1237 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1221 +#: ../../library/multiprocessing.rst:1241 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1312,73 +1343,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1228 +#: ../../library/multiprocessing.rst:1248 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1234 +#: ../../library/multiprocessing.rst:1254 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1238 +#: ../../library/multiprocessing.rst:1258 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1242 +#: ../../library/multiprocessing.rst:1262 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1247 +#: ../../library/multiprocessing.rst:1267 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1253 +#: ../../library/multiprocessing.rst:1273 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1256 -#: ../../library/multiprocessing.rst:1394 +#: ../../library/multiprocessing.rst:1276 +#: ../../library/multiprocessing.rst:1414 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1260 +#: ../../library/multiprocessing.rst:1280 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1265 +#: ../../library/multiprocessing.rst:1285 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1267 +#: ../../library/multiprocessing.rst:1287 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1270 -#: ../../library/multiprocessing.rst:1805 +#: ../../library/multiprocessing.rst:1290 +#: ../../library/multiprocessing.rst:1839 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1275 +#: ../../library/multiprocessing.rst:1295 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1280 +#: ../../library/multiprocessing.rst:1300 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -1389,25 +1420,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1288 +#: ../../library/multiprocessing.rst:1308 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1292 +#: ../../library/multiprocessing.rst:1312 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1297 -#: ../../library/multiprocessing.rst:1348 +#: ../../library/multiprocessing.rst:1317 +#: ../../library/multiprocessing.rst:1368 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1299 +#: ../../library/multiprocessing.rst:1319 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -1415,14 +1446,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1304 +#: ../../library/multiprocessing.rst:1324 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1308 +#: ../../library/multiprocessing.rst:1328 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -1436,19 +1467,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1323 +#: ../../library/multiprocessing.rst:1343 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1326 +#: ../../library/multiprocessing.rst:1346 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1332 +#: ../../library/multiprocessing.rst:1352 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -1457,20 +1488,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1338 +#: ../../library/multiprocessing.rst:1358 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1342 +#: ../../library/multiprocessing.rst:1362 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1350 +#: ../../library/multiprocessing.rst:1370 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -1483,7 +1514,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1360 +#: ../../library/multiprocessing.rst:1380 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -1494,14 +1525,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1368 +#: ../../library/multiprocessing.rst:1388 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1375 +#: ../../library/multiprocessing.rst:1395 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -1511,7 +1542,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1383 +#: ../../library/multiprocessing.rst:1403 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -1520,17 +1551,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1392 +#: ../../library/multiprocessing.rst:1412 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1399 +#: ../../library/multiprocessing.rst:1419 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1404 +#: ../../library/multiprocessing.rst:1424 msgid "" "If the SIGINT signal generated by :kbd:`Ctrl-C` arrives while the main " "thread is blocked by a call to :meth:`BoundedSemaphore.acquire`, :meth:`Lock." @@ -1539,13 +1570,13 @@ msgid "" "interrupted and :exc:`KeyboardInterrupt` will be raised." msgstr "" -#: ../../library/multiprocessing.rst:1410 +#: ../../library/multiprocessing.rst:1430 msgid "" "This differs from the behaviour of :mod:`threading` where SIGINT will be " "ignored while the equivalent blocking calls are in progress." msgstr "" -#: ../../library/multiprocessing.rst:1415 +#: ../../library/multiprocessing.rst:1435 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -1554,32 +1585,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1423 +#: ../../library/multiprocessing.rst:1443 msgid "Shared :mod:`ctypes` Objects" msgstr "" -#: ../../library/multiprocessing.rst:1425 +#: ../../library/multiprocessing.rst:1445 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1430 +#: ../../library/multiprocessing.rst:1450 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1434 -#: ../../library/multiprocessing.rst:1521 +#: ../../library/multiprocessing.rst:1454 +#: ../../library/multiprocessing.rst:1541 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1438 +#: ../../library/multiprocessing.rst:1458 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -1589,32 +1620,32 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1445 +#: ../../library/multiprocessing.rst:1465 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1451 +#: ../../library/multiprocessing.rst:1471 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1457 -#: ../../library/multiprocessing.rst:1547 -#: ../../library/multiprocessing.rst:1562 +#: ../../library/multiprocessing.rst:1477 +#: ../../library/multiprocessing.rst:1567 +#: ../../library/multiprocessing.rst:1582 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1461 +#: ../../library/multiprocessing.rst:1481 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1464 +#: ../../library/multiprocessing.rst:1484 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1624,7 +1655,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1471 +#: ../../library/multiprocessing.rst:1491 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -1634,28 +1665,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1478 +#: ../../library/multiprocessing.rst:1498 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1480 +#: ../../library/multiprocessing.rst:1500 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1485 +#: ../../library/multiprocessing.rst:1505 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr "" -#: ../../library/multiprocessing.rst:1490 +#: ../../library/multiprocessing.rst:1510 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1496 +#: ../../library/multiprocessing.rst:1516 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -1664,11 +1695,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1504 +#: ../../library/multiprocessing.rst:1524 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1506 +#: ../../library/multiprocessing.rst:1526 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1678,40 +1709,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1513 +#: ../../library/multiprocessing.rst:1533 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1519 +#: ../../library/multiprocessing.rst:1539 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1525 +#: ../../library/multiprocessing.rst:1545 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1529 +#: ../../library/multiprocessing.rst:1549 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1535 +#: ../../library/multiprocessing.rst:1555 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1539 -#: ../../library/multiprocessing.rst:1555 +#: ../../library/multiprocessing.rst:1559 +#: ../../library/multiprocessing.rst:1575 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -1721,121 +1752,121 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1551 +#: ../../library/multiprocessing.rst:1571 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1566 +#: ../../library/multiprocessing.rst:1586 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1571 +#: ../../library/multiprocessing.rst:1591 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1575 +#: ../../library/multiprocessing.rst:1595 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1579 +#: ../../library/multiprocessing.rst:1599 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1582 +#: ../../library/multiprocessing.rst:1602 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1586 +#: ../../library/multiprocessing.rst:1606 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1591 +#: ../../library/multiprocessing.rst:1611 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1591 +#: ../../library/multiprocessing.rst:1611 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1591 +#: ../../library/multiprocessing.rst:1611 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1593 +#: ../../library/multiprocessing.rst:1613 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1593 +#: ../../library/multiprocessing.rst:1613 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1593 +#: ../../library/multiprocessing.rst:1613 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1594 +#: ../../library/multiprocessing.rst:1614 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1594 +#: ../../library/multiprocessing.rst:1614 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1595 +#: ../../library/multiprocessing.rst:1615 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1595 +#: ../../library/multiprocessing.rst:1615 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1595 +#: ../../library/multiprocessing.rst:1615 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1596 +#: ../../library/multiprocessing.rst:1616 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1596 +#: ../../library/multiprocessing.rst:1616 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1596 +#: ../../library/multiprocessing.rst:1616 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1600 +#: ../../library/multiprocessing.rst:1620 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1638 +#: ../../library/multiprocessing.rst:1658 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1671 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1653 +#: ../../library/multiprocessing.rst:1673 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -1844,7 +1875,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1662 +#: ../../library/multiprocessing.rst:1682 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -1852,31 +1883,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1670 +#: ../../library/multiprocessing.rst:1690 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1676 +#: ../../library/multiprocessing.rst:1696 msgid "Create a BaseManager object." msgstr "" -#: ../../library/multiprocessing.rst:1678 +#: ../../library/multiprocessing.rst:1698 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1681 +#: ../../library/multiprocessing.rst:1701 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1684 +#: ../../library/multiprocessing.rst:1704 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -1884,50 +1915,74 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1691 +#: ../../library/multiprocessing.rst:1709 +msgid "" +"*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " +"``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." +msgstr "" + +#: ../../library/multiprocessing.rst:1712 +msgid "" +"*ctx* is a context object, or ``None`` (use the current context). See the :" +"func:`get_context` function." +msgstr "" + +#: ../../library/multiprocessing.rst:1715 +msgid "" +"*shutdown_timeout* is a timeout in seconds used to wait until the process " +"used by the manager completes in the :meth:`shutdown` method. If the " +"shutdown times out, the process is terminated. If terminating the process " +"also times out, the process is killed." +msgstr "" + +#: ../../library/multiprocessing.rst:1720 +msgid "Added the *shutdown_timeout* parameter." +msgstr "新增 *shutdown_timeout* 參數。" + +#: ../../library/multiprocessing.rst:1725 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1696 +#: ../../library/multiprocessing.rst:1730 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1705 +#: ../../library/multiprocessing.rst:1739 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1709 +#: ../../library/multiprocessing.rst:1743 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1717 +#: ../../library/multiprocessing.rst:1751 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1720 +#: ../../library/multiprocessing.rst:1754 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1724 +#: ../../library/multiprocessing.rst:1758 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1727 +#: ../../library/multiprocessing.rst:1761 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1730 +#: ../../library/multiprocessing.rst:1764 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -1935,14 +1990,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1736 +#: ../../library/multiprocessing.rst:1770 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1740 +#: ../../library/multiprocessing.rst:1774 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -1953,7 +2008,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1749 +#: ../../library/multiprocessing.rst:1783 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -1963,22 +2018,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1756 +#: ../../library/multiprocessing.rst:1790 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1760 +#: ../../library/multiprocessing.rst:1794 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1764 +#: ../../library/multiprocessing.rst:1798 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1766 +#: ../../library/multiprocessing.rst:1800 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -1986,173 +2041,173 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1772 +#: ../../library/multiprocessing.rst:1806 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1777 +#: ../../library/multiprocessing.rst:1811 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1781 +#: ../../library/multiprocessing.rst:1815 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1787 +#: ../../library/multiprocessing.rst:1821 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1794 +#: ../../library/multiprocessing.rst:1828 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1799 +#: ../../library/multiprocessing.rst:1833 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1802 +#: ../../library/multiprocessing.rst:1836 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1810 +#: ../../library/multiprocessing.rst:1844 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1814 +#: ../../library/multiprocessing.rst:1848 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1818 +#: ../../library/multiprocessing.rst:1852 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1822 +#: ../../library/multiprocessing.rst:1856 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1826 +#: ../../library/multiprocessing.rst:1860 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1830 +#: ../../library/multiprocessing.rst:1864 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1835 +#: ../../library/multiprocessing.rst:1869 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1839 +#: ../../library/multiprocessing.rst:1873 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1846 +#: ../../library/multiprocessing.rst:1880 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1851 +#: ../../library/multiprocessing.rst:1885 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1853 +#: ../../library/multiprocessing.rst:1887 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1860 +#: ../../library/multiprocessing.rst:1894 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1862 +#: ../../library/multiprocessing.rst:1896 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1865 +#: ../../library/multiprocessing.rst:1899 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1881 +#: ../../library/multiprocessing.rst:1915 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:1883 +#: ../../library/multiprocessing.rst:1917 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1908 +#: ../../library/multiprocessing.rst:1942 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:1910 +#: ../../library/multiprocessing.rst:1944 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:1913 +#: ../../library/multiprocessing.rst:1947 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:1925 +#: ../../library/multiprocessing.rst:1959 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:1935 +#: ../../library/multiprocessing.rst:1969 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:1946 +#: ../../library/multiprocessing.rst:1980 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:1971 +#: ../../library/multiprocessing.rst:2005 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:1973 +#: ../../library/multiprocessing.rst:2007 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:1977 +#: ../../library/multiprocessing.rst:2011 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -2160,14 +2215,14 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:1995 +#: ../../library/multiprocessing.rst:2029 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:1999 +#: ../../library/multiprocessing.rst:2033 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -2175,11 +2230,11 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2015 +#: ../../library/multiprocessing.rst:2049 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2028 +#: ../../library/multiprocessing.rst:2062 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -2190,53 +2245,53 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2047 +#: ../../library/multiprocessing.rst:2081 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2053 +#: ../../library/multiprocessing.rst:2087 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2061 +#: ../../library/multiprocessing.rst:2095 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2065 +#: ../../library/multiprocessing.rst:2099 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2069 +#: ../../library/multiprocessing.rst:2103 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2071 +#: ../../library/multiprocessing.rst:2105 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2075 +#: ../../library/multiprocessing.rst:2109 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2079 +#: ../../library/multiprocessing.rst:2113 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2081 +#: ../../library/multiprocessing.rst:2115 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2085 +#: ../../library/multiprocessing.rst:2119 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -2244,79 +2299,79 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2090 +#: ../../library/multiprocessing.rst:2124 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2093 +#: ../../library/multiprocessing.rst:2127 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2109 +#: ../../library/multiprocessing.rst:2143 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2111 +#: ../../library/multiprocessing.rst:2145 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2115 +#: ../../library/multiprocessing.rst:2149 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2119 +#: ../../library/multiprocessing.rst:2153 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2123 +#: ../../library/multiprocessing.rst:2157 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2125 +#: ../../library/multiprocessing.rst:2159 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2128 +#: ../../library/multiprocessing.rst:2162 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2133 +#: ../../library/multiprocessing.rst:2167 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2138 +#: ../../library/multiprocessing.rst:2172 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2143 +#: ../../library/multiprocessing.rst:2177 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2147 +#: ../../library/multiprocessing.rst:2181 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2150 -#: ../../library/multiprocessing.rst:2711 +#: ../../library/multiprocessing.rst:2184 +#: ../../library/multiprocessing.rst:2745 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2153 +#: ../../library/multiprocessing.rst:2187 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -2324,7 +2379,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2158 +#: ../../library/multiprocessing.rst:2192 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -2332,13 +2387,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2164 +#: ../../library/multiprocessing.rst:2198 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2168 +#: ../../library/multiprocessing.rst:2202 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -2346,22 +2401,22 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2173 +#: ../../library/multiprocessing.rst:2207 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2177 +#: ../../library/multiprocessing.rst:2211 msgid "*maxtasksperchild*" msgstr "" -#: ../../library/multiprocessing.rst:2180 +#: ../../library/multiprocessing.rst:2214 msgid "*context*" msgstr "" -#: ../../library/multiprocessing.rst:2185 +#: ../../library/multiprocessing.rst:2219 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -2372,7 +2427,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2195 +#: ../../library/multiprocessing.rst:2229 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -2380,14 +2435,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2202 +#: ../../library/multiprocessing.rst:2236 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2205 -#: ../../library/multiprocessing.rst:2236 +#: ../../library/multiprocessing.rst:2239 +#: ../../library/multiprocessing.rst:2270 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -2395,60 +2450,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2210 -#: ../../library/multiprocessing.rst:2241 +#: ../../library/multiprocessing.rst:2244 +#: ../../library/multiprocessing.rst:2275 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2214 -#: ../../library/multiprocessing.rst:2245 +#: ../../library/multiprocessing.rst:2248 +#: ../../library/multiprocessing.rst:2279 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2219 +#: ../../library/multiprocessing.rst:2253 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2223 +#: ../../library/multiprocessing.rst:2257 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2227 +#: ../../library/multiprocessing.rst:2261 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2233 +#: ../../library/multiprocessing.rst:2267 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2250 +#: ../../library/multiprocessing.rst:2284 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2252 +#: ../../library/multiprocessing.rst:2286 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2257 +#: ../../library/multiprocessing.rst:2291 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -2456,65 +2511,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2264 +#: ../../library/multiprocessing.rst:2298 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2270 +#: ../../library/multiprocessing.rst:2304 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2274 +#: ../../library/multiprocessing.rst:2308 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2281 +#: ../../library/multiprocessing.rst:2315 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2289 +#: ../../library/multiprocessing.rst:2323 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2294 +#: ../../library/multiprocessing.rst:2328 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2300 +#: ../../library/multiprocessing.rst:2334 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2303 +#: ../../library/multiprocessing.rst:2337 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2311 +#: ../../library/multiprocessing.rst:2345 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2316 +#: ../../library/multiprocessing.rst:2350 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -2522,41 +2577,41 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2323 +#: ../../library/multiprocessing.rst:2357 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2327 +#: ../../library/multiprocessing.rst:2361 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2331 +#: ../../library/multiprocessing.rst:2365 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2334 +#: ../../library/multiprocessing.rst:2368 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2338 +#: ../../library/multiprocessing.rst:2372 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2365 +#: ../../library/multiprocessing.rst:2399 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2370 +#: ../../library/multiprocessing.rst:2404 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2374 +#: ../../library/multiprocessing.rst:2408 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -2565,46 +2620,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2383 +#: ../../library/multiprocessing.rst:2417 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2386 +#: ../../library/multiprocessing.rst:2420 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2392 +#: ../../library/multiprocessing.rst:2426 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2395 +#: ../../library/multiprocessing.rst:2429 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2400 +#: ../../library/multiprocessing.rst:2434 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2403 +#: ../../library/multiprocessing.rst:2437 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2407 -#: ../../library/multiprocessing.rst:2442 +#: ../../library/multiprocessing.rst:2441 +#: ../../library/multiprocessing.rst:2476 msgid "" "If *authkey* is given and not None, it should be a byte string and will be " "used as the secret key for an HMAC-based authentication challenge. No " @@ -2613,26 +2668,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2415 +#: ../../library/multiprocessing.rst:2449 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2418 +#: ../../library/multiprocessing.rst:2452 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2423 +#: ../../library/multiprocessing.rst:2457 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2427 +#: ../../library/multiprocessing.rst:2461 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -2646,49 +2701,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2438 +#: ../../library/multiprocessing.rst:2472 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2450 +#: ../../library/multiprocessing.rst:2484 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2457 +#: ../../library/multiprocessing.rst:2491 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2461 +#: ../../library/multiprocessing.rst:2495 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2465 +#: ../../library/multiprocessing.rst:2499 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2469 +#: ../../library/multiprocessing.rst:2503 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2472 +#: ../../library/multiprocessing.rst:2506 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2479 +#: ../../library/multiprocessing.rst:2513 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -2697,32 +2752,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2485 +#: ../../library/multiprocessing.rst:2519 msgid "" "For both Unix and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2488 +#: ../../library/multiprocessing.rst:2522 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2489 +#: ../../library/multiprocessing.rst:2523 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2490 +#: ../../library/multiprocessing.rst:2524 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2493 +#: ../../library/multiprocessing.rst:2527 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2496 +#: ../../library/multiprocessing.rst:2530 msgid "" "**Unix**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -2730,7 +2785,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2502 +#: ../../library/multiprocessing.rst:2536 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -2739,46 +2794,46 @@ msgid "" "that pipe handles and socket handles are **not** waitable handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2512 +#: ../../library/multiprocessing.rst:2546 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2514 +#: ../../library/multiprocessing.rst:2548 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2533 +#: ../../library/multiprocessing.rst:2567 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2550 +#: ../../library/multiprocessing.rst:2584 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2589 +#: ../../library/multiprocessing.rst:2623 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2591 +#: ../../library/multiprocessing.rst:2625 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2594 +#: ../../library/multiprocessing.rst:2628 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2597 +#: ../../library/multiprocessing.rst:2631 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -2787,17 +2842,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2602 +#: ../../library/multiprocessing.rst:2636 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2609 +#: ../../library/multiprocessing.rst:2643 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2611 +#: ../../library/multiprocessing.rst:2645 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -2805,7 +2860,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2617 +#: ../../library/multiprocessing.rst:2651 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -2813,7 +2868,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2623 +#: ../../library/multiprocessing.rst:2657 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -2824,17 +2879,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2631 +#: ../../library/multiprocessing.rst:2665 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2635 +#: ../../library/multiprocessing.rst:2669 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2637 +#: ../../library/multiprocessing.rst:2671 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -2842,27 +2897,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2644 +#: ../../library/multiprocessing.rst:2678 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2647 +#: ../../library/multiprocessing.rst:2681 msgid "" "When first created the logger has level :data:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2651 +#: ../../library/multiprocessing.rst:2685 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2658 +#: ../../library/multiprocessing.rst:2692 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -2871,25 +2926,25 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2664 +#: ../../library/multiprocessing.rst:2698 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2679 +#: ../../library/multiprocessing.rst:2713 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2683 +#: ../../library/multiprocessing.rst:2717 msgid "The :mod:`multiprocessing.dummy` module" msgstr "" -#: ../../library/multiprocessing.rst:2688 +#: ../../library/multiprocessing.rst:2722 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2693 +#: ../../library/multiprocessing.rst:2727 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -2897,7 +2952,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2701 +#: ../../library/multiprocessing.rst:2735 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -2907,18 +2962,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2708 +#: ../../library/multiprocessing.rst:2742 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2714 +#: ../../library/multiprocessing.rst:2748 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2718 +#: ../../library/multiprocessing.rst:2752 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -2928,7 +2983,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2725 +#: ../../library/multiprocessing.rst:2759 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -2937,69 +2992,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2735 +#: ../../library/multiprocessing.rst:2769 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2737 +#: ../../library/multiprocessing.rst:2771 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2742 +#: ../../library/multiprocessing.rst:2776 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2744 +#: ../../library/multiprocessing.rst:2778 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2746 +#: ../../library/multiprocessing.rst:2780 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2748 +#: ../../library/multiprocessing.rst:2782 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2751 +#: ../../library/multiprocessing.rst:2785 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2755 +#: ../../library/multiprocessing.rst:2789 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2757 +#: ../../library/multiprocessing.rst:2791 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2759 +#: ../../library/multiprocessing.rst:2793 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2761 +#: ../../library/multiprocessing.rst:2795 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2764 +#: ../../library/multiprocessing.rst:2798 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2766 +#: ../../library/multiprocessing.rst:2800 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2768 +#: ../../library/multiprocessing.rst:2802 msgid "" "On Unix when a process finishes but has not been joined it becomes a zombie. " "There should never be very many because each time a new process starts (or :" @@ -3010,11 +3065,11 @@ msgid "" "all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2776 +#: ../../library/multiprocessing.rst:2810 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2778 +#: ../../library/multiprocessing.rst:2812 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -3024,11 +3079,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2786 +#: ../../library/multiprocessing.rst:2820 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2788 +#: ../../library/multiprocessing.rst:2822 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -3036,18 +3091,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2794 +#: ../../library/multiprocessing.rst:2828 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2798 +#: ../../library/multiprocessing.rst:2832 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2800 +#: ../../library/multiprocessing.rst:2834 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -3056,7 +3111,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2806 +#: ../../library/multiprocessing.rst:2840 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -3065,21 +3120,21 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2812 +#: ../../library/multiprocessing.rst:2846 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2826 +#: ../../library/multiprocessing.rst:2860 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2829 +#: ../../library/multiprocessing.rst:2863 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2831 +#: ../../library/multiprocessing.rst:2865 msgid "" "On Unix using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -3087,7 +3142,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2836 +#: ../../library/multiprocessing.rst:2870 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -3096,29 +3151,29 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2843 +#: ../../library/multiprocessing.rst:2877 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2855 +#: ../../library/multiprocessing.rst:2889 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2867 +#: ../../library/multiprocessing.rst:2901 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2869 +#: ../../library/multiprocessing.rst:2903 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2873 +#: ../../library/multiprocessing.rst:2907 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:2879 +#: ../../library/multiprocessing.rst:2913 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -3128,33 +3183,33 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:2886 +#: ../../library/multiprocessing.rst:2920 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2898 +#: ../../library/multiprocessing.rst:2932 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:2901 +#: ../../library/multiprocessing.rst:2935 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:2903 +#: ../../library/multiprocessing.rst:2937 msgid "" "There are a few extra restriction which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:2906 +#: ../../library/multiprocessing.rst:2940 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:2908 +#: ../../library/multiprocessing.rst:2942 msgid "" "Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " "if you subclass :class:`~multiprocessing.Process` then make sure that " @@ -3162,11 +3217,11 @@ msgid "" "Process.start>` method is called." msgstr "" -#: ../../library/multiprocessing.rst:2913 +#: ../../library/multiprocessing.rst:2947 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:2915 +#: ../../library/multiprocessing.rst:2949 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -3174,66 +3229,66 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:2920 +#: ../../library/multiprocessing.rst:2954 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:2923 +#: ../../library/multiprocessing.rst:2957 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:2925 +#: ../../library/multiprocessing.rst:2959 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such a starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:2929 +#: ../../library/multiprocessing.rst:2963 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:2941 +#: ../../library/multiprocessing.rst:2975 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2955 +#: ../../library/multiprocessing.rst:2989 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:2958 +#: ../../library/multiprocessing.rst:2992 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:2961 +#: ../../library/multiprocessing.rst:2995 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:2968 +#: ../../library/multiprocessing.rst:3002 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:2970 +#: ../../library/multiprocessing.rst:3004 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:2976 +#: ../../library/multiprocessing.rst:3010 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "" -#: ../../library/multiprocessing.rst:2982 +#: ../../library/multiprocessing.rst:3016 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" diff --git a/library/netrc.po b/library/netrc.po index cfcb2b6046..ea3d70be8f 100644 --- a/library/netrc.po +++ b/library/netrc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,10 +61,15 @@ msgstr "" #: ../../library/netrc.rst:41 msgid "" -":class:`netrc` try UTF-8 encoding before using locale specific encoding." +":class:`netrc` try UTF-8 encoding before using locale specific encoding. The " +"entry in the netrc file no longer needs to contain all tokens. The missing " +"tokens' value default to an empty string. All the tokens and their values " +"now can contain arbitrary characters, like whitespace and non-ASCII " +"characters. If the login name is anonymous, it won't trigger the security " +"check." msgstr "" -#: ../../library/netrc.rst:48 +#: ../../library/netrc.rst:52 msgid "" "Exception raised by the :class:`~netrc.netrc` class when syntactical errors " "are encountered in source text. Instances of this exception provide three " @@ -73,15 +78,15 @@ msgid "" "line number on which the error was found." msgstr "" -#: ../../library/netrc.rst:58 +#: ../../library/netrc.rst:62 msgid "netrc Objects" msgstr "netrc 物件" -#: ../../library/netrc.rst:60 +#: ../../library/netrc.rst:64 msgid "A :class:`~netrc.netrc` instance has the following methods:" msgstr "" -#: ../../library/netrc.rst:65 +#: ../../library/netrc.rst:69 msgid "" "Return a 3-tuple ``(login, account, password)`` of authenticators for " "*host*. If the netrc file did not contain an entry for the given host, " @@ -89,30 +94,22 @@ msgid "" "host nor default entry is available, return ``None``." msgstr "" -#: ../../library/netrc.rst:73 +#: ../../library/netrc.rst:77 msgid "" "Dump the class data as a string in the format of a netrc file. (This " "discards comments and may reorder the entries.)" msgstr "" -#: ../../library/netrc.rst:76 +#: ../../library/netrc.rst:80 msgid "Instances of :class:`~netrc.netrc` have public instance variables:" msgstr "" -#: ../../library/netrc.rst:81 +#: ../../library/netrc.rst:85 msgid "" "Dictionary mapping host names to ``(login, account, password)`` tuples. The " "'default' entry, if any, is represented as a pseudo-host by that name." msgstr "" -#: ../../library/netrc.rst:87 -msgid "Dictionary mapping macro names to string lists." -msgstr "" - #: ../../library/netrc.rst:91 -msgid "" -"Passwords are limited to a subset of the ASCII character set. All ASCII " -"punctuation is allowed in passwords, however, note that whitespace and non-" -"printable characters are not allowed in passwords. This is a limitation of " -"the way the .netrc file is parsed and may be removed in the future." +msgid "Dictionary mapping macro names to string lists." msgstr "" diff --git a/library/nis.po b/library/nis.po index 9168a426be..133bbe4cf6 100644 --- a/library/nis.po +++ b/library/nis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,7 @@ msgstr "" msgid ":mod:`nis` --- Interface to Sun's NIS (Yellow Pages)" msgstr ":mod:`nis` --- Sun NIS (Yellow Pages) 介面" -#: ../../library/nis.rst:13 +#: ../../library/nis.rst:16 msgid "" "The :mod:`nis` module is deprecated (see :pep:`PEP 594 <594#nis>` for " "details)." @@ -41,11 +41,22 @@ msgid "" "Unix." msgstr "" -#: ../../library/nis.rst:24 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/nis.rst:26 msgid "The :mod:`nis` module defines the following functions:" msgstr "" -#: ../../library/nis.rst:29 +#: ../../library/nis.rst:31 msgid "" "Return the match for *key* in map *mapname*, or raise an error (:exc:`nis." "error`) if there is none. Both should be strings, *key* is 8-bit clean. " @@ -53,35 +64,35 @@ msgid "" "joys)." msgstr "" -#: ../../library/nis.rst:34 ../../library/nis.rst:46 +#: ../../library/nis.rst:36 ../../library/nis.rst:48 msgid "Note that *mapname* is first checked if it is an alias to another name." msgstr "" -#: ../../library/nis.rst:36 ../../library/nis.rst:48 ../../library/nis.rst:56 +#: ../../library/nis.rst:38 ../../library/nis.rst:50 ../../library/nis.rst:58 msgid "" "The *domain* argument allows overriding the NIS domain used for the lookup. " "If unspecified, lookup is in the default NIS domain." msgstr "" -#: ../../library/nis.rst:42 +#: ../../library/nis.rst:44 msgid "" "Return a dictionary mapping *key* to *value* such that ``match(key, " "mapname)==value``. Note that both keys and values of the dictionary are " "arbitrary arrays of bytes." msgstr "" -#: ../../library/nis.rst:54 +#: ../../library/nis.rst:56 msgid "Return a list of all valid maps." msgstr "" -#: ../../library/nis.rst:62 +#: ../../library/nis.rst:64 msgid "Return the system default NIS domain." msgstr "" -#: ../../library/nis.rst:65 +#: ../../library/nis.rst:67 msgid "The :mod:`nis` module defines the following exception:" msgstr "" -#: ../../library/nis.rst:69 +#: ../../library/nis.rst:71 msgid "An error raised when a NIS function returns an error code." msgstr "" diff --git a/library/nntplib.po b/library/nntplib.po index 772c31f000..a9b475e268 100644 --- a/library/nntplib.po +++ b/library/nntplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,23 +38,34 @@ msgid "" "`3977` as well as the older :rfc:`977` and :rfc:`2980`." msgstr "" -#: ../../library/nntplib.rst:24 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/nntplib.rst:26 msgid "" "Here are two small examples of how it can be used. To list some statistics " "about a newsgroup and print the subjects of the last 10 articles::" msgstr "" -#: ../../library/nntplib.rst:48 +#: ../../library/nntplib.rst:50 msgid "" "To post an article from a binary file (this assumes that the article has " "valid headers, and that you have right to post on the particular newsgroup)::" msgstr "" -#: ../../library/nntplib.rst:58 +#: ../../library/nntplib.rst:60 msgid "The module itself defines the following classes:" msgstr "" -#: ../../library/nntplib.rst:63 +#: ../../library/nntplib.rst:65 msgid "" "Return a new :class:`NNTP` object, representing a connection to the NNTP " "server running on host *host*, listening at port *port*. An optional " @@ -72,40 +83,40 @@ msgid "" "close the NNTP connection when done, e.g.:" msgstr "" -#: ../../library/nntplib.rst:86 ../../library/nntplib.rst:118 +#: ../../library/nntplib.rst:99 ../../library/nntplib.rst:131 msgid "" "Raises an :ref:`auditing event ` ``nntplib.connect`` with " "arguments ``self``, ``host``, ``port``." msgstr "" -#: ../../library/nntplib.rst:88 ../../library/nntplib.rst:120 +#: ../../library/nntplib.rst:101 ../../library/nntplib.rst:133 msgid "" "Raises an :ref:`auditing event ` ``nntplib.putline`` with " "arguments ``self``, ``line``." msgstr "" -#: ../../library/nntplib.rst:90 ../../library/nntplib.rst:122 +#: ../../library/nntplib.rst:92 ../../library/nntplib.rst:124 msgid "" "All commands will raise an :ref:`auditing event ` ``nntplib." "putline`` with arguments ``self`` and ``line``, where ``line`` is the bytes " "about to be sent to the remote host." msgstr "" -#: ../../library/nntplib.rst:94 +#: ../../library/nntplib.rst:96 msgid "*usenetrc* is now ``False`` by default." msgstr "" -#: ../../library/nntplib.rst:97 +#: ../../library/nntplib.rst:99 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/nntplib.rst:100 ../../library/nntplib.rst:133 +#: ../../library/nntplib.rst:102 ../../library/nntplib.rst:135 msgid "" "If the *timeout* parameter is set to be zero, it will raise a :class:" "`ValueError` to prevent the creation of a non-blocking socket." msgstr "" -#: ../../library/nntplib.rst:106 +#: ../../library/nntplib.rst:108 msgid "" "Return a new :class:`NNTP_SSL` object, representing an encrypted connection " "to the NNTP server running on host *host*, listening at port *port*. :class:" @@ -116,85 +127,85 @@ msgid "" "`NNTP`." msgstr "" -#: ../../library/nntplib.rst:114 +#: ../../library/nntplib.rst:116 msgid "" "Note that SSL-on-563 is discouraged per :rfc:`4642`, in favor of STARTTLS as " "described below. However, some servers only support the former." msgstr "" -#: ../../library/nntplib.rst:128 +#: ../../library/nntplib.rst:130 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/nntplib.rst:139 +#: ../../library/nntplib.rst:141 msgid "" "Derived from the standard exception :exc:`Exception`, this is the base class " "for all exceptions raised by the :mod:`nntplib` module. Instances of this " "class have the following attribute:" msgstr "" -#: ../../library/nntplib.rst:145 +#: ../../library/nntplib.rst:147 msgid "The response of the server if available, as a :class:`str` object." msgstr "" -#: ../../library/nntplib.rst:150 +#: ../../library/nntplib.rst:152 msgid "Exception raised when an unexpected reply is received from the server." msgstr "" -#: ../../library/nntplib.rst:155 +#: ../../library/nntplib.rst:157 msgid "" "Exception raised when a response code in the range 400--499 is received." msgstr "" -#: ../../library/nntplib.rst:160 +#: ../../library/nntplib.rst:162 msgid "" "Exception raised when a response code in the range 500--599 is received." msgstr "" -#: ../../library/nntplib.rst:165 +#: ../../library/nntplib.rst:167 msgid "" "Exception raised when a reply is received from the server that does not " "begin with a digit in the range 1--5." msgstr "" -#: ../../library/nntplib.rst:171 +#: ../../library/nntplib.rst:173 msgid "Exception raised when there is some error in the response data." msgstr "" -#: ../../library/nntplib.rst:177 +#: ../../library/nntplib.rst:179 msgid "NNTP Objects" msgstr "NNTP 物件" -#: ../../library/nntplib.rst:179 +#: ../../library/nntplib.rst:181 msgid "" "When connected, :class:`NNTP` and :class:`NNTP_SSL` objects support the " "following methods and attributes." msgstr "" -#: ../../library/nntplib.rst:183 +#: ../../library/nntplib.rst:185 msgid "Attributes" msgstr "屬性" -#: ../../library/nntplib.rst:187 +#: ../../library/nntplib.rst:189 msgid "" "An integer representing the version of the NNTP protocol supported by the " "server. In practice, this should be ``2`` for servers advertising :rfc:" "`3977` compliance and ``1`` for others." msgstr "" -#: ../../library/nntplib.rst:195 +#: ../../library/nntplib.rst:197 msgid "" "A string describing the software name and version of the NNTP server, or :" "const:`None` if not advertised by the server." msgstr "" -#: ../../library/nntplib.rst:201 +#: ../../library/nntplib.rst:203 msgid "Methods" msgstr "" -#: ../../library/nntplib.rst:203 +#: ../../library/nntplib.rst:205 msgid "" "The *response* that is returned as the first item in the return tuple of " "almost all methods is the server's response: a string beginning with a three-" @@ -202,7 +213,7 @@ msgid "" "one of the above exceptions." msgstr "" -#: ../../library/nntplib.rst:208 +#: ../../library/nntplib.rst:210 msgid "" "Many of the following methods take an optional keyword-only argument *file*. " "When the *file* argument is supplied, it must be either a :term:`file " @@ -212,26 +223,26 @@ msgid "" "of lines, tuples or objects that the method normally returns will be empty." msgstr "" -#: ../../library/nntplib.rst:215 +#: ../../library/nntplib.rst:217 msgid "" "Many of the following methods have been reworked and fixed, which makes them " "incompatible with their 3.1 counterparts." msgstr "" -#: ../../library/nntplib.rst:222 +#: ../../library/nntplib.rst:224 msgid "" "Send a ``QUIT`` command and close the connection. Once this method has been " "called, no other methods of the NNTP object should be called." msgstr "" -#: ../../library/nntplib.rst:228 +#: ../../library/nntplib.rst:230 msgid "" "Return the welcome message sent by the server in reply to the initial " "connection. (This message sometimes contains disclaimers or help " "information that may be relevant to the user.)" msgstr "" -#: ../../library/nntplib.rst:235 +#: ../../library/nntplib.rst:237 msgid "" "Return the :rfc:`3977` capabilities advertised by the server, as a :class:" "`dict` instance mapping capability names to (possibly empty) lists of " @@ -239,14 +250,14 @@ msgid "" "command, an empty dictionary is returned instead." msgstr "" -#: ../../library/nntplib.rst:249 +#: ../../library/nntplib.rst:251 msgid "" "Send ``AUTHINFO`` commands with the user name and password. If *user* and " "*password* are ``None`` and *usenetrc* is true, credentials from ``~/." "netrc`` will be used if possible." msgstr "" -#: ../../library/nntplib.rst:253 +#: ../../library/nntplib.rst:255 msgid "" "Unless intentionally delayed, login is normally performed during the :class:" "`NNTP` object initialization and separately calling this function is " @@ -254,14 +265,14 @@ msgid "" "or *password* when creating the object, and must set *usenetrc* to False." msgstr "" -#: ../../library/nntplib.rst:264 +#: ../../library/nntplib.rst:266 msgid "" "Send a ``STARTTLS`` command. This will enable encryption on the NNTP " "connection. The *context* argument is optional and should be a :class:`ssl." "SSLContext` object. Please read :ref:`ssl-security` for best practices." msgstr "" -#: ../../library/nntplib.rst:269 +#: ../../library/nntplib.rst:271 msgid "" "Note that this may not be done after authentication information has been " "transmitted, and authentication occurs by default if possible during a :" @@ -269,13 +280,13 @@ msgid "" "on suppressing this behavior." msgstr "" -#: ../../library/nntplib.rst:276 +#: ../../library/nntplib.rst:278 msgid "" "The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/nntplib.rst:283 +#: ../../library/nntplib.rst:285 msgid "" "Send a ``NEWGROUPS`` command. The *date* argument should be a :class:" "`datetime.date` or :class:`datetime.datetime` object. Return a pair " @@ -284,18 +295,18 @@ msgid "" "will be empty." msgstr "" -#: ../../library/nntplib.rst:299 +#: ../../library/nntplib.rst:301 msgid "" "Send a ``NEWNEWS`` command. Here, *group* is a group name or ``'*'``, and " "*date* has the same meaning as for :meth:`newgroups`. Return a pair " "``(response, articles)`` where *articles* is a list of message ids." msgstr "" -#: ../../library/nntplib.rst:303 +#: ../../library/nntplib.rst:305 msgid "This command is frequently disabled by NNTP server administrators." msgstr "" -#: ../../library/nntplib.rst:308 +#: ../../library/nntplib.rst:310 msgid "" "Send a ``LIST`` or ``LIST ACTIVE`` command. Return a pair ``(response, " "list)`` where *list* is a list of tuples representing all the groups " @@ -305,48 +316,48 @@ msgid "" "article numbers, and *flag* usually takes one of these values:" msgstr "" -#: ../../library/nntplib.rst:316 +#: ../../library/nntplib.rst:318 msgid "``y``: Local postings and articles from peers are allowed." msgstr "" -#: ../../library/nntplib.rst:317 +#: ../../library/nntplib.rst:319 msgid "``m``: The group is moderated and all postings must be approved." msgstr "" -#: ../../library/nntplib.rst:318 +#: ../../library/nntplib.rst:320 msgid "``n``: No local postings are allowed, only articles from peers." msgstr "" -#: ../../library/nntplib.rst:319 +#: ../../library/nntplib.rst:321 msgid "``j``: Articles from peers are filed in the junk group instead." msgstr "" -#: ../../library/nntplib.rst:320 +#: ../../library/nntplib.rst:322 msgid "``x``: No local postings, and articles from peers are ignored." msgstr "" -#: ../../library/nntplib.rst:321 +#: ../../library/nntplib.rst:323 msgid "``=foo.bar``: Articles are filed in the ``foo.bar`` group instead." msgstr "" -#: ../../library/nntplib.rst:323 +#: ../../library/nntplib.rst:325 msgid "" "If *flag* has another value, then the status of the newsgroup should be " "considered unknown." msgstr "" -#: ../../library/nntplib.rst:326 +#: ../../library/nntplib.rst:328 msgid "" "This command can return very large results, especially if *group_pattern* is " "not specified. It is best to cache the results offline unless you really " "need to refresh them." msgstr "" -#: ../../library/nntplib.rst:330 +#: ../../library/nntplib.rst:332 msgid "*group_pattern* was added." msgstr "新增 *group_pattern*\\ 。" -#: ../../library/nntplib.rst:336 +#: ../../library/nntplib.rst:338 msgid "" "Send a ``LIST NEWSGROUPS`` command, where *grouppattern* is a wildmat string " "as specified in :rfc:`3977` (it's essentially the same as DOS or UNIX shell " @@ -354,20 +365,20 @@ msgid "" "*descriptions* is a dictionary mapping group names to textual descriptions." msgstr "" -#: ../../library/nntplib.rst:350 +#: ../../library/nntplib.rst:352 msgid "" "Get a description for a single group *group*. If more than one group " "matches (if 'group' is a real wildmat string), return the first match. If " "no group matches, return an empty string." msgstr "" -#: ../../library/nntplib.rst:354 +#: ../../library/nntplib.rst:356 msgid "" "This elides the response code from the server. If the response code is " "needed, use :meth:`descriptions`." msgstr "" -#: ../../library/nntplib.rst:360 +#: ../../library/nntplib.rst:362 msgid "" "Send a ``GROUP`` command, where *name* is the group name. The group is " "selected as the current group, if it exists. Return a tuple ``(response, " @@ -376,7 +387,7 @@ msgid "" "*last* is the last article number in the group, and *name* is the group name." msgstr "" -#: ../../library/nntplib.rst:370 +#: ../../library/nntplib.rst:372 msgid "" "Send an ``OVER`` command, or an ``XOVER`` command on legacy servers. " "*message_spec* can be either a string representing a message id, or a " @@ -386,7 +397,7 @@ msgid "" "`None` to select the current article in the current group." msgstr "" -#: ../../library/nntplib.rst:377 +#: ../../library/nntplib.rst:379 msgid "" "Return a pair ``(response, overviews)``. *overviews* is a list of " "``(article_number, overview)`` tuples, one for each article selected by " @@ -397,40 +408,40 @@ msgid "" "following items are guaranteed to be present by the NNTP specification:" msgstr "" -#: ../../library/nntplib.rst:385 +#: ../../library/nntplib.rst:387 msgid "" "the ``subject``, ``from``, ``date``, ``message-id`` and ``references`` " "headers" msgstr "" -#: ../../library/nntplib.rst:387 +#: ../../library/nntplib.rst:389 msgid "" "the ``:bytes`` metadata: the number of bytes in the entire raw article " "(including headers and body)" msgstr "" -#: ../../library/nntplib.rst:389 +#: ../../library/nntplib.rst:391 msgid "the ``:lines`` metadata: the number of lines in the article body" msgstr "" -#: ../../library/nntplib.rst:391 +#: ../../library/nntplib.rst:393 msgid "" "The value of each item is either a string, or :const:`None` if not present." msgstr "" -#: ../../library/nntplib.rst:393 +#: ../../library/nntplib.rst:395 msgid "" "It is advisable to use the :func:`decode_header` function on header values " "when they may contain non-ASCII characters::" msgstr "" -#: ../../library/nntplib.rst:413 +#: ../../library/nntplib.rst:415 msgid "" "Send a ``HELP`` command. Return a pair ``(response, list)`` where *list* is " "a list of help strings." msgstr "" -#: ../../library/nntplib.rst:419 +#: ../../library/nntplib.rst:421 msgid "" "Send a ``STAT`` command, where *message_spec* is either a message id " "(enclosed in ``'<'`` and ``'>'``) or an article number in the current group. " @@ -439,15 +450,15 @@ msgid "" "where *number* is the article number and *id* is the message id." msgstr "" -#: ../../library/nntplib.rst:433 +#: ../../library/nntplib.rst:435 msgid "Send a ``NEXT`` command. Return as for :meth:`.stat`." msgstr "" -#: ../../library/nntplib.rst:438 +#: ../../library/nntplib.rst:440 msgid "Send a ``LAST`` command. Return as for :meth:`.stat`." msgstr "" -#: ../../library/nntplib.rst:443 +#: ../../library/nntplib.rst:445 msgid "" "Send an ``ARTICLE`` command, where *message_spec* has the same meaning as " "for :meth:`.stat`. Return a tuple ``(response, info)`` where *info* is a :" @@ -458,21 +469,21 @@ msgid "" "comprising the raw message including headers and body." msgstr "" -#: ../../library/nntplib.rst:468 +#: ../../library/nntplib.rst:470 msgid "" "Same as :meth:`article()`, but sends a ``HEAD`` command. The *lines* " "returned (or written to *file*) will only contain the message headers, not " "the body." msgstr "" -#: ../../library/nntplib.rst:475 +#: ../../library/nntplib.rst:477 msgid "" "Same as :meth:`article()`, but sends a ``BODY`` command. The *lines* " "returned (or written to *file*) will only contain the message body, not the " "headers." msgstr "" -#: ../../library/nntplib.rst:482 +#: ../../library/nntplib.rst:484 msgid "" "Post an article using the ``POST`` command. The *data* argument is either " "a :term:`file object` opened for binary reading, or any iterable of bytes " @@ -482,30 +493,30 @@ msgid "" "appends the termination line." msgstr "" -#: ../../library/nntplib.rst:489 +#: ../../library/nntplib.rst:491 msgid "" "If the method succeeds, the server's response is returned. If the server " "refuses posting, a :class:`NNTPReplyError` is raised." msgstr "" -#: ../../library/nntplib.rst:495 +#: ../../library/nntplib.rst:497 msgid "" "Send an ``IHAVE`` command. *message_id* is the id of the message to send to " "the server (enclosed in ``'<'`` and ``'>'``). The *data* parameter and the " "return value are the same as for :meth:`post()`." msgstr "" -#: ../../library/nntplib.rst:502 +#: ../../library/nntplib.rst:504 msgid "" "Return a pair ``(response, date)``. *date* is a :class:`~datetime.datetime` " "object containing the current date and time of the server." msgstr "" -#: ../../library/nntplib.rst:508 +#: ../../library/nntplib.rst:510 msgid "Send a ``SLAVE`` command. Return the server's *response*." msgstr "" -#: ../../library/nntplib.rst:513 +#: ../../library/nntplib.rst:515 msgid "" "Set the instance's debugging level. This controls the amount of debugging " "output printed. The default, ``0``, produces no debugging output. A value " @@ -515,13 +526,13 @@ msgid "" "the connection (including message text)." msgstr "" -#: ../../library/nntplib.rst:521 +#: ../../library/nntplib.rst:523 msgid "" "The following are optional NNTP extensions defined in :rfc:`2980`. Some of " "them have been superseded by newer commands in :rfc:`3977`." msgstr "" -#: ../../library/nntplib.rst:527 +#: ../../library/nntplib.rst:529 msgid "" "Send an ``XHDR`` command. The *hdr* argument is a header keyword, e.g. " "``'subject'``. The *str* argument should have the form ``'first-last'`` " @@ -536,7 +547,7 @@ msgid "" "*file* is supplied, then the returned *list* is an empty list." msgstr "" -#: ../../library/nntplib.rst:542 +#: ../../library/nntplib.rst:544 msgid "" "Send an ``XOVER`` command. *start* and *end* are article numbers delimiting " "the range of articles to select. The return value is the same of for :meth:" @@ -544,15 +555,15 @@ msgid "" "automatically use the newer ``OVER`` command if available." msgstr "" -#: ../../library/nntplib.rst:550 +#: ../../library/nntplib.rst:552 msgid "Utility functions" msgstr "" -#: ../../library/nntplib.rst:552 +#: ../../library/nntplib.rst:554 msgid "The module also defines the following utility function:" msgstr "" -#: ../../library/nntplib.rst:557 +#: ../../library/nntplib.rst:559 msgid "" "Decode a header value, un-escaping any escaped non-ASCII characters. " "*header_str* must be a :class:`str` object. The unescaped value is " diff --git a/library/operator.po b/library/operator.po index 470070d649..ced7c9af72 100644 --- a/library/operator.po +++ b/library/operator.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2021-12-09 23:32+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,8 +70,8 @@ msgstr "" "在 *a* 和 *b* 之間進行 \"rich comparison\"。具體來說,\\ ``lt(a, b)`` 與 ``a " "< b`` 相同,\\ ``le(a, b)`` 與 ``a <= b`` 相同,\\ ``eq(a, b)`` 與 ``a == " "b`` 相同,\\ ``ne(a, b)`` 與 ``a != b`` 相同,\\ ``gt(a, b)`` 與 ``a > b`` 相" -"同,\\ ``ge(a, b)`` 與 ``a >= b`` 相同。注意這些函式可以回傳任何值,無論它是否" -"可當作 boolean(布林)值。關於 rich comparison 的更多資訊請參考 :ref:" +"同,\\ ``ge(a, b)`` 與 ``a >= b`` 相同。注意這些函式可以回傳任何值,無論它是" +"否可當作 boolean(布林)值。關於 rich comparison 的更多資訊請參考 :ref:" "`comparisons`\\ 。" #: ../../library/operator.rst:54 @@ -239,7 +239,15 @@ msgstr "" "回傳物件 *o* 的估計長度。首先嘗試回傳其實際長度,再使用 :meth:`object." "__length_hint__` 得出估計值,最後才是回傳預設值。" -#: ../../library/operator.rst:253 +#: ../../library/operator.rst:254 +msgid "The following operation works with callables:" +msgstr "" + +#: ../../library/operator.rst:259 +msgid "Return ``obj(*args, **kwargs)``." +msgstr "" + +#: ../../library/operator.rst:264 msgid "" "The :mod:`operator` module also defines tools for generalized attribute and " "item lookups. These are useful for making fast field extractors as " @@ -250,7 +258,7 @@ msgstr "" "用來編寫快速欄位提取器以作為 :func:`map`\\ 、\\ :func:`sorted`\\ 、\\ :meth:" "`itertools.groupby` 或其他需要函式引數的函式之引數。" -#: ../../library/operator.rst:262 +#: ../../library/operator.rst:273 msgid "" "Return a callable object that fetches *attr* from its operand. If more than " "one attribute is requested, returns a tuple of attributes. The attribute " @@ -259,11 +267,11 @@ msgstr "" "回傳一個可從運算元中獲取 *attr* 的可呼叫 (callable) 物件。如果請求了一個以上" "的屬性,則回傳一個包含屬性的 tupple(元組)。屬性名稱還可包含點號。例如:" -#: ../../library/operator.rst:266 +#: ../../library/operator.rst:277 msgid "After ``f = attrgetter('name')``, the call ``f(b)`` returns ``b.name``." msgstr "在 ``f = attrgetter('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.name``。" -#: ../../library/operator.rst:268 +#: ../../library/operator.rst:279 msgid "" "After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b." "name, b.date)``." @@ -271,7 +279,7 @@ msgstr "" "在 ``f = attrgetter('name', 'date')`` 之後,呼叫 ``f(b)`` 將回傳 ``(b.name, " "b.date)``。" -#: ../../library/operator.rst:271 +#: ../../library/operator.rst:282 msgid "" "After ``f = attrgetter('name.first', 'name.last')``, the call ``f(b)`` " "returns ``(b.name.first, b.name.last)``." @@ -279,15 +287,15 @@ msgstr "" "在 ``f = attrgetter('name.first', 'name.last')`` 之後,呼叫 ``f(b)`` 將回傳 " "``(b.name.first, b.name.last)``。" -#: ../../library/operator.rst:274 ../../library/operator.rst:306 -#: ../../library/operator.rst:354 +#: ../../library/operator.rst:285 ../../library/operator.rst:317 +#: ../../library/operator.rst:365 msgid "Equivalent to::" msgstr "" "等價於:\n" "\n" "::" -#: ../../library/operator.rst:297 +#: ../../library/operator.rst:308 msgid "" "Return a callable object that fetches *item* from its operand using the " "operand's :meth:`__getitem__` method. If multiple items are specified, " @@ -296,11 +304,11 @@ msgstr "" "回傳一個使用運算元的 :meth:`__getitem__` 方法從運算元中獲取 *item* 的可呼叫物" "件。如果指定了多個條目,則回傳一個查詢值的 tupple。例如:" -#: ../../library/operator.rst:301 +#: ../../library/operator.rst:312 msgid "After ``f = itemgetter(2)``, the call ``f(r)`` returns ``r[2]``." msgstr "在 ``f = itemgetter(2)`` 之後,呼叫 ``f(r)`` 將回傳 ``r[2]``。" -#: ../../library/operator.rst:303 +#: ../../library/operator.rst:314 msgid "" "After ``g = itemgetter(2, 5, 3)``, the call ``g(r)`` returns ``(r[2], r[5], " "r[3])``." @@ -308,7 +316,7 @@ msgstr "" "在 ``g = itemgetter(2, 5, 3)`` 之後,呼叫 ``g(r)`` 將回傳 ``(r[2], r[5], " "r[3])``。" -#: ../../library/operator.rst:318 +#: ../../library/operator.rst:329 msgid "" "The items can be any type accepted by the operand's :meth:`__getitem__` " "method. Dictionaries accept any hashable value. Lists, tuples, and strings " @@ -317,13 +325,13 @@ msgstr "" "傳入的條目可以為運算元的 :meth:`__getitem__` 所接受的任何型別。dictionary(字" "典)接受任意可雜湊 (hashable) 的值。list、tupple 和字串接受索引或切片:" -#: ../../library/operator.rst:332 +#: ../../library/operator.rst:343 msgid "" "Example of using :func:`itemgetter` to retrieve specific fields from a tuple " "record:" msgstr "使用 :func:`itemgetter` 從 tuple 中提取特定欄位的例子:" -#: ../../library/operator.rst:345 +#: ../../library/operator.rst:356 msgid "" "Return a callable object that calls the method *name* on its operand. If " "additional arguments and/or keyword arguments are given, they will be given " @@ -332,13 +340,13 @@ msgstr "" "回傳一個在運算元上呼叫 *name* method 的可呼叫物件。如果給定額外的引數和/或關" "鍵字引數,它們也將被傳給該 method。例如:" -#: ../../library/operator.rst:349 +#: ../../library/operator.rst:360 msgid "" "After ``f = methodcaller('name')``, the call ``f(b)`` returns ``b.name()``." msgstr "" "在 ``f = methodcaller('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.name()``。" -#: ../../library/operator.rst:351 +#: ../../library/operator.rst:362 msgid "" "After ``f = methodcaller('name', 'foo', bar=1)``, the call ``f(b)`` returns " "``b.name('foo', bar=1)``." @@ -346,11 +354,11 @@ msgstr "" "在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 ``b." "name('foo', bar=1)``。" -#: ../../library/operator.rst:365 +#: ../../library/operator.rst:376 msgid "Mapping Operators to Functions" msgstr "運算子與函式間的對映" -#: ../../library/operator.rst:367 +#: ../../library/operator.rst:378 msgid "" "This table shows how abstract operations correspond to operator symbols in " "the Python syntax and the functions in the :mod:`operator` module." @@ -358,424 +366,424 @@ msgstr "" "以下表格表示了抽象運算是如何對應於 Python 語法中的運算子和 :mod:`operator` " "module中的函式。" -#: ../../library/operator.rst:371 +#: ../../library/operator.rst:382 msgid "Operation" msgstr "運算" -#: ../../library/operator.rst:371 +#: ../../library/operator.rst:382 msgid "Syntax" msgstr "語法" -#: ../../library/operator.rst:371 +#: ../../library/operator.rst:382 msgid "Function" msgstr "函式" -#: ../../library/operator.rst:373 +#: ../../library/operator.rst:384 msgid "Addition" msgstr "加法" -#: ../../library/operator.rst:373 +#: ../../library/operator.rst:384 msgid "``a + b``" msgstr "``a + b``" -#: ../../library/operator.rst:373 +#: ../../library/operator.rst:384 msgid "``add(a, b)``" msgstr "``add(a, b)``" -#: ../../library/operator.rst:375 +#: ../../library/operator.rst:386 msgid "Concatenation" msgstr "字串串接" -#: ../../library/operator.rst:375 +#: ../../library/operator.rst:386 msgid "``seq1 + seq2``" msgstr "``seq1 + seq2``" -#: ../../library/operator.rst:375 +#: ../../library/operator.rst:386 msgid "``concat(seq1, seq2)``" msgstr "``concat(seq1, seq2)``" -#: ../../library/operator.rst:377 +#: ../../library/operator.rst:388 msgid "Containment Test" msgstr "包含性檢測" -#: ../../library/operator.rst:377 +#: ../../library/operator.rst:388 msgid "``obj in seq``" msgstr "``obj in seq``" -#: ../../library/operator.rst:377 +#: ../../library/operator.rst:388 msgid "``contains(seq, obj)``" msgstr "``contains(seq, obj)``" -#: ../../library/operator.rst:379 ../../library/operator.rst:381 +#: ../../library/operator.rst:390 ../../library/operator.rst:392 msgid "Division" msgstr "除法" -#: ../../library/operator.rst:379 +#: ../../library/operator.rst:390 msgid "``a / b``" msgstr "``a / b``" -#: ../../library/operator.rst:379 +#: ../../library/operator.rst:390 msgid "``truediv(a, b)``" msgstr "``truediv(a, b)``" -#: ../../library/operator.rst:381 +#: ../../library/operator.rst:392 msgid "``a // b``" msgstr "``a // b``" -#: ../../library/operator.rst:381 +#: ../../library/operator.rst:392 msgid "``floordiv(a, b)``" msgstr "``floordiv(a, b)``" -#: ../../library/operator.rst:383 +#: ../../library/operator.rst:394 msgid "Bitwise And" msgstr "按位元與 (And)" -#: ../../library/operator.rst:383 +#: ../../library/operator.rst:394 msgid "``a & b``" msgstr "``a & b``" -#: ../../library/operator.rst:383 +#: ../../library/operator.rst:394 msgid "``and_(a, b)``" msgstr "``and_(a, b)``" -#: ../../library/operator.rst:385 +#: ../../library/operator.rst:396 msgid "Bitwise Exclusive Or" msgstr "按位元互斥或 (Exclusive Or)" -#: ../../library/operator.rst:385 +#: ../../library/operator.rst:396 msgid "``a ^ b``" msgstr "``a ^ b``" -#: ../../library/operator.rst:385 +#: ../../library/operator.rst:396 msgid "``xor(a, b)``" msgstr "``xor(a, b)``" -#: ../../library/operator.rst:387 +#: ../../library/operator.rst:398 msgid "Bitwise Inversion" msgstr "按位元取反 (Inversion)" -#: ../../library/operator.rst:387 +#: ../../library/operator.rst:398 msgid "``~ a``" msgstr "``~ a``" -#: ../../library/operator.rst:387 +#: ../../library/operator.rst:398 msgid "``invert(a)``" msgstr "``invert(a)``" -#: ../../library/operator.rst:389 +#: ../../library/operator.rst:400 msgid "Bitwise Or" msgstr "按位元或 (Or)" -#: ../../library/operator.rst:389 +#: ../../library/operator.rst:400 msgid "``a | b``" msgstr "``a | b``" -#: ../../library/operator.rst:389 +#: ../../library/operator.rst:400 msgid "``or_(a, b)``" msgstr "``or_(a, b)``" -#: ../../library/operator.rst:391 +#: ../../library/operator.rst:402 msgid "Exponentiation" msgstr "取冪" -#: ../../library/operator.rst:391 +#: ../../library/operator.rst:402 msgid "``a ** b``" msgstr "``a ** b``" -#: ../../library/operator.rst:391 +#: ../../library/operator.rst:402 msgid "``pow(a, b)``" msgstr "``pow(a, b)``" -#: ../../library/operator.rst:393 ../../library/operator.rst:395 +#: ../../library/operator.rst:404 ../../library/operator.rst:406 msgid "Identity" msgstr "標識" -#: ../../library/operator.rst:393 +#: ../../library/operator.rst:404 msgid "``a is b``" msgstr "``a is b``" -#: ../../library/operator.rst:393 +#: ../../library/operator.rst:404 msgid "``is_(a, b)``" msgstr "``is_(a, b)``" -#: ../../library/operator.rst:395 +#: ../../library/operator.rst:406 msgid "``a is not b``" msgstr "``a is not b``" -#: ../../library/operator.rst:395 +#: ../../library/operator.rst:406 msgid "``is_not(a, b)``" msgstr "``is_not(a, b)``" -#: ../../library/operator.rst:397 +#: ../../library/operator.rst:408 msgid "Indexed Assignment" msgstr "索引賦值" -#: ../../library/operator.rst:397 +#: ../../library/operator.rst:408 msgid "``obj[k] = v``" msgstr "``obj[k] = v``" -#: ../../library/operator.rst:397 +#: ../../library/operator.rst:408 msgid "``setitem(obj, k, v)``" msgstr "``setitem(obj, k, v)``" -#: ../../library/operator.rst:399 +#: ../../library/operator.rst:410 msgid "Indexed Deletion" msgstr "索引刪除" -#: ../../library/operator.rst:399 +#: ../../library/operator.rst:410 msgid "``del obj[k]``" msgstr "``del obj[k]``" -#: ../../library/operator.rst:399 +#: ../../library/operator.rst:410 msgid "``delitem(obj, k)``" msgstr "``delitem(obj, k)``" -#: ../../library/operator.rst:401 +#: ../../library/operator.rst:412 msgid "Indexing" msgstr "索引取值" -#: ../../library/operator.rst:401 +#: ../../library/operator.rst:412 msgid "``obj[k]``" msgstr "``obj[k]``" -#: ../../library/operator.rst:401 +#: ../../library/operator.rst:412 msgid "``getitem(obj, k)``" msgstr "``getitem(obj, k)``" -#: ../../library/operator.rst:403 +#: ../../library/operator.rst:414 msgid "Left Shift" msgstr "左移" -#: ../../library/operator.rst:403 +#: ../../library/operator.rst:414 msgid "``a << b``" msgstr "``a << b``" -#: ../../library/operator.rst:403 +#: ../../library/operator.rst:414 msgid "``lshift(a, b)``" msgstr "``lshift(a, b)``" -#: ../../library/operator.rst:405 +#: ../../library/operator.rst:416 msgid "Modulo" msgstr "模除 (Modulo)" -#: ../../library/operator.rst:405 +#: ../../library/operator.rst:416 msgid "``a % b``" msgstr "``a % b``" -#: ../../library/operator.rst:405 +#: ../../library/operator.rst:416 msgid "``mod(a, b)``" msgstr "``mod(a, b)``" -#: ../../library/operator.rst:407 +#: ../../library/operator.rst:418 msgid "Multiplication" msgstr "乘法" -#: ../../library/operator.rst:407 +#: ../../library/operator.rst:418 msgid "``a * b``" msgstr "``a * b``" -#: ../../library/operator.rst:407 +#: ../../library/operator.rst:418 msgid "``mul(a, b)``" msgstr "``mul(a, b)``" -#: ../../library/operator.rst:409 +#: ../../library/operator.rst:420 msgid "Matrix Multiplication" msgstr "矩陣乘法" -#: ../../library/operator.rst:409 +#: ../../library/operator.rst:420 msgid "``a @ b``" msgstr "``a @ b``" -#: ../../library/operator.rst:409 +#: ../../library/operator.rst:420 msgid "``matmul(a, b)``" msgstr "``matmul(a, b)``" -#: ../../library/operator.rst:411 +#: ../../library/operator.rst:422 msgid "Negation (Arithmetic)" msgstr "反相(算術)" -#: ../../library/operator.rst:411 +#: ../../library/operator.rst:422 msgid "``- a``" msgstr "``- a``" -#: ../../library/operator.rst:411 +#: ../../library/operator.rst:422 msgid "``neg(a)``" msgstr "``neg(a)``" -#: ../../library/operator.rst:413 +#: ../../library/operator.rst:424 msgid "Negation (Logical)" msgstr "反相(邏輯)" -#: ../../library/operator.rst:413 +#: ../../library/operator.rst:424 msgid "``not a``" msgstr "``not a``" -#: ../../library/operator.rst:413 +#: ../../library/operator.rst:424 msgid "``not_(a)``" msgstr "``not_(a)``" -#: ../../library/operator.rst:415 +#: ../../library/operator.rst:426 msgid "Positive" msgstr "正數" -#: ../../library/operator.rst:415 +#: ../../library/operator.rst:426 msgid "``+ a``" msgstr "``+ a``" -#: ../../library/operator.rst:415 +#: ../../library/operator.rst:426 msgid "``pos(a)``" msgstr "``pos(a)``" -#: ../../library/operator.rst:417 +#: ../../library/operator.rst:428 msgid "Right Shift" msgstr "右移" -#: ../../library/operator.rst:417 +#: ../../library/operator.rst:428 msgid "``a >> b``" msgstr "``a >> b``" -#: ../../library/operator.rst:417 +#: ../../library/operator.rst:428 msgid "``rshift(a, b)``" msgstr "``rshift(a, b)``" -#: ../../library/operator.rst:419 +#: ../../library/operator.rst:430 msgid "Slice Assignment" msgstr "切片賦值" -#: ../../library/operator.rst:419 +#: ../../library/operator.rst:430 msgid "``seq[i:j] = values``" msgstr "``seq[i:j] = values``" -#: ../../library/operator.rst:419 +#: ../../library/operator.rst:430 msgid "``setitem(seq, slice(i, j), values)``" msgstr "``setitem(seq, slice(i, j), values)``" -#: ../../library/operator.rst:421 +#: ../../library/operator.rst:432 msgid "Slice Deletion" msgstr "切片刪除" -#: ../../library/operator.rst:421 +#: ../../library/operator.rst:432 msgid "``del seq[i:j]``" msgstr "``del seq[i:j]``" -#: ../../library/operator.rst:421 +#: ../../library/operator.rst:432 msgid "``delitem(seq, slice(i, j))``" msgstr "``delitem(seq, slice(i, j))``" -#: ../../library/operator.rst:423 +#: ../../library/operator.rst:434 msgid "Slicing" msgstr "切片取值" -#: ../../library/operator.rst:423 +#: ../../library/operator.rst:434 msgid "``seq[i:j]``" msgstr "``seq[i:j]``" -#: ../../library/operator.rst:423 +#: ../../library/operator.rst:434 msgid "``getitem(seq, slice(i, j))``" msgstr "``getitem(seq, slice(i, j))``" -#: ../../library/operator.rst:425 +#: ../../library/operator.rst:436 msgid "String Formatting" msgstr "字串格式化" -#: ../../library/operator.rst:425 +#: ../../library/operator.rst:436 msgid "``s % obj``" msgstr "``s % obj``" -#: ../../library/operator.rst:425 +#: ../../library/operator.rst:436 msgid "``mod(s, obj)``" msgstr "``mod(s, obj)``" -#: ../../library/operator.rst:427 +#: ../../library/operator.rst:438 msgid "Subtraction" msgstr "減法" -#: ../../library/operator.rst:427 +#: ../../library/operator.rst:438 msgid "``a - b``" msgstr "``a - b``" -#: ../../library/operator.rst:427 +#: ../../library/operator.rst:438 msgid "``sub(a, b)``" msgstr "``sub(a, b)``" -#: ../../library/operator.rst:429 +#: ../../library/operator.rst:440 msgid "Truth Test" msgstr "真值檢測" -#: ../../library/operator.rst:429 +#: ../../library/operator.rst:440 msgid "``obj``" msgstr "``obj``" -#: ../../library/operator.rst:429 +#: ../../library/operator.rst:440 msgid "``truth(obj)``" msgstr "``truth(obj)``" -#: ../../library/operator.rst:431 ../../library/operator.rst:433 -#: ../../library/operator.rst:439 ../../library/operator.rst:441 +#: ../../library/operator.rst:442 ../../library/operator.rst:444 +#: ../../library/operator.rst:450 ../../library/operator.rst:452 msgid "Ordering" msgstr "比較大小" -#: ../../library/operator.rst:431 +#: ../../library/operator.rst:442 msgid "``a < b``" msgstr "``a < b``" -#: ../../library/operator.rst:431 +#: ../../library/operator.rst:442 msgid "``lt(a, b)``" msgstr "``lt(a, b)``" -#: ../../library/operator.rst:433 +#: ../../library/operator.rst:444 msgid "``a <= b``" msgstr "``a <= b``" -#: ../../library/operator.rst:433 +#: ../../library/operator.rst:444 msgid "``le(a, b)``" msgstr "``le(a, b)``" -#: ../../library/operator.rst:435 +#: ../../library/operator.rst:446 msgid "Equality" msgstr "相等性" -#: ../../library/operator.rst:435 +#: ../../library/operator.rst:446 msgid "``a == b``" msgstr "``a == b``" -#: ../../library/operator.rst:435 +#: ../../library/operator.rst:446 msgid "``eq(a, b)``" msgstr "``eq(a, b)``" -#: ../../library/operator.rst:437 +#: ../../library/operator.rst:448 msgid "Difference" msgstr "不等性" -#: ../../library/operator.rst:437 +#: ../../library/operator.rst:448 msgid "``a != b``" msgstr "``a != b``" -#: ../../library/operator.rst:437 +#: ../../library/operator.rst:448 msgid "``ne(a, b)``" msgstr "``ne(a, b)``" -#: ../../library/operator.rst:439 +#: ../../library/operator.rst:450 msgid "``a >= b``" msgstr "``a >= b``" -#: ../../library/operator.rst:439 +#: ../../library/operator.rst:450 msgid "``ge(a, b)``" msgstr "``ge(a, b)``" -#: ../../library/operator.rst:441 +#: ../../library/operator.rst:452 msgid "``a > b``" msgstr "``a > b``" -#: ../../library/operator.rst:441 +#: ../../library/operator.rst:452 msgid "``gt(a, b)``" msgstr "``gt(a, b)``" -#: ../../library/operator.rst:445 +#: ../../library/operator.rst:456 msgid "In-place Operators" msgstr "原地 (in-place) 運算子" -#: ../../library/operator.rst:447 +#: ../../library/operator.rst:458 msgid "" "Many operations have an \"in-place\" version. Listed below are functions " "providing a more primitive access to in-place operators than the usual " @@ -789,7 +797,7 @@ msgstr "" "iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於複合陳述" "式 ``z = x; z += y``。" -#: ../../library/operator.rst:454 +#: ../../library/operator.rst:465 msgid "" "In those examples, note that when an in-place method is called, the " "computation and assignment are performed in two separate steps. The in-" @@ -799,7 +807,7 @@ msgstr "" "在這些例子中,請注意當呼叫一個原地方法時,運算和賦值是分成兩個步驟來執行的。" "下面列出的原地函式只執行第一步,即呼叫原地方法,第二步賦值則不加處理。" -#: ../../library/operator.rst:459 +#: ../../library/operator.rst:470 msgid "" "For immutable targets such as strings, numbers, and tuples, the updated " "value is computed, but not assigned back to the input variable:" @@ -807,7 +815,7 @@ msgstr "" "對於不可變 (immutable) 的目標例如字串、數字和 tupple,更新的值會被計算,但不" "會被再被賦值給輸入變數:" -#: ../../library/operator.rst:468 +#: ../../library/operator.rst:479 msgid "" "For mutable targets such as lists and dictionaries, the in-place method will " "perform the update, so no subsequent assignment is necessary:" @@ -815,59 +823,59 @@ msgstr "" "對於可變 (mutable) 的目標例如 list 和 dictionary,原地方法將執行更新,因此不" "需要後續賦值操作:" -#: ../../library/operator.rst:480 +#: ../../library/operator.rst:491 msgid "``a = iadd(a, b)`` is equivalent to ``a += b``." msgstr "``a = iadd(a, b)`` 等價於 ``a += b``。" -#: ../../library/operator.rst:486 +#: ../../library/operator.rst:497 msgid "``a = iand(a, b)`` is equivalent to ``a &= b``." msgstr "``a = iand(a, b)`` 等價於 ``a &= b``。" -#: ../../library/operator.rst:492 +#: ../../library/operator.rst:503 msgid "" "``a = iconcat(a, b)`` is equivalent to ``a += b`` for *a* and *b* sequences." msgstr "``a = iconcat(a, b)`` 等價於 ``a += b``\\ ,其中 *a* 和 *b* 為序列。" -#: ../../library/operator.rst:498 +#: ../../library/operator.rst:509 msgid "``a = ifloordiv(a, b)`` is equivalent to ``a //= b``." msgstr "``a = ifloordiv(a, b)`` 等價於 ``a //= b``。" -#: ../../library/operator.rst:504 +#: ../../library/operator.rst:515 msgid "``a = ilshift(a, b)`` is equivalent to ``a <<= b``." msgstr "``a = ilshift(a, b)`` 等價於 ``a <<= b``。" -#: ../../library/operator.rst:510 +#: ../../library/operator.rst:521 msgid "``a = imod(a, b)`` is equivalent to ``a %= b``." msgstr "``a = imod(a, b)`` 等價於 ``a %= b``。" -#: ../../library/operator.rst:516 +#: ../../library/operator.rst:527 msgid "``a = imul(a, b)`` is equivalent to ``a *= b``." msgstr "``a = imul(a, b)`` 等價於 ``a *= b``。" -#: ../../library/operator.rst:522 +#: ../../library/operator.rst:533 msgid "``a = imatmul(a, b)`` is equivalent to ``a @= b``." msgstr "``a = imatmul(a, b)`` 等價於 ``a @= b``。" -#: ../../library/operator.rst:530 +#: ../../library/operator.rst:541 msgid "``a = ior(a, b)`` is equivalent to ``a |= b``." msgstr "``a = ior(a, b)`` 等價於 ``a |= b``。" -#: ../../library/operator.rst:536 +#: ../../library/operator.rst:547 msgid "``a = ipow(a, b)`` is equivalent to ``a **= b``." msgstr "``a = ipow(a, b)`` 等價於 ``a **= b``。" -#: ../../library/operator.rst:542 +#: ../../library/operator.rst:553 msgid "``a = irshift(a, b)`` is equivalent to ``a >>= b``." msgstr "``a = irshift(a, b)`` 等價於 ``a >>= b``。" -#: ../../library/operator.rst:548 +#: ../../library/operator.rst:559 msgid "``a = isub(a, b)`` is equivalent to ``a -= b``." msgstr "``a = isub(a, b)`` 等價於 ``a -= b``。" -#: ../../library/operator.rst:554 +#: ../../library/operator.rst:565 msgid "``a = itruediv(a, b)`` is equivalent to ``a /= b``." msgstr "``a = itruediv(a, b)`` 等價於 ``a /= b``。" -#: ../../library/operator.rst:560 +#: ../../library/operator.rst:571 msgid "``a = ixor(a, b)`` is equivalent to ``a ^= b``." msgstr "``a = ixor(a, b)`` 等價於 ``a ^= b``。" diff --git a/library/os.po b/library/os.po index 1c4842117f..a0a435532a 100644 --- a/library/os.po +++ b/library/os.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-11 00:23+0000\n" -"PO-Revision-Date: 2018-05-23 16:07+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 08:11+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,6 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/os.rst:2 msgid ":mod:`os` --- Miscellaneous operating system interfaces" @@ -69,40 +70,50 @@ msgid "" "On VxWorks, os.popen, os.fork, os.execv and os.spawn*p* are not supported." msgstr "" -#: ../../library/os.rst:39 +#: ../../library/os.rst:37 +msgid "" +"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, large " +"parts of the :mod:`os` module are not available or behave differently. API " +"related to processes (e.g. :func:`~os.fork`, :func:`~os.execve`), signals (e." +"g. :func:`~os.kill`, :func:`~os.wait`), and resources (e.g. :func:`~os." +"nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." +"getpid` are emulated or stubs." +msgstr "" + +#: ../../library/os.rst:47 msgid "" "All functions in this module raise :exc:`OSError` (or subclasses thereof) in " "the case of invalid or inaccessible file names and paths, or other arguments " "that have the correct type, but are not accepted by the operating system." msgstr "" -#: ../../library/os.rst:45 +#: ../../library/os.rst:53 msgid "An alias for the built-in :exc:`OSError` exception." msgstr "" -#: ../../library/os.rst:50 +#: ../../library/os.rst:58 msgid "" "The name of the operating system dependent module imported. The following " "names have currently been registered: ``'posix'``, ``'nt'``, ``'java'``." msgstr "" -#: ../../library/os.rst:55 +#: ../../library/os.rst:63 msgid "" ":attr:`sys.platform` has a finer granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/os.rst:58 +#: ../../library/os.rst:66 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/os.rst:66 +#: ../../library/os.rst:74 msgid "File Names, Command Line Arguments, and Environment Variables" msgstr "" -#: ../../library/os.rst:68 +#: ../../library/os.rst:76 msgid "" "In Python, file names, command line arguments, and environment variables are " "represented using the string type. On some systems, decoding these strings " @@ -111,7 +122,7 @@ msgid "" "this conversion (see :func:`sys.getfilesystemencoding`)." msgstr "" -#: ../../library/os.rst:74 +#: ../../library/os.rst:82 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -119,7 +130,7 @@ msgid "" "c:type:`PyConfig`." msgstr "" -#: ../../library/os.rst:79 +#: ../../library/os.rst:87 msgid "" "On some systems, conversion using the file system encoding may fail. In this " "case, Python uses the :ref:`surrogateescape encoding error handler " @@ -128,7 +139,7 @@ msgid "" "original byte on encoding." msgstr "" -#: ../../library/os.rst:87 +#: ../../library/os.rst:95 msgid "" "The :term:`file system encoding ` " "must guarantee to successfully decode all bytes below 128. If the file " @@ -136,41 +147,41 @@ msgid "" "exc:`UnicodeError`." msgstr "" -#: ../../library/os.rst:92 +#: ../../library/os.rst:100 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ 。" -#: ../../library/os.rst:98 +#: ../../library/os.rst:106 msgid "Python UTF-8 Mode" msgstr "" -#: ../../library/os.rst:100 +#: ../../library/os.rst:108 msgid "See :pep:`540` for more details." msgstr "更多資訊請見 :pep:`540`\\ 。" -#: ../../library/os.rst:103 +#: ../../library/os.rst:111 msgid "" "The Python UTF-8 Mode ignores the :term:`locale encoding` and forces the " "usage of the UTF-8 encoding:" msgstr "" -#: ../../library/os.rst:106 +#: ../../library/os.rst:114 msgid "" "Use UTF-8 as the :term:`filesystem encoding `." msgstr "" -#: ../../library/os.rst:108 -msgid ":func:`sys.getfilesystemencoding()` returns ``'UTF-8'``." -msgstr ":func:`sys.getfilesystemencoding()` 回傳 ``'UTF-8'``。" +#: ../../library/os.rst:116 +msgid ":func:`sys.getfilesystemencoding()` returns ``'utf-8'``." +msgstr ":func:`sys.getfilesystemencoding()` 回傳 ``'utf-8'``。" -#: ../../library/os.rst:109 +#: ../../library/os.rst:117 msgid "" -":func:`locale.getpreferredencoding()` returns ``'UTF-8'`` (the " +":func:`locale.getpreferredencoding()` returns ``'utf-8'`` (the " "*do_setlocale* argument has no effect)." msgstr "" -#: ../../library/os.rst:111 +#: ../../library/os.rst:119 msgid "" ":data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` all use UTF-8 " "as their text encoding, with the ``surrogateescape`` :ref:`error handler " @@ -179,36 +190,36 @@ msgid "" "default locale-aware mode)" msgstr "" -#: ../../library/os.rst:116 +#: ../../library/os.rst:124 msgid "" -"On Unix, :func:`os.device_encoding` returns ``'UTF-8'`` rather than the " +"On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the " "device encoding." msgstr "" -#: ../../library/os.rst:119 +#: ../../library/os.rst:127 msgid "" "Note that the standard stream settings in UTF-8 mode can be overridden by :" "envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " "mode)." msgstr "" -#: ../../library/os.rst:123 +#: ../../library/os.rst:131 msgid "" "As a consequence of the changes in those lower level APIs, other higher " "level APIs also exhibit different default behaviours:" msgstr "" -#: ../../library/os.rst:126 +#: ../../library/os.rst:134 msgid "" "Command line arguments, environment variables and filenames are decoded to " "text using the UTF-8 encoding." msgstr "" -#: ../../library/os.rst:128 +#: ../../library/os.rst:136 msgid ":func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding." msgstr "" -#: ../../library/os.rst:129 +#: ../../library/os.rst:137 msgid "" ":func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8 " "encoding by default. However, they still use the strict error handler by " @@ -216,20 +227,20 @@ msgid "" "raise an exception rather than producing nonsense data." msgstr "" -#: ../../library/os.rst:134 +#: ../../library/os.rst:142 msgid "" "The :ref:`Python UTF-8 Mode ` is enabled if the LC_CTYPE locale " "is ``C`` or ``POSIX`` at Python startup (see the :c:func:`PyConfig_Read` " "function)." msgstr "" -#: ../../library/os.rst:138 +#: ../../library/os.rst:146 msgid "" "It can be enabled or disabled using the :option:`-X utf8 <-X>` command line " "option and the :envvar:`PYTHONUTF8` environment variable." msgstr "" -#: ../../library/os.rst:141 +#: ../../library/os.rst:149 msgid "" "If the :envvar:`PYTHONUTF8` environment variable is not set at all, then the " "interpreter defaults to using the current locale settings, *unless* the " @@ -239,85 +250,81 @@ msgid "" "UTF-8 mode unless explicitly instructed not to do so." msgstr "" -#: ../../library/os.rst:148 +#: ../../library/os.rst:156 msgid "" "The Python UTF-8 Mode can only be enabled at the Python startup. Its value " "can be read from :data:`sys.flags.utf8_mode `." msgstr "" -#: ../../library/os.rst:151 +#: ../../library/os.rst:159 msgid "" "See also the :ref:`UTF-8 mode on Windows ` and the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:158 +#: ../../library/os.rst:164 +msgid ":pep:`686`" +msgstr "" + +#: ../../library/os.rst:165 +msgid "Python 3.15 will make :ref:`utf8-mode` default." +msgstr "" + +#: ../../library/os.rst:171 msgid "Process Parameters" msgstr "" -#: ../../library/os.rst:160 +#: ../../library/os.rst:173 msgid "" "These functions and data items provide information and operate on the " "current process and user." msgstr "" -#: ../../library/os.rst:166 +#: ../../library/os.rst:179 msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: ../../library/os.rst:168 ../../library/os.rst:340 ../../library/os.rst:349 -#: ../../library/os.rst:358 ../../library/os.rst:368 ../../library/os.rst:377 -#: ../../library/os.rst:412 ../../library/os.rst:420 ../../library/os.rst:457 -#: ../../library/os.rst:468 ../../library/os.rst:478 ../../library/os.rst:488 -#: ../../library/os.rst:498 ../../library/os.rst:508 ../../library/os.rst:541 -#: ../../library/os.rst:548 ../../library/os.rst:555 ../../library/os.rst:565 -#: ../../library/os.rst:576 ../../library/os.rst:585 ../../library/os.rst:603 -#: ../../library/os.rst:611 ../../library/os.rst:619 ../../library/os.rst:628 -#: ../../library/os.rst:636 ../../library/os.rst:643 ../../library/os.rst:650 -#: ../../library/os.rst:659 ../../library/os.rst:864 ../../library/os.rst:876 -#: ../../library/os.rst:885 ../../library/os.rst:907 ../../library/os.rst:928 -#: ../../library/os.rst:965 ../../library/os.rst:986 ../../library/os.rst:998 -#: ../../library/os.rst:1178 ../../library/os.rst:1193 -#: ../../library/os.rst:1208 ../../library/os.rst:1221 -#: ../../library/os.rst:1290 ../../library/os.rst:1405 -#: ../../library/os.rst:1425 ../../library/os.rst:1437 -#: ../../library/os.rst:1488 ../../library/os.rst:1497 -#: ../../library/os.rst:1505 ../../library/os.rst:1514 -#: ../../library/os.rst:1550 ../../library/os.rst:1798 -#: ../../library/os.rst:1867 ../../library/os.rst:1881 -#: ../../library/os.rst:1894 ../../library/os.rst:1921 -#: ../../library/os.rst:1936 ../../library/os.rst:1949 -#: ../../library/os.rst:2138 ../../library/os.rst:2160 -#: ../../library/os.rst:2204 ../../library/os.rst:2215 -#: ../../library/os.rst:2892 ../../library/os.rst:3046 -#: ../../library/os.rst:3279 ../../library/os.rst:3672 -#: ../../library/os.rst:3680 ../../library/os.rst:3687 -#: ../../library/os.rst:3694 ../../library/os.rst:3701 -#: ../../library/os.rst:3708 ../../library/os.rst:3715 -#: ../../library/os.rst:3722 ../../library/os.rst:3730 -#: ../../library/os.rst:3738 ../../library/os.rst:3745 -#: ../../library/os.rst:3752 ../../library/os.rst:3761 -#: ../../library/os.rst:3769 ../../library/os.rst:3777 -#: ../../library/os.rst:3784 ../../library/os.rst:3791 -#: ../../library/os.rst:3812 ../../library/os.rst:3867 -#: ../../library/os.rst:3874 ../../library/os.rst:3895 -#: ../../library/os.rst:4011 ../../library/os.rst:4059 -#: ../../library/os.rst:4291 ../../library/os.rst:4312 -#: ../../library/os.rst:4323 ../../library/os.rst:4343 -#: ../../library/os.rst:4358 ../../library/os.rst:4413 -#: ../../library/os.rst:4427 ../../library/os.rst:4465 -#: ../../library/os.rst:4481 ../../library/os.rst:4495 -#: ../../library/os.rst:4506 ../../library/os.rst:4518 -#: ../../library/os.rst:4525 ../../library/os.rst:4534 -#: ../../library/os.rst:4543 ../../library/os.rst:4552 -#: ../../library/os.rst:4561 ../../library/os.rst:4707 -#: ../../library/os.rst:4716 ../../library/os.rst:4737 -#: ../../library/os.rst:4747 ../../library/os.rst:4756 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - -#: ../../library/os.rst:173 +#: ../../library/os.rst:-1 ../../library/os.rst:181 ../../library/os.rst:353 +#: ../../library/os.rst:362 ../../library/os.rst:385 ../../library/os.rst:394 +#: ../../library/os.rst:429 ../../library/os.rst:437 ../../library/os.rst:476 +#: ../../library/os.rst:487 ../../library/os.rst:497 ../../library/os.rst:507 +#: ../../library/os.rst:530 ../../library/os.rst:563 ../../library/os.rst:570 +#: ../../library/os.rst:577 ../../library/os.rst:587 ../../library/os.rst:598 +#: ../../library/os.rst:607 ../../library/os.rst:625 ../../library/os.rst:633 +#: ../../library/os.rst:641 ../../library/os.rst:650 ../../library/os.rst:658 +#: ../../library/os.rst:665 ../../library/os.rst:672 ../../library/os.rst:681 +#: ../../library/os.rst:1047 ../../library/os.rst:1191 +#: ../../library/os.rst:1217 ../../library/os.rst:1454 +#: ../../library/os.rst:1489 ../../library/os.rst:1498 +#: ../../library/os.rst:1862 ../../library/os.rst:1951 +#: ../../library/os.rst:1991 ../../library/os.rst:2208 +#: ../../library/os.rst:2230 ../../library/os.rst:3755 +#: ../../library/os.rst:3762 ../../library/os.rst:3769 +#: ../../library/os.rst:3776 ../../library/os.rst:3783 +#: ../../library/os.rst:3790 ../../library/os.rst:3797 +#: ../../library/os.rst:3805 ../../library/os.rst:3813 +#: ../../library/os.rst:3820 ../../library/os.rst:3827 +#: ../../library/os.rst:3836 ../../library/os.rst:3844 +#: ../../library/os.rst:3852 ../../library/os.rst:3859 +#: ../../library/os.rst:3866 ../../library/os.rst:3887 +#: ../../library/os.rst:3904 ../../library/os.rst:3944 +#: ../../library/os.rst:3951 ../../library/os.rst:3972 +#: ../../library/os.rst:4099 ../../library/os.rst:4149 +#: ../../library/os.rst:4383 ../../library/os.rst:4404 +#: ../../library/os.rst:4415 ../../library/os.rst:4435 +#: ../../library/os.rst:4450 ../../library/os.rst:4488 +#: ../../library/os.rst:4507 ../../library/os.rst:4521 +#: ../../library/os.rst:4561 ../../library/os.rst:4579 +#: ../../library/os.rst:4593 ../../library/os.rst:4604 +#: ../../library/os.rst:4616 ../../library/os.rst:4623 +#: ../../library/os.rst:4632 ../../library/os.rst:4641 +#: ../../library/os.rst:4650 ../../library/os.rst:4659 +#, fuzzy +msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" + +#: ../../library/os.rst:186 msgid "" "A :term:`mapping` object where keys and values are strings that represent " "the process environment. For example, ``environ['HOME']`` is the pathname " @@ -325,7 +332,7 @@ msgid "" "``getenv(\"HOME\")`` in C." msgstr "" -#: ../../library/os.rst:178 +#: ../../library/os.rst:191 msgid "" "This mapping is captured the first time the :mod:`os` module is imported, " "typically during Python startup as part of processing :file:`site.py`. " @@ -334,33 +341,33 @@ msgid "" "directly." msgstr "" -#: ../../library/os.rst:183 +#: ../../library/os.rst:196 msgid "" "This mapping may be used to modify the environment as well as query the " "environment. :func:`putenv` will be called automatically when the mapping " "is modified." msgstr "" -#: ../../library/os.rst:187 +#: ../../library/os.rst:200 msgid "" "On Unix, keys and values use :func:`sys.getfilesystemencoding` and " "``'surrogateescape'`` error handler. Use :data:`environb` if you would like " "to use a different encoding." msgstr "" -#: ../../library/os.rst:193 +#: ../../library/os.rst:206 msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" -#: ../../library/os.rst:198 +#: ../../library/os.rst:211 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`putenv`." msgstr "" -#: ../../library/os.rst:202 +#: ../../library/os.rst:215 msgid "" "You can delete items in this mapping to unset environment variables. :func:" "`unsetenv` will be called automatically when an item is deleted from :data:" @@ -368,12 +375,12 @@ msgid "" "called." msgstr "" -#: ../../library/os.rst:207 ../../library/os.rst:223 +#: ../../library/os.rst:220 ../../library/os.rst:236 msgid "" "Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators." msgstr "" -#: ../../library/os.rst:213 +#: ../../library/os.rst:226 msgid "" "Bytes version of :data:`environ`: a :term:`mapping` object where both keys " "and values are :class:`bytes` objects representing the process environment. :" @@ -381,47 +388,47 @@ msgid "" "`environb` updates :data:`environ`, and vice versa)." msgstr "" -#: ../../library/os.rst:218 +#: ../../library/os.rst:231 msgid "" ":data:`environb` is only available if :data:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:232 +#: ../../library/os.rst:245 msgid "These functions are described in :ref:`os-file-dir`." msgstr "" -#: ../../library/os.rst:237 +#: ../../library/os.rst:250 msgid "" "Encode :term:`path-like ` *filename* to the :term:" "`filesystem encoding and error handler`; return :class:`bytes` unchanged." msgstr "" -#: ../../library/os.rst:241 +#: ../../library/os.rst:254 msgid ":func:`fsdecode` is the reverse function." msgstr "" -#: ../../library/os.rst:245 ../../library/os.rst:260 +#: ../../library/os.rst:258 ../../library/os.rst:273 msgid "" "Support added to accept objects implementing the :class:`os.PathLike` " "interface." msgstr "" -#: ../../library/os.rst:252 +#: ../../library/os.rst:265 msgid "" "Decode the :term:`path-like ` *filename* from the :term:" "`filesystem encoding and error handler`; return :class:`str` unchanged." msgstr "" -#: ../../library/os.rst:256 +#: ../../library/os.rst:269 msgid ":func:`fsencode` is the reverse function." msgstr "" -#: ../../library/os.rst:267 +#: ../../library/os.rst:280 msgid "Return the file system representation of the path." msgstr "" -#: ../../library/os.rst:269 +#: ../../library/os.rst:282 msgid "" "If :class:`str` or :class:`bytes` is passed in, it is returned unchanged. " "Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is " @@ -429,23 +436,23 @@ msgid "" "other cases, :exc:`TypeError` is raised." msgstr "" -#: ../../library/os.rst:279 +#: ../../library/os.rst:292 msgid "" "An :term:`abstract base class` for objects representing a file system path, " "e.g. :class:`pathlib.PurePath`." msgstr "" -#: ../../library/os.rst:286 +#: ../../library/os.rst:299 msgid "Return the file system path representation of the object." msgstr "" -#: ../../library/os.rst:288 +#: ../../library/os.rst:301 msgid "" "The method should only return a :class:`str` or :class:`bytes` object, with " "the preference being for :class:`str`." msgstr "" -#: ../../library/os.rst:294 +#: ../../library/os.rst:307 msgid "" "Return the value of the environment variable *key* as a string if it exists, " "or *default* if it doesn't. *key* is a string. Note that since :func:" @@ -454,18 +461,24 @@ msgid "" "changes." msgstr "" -#: ../../library/os.rst:300 +#: ../../library/os.rst:313 msgid "" "On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` " "and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would " "like to use a different encoding." msgstr "" -#: ../../library/os.rst:304 -msgid ":ref:`Availability `: most flavors of Unix, Windows." -msgstr ":ref:`適用 `:大部分的 Unix、Windows。" +#: ../../library/os.rst:-1 ../../library/os.rst:317 ../../library/os.rst:975 +#: ../../library/os.rst:987 ../../library/os.rst:1203 ../../library/os.rst:1637 +#: ../../library/os.rst:2035 ../../library/os.rst:2308 +#: ../../library/os.rst:3133 ../../library/os.rst:3747 +#: ../../library/os.rst:4236 ../../library/os.rst:4247 +#: ../../library/os.rst:4365 +#, fuzzy +msgid ":ref:`Availability `: Unix, Windows." +msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/os.rst:309 +#: ../../library/os.rst:322 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " "*default* if it doesn't. *key* must be bytes. Note that since :func:" @@ -474,17 +487,30 @@ msgid "" "environment changes." msgstr "" -#: ../../library/os.rst:316 +#: ../../library/os.rst:329 msgid "" ":func:`getenvb` is only available if :data:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:320 -msgid ":ref:`Availability `: most flavors of Unix." -msgstr ":ref:`適用 `:大部分的 Unix。" +#: ../../library/os.rst:-1 ../../library/os.rst:333 ../../library/os.rst:734 +#: ../../library/os.rst:920 ../../library/os.rst:942 ../../library/os.rst:963 +#: ../../library/os.rst:1024 ../../library/os.rst:1036 +#: ../../library/os.rst:1242 ../../library/os.rst:1257 +#: ../../library/os.rst:1270 ../../library/os.rst:1339 +#: ../../library/os.rst:1549 ../../library/os.rst:1575 +#: ../../library/os.rst:1611 ../../library/os.rst:1964 +#: ../../library/os.rst:2006 ../../library/os.rst:2019 +#: ../../library/os.rst:2274 ../../library/os.rst:2285 +#: ../../library/os.rst:2962 ../../library/os.rst:3119 +#: ../../library/os.rst:3352 ../../library/os.rst:4805 +#: ../../library/os.rst:4814 ../../library/os.rst:4835 +#: ../../library/os.rst:4845 ../../library/os.rst:4855 +#, fuzzy +msgid ":ref:`Availability `: Unix." +msgstr ":ref:`適用 `:Unix。" -#: ../../library/os.rst:326 +#: ../../library/os.rst:339 msgid "" "Returns the list of directories that will be searched for a named " "executable, similar to a shell, when launching a process. *env*, when " @@ -492,33 +518,41 @@ msgid "" "in. By default, when *env* is ``None``, :data:`environ` is used." msgstr "" -#: ../../library/os.rst:337 +#: ../../library/os.rst:350 msgid "" "Return the effective group id of the current process. This corresponds to " "the \"set id\" bit on the file being executed in the current process." msgstr "" -#: ../../library/os.rst:347 +#: ../../library/os.rst:360 msgid "Return the current process's effective user id." msgstr "" -#: ../../library/os.rst:356 +#: ../../library/os.rst:369 msgid "Return the real group id of the current process." msgstr "" -#: ../../library/os.rst:363 +#: ../../library/os.rst:373 ../../library/os.rst:446 ../../library/os.rst:519 +#: ../../library/os.rst:704 +msgid "" +"The function is a stub on Emscripten and WASI, see :ref:`wasm-availability` " +"for more information." +msgstr "" + +#: ../../library/os.rst:379 msgid "" "Return list of group ids that *user* belongs to. If *group* is not in the " "list, it is included; typically, *group* is specified as the group ID field " -"from the password record for *user*." +"from the password record for *user*, because that group ID will otherwise be " +"potentially omitted." msgstr "" -#: ../../library/os.rst:374 +#: ../../library/os.rst:391 msgid "" "Return list of supplemental group ids associated with the current process." msgstr "" -#: ../../library/os.rst:380 +#: ../../library/os.rst:397 msgid "" "On macOS, :func:`getgroups` behavior differs somewhat from other Unix " "platforms. If the Python interpreter was built with a deployment target of :" @@ -535,7 +569,7 @@ msgid "" "get_config_var`." msgstr "" -#: ../../library/os.rst:397 +#: ../../library/os.rst:414 msgid "" "Return the name of the user logged in on the controlling terminal of the " "process. For most purposes, it is more useful to use :func:`getpass." @@ -544,42 +578,40 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:404 ../../library/os.rst:439 ../../library/os.rst:940 -#: ../../library/os.rst:952 ../../library/os.rst:1154 ../../library/os.rst:1576 -#: ../../library/os.rst:1965 ../../library/os.rst:2238 -#: ../../library/os.rst:3026 ../../library/os.rst:3060 -#: ../../library/os.rst:3639 ../../library/os.rst:4144 -#: ../../library/os.rst:4155 ../../library/os.rst:4249 -#: ../../library/os.rst:4273 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix、Windows。" +#: ../../library/os.rst:-1 ../../library/os.rst:421 ../../library/os.rst:458 +#: ../../library/os.rst:3713 ../../library/os.rst:3929 +#: ../../library/os.rst:4341 ../../library/os.rst:4552 +#, fuzzy +msgid "" +":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." +msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" -#: ../../library/os.rst:409 +#: ../../library/os.rst:426 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " "is 0, the process group id of the current process is returned." msgstr "" -#: ../../library/os.rst:418 +#: ../../library/os.rst:435 msgid "Return the id of the current process group." msgstr "" -#: ../../library/os.rst:427 +#: ../../library/os.rst:444 msgid "Return the current process id." msgstr "" -#: ../../library/os.rst:434 +#: ../../library/os.rst:453 msgid "" "Return the parent's process id. When the parent process has exited, on Unix " "the id returned is the one of the init process (1), on Windows it is still " "the same id, which may be already reused by another process." msgstr "" -#: ../../library/os.rst:440 +#: ../../library/os.rst:459 msgid "Added support for Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:448 +#: ../../library/os.rst:467 msgid "" "Get program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -590,42 +622,42 @@ msgid "" "user ID of the calling process." msgstr "" -#: ../../library/os.rst:465 +#: ../../library/os.rst:484 msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: ../../library/os.rst:474 +#: ../../library/os.rst:493 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " "effective, and saved user ids." msgstr "" -#: ../../library/os.rst:484 +#: ../../library/os.rst:503 msgid "" "Return a tuple (rgid, egid, sgid) denoting the current process's real, " "effective, and saved group ids." msgstr "" -#: ../../library/os.rst:496 +#: ../../library/os.rst:515 msgid "Return the current process's real user id." msgstr "" -#: ../../library/os.rst:503 +#: ../../library/os.rst:525 msgid "" "Call the system initgroups() to initialize the group access list with all of " "the groups of which the specified username is a member, plus the specified " "group id." msgstr "" -#: ../../library/os.rst:516 +#: ../../library/os.rst:538 msgid "" "Set the environment variable named *key* to the string *value*. Such " "changes to the environment affect subprocesses started with :func:`os." "system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:520 +#: ../../library/os.rst:542 msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " @@ -635,35 +667,35 @@ msgid "" "in their implementations." msgstr "" -#: ../../library/os.rst:528 +#: ../../library/os.rst:550 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`putenv`." msgstr "" -#: ../../library/os.rst:531 +#: ../../library/os.rst:553 msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." msgstr "" -#: ../../library/os.rst:533 +#: ../../library/os.rst:555 msgid "The function is now always available." msgstr "" -#: ../../library/os.rst:539 +#: ../../library/os.rst:561 msgid "Set the current process's effective group id." msgstr "" -#: ../../library/os.rst:546 +#: ../../library/os.rst:568 msgid "Set the current process's effective user id." msgstr "" -#: ../../library/os.rst:553 +#: ../../library/os.rst:575 msgid "Set the current process' group id." msgstr "" -#: ../../library/os.rst:560 +#: ../../library/os.rst:582 msgid "" "Set the list of supplemental group ids associated with the current process " "to *groups*. *groups* must be a sequence, and each element must be an " @@ -671,7 +703,7 @@ msgid "" "the superuser." msgstr "" -#: ../../library/os.rst:566 +#: ../../library/os.rst:588 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " "number of effective group ids, typically 16. See the documentation for :func:" @@ -679,21 +711,21 @@ msgid "" "calling setgroups()." msgstr "" -#: ../../library/os.rst:573 +#: ../../library/os.rst:595 msgid "" "Call the system call :c:func:`setpgrp` or ``setpgrp(0, 0)`` depending on " "which version is implemented (if any). See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:581 +#: ../../library/os.rst:603 msgid "" "Call the system call :c:func:`setpgid` to set the process group id of the " "process with id *pid* to the process group with id *pgrp*. See the Unix " "manual for the semantics." msgstr "" -#: ../../library/os.rst:592 +#: ../../library/os.rst:614 msgid "" "Set program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -706,113 +738,109 @@ msgid "" "scheduling." msgstr "" -#: ../../library/os.rst:609 +#: ../../library/os.rst:631 msgid "Set the current process's real and effective group ids." msgstr "" -#: ../../library/os.rst:616 +#: ../../library/os.rst:638 msgid "Set the current process's real, effective, and saved group ids." msgstr "" -#: ../../library/os.rst:625 +#: ../../library/os.rst:647 msgid "Set the current process's real, effective, and saved user ids." msgstr "" -#: ../../library/os.rst:634 +#: ../../library/os.rst:656 msgid "Set the current process's real and effective user ids." msgstr "" -#: ../../library/os.rst:641 +#: ../../library/os.rst:663 msgid "" "Call the system call :c:func:`getsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:648 +#: ../../library/os.rst:670 msgid "" "Call the system call :c:func:`setsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:657 +#: ../../library/os.rst:679 msgid "Set the current process's user id." msgstr "" -#: ../../library/os.rst:665 +#: ../../library/os.rst:687 msgid "" "Return the error message corresponding to the error code in *code*. On " "platforms where :c:func:`strerror` returns ``NULL`` when given an unknown " "error number, :exc:`ValueError` is raised." msgstr "" -#: ../../library/os.rst:672 +#: ../../library/os.rst:694 msgid "" "``True`` if the native OS type of the environment is bytes (eg. ``False`` on " "Windows)." msgstr "" -#: ../../library/os.rst:680 +#: ../../library/os.rst:702 msgid "Set the current numeric umask and return the previous umask." msgstr "" -#: ../../library/os.rst:689 +#: ../../library/os.rst:714 msgid "" "Returns information identifying the current operating system. The return " "value is an object with five attributes:" msgstr "" -#: ../../library/os.rst:692 +#: ../../library/os.rst:717 msgid ":attr:`sysname` - operating system name" msgstr ":attr:`sysname` - 作業系統名稱" -#: ../../library/os.rst:693 +#: ../../library/os.rst:718 msgid ":attr:`nodename` - name of machine on network (implementation-defined)" msgstr "" -#: ../../library/os.rst:694 +#: ../../library/os.rst:719 msgid ":attr:`release` - operating system release" msgstr "" -#: ../../library/os.rst:695 +#: ../../library/os.rst:720 msgid ":attr:`version` - operating system version" msgstr ":attr:`version` - 作業系統版本" -#: ../../library/os.rst:696 +#: ../../library/os.rst:721 msgid ":attr:`machine` - hardware identifier" msgstr "" -#: ../../library/os.rst:698 +#: ../../library/os.rst:723 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " "five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" "attr:`version`, and :attr:`machine` in that order." msgstr "" -#: ../../library/os.rst:703 +#: ../../library/os.rst:728 msgid "" "Some systems truncate :attr:`nodename` to 8 characters or to the leading " "component; a better way to get the hostname is :func:`socket.gethostname` " "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:709 -msgid ":ref:`Availability `: recent flavors of Unix." -msgstr ":ref:`適用 `:近期的 Unix。" - -#: ../../library/os.rst:710 ../../library/os.rst:4274 +#: ../../library/os.rst:735 ../../library/os.rst:4366 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:719 +#: ../../library/os.rst:744 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:723 +#: ../../library/os.rst:748 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -820,27 +848,27 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:728 +#: ../../library/os.rst:753 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" -#: ../../library/os.rst:730 +#: ../../library/os.rst:755 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:737 +#: ../../library/os.rst:762 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:739 +#: ../../library/os.rst:764 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:745 +#: ../../library/os.rst:770 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -848,16 +876,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:754 +#: ../../library/os.rst:779 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:756 +#: ../../library/os.rst:781 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:758 +#: ../../library/os.rst:783 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -867,7 +895,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:765 +#: ../../library/os.rst:790 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -875,11 +903,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:773 +#: ../../library/os.rst:798 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:777 +#: ../../library/os.rst:802 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -887,13 +915,13 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:785 +#: ../../library/os.rst:810 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:797 +#: ../../library/os.rst:822 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -903,7 +931,7 @@ msgid "" "attr:`~OSError.errno` set to :data:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:804 ../../library/os.rst:1452 +#: ../../library/os.rst:829 ../../library/os.rst:1513 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -911,50 +939,53 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:809 +#: ../../library/os.rst:834 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:813 -msgid "" -":ref:`Availability `: Linux kernel >= 4.5 or glibc >= 2.27." -msgstr "" +#: ../../library/os.rst:838 +msgid ":ref:`Availability `: Linux >= 4.5 with glibc >= 2.27." +msgstr ":ref:`適用 `:Linux 4.5 以上且具有 glibc 2.27 以上。" -#: ../../library/os.rst:819 +#: ../../library/os.rst:844 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:822 +#: ../../library/os.rst:847 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:825 +#: ../../library/os.rst:850 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:831 +#: ../../library/os.rst:856 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: ../../library/os.rst:834 +#: ../../library/os.rst:859 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:838 ../../library/os.rst:1040 +#: ../../library/os.rst:864 ../../library/os.rst:877 +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:分 WASI。" + +#: ../../library/os.rst:865 ../../library/os.rst:1089 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:844 +#: ../../library/os.rst:871 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -962,51 +993,59 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:849 +#: ../../library/os.rst:878 msgid "Add the optional *inheritable* parameter." msgstr "" -#: ../../library/os.rst:852 +#: ../../library/os.rst:881 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:858 +#: ../../library/os.rst:887 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:862 ../../library/os.rst:1842 ../../library/os.rst:1933 +#: ../../library/os.rst:891 ../../library/os.rst:1909 ../../library/os.rst:2003 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:869 +#: ../../library/os.rst:895 ../../library/os.rst:910 ../../library/os.rst:1001 +#: ../../library/os.rst:1475 ../../library/os.rst:1906 +#: ../../library/os.rst:1935 ../../library/os.rst:3097 +msgid "" +"The function is limited on Emscripten and WASI, see :ref:`wasm-availability` " +"for more information." +msgstr "" + +#: ../../library/os.rst:901 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: ../../library/os.rst:874 ../../library/os.rst:1864 ../../library/os.rst:1946 +#: ../../library/os.rst:906 ../../library/os.rst:1931 ../../library/os.rst:2016 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:881 +#: ../../library/os.rst:916 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:887 +#: ../../library/os.rst:922 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:892 +#: ../../library/os.rst:927 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1017,7 +1056,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:900 ../../library/os.rst:2195 +#: ../../library/os.rst:935 ../../library/os.rst:2265 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -1025,80 +1064,80 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:905 +#: ../../library/os.rst:940 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:912 +#: ../../library/os.rst:947 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:915 +#: ../../library/os.rst:950 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:919 ../../library/os.rst:2030 +#: ../../library/os.rst:954 ../../library/os.rst:2100 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:924 +#: ../../library/os.rst:959 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:933 +#: ../../library/os.rst:968 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`fsync` function; on Windows, the MS :c:func:`_commit` " "function." msgstr "" -#: ../../library/os.rst:936 +#: ../../library/os.rst:971 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:945 +#: ../../library/os.rst:980 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:949 +#: ../../library/os.rst:984 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." msgstr "" -#: ../../library/os.rst:953 ../../library/os.rst:3063 +#: ../../library/os.rst:988 ../../library/os.rst:3136 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:959 +#: ../../library/os.rst:994 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:962 +#: ../../library/os.rst:997 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "" "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`\\ 。" -#: ../../library/os.rst:971 +#: ../../library/os.rst:1009 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:977 +#: ../../library/os.rst:1015 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1106,17 +1145,24 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:983 +#: ../../library/os.rst:1021 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." msgstr "" -#: ../../library/os.rst:995 +#: ../../library/os.rst:1033 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1004 +#: ../../library/os.rst:1042 +msgid "" +"Prepare the tty of which fd is a file descriptor for a new login session. " +"Make the calling process a session leader; make the tty the controlling tty, " +"the stdin, the stdout, and the stderr of the calling process; close fd." +msgstr "" + +#: ../../library/os.rst:1053 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the " @@ -1126,19 +1172,19 @@ msgid "" "beginning." msgstr "" -#: ../../library/os.rst:1015 +#: ../../library/os.rst:1064 msgid "" "Parameters to the :func:`lseek` function. Their values are 0, 1, and 2, " "respectively." msgstr "" -#: ../../library/os.rst:1018 +#: ../../library/os.rst:1067 msgid "" "Some operating systems could support additional values, like :data:`os." "SEEK_HOLE` or :data:`os.SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1025 +#: ../../library/os.rst:1074 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1146,7 +1192,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1030 +#: ../../library/os.rst:1079 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1154,19 +1200,19 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1035 +#: ../../library/os.rst:1084 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1038 +#: ../../library/os.rst:1087 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." msgstr "" -#: ../../library/os.rst:1045 +#: ../../library/os.rst:1094 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1174,39 +1220,39 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1050 ../../library/os.rst:2071 -#: ../../library/os.rst:2139 ../../library/os.rst:2161 -#: ../../library/os.rst:2242 ../../library/os.rst:2273 +#: ../../library/os.rst:1099 ../../library/os.rst:2141 +#: ../../library/os.rst:2209 ../../library/os.rst:2231 +#: ../../library/os.rst:2312 ../../library/os.rst:2343 msgid "The *dir_fd* argument." msgstr "*dir_fd* 引數。" -#: ../../library/os.rst:1053 ../../library/os.rst:1372 -#: ../../library/os.rst:1531 ../../library/os.rst:4395 +#: ../../library/os.rst:1102 ../../library/os.rst:1421 +#: ../../library/os.rst:1592 ../../library/os.rst:4489 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/os.rst:1058 ../../library/os.rst:1739 -#: ../../library/os.rst:1771 ../../library/os.rst:1802 -#: ../../library/os.rst:1848 ../../library/os.rst:1882 -#: ../../library/os.rst:1922 ../../library/os.rst:1937 -#: ../../library/os.rst:1950 ../../library/os.rst:2009 -#: ../../library/os.rst:2038 ../../library/os.rst:2074 -#: ../../library/os.rst:2115 ../../library/os.rst:2142 -#: ../../library/os.rst:2164 ../../library/os.rst:2205 -#: ../../library/os.rst:2276 ../../library/os.rst:2295 -#: ../../library/os.rst:2381 ../../library/os.rst:2654 -#: ../../library/os.rst:2905 ../../library/os.rst:3066 -#: ../../library/os.rst:3082 ../../library/os.rst:3122 -#: ../../library/os.rst:3221 ../../library/os.rst:3282 -#: ../../library/os.rst:3465 ../../library/os.rst:3644 -#: ../../library/os.rst:4132 +#: ../../library/os.rst:1107 ../../library/os.rst:1803 +#: ../../library/os.rst:1835 ../../library/os.rst:1866 +#: ../../library/os.rst:1915 ../../library/os.rst:1952 +#: ../../library/os.rst:1992 ../../library/os.rst:2007 +#: ../../library/os.rst:2020 ../../library/os.rst:2079 +#: ../../library/os.rst:2108 ../../library/os.rst:2144 +#: ../../library/os.rst:2185 ../../library/os.rst:2212 +#: ../../library/os.rst:2234 ../../library/os.rst:2275 +#: ../../library/os.rst:2346 ../../library/os.rst:2365 +#: ../../library/os.rst:2451 ../../library/os.rst:2724 +#: ../../library/os.rst:2975 ../../library/os.rst:3139 +#: ../../library/os.rst:3155 ../../library/os.rst:3195 +#: ../../library/os.rst:3294 ../../library/os.rst:3355 +#: ../../library/os.rst:3539 ../../library/os.rst:3718 +#: ../../library/os.rst:4224 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1061 +#: ../../library/os.rst:1110 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1216,45 +1262,45 @@ msgid "" "on Windows." msgstr "" -#: ../../library/os.rst:1076 +#: ../../library/os.rst:1125 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1087 +#: ../../library/os.rst:1136 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1089 +#: ../../library/os.rst:1138 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1100 +#: ../../library/os.rst:1149 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1107 +#: ../../library/os.rst:1156 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1109 +#: ../../library/os.rst:1158 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1123 +#: ../../library/os.rst:1172 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1126 +#: ../../library/os.rst:1175 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1136 +#: ../../library/os.rst:1185 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1262,23 +1308,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1142 ../../library/os.rst:1168 -#: ../../library/os.rst:3829 -msgid ":ref:`Availability `: some flavors of Unix." -msgstr ":ref:`適用 `:部分的 Unix。" - -#: ../../library/os.rst:1143 ../../library/os.rst:1155 +#: ../../library/os.rst:1192 ../../library/os.rst:1204 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1149 +#: ../../library/os.rst:1198 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1161 +#: ../../library/os.rst:1210 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1286,13 +1327,17 @@ msgid "" "and writing, respectively." msgstr "" -#: ../../library/os.rst:1174 +#: ../../library/os.rst:1223 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1184 +#: ../../library/os.rst:1227 +msgid ":ref:`Availability `: Unix, not Emscripten." +msgstr ":ref:`適用 `:Unix、非 Emscripten。" + +#: ../../library/os.rst:1233 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1303,25 +1348,25 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1204 +#: ../../library/os.rst:1253 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1214 +#: ../../library/os.rst:1263 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1217 ../../library/os.rst:1361 +#: ../../library/os.rst:1266 ../../library/os.rst:1410 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1227 +#: ../../library/os.rst:1276 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1329,89 +1374,95 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: ../../library/os.rst:1232 ../../library/os.rst:1302 +#: ../../library/os.rst:1281 ../../library/os.rst:1351 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1235 +#: ../../library/os.rst:1284 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1236 +#: ../../library/os.rst:1285 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1238 ../../library/os.rst:1481 +#: ../../library/os.rst:1287 ../../library/os.rst:1542 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1241 ../../library/os.rst:1311 -#: ../../library/os.rst:1484 ../../library/os.rst:1546 +#: ../../library/os.rst:1290 ../../library/os.rst:1360 +#: ../../library/os.rst:1545 ../../library/os.rst:1607 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1244 +#: ../../library/os.rst:1293 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1249 +#: ../../library/os.rst:-1 +#, fuzzy msgid "" -":ref:`Availability `: Linux 2.6.30 and newer, FreeBSD 6.0 and " -"newer, OpenBSD 2.7 and newer, AIX 7.1 and newer. Using flags requires Linux " -"4.6 or newer." +":ref:`Availability `: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD " +">= 2.7, AIX >= 7.1." +msgstr "" +":ref:`適用 `:Linux 2.6.30 以上、FreeBSD 6.0 以上、OpenBSD 2.7 " +"以上、AIX 7.1 以上。" + +#: ../../library/os.rst:1297 ../../library/os.rst:1367 +msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1255 +#: ../../library/os.rst:1304 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1259 +#: ../../library/os.rst:1308 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :data:`errno." "EAGAIN`." msgstr "" -#: ../../library/os.rst:1264 -msgid ":ref:`Availability `: Linux 4.14 and newer." +#: ../../library/os.rst:1313 +msgid ":ref:`Availability `: Linux >= 4.14." msgstr ":ref:`適用 `:Linux 4.14 以上。" -#: ../../library/os.rst:1270 +#: ../../library/os.rst:1319 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1274 +#: ../../library/os.rst:1323 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1278 -msgid ":ref:`Availability `: Linux 4.6 and newer." +#: ../../library/os.rst:1327 +msgid ":ref:`Availability `: Linux >= 4.6." msgstr ":ref:`適用 `:Linux 4.6 以上。" -#: ../../library/os.rst:1284 +#: ../../library/os.rst:1333 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1287 ../../library/os.rst:1521 +#: ../../library/os.rst:1336 ../../library/os.rst:1582 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1296 +#: ../../library/os.rst:1345 msgid "" "Write the *buffers* contents to file descriptor *fd* at a offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" @@ -1420,50 +1471,43 @@ msgid "" "the second, and so on." msgstr "" -#: ../../library/os.rst:1305 +#: ../../library/os.rst:1354 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1306 +#: ../../library/os.rst:1355 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1307 +#: ../../library/os.rst:1356 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1309 +#: ../../library/os.rst:1358 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1314 +#: ../../library/os.rst:1363 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1319 -msgid "" -":ref:`Availability `: Linux 2.6.30 and newer, FreeBSD 6.0 and " -"newer, OpenBSD 2.7 and newer, AIX 7.1 and newer. Using flags requires Linux " -"4.7 or newer." -msgstr "" - -#: ../../library/os.rst:1325 +#: ../../library/os.rst:1374 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1329 ../../library/os.rst:1339 -msgid ":ref:`Availability `: Linux 4.7 and newer." +#: ../../library/os.rst:1378 ../../library/os.rst:1388 +msgid ":ref:`Availability `: Linux >= 4.7." msgstr ":ref:`適用 `:Linux 4.7 以上。" -#: ../../library/os.rst:1335 +#: ../../library/os.rst:1384 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1345 +#: ../../library/os.rst:1394 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1473,15 +1517,15 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1353 -msgid ":ref:`Availability `: Linux 4.16 and newer." +#: ../../library/os.rst:1402 +msgid ":ref:`Availability `: Linux >= 4.16." msgstr ":ref:`適用 `:Linux 4.16 以上。" -#: ../../library/os.rst:1359 +#: ../../library/os.rst:1408 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1366 +#: ../../library/os.rst:1415 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1490,26 +1534,26 @@ msgid "" "`~file.readline` methods." msgstr "" -#: ../../library/os.rst:1381 +#: ../../library/os.rst:1430 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1385 +#: ../../library/os.rst:1434 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: ../../library/os.rst:1388 +#: ../../library/os.rst:1437 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1391 +#: ../../library/os.rst:1440 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1517,52 +1561,59 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1395 +#: ../../library/os.rst:1444 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1398 +#: ../../library/os.rst:1447 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1401 +#: ../../library/os.rst:1450 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1408 +#: ../../library/os.rst:1457 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: ../../library/os.rst:1413 +#: ../../library/os.rst:1462 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1419 +#: ../../library/os.rst:1468 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: ../../library/os.rst:1422 +#: ../../library/os.rst:1471 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "" "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`\\ 。" -#: ../../library/os.rst:1433 +#: ../../library/os.rst:1485 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1443 +#: ../../library/os.rst:1494 +msgid "" +"Parameter to the :func:`sendfile` function, if the implementation supports " +"it. The data won't be cached in the virtual memory and will be freed " +"afterwards." +msgstr "" + +#: ../../library/os.rst:1504 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1574,7 +1625,7 @@ msgid "" "`~OSError.errno` set to :data:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1457 +#: ../../library/os.rst:1518 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1583,12 +1634,11 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1464 -msgid "" -":ref:`Availability `: Linux kernel >= 2.6.17 and glibc >= 2.5" -msgstr "" +#: ../../library/os.rst:1525 +msgid ":ref:`Availability `: Linux >= 2.6.17 with glibc >= 2.5" +msgstr ":ref:`適用 `:Linux 2.6.17 以上且具有 glibc 2.5 以上" -#: ../../library/os.rst:1476 +#: ../../library/os.rst:1537 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1596,30 +1646,34 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1494 +#: ../../library/os.rst:1555 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1502 +#: ../../library/os.rst:1558 ../../library/os.rst:1566 +msgid ":ref:`Availability `: Unix, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" + +#: ../../library/os.rst:1563 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1510 +#: ../../library/os.rst:1571 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1519 +#: ../../library/os.rst:1580 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1525 +#: ../../library/os.rst:1586 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1628,7 +1682,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1539 +#: ../../library/os.rst:1600 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1636,70 +1690,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1544 +#: ../../library/os.rst:1605 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1557 +#: ../../library/os.rst:1618 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1563 +#: ../../library/os.rst:1624 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1566 +#: ../../library/os.rst:1627 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1569 +#: ../../library/os.rst:1630 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1572 +#: ../../library/os.rst:1633 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1580 +#: ../../library/os.rst:1641 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1584 +#: ../../library/os.rst:1645 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1588 +#: ../../library/os.rst:1649 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1594 +#: ../../library/os.rst:1655 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1598 +#: ../../library/os.rst:1659 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1602 +#: ../../library/os.rst:1663 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1605 +#: ../../library/os.rst:1666 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -1710,40 +1764,46 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1615 +#: ../../library/os.rst:1674 +msgid "" +"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, the file " +"descriptor cannot be modified." +msgstr "" + +#: ../../library/os.rst:1679 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1619 +#: ../../library/os.rst:1683 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1623 +#: ../../library/os.rst:1687 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1625 ../../library/os.rst:1631 -#: ../../library/os.rst:3571 ../../library/os.rst:4167 -#: ../../library/os.rst:4213 +#: ../../library/os.rst:1689 ../../library/os.rst:1695 +#: ../../library/os.rst:3645 ../../library/os.rst:4259 +#: ../../library/os.rst:4305 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.rst:1629 +#: ../../library/os.rst:1693 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1637 +#: ../../library/os.rst:1701 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1639 +#: ../../library/os.rst:1703 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1644 +#: ../../library/os.rst:1708 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -1754,7 +1814,7 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1652 +#: ../../library/os.rst:1716 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -1762,13 +1822,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1657 +#: ../../library/os.rst:1721 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1662 +#: ../../library/os.rst:1726 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -1779,14 +1839,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1669 +#: ../../library/os.rst:1733 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1675 +#: ../../library/os.rst:1739 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -1795,14 +1855,14 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1681 +#: ../../library/os.rst:1745 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1689 +#: ../../library/os.rst:1753 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -1814,13 +1874,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1698 +#: ../../library/os.rst:1762 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1701 +#: ../../library/os.rst:1765 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -1829,7 +1889,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1709 +#: ../../library/os.rst:1773 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -1838,279 +1898,279 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:1720 +#: ../../library/os.rst:1784 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:1732 +#: ../../library/os.rst:1796 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:1736 +#: ../../library/os.rst:1800 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*\\ 、\\ *effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:1748 +#: ../../library/os.rst:1812 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:1757 +#: ../../library/os.rst:1821 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:1759 +#: ../../library/os.rst:1823 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:1762 +#: ../../library/os.rst:1826 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:1765 ../../library/os.rst:1892 +#: ../../library/os.rst:1829 ../../library/os.rst:1962 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" -#: ../../library/os.rst:1767 +#: ../../library/os.rst:1831 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:1777 +#: ../../library/os.rst:1841 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: ../../library/os.rst:1780 +#: ../../library/os.rst:1844 msgid ":data:`stat.UF_NODUMP`" msgstr ":data:`stat.UF_NODUMP`" -#: ../../library/os.rst:1781 +#: ../../library/os.rst:1845 msgid ":data:`stat.UF_IMMUTABLE`" msgstr ":data:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:1782 +#: ../../library/os.rst:1846 msgid ":data:`stat.UF_APPEND`" msgstr ":data:`stat.UF_APPEND`" -#: ../../library/os.rst:1783 +#: ../../library/os.rst:1847 msgid ":data:`stat.UF_OPAQUE`" msgstr ":data:`stat.UF_OPAQUE`" -#: ../../library/os.rst:1784 +#: ../../library/os.rst:1848 msgid ":data:`stat.UF_NOUNLINK`" msgstr ":data:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:1785 +#: ../../library/os.rst:1849 msgid ":data:`stat.UF_COMPRESSED`" msgstr ":data:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:1786 +#: ../../library/os.rst:1850 msgid ":data:`stat.UF_HIDDEN`" msgstr ":data:`stat.UF_HIDDEN`" -#: ../../library/os.rst:1787 +#: ../../library/os.rst:1851 msgid ":data:`stat.SF_ARCHIVED`" msgstr ":data:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:1788 +#: ../../library/os.rst:1852 msgid ":data:`stat.SF_IMMUTABLE`" msgstr ":data:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:1789 +#: ../../library/os.rst:1853 msgid ":data:`stat.SF_APPEND`" msgstr ":data:`stat.SF_APPEND`" -#: ../../library/os.rst:1790 +#: ../../library/os.rst:1854 msgid ":data:`stat.SF_NOUNLINK`" msgstr ":data:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:1791 +#: ../../library/os.rst:1855 msgid ":data:`stat.SF_SNAPSHOT`" msgstr ":data:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:1793 +#: ../../library/os.rst:1857 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1795 ../../library/os.rst:1918 +#: ../../library/os.rst:1859 ../../library/os.rst:1988 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." msgstr "" -#: ../../library/os.rst:1799 +#: ../../library/os.rst:1863 msgid "The *follow_symlinks* argument." msgstr "*follow_symlinks* 引數。" -#: ../../library/os.rst:1808 +#: ../../library/os.rst:1872 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:1812 +#: ../../library/os.rst:1876 msgid ":data:`stat.S_ISUID`" msgstr ":data:`stat.S_ISUID`" -#: ../../library/os.rst:1813 +#: ../../library/os.rst:1877 msgid ":data:`stat.S_ISGID`" msgstr ":data:`stat.S_ISGID`" -#: ../../library/os.rst:1814 +#: ../../library/os.rst:1878 msgid ":data:`stat.S_ENFMT`" msgstr ":data:`stat.S_ENFMT`" -#: ../../library/os.rst:1815 +#: ../../library/os.rst:1879 msgid ":data:`stat.S_ISVTX`" msgstr ":data:`stat.S_ISVTX`" -#: ../../library/os.rst:1816 +#: ../../library/os.rst:1880 msgid ":data:`stat.S_IREAD`" msgstr ":data:`stat.S_IREAD`" -#: ../../library/os.rst:1817 +#: ../../library/os.rst:1881 msgid ":data:`stat.S_IWRITE`" msgstr ":data:`stat.S_IWRITE`" -#: ../../library/os.rst:1818 +#: ../../library/os.rst:1882 msgid ":data:`stat.S_IEXEC`" msgstr ":data:`stat.S_IEXEC`" -#: ../../library/os.rst:1819 +#: ../../library/os.rst:1883 msgid ":data:`stat.S_IRWXU`" msgstr ":data:`stat.S_IRWXU`" -#: ../../library/os.rst:1820 +#: ../../library/os.rst:1884 msgid ":data:`stat.S_IRUSR`" msgstr ":data:`stat.S_IRUSR`" -#: ../../library/os.rst:1821 +#: ../../library/os.rst:1885 msgid ":data:`stat.S_IWUSR`" msgstr ":data:`stat.S_IWUSR`" -#: ../../library/os.rst:1822 +#: ../../library/os.rst:1886 msgid ":data:`stat.S_IXUSR`" msgstr ":data:`stat.S_IXUSR`" -#: ../../library/os.rst:1823 +#: ../../library/os.rst:1887 msgid ":data:`stat.S_IRWXG`" msgstr ":data:`stat.S_IRWXG`" -#: ../../library/os.rst:1824 +#: ../../library/os.rst:1888 msgid ":data:`stat.S_IRGRP`" msgstr ":data:`stat.S_IRGRP`" -#: ../../library/os.rst:1825 +#: ../../library/os.rst:1889 msgid ":data:`stat.S_IWGRP`" msgstr ":data:`stat.S_IWGRP`" -#: ../../library/os.rst:1826 +#: ../../library/os.rst:1890 msgid ":data:`stat.S_IXGRP`" msgstr ":data:`stat.S_IXGRP`" -#: ../../library/os.rst:1827 +#: ../../library/os.rst:1891 msgid ":data:`stat.S_IRWXO`" msgstr ":data:`stat.S_IRWXO`" -#: ../../library/os.rst:1828 +#: ../../library/os.rst:1892 msgid ":data:`stat.S_IROTH`" msgstr ":data:`stat.S_IROTH`" -#: ../../library/os.rst:1829 +#: ../../library/os.rst:1893 msgid ":data:`stat.S_IWOTH`" msgstr ":data:`stat.S_IWOTH`" -#: ../../library/os.rst:1830 +#: ../../library/os.rst:1894 msgid ":data:`stat.S_IXOTH`" msgstr ":data:`stat.S_IXOTH`" -#: ../../library/os.rst:1832 ../../library/os.rst:1857 -#: ../../library/os.rst:3112 +#: ../../library/os.rst:1896 ../../library/os.rst:1924 +#: ../../library/os.rst:3185 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: ../../library/os.rst:1838 +#: ../../library/os.rst:1902 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " "or a corresponding integer value). All other bits are ignored." msgstr "" -#: ../../library/os.rst:1844 ../../library/os.rst:1868 +#: ../../library/os.rst:1911 ../../library/os.rst:1938 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:1854 +#: ../../library/os.rst:1921 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:1861 +#: ../../library/os.rst:1928 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:1872 +#: ../../library/os.rst:1942 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1878 +#: ../../library/os.rst:1948 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:1888 +#: ../../library/os.rst:1958 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:1899 +#: ../../library/os.rst:1969 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:1904 +#: ../../library/os.rst:1974 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:1906 +#: ../../library/os.rst:1976 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:1914 +#: ../../library/os.rst:1984 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:1928 +#: ../../library/os.rst:1998 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2118,44 +2178,44 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:1942 +#: ../../library/os.rst:2012 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:1956 +#: ../../library/os.rst:2026 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:1958 +#: ../../library/os.rst:2028 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" "`not following symlinks `." msgstr "" -#: ../../library/os.rst:1962 +#: ../../library/os.rst:2032 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." msgstr "" -#: ../../library/os.rst:1966 +#: ../../library/os.rst:2036 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:1969 +#: ../../library/os.rst:2039 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* arguments." msgstr "增加 *src_dir_fd*\\ 、\\ *dst_dir_fd* 與 *follow_symlinks* 引數。" -#: ../../library/os.rst:1972 ../../library/os.rst:2325 -#: ../../library/os.rst:2362 ../../library/os.rst:3034 +#: ../../library/os.rst:2042 ../../library/os.rst:2395 +#: ../../library/os.rst:2432 ../../library/os.rst:3107 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:1978 +#: ../../library/os.rst:2048 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2164,7 +2224,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:1984 +#: ../../library/os.rst:2054 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2172,73 +2232,73 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:1989 ../../library/os.rst:2410 +#: ../../library/os.rst:2059 ../../library/os.rst:2480 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:1992 +#: ../../library/os.rst:2062 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" -#: ../../library/os.rst:1995 +#: ../../library/os.rst:2065 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:1999 +#: ../../library/os.rst:2069 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2003 +#: ../../library/os.rst:2073 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2006 ../../library/os.rst:2896 +#: ../../library/os.rst:2076 ../../library/os.rst:2966 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2015 +#: ../../library/os.rst:2085 msgid "" "Perform the equivalent of an :c:func:`lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2019 +#: ../../library/os.rst:2089 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: ../../library/os.rst:2022 +#: ../../library/os.rst:2092 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2025 ../../library/os.rst:2063 -#: ../../library/os.rst:2128 ../../library/os.rst:2156 -#: ../../library/os.rst:2230 +#: ../../library/os.rst:2095 ../../library/os.rst:2133 +#: ../../library/os.rst:2198 ../../library/os.rst:2226 +#: ../../library/os.rst:2300 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2032 ../../library/os.rst:2239 -#: ../../library/os.rst:3027 +#: ../../library/os.rst:2102 ../../library/os.rst:2309 +#: ../../library/os.rst:3100 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2035 +#: ../../library/os.rst:2105 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:2041 +#: ../../library/os.rst:2111 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2246,18 +2306,18 @@ msgid "" "stat`." msgstr "" -#: ../../library/os.rst:2050 +#: ../../library/os.rst:2120 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2052 +#: ../../library/os.rst:2122 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2057 +#: ../../library/os.rst:2127 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2266,25 +2326,25 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2066 +#: ../../library/os.rst:2136 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2069 ../../library/os.rst:2103 +#: ../../library/os.rst:2139 ../../library/os.rst:2173 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:2084 +#: ../../library/os.rst:2154 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2087 +#: ../../library/os.rst:2157 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2293,27 +2353,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2093 +#: ../../library/os.rst:2163 msgid "" -"If *exist_ok* is ``False`` (the default), an :exc:`FileExistsError` is " -"raised if the target directory already exists." +"If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " +"if the target directory already exists." msgstr "" -#: ../../library/os.rst:2098 +#: ../../library/os.rst:2168 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2101 +#: ../../library/os.rst:2171 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2105 +#: ../../library/os.rst:2175 msgid "The *exist_ok* parameter." msgstr "*exist_ok* 參數。" -#: ../../library/os.rst:2110 +#: ../../library/os.rst:2180 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2321,19 +2381,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2188 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2125 +#: ../../library/os.rst:2195 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2131 +#: ../../library/os.rst:2201 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2343,7 +2403,7 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2148 +#: ../../library/os.rst:2218 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2354,23 +2414,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2170 +#: ../../library/os.rst:2240 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:type:`stat`)." msgstr "" -#: ../../library/os.rst:2176 +#: ../../library/os.rst:2246 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:type:`stat`)." msgstr "" -#: ../../library/os.rst:2182 +#: ../../library/os.rst:2252 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2187 +#: ../../library/os.rst:2257 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2381,20 +2441,20 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2200 ../../library/os.rst:2889 -#: ../../library/os.rst:3055 +#: ../../library/os.rst:2270 ../../library/os.rst:2959 +#: ../../library/os.rst:3128 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2211 +#: ../../library/os.rst:2281 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2220 +#: ../../library/os.rst:2290 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2402,7 +2462,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2225 +#: ../../library/os.rst:2295 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2410,42 +2470,42 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2233 +#: ../../library/os.rst:2303 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: ../../library/os.rst:2245 +#: ../../library/os.rst:2315 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2248 +#: ../../library/os.rst:2318 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2251 +#: ../../library/os.rst:2321 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2258 +#: ../../library/os.rst:2328 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`IsADirectoryError` is raised. Use :func:`rmdir` to remove directories. If " "the file does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2262 ../../library/os.rst:2373 -#: ../../library/os.rst:3009 +#: ../../library/os.rst:2332 ../../library/os.rst:2443 +#: ../../library/os.rst:3079 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2265 +#: ../../library/os.rst:2335 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2453,18 +2513,18 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2269 +#: ../../library/os.rst:2339 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2271 ../../library/os.rst:2293 -#: ../../library/os.rst:3077 +#: ../../library/os.rst:2341 ../../library/os.rst:2363 +#: ../../library/os.rst:3150 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:2284 +#: ../../library/os.rst:2354 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2476,17 +2536,17 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2301 +#: ../../library/os.rst:2371 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2304 +#: ../../library/os.rst:2374 msgid "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised." msgstr "" -#: ../../library/os.rst:2306 +#: ../../library/os.rst:2376 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2498,30 +2558,30 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2315 ../../library/os.rst:2355 +#: ../../library/os.rst:2385 ../../library/os.rst:2425 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2318 +#: ../../library/os.rst:2388 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: ../../library/os.rst:2320 ../../library/os.rst:2341 -#: ../../library/os.rst:2358 +#: ../../library/os.rst:2390 ../../library/os.rst:2411 +#: ../../library/os.rst:2428 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." msgstr "" -#: ../../library/os.rst:2322 +#: ../../library/os.rst:2392 msgid "The *src_dir_fd* and *dst_dir_fd* arguments." msgstr "" -#: ../../library/os.rst:2331 +#: ../../library/os.rst:2401 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -2530,17 +2590,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2338 +#: ../../library/os.rst:2408 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2343 +#: ../../library/os.rst:2413 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2349 +#: ../../library/os.rst:2419 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -2549,25 +2609,25 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2368 +#: ../../library/os.rst:2438 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " -"not empty, an :exc:`FileNotFoundError` or an :exc:`OSError` is raised " +"not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " "respectively. In order to remove whole directory trees, :func:`shutil." "rmtree` can be used." msgstr "" -#: ../../library/os.rst:2376 +#: ../../library/os.rst:2446 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:2378 ../../library/os.rst:3079 +#: ../../library/os.rst:2448 ../../library/os.rst:3152 msgid "The *dir_fd* parameter." msgstr "*dir_fd* 參數。" -#: ../../library/os.rst:2387 +#: ../../library/os.rst:2457 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -2577,7 +2637,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2394 +#: ../../library/os.rst:2464 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -2589,7 +2649,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: ../../library/os.rst:2404 +#: ../../library/os.rst:2474 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -2598,30 +2658,30 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2413 +#: ../../library/os.rst:2483 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" -#: ../../library/os.rst:2415 +#: ../../library/os.rst:2485 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: ../../library/os.rst:2420 +#: ../../library/os.rst:2490 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2422 +#: ../../library/os.rst:2492 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2429 +#: ../../library/os.rst:2499 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -2629,7 +2689,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2441 +#: ../../library/os.rst:2511 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -2640,7 +2700,7 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: ../../library/os.rst:2453 +#: ../../library/os.rst:2523 msgid "" "Added support for the :term:`context manager` protocol and the :func:" "`~scandir.close()` method. If a :func:`scandir` iterator is neither " @@ -2648,28 +2708,28 @@ msgid "" "its destructor." msgstr "" -#: ../../library/os.rst:2459 +#: ../../library/os.rst:2529 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2461 +#: ../../library/os.rst:2531 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: ../../library/os.rst:2467 +#: ../../library/os.rst:2537 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2470 +#: ../../library/os.rst:2540 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2474 +#: ../../library/os.rst:2544 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -2677,7 +2737,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2479 +#: ../../library/os.rst:2549 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -2685,29 +2745,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2484 +#: ../../library/os.rst:2554 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2487 +#: ../../library/os.rst:2557 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2491 +#: ../../library/os.rst:2561 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2494 +#: ../../library/os.rst:2564 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2500 +#: ../../library/os.rst:2570 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -2717,51 +2777,51 @@ msgid "" "attribute." msgstr "" -#: ../../library/os.rst:2507 +#: ../../library/os.rst:2577 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2513 +#: ../../library/os.rst:2583 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2515 +#: ../../library/os.rst:2585 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2519 +#: ../../library/os.rst:2589 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2524 +#: ../../library/os.rst:2594 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2528 +#: ../../library/os.rst:2598 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2532 +#: ../../library/os.rst:2602 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2536 +#: ../../library/os.rst:2606 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -2771,46 +2831,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2543 ../../library/os.rst:2573 +#: ../../library/os.rst:2613 ../../library/os.rst:2643 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2548 +#: ../../library/os.rst:2618 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2552 +#: ../../library/os.rst:2622 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2556 +#: ../../library/os.rst:2626 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2561 +#: ../../library/os.rst:2631 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2565 +#: ../../library/os.rst:2635 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2568 +#: ../../library/os.rst:2638 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -2818,35 +2878,35 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2578 +#: ../../library/os.rst:2648 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2582 +#: ../../library/os.rst:2652 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2587 +#: ../../library/os.rst:2657 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2591 +#: ../../library/os.rst:2661 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2595 +#: ../../library/os.rst:2665 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -2854,13 +2914,13 @@ msgid "" "``is_file()``, ``is_symlink()`` and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2603 +#: ../../library/os.rst:2673 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2610 +#: ../../library/os.rst:2680 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -2869,21 +2929,21 @@ msgid "" "`stat_result` object." msgstr "" -#: ../../library/os.rst:2616 +#: ../../library/os.rst:2686 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:2619 ../../library/os.rst:3444 -#: ../../library/os.rst:3460 ../../library/os.rst:3476 -#: ../../library/os.rst:3496 +#: ../../library/os.rst:2689 ../../library/os.rst:3518 +#: ../../library/os.rst:3534 ../../library/os.rst:3550 +#: ../../library/os.rst:3570 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2622 +#: ../../library/os.rst:2692 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -2897,24 +2957,24 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:2635 ../../library/os.rst:3364 +#: ../../library/os.rst:2705 ../../library/os.rst:3438 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/os.rst:2648 +#: ../../library/os.rst:2718 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:2650 +#: ../../library/os.rst:2720 msgid "" "Added the *dir_fd* and *follow_symlinks* arguments, specifying a file " "descriptor instead of a path." msgstr "" -#: ../../library/os.rst:2657 +#: ../../library/os.rst:2727 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -2924,100 +2984,100 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:2668 +#: ../../library/os.rst:2738 msgid "" "Object whose attributes correspond roughly to the members of the :c:type:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:2672 +#: ../../library/os.rst:2742 msgid "Attributes:" msgstr "" -#: ../../library/os.rst:2676 +#: ../../library/os.rst:2746 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:2680 +#: ../../library/os.rst:2750 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:2683 +#: ../../library/os.rst:2753 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:2684 +#: ../../library/os.rst:2754 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:2690 +#: ../../library/os.rst:2760 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:2694 +#: ../../library/os.rst:2764 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:2698 +#: ../../library/os.rst:2768 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:2702 +#: ../../library/os.rst:2772 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:2706 +#: ../../library/os.rst:2776 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:2710 +#: ../../library/os.rst:2780 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:2714 +#: ../../library/os.rst:2784 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:2718 +#: ../../library/os.rst:2788 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:2722 ../../library/os.rst:2738 +#: ../../library/os.rst:2792 ../../library/os.rst:2808 msgid "Platform dependent:" msgstr "" -#: ../../library/os.rst:2724 ../../library/os.rst:2740 +#: ../../library/os.rst:2794 ../../library/os.rst:2810 msgid "the time of most recent metadata change on Unix," msgstr "" -#: ../../library/os.rst:2725 +#: ../../library/os.rst:2795 msgid "the time of creation on Windows, expressed in seconds." msgstr "" -#: ../../library/os.rst:2729 +#: ../../library/os.rst:2799 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:2733 +#: ../../library/os.rst:2803 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:2741 +#: ../../library/os.rst:2811 msgid "" "the time of creation on Windows, expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:2746 +#: ../../library/os.rst:2816 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, " "and :attr:`st_ctime` attributes depend on the operating system and the file " @@ -3026,7 +3086,7 @@ msgid "" "only 1-day resolution. See your operating system documentation for details." msgstr "" -#: ../../library/os.rst:2753 +#: ../../library/os.rst:2823 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, and :attr:" "`st_ctime_ns` are always expressed in nanoseconds, many systems do not " @@ -3037,78 +3097,78 @@ msgid "" "attr:`st_atime_ns`, :attr:`st_mtime_ns`, and :attr:`st_ctime_ns`." msgstr "" -#: ../../library/os.rst:2762 +#: ../../library/os.rst:2832 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:2767 +#: ../../library/os.rst:2837 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:2772 +#: ../../library/os.rst:2842 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:2777 +#: ../../library/os.rst:2847 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:2781 +#: ../../library/os.rst:2851 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:2783 +#: ../../library/os.rst:2853 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:2788 +#: ../../library/os.rst:2858 msgid "File generation number." msgstr "" -#: ../../library/os.rst:2792 +#: ../../library/os.rst:2862 msgid "Time of file creation." msgstr "" -#: ../../library/os.rst:2794 +#: ../../library/os.rst:2864 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:2799 +#: ../../library/os.rst:2869 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:2802 +#: ../../library/os.rst:2872 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:2806 +#: ../../library/os.rst:2876 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:2810 +#: ../../library/os.rst:2880 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:2814 +#: ../../library/os.rst:2884 msgid "File type." msgstr "" -#: ../../library/os.rst:2816 +#: ../../library/os.rst:2886 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:2820 +#: ../../library/os.rst:2890 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:" @@ -3116,21 +3176,21 @@ msgid "" "mod:`stat` module." msgstr "" -#: ../../library/os.rst:2827 +#: ../../library/os.rst:2897 msgid "" "When :attr:`st_file_attributes` has the ``FILE_ATTRIBUTE_REPARSE_POINT`` " "set, this field contains the tag identifying the type of reparse point. See " "the ``IO_REPARSE_TAG_*`` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:2831 +#: ../../library/os.rst:2901 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:type:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:2835 +#: ../../library/os.rst:2905 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3142,35 +3202,35 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: ../../library/os.rst:2844 +#: ../../library/os.rst:2914 msgid "" "Added the :attr:`st_atime_ns`, :attr:`st_mtime_ns`, and :attr:`st_ctime_ns` " "members." msgstr "" -#: ../../library/os.rst:2848 +#: ../../library/os.rst:2918 msgid "Added the :attr:`st_file_attributes` member on Windows." msgstr "" -#: ../../library/os.rst:2851 +#: ../../library/os.rst:2921 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:2855 +#: ../../library/os.rst:2925 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:2858 +#: ../../library/os.rst:2928 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "" -#: ../../library/os.rst:2861 +#: ../../library/os.rst:2931 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:2868 +#: ../../library/os.rst:2938 msgid "" "Perform a :c:func:`statvfs` system call on the given path. The return value " "is an object whose attributes describe the filesystem on the given path, and " @@ -3180,7 +3240,7 @@ msgid "" "`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:2875 +#: ../../library/os.rst:2945 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3188,7 +3248,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:2880 +#: ../../library/os.rst:2950 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3201,11 +3261,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: ../../library/os.rst:2893 +#: ../../library/os.rst:2963 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:2899 +#: ../../library/os.rst:2969 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3213,11 +3273,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:2908 +#: ../../library/os.rst:2978 msgid "Added :attr:`f_fsid`." msgstr "新增 :attr:`f_fsid`\\ 。" -#: ../../library/os.rst:2914 +#: ../../library/os.rst:2984 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3229,7 +3289,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:2924 +#: ../../library/os.rst:2994 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3237,13 +3297,13 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:2931 +#: ../../library/os.rst:3001 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:2939 +#: ../../library/os.rst:3009 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3252,19 +3312,19 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:2945 +#: ../../library/os.rst:3015 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:2950 +#: ../../library/os.rst:3020 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:2958 +#: ../../library/os.rst:3028 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3273,7 +3333,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:2965 +#: ../../library/os.rst:3035 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3282,7 +3342,7 @@ msgid "" "platform::" msgstr "" -#: ../../library/os.rst:2978 +#: ../../library/os.rst:3048 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3295,7 +3355,7 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:2988 +#: ../../library/os.rst:3058 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3304,11 +3364,11 @@ msgid "" "stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3001 +#: ../../library/os.rst:3071 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3003 +#: ../../library/os.rst:3073 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3318,7 +3378,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3014 +#: ../../library/os.rst:3084 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3326,83 +3386,83 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3020 +#: ../../library/os.rst:3090 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3023 +#: ../../library/os.rst:3093 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:3030 +#: ../../library/os.rst:3103 msgid "" "Added the *dir_fd* argument, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3037 +#: ../../library/os.rst:3110 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3043 +#: ../../library/os.rst:3116 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3052 +#: ../../library/os.rst:3125 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3057 +#: ../../library/os.rst:3130 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." msgstr "" -#: ../../library/os.rst:3072 +#: ../../library/os.rst:3145 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3088 +#: ../../library/os.rst:3161 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3090 +#: ../../library/os.rst:3163 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3093 +#: ../../library/os.rst:3166 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3096 +#: ../../library/os.rst:3169 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3099 +#: ../../library/os.rst:3172 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3103 +#: ../../library/os.rst:3176 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3105 +#: ../../library/os.rst:3178 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -3412,19 +3472,19 @@ msgid "" "`utime`." msgstr "" -#: ../../library/os.rst:3116 +#: ../../library/os.rst:3189 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:3118 +#: ../../library/os.rst:3191 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3132 +#: ../../library/os.rst:3205 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -3432,7 +3492,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3137 +#: ../../library/os.rst:3210 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -3446,7 +3506,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3148 +#: ../../library/os.rst:3221 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -3457,7 +3517,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3156 +#: ../../library/os.rst:3229 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -3470,7 +3530,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3165 +#: ../../library/os.rst:3238 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -3480,66 +3540,66 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3171 +#: ../../library/os.rst:3244 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3177 +#: ../../library/os.rst:3250 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3183 +#: ../../library/os.rst:3256 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3187 ../../library/os.rst:3248 +#: ../../library/os.rst:3260 ../../library/os.rst:3321 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " "under any CVS subdirectory::" msgstr "" -#: ../../library/os.rst:3200 +#: ../../library/os.rst:3273 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3215 +#: ../../library/os.rst:3288 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." msgstr "" -#: ../../library/os.rst:3217 +#: ../../library/os.rst:3290 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3231 +#: ../../library/os.rst:3304 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3234 +#: ../../library/os.rst:3307 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3237 +#: ../../library/os.rst:3310 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -3547,30 +3607,30 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3244 +#: ../../library/os.rst:3317 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3261 +#: ../../library/os.rst:3334 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3276 +#: ../../library/os.rst:3349 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." msgstr "" -#: ../../library/os.rst:3285 +#: ../../library/os.rst:3358 msgid "Added support for :class:`bytes` paths." msgstr "" -#: ../../library/os.rst:3291 +#: ../../library/os.rst:3364 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -3578,7 +3638,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3296 +#: ../../library/os.rst:3369 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -3588,23 +3648,24 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3304 -msgid "" -":ref:`Availability `: Linux 3.17 or newer with glibc 2.27 or " -"newer." -msgstr "" +#: ../../library/os.rst:3377 +msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27." +msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上。" -#: ../../library/os.rst:3326 +#: ../../library/os.rst:3399 msgid "These flags can be passed to :func:`memfd_create`." msgstr "" -#: ../../library/os.rst:3330 -msgid "" -":ref:`Availability `: Linux 3.17 or newer with glibc 2.27 or " -"newer. The ``MFD_HUGE*`` flags are only available since Linux 4.14." +#: ../../library/os.rst:-1 +#, fuzzy +msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27" +msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上" + +#: ../../library/os.rst:3403 +msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "" -#: ../../library/os.rst:3336 +#: ../../library/os.rst:3410 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -3613,7 +3674,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3342 +#: ../../library/os.rst:3416 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be an 32 bit unsigned integer. Please note that the initial value is limited " @@ -3621,91 +3682,87 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3347 +#: ../../library/os.rst:3421 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3350 +#: ../../library/os.rst:3424 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3353 +#: ../../library/os.rst:3427 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3357 +#: ../../library/os.rst:3431 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3360 +#: ../../library/os.rst:3434 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3382 -msgid "" -":ref:`Availability `: Linux 2.6.27 or newer with glibc 2.8 or " -"newer." -msgstr "" +#: ../../library/os.rst:3456 +msgid ":ref:`Availability `: Linux >= 2.6.27 with glibc >= 2.8" +msgstr ":ref:`適用 `:Linux 2.6.27 以上且具有 glibc 2.8 以上" -#: ../../library/os.rst:3387 +#: ../../library/os.rst:3461 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3391 ../../library/os.rst:3400 -#: ../../library/os.rst:3408 ../../library/os.rst:3417 -msgid ":ref:`Availability `: See :func:`eventfd`" -msgstr ":ref:`適用 `:請見 :func:`eventfd`" +#: ../../library/os.rst:3465 ../../library/os.rst:3474 +#: ../../library/os.rst:3482 ../../library/os.rst:3491 +msgid ":ref:`Availability `: Linux >= 2.6.27" +msgstr ":ref:`適用 `:Linux 2.6.27 以上" -#: ../../library/os.rst:3396 +#: ../../library/os.rst:3470 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3405 +#: ../../library/os.rst:3479 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3413 +#: ../../library/os.rst:3487 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3422 +#: ../../library/os.rst:3496 msgid "" "Provide semaphore-like semantics for reads from a :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3426 -msgid "" -":ref:`Availability `: Linux 2.6.30 or newer with glibc 2.8 or " -"newer." -msgstr "" +#: ../../library/os.rst:3500 +msgid ":ref:`Availability `: Linux >= 2.6.30" +msgstr ":ref:`適用 `:Linux 2.6.30 以上" -#: ../../library/os.rst:3431 +#: ../../library/os.rst:3505 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:3435 +#: ../../library/os.rst:3509 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:3439 +#: ../../library/os.rst:3513 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -3713,18 +3770,18 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:3447 +#: ../../library/os.rst:3521 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." msgstr "" -#: ../../library/os.rst:3449 ../../library/os.rst:3481 -#: ../../library/os.rst:3506 +#: ../../library/os.rst:3523 ../../library/os.rst:3555 +#: ../../library/os.rst:3580 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:3455 +#: ../../library/os.rst:3529 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -3732,13 +3789,13 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:3463 +#: ../../library/os.rst:3537 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" -#: ../../library/os.rst:3471 +#: ../../library/os.rst:3545 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -3746,13 +3803,13 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:3479 +#: ../../library/os.rst:3553 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." msgstr "" -#: ../../library/os.rst:3487 +#: ../../library/os.rst:3561 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -3764,45 +3821,45 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:3501 +#: ../../library/os.rst:3575 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:3504 +#: ../../library/os.rst:3578 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." msgstr "" -#: ../../library/os.rst:3512 +#: ../../library/os.rst:3586 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:3518 +#: ../../library/os.rst:3592 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:3524 +#: ../../library/os.rst:3598 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:3531 +#: ../../library/os.rst:3605 msgid "Process Management" msgstr "" -#: ../../library/os.rst:3533 +#: ../../library/os.rst:3607 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:3535 +#: ../../library/os.rst:3609 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -3813,7 +3870,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:3546 +#: ../../library/os.rst:3620 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -3822,37 +3879,37 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:3555 +#: ../../library/os.rst:3629 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:3557 +#: ../../library/os.rst:3631 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:3561 +#: ../../library/os.rst:3635 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:3564 +#: ../../library/os.rst:3638 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:3568 +#: ../../library/os.rst:3642 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." msgstr "" -#: ../../library/os.rst:3572 +#: ../../library/os.rst:3646 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -3860,14 +3917,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:3579 +#: ../../library/os.rst:3653 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:3594 +#: ../../library/os.rst:3668 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -3875,7 +3932,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:3599 +#: ../../library/os.rst:3673 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -3883,7 +3940,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:3605 +#: ../../library/os.rst:3679 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -3896,7 +3953,7 @@ msgid "" "enforced." msgstr "" -#: ../../library/os.rst:3614 +#: ../../library/os.rst:3688 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -3909,7 +3966,7 @@ msgid "" "absolute or relative path." msgstr "" -#: ../../library/os.rst:3624 +#: ../../library/os.rst:3698 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -3919,7 +3976,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:3631 +#: ../../library/os.rst:3705 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -3928,31 +3985,31 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:3636 +#: ../../library/os.rst:3710 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." msgstr "" -#: ../../library/os.rst:3640 +#: ../../library/os.rst:3714 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:3649 +#: ../../library/os.rst:3723 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:3654 +#: ../../library/os.rst:3728 msgid "" "The standard way to exit is ``sys.exit(n)``. :func:`_exit` should normally " "only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:3657 +#: ../../library/os.rst:3731 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -3960,123 +4017,125 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:3663 +#: ../../library/os.rst:3737 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:3670 -msgid "Exit code that means no error occurred." +#: ../../library/os.rst:3744 +msgid "" +"Exit code that means no error occurred. May be taken from the defined value " +"of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:3677 +#: ../../library/os.rst:3752 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:3685 +#: ../../library/os.rst:3760 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:3692 +#: ../../library/os.rst:3767 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:3699 +#: ../../library/os.rst:3774 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:3706 +#: ../../library/os.rst:3781 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:3713 +#: ../../library/os.rst:3788 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:3720 +#: ../../library/os.rst:3795 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:3727 +#: ../../library/os.rst:3802 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:3735 +#: ../../library/os.rst:3810 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:3743 +#: ../../library/os.rst:3818 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:3750 +#: ../../library/os.rst:3825 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:3757 +#: ../../library/os.rst:3832 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:3766 +#: ../../library/os.rst:3841 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:3774 +#: ../../library/os.rst:3849 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:3782 +#: ../../library/os.rst:3857 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:3789 +#: ../../library/os.rst:3864 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:3796 +#: ../../library/os.rst:3871 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:3799 +#: ../../library/os.rst:3874 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:3802 +#: ../../library/os.rst:3877 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "" -#: ../../library/os.rst:3804 +#: ../../library/os.rst:3879 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:3810 +#: ../../library/os.rst:3885 msgid "See :mod:`ssl` for applications that use the SSL module with fork()." msgstr "" -#: ../../library/os.rst:3817 +#: ../../library/os.rst:3892 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -4085,24 +4144,24 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:3823 +#: ../../library/os.rst:3898 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "" -#: ../../library/os.rst:3825 +#: ../../library/os.rst:3900 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:3838 +#: ../../library/os.rst:3913 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:3841 +#: ../../library/os.rst:3916 msgid "" "Windows: The :data:`signal.CTRL_C_EVENT` and :data:`signal.CTRL_BREAK_EVENT` " "signals are special signals which can only be sent to console processes " @@ -4112,36 +4171,36 @@ msgid "" "version of :func:`kill` additionally takes process handles to be killed." msgstr "" -#: ../../library/os.rst:3849 +#: ../../library/os.rst:3924 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`\\ 。" -#: ../../library/os.rst:3851 +#: ../../library/os.rst:3926 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." msgstr "" -#: ../../library/os.rst:3853 +#: ../../library/os.rst:3930 msgid "Windows support." msgstr "" -#: ../../library/os.rst:3863 +#: ../../library/os.rst:3940 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:3865 +#: ../../library/os.rst:3942 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." msgstr "" -#: ../../library/os.rst:3872 +#: ../../library/os.rst:3949 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:3879 +#: ../../library/os.rst:3956 msgid "" "Return a file descriptor referring to the process *pid*. This descriptor " "can be used to perform process management without races and signals. The " @@ -4149,31 +4208,31 @@ msgid "" "currently defined." msgstr "" -#: ../../library/os.rst:3884 +#: ../../library/os.rst:3961 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:3886 -msgid ":ref:`Availability `: Linux 5.3+" -msgstr ":ref:`適用 `:Linux 5.3+" +#: ../../library/os.rst:3963 +msgid ":ref:`Availability `: Linux >= 5.3" +msgstr ":ref:`適用 `:Linux 5.3 以上" -#: ../../library/os.rst:3892 +#: ../../library/os.rst:3969 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:3900 +#: ../../library/os.rst:3977 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " -"whether *mode* is ``'r'`` (default) or ``'w'``. The *buffering* argument has " -"the same meaning as the corresponding argument to the built-in :func:`open` " -"function. The returned file object reads or writes text strings rather than " -"bytes." +"whether *mode* is ``'r'`` (default) or ``'w'``. The *buffering* argument " +"have the same meaning as the corresponding argument to the built-in :func:" +"`open` function. The returned file object reads or writes text strings " +"rather than bytes." msgstr "" -#: ../../library/os.rst:3907 +#: ../../library/os.rst:3985 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -4185,43 +4244,60 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:3917 +#: ../../library/os.rst:3995 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:3922 +#: ../../library/os.rst:4000 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:3931 +#: ../../library/os.rst:4005 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../library/os.rst:4007 +msgid "" +"The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " +"and pipe contents." +msgstr "" + +#: ../../library/os.rst:4010 +msgid "" +":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" +"class:`subprocess.Popen` or :func:`subprocess.run` to control options like " +"encodings." +msgstr "" + +#: ../../library/os.rst:4019 msgid "Wraps the :c:func:`posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:3933 +#: ../../library/os.rst:4021 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:3935 +#: ../../library/os.rst:4023 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" "`execve`." msgstr "" -#: ../../library/os.rst:3938 +#: ../../library/os.rst:4026 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:3942 +#: ../../library/os.rst:4030 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -4230,31 +4306,31 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:3950 +#: ../../library/os.rst:4038 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:3952 +#: ../../library/os.rst:4040 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:3956 +#: ../../library/os.rst:4044 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:3958 +#: ../../library/os.rst:4046 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:3962 +#: ../../library/os.rst:4050 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:3964 +#: ../../library/os.rst:4052 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:3966 +#: ../../library/os.rst:4054 msgid "" "These tuples correspond to the C library :c:func:" "`posix_spawn_file_actions_addopen`, :c:func:" @@ -4263,7 +4339,7 @@ msgid "" "`posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:3972 +#: ../../library/os.rst:4060 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -4272,7 +4348,7 @@ msgid "" "corresponds to the C library :c:data:`POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:3978 +#: ../../library/os.rst:4066 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -4283,7 +4359,7 @@ msgid "" "library :c:data:`POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:3986 +#: ../../library/os.rst:4074 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "`posix_spawn`. *setsid* requires :c:data:`POSIX_SPAWN_SETSID` or :c:data:" @@ -4291,7 +4367,7 @@ msgid "" "raised." msgstr "" -#: ../../library/os.rst:3991 +#: ../../library/os.rst:4079 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -4299,14 +4375,14 @@ msgid "" "`POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:3996 +#: ../../library/os.rst:4084 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:data:" "`POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4000 +#: ../../library/os.rst:4088 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -4316,79 +4392,83 @@ msgid "" "`POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4007 ../../library/os.rst:4023 +#: ../../library/os.rst:4095 ../../library/os.rst:4111 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." msgstr "" -#: ../../library/os.rst:4017 +#: ../../library/os.rst:4105 msgid "Wraps the :c:func:`posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4019 +#: ../../library/os.rst:4107 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4027 -msgid "" -":ref:`Availability `: See :func:`posix_spawn` documentation." +#: ../../library/os.rst:-1 +#, fuzzy +msgid ":ref:`Availability `: POSIX, not Emscripten, not WASI." +msgstr ":ref:`適用 `:POSIX、非 Emscripten、非 WASI。" + +#: ../../library/os.rst:4117 +msgid "See :func:`posix_spawn` documentation." msgstr "" -#: ../../library/os.rst:4033 +#: ../../library/os.rst:4123 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4038 +#: ../../library/os.rst:4128 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4039 +#: ../../library/os.rst:4129 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4041 +#: ../../library/os.rst:4131 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4043 +#: ../../library/os.rst:4133 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4047 +#: ../../library/os.rst:4137 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4052 +#: ../../library/os.rst:4142 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4056 +#: ../../library/os.rst:4146 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4072 +#: ../../library/os.rst:4162 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4074 +#: ../../library/os.rst:4164 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -4396,7 +4476,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4079 +#: ../../library/os.rst:4169 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -4405,13 +4485,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4085 +#: ../../library/os.rst:4175 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4088 +#: ../../library/os.rst:4178 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -4423,7 +4503,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4097 +#: ../../library/os.rst:4187 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -4436,7 +4516,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4107 +#: ../../library/os.rst:4197 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4448,27 +4528,27 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4116 +#: ../../library/os.rst:4206 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4125 +#: ../../library/os.rst:4215 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." msgstr "" -#: ../../library/os.rst:4131 +#: ../../library/os.rst:4219 msgid "" -":ref:`Availability `: Unix, Windows. :func:`spawnlp`, :func:" -"`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are not available on " -"Windows. :func:`spawnle` and :func:`spawnve` are not thread-safe on " -"Windows; we advise you to use the :mod:`subprocess` module instead." +":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " +"not available on Windows. :func:`spawnle` and :func:`spawnve` are not " +"thread-safe on Windows; we advise you to use the :mod:`subprocess` module " +"instead." msgstr "" -#: ../../library/os.rst:4139 +#: ../../library/os.rst:4231 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:`spawn" @@ -4476,7 +4556,7 @@ msgid "" "the process id as the return value." msgstr "" -#: ../../library/os.rst:4149 +#: ../../library/os.rst:4241 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\*` " @@ -4485,7 +4565,7 @@ msgid "" "signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4161 +#: ../../library/os.rst:4253 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -4495,11 +4575,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4172 +#: ../../library/os.rst:4264 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4174 +#: ../../library/os.rst:4266 msgid "" "When *operation* is not specified or ``'open'``, this acts like double-" "clicking the file in Windows Explorer, or giving the file name as an " @@ -4508,7 +4588,7 @@ msgid "" "associated." msgstr "" -#: ../../library/os.rst:4179 +#: ../../library/os.rst:4271 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -4516,28 +4596,28 @@ msgid "" "``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4184 +#: ../../library/os.rst:4276 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:4188 +#: ../../library/os.rst:4280 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:4192 +#: ../../library/os.rst:4284 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`ShellExecute` function." msgstr "" -#: ../../library/os.rst:4196 +#: ../../library/os.rst:4288 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -4548,32 +4628,32 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4204 +#: ../../library/os.rst:4296 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:4208 +#: ../../library/os.rst:4300 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." msgstr "" -#: ../../library/os.rst:4210 +#: ../../library/os.rst:4302 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." msgstr "" -#: ../../library/os.rst:4214 +#: ../../library/os.rst:4306 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4221 +#: ../../library/os.rst:4313 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -4584,13 +4664,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4229 +#: ../../library/os.rst:4321 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:4232 +#: ../../library/os.rst:4324 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -4599,7 +4679,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:4238 +#: ../../library/os.rst:4330 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is preferable " @@ -4607,53 +4687,53 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4243 +#: ../../library/os.rst:4335 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:4247 +#: ../../library/os.rst:4339 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" -#: ../../library/os.rst:4254 +#: ../../library/os.rst:4346 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4257 +#: ../../library/os.rst:4349 msgid ":attr:`!user` - user time" msgstr "" -#: ../../library/os.rst:4258 +#: ../../library/os.rst:4350 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4259 +#: ../../library/os.rst:4351 msgid ":attr:`!children_user` - user time of all child processes" msgstr "" -#: ../../library/os.rst:4260 +#: ../../library/os.rst:4352 msgid ":attr:`!children_system` - system time of all child processes" msgstr "" -#: ../../library/os.rst:4261 +#: ../../library/os.rst:4353 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4263 +#: ../../library/os.rst:4355 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:4267 +#: ../../library/os.rst:4359 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -4663,7 +4743,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:4281 +#: ../../library/os.rst:4373 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -4672,19 +4752,19 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:4287 ../../library/os.rst:4392 +#: ../../library/os.rst:4379 ../../library/os.rst:4484 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:4294 +#: ../../library/os.rst:4386 msgid "" ":func:`waitpid` can be used to wait for the completion of a specific child " "process and has more options." msgstr "" -#: ../../library/os.rst:4299 +#: ../../library/os.rst:4391 msgid "" "Wait for the completion of one or more child processes. *idtype* can be :" "data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or :data:`P_PIDFD` on Linux. " @@ -4697,43 +4777,43 @@ msgid "" "`WNOHANG` is specified and there are no children in a waitable state." msgstr "" -#: ../../library/os.rst:4319 +#: ../../library/os.rst:4411 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted." msgstr "" -#: ../../library/os.rst:4328 +#: ../../library/os.rst:4420 msgid "" "This is a Linux-specific *idtype* that indicates that *id* is a file " "descriptor that refers to a process." msgstr "" -#: ../../library/os.rst:4332 -msgid ":ref:`Availability `: Linux 5.4+" -msgstr ":ref:`適用 `:Linux 5.4+" +#: ../../library/os.rst:4424 +msgid ":ref:`Availability `: Linux >= 5.4" +msgstr ":ref:`適用 `:Linux 5.4 以上" -#: ../../library/os.rst:4339 +#: ../../library/os.rst:4431 msgid "" "Flags that can be used in *options* in :func:`waitid` that specify what " "child signal to wait for." msgstr "" -#: ../../library/os.rst:4354 +#: ../../library/os.rst:4446 msgid "" "These are the possible values for :attr:`si_code` in the result returned by :" "func:`waitid`." msgstr "" -#: ../../library/os.rst:4361 +#: ../../library/os.rst:4453 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: ../../library/os.rst:4367 +#: ../../library/os.rst:4459 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:4369 +#: ../../library/os.rst:4461 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -4742,7 +4822,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:4374 +#: ../../library/os.rst:4466 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -4752,13 +4832,13 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:4381 +#: ../../library/os.rst:4473 msgid "" "An :exc:`OSError` is raised with the value of errno when the syscall returns " "-1." msgstr "" -#: ../../library/os.rst:4384 +#: ../../library/os.rst:4476 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -4770,7 +4850,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:4403 +#: ../../library/os.rst:4497 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -4779,13 +4859,13 @@ msgid "" "argument is the same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:4410 ../../library/os.rst:4424 +#: ../../library/os.rst:4504 ../../library/os.rst:4518 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:4418 +#: ../../library/os.rst:4512 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -4794,22 +4874,22 @@ msgid "" "the same as those provided to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:4432 +#: ../../library/os.rst:4526 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:4434 +#: ../../library/os.rst:4528 msgid "On Unix:" msgstr "" -#: ../../library/os.rst:4436 +#: ../../library/os.rst:4530 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:4439 +#: ../../library/os.rst:4533 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -4817,15 +4897,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:4443 +#: ../../library/os.rst:4537 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: ../../library/os.rst:4445 +#: ../../library/os.rst:4539 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:4447 +#: ../../library/os.rst:4541 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -4833,240 +4913,240 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:4454 +#: ../../library/os.rst:4548 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:4462 +#: ../../library/os.rst:4558 msgid "" "The option for :func:`waitpid` to return immediately if no child process " "status is available immediately. The function returns ``(0, 0)`` in this " "case." msgstr "" -#: ../../library/os.rst:4470 +#: ../../library/os.rst:4566 msgid "" "This option causes child processes to be reported if they have been " "continued from a job control stop since their status was last reported." msgstr "" -#: ../../library/os.rst:4473 -msgid ":ref:`Availability `: some Unix systems." -msgstr ":ref:`適用 `:部分 Unix 系統。" +#: ../../library/os.rst:4571 +msgid "Some Unix systems." +msgstr "" -#: ../../library/os.rst:4478 +#: ../../library/os.rst:4576 msgid "" "This option causes child processes to be reported if they have been stopped " "but their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:4484 +#: ../../library/os.rst:4582 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:4490 +#: ../../library/os.rst:4588 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:4493 ../../library/os.rst:4559 +#: ../../library/os.rst:4591 ../../library/os.rst:4657 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:4500 +#: ../../library/os.rst:4598 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :data:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:4504 +#: ../../library/os.rst:4602 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:4511 +#: ../../library/os.rst:4609 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:4514 +#: ../../library/os.rst:4612 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:4522 +#: ../../library/os.rst:4620 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:4530 +#: ../../library/os.rst:4628 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:4539 +#: ../../library/os.rst:4637 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:4541 +#: ../../library/os.rst:4639 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:4548 +#: ../../library/os.rst:4646 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:4550 +#: ../../library/os.rst:4648 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:4557 +#: ../../library/os.rst:4655 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:4565 +#: ../../library/os.rst:4663 msgid "Interface to the scheduler" msgstr "" -#: ../../library/os.rst:4567 +#: ../../library/os.rst:4665 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:4573 +#: ../../library/os.rst:4671 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:4578 +#: ../../library/os.rst:4676 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:4582 +#: ../../library/os.rst:4680 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:4587 +#: ../../library/os.rst:4685 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:4591 +#: ../../library/os.rst:4689 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:4595 +#: ../../library/os.rst:4693 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:4599 +#: ../../library/os.rst:4697 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:4603 +#: ../../library/os.rst:4701 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:4610 +#: ../../library/os.rst:4708 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:4614 +#: ../../library/os.rst:4712 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:4618 +#: ../../library/os.rst:4716 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:4623 +#: ../../library/os.rst:4721 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:4629 +#: ../../library/os.rst:4727 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:4635 +#: ../../library/os.rst:4733 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:4642 +#: ../../library/os.rst:4740 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:4649 +#: ../../library/os.rst:4747 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:4655 +#: ../../library/os.rst:4753 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:4661 +#: ../../library/os.rst:4759 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:4667 +#: ../../library/os.rst:4765 msgid "Voluntarily relinquish the CPU." msgstr "" -#: ../../library/os.rst:4672 +#: ../../library/os.rst:4770 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:4679 +#: ../../library/os.rst:4777 msgid "" "Return the set of CPUs the process with PID *pid* (or the current process if " "zero) is restricted to." msgstr "" -#: ../../library/os.rst:4686 +#: ../../library/os.rst:4784 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:4691 +#: ../../library/os.rst:4789 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -5077,13 +5157,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:4699 +#: ../../library/os.rst:4797 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:4702 +#: ../../library/os.rst:4800 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -5091,33 +5171,33 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:4712 +#: ../../library/os.rst:4810 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:4721 +#: ../../library/os.rst:4819 msgid "" "Return the number of CPUs in the system. Returns ``None`` if undetermined." msgstr "" -#: ../../library/os.rst:4723 +#: ../../library/os.rst:4821 msgid "" "This number is not equivalent to the number of CPUs the current process can " "use. The number of usable CPUs can be obtained with ``len(os." "sched_getaffinity(0))``" msgstr "" -#: ../../library/os.rst:4733 +#: ../../library/os.rst:4831 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:4742 +#: ../../library/os.rst:4840 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -5126,40 +5206,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:4752 +#: ../../library/os.rst:4850 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:4758 +#: ../../library/os.rst:4856 +msgid "Add ``'SC_MINSIGSTKSZ'`` name." +msgstr "" + +#: ../../library/os.rst:4859 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:4761 +#: ../../library/os.rst:4862 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:4767 +#: ../../library/os.rst:4868 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:4775 +#: ../../library/os.rst:4876 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:4784 +#: ../../library/os.rst:4885 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -5168,7 +5252,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:4794 +#: ../../library/os.rst:4895 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -5176,27 +5260,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:4803 +#: ../../library/os.rst:4904 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:4811 +#: ../../library/os.rst:4912 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:4818 +#: ../../library/os.rst:4919 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:`spawn" "\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. Also " "available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:4825 +#: ../../library/os.rst:4926 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -5205,36 +5289,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:4834 +#: ../../library/os.rst:4935 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:4845 +#: ../../library/os.rst:4946 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:4853 +#: ../../library/os.rst:4954 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:4858 +#: ../../library/os.rst:4959 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:4861 +#: ../../library/os.rst:4962 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:4864 +#: ../../library/os.rst:4965 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -5242,36 +5326,36 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:4869 +#: ../../library/os.rst:4970 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:data:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:4873 +#: ../../library/os.rst:4974 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:4877 -msgid ":ref:`Availability `: Linux 3.17 and newer." +#: ../../library/os.rst:4978 +msgid ":ref:`Availability `: Linux >= 3.17." msgstr ":ref:`適用 `:Linux 3.17 以上。" -#: ../../library/os.rst:4882 +#: ../../library/os.rst:4983 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:4884 +#: ../../library/os.rst:4985 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:4888 +#: ../../library/os.rst:4989 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -5281,58 +5365,91 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:4895 +#: ../../library/os.rst:4996 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:4899 -msgid "On Windows, it will use ``CryptGenRandom()``." +#: ../../library/os.rst:5000 +msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:4902 +#: ../../library/os.rst:5003 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:4906 +#: ../../library/os.rst:5007 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:4910 +#: ../../library/os.rst:5011 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:4914 +#: ../../library/os.rst:5015 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:4922 +#: ../../library/os.rst:5021 +msgid "" +"On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " +"which is deprecated." +msgstr "" + +#: ../../library/os.rst:5027 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:4926 +#: ../../library/os.rst:5031 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:4933 +#: ../../library/os.rst:5038 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." msgstr "" + +#~ msgid ":ref:`Availability `: most flavors of Unix, Windows." +#~ msgstr ":ref:`適用 `:大部分的 Unix、Windows。" + +#~ msgid ":ref:`Availability `: most flavors of Unix." +#~ msgstr ":ref:`適用 `:大部分的 Unix。" + +#~ msgid ":ref:`Availability `: recent flavors of Unix." +#~ msgstr ":ref:`適用 `:近期的 Unix。" + +#~ msgid ":ref:`Availability `: some flavors of Unix." +#~ msgstr ":ref:`適用 `:部分的 Unix。" + +#~ msgid ":ref:`Availability `: Linux 4.14 and newer." +#~ msgstr ":ref:`適用 `:Linux 4.14 以上。" + +#~ msgid ":ref:`Availability `: Linux 4.7 and newer." +#~ msgstr ":ref:`適用 `:Linux 4.7 以上。" + +#~ msgid ":ref:`Availability `: Linux 4.16 and newer." +#~ msgstr ":ref:`適用 `:Linux 4.16 以上。" + +#~ msgid ":ref:`Availability `: See :func:`eventfd`" +#~ msgstr ":ref:`適用 `:請見 :func:`eventfd`" + +#~ msgid ":ref:`Availability `: some Unix systems." +#~ msgstr ":ref:`適用 `:部分 Unix 系統。" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po index c8044e58b1..2ea1c044e9 100644 --- a/library/ossaudiodev.po +++ b/library/ossaudiodev.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:10+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr "" msgid ":mod:`ossaudiodev` --- Access to OSS-compatible audio devices" msgstr ":mod:`ossaudiodev` --- 對 OSS 相容聲音裝置的存取" -#: ../../library/ossaudiodev.rst:9 +#: ../../library/ossaudiodev.rst:12 msgid "" "The :mod:`ossaudiodev` module is deprecated (see :pep:`PEP 594 " "<594#ossaudiodev>` for details)." diff --git a/library/pathlib.po b/library/pathlib.po index 0c19750b6b..d889fa1f07 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-16 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -589,33 +589,39 @@ msgid "" "arguments ``self``, ``pattern``." msgstr "" -#: ../../library/pathlib.rst:847 +#: ../../library/pathlib.rst:844 ../../library/pathlib.rst:1137 +msgid "" +"Return only directories if *pattern* ends with a pathname components " +"separator (:data:`~os.sep` or :data:`~os.altsep`)." +msgstr "" + +#: ../../library/pathlib.rst:850 msgid "" "Return the name of the group owning the file. :exc:`KeyError` is raised if " "the file's gid isn't found in the system database." msgstr "" -#: ../../library/pathlib.rst:853 +#: ../../library/pathlib.rst:856 msgid "" "Return ``True`` if the path points to a directory (or a symbolic link " "pointing to a directory), ``False`` if it points to another kind of file." msgstr "" -#: ../../library/pathlib.rst:856 ../../library/pathlib.rst:865 -#: ../../library/pathlib.rst:894 ../../library/pathlib.rst:903 -#: ../../library/pathlib.rst:912 ../../library/pathlib.rst:921 +#: ../../library/pathlib.rst:859 ../../library/pathlib.rst:868 +#: ../../library/pathlib.rst:897 ../../library/pathlib.rst:906 +#: ../../library/pathlib.rst:915 ../../library/pathlib.rst:924 msgid "" "``False`` is also returned if the path doesn't exist or is a broken symlink; " "other errors (such as permission errors) are propagated." msgstr "" -#: ../../library/pathlib.rst:862 +#: ../../library/pathlib.rst:865 msgid "" "Return ``True`` if the path points to a regular file (or a symbolic link " "pointing to a regular file), ``False`` if it points to another kind of file." msgstr "" -#: ../../library/pathlib.rst:871 +#: ../../library/pathlib.rst:874 msgid "" "Return ``True`` if the path is a :dfn:`mount point`: a point in a file " "system where a different file system has been mounted. On POSIX, the " @@ -625,49 +631,49 @@ msgid "" "and POSIX variants. Not implemented on Windows." msgstr "" -#: ../../library/pathlib.rst:883 +#: ../../library/pathlib.rst:886 msgid "" "Return ``True`` if the path points to a symbolic link, ``False`` otherwise." msgstr "" -#: ../../library/pathlib.rst:885 +#: ../../library/pathlib.rst:888 msgid "" "``False`` is also returned if the path doesn't exist; other errors (such as " "permission errors) are propagated." msgstr "" -#: ../../library/pathlib.rst:891 +#: ../../library/pathlib.rst:894 msgid "" "Return ``True`` if the path points to a Unix socket (or a symbolic link " "pointing to a Unix socket), ``False`` if it points to another kind of file." msgstr "" -#: ../../library/pathlib.rst:900 +#: ../../library/pathlib.rst:903 msgid "" "Return ``True`` if the path points to a FIFO (or a symbolic link pointing to " "a FIFO), ``False`` if it points to another kind of file." msgstr "" -#: ../../library/pathlib.rst:909 +#: ../../library/pathlib.rst:912 msgid "" "Return ``True`` if the path points to a block device (or a symbolic link " "pointing to a block device), ``False`` if it points to another kind of file." msgstr "" -#: ../../library/pathlib.rst:918 +#: ../../library/pathlib.rst:921 msgid "" "Return ``True`` if the path points to a character device (or a symbolic link " "pointing to a character device), ``False`` if it points to another kind of " "file." msgstr "" -#: ../../library/pathlib.rst:927 +#: ../../library/pathlib.rst:930 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "" -#: ../../library/pathlib.rst:941 +#: ../../library/pathlib.rst:944 msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " @@ -675,88 +681,88 @@ msgid "" "be included is unspecified." msgstr "" -#: ../../library/pathlib.rst:948 +#: ../../library/pathlib.rst:951 msgid "" "Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " "symbolic link's mode is changed rather than its target's." msgstr "" -#: ../../library/pathlib.rst:954 +#: ../../library/pathlib.rst:957 msgid "" "Like :meth:`Path.stat` but, if the path points to a symbolic link, return " "the symbolic link's information rather than its target's." msgstr "" -#: ../../library/pathlib.rst:960 +#: ../../library/pathlib.rst:963 msgid "" "Create a new directory at this given path. If *mode* is given, it is " "combined with the process' ``umask`` value to determine the file mode and " "access flags. If the path already exists, :exc:`FileExistsError` is raised." msgstr "" -#: ../../library/pathlib.rst:965 +#: ../../library/pathlib.rst:968 msgid "" "If *parents* is true, any missing parents of this path are created as " "needed; they are created with the default permissions without taking *mode* " "into account (mimicking the POSIX ``mkdir -p`` command)." msgstr "" -#: ../../library/pathlib.rst:969 +#: ../../library/pathlib.rst:972 msgid "" "If *parents* is false (the default), a missing parent raises :exc:" "`FileNotFoundError`." msgstr "" -#: ../../library/pathlib.rst:972 +#: ../../library/pathlib.rst:975 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." msgstr "" -#: ../../library/pathlib.rst:975 +#: ../../library/pathlib.rst:978 msgid "" "If *exist_ok* is true, :exc:`FileExistsError` exceptions will be ignored " "(same behavior as the POSIX ``mkdir -p`` command), but only if the last path " "component is not an existing non-directory file." msgstr "" -#: ../../library/pathlib.rst:979 +#: ../../library/pathlib.rst:982 msgid "The *exist_ok* parameter was added." msgstr "新增 *exist_ok* 參數。" -#: ../../library/pathlib.rst:985 +#: ../../library/pathlib.rst:988 msgid "" "Open the file pointed to by the path, like the built-in :func:`open` " "function does::" msgstr "" -#: ../../library/pathlib.rst:997 +#: ../../library/pathlib.rst:1000 msgid "" "Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's uid isn't found in the system database." msgstr "" -#: ../../library/pathlib.rst:1003 +#: ../../library/pathlib.rst:1006 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "" -#: ../../library/pathlib.rst:1016 +#: ../../library/pathlib.rst:1019 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "" -#: ../../library/pathlib.rst:1024 +#: ../../library/pathlib.rst:1027 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." msgstr "" -#: ../../library/pathlib.rst:1032 +#: ../../library/pathlib.rst:1035 msgid "" "Return the path to which the symbolic link points (as returned by :func:`os." "readlink`)::" msgstr "" -#: ../../library/pathlib.rst:1045 +#: ../../library/pathlib.rst:1048 msgid "" "Rename this file or directory to the given *target*, and return a new Path " "instance pointing to *target*. On Unix, if *target* exists and is a file, " @@ -765,37 +771,43 @@ msgid "" "either a string or another path object::" msgstr "" -#: ../../library/pathlib.rst:1060 ../../library/pathlib.rst:1074 +#: ../../library/pathlib.rst:1063 ../../library/pathlib.rst:1077 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " "relative to the current working directory, *not* the directory of the Path " "object." msgstr "" -#: ../../library/pathlib.rst:1064 ../../library/pathlib.rst:1078 +#: ../../library/pathlib.rst:1067 ../../library/pathlib.rst:1081 msgid "Added return value, return the new Path instance." msgstr "" -#: ../../library/pathlib.rst:1070 +#: ../../library/pathlib.rst:1073 msgid "" "Rename this file or directory to the given *target*, and return a new Path " "instance pointing to *target*. If *target* points to an existing file or " "empty directory, it will be unconditionally replaced." msgstr "" -#: ../../library/pathlib.rst:1084 +#: ../../library/pathlib.rst:1087 +msgid "" +"Make the path absolute, without normalization or resolving symlinks. Returns " +"a new path object::" +msgstr "" + +#: ../../library/pathlib.rst:1099 msgid "" "Make the path absolute, resolving any symlinks. A new path object is " "returned::" msgstr "" -#: ../../library/pathlib.rst:1093 +#: ../../library/pathlib.rst:1108 msgid "" "\"``..``\" components are also eliminated (this is the only method to do " "so)::" msgstr "" -#: ../../library/pathlib.rst:1099 +#: ../../library/pathlib.rst:1114 msgid "" "If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError` " "is raised. If *strict* is ``False``, the path is resolved as far as " @@ -804,65 +816,65 @@ msgid "" "`RuntimeError` is raised." msgstr "" -#: ../../library/pathlib.rst:1105 +#: ../../library/pathlib.rst:1120 msgid "The *strict* argument (pre-3.6 behavior is strict)." msgstr "" -#: ../../library/pathlib.rst:1110 +#: ../../library/pathlib.rst:1125 msgid "" "This is like calling :func:`Path.glob` with \"``**/``\" added in front of " "the given relative *pattern*::" msgstr "" -#: ../../library/pathlib.rst:1120 +#: ../../library/pathlib.rst:1135 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " "arguments ``self``, ``pattern``." msgstr "" -#: ../../library/pathlib.rst:1125 +#: ../../library/pathlib.rst:1143 msgid "Remove this directory. The directory must be empty." msgstr "" -#: ../../library/pathlib.rst:1130 +#: ../../library/pathlib.rst:1148 msgid "" "Return whether this path points to the same file as *other_path*, which can " "be either a Path object, or a string. The semantics are similar to :func:" "`os.path.samefile` and :func:`os.path.samestat`." msgstr "" -#: ../../library/pathlib.rst:1134 +#: ../../library/pathlib.rst:1152 msgid "" "An :exc:`OSError` can be raised if either file cannot be accessed for some " "reason." msgstr "" -#: ../../library/pathlib.rst:1151 +#: ../../library/pathlib.rst:1169 msgid "" "Make this path a symbolic link to *target*. Under Windows, " "*target_is_directory* must be true (default ``False``) if the link's target " "is a directory. Under POSIX, *target_is_directory*'s value is ignored." msgstr "" -#: ../../library/pathlib.rst:1167 +#: ../../library/pathlib.rst:1185 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." msgstr "" -#: ../../library/pathlib.rst:1172 +#: ../../library/pathlib.rst:1190 msgid "Make this path a hard link to the same file as *target*." msgstr "" -#: ../../library/pathlib.rst:1175 +#: ../../library/pathlib.rst:1193 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.link`'s." msgstr "" -#: ../../library/pathlib.rst:1182 +#: ../../library/pathlib.rst:1200 msgid "Make *target* a hard link to this path." msgstr "" -#: ../../library/pathlib.rst:1186 +#: ../../library/pathlib.rst:1204 msgid "" "This function does not make this path a hard link to *target*, despite the " "implication of the function and argument names. The argument order (target, " @@ -870,14 +882,14 @@ msgid "" "hardlink_to`, but matches that of :func:`os.link`." msgstr "" -#: ../../library/pathlib.rst:1195 +#: ../../library/pathlib.rst:1213 msgid "" "This method is deprecated in favor of :meth:`Path.hardlink_to`, as the " "argument order of :meth:`Path.link_to` does not match that of :meth:`Path." "symlink_to`." msgstr "" -#: ../../library/pathlib.rst:1202 +#: ../../library/pathlib.rst:1220 msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process' ``umask`` value to determine the file mode and access flags. " @@ -886,295 +898,303 @@ msgid "" "`FileExistsError` is raised." msgstr "" -#: ../../library/pathlib.rst:1211 +#: ../../library/pathlib.rst:1229 msgid "" "Remove this file or symbolic link. If the path points to a directory, use :" "func:`Path.rmdir` instead." msgstr "" -#: ../../library/pathlib.rst:1214 +#: ../../library/pathlib.rst:1232 msgid "" "If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " "if the path does not exist." msgstr "" -#: ../../library/pathlib.rst:1217 +#: ../../library/pathlib.rst:1235 msgid "" "If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " "(same behavior as the POSIX ``rm -f`` command)." msgstr "" -#: ../../library/pathlib.rst:1220 +#: ../../library/pathlib.rst:1238 msgid "The *missing_ok* parameter was added." msgstr "新增 *missing_ok* 參數。" -#: ../../library/pathlib.rst:1226 +#: ../../library/pathlib.rst:1244 msgid "" "Open the file pointed to in bytes mode, write *data* to it, and close the " "file::" msgstr "" -#: ../../library/pathlib.rst:1235 +#: ../../library/pathlib.rst:1253 msgid "An existing file of the same name is overwritten." msgstr "" -#: ../../library/pathlib.rst:1242 +#: ../../library/pathlib.rst:1260 msgid "" "Open the file pointed to in text mode, write *data* to it, and close the " "file::" msgstr "" -#: ../../library/pathlib.rst:1251 +#: ../../library/pathlib.rst:1269 msgid "" "An existing file of the same name is overwritten. The optional parameters " "have the same meaning as in :func:`open`." msgstr "" -#: ../../library/pathlib.rst:1256 +#: ../../library/pathlib.rst:1274 msgid "The *newline* parameter was added." msgstr "新增 *newline* 參數。" -#: ../../library/pathlib.rst:1260 +#: ../../library/pathlib.rst:1278 msgid "Correspondence to tools in the :mod:`os` module" msgstr "" -#: ../../library/pathlib.rst:1262 +#: ../../library/pathlib.rst:1280 msgid "" "Below is a table mapping various :mod:`os` functions to their corresponding :" "class:`PurePath`/:class:`Path` equivalent." msgstr "" -#: ../../library/pathlib.rst:1267 +#: ../../library/pathlib.rst:1285 msgid "" "Not all pairs of functions/methods below are equivalent. Some of them, " "despite having some overlapping use-cases, have different semantics. They " -"include :func:`os.path.abspath` and :meth:`Path.resolve`, :func:`os.path." +"include :func:`os.path.abspath` and :meth:`Path.absolute`, :func:`os.path." "relpath` and :meth:`PurePath.relative_to`." msgstr "" -#: ../../library/pathlib.rst:1273 +#: ../../library/pathlib.rst:1291 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` 和 :mod:`os.path`" -#: ../../library/pathlib.rst:1273 +#: ../../library/pathlib.rst:1291 msgid ":mod:`pathlib`" msgstr ":mod:`pathlib`" -#: ../../library/pathlib.rst:1275 +#: ../../library/pathlib.rst:1293 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" -#: ../../library/pathlib.rst:1275 -msgid ":meth:`Path.resolve` [#]_" -msgstr ":meth:`Path.resolve` [#]_" +#: ../../library/pathlib.rst:1293 +msgid ":meth:`Path.absolute` [#]_" +msgstr ":meth:`Path.absolute` [#]_" + +#: ../../library/pathlib.rst:1294 +msgid ":func:`os.path.realpath`" +msgstr ":func:`os.path.realpath`" + +#: ../../library/pathlib.rst:1294 +msgid ":meth:`Path.resolve`" +msgstr ":meth:`Path.resolve`" -#: ../../library/pathlib.rst:1276 +#: ../../library/pathlib.rst:1295 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" -#: ../../library/pathlib.rst:1276 +#: ../../library/pathlib.rst:1295 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" -#: ../../library/pathlib.rst:1277 +#: ../../library/pathlib.rst:1296 msgid ":func:`os.mkdir`" msgstr ":func:`os.mkdir`" -#: ../../library/pathlib.rst:1277 ../../library/pathlib.rst:1278 +#: ../../library/pathlib.rst:1296 ../../library/pathlib.rst:1297 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" -#: ../../library/pathlib.rst:1278 +#: ../../library/pathlib.rst:1297 msgid ":func:`os.makedirs`" msgstr ":func:`os.makedirs`" -#: ../../library/pathlib.rst:1279 +#: ../../library/pathlib.rst:1298 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" -#: ../../library/pathlib.rst:1279 +#: ../../library/pathlib.rst:1298 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" -#: ../../library/pathlib.rst:1280 +#: ../../library/pathlib.rst:1299 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" -#: ../../library/pathlib.rst:1280 +#: ../../library/pathlib.rst:1299 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" -#: ../../library/pathlib.rst:1281 +#: ../../library/pathlib.rst:1300 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" -#: ../../library/pathlib.rst:1281 +#: ../../library/pathlib.rst:1300 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" -#: ../../library/pathlib.rst:1282 +#: ../../library/pathlib.rst:1301 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`, :func:`os.unlink`" -#: ../../library/pathlib.rst:1282 +#: ../../library/pathlib.rst:1301 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" -#: ../../library/pathlib.rst:1283 +#: ../../library/pathlib.rst:1302 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" -#: ../../library/pathlib.rst:1283 +#: ../../library/pathlib.rst:1302 msgid ":func:`Path.cwd`" msgstr ":func:`Path.cwd`" -#: ../../library/pathlib.rst:1284 +#: ../../library/pathlib.rst:1303 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" -#: ../../library/pathlib.rst:1284 +#: ../../library/pathlib.rst:1303 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" -#: ../../library/pathlib.rst:1285 +#: ../../library/pathlib.rst:1304 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" -#: ../../library/pathlib.rst:1285 +#: ../../library/pathlib.rst:1304 msgid ":meth:`Path.expanduser` and :meth:`Path.home`" msgstr ":meth:`Path.expanduser` 和 :meth:`Path.home`" -#: ../../library/pathlib.rst:1287 +#: ../../library/pathlib.rst:1306 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" -#: ../../library/pathlib.rst:1287 +#: ../../library/pathlib.rst:1306 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" -#: ../../library/pathlib.rst:1288 +#: ../../library/pathlib.rst:1307 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" -#: ../../library/pathlib.rst:1288 +#: ../../library/pathlib.rst:1307 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" -#: ../../library/pathlib.rst:1289 +#: ../../library/pathlib.rst:1308 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" -#: ../../library/pathlib.rst:1289 +#: ../../library/pathlib.rst:1308 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" -#: ../../library/pathlib.rst:1290 +#: ../../library/pathlib.rst:1309 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" -#: ../../library/pathlib.rst:1290 +#: ../../library/pathlib.rst:1309 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" -#: ../../library/pathlib.rst:1291 +#: ../../library/pathlib.rst:1310 msgid ":func:`os.link`" msgstr ":func:`os.link`" -#: ../../library/pathlib.rst:1291 +#: ../../library/pathlib.rst:1310 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" -#: ../../library/pathlib.rst:1292 +#: ../../library/pathlib.rst:1311 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" -#: ../../library/pathlib.rst:1292 +#: ../../library/pathlib.rst:1311 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" -#: ../../library/pathlib.rst:1293 +#: ../../library/pathlib.rst:1312 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" -#: ../../library/pathlib.rst:1293 +#: ../../library/pathlib.rst:1312 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" -#: ../../library/pathlib.rst:1294 +#: ../../library/pathlib.rst:1313 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" -#: ../../library/pathlib.rst:1294 +#: ../../library/pathlib.rst:1313 msgid ":meth:`PurePath.relative_to` [#]_" msgstr ":meth:`PurePath.relative_to` [#]_" -#: ../../library/pathlib.rst:1295 +#: ../../library/pathlib.rst:1314 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" -#: ../../library/pathlib.rst:1295 +#: ../../library/pathlib.rst:1314 msgid ":meth:`Path.stat`, :meth:`Path.owner`, :meth:`Path.group`" msgstr ":meth:`Path.stat`, :meth:`Path.owner`, :meth:`Path.group`" -#: ../../library/pathlib.rst:1298 +#: ../../library/pathlib.rst:1317 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" -#: ../../library/pathlib.rst:1298 +#: ../../library/pathlib.rst:1317 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" -#: ../../library/pathlib.rst:1299 +#: ../../library/pathlib.rst:1318 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" -#: ../../library/pathlib.rst:1299 +#: ../../library/pathlib.rst:1318 msgid ":func:`PurePath.joinpath`" msgstr ":func:`PurePath.joinpath`" -#: ../../library/pathlib.rst:1300 +#: ../../library/pathlib.rst:1319 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" -#: ../../library/pathlib.rst:1300 +#: ../../library/pathlib.rst:1319 msgid ":data:`PurePath.name`" msgstr ":data:`PurePath.name`" -#: ../../library/pathlib.rst:1301 +#: ../../library/pathlib.rst:1320 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" -#: ../../library/pathlib.rst:1301 +#: ../../library/pathlib.rst:1320 msgid ":data:`PurePath.parent`" msgstr ":data:`PurePath.parent`" -#: ../../library/pathlib.rst:1302 +#: ../../library/pathlib.rst:1321 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" -#: ../../library/pathlib.rst:1302 +#: ../../library/pathlib.rst:1321 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" -#: ../../library/pathlib.rst:1303 +#: ../../library/pathlib.rst:1322 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" -#: ../../library/pathlib.rst:1303 +#: ../../library/pathlib.rst:1322 msgid ":data:`PurePath.stem` and :data:`PurePath.suffix`" msgstr ":data:`PurePath.stem` 和 :data:`PurePath.suffix`" -#: ../../library/pathlib.rst:1308 +#: ../../library/pathlib.rst:1327 msgid "Footnotes" msgstr "註解" -#: ../../library/pathlib.rst:1309 +#: ../../library/pathlib.rst:1328 msgid "" -":func:`os.path.abspath` does not resolve symbolic links while :meth:`Path." -"resolve` does." +":func:`os.path.abspath` normalizes the resulting path, which may change its " +"meaning in the presence of symlinks, while :meth:`Path.absolute` does not." msgstr "" -#: ../../library/pathlib.rst:1310 +#: ../../library/pathlib.rst:1329 msgid "" ":meth:`PurePath.relative_to` requires ``self`` to be the subpath of the " "argument, but :func:`os.path.relpath` does not." diff --git a/library/pdb.po b/library/pdb.po index 7d5843f52a..ff48f6c8a4 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -283,20 +283,26 @@ msgstr "" #: ../../library/pdb.rst:243 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " -"current directory, it is read in and executed as if it had been typed at the " -"debugger prompt. This is particularly useful for aliases. If both files " -"exist, the one in the home directory is read first and aliases defined there " -"can be overridden by the local file." +"current directory, it is read with ``'utf-8'`` encoding and executed as if " +"it had been typed at the debugger prompt. This is particularly useful for " +"aliases. If both files exist, the one in the home directory is read first " +"and aliases defined there can be overridden by the local file." msgstr "" #: ../../library/pdb.rst:249 msgid "" +":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " +"read with the system locale encoding." +msgstr "" + +#: ../../library/pdb.rst:253 +msgid "" ":file:`.pdbrc` can now contain commands that continue debugging, such as :" "pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -#: ../../library/pdb.rst:257 +#: ../../library/pdb.rst:261 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -305,25 +311,25 @@ msgid "" "the ``!`` command." msgstr "" -#: ../../library/pdb.rst:265 +#: ../../library/pdb.rst:269 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "indicates the current frame, which determines the context of most commands." msgstr "" -#: ../../library/pdb.rst:270 +#: ../../library/pdb.rst:274 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" -#: ../../library/pdb.rst:275 +#: ../../library/pdb.rst:279 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" -#: ../../library/pdb.rst:280 +#: ../../library/pdb.rst:284 msgid "" "With a *lineno* argument, set a break there in the current file. With a " "*function* argument, set a break at the first executable statement within " @@ -334,33 +340,33 @@ msgid "" "refer." msgstr "" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:291 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "" -#: ../../library/pdb.rst:290 +#: ../../library/pdb.rst:294 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" -#: ../../library/pdb.rst:296 +#: ../../library/pdb.rst:300 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" -#: ../../library/pdb.rst:301 +#: ../../library/pdb.rst:305 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " "Without argument, clear all breaks (but first ask confirmation)." msgstr "" -#: ../../library/pdb.rst:307 +#: ../../library/pdb.rst:311 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -368,11 +374,11 @@ msgid "" "breakpoints and can be (re-)enabled." msgstr "" -#: ../../library/pdb.rst:314 +#: ../../library/pdb.rst:318 msgid "Enable the breakpoints specified." msgstr "" -#: ../../library/pdb.rst:318 +#: ../../library/pdb.rst:322 msgid "" "Set the ignore count for the given breakpoint number. If count is omitted, " "the ignore count is set to 0. A breakpoint becomes active when the ignore " @@ -381,39 +387,39 @@ msgid "" "condition evaluates to true." msgstr "" -#: ../../library/pdb.rst:326 +#: ../../library/pdb.rst:330 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " "existing condition is removed; i.e., the breakpoint is made unconditional." msgstr "" -#: ../../library/pdb.rst:332 +#: ../../library/pdb.rst:336 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " "``end`` to terminate the commands. An example::" msgstr "" -#: ../../library/pdb.rst:341 +#: ../../library/pdb.rst:345 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." msgstr "" -#: ../../library/pdb.rst:344 +#: ../../library/pdb.rst:348 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "" -#: ../../library/pdb.rst:346 +#: ../../library/pdb.rst:350 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -#: ../../library/pdb.rst:350 +#: ../../library/pdb.rst:354 msgid "" "Specifying any command resuming execution (currently :pdbcmd:`continue`, :" "pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" @@ -424,7 +430,7 @@ msgid "" "ambiguities about which list to execute." msgstr "" -#: ../../library/pdb.rst:359 +#: ../../library/pdb.rst:363 msgid "" "If you use the 'silent' command in the command list, the usual message about " "stopping at a breakpoint is not printed. This may be desirable for " @@ -433,13 +439,13 @@ msgid "" "was reached." msgstr "" -#: ../../library/pdb.rst:366 +#: ../../library/pdb.rst:370 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" -#: ../../library/pdb.rst:371 +#: ../../library/pdb.rst:375 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -448,46 +454,46 @@ msgid "" "line in the current function.)" msgstr "" -#: ../../library/pdb.rst:379 +#: ../../library/pdb.rst:383 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "" -#: ../../library/pdb.rst:382 +#: ../../library/pdb.rst:386 msgid "" "With a line number, continue execution until a line with a number greater or " "equal to that is reached. In both cases, also stop when the current frame " "returns." msgstr "" -#: ../../library/pdb.rst:386 +#: ../../library/pdb.rst:390 msgid "Allow giving an explicit line number." msgstr "" -#: ../../library/pdb.rst:391 +#: ../../library/pdb.rst:395 msgid "Continue execution until the current function returns." msgstr "" -#: ../../library/pdb.rst:395 +#: ../../library/pdb.rst:399 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "" -#: ../../library/pdb.rst:399 +#: ../../library/pdb.rst:403 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " "skip code that you don't want to run." msgstr "" -#: ../../library/pdb.rst:403 +#: ../../library/pdb.rst:407 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " "possible to jump into the middle of a :keyword:`for` loop or out of a :" "keyword:`finally` clause." msgstr "" -#: ../../library/pdb.rst:409 +#: ../../library/pdb.rst:413 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -496,7 +502,7 @@ msgid "" "second argument is less than the first, it is interpreted as a count." msgstr "" -#: ../../library/pdb.rst:415 +#: ../../library/pdb.rst:419 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -504,68 +510,68 @@ msgid "" "line." msgstr "" -#: ../../library/pdb.rst:420 +#: ../../library/pdb.rst:424 msgid "The ``>>`` marker." msgstr "" -#: ../../library/pdb.rst:425 +#: ../../library/pdb.rst:429 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" -#: ../../library/pdb.rst:432 +#: ../../library/pdb.rst:436 msgid "Print the argument list of the current function." msgstr "" -#: ../../library/pdb.rst:436 +#: ../../library/pdb.rst:440 msgid "Evaluate the *expression* in the current context and print its value." msgstr "" -#: ../../library/pdb.rst:440 +#: ../../library/pdb.rst:444 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -#: ../../library/pdb.rst:446 +#: ../../library/pdb.rst:450 msgid "" "Like the :pdbcmd:`p` command, except the value of the expression is pretty-" "printed using the :mod:`pprint` module." msgstr "" -#: ../../library/pdb.rst:451 +#: ../../library/pdb.rst:455 msgid "Print the type of the *expression*." msgstr "" -#: ../../library/pdb.rst:455 +#: ../../library/pdb.rst:459 msgid "Try to get source code for the given object and display it." msgstr "" -#: ../../library/pdb.rst:461 +#: ../../library/pdb.rst:465 msgid "" "Display the value of the expression if it changed, each time execution stops " "in the current frame." msgstr "" -#: ../../library/pdb.rst:464 +#: ../../library/pdb.rst:468 msgid "Without expression, list all display expressions for the current frame." msgstr "" -#: ../../library/pdb.rst:470 +#: ../../library/pdb.rst:474 msgid "" "Do not display the expression any more in the current frame. Without " "expression, clear all display expressions for the current frame." msgstr "" -#: ../../library/pdb.rst:477 +#: ../../library/pdb.rst:481 msgid "" "Start an interactive interpreter (using the :mod:`code` module) whose global " "namespace contains all the (global and local) names found in the current " "scope." msgstr "" -#: ../../library/pdb.rst:487 +#: ../../library/pdb.rst:491 msgid "" "Create an alias called *name* that executes *command*. The command must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by ``" @@ -574,7 +580,7 @@ msgid "" "are given, all aliases are listed." msgstr "" -#: ../../library/pdb.rst:493 +#: ../../library/pdb.rst:497 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -583,17 +589,17 @@ msgid "" "other words in the line are left alone." msgstr "" -#: ../../library/pdb.rst:499 +#: ../../library/pdb.rst:503 msgid "" "As an example, here are two useful aliases (especially when placed in the :" "file:`.pdbrc` file)::" msgstr "" -#: ../../library/pdb.rst:509 +#: ../../library/pdb.rst:513 msgid "Delete the specified alias." msgstr "" -#: ../../library/pdb.rst:513 +#: ../../library/pdb.rst:517 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " @@ -602,7 +608,7 @@ msgid "" "line, e.g.::" msgstr "" -#: ../../library/pdb.rst:525 +#: ../../library/pdb.rst:529 msgid "" "Restart the debugged Python program. If an argument is supplied, it is " "split with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " @@ -610,25 +616,25 @@ msgid "" "`restart` is an alias for :pdbcmd:`run`." msgstr "" -#: ../../library/pdb.rst:532 +#: ../../library/pdb.rst:536 msgid "Quit from the debugger. The program being executed is aborted." msgstr "" -#: ../../library/pdb.rst:536 +#: ../../library/pdb.rst:540 msgid "" "Enter a recursive debugger that steps through the code argument (which is an " "arbitrary expression or statement to be executed in the current environment)." msgstr "" -#: ../../library/pdb.rst:542 +#: ../../library/pdb.rst:546 msgid "Print the return value for the last return of a function." msgstr "" -#: ../../library/pdb.rst:545 +#: ../../library/pdb.rst:549 msgid "Footnotes" msgstr "註解" -#: ../../library/pdb.rst:546 +#: ../../library/pdb.rst:550 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." diff --git a/library/pickle.po b/library/pickle.po index 625acd7282..28b59c56f2 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-26 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -692,12 +692,11 @@ msgstr "" #: ../../library/pickle.rst:510 msgid "" -"instances of such classes whose :attr:`~object.__dict__` or the result of " -"calling :meth:`__getstate__` is picklable (see section :ref:`pickle-inst` " -"for details)." +"instances of such classes whose the result of calling :meth:`__getstate__` " +"is picklable (see section :ref:`pickle-inst` for details)." msgstr "" -#: ../../library/pickle.rst:514 +#: ../../library/pickle.rst:513 msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " @@ -707,7 +706,7 @@ msgid "" "limit with :func:`sys.setrecursionlimit`." msgstr "" -#: ../../library/pickle.rst:521 +#: ../../library/pickle.rst:520 msgid "" "Note that functions (built-in and user-defined) are pickled by fully :term:" "`qualified name`, not by value. [#]_ This means that only the function name " @@ -718,7 +717,7 @@ msgid "" "exception will be raised. [#]_" msgstr "" -#: ../../library/pickle.rst:528 +#: ../../library/pickle.rst:527 msgid "" "Similarly, classes are pickled by fully qualified name, so the same " "restrictions in the unpickling environment apply. Note that none of the " @@ -726,13 +725,13 @@ msgid "" "attribute ``attr`` is not restored in the unpickling environment::" msgstr "" -#: ../../library/pickle.rst:538 +#: ../../library/pickle.rst:537 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." msgstr "" -#: ../../library/pickle.rst:541 +#: ../../library/pickle.rst:540 msgid "" "Similarly, when class instances are pickled, their class's code and data are " "not pickled along with them. Only the instance data are pickled. This is " @@ -744,17 +743,17 @@ msgid "" "method." msgstr "" -#: ../../library/pickle.rst:553 +#: ../../library/pickle.rst:552 msgid "Pickling Class Instances" msgstr "" -#: ../../library/pickle.rst:557 +#: ../../library/pickle.rst:556 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." msgstr "" -#: ../../library/pickle.rst:560 +#: ../../library/pickle.rst:559 msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " @@ -764,13 +763,13 @@ msgid "" "following code shows an implementation of this behaviour::" msgstr "" -#: ../../library/pickle.rst:575 +#: ../../library/pickle.rst:574 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" -#: ../../library/pickle.rst:580 +#: ../../library/pickle.rst:579 msgid "" "In protocols 2 and newer, classes that implements the :meth:" "`__getnewargs_ex__` method can dictate the values passed to the :meth:" @@ -780,46 +779,79 @@ msgid "" "passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: ../../library/pickle.rst:588 +#: ../../library/pickle.rst:587 msgid "" "You should implement this method if the :meth:`__new__` method of your class " "requires keyword-only arguments. Otherwise, it is recommended for " "compatibility to implement :meth:`__getnewargs__`." msgstr "" -#: ../../library/pickle.rst:592 +#: ../../library/pickle.rst:591 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." msgstr "" -#: ../../library/pickle.rst:598 +#: ../../library/pickle.rst:597 msgid "" "This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " "supports only positional arguments. It must return a tuple of arguments " "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: ../../library/pickle.rst:602 +#: ../../library/pickle.rst:601 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" -#: ../../library/pickle.rst:605 +#: ../../library/pickle.rst:604 msgid "" "Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" "`__getnewargs_ex__` in protocols 2 and 3." msgstr "" -#: ../../library/pickle.rst:612 +#: ../../library/pickle.rst:611 msgid "" -"Classes can further influence how their instances are pickled; if the class " -"defines the method :meth:`__getstate__`, it is called and the returned " -"object is pickled as the contents for the instance, instead of the contents " -"of the instance's dictionary. If the :meth:`__getstate__` method is absent, " -"the instance's :attr:`~object.__dict__` is pickled as usual." +"Classes can further influence how their instances are pickled by overriding " +"the method :meth:`__getstate__`. It is called and the returned object is " +"pickled as the contents for the instance, instead of a default state. There " +"are several cases:" msgstr "" -#: ../../library/pickle.rst:621 +#: ../../library/pickle.rst:616 +msgid "" +"For a class that has no instance :attr:`~object.__dict__` and no :attr:" +"`~object.__slots__`, the default state is ``None``." +msgstr "" + +#: ../../library/pickle.rst:619 +msgid "" +"For a class that has an instance :attr:`~object.__dict__` and no :attr:" +"`~object.__slots__`, the default state is ``self.__dict__``." +msgstr "" + +#: ../../library/pickle.rst:622 +msgid "" +"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." +"__slots__`, the default state is a tuple consisting of two dictionaries: " +"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " +"slots that have a value are included in the latter." +msgstr "" + +#: ../../library/pickle.rst:628 +msgid "" +"For a class that has :attr:`~object.__slots__` and no instance :attr:" +"`~object.__dict__`, the default state is a tuple whose first item is " +"``None`` and whose second item is a dictionary mapping slot names to slot " +"values described in the previous bullet." +msgstr "" + +#: ../../library/pickle.rst:633 +msgid "" +"Added the default implementation of the ``__getstate__()`` method in the :" +"class:`object` class." +msgstr "" + +#: ../../library/pickle.rst:640 msgid "" "Upon unpickling, if the class defines :meth:`__setstate__`, it is called " "with the unpickled state. In that case, there is no requirement for the " @@ -827,19 +859,19 @@ msgid "" "dictionary and its items are assigned to the new instance's dictionary." msgstr "" -#: ../../library/pickle.rst:628 +#: ../../library/pickle.rst:647 msgid "" "If :meth:`__getstate__` returns a false value, the :meth:`__setstate__` " "method will not be called upon unpickling." msgstr "" -#: ../../library/pickle.rst:632 +#: ../../library/pickle.rst:651 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " "use the methods :meth:`__getstate__` and :meth:`__setstate__`." msgstr "" -#: ../../library/pickle.rst:637 +#: ../../library/pickle.rst:656 msgid "" "At unpickling time, some methods like :meth:`__getattr__`, :meth:" "`__getattribute__`, or :meth:`__setattr__` may be called upon the instance. " @@ -848,7 +880,7 @@ msgid "" "`__init__` is not called when unpickling an instance." msgstr "" -#: ../../library/pickle.rst:646 +#: ../../library/pickle.rst:665 msgid "" "As we shall see, pickle does not use directly the methods described above. " "In fact, these methods are part of the copy protocol which implements the :" @@ -857,7 +889,7 @@ msgid "" "objects. [#]_" msgstr "" -#: ../../library/pickle.rst:652 +#: ../../library/pickle.rst:671 msgid "" "Although powerful, implementing :meth:`__reduce__` directly in your classes " "is error prone. For this reason, class designers should use the high-level " @@ -867,14 +899,14 @@ msgid "" "pickling or both." msgstr "" -#: ../../library/pickle.rst:661 +#: ../../library/pickle.rst:680 msgid "" "The interface is currently defined as follows. The :meth:`__reduce__` " "method takes no argument and shall return either a string or preferably a " "tuple (the returned object is often referred to as the \"reduce value\")." msgstr "" -#: ../../library/pickle.rst:665 +#: ../../library/pickle.rst:684 msgid "" "If a string is returned, the string should be interpreted as the name of a " "global variable. It should be the object's local name relative to its " @@ -882,26 +914,26 @@ msgid "" "object's module. This behaviour is typically useful for singletons." msgstr "" -#: ../../library/pickle.rst:670 +#: ../../library/pickle.rst:689 msgid "" "When a tuple is returned, it must be between two and six items long. " "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" -#: ../../library/pickle.rst:676 +#: ../../library/pickle.rst:695 msgid "" "A callable object that will be called to create the initial version of the " "object." msgstr "" -#: ../../library/pickle.rst:679 +#: ../../library/pickle.rst:698 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." msgstr "" -#: ../../library/pickle.rst:682 +#: ../../library/pickle.rst:701 msgid "" "Optionally, the object's state, which will be passed to the object's :meth:" "`__setstate__` method as previously described. If the object has no such " @@ -909,7 +941,7 @@ msgid "" "object's :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/pickle.rst:687 +#: ../../library/pickle.rst:706 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " @@ -921,7 +953,7 @@ msgid "" "must be supported.)" msgstr "" -#: ../../library/pickle.rst:696 +#: ../../library/pickle.rst:715 msgid "" "Optionally, an iterator (not a sequence) yielding successive key-value " "pairs. These items will be stored to the object using ``obj[key] = " @@ -929,7 +961,7 @@ msgid "" "by other classes as long as they implement :meth:`__setitem__`." msgstr "" -#: ../../library/pickle.rst:701 +#: ../../library/pickle.rst:720 msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " @@ -938,11 +970,11 @@ msgid "" "meth:`__setstate__`." msgstr "" -#: ../../library/pickle.rst:707 +#: ../../library/pickle.rst:726 msgid "The optional sixth tuple item, ``(obj, state)``, was added." msgstr "" -#: ../../library/pickle.rst:713 +#: ../../library/pickle.rst:732 msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " @@ -952,11 +984,11 @@ msgid "" "provide backwards-compatible reduce values for older Python releases." msgstr "" -#: ../../library/pickle.rst:725 +#: ../../library/pickle.rst:744 msgid "Persistence of External Objects" msgstr "" -#: ../../library/pickle.rst:731 +#: ../../library/pickle.rst:750 msgid "" "For the benefit of object persistence, the :mod:`pickle` module supports the " "notion of a reference to an object outside the pickled data stream. Such " @@ -965,7 +997,7 @@ msgid "" "(for any newer protocol)." msgstr "" -#: ../../library/pickle.rst:737 +#: ../../library/pickle.rst:756 msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " @@ -973,7 +1005,7 @@ msgid "" "persistent_load` respectively." msgstr "" -#: ../../library/pickle.rst:742 +#: ../../library/pickle.rst:761 msgid "" "To pickle objects that have an external persistent ID, the pickler must have " "a custom :meth:`~Pickler.persistent_id` method that takes an object as an " @@ -984,67 +1016,67 @@ msgid "" "persistent ID." msgstr "" -#: ../../library/pickle.rst:749 +#: ../../library/pickle.rst:768 msgid "" "To unpickle external objects, the unpickler must have a custom :meth:" "`~Unpickler.persistent_load` method that takes a persistent ID object and " "returns the referenced object." msgstr "" -#: ../../library/pickle.rst:753 +#: ../../library/pickle.rst:772 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" -#: ../../library/pickle.rst:761 +#: ../../library/pickle.rst:780 msgid "Dispatch Tables" msgstr "" -#: ../../library/pickle.rst:763 +#: ../../library/pickle.rst:782 msgid "" "If one wants to customize pickling of some classes without disturbing any " "other code which depends on pickling, then one can create a pickler with a " "private dispatch table." msgstr "" -#: ../../library/pickle.rst:767 +#: ../../library/pickle.rst:786 msgid "" "The global dispatch table managed by the :mod:`copyreg` module is available " "as :data:`copyreg.dispatch_table`. Therefore, one may choose to use a " "modified copy of :data:`copyreg.dispatch_table` as a private dispatch table." msgstr "" -#: ../../library/pickle.rst:772 +#: ../../library/pickle.rst:791 msgid "For example ::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/pickle.rst:779 +#: ../../library/pickle.rst:798 msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" msgstr "" -#: ../../library/pickle.rst:789 +#: ../../library/pickle.rst:808 msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" msgstr "" -#: ../../library/pickle.rst:796 +#: ../../library/pickle.rst:815 msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." msgstr "" -#: ../../library/pickle.rst:801 +#: ../../library/pickle.rst:820 msgid "Handling Stateful Objects" msgstr "" -#: ../../library/pickle.rst:807 +#: ../../library/pickle.rst:826 msgid "" "Here's an example that shows how to modify pickling behavior for a class. " "The :class:`TextReader` class opens a text file, and returns the line number " @@ -1056,15 +1088,15 @@ msgid "" "behavior. ::" msgstr "" -#: ../../library/pickle.rst:853 +#: ../../library/pickle.rst:872 msgid "A sample usage might be something like this::" msgstr "" -#: ../../library/pickle.rst:867 +#: ../../library/pickle.rst:886 msgid "Custom Reduction for Types, Functions, and Other Objects" msgstr "" -#: ../../library/pickle.rst:871 +#: ../../library/pickle.rst:890 msgid "" "Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " "particular we may want to customize pickling based on another criterion than " @@ -1072,7 +1104,7 @@ msgid "" "classes." msgstr "" -#: ../../library/pickle.rst:876 +#: ../../library/pickle.rst:895 msgid "" "For those cases, it is possible to subclass from the :class:`Pickler` class " "and implement a :meth:`~Pickler.reducer_override` method. This method can " @@ -1081,14 +1113,14 @@ msgid "" "behavior." msgstr "" -#: ../../library/pickle.rst:881 +#: ../../library/pickle.rst:900 msgid "" "If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." "reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " "takes priority." msgstr "" -#: ../../library/pickle.rst:886 +#: ../../library/pickle.rst:905 msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " @@ -1097,17 +1129,17 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/pickle.rst:892 +#: ../../library/pickle.rst:911 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" msgstr "" -#: ../../library/pickle.rst:927 +#: ../../library/pickle.rst:946 msgid "Out-of-band Buffers" msgstr "" -#: ../../library/pickle.rst:931 +#: ../../library/pickle.rst:950 msgid "" "In some contexts, the :mod:`pickle` module is used to transfer massive " "amounts of data. Therefore, it can be important to minimize the number of " @@ -1117,7 +1149,7 @@ msgid "" "involves copying data to and from the pickle stream." msgstr "" -#: ../../library/pickle.rst:938 +#: ../../library/pickle.rst:957 msgid "" "This constraint can be eschewed if both the *provider* (the implementation " "of the object types to be transferred) and the *consumer* (the " @@ -1125,11 +1157,11 @@ msgid "" "transfer facilities provided by pickle protocol 5 and higher." msgstr "" -#: ../../library/pickle.rst:944 +#: ../../library/pickle.rst:963 msgid "Provider API" msgstr "" -#: ../../library/pickle.rst:946 +#: ../../library/pickle.rst:965 msgid "" "The large data objects to be pickled must implement a :meth:`__reduce_ex__` " "method specialized for protocol 5 and higher, which returns a :class:" @@ -1137,7 +1169,7 @@ msgid "" "large data." msgstr "" -#: ../../library/pickle.rst:951 +#: ../../library/pickle.rst:970 msgid "" "A :class:`PickleBuffer` object *signals* that the underlying buffer is " "eligible for out-of-band data transfer. Those objects remain compatible " @@ -1146,17 +1178,17 @@ msgid "" "themselves." msgstr "" -#: ../../library/pickle.rst:958 +#: ../../library/pickle.rst:977 msgid "Consumer API" msgstr "" -#: ../../library/pickle.rst:960 +#: ../../library/pickle.rst:979 msgid "" "A communications system can enable custom handling of the :class:" "`PickleBuffer` objects generated when serializing an object graph." msgstr "" -#: ../../library/pickle.rst:963 +#: ../../library/pickle.rst:982 msgid "" "On the sending side, it needs to pass a *buffer_callback* argument to :class:" "`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " @@ -1165,7 +1197,7 @@ msgid "" "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -#: ../../library/pickle.rst:970 +#: ../../library/pickle.rst:989 msgid "" "On the receiving side, it needs to pass a *buffers* argument to :class:" "`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " @@ -1176,7 +1208,7 @@ msgid "" "`PickleBuffer` objects." msgstr "" -#: ../../library/pickle.rst:978 +#: ../../library/pickle.rst:997 msgid "" "Between the sending side and the receiving side, the communications system " "is free to implement its own transfer mechanism for out-of-band buffers. " @@ -1184,36 +1216,36 @@ msgid "" "dependent compression." msgstr "" -#: ../../library/pickle.rst:984 +#: ../../library/pickle.rst:1003 msgid "Example" msgstr "範例" -#: ../../library/pickle.rst:986 +#: ../../library/pickle.rst:1005 msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -#: ../../library/pickle.rst:1010 +#: ../../library/pickle.rst:1029 msgid "" "The reconstructor (the ``_reconstruct`` class method) returns the buffer's " "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" -#: ../../library/pickle.rst:1014 +#: ../../library/pickle.rst:1033 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" msgstr "" -#: ../../library/pickle.rst:1023 +#: ../../library/pickle.rst:1042 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" -#: ../../library/pickle.rst:1033 +#: ../../library/pickle.rst:1052 msgid "" "This example is limited by the fact that :class:`bytearray` allocates its " "own memory: you cannot create a :class:`bytearray` instance that is backed " @@ -1223,15 +1255,15 @@ msgid "" "processes or systems." msgstr "" -#: ../../library/pickle.rst:1040 +#: ../../library/pickle.rst:1059 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" msgstr "" -#: ../../library/pickle.rst:1046 +#: ../../library/pickle.rst:1065 msgid "Restricting Globals" msgstr "" -#: ../../library/pickle.rst:1051 +#: ../../library/pickle.rst:1070 msgid "" "By default, unpickling will import any class or function that it finds in " "the pickle data. For many applications, this behaviour is unacceptable as " @@ -1239,7 +1271,7 @@ msgid "" "what this hand-crafted pickle data stream does when loaded::" msgstr "" -#: ../../library/pickle.rst:1061 +#: ../../library/pickle.rst:1080 msgid "" "In this example, the unpickler imports the :func:`os.system` function and " "then apply the string argument \"echo hello world\". Although this example " @@ -1247,7 +1279,7 @@ msgid "" "system." msgstr "" -#: ../../library/pickle.rst:1065 +#: ../../library/pickle.rst:1084 msgid "" "For this reason, you may want to control what gets unpickled by customizing :" "meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." @@ -1256,17 +1288,17 @@ msgid "" "restrict them to a safe subset." msgstr "" -#: ../../library/pickle.rst:1071 +#: ../../library/pickle.rst:1090 msgid "" "Here is an example of an unpickler allowing only few safe classes from the :" "mod:`builtins` module to be loaded::" msgstr "" -#: ../../library/pickle.rst:1100 +#: ../../library/pickle.rst:1119 msgid "A sample usage of our unpickler working as intended::" msgstr "" -#: ../../library/pickle.rst:1119 +#: ../../library/pickle.rst:1138 msgid "" "As our examples shows, you have to be careful with what you allow to be " "unpickled. Therefore if security is a concern, you may want to consider " @@ -1274,97 +1306,97 @@ msgid "" "party solutions." msgstr "" -#: ../../library/pickle.rst:1126 +#: ../../library/pickle.rst:1145 msgid "Performance" msgstr "" -#: ../../library/pickle.rst:1128 +#: ../../library/pickle.rst:1147 msgid "" "Recent versions of the pickle protocol (from protocol 2 and upwards) feature " "efficient binary encodings for several common features and built-in types. " "Also, the :mod:`pickle` module has a transparent optimizer written in C." msgstr "" -#: ../../library/pickle.rst:1136 +#: ../../library/pickle.rst:1155 msgid "Examples" msgstr "範例" -#: ../../library/pickle.rst:1138 +#: ../../library/pickle.rst:1157 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" msgstr "" -#: ../../library/pickle.rst:1154 +#: ../../library/pickle.rst:1173 msgid "The following example reads the resulting pickled data. ::" msgstr "" -#: ../../library/pickle.rst:1171 +#: ../../library/pickle.rst:1190 msgid "Module :mod:`copyreg`" msgstr ":mod:`copyreg` 模組" -#: ../../library/pickle.rst:1171 +#: ../../library/pickle.rst:1190 msgid "Pickle interface constructor registration for extension types." msgstr "" -#: ../../library/pickle.rst:1174 +#: ../../library/pickle.rst:1193 msgid "Module :mod:`pickletools`" msgstr ":mod:`pickletools` 模組" -#: ../../library/pickle.rst:1174 +#: ../../library/pickle.rst:1193 msgid "Tools for working with and analyzing pickled data." msgstr "" -#: ../../library/pickle.rst:1177 +#: ../../library/pickle.rst:1196 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/pickle.rst:1177 +#: ../../library/pickle.rst:1196 msgid "Indexed databases of objects; uses :mod:`pickle`." msgstr "" -#: ../../library/pickle.rst:1180 +#: ../../library/pickle.rst:1199 msgid "Module :mod:`copy`" msgstr ":mod:`copy` 模組" -#: ../../library/pickle.rst:1180 +#: ../../library/pickle.rst:1199 msgid "Shallow and deep object copying." msgstr "" -#: ../../library/pickle.rst:1182 +#: ../../library/pickle.rst:1201 msgid "Module :mod:`marshal`" msgstr ":mod:`marshal` 模組" -#: ../../library/pickle.rst:1183 +#: ../../library/pickle.rst:1202 msgid "High-performance serialization of built-in types." msgstr "" -#: ../../library/pickle.rst:1187 +#: ../../library/pickle.rst:1206 msgid "Footnotes" msgstr "註解" -#: ../../library/pickle.rst:1188 +#: ../../library/pickle.rst:1207 msgid "Don't confuse this with the :mod:`marshal` module" msgstr "" -#: ../../library/pickle.rst:1190 +#: ../../library/pickle.rst:1209 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." msgstr "" -#: ../../library/pickle.rst:1193 +#: ../../library/pickle.rst:1212 msgid "" "The exception raised will likely be an :exc:`ImportError` or an :exc:" "`AttributeError` but it could be something else." msgstr "" -#: ../../library/pickle.rst:1196 +#: ../../library/pickle.rst:1215 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." msgstr "" -#: ../../library/pickle.rst:1199 +#: ../../library/pickle.rst:1218 msgid "" "The limitation on alphanumeric characters is due to the fact that persistent " "IDs in protocol 0 are delimited by the newline character. Therefore if any " diff --git a/library/pipes.po b/library/pipes.po index 265073ae61..efce40fb9e 100644 --- a/library/pipes.po +++ b/library/pipes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:11+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`pipes` --- shell pipelines 介面" msgid "**Source code:** :source:`Lib/pipes.py`" msgstr "**原始碼:**\\ :source:`Lib/pipes.py`" -#: ../../library/pipes.rst:13 +#: ../../library/pipes.rst:17 msgid "" "The :mod:`pipes` module is deprecated (see :pep:`PEP 594 <594#pipes>` for " "details). Please use the :mod:`subprocess` module instead." @@ -48,8 +48,8 @@ msgid "" msgstr "" #: ../../library/pipes.rst:27 -msgid ":ref:`Availability `: Unix. Not available on VxWorks." -msgstr ":ref:`適用 `:Unix,VxWorks 上不支援。" +msgid ":ref:`Availability `: Unix, not VxWorks." +msgstr ":ref:`適用 `:Unix,非 VxWorks。" #: ../../library/pipes.rst:28 msgid "The :mod:`pipes` module defines the following class:" diff --git a/library/poplib.po b/library/poplib.po index 6affc49d81..2ef9edf5a7 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,11 +51,22 @@ msgid "" "IMAP4` class, as IMAP servers tend to be better implemented." msgstr "" -#: ../../library/poplib.rst:31 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/poplib.rst:33 msgid "The :mod:`poplib` module provides two classes:" msgstr "" -#: ../../library/poplib.rst:36 +#: ../../library/poplib.rst:38 msgid "" "This class implements the actual POP3 protocol. The connection is created " "when the instance is initialized. If *port* is omitted, the standard POP3 " @@ -64,32 +75,32 @@ msgid "" "timeout setting will be used)." msgstr "" -#: ../../library/poplib.rst:42 ../../library/poplib.rst:68 +#: ../../library/poplib.rst:55 ../../library/poplib.rst:81 msgid "" "Raises an :ref:`auditing event ` ``poplib.connect`` with arguments " "``self``, ``host``, ``port``." msgstr "" -#: ../../library/poplib.rst:44 ../../library/poplib.rst:70 +#: ../../library/poplib.rst:57 ../../library/poplib.rst:83 msgid "" "Raises an :ref:`auditing event ` ``poplib.putline`` with arguments " "``self``, ``line``." msgstr "" -#: ../../library/poplib.rst:46 ../../library/poplib.rst:72 +#: ../../library/poplib.rst:48 ../../library/poplib.rst:74 msgid "" "All commands will raise an :ref:`auditing event ` ``poplib." "putline`` with arguments ``self`` and ``line``, where ``line`` is the bytes " "about to be sent to the remote host." msgstr "" -#: ../../library/poplib.rst:50 ../../library/poplib.rst:91 +#: ../../library/poplib.rst:52 ../../library/poplib.rst:93 msgid "" "If the *timeout* parameter is set to be zero, it will raise a :class:" "`ValueError` to prevent the creation of a non-blocking socket." msgstr "" -#: ../../library/poplib.rst:56 +#: ../../library/poplib.rst:58 msgid "" "This is a subclass of :class:`POP3` that connects to the server over an SSL " "encrypted socket. If *port* is not specified, 995, the standard POP3-over-" @@ -100,79 +111,79 @@ msgid "" "for best practices." msgstr "" -#: ../../library/poplib.rst:64 +#: ../../library/poplib.rst:66 msgid "" "*keyfile* and *certfile* are a legacy alternative to *context* - they can " "point to PEM-formatted private key and certificate chain files, " "respectively, for the SSL connection." msgstr "" -#: ../../library/poplib.rst:76 +#: ../../library/poplib.rst:78 msgid "*context* parameter added." msgstr "" -#: ../../library/poplib.rst:79 +#: ../../library/poplib.rst:81 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/poplib.rst:86 +#: ../../library/poplib.rst:88 msgid "" "*keyfile* and *certfile* are deprecated in favor of *context*. Please use :" "meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." "create_default_context` select the system's trusted CA certificates for you." msgstr "" -#: ../../library/poplib.rst:95 +#: ../../library/poplib.rst:97 msgid "One exception is defined as an attribute of the :mod:`poplib` module:" msgstr "" -#: ../../library/poplib.rst:100 +#: ../../library/poplib.rst:102 msgid "" "Exception raised on any errors from this module (errors from :mod:`socket` " "module are not caught). The reason for the exception is passed to the " "constructor as a string." msgstr "" -#: ../../library/poplib.rst:108 +#: ../../library/poplib.rst:110 msgid "Module :mod:`imaplib`" msgstr ":mod:`imaplib` 模組" -#: ../../library/poplib.rst:108 +#: ../../library/poplib.rst:110 msgid "The standard Python IMAP module." msgstr "" -#: ../../library/poplib.rst:112 +#: ../../library/poplib.rst:114 msgid "" "`Frequently Asked Questions About Fetchmail `_" msgstr "" -"`關於 Fetchmail 的常見問題 `_" +"`關於 Fetchmail 的常見問題 `_" -#: ../../library/poplib.rst:111 +#: ../../library/poplib.rst:113 msgid "" "The FAQ for the :program:`fetchmail` POP/IMAP client collects information on " "POP3 server variations and RFC noncompliance that may be useful if you need " "to write an application based on the POP protocol." msgstr "" -#: ../../library/poplib.rst:119 +#: ../../library/poplib.rst:121 msgid "POP3 Objects" msgstr "POP3 物件" -#: ../../library/poplib.rst:121 +#: ../../library/poplib.rst:123 msgid "" -"All POP3 commands are represented by methods of the same name, in lower-" -"case; most return the response text sent by the server." +"All POP3 commands are represented by methods of the same name, in lowercase; " +"most return the response text sent by the server." msgstr "" -#: ../../library/poplib.rst:124 -msgid "An :class:`POP3` instance has the following methods:" +#: ../../library/poplib.rst:126 +msgid "A :class:`POP3` instance has the following methods:" msgstr "" -#: ../../library/poplib.rst:129 +#: ../../library/poplib.rst:131 msgid "" "Set the instance's debugging level. This controls the amount of debugging " "output printed. The default, ``0``, produces no debugging output. A value " @@ -182,81 +193,81 @@ msgid "" "connection." msgstr "" -#: ../../library/poplib.rst:138 +#: ../../library/poplib.rst:140 msgid "Returns the greeting string sent by the POP3 server." msgstr "" -#: ../../library/poplib.rst:143 +#: ../../library/poplib.rst:145 msgid "" "Query the server's capabilities as specified in :rfc:`2449`. Returns a " "dictionary in the form ``{'name': ['param'...]}``." msgstr "" -#: ../../library/poplib.rst:151 +#: ../../library/poplib.rst:153 msgid "" "Send user command, response should indicate that a password is required." msgstr "" -#: ../../library/poplib.rst:156 +#: ../../library/poplib.rst:158 msgid "" "Send password, response includes message count and mailbox size. Note: the " "mailbox on the server is locked until :meth:`~poplib.quit` is called." msgstr "" -#: ../../library/poplib.rst:162 +#: ../../library/poplib.rst:164 msgid "Use the more secure APOP authentication to log into the POP3 server." msgstr "" -#: ../../library/poplib.rst:167 +#: ../../library/poplib.rst:169 msgid "" "Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server." msgstr "" -#: ../../library/poplib.rst:172 +#: ../../library/poplib.rst:174 msgid "" "Get mailbox status. The result is a tuple of 2 integers: ``(message count, " "mailbox size)``." msgstr "" -#: ../../library/poplib.rst:178 +#: ../../library/poplib.rst:180 msgid "" "Request message list, result is in the form ``(response, ['mesg_num " "octets', ...], octets)``. If *which* is set, it is the message to list." msgstr "" -#: ../../library/poplib.rst:184 +#: ../../library/poplib.rst:186 msgid "" "Retrieve whole message number *which*, and set its seen flag. Result is in " "form ``(response, ['line', ...], octets)``." msgstr "" -#: ../../library/poplib.rst:190 +#: ../../library/poplib.rst:192 msgid "" "Flag message number *which* for deletion. On most servers deletions are not " "actually performed until QUIT (the major exception is Eudora QPOP, which " "deliberately violates the RFCs by doing pending deletes on any disconnect)." msgstr "" -#: ../../library/poplib.rst:197 +#: ../../library/poplib.rst:199 msgid "Remove any deletion marks for the mailbox." msgstr "" -#: ../../library/poplib.rst:202 +#: ../../library/poplib.rst:204 msgid "Do nothing. Might be used as a keep-alive." msgstr "" -#: ../../library/poplib.rst:207 +#: ../../library/poplib.rst:209 msgid "Signoff: commit changes, unlock mailbox, drop connection." msgstr "" -#: ../../library/poplib.rst:212 +#: ../../library/poplib.rst:214 msgid "" "Retrieves the message header plus *howmuch* lines of the message after the " "header of message number *which*. Result is in form ``(response, " "['line', ...], octets)``." msgstr "" -#: ../../library/poplib.rst:216 +#: ../../library/poplib.rst:218 msgid "" "The POP3 TOP command this method uses, unlike the RETR command, doesn't set " "the message's seen flag; unfortunately, TOP is poorly specified in the RFCs " @@ -264,26 +275,26 @@ msgid "" "against the POP3 servers you will use before trusting it." msgstr "" -#: ../../library/poplib.rst:224 +#: ../../library/poplib.rst:226 msgid "" "Return message digest (unique id) list. If *which* is specified, result " "contains the unique id for that message in the form ``'response mesgnum " "uid``, otherwise result is list ``(response, ['mesgnum uid', ...], octets)``." msgstr "" -#: ../../library/poplib.rst:231 +#: ../../library/poplib.rst:233 msgid "" "Try to switch to UTF-8 mode. Returns the server response if successful, " "raises :class:`error_proto` if not. Specified in :RFC:`6856`." msgstr "" -#: ../../library/poplib.rst:239 +#: ../../library/poplib.rst:241 msgid "" "Start a TLS session on the active connection as specified in :rfc:`2595`. " "This is only allowed before user authentication" msgstr "" -#: ../../library/poplib.rst:242 +#: ../../library/poplib.rst:244 msgid "" "*context* parameter is a :class:`ssl.SSLContext` object which allows " "bundling SSL configuration options, certificates and private keys into a " @@ -291,29 +302,29 @@ msgid "" "for best practices." msgstr "" -#: ../../library/poplib.rst:247 +#: ../../library/poplib.rst:249 msgid "" "This method supports hostname checking via :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/poplib.rst:254 +#: ../../library/poplib.rst:256 msgid "" "Instances of :class:`POP3_SSL` have no additional methods. The interface of " "this subclass is identical to its parent." msgstr "" -#: ../../library/poplib.rst:261 +#: ../../library/poplib.rst:263 msgid "POP3 Example" msgstr "POP3 範例" -#: ../../library/poplib.rst:263 +#: ../../library/poplib.rst:265 msgid "" "Here is a minimal example (without error checking) that opens a mailbox and " "retrieves and prints all messages::" msgstr "" -#: ../../library/poplib.rst:276 +#: ../../library/poplib.rst:278 msgid "" "At the end of the module, there is a test section that contains a more " "extensive example of usage." diff --git a/library/pprint.po b/library/pprint.po index 191c4e01f6..c79aae4d28 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,22 +69,24 @@ msgstr "" #: ../../library/pprint.rst:47 msgid "" "*stream* (default ``sys.stdout``) is a :term:`file-like object` to which the " -"output will be written by calling its :meth:`write` method." +"output will be written by calling its :meth:`write` method. If both *stream* " +"and ``sys.stdout`` are ``None``, then :meth:`~PrettyPrinter.pprint` silently " +"returns." msgstr "" -#: ../../library/pprint.rst:50 +#: ../../library/pprint.rst:52 msgid "" "Other values configure the manner in which nesting of complex data " "structures is displayed." msgstr "" -#: ../../library/pprint.rst:53 +#: ../../library/pprint.rst:55 msgid "" "*indent* (default 1) specifies the amount of indentation added for each " "nesting level." msgstr "" -#: ../../library/pprint.rst:56 +#: ../../library/pprint.rst:58 msgid "" "*depth* controls the number of nesting levels which may be printed; if the " "data structure being printed is too deep, the next contained level is " @@ -92,14 +94,14 @@ msgid "" "objects being formatted." msgstr "" -#: ../../library/pprint.rst:61 +#: ../../library/pprint.rst:63 msgid "" "*width* (default 80) specifies the desired maximum number of characters per " "line in the output. If a structure cannot be formatted within the width " "constraint, a best effort will be made." msgstr "" -#: ../../library/pprint.rst:65 +#: ../../library/pprint.rst:67 msgid "" "*compact* impacts the way that long sequences (lists, tuples, sets, etc) are " "formatted. If *compact* is false (the default) then each item of a sequence " @@ -107,46 +109,44 @@ msgid "" "as will fit within the *width* will be formatted on each output line." msgstr "" -#: ../../library/pprint.rst:71 +#: ../../library/pprint.rst:73 msgid "" "If *sort_dicts* is true (the default), dictionaries will be formatted with " "their keys sorted, otherwise they will display in insertion order." msgstr "" -#: ../../library/pprint.rst:74 +#: ../../library/pprint.rst:76 msgid "" "If *underscore_numbers* is true, integers will be formatted with the ``_`` " "character for a thousands separator, otherwise underscores are not displayed " "(the default)." msgstr "" -#: ../../library/pprint.rst:78 ../../library/pprint.rst:120 -#: ../../library/pprint.rst:151 +#: ../../library/pprint.rst:80 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/pprint.rst:81 ../../library/pprint.rst:123 -#: ../../library/pprint.rst:154 +#: ../../library/pprint.rst:83 msgid "Added the *sort_dicts* parameter." msgstr "新增 *sort_dicts* 參數。" -#: ../../library/pprint.rst:84 ../../library/pprint.rst:126 -#: ../../library/pprint.rst:157 +#: ../../library/pprint.rst:86 msgid "Added the *underscore_numbers* parameter." msgstr "新增 *underscore_numbers* 參數。" -#: ../../library/pprint.rst:111 -msgid "The :mod:`pprint` module also provides several shortcut functions:" +#: ../../library/pprint.rst:89 +msgid "No longer attempts to write to ``sys.stdout`` if it is ``None``." msgstr "" -#: ../../library/pprint.rst:116 +#: ../../library/pprint.rst:118 msgid "" "Return the formatted representation of *object* as a string. *indent*, " -"*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* will be " -"passed to the :class:`PrettyPrinter` constructor as formatting parameters." +"*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are " +"passed to the :class:`PrettyPrinter` constructor as formatting parameters " +"and their meanings are as described in its documentation above." msgstr "" -#: ../../library/pprint.rst:132 +#: ../../library/pprint.rst:126 msgid "" "Prints the formatted representation of *object* followed by a newline. If " "*sort_dicts* is false (the default), dictionaries will be displayed with " @@ -155,33 +155,39 @@ msgid "" "parameters." msgstr "" -#: ../../library/pprint.rst:144 +#: ../../library/pprint.rst:138 msgid "" "Prints the formatted representation of *object* on *stream*, followed by a " -"newline. If *stream* is ``None``, ``sys.stdout`` is used. This may be used " +"newline. If *stream* is ``None``, ``sys.stdout`` is used. This may be used " "in the interactive interpreter instead of the :func:`print` function for " "inspecting values (you can even reassign ``print = pprint.pprint`` for use " -"within a scope). *indent*, *width*, *depth*, *compact*, *sort_dicts* and " -"*underscore_numbers* will be passed to the :class:`PrettyPrinter` " -"constructor as formatting parameters." +"within a scope)." msgstr "" -#: ../../library/pprint.rst:176 +#: ../../library/pprint.rst:144 +msgid "" +"The configuration parameters *stream*, *indent*, *width*, *depth*, " +"*compact*, *sort_dicts* and *underscore_numbers* are passed to the :class:" +"`PrettyPrinter` constructor and their meanings are as described in its " +"documentation above." +msgstr "" + +#: ../../library/pprint.rst:164 msgid "" "Determine if the formatted representation of *object* is \"readable\", or " "can be used to reconstruct the value using :func:`eval`. This always " "returns ``False`` for recursive objects." msgstr "" -#: ../../library/pprint.rst:186 +#: ../../library/pprint.rst:174 msgid "Determine if *object* requires a recursive representation." msgstr "" -#: ../../library/pprint.rst:189 +#: ../../library/pprint.rst:177 msgid "One more support function is also defined:" msgstr "" -#: ../../library/pprint.rst:193 +#: ../../library/pprint.rst:181 msgid "" "Return a string representation of *object*, protected against recursive data " "structures. If the representation of *object* exposes a recursive entry, " @@ -189,27 +195,27 @@ msgid "" "id=number>``. The representation is not otherwise formatted." msgstr "" -#: ../../library/pprint.rst:205 +#: ../../library/pprint.rst:193 msgid "PrettyPrinter Objects" msgstr "PrettyPrinter 物件" -#: ../../library/pprint.rst:207 +#: ../../library/pprint.rst:195 msgid ":class:`PrettyPrinter` instances have the following methods:" msgstr "" -#: ../../library/pprint.rst:212 +#: ../../library/pprint.rst:200 msgid "" "Return the formatted representation of *object*. This takes into account " "the options passed to the :class:`PrettyPrinter` constructor." msgstr "" -#: ../../library/pprint.rst:218 +#: ../../library/pprint.rst:206 msgid "" "Print the formatted representation of *object* on the configured stream, " "followed by a newline." msgstr "" -#: ../../library/pprint.rst:221 +#: ../../library/pprint.rst:209 msgid "" "The following methods provide the implementations for the corresponding " "functions of the same names. Using these methods on an instance is slightly " @@ -217,7 +223,7 @@ msgid "" "created." msgstr "" -#: ../../library/pprint.rst:231 +#: ../../library/pprint.rst:219 msgid "" "Determine if the formatted representation of the object is \"readable,\" or " "can be used to reconstruct the value using :func:`eval`. Note that this " @@ -226,18 +232,18 @@ msgid "" "returns ``False``." msgstr "" -#: ../../library/pprint.rst:240 +#: ../../library/pprint.rst:228 msgid "Determine if the object requires a recursive representation." msgstr "" -#: ../../library/pprint.rst:242 +#: ../../library/pprint.rst:230 msgid "" "This method is provided as a hook to allow subclasses to modify the way " "objects are converted to strings. The default implementation uses the " "internals of the :func:`saferepr` implementation." msgstr "" -#: ../../library/pprint.rst:249 +#: ../../library/pprint.rst:237 msgid "" "Returns three values: the formatted version of *object* as a string, a flag " "indicating whether the result is readable, and a flag indicating whether " @@ -255,28 +261,28 @@ msgid "" "of the current call." msgstr "" -#: ../../library/pprint.rst:267 +#: ../../library/pprint.rst:255 msgid "Example" msgstr "範例" -#: ../../library/pprint.rst:269 +#: ../../library/pprint.rst:257 msgid "" "To demonstrate several uses of the :func:`pprint` function and its " "parameters, let's fetch information about a project from `PyPI `_::" msgstr "" -#: ../../library/pprint.rst:278 +#: ../../library/pprint.rst:266 msgid "In its basic form, :func:`pprint` shows the whole object::" msgstr "" -#: ../../library/pprint.rst:334 +#: ../../library/pprint.rst:322 msgid "" "The result can be limited to a certain *depth* (ellipsis is used for deeper " "contents)::" msgstr "" -#: ../../library/pprint.rst:380 +#: ../../library/pprint.rst:368 msgid "" "Additionally, maximum character *width* can be suggested. If a long object " "cannot be split, the specified width will be exceeded::" diff --git a/library/profile.po b/library/profile.po index 68676beec9..bb1e4ea951 100644 --- a/library/profile.po +++ b/library/profile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-24 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -97,64 +97,64 @@ msgid "" "the following::" msgstr "" -#: ../../library/profile.rst:82 +#: ../../library/profile.rst:83 msgid "" -"The first line indicates that 197 calls were monitored. Of those calls, 192 " +"The first line indicates that 214 calls were monitored. Of those calls, 207 " "were :dfn:`primitive`, meaning that the call was not induced via recursion. " -"The next line: ``Ordered by: standard name``, indicates that the text string " -"in the far right column was used to sort the output. The column headings " -"include:" +"The next line: ``Ordered by: cumulative name``, indicates that the text " +"string in the far right column was used to sort the output. The column " +"headings include:" msgstr "" -#: ../../library/profile.rst:88 +#: ../../library/profile.rst:89 msgid "ncalls" msgstr "ncalls" -#: ../../library/profile.rst:88 +#: ../../library/profile.rst:89 msgid "for the number of calls." msgstr "" -#: ../../library/profile.rst:92 +#: ../../library/profile.rst:93 msgid "tottime" msgstr "tottime" -#: ../../library/profile.rst:91 +#: ../../library/profile.rst:92 msgid "" "for the total time spent in the given function (and excluding time made in " "calls to sub-functions)" msgstr "" -#: ../../library/profile.rst:95 ../../library/profile.rst:102 +#: ../../library/profile.rst:96 ../../library/profile.rst:103 msgid "percall" msgstr "percall" -#: ../../library/profile.rst:95 +#: ../../library/profile.rst:96 msgid "is the quotient of ``tottime`` divided by ``ncalls``" msgstr "" -#: ../../library/profile.rst:99 +#: ../../library/profile.rst:100 msgid "cumtime" msgstr "cumtime" -#: ../../library/profile.rst:98 +#: ../../library/profile.rst:99 msgid "" "is the cumulative time spent in this and all subfunctions (from invocation " "till exit). This figure is accurate *even* for recursive functions." msgstr "" -#: ../../library/profile.rst:102 +#: ../../library/profile.rst:103 msgid "is the quotient of ``cumtime`` divided by primitive calls" msgstr "" -#: ../../library/profile.rst:105 +#: ../../library/profile.rst:106 msgid "filename:lineno(function)" msgstr "" -#: ../../library/profile.rst:105 +#: ../../library/profile.rst:106 msgid "provides the respective data of each function" msgstr "" -#: ../../library/profile.rst:107 +#: ../../library/profile.rst:108 msgid "" "When there are two numbers in the first column (for example ``3/1``), it " "means that the function recursed. The second value is the number of " @@ -163,54 +163,54 @@ msgid "" "single figure is printed." msgstr "" -#: ../../library/profile.rst:113 +#: ../../library/profile.rst:114 msgid "" "Instead of printing the output at the end of the profile run, you can save " "the results to a file by specifying a filename to the :func:`run` function::" msgstr "" -#: ../../library/profile.rst:120 +#: ../../library/profile.rst:121 msgid "" "The :class:`pstats.Stats` class reads profile results from a file and " "formats them in various ways." msgstr "" -#: ../../library/profile.rst:123 +#: ../../library/profile.rst:124 msgid "" "The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script " "to profile another script. For example::" msgstr "" -#: ../../library/profile.rst:128 +#: ../../library/profile.rst:129 msgid "``-o`` writes the profile results to a file instead of to stdout" msgstr "" -#: ../../library/profile.rst:130 +#: ../../library/profile.rst:131 msgid "" "``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to " "sort the output by. This only applies when ``-o`` is not supplied." msgstr "" -#: ../../library/profile.rst:133 +#: ../../library/profile.rst:134 msgid "``-m`` specifies that a module is being profiled instead of a script." msgstr "" -#: ../../library/profile.rst:135 +#: ../../library/profile.rst:136 msgid "Added the ``-m`` option to :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:138 +#: ../../library/profile.rst:139 msgid "Added the ``-m`` option to :mod:`profile`." msgstr "" -#: ../../library/profile.rst:141 +#: ../../library/profile.rst:142 msgid "" "The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of " "methods for manipulating and printing the data saved into a profile results " "file::" msgstr "" -#: ../../library/profile.rst:149 +#: ../../library/profile.rst:150 msgid "" "The :meth:`~pstats.Stats.strip_dirs` method removed the extraneous path from " "all the module names. The :meth:`~pstats.Stats.sort_stats` method sorted all " @@ -219,44 +219,44 @@ msgid "" "statistics. You might try the following sort calls::" msgstr "" -#: ../../library/profile.rst:158 +#: ../../library/profile.rst:159 msgid "" "The first call will actually sort the list by function name, and the second " "call will print out the statistics. The following are some interesting " "calls to experiment with::" msgstr "" -#: ../../library/profile.rst:164 +#: ../../library/profile.rst:165 msgid "" "This sorts the profile by cumulative time in a function, and then only " "prints the ten most significant lines. If you want to understand what " "algorithms are taking time, the above line is what you would use." msgstr "" -#: ../../library/profile.rst:168 +#: ../../library/profile.rst:169 msgid "" "If you were looking to see what functions were looping a lot, and taking a " "lot of time, you would do::" msgstr "" -#: ../../library/profile.rst:173 +#: ../../library/profile.rst:174 msgid "" "to sort according to time spent within each function, and then print the " "statistics for the top ten functions." msgstr "" -#: ../../library/profile.rst:176 +#: ../../library/profile.rst:177 msgid "You might also try::" msgstr "" -#: ../../library/profile.rst:180 +#: ../../library/profile.rst:181 msgid "" "This will sort all the statistics by file name, and then print out " "statistics for only the class init methods (since they are spelled with " "``__init__`` in them). As one final example, you could try::" msgstr "" -#: ../../library/profile.rst:186 +#: ../../library/profile.rst:187 msgid "" "This line sorts statistics with a primary key of time, and a secondary key " "of cumulative time, and then prints out some of the statistics. To be " @@ -265,46 +265,46 @@ msgid "" "list is printed." msgstr "" -#: ../../library/profile.rst:191 +#: ../../library/profile.rst:192 msgid "" "If you wondered what functions called the above functions, you could now " "(``p`` is still sorted according to the last criteria) do::" msgstr "" -#: ../../library/profile.rst:196 +#: ../../library/profile.rst:197 msgid "and you would get a list of callers for each of the listed functions." msgstr "" -#: ../../library/profile.rst:198 +#: ../../library/profile.rst:199 msgid "" "If you want more functionality, you're going to have to read the manual, or " "guess what the following functions do::" msgstr "" -#: ../../library/profile.rst:204 +#: ../../library/profile.rst:205 msgid "" "Invoked as a script, the :mod:`pstats` module is a statistics browser for " "reading and examining profile dumps. It has a simple line-oriented " "interface (implemented using :mod:`cmd`) and interactive help." msgstr "" -#: ../../library/profile.rst:209 +#: ../../library/profile.rst:210 msgid ":mod:`profile` and :mod:`cProfile` Module Reference" msgstr "" -#: ../../library/profile.rst:215 +#: ../../library/profile.rst:216 msgid "" "Both the :mod:`profile` and :mod:`cProfile` modules provide the following " "functions:" msgstr "" -#: ../../library/profile.rst:220 +#: ../../library/profile.rst:221 msgid "" "This function takes a single argument that can be passed to the :func:`exec` " "function, and an optional file name. In all cases this routine executes::" msgstr "" -#: ../../library/profile.rst:225 +#: ../../library/profile.rst:226 msgid "" "and gathers profiling statistics from the execution. If no file name is " "present, then this function automatically creates a :class:`~pstats.Stats` " @@ -313,24 +313,24 @@ msgid "" "how the results are sorted." msgstr "" -#: ../../library/profile.rst:233 +#: ../../library/profile.rst:234 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " "globals and locals dictionaries for the *command* string. This routine " "executes::" msgstr "" -#: ../../library/profile.rst:239 +#: ../../library/profile.rst:240 msgid "and gathers profiling statistics as in the :func:`run` function above." msgstr "" -#: ../../library/profile.rst:243 +#: ../../library/profile.rst:244 msgid "" "This class is normally only used if more precise control over profiling is " "needed than what the :func:`cProfile.run` function provides." msgstr "" -#: ../../library/profile.rst:246 +#: ../../library/profile.rst:247 msgid "" "A custom timer can be supplied for measuring how long code takes to run via " "the *timer* argument. This must be a function that returns a single number " @@ -340,61 +340,61 @@ msgid "" "time unit would be ``.001``." msgstr "" -#: ../../library/profile.rst:253 +#: ../../library/profile.rst:254 msgid "" "Directly using the :class:`Profile` class allows formatting profile results " "without writing the profile data to a file::" msgstr "" -#: ../../library/profile.rst:268 +#: ../../library/profile.rst:269 msgid "" "The :class:`Profile` class can also be used as a context manager (supported " "only in :mod:`cProfile` module. see :ref:`typecontextmanager`)::" msgstr "" -#: ../../library/profile.rst:278 +#: ../../library/profile.rst:279 msgid "Added context manager support." msgstr "" -#: ../../library/profile.rst:283 +#: ../../library/profile.rst:284 msgid "Start collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:287 +#: ../../library/profile.rst:288 msgid "Stop collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:291 +#: ../../library/profile.rst:292 msgid "" "Stop collecting profiling data and record the results internally as the " "current profile." msgstr "" -#: ../../library/profile.rst:296 +#: ../../library/profile.rst:297 msgid "" "Create a :class:`~pstats.Stats` object based on the current profile and " "print the results to stdout." msgstr "" -#: ../../library/profile.rst:301 +#: ../../library/profile.rst:302 msgid "Write the results of the current profile to *filename*." msgstr "" -#: ../../library/profile.rst:305 +#: ../../library/profile.rst:306 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: ../../library/profile.rst:309 +#: ../../library/profile.rst:310 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: ../../library/profile.rst:314 +#: ../../library/profile.rst:315 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: ../../library/profile.rst:316 +#: ../../library/profile.rst:317 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -402,23 +402,23 @@ msgid "" "printed." msgstr "" -#: ../../library/profile.rst:324 +#: ../../library/profile.rst:325 msgid "The :class:`Stats` Class" msgstr "" -#: ../../library/profile.rst:326 +#: ../../library/profile.rst:327 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: ../../library/profile.rst:333 +#: ../../library/profile.rst:334 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: ../../library/profile.rst:337 +#: ../../library/profile.rst:338 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -432,17 +432,17 @@ msgid "" "can be used." msgstr "" -#: ../../library/profile.rst:348 +#: ../../library/profile.rst:349 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: ../../library/profile.rst:351 +#: ../../library/profile.rst:352 msgid ":class:`Stats` objects have the following methods:" msgstr "" -#: ../../library/profile.rst:355 +#: ../../library/profile.rst:356 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " @@ -456,7 +456,7 @@ msgid "" "single entry." msgstr "" -#: ../../library/profile.rst:369 +#: ../../library/profile.rst:370 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " @@ -465,7 +465,7 @@ msgid "" "functions are automatically accumulated into single function statistics." msgstr "" -#: ../../library/profile.rst:379 +#: ../../library/profile.rst:380 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -473,7 +473,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: ../../library/profile.rst:387 +#: ../../library/profile.rst:388 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -483,7 +483,7 @@ msgid "" "prone." msgstr "" -#: ../../library/profile.rst:394 +#: ../../library/profile.rst:395 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -492,164 +492,164 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: ../../library/profile.rst:400 +#: ../../library/profile.rst:401 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: ../../library/profile.rst:403 +#: ../../library/profile.rst:404 msgid "The following are the valid string and SortKey:" msgstr "" -#: ../../library/profile.rst:406 +#: ../../library/profile.rst:407 msgid "Valid String Arg" msgstr "" -#: ../../library/profile.rst:406 +#: ../../library/profile.rst:407 msgid "Valid enum Arg" msgstr "" -#: ../../library/profile.rst:406 +#: ../../library/profile.rst:407 msgid "Meaning" msgstr "" -#: ../../library/profile.rst:408 +#: ../../library/profile.rst:409 msgid "``'calls'``" msgstr "``'calls'``" -#: ../../library/profile.rst:408 +#: ../../library/profile.rst:409 msgid "SortKey.CALLS" msgstr "SortKey.CALLS" -#: ../../library/profile.rst:408 ../../library/profile.rst:420 +#: ../../library/profile.rst:409 ../../library/profile.rst:421 msgid "call count" msgstr "" -#: ../../library/profile.rst:410 +#: ../../library/profile.rst:411 msgid "``'cumulative'``" msgstr "``'cumulative'``" -#: ../../library/profile.rst:410 +#: ../../library/profile.rst:411 msgid "SortKey.CUMULATIVE" msgstr "SortKey.CUMULATIVE" -#: ../../library/profile.rst:410 ../../library/profile.rst:412 +#: ../../library/profile.rst:411 ../../library/profile.rst:413 msgid "cumulative time" msgstr "" -#: ../../library/profile.rst:412 +#: ../../library/profile.rst:413 msgid "``'cumtime'``" msgstr "``'cumtime'``" -#: ../../library/profile.rst:412 ../../library/profile.rst:414 -#: ../../library/profile.rst:418 ../../library/profile.rst:420 -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:413 ../../library/profile.rst:415 +#: ../../library/profile.rst:419 ../../library/profile.rst:421 +#: ../../library/profile.rst:435 msgid "N/A" msgstr "N/A" -#: ../../library/profile.rst:414 +#: ../../library/profile.rst:415 msgid "``'file'``" msgstr "``'file'``" -#: ../../library/profile.rst:414 ../../library/profile.rst:416 -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:415 ../../library/profile.rst:417 +#: ../../library/profile.rst:419 msgid "file name" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:417 msgid "``'filename'``" msgstr "``'filename'``" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:417 msgid "SortKey.FILENAME" msgstr "SortKey.FILENAME" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:419 msgid "``'module'``" msgstr "``'module'``" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:421 msgid "``'ncalls'``" msgstr "``'ncalls'``" -#: ../../library/profile.rst:422 +#: ../../library/profile.rst:423 msgid "``'pcalls'``" msgstr "``'pcalls'``" -#: ../../library/profile.rst:422 +#: ../../library/profile.rst:423 msgid "SortKey.PCALLS" msgstr "SortKey.PCALLS" -#: ../../library/profile.rst:422 +#: ../../library/profile.rst:423 msgid "primitive call count" msgstr "" -#: ../../library/profile.rst:424 +#: ../../library/profile.rst:425 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/profile.rst:424 +#: ../../library/profile.rst:425 msgid "SortKey.LINE" msgstr "SortKey.LINE" -#: ../../library/profile.rst:424 +#: ../../library/profile.rst:425 msgid "line number" msgstr "" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:427 msgid "``'name'``" msgstr "``'name'``" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:427 msgid "SortKey.NAME" msgstr "SortKey.NAME" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:427 msgid "function name" msgstr "" -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:429 msgid "``'nfl'``" msgstr "``'nfl'``" -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:429 msgid "SortKey.NFL" msgstr "SortKey.NFL" -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:429 msgid "name/file/line" msgstr "" -#: ../../library/profile.rst:430 +#: ../../library/profile.rst:431 msgid "``'stdname'``" msgstr "``'stdname'``" -#: ../../library/profile.rst:430 +#: ../../library/profile.rst:431 msgid "SortKey.STDNAME" msgstr "SortKey.STDNAME" -#: ../../library/profile.rst:430 +#: ../../library/profile.rst:431 msgid "standard name" msgstr "" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:433 msgid "``'time'``" msgstr "``'time'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:433 msgid "SortKey.TIME" msgstr "SortKey.TIME" -#: ../../library/profile.rst:432 ../../library/profile.rst:434 +#: ../../library/profile.rst:433 ../../library/profile.rst:435 msgid "internal time" msgstr "" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:435 msgid "``'tottime'``" msgstr "``'tottime'``" -#: ../../library/profile.rst:437 +#: ../../library/profile.rst:438 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " @@ -663,7 +663,7 @@ msgid "" "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: ../../library/profile.rst:448 +#: ../../library/profile.rst:449 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -672,31 +672,31 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: ../../library/profile.rst:456 +#: ../../library/profile.rst:457 msgid "Added the SortKey enum." msgstr "" -#: ../../library/profile.rst:461 +#: ../../library/profile.rst:462 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: ../../library/profile.rst:471 +#: ../../library/profile.rst:472 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: ../../library/profile.rst:474 +#: ../../library/profile.rst:475 msgid "" "The order of the printing is based on the last :meth:`~pstats.Stats." "sort_stats` operation done on the object (subject to caveats in :meth:" "`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: ../../library/profile.rst:479 +#: ../../library/profile.rst:480 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " @@ -708,20 +708,20 @@ msgid "" "example::" msgstr "" -#: ../../library/profile.rst:490 +#: ../../library/profile.rst:491 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: ../../library/profile.rst:496 +#: ../../library/profile.rst:497 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: ../../library/profile.rst:502 +#: ../../library/profile.rst:503 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -731,7 +731,7 @@ msgid "" "produced the stats:" msgstr "" -#: ../../library/profile.rst:509 +#: ../../library/profile.rst:510 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -739,14 +739,14 @@ msgid "" "at the right." msgstr "" -#: ../../library/profile.rst:514 +#: ../../library/profile.rst:515 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: ../../library/profile.rst:522 +#: ../../library/profile.rst:523 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -754,7 +754,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: ../../library/profile.rst:530 +#: ../../library/profile.rst:531 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -762,17 +762,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: ../../library/profile.rst:535 +#: ../../library/profile.rst:536 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: ../../library/profile.rst:542 +#: ../../library/profile.rst:543 msgid "What Is Deterministic Profiling?" msgstr "" -#: ../../library/profile.rst:544 +#: ../../library/profile.rst:545 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -785,7 +785,7 @@ msgid "" "being spent." msgstr "" -#: ../../library/profile.rst:553 +#: ../../library/profile.rst:554 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -797,7 +797,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: ../../library/profile.rst:562 +#: ../../library/profile.rst:563 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -809,11 +809,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: ../../library/profile.rst:575 +#: ../../library/profile.rst:576 msgid "Limitations" msgstr "限制" -#: ../../library/profile.rst:577 +#: ../../library/profile.rst:578 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -824,7 +824,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: ../../library/profile.rst:585 +#: ../../library/profile.rst:586 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -837,7 +837,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: ../../library/profile.rst:595 +#: ../../library/profile.rst:596 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -851,11 +851,11 @@ msgid "" "calibration." msgstr "" -#: ../../library/profile.rst:609 +#: ../../library/profile.rst:610 msgid "Calibration" msgstr "校正" -#: ../../library/profile.rst:611 +#: ../../library/profile.rst:612 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -864,7 +864,7 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: ../../library/profile.rst:622 +#: ../../library/profile.rst:623 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -874,48 +874,48 @@ msgid "" "4.04e-6." msgstr "" -#: ../../library/profile.rst:628 +#: ../../library/profile.rst:629 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: ../../library/profile.rst:632 +#: ../../library/profile.rst:633 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: ../../library/profile.rst:646 +#: ../../library/profile.rst:647 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: ../../library/profile.rst:652 +#: ../../library/profile.rst:653 msgid "Using a custom timer" msgstr "" -#: ../../library/profile.rst:654 +#: ../../library/profile.rst:655 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: ../../library/profile.rst:660 +#: ../../library/profile.rst:661 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: ../../library/profile.rst:678 +#: ../../library/profile.rst:679 msgid ":class:`profile.Profile`" msgstr ":class:`profile.Profile`" -#: ../../library/profile.rst:665 +#: ../../library/profile.rst:666 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -924,7 +924,7 @@ msgid "" "routine." msgstr "" -#: ../../library/profile.rst:671 +#: ../../library/profile.rst:672 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " @@ -936,11 +936,11 @@ msgid "" "along with the appropriate calibration constant." msgstr "" -#: ../../library/profile.rst:692 +#: ../../library/profile.rst:693 msgid ":class:`cProfile.Profile`" msgstr ":class:`cProfile.Profile`" -#: ../../library/profile.rst:681 +#: ../../library/profile.rst:682 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -949,7 +949,7 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: ../../library/profile.rst:689 +#: ../../library/profile.rst:690 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " @@ -957,7 +957,7 @@ msgid "" "in the C source of the internal :mod:`_lsprof` module." msgstr "" -#: ../../library/profile.rst:694 +#: ../../library/profile.rst:695 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " "make precise measurements of process or wall-clock time. For example, see :" diff --git a/library/pwd.po b/library/pwd.po index f384f9056f..8315de19bb 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,116 +28,127 @@ msgid "" "It is available on all Unix versions." msgstr "" -#: ../../library/pwd.rst:13 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/pwd.rst:15 msgid "" "Password database entries are reported as a tuple-like object, whose " "attributes correspond to the members of the ``passwd`` structure (Attribute " "field below, see ````):" msgstr "" -#: ../../library/pwd.rst:18 +#: ../../library/pwd.rst:20 msgid "Index" msgstr "" -#: ../../library/pwd.rst:18 +#: ../../library/pwd.rst:20 msgid "Attribute" msgstr "屬性" -#: ../../library/pwd.rst:18 +#: ../../library/pwd.rst:20 msgid "Meaning" msgstr "" -#: ../../library/pwd.rst:20 +#: ../../library/pwd.rst:22 msgid "0" msgstr "0" -#: ../../library/pwd.rst:20 +#: ../../library/pwd.rst:22 msgid "``pw_name``" msgstr "``pw_name``" -#: ../../library/pwd.rst:20 +#: ../../library/pwd.rst:22 msgid "Login name" msgstr "" -#: ../../library/pwd.rst:22 +#: ../../library/pwd.rst:24 msgid "1" msgstr "1" -#: ../../library/pwd.rst:22 +#: ../../library/pwd.rst:24 msgid "``pw_passwd``" msgstr "``pw_passwd``" -#: ../../library/pwd.rst:22 +#: ../../library/pwd.rst:24 msgid "Optional encrypted password" msgstr "" -#: ../../library/pwd.rst:24 +#: ../../library/pwd.rst:26 msgid "2" msgstr "2" -#: ../../library/pwd.rst:24 +#: ../../library/pwd.rst:26 msgid "``pw_uid``" msgstr "``pw_uid``" -#: ../../library/pwd.rst:24 +#: ../../library/pwd.rst:26 msgid "Numerical user ID" msgstr "" -#: ../../library/pwd.rst:26 +#: ../../library/pwd.rst:28 msgid "3" msgstr "3" -#: ../../library/pwd.rst:26 +#: ../../library/pwd.rst:28 msgid "``pw_gid``" msgstr "``pw_gid``" -#: ../../library/pwd.rst:26 +#: ../../library/pwd.rst:28 msgid "Numerical group ID" msgstr "" -#: ../../library/pwd.rst:28 +#: ../../library/pwd.rst:30 msgid "4" msgstr "4" -#: ../../library/pwd.rst:28 +#: ../../library/pwd.rst:30 msgid "``pw_gecos``" msgstr "``pw_gecos``" -#: ../../library/pwd.rst:28 +#: ../../library/pwd.rst:30 msgid "User name or comment field" msgstr "" -#: ../../library/pwd.rst:30 +#: ../../library/pwd.rst:32 msgid "5" msgstr "5" -#: ../../library/pwd.rst:30 +#: ../../library/pwd.rst:32 msgid "``pw_dir``" msgstr "``pw_dir``" -#: ../../library/pwd.rst:30 +#: ../../library/pwd.rst:32 msgid "User home directory" msgstr "" -#: ../../library/pwd.rst:32 +#: ../../library/pwd.rst:34 msgid "6" msgstr "6" -#: ../../library/pwd.rst:32 +#: ../../library/pwd.rst:34 msgid "``pw_shell``" msgstr "``pw_shell``" -#: ../../library/pwd.rst:32 +#: ../../library/pwd.rst:34 msgid "User command interpreter" msgstr "" -#: ../../library/pwd.rst:35 +#: ../../library/pwd.rst:37 msgid "" "The uid and gid items are integers, all others are strings. :exc:`KeyError` " "is raised if the entry asked for cannot be found." msgstr "" -#: ../../library/pwd.rst:42 +#: ../../library/pwd.rst:44 msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " "encrypted with a DES derived algorithm (see module :mod:`crypt`). However " @@ -149,35 +160,35 @@ msgid "" "should be used where access to the encrypted password is required." msgstr "" -#: ../../library/pwd.rst:51 +#: ../../library/pwd.rst:53 msgid "It defines the following items:" msgstr "" -#: ../../library/pwd.rst:56 +#: ../../library/pwd.rst:58 msgid "Return the password database entry for the given numeric user ID." msgstr "" -#: ../../library/pwd.rst:61 +#: ../../library/pwd.rst:63 msgid "Return the password database entry for the given user name." msgstr "" -#: ../../library/pwd.rst:66 +#: ../../library/pwd.rst:68 msgid "" "Return a list of all available password database entries, in arbitrary order." msgstr "" -#: ../../library/pwd.rst:72 +#: ../../library/pwd.rst:74 msgid "Module :mod:`grp`" msgstr ":mod:`grp` 模組" -#: ../../library/pwd.rst:72 +#: ../../library/pwd.rst:74 msgid "An interface to the group database, similar to this." msgstr "" -#: ../../library/pwd.rst:74 +#: ../../library/pwd.rst:76 msgid "Module :mod:`spwd`" msgstr ":mod:`spwd` 模組" -#: ../../library/pwd.rst:75 +#: ../../library/pwd.rst:77 msgid "An interface to the shadow password database, similar to this." msgstr "" diff --git a/library/pyexpat.po b/library/pyexpat.po index 103f7f071b..f568d05c00 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -792,7 +792,8 @@ msgid "" "suspended." msgstr "" -#: ../../library/pyexpat.rst:857 +#: ../../library/pyexpat.rst:857 ../../library/pyexpat.rst:890 +#: ../../library/pyexpat.rst:895 msgid "This should not be reported to Python applications." msgstr "" @@ -803,11 +804,35 @@ msgid "" "input or to stop the parser." msgstr "" -#: ../../library/pyexpat.rst:871 +#: ../../library/pyexpat.rst:872 +msgid "" +"An attempt was made to undeclare reserved namespace prefix ``xml`` or to " +"bind it to another namespace URI." +msgstr "" + +#: ../../library/pyexpat.rst:879 +msgid "" +"An attempt was made to declare or undeclare reserved namespace prefix " +"``xmlns``." +msgstr "" + +#: ../../library/pyexpat.rst:884 +msgid "" +"An attempt was made to bind the URI of one the reserved namespace prefixes " +"``xml`` and ``xmlns`` to another namespace prefix." +msgstr "" + +#: ../../library/pyexpat.rst:900 +msgid "" +"The limit on input amplification factor (from DTD and entities) has been " +"breached." +msgstr "" + +#: ../../library/pyexpat.rst:905 msgid "Footnotes" msgstr "註解" -#: ../../library/pyexpat.rst:872 +#: ../../library/pyexpat.rst:906 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See https://" diff --git a/library/random.po b/library/random.po index 65d8563a31..a085ddf360 100644 --- a/library/random.po +++ b/library/random.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" -"PO-Revision-Date: 2022-10-01 14:31+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 06:34+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -183,11 +183,10 @@ msgstr "移至版本 2 方案,該方案使用字串種子中的所有位元。 #: ../../library/random.rst:89 msgid "" -"In the future, the *seed* must be one of the following types: *NoneType*, :" -"class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:" -"`bytearray`." +"The *seed* must be one of the following types: *NoneType*, :class:`int`, :" +"class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`." msgstr "" -"將來,*seed* 必須是以下型別之一:\\ *NoneType*、\\ :class:`int`、\\ :class:" +"*seed* 必須是以下型別之一:\\ *NoneType*、\\ :class:`int`、\\ :class:" "`float`、\\ :class:`str`、\\ :class:`bytes`、\\ :class:`bytearray`。" #: ../../library/random.rst:96 @@ -377,21 +376,13 @@ msgstr "將序列 *x* 原地 (in place) 隨機打亂位置。" #: ../../library/random.rst:215 msgid "" -"The optional argument *random* is a 0-argument function returning a random " -"float in [0.0, 1.0); by default, this is the function :func:`.random`." -msgstr "" -"選擇性引數 *random* 是一個 0 引數函式,回傳一個在 [0.0, 1.0) 之間的隨機 " -"float;預設情況下,這是函式 :func:`.random`。" - -#: ../../library/random.rst:218 -msgid "" "To shuffle an immutable sequence and return a new shuffled list, use " "``sample(x, k=len(x))`` instead." msgstr "" "要打亂一個不可變的序列並回傳一個新的被打亂的 list(串列),請使用 " "``sample(x, k=len(x))``。" -#: ../../library/random.rst:221 +#: ../../library/random.rst:218 msgid "" "Note that even for small ``len(x)``, the total number of permutations of *x* " "can quickly grow larger than the period of most random number generators. " @@ -403,19 +394,19 @@ msgstr "" "數產生器的週期。這意味著長序列的大多數置換永遠無法產生。例如,長度為 2080 的" "序列是 Mersenne Twister 隨機數產生器週期內可以容納的最大序列。" -#: ../../library/random.rst:228 +#: ../../library/random.rst:225 msgid "The optional parameter *random*." msgstr "選擇性參數 *random*。" -#: ../../library/random.rst:233 +#: ../../library/random.rst:230 msgid "" "Return a *k* length list of unique elements chosen from the population " -"sequence or set. Used for random sampling without replacement." +"sequence. Used for random sampling without replacement." msgstr "" -"回傳從母體序列或集合中選擇出的一個包含獨特元素、長度為 *k* 的 list。用於不重" -"置的隨機取樣。" +"回傳從母體序列中選擇出的一個包含獨特元素、長度為 *k* 的 list。用於不重置的隨" +"機取樣。" -#: ../../library/random.rst:236 +#: ../../library/random.rst:233 msgid "" "Returns a new list containing elements from the population while leaving the " "original population unchanged. The resulting list is in selection order so " @@ -427,7 +418,7 @@ msgstr "" "此所有子切片也會是有效的隨機樣本。這允許抽獎獲獎者(樣本)分為大獎和第二名獲" "獎者(子切片)。" -#: ../../library/random.rst:242 +#: ../../library/random.rst:239 msgid "" "Members of the population need not be :term:`hashable` or unique. If the " "population contains repeats, then each occurrence is a possible selection in " @@ -436,7 +427,7 @@ msgstr "" "母體成員不必是 :term:`hashable` 或唯一的。如果母體包含重複項,則每次出現都是" "樣本中可能出現的一個選擇。" -#: ../../library/random.rst:245 +#: ../../library/random.rst:242 msgid "" "Repeated elements can be specified one at a time or with the optional " "keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], " @@ -447,7 +438,7 @@ msgstr "" "素。例如 ``sample(['red', 'blue'], counts=[4, 2], k=5)`` 等同於 " "``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``。" -#: ../../library/random.rst:250 +#: ../../library/random.rst:247 msgid "" "To choose a sample from a range of integers, use a :func:`range` object as " "an argument. This is especially fast and space efficient for sampling from " @@ -456,32 +447,27 @@ msgstr "" "若要從整數範圍中選擇範例,請使用 :func:`range` 物件作為引數。這對於從大型母體" "中取樣特別快速且節省空間:\\ ``sample(range(10000000), k=60)``。" -#: ../../library/random.rst:254 +#: ../../library/random.rst:251 msgid "" "If the sample size is larger than the population size, a :exc:`ValueError` " "is raised." msgstr "如果樣本大小大於母體大小,:exc:`ValueError` 會被引發。" -#: ../../library/random.rst:257 +#: ../../library/random.rst:254 msgid "Added the *counts* parameter." msgstr "新增 *counts* 參數。" -#: ../../library/random.rst:260 +#: ../../library/random.rst:259 msgid "" -"In the future, the *population* must be a sequence. Instances of :class:" -"`set` are no longer supported. The set must first be converted to a :class:" -"`list` or :class:`tuple`, preferably in a deterministic order so that the " -"sample is reproducible." +"The *population* must be a sequence. Automatic conversion of sets to lists " +"is no longer supported." msgstr "" -"將來,*population* 必須是一個序列。不再支援 :class:`set` 的實例。必須先將集合" -"轉換為 :class:`list` 或 :class:`tuple`,最好是按確定性順序,以便取樣是可復現" -"的。" -#: ../../library/random.rst:270 +#: ../../library/random.rst:266 msgid "Real-valued distributions" msgstr "實數分布" -#: ../../library/random.rst:272 +#: ../../library/random.rst:268 msgid "" "The following functions generate specific real-valued distributions. " "Function parameters are named after the corresponding variables in the " @@ -491,11 +477,11 @@ msgstr "" "以下函式產生特定的實數分佈。函式參數以分佈方程中的對應變數命名,如常見的數學" "實踐所示;這些方程式中的大多數都可以在任意統計文本中找到。" -#: ../../library/random.rst:280 +#: ../../library/random.rst:276 msgid "Return the next random floating point number in the range [0.0, 1.0)." msgstr "回傳範圍 [0.0, 1.0) 中的下一個隨機浮點數。" -#: ../../library/random.rst:285 +#: ../../library/random.rst:281 msgid "" "Return a random floating point number *N* such that ``a <= N <= b`` for ``a " "<= b`` and ``b <= N <= a`` for ``b < a``." @@ -503,7 +489,7 @@ msgstr "" "回傳一個隨機浮點數 *N*,當 ``a <= b`` 時確保 N 為 ``a <= N <= b`` 、``b < " "a`` 時確保 N 為 ``b <= N <= a``。" -#: ../../library/random.rst:288 +#: ../../library/random.rst:284 msgid "" "The end-point value ``b`` may or may not be included in the range depending " "on floating-point rounding in the equation ``a + (b-a) * random()``." @@ -511,7 +497,7 @@ msgstr "" "終點值 ``b`` 可能包含在範圍內,也可能不包含在範圍內,取決於方程式 ``a + (b-" "a) * random()`` 中的浮點捨入。" -#: ../../library/random.rst:294 +#: ../../library/random.rst:290 msgid "" "Return a random floating point number *N* such that ``low <= N <= high`` and " "with the specified *mode* between those bounds. The *low* and *high* bounds " @@ -522,7 +508,7 @@ msgstr "" "的 *mode*。*low* 和 *high* 邊界預設為零和一。*mode* 引數預設為邊界之間的中" "點,從而給出對稱分佈。" -#: ../../library/random.rst:302 +#: ../../library/random.rst:298 msgid "" "Beta distribution. Conditions on the parameters are ``alpha > 0`` and " "``beta > 0``. Returned values range between 0 and 1." @@ -530,7 +516,7 @@ msgstr "" "Beta(貝它)分布。參數的條件為 ``alpha > 0`` 和 ``beta > 0``。回傳值的範圍介" "於 0 和 1 之間。" -#: ../../library/random.rst:308 +#: ../../library/random.rst:304 msgid "" "Exponential distribution. *lambd* is 1.0 divided by the desired mean. It " "should be nonzero. (The parameter would be called \"lambda\", but that is a " @@ -542,7 +528,7 @@ msgstr "" "\"lambda\",但這是 Python 中的保留字)如果 *lambd* 為正,則回傳值的範圍從 0 " "到正無窮大;如果 *lambd* 為負,則回傳值的範圍從負無窮大到 0。" -#: ../../library/random.rst:317 +#: ../../library/random.rst:313 msgid "" "Gamma distribution. (*Not* the gamma function!) Conditions on the " "parameters are ``alpha > 0`` and ``beta > 0``." @@ -550,14 +536,14 @@ msgstr "" "Gamma(伽瑪)分佈。(*不是* Gamma 函式!)參數的條件為 ``alpha > 0`` 和 " "``beta > 0``。" -#: ../../library/random.rst:320 +#: ../../library/random.rst:316 msgid "The probability distribution function is::" msgstr "" "Probability distribution function(機率密度函式)是:\n" "\n" "::" -#: ../../library/random.rst:329 +#: ../../library/random.rst:325 msgid "" "Normal distribution, also called the Gaussian distribution. *mu* is the " "mean, and *sigma* is the standard deviation. This is slightly faster than " @@ -566,7 +552,7 @@ msgstr "" "常態分佈,也稱為高斯分佈。*mu* 是平均數,*sigma* 是標準差。這比下面定義的 :" "func:`normalvariate` 函式快一點。" -#: ../../library/random.rst:333 +#: ../../library/random.rst:329 msgid "" "Multithreading note: When two threads call this function simultaneously, it " "is possible that they will receive the same return value. This can be " @@ -578,7 +564,11 @@ msgstr "" "可以透過三種方式避免。1)讓每個執行緒使用隨機數產生器的不同實例。2)在所有呼" "叫周圍加鎖。3)使用較慢但執行緒安全的 :func:`normalvariate` 函式代替。" -#: ../../library/random.rst:343 +#: ../../library/random.rst:336 ../../library/random.rst:352 +msgid "*mu* and *sigma* now have default arguments." +msgstr "" + +#: ../../library/random.rst:342 msgid "" "Log normal distribution. If you take the natural logarithm of this " "distribution, you'll get a normal distribution with mean *mu* and standard " @@ -588,13 +578,13 @@ msgstr "" "對數常態分佈。如果你取此分佈的自然對數,你將獲得一個具有平均數 *mu* 和標準差 " "*sigma* 的常態分佈。*mu* 可以為任何值,並且 *sigma* 必須大於零。" -#: ../../library/random.rst:351 +#: ../../library/random.rst:350 msgid "" "Normal distribution. *mu* is the mean, and *sigma* is the standard " "deviation." msgstr "常態分佈。*mu* 是平均數,*sigma* 是標準差。" -#: ../../library/random.rst:356 +#: ../../library/random.rst:358 msgid "" "*mu* is the mean angle, expressed in radians between 0 and 2\\*\\ *pi*, and " "*kappa* is the concentration parameter, which must be greater than or equal " @@ -605,28 +595,28 @@ msgstr "" "大於或等於零。如果 *kappa* 等於零,則此分佈在 0 到 2\\*\\ *pi* 的範圍內將減小" "為均勻的隨機角度。" -#: ../../library/random.rst:364 +#: ../../library/random.rst:366 msgid "Pareto distribution. *alpha* is the shape parameter." msgstr "Pareto distribution(柏拉圖分佈)。*alpha* 是形狀參數。" -#: ../../library/random.rst:369 +#: ../../library/random.rst:371 msgid "" "Weibull distribution. *alpha* is the scale parameter and *beta* is the " "shape parameter." msgstr "" "Weibull distribution(韋伯分佈)。*alpha* 是比例參數,*beta* 是形狀參數。" -#: ../../library/random.rst:374 +#: ../../library/random.rst:376 msgid "Alternative Generator" msgstr "替代產生器" -#: ../../library/random.rst:378 +#: ../../library/random.rst:380 msgid "" "Class that implements the default pseudo-random number generator used by " "the :mod:`random` module." msgstr "實現 :mod:`random` 模組使用的預設偽隨機數產生器的 class。" -#: ../../library/random.rst:381 +#: ../../library/random.rst:383 msgid "" "In the future, the *seed* must be one of the following types: :class:" "`NoneType`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :" @@ -635,7 +625,7 @@ msgstr "" "將來,*seed* 必須是以下類型之一:\\ :class:`NoneType`、\\ :class:`int`、\\ :" "class:`float`、\\ :class:`str`、\\ :class:`bytes`、\\ :class:`bytearray`。" -#: ../../library/random.rst:388 +#: ../../library/random.rst:390 msgid "" "Class that uses the :func:`os.urandom` function for generating random " "numbers from sources provided by the operating system. Not available on all " @@ -649,11 +639,11 @@ msgstr "" "有效果且被忽略。如果呼叫 :meth:`getstate` 和 :meth:`setstate` 方法會引發 :" "exc:`NotImplementedError`。" -#: ../../library/random.rst:397 +#: ../../library/random.rst:399 msgid "Notes on Reproducibility" msgstr "關於 Reproducibility(復現性)的注意事項" -#: ../../library/random.rst:399 +#: ../../library/random.rst:401 msgid "" "Sometimes it is useful to be able to reproduce the sequences given by a " "pseudo-random number generator. By re-using a seed value, the same sequence " @@ -663,7 +653,7 @@ msgstr "" "有時,能夠重現偽隨機數產生器給出的序列很有用。只要多執行緒未運行,透過重複使" "用種子值,同一序列就應該可以被復現。" -#: ../../library/random.rst:403 +#: ../../library/random.rst:405 msgid "" "Most of the random module's algorithms and seeding functions are subject to " "change across Python versions, but two aspects are guaranteed not to change:" @@ -671,13 +661,13 @@ msgstr "" "大多數隨機 module 的演算法和 seed 設定函式在 Python 版本中可能會發生變化,但" "可以保證兩個方面不會改變:" -#: ../../library/random.rst:406 +#: ../../library/random.rst:408 msgid "" "If a new seeding method is added, then a backward compatible seeder will be " "offered." msgstr "如果增加了新的 seed 設定函式,則將提供向後相容的播種器 (seeder)。" -#: ../../library/random.rst:409 +#: ../../library/random.rst:411 msgid "" "The generator's :meth:`~Random.random` method will continue to produce the " "same sequence when the compatible seeder is given the same seed." @@ -685,25 +675,25 @@ msgstr "" "當相容的播種器被賦予相同的種子時,產生器的 :meth:`~Random.random` 方法將持續" "產生相同的序列。" -#: ../../library/random.rst:415 +#: ../../library/random.rst:417 msgid "Examples" msgstr "範例" -#: ../../library/random.rst:417 +#: ../../library/random.rst:419 msgid "Basic examples::" msgstr "" "基礎範例:\n" "\n" "::" -#: ../../library/random.rst:445 +#: ../../library/random.rst:447 msgid "Simulations::" msgstr "" "模擬:\n" "\n" "::" -#: ../../library/random.rst:473 +#: ../../library/random.rst:475 msgid "" "Example of `statistical bootstrapping `_ using resampling with replacement to estimate " @@ -715,7 +705,7 @@ msgstr "" "\n" "::" -#: ../../library/random.rst:486 +#: ../../library/random.rst:488 msgid "" "Example of a `resampling permutation test `_ to determine the statistical " @@ -729,7 +719,7 @@ msgstr "" "\n" "::" -#: ../../library/random.rst:513 +#: ../../library/random.rst:515 msgid "" "Simulation of arrival times and service deliveries for a multiserver queue::" msgstr "" @@ -737,7 +727,7 @@ msgstr "" "\n" "::" -#: ../../library/random.rst:542 +#: ../../library/random.rst:544 msgid "" "`Statistics for Hackers `_ a " "video tutorial by `Jake Vanderplas `_ 製作的教" "學影片,僅使用幾個基本概念(包括模擬、取樣、洗牌、交叉驗證)進行統計分析。" -#: ../../library/random.rst:548 +#: ../../library/random.rst:550 msgid "" "`Economics Simulation `_ a simulation of a marketplace by `Peter Norvig `_ a tutorial by `Peter " @@ -774,11 +764,11 @@ msgstr "" "html>`_ 的教學課程,涵蓋了機率理論的基礎知識與如何模擬以及使用 Python 執行數" "據分析。" -#: ../../library/random.rst:563 +#: ../../library/random.rst:565 msgid "Recipes" msgstr "使用方案" -#: ../../library/random.rst:565 +#: ../../library/random.rst:567 msgid "" "The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x " "< 1.0*. All such numbers are evenly spaced and are exactly representable as " @@ -790,7 +780,7 @@ msgstr "" "均勻分佈的,並且可以完全表示為 Python float。但是,該間隔中的許多其他可表示" "的 float 不是可能的選擇。 例如 ``0.05954861408025609`` 不是 2⁻⁵³ 的整數倍。" -#: ../../library/random.rst:571 +#: ../../library/random.rst:573 msgid "" "The following recipe takes a different approach. All floats in the interval " "are possible selections. The mantissa comes from a uniform distribution of " @@ -802,7 +792,7 @@ msgstr "" "數 < 2⁵³* 範圍內的整數均勻分佈。指數來自幾何分佈,其中小於 *-53* 的指數的出現" "頻率是下一個較大指數的一半。" -#: ../../library/random.rst:593 +#: ../../library/random.rst:595 msgid "" "All :ref:`real valued distributions ` in the " "class will use the new method::" @@ -812,7 +802,7 @@ msgstr "" "\n" "::" -#: ../../library/random.rst:602 +#: ../../library/random.rst:604 msgid "" "The recipe is conceptually equivalent to an algorithm that chooses from all " "the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are " @@ -825,7 +815,7 @@ msgstr "" "示的 Python float。(2⁻¹⁰⁷⁴ 是最小為正的非正規化 float,等於 ``math." "ulp(0.0)``)" -#: ../../library/random.rst:611 +#: ../../library/random.rst:613 msgid "" "`Generating Pseudo-random Floating-Point Values `_ a paper by Allen B. Downey describing " @@ -835,3 +825,21 @@ msgstr "" "`產生偽隨機浮點值 `_ Allen B. Downey 的一篇論文描述了產生比通常由 :func:`.random` 產生的 " "float 更 fine-grained(細粒的)的方法。" + +#~ msgid "" +#~ "The optional argument *random* is a 0-argument function returning a " +#~ "random float in [0.0, 1.0); by default, this is the function :func:`." +#~ "random`." +#~ msgstr "" +#~ "選擇性引數 *random* 是一個 0 引數函式,回傳一個在 [0.0, 1.0) 之間的隨機 " +#~ "float;預設情況下,這是函式 :func:`.random`。" + +#~ msgid "" +#~ "In the future, the *population* must be a sequence. Instances of :class:" +#~ "`set` are no longer supported. The set must first be converted to a :" +#~ "class:`list` or :class:`tuple`, preferably in a deterministic order so " +#~ "that the sample is reproducible." +#~ msgstr "" +#~ "將來,*population* 必須是一個序列。不再支援 :class:`set` 的實例。必須先將" +#~ "集合轉換為 :class:`list` 或 :class:`tuple`,最好是按確定性順序,以便取樣是" +#~ "可復現的。" diff --git a/library/re.po b/library/re.po index 966bbfce7e..d7763969a2 100644 --- a/library/re.po +++ b/library/re.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-05 06:54+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,8 +23,8 @@ msgid ":mod:`re` --- Regular expression operations" msgstr "" #: ../../library/re.rst:10 -msgid "**Source code:** :source:`Lib/re.py`" -msgstr "**原始碼:**\\ :source:`Lib/re.py`" +msgid "**Source code:** :source:`Lib/re/`" +msgstr "**原始碼:**\\ :source:`Lib/re/`" #: ../../library/re.rst:14 msgid "" @@ -134,18 +134,19 @@ msgstr "" #: ../../library/re.rst:90 msgid "" -"Repetition qualifiers (``*``, ``+``, ``?``, ``{m,n}``, etc) cannot be " -"directly nested. This avoids ambiguity with the non-greedy modifier suffix " -"``?``, and with other modifiers in other implementations. To apply a second " -"repetition to an inner repetition, parentheses may be used. For example, the " -"expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters." +"Repetition operators or quantifiers (``*``, ``+``, ``?``, ``{m,n}``, etc) " +"cannot be directly nested. This avoids ambiguity with the non-greedy " +"modifier suffix ``?``, and with other modifiers in other implementations. To " +"apply a second repetition to an inner repetition, parentheses may be used. " +"For example, the expression ``(?:a{6})*`` matches any multiple of six " +"``'a'`` characters." msgstr "" #: ../../library/re.rst:97 msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:104 ../../library/re.rst:1432 +#: ../../library/re.rst:104 ../../library/re.rst:1523 msgid "``.``" msgstr "``.``" @@ -220,31 +221,52 @@ msgstr "``*?``, ``+?``, ``??``" #: ../../library/re.rst:149 msgid "" -"The ``'*'``, ``'+'``, and ``'?'`` qualifiers are all :dfn:`greedy`; they " +"The ``'*'``, ``'+'``, and ``'?'`` quantifiers are all :dfn:`greedy`; they " "match as much text as possible. Sometimes this behaviour isn't desired; if " "the RE ``<.*>`` is matched against ``' b '``, it will match the entire " -"string, and not just ``''``. Adding ``?`` after the qualifier makes it " +"string, and not just ``''``. Adding ``?`` after the quantifier makes it " "perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few* " "characters as possible will be matched. Using the RE ``<.*?>`` will match " "only ``''``." msgstr "" +#: ../../library/re.rst:179 +msgid "``*+``, ``++``, ``?+``" +msgstr "``*+``, ``++``, ``?+``" + #: ../../library/re.rst:163 +msgid "" +"Like the ``'*'``, ``'+'``, and ``'?'`` quantifiers, those where ``'+'`` is " +"appended also match as many times as possible. However, unlike the true " +"greedy quantifiers, these do not allow back-tracking when the expression " +"following it fails to match. These are known as :dfn:`possessive` " +"quantifiers. For example, ``a*a`` will match ``'aaaa'`` because the ``a*`` " +"will match all 4 ``'a'``\\ s, but, when the final ``'a'`` is encountered, " +"the expression is backtracked so that in the end the ``a*`` ends up matching " +"3 ``'a'``\\ s total, and the fourth ``'a'`` is matched by the final ``'a'``. " +"However, when ``a*+a`` is used to match ``'aaaa'``, the ``a*+`` will match " +"all 4 ``'a'``, but when the final ``'a'`` fails to find any more characters " +"to match, the expression cannot be backtracked and will thus fail to match. " +"``x*+``, ``x++`` and ``x?+`` are equivalent to ``(?>x*)``, ``(?>x+)`` and " +"``(?>x?)`` correspondingly." +msgstr "" + +#: ../../library/re.rst:187 msgid "``{m}``" msgstr "``{m}``" -#: ../../library/re.rst:161 +#: ../../library/re.rst:185 msgid "" "Specifies that exactly *m* copies of the previous RE should be matched; " "fewer matches cause the entire RE not to match. For example, ``a{6}`` will " "match exactly six ``'a'`` characters, but not five." msgstr "" -#: ../../library/re.rst:172 +#: ../../library/re.rst:196 msgid "``{m,n}``" msgstr "``{m,n}``" -#: ../../library/re.rst:166 +#: ../../library/re.rst:190 msgid "" "Causes the resulting RE to match from *m* to *n* repetitions of the " "preceding RE, attempting to match as many repetitions as possible. For " @@ -256,31 +278,48 @@ msgid "" "described form." msgstr "" -#: ../../library/re.rst:179 +#: ../../library/re.rst:203 msgid "``{m,n}?``" msgstr "``{m,n}?``" -#: ../../library/re.rst:175 +#: ../../library/re.rst:199 msgid "" "Causes the resulting RE to match from *m* to *n* repetitions of the " "preceding RE, attempting to match as *few* repetitions as possible. This is " -"the non-greedy version of the previous qualifier. For example, on the 6-" +"the non-greedy version of the previous quantifier. For example, on the 6-" "character string ``'aaaaaa'``, ``a{3,5}`` will match 5 ``'a'`` characters, " "while ``a{3,5}?`` will only match 3 characters." msgstr "" -#: ../../library/re.rst:194 +#: ../../library/re.rst:218 +msgid "``{m,n}+``" +msgstr "``{m,n}+``" + +#: ../../library/re.rst:206 +msgid "" +"Causes the resulting RE to match from *m* to *n* repetitions of the " +"preceding RE, attempting to match as many repetitions as possible *without* " +"establishing any backtracking points. This is the possessive version of the " +"quantifier above. For example, on the 6-character string ``'aaaaaa'``, " +"``a{3,5}+aa`` attempt to match 5 ``'a'`` characters, then, requiring 2 more " +"``'a'``\\ s, will need more characters than available and thus fail, while " +"``a{3,5}aa`` will match with ``a{3,5}`` capturing 5, then 4 ``'a'``\\ s by " +"backtracking and then the final 2 ``'a'``\\ s are matched by the final " +"``aa`` in the pattern. ``x{m,n}+`` is equivalent to ``(?>x{m,n})``." +msgstr "" + +#: ../../library/re.rst:233 msgid "``\\``" msgstr "``\\``" -#: ../../library/re.rst:184 +#: ../../library/re.rst:223 msgid "" "Either escapes special characters (permitting you to match characters like " "``'*'``, ``'?'``, and so forth), or signals a special sequence; special " "sequences are discussed below." msgstr "" -#: ../../library/re.rst:188 +#: ../../library/re.rst:227 msgid "" "If you're not using a raw string to express the pattern, remember that " "Python also uses the backslash as an escape sequence in string literals; if " @@ -291,21 +330,21 @@ msgid "" "recommended that you use raw strings for all but the simplest expressions." msgstr "" -#: ../../library/re.rst:254 +#: ../../library/re.rst:293 msgid "``[]``" msgstr "``[]``" -#: ../../library/re.rst:200 +#: ../../library/re.rst:239 msgid "Used to indicate a set of characters. In a set:" msgstr "" -#: ../../library/re.rst:202 +#: ../../library/re.rst:241 msgid "" "Characters can be listed individually, e.g. ``[amk]`` will match ``'a'``, " "``'m'``, or ``'k'``." msgstr "" -#: ../../library/re.rst:207 +#: ../../library/re.rst:246 msgid "" "Ranges of characters can be indicated by giving two characters and " "separating them by a ``'-'``, for example ``[a-z]`` will match any lowercase " @@ -315,21 +354,21 @@ msgid "" "character (e.g. ``[-a]`` or ``[a-]``), it will match a literal ``'-'``." msgstr "" -#: ../../library/re.rst:214 +#: ../../library/re.rst:253 msgid "" "Special characters lose their special meaning inside sets. For example, " "``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, " "``'*'``, or ``')'``." msgstr "" -#: ../../library/re.rst:220 +#: ../../library/re.rst:259 msgid "" "Character classes such as ``\\w`` or ``\\S`` (defined below) are also " "accepted inside a set, although the characters they match depends on " "whether :const:`ASCII` or :const:`LOCALE` mode is in force." msgstr "" -#: ../../library/re.rst:226 +#: ../../library/re.rst:265 msgid "" "Characters that are not within a range can be matched by :dfn:" "`complementing` the set. If the first character of the set is ``'^'``, all " @@ -339,14 +378,14 @@ msgid "" "first character in the set." msgstr "" -#: ../../library/re.rst:233 +#: ../../library/re.rst:272 msgid "" "To match a literal ``']'`` inside a set, precede it with a backslash, or " "place it at the beginning of the set. For example, both ``[()[\\]{}]`` and " "``[]()[{}]`` will both match a parenthesis." msgstr "" -#: ../../library/re.rst:242 +#: ../../library/re.rst:281 msgid "" "Support of nested sets and set operations as in `Unicode Technical Standard " "#18`_ might be added in the future. This would change the syntax, so to " @@ -356,17 +395,17 @@ msgid "" "``'||'``. To avoid a warning escape them with a backslash." msgstr "" -#: ../../library/re.rst:252 +#: ../../library/re.rst:291 msgid "" ":exc:`FutureWarning` is raised if a character set contains constructs that " "will change semantically in the future." msgstr "" -#: ../../library/re.rst:267 +#: ../../library/re.rst:306 msgid "``|``" msgstr "``|``" -#: ../../library/re.rst:259 +#: ../../library/re.rst:298 msgid "" "``A|B``, where *A* and *B* can be arbitrary REs, creates a regular " "expression that will match either *A* or *B*. An arbitrary number of REs " @@ -379,11 +418,11 @@ msgid "" "use ``\\|``, or enclose it inside a character class, as in ``[|]``." msgstr "" -#: ../../library/re.rst:277 +#: ../../library/re.rst:316 msgid "``(...)``" msgstr "``(...)``" -#: ../../library/re.rst:273 +#: ../../library/re.rst:312 msgid "" "Matches whatever regular expression is inside the parentheses, and indicates " "the start and end of a group; the contents of a group can be retrieved after " @@ -393,11 +432,11 @@ msgid "" "character class: ``[(]``, ``[)]``." msgstr "" -#: ../../library/re.rst:286 +#: ../../library/re.rst:325 msgid "``(?...)``" msgstr "``(?...)``" -#: ../../library/re.rst:282 +#: ../../library/re.rst:321 msgid "" "This is an extension notation (a ``'?'`` following a ``'('`` is not " "meaningful otherwise). The first character after the ``'?'`` determines " @@ -406,11 +445,11 @@ msgid "" "rule. Following are the currently supported extensions." msgstr "" -#: ../../library/re.rst:300 +#: ../../library/re.rst:342 msgid "``(?aiLmsux)``" msgstr "``(?aiLmsux)``" -#: ../../library/re.rst:289 +#: ../../library/re.rst:328 msgid "" "(One or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the letters " @@ -424,11 +463,15 @@ msgid "" "first in the expression string." msgstr "" -#: ../../library/re.rst:308 +#: ../../library/re.rst:341 +msgid "This construction can only be used at the start of the expression." +msgstr "" + +#: ../../library/re.rst:350 msgid "``(?:...)``" msgstr "``(?:...)``" -#: ../../library/re.rst:305 +#: ../../library/re.rst:347 msgid "" "A non-capturing version of regular parentheses. Matches whatever regular " "expression is inside the parentheses, but the substring matched by the group " @@ -436,11 +479,11 @@ msgid "" "pattern." msgstr "" -#: ../../library/re.rst:334 +#: ../../library/re.rst:376 msgid "``(?aiLmsux-imsx:...)``" msgstr "``(?aiLmsux-imsx:...)``" -#: ../../library/re.rst:311 +#: ../../library/re.rst:353 msgid "" "(Zero or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``, optionally followed by ``'-'`` followed by one or " @@ -452,7 +495,7 @@ msgid "" "flags are described in :ref:`contents-of-module-re`.)" msgstr "" -#: ../../library/re.rst:321 +#: ../../library/re.rst:363 msgid "" "The letters ``'a'``, ``'L'`` and ``'u'`` are mutually exclusive when used as " "inline flags, so they can't be combined or follow ``'-'``. Instead, when " @@ -465,15 +508,33 @@ msgid "" "restored outside of the group." msgstr "" -#: ../../library/re.rst:333 +#: ../../library/re.rst:375 msgid "The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group." msgstr "" -#: ../../library/re.rst:361 +#: ../../library/re.rst:391 +msgid "``(?>...)``" +msgstr "``(?>...)``" + +#: ../../library/re.rst:379 +msgid "" +"Attempts to match ``...`` as if it was a separate regular expression, and if " +"successful, continues to match the rest of the pattern following it. If the " +"subsequent pattern fails to match, the stack can only be unwound to a point " +"*before* the ``(?>...)`` because once exited, the expression, known as an :" +"dfn:`atomic group`, has thrown away all stack points within itself. Thus, " +"``(?>.*).`` would never match anything because first the ``.*`` would match " +"all characters possible, then, having nothing left to match, the final ``.`` " +"would fail to match. Since there are no stack points saved in the Atomic " +"Group, and there is no stack point before it, the entire expression would " +"thus fail to match." +msgstr "" + +#: ../../library/re.rst:421 msgid "``(?P...)``" msgstr "``(?P...)``" -#: ../../library/re.rst:339 +#: ../../library/re.rst:396 msgid "" "Similar to regular parentheses, but the substring matched by the group is " "accessible via the symbolic group name *name*. Group names must be valid " @@ -482,102 +543,106 @@ msgid "" "the group were not named." msgstr "" -#: ../../library/re.rst:345 +#: ../../library/re.rst:402 msgid "" "Named groups can be referenced in three contexts. If the pattern is ``(?" "P['\"]).*?(?P=quote)`` (i.e. matching a string quoted with either " "single or double quotes):" msgstr "" -#: ../../library/re.rst:350 +#: ../../library/re.rst:407 msgid "Context of reference to group \"quote\"" msgstr "" -#: ../../library/re.rst:350 +#: ../../library/re.rst:407 msgid "Ways to reference it" msgstr "" -#: ../../library/re.rst:352 +#: ../../library/re.rst:409 msgid "in the same pattern itself" msgstr "" -#: ../../library/re.rst:352 +#: ../../library/re.rst:409 msgid "``(?P=quote)`` (as shown)" msgstr "" -#: ../../library/re.rst:353 ../../library/re.rst:360 +#: ../../library/re.rst:410 ../../library/re.rst:417 msgid "``\\1``" msgstr "``\\1``" -#: ../../library/re.rst:355 +#: ../../library/re.rst:412 msgid "when processing match object *m*" msgstr "" -#: ../../library/re.rst:355 +#: ../../library/re.rst:412 msgid "``m.group('quote')``" msgstr "``m.group('quote')``" -#: ../../library/re.rst:356 +#: ../../library/re.rst:413 msgid "``m.end('quote')`` (etc.)" msgstr "" -#: ../../library/re.rst:358 +#: ../../library/re.rst:415 msgid "in a string passed to the *repl* argument of ``re.sub()``" msgstr "" -#: ../../library/re.rst:358 +#: ../../library/re.rst:415 msgid "``\\g``" msgstr "``\\g``" -#: ../../library/re.rst:359 +#: ../../library/re.rst:416 msgid "``\\g<1>``" msgstr "``\\g<1>``" -#: ../../library/re.rst:367 +#: ../../library/re.rst:420 +msgid "Group names containing non-ASCII characters in bytes patterns." +msgstr "" + +#: ../../library/re.rst:427 msgid "``(?P=name)``" msgstr "``(?P=name)``" -#: ../../library/re.rst:366 +#: ../../library/re.rst:426 msgid "" "A backreference to a named group; it matches whatever text was matched by " "the earlier group named *name*." msgstr "" -#: ../../library/re.rst:372 +#: ../../library/re.rst:432 msgid "``(?#...)``" msgstr "``(?#...)``" -#: ../../library/re.rst:372 +#: ../../library/re.rst:432 msgid "A comment; the contents of the parentheses are simply ignored." msgstr "" -#: ../../library/re.rst:379 +#: ../../library/re.rst:439 msgid "``(?=...)``" msgstr "``(?=...)``" -#: ../../library/re.rst:377 +#: ../../library/re.rst:437 msgid "" "Matches if ``...`` matches next, but doesn't consume any of the string. " "This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?" "=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:386 +#: ../../library/re.rst:446 msgid "``(?!...)``" msgstr "``(?!...)``" -#: ../../library/re.rst:384 +#: ../../library/re.rst:444 msgid "" "Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead " "assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only " "if it's *not* followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:413 +#: ../../library/re.rst:473 msgid "``(?<=...)``" msgstr "``(?<=...)``" -#: ../../library/re.rst:391 +#: ../../library/re.rst:451 msgid "" "Matches if the current position in the string is preceded by a match for " "``...`` that ends at the current position. This is called a :dfn:`positive " @@ -591,19 +656,19 @@ msgid "" "func:`match` function:" msgstr "" -#: ../../library/re.rst:406 +#: ../../library/re.rst:466 msgid "This example looks for a word following a hyphen:" msgstr "" -#: ../../library/re.rst:412 +#: ../../library/re.rst:472 msgid "Added support for group references of fixed length." msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:482 msgid "``(?'``." msgstr "" -#: ../../library/re.rst:433 +#: ../../library/re.rst:492 +msgid "Group *id* containing anything except ASCII digits." +msgstr "" + +#: ../../library/re.rst:496 msgid "" "The special sequences consist of ``'\\'`` and a character from the list " "below. If the ordinary character is not an ASCII digit or an ASCII letter, " @@ -634,11 +703,11 @@ msgid "" "matches the character ``'$'``." msgstr "" -#: ../../library/re.rst:448 +#: ../../library/re.rst:511 msgid "``\\number``" msgstr "``\\number``" -#: ../../library/re.rst:441 +#: ../../library/re.rst:504 msgid "" "Matches the contents of the group of the same number. Groups are numbered " "starting from 1. For example, ``(.+) \\1`` matches ``'the the'`` or ``'55 " @@ -650,19 +719,19 @@ msgid "" "escapes are treated as characters." msgstr "" -#: ../../library/re.rst:453 +#: ../../library/re.rst:516 msgid "``\\A``" msgstr "``\\A``" -#: ../../library/re.rst:453 +#: ../../library/re.rst:516 msgid "Matches only at the start of the string." msgstr "" -#: ../../library/re.rst:469 +#: ../../library/re.rst:532 msgid "``\\b``" msgstr "``\\b``" -#: ../../library/re.rst:458 +#: ../../library/re.rst:521 msgid "" "Matches the empty string, but only at the beginning or end of a word. A word " "is defined as a sequence of word characters. Note that formally, ``\\b`` is " @@ -672,7 +741,7 @@ msgid "" "baz'`` but not ``'foobar'`` or ``'foo3'``." msgstr "" -#: ../../library/re.rst:465 +#: ../../library/re.rst:528 msgid "" "By default Unicode alphanumerics are the ones used in Unicode patterns, but " "this can be changed by using the :const:`ASCII` flag. Word boundaries are " @@ -681,11 +750,11 @@ msgid "" "compatibility with Python's string literals." msgstr "" -#: ../../library/re.rst:480 +#: ../../library/re.rst:543 msgid "``\\B``" msgstr "``\\B``" -#: ../../library/re.rst:474 +#: ../../library/re.rst:537 msgid "" "Matches the empty string, but only when it is *not* at the beginning or end " "of a word. This means that ``r'py\\B'`` matches ``'python'``, ``'py3'``, " @@ -696,15 +765,15 @@ msgid "" "the :const:`LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:492 +#: ../../library/re.rst:555 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:489 ../../library/re.rst:509 ../../library/re.rst:529 +#: ../../library/re.rst:552 ../../library/re.rst:572 ../../library/re.rst:592 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:486 +#: ../../library/re.rst:549 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category [Nd]). This includes ``[0-9]``, and also many other " @@ -712,30 +781,30 @@ msgid "" "matched." msgstr "" -#: ../../library/re.rst:492 ../../library/re.rst:513 ../../library/re.rst:535 +#: ../../library/re.rst:555 ../../library/re.rst:576 ../../library/re.rst:598 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:492 +#: ../../library/re.rst:555 msgid "Matches any decimal digit; this is equivalent to ``[0-9]``." msgstr "" -#: ../../library/re.rst:499 +#: ../../library/re.rst:562 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:497 +#: ../../library/re.rst:560 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``. If the :const:`ASCII` flag is used this becomes the equivalent of " "``[^0-9]``." msgstr "" -#: ../../library/re.rst:513 +#: ../../library/re.rst:576 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:505 +#: ../../library/re.rst:568 msgid "" "Matches Unicode whitespace characters (which includes ``[ \\t\\n\\r\\f" "\\v]``, and also many other characters, for example the non-breaking spaces " @@ -743,35 +812,35 @@ msgid "" "is used, only ``[ \\t\\n\\r\\f\\v]`` is matched." msgstr "" -#: ../../library/re.rst:512 +#: ../../library/re.rst:575 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:520 +#: ../../library/re.rst:583 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:518 +#: ../../library/re.rst:581 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``. If the :const:`ASCII` flag is used this becomes the " "equivalent of ``[^ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:535 +#: ../../library/re.rst:598 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:526 +#: ../../library/re.rst:589 msgid "" "Matches Unicode word characters; this includes most characters that can be " "part of a word in any language, as well as numbers and the underscore. If " "the :const:`ASCII` flag is used, only ``[a-zA-Z0-9_]`` is matched." msgstr "" -#: ../../library/re.rst:532 +#: ../../library/re.rst:595 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :const:`LOCALE` flag is used, " @@ -779,11 +848,11 @@ msgid "" "underscore." msgstr "" -#: ../../library/re.rst:544 +#: ../../library/re.rst:607 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:540 +#: ../../library/re.rst:603 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. If the :const:`ASCII` flag is used this becomes the equivalent of " @@ -791,34 +860,34 @@ msgid "" "which are neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:549 +#: ../../library/re.rst:612 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:549 +#: ../../library/re.rst:612 msgid "Matches only at the end of the string." msgstr "" -#: ../../library/re.rst:565 +#: ../../library/re.rst:628 msgid "" "Most of the standard escapes supported by Python string literals are also " "accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:572 +#: ../../library/re.rst:635 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:575 +#: ../../library/re.rst:638 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode patterns. In bytes patterns they are errors. Unknown escapes of " "ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:579 +#: ../../library/re.rst:642 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -826,26 +895,26 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:584 +#: ../../library/re.rst:647 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:587 +#: ../../library/re.rst:650 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:590 +#: ../../library/re.rst:653 msgid "" "The ``'\\N{name}'`` escape sequence has been added. As in string literals, " "it expands to the named Unicode character (e.g. ``'\\N{EM DASH}'``)." msgstr "" -#: ../../library/re.rst:598 +#: ../../library/re.rst:661 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:600 +#: ../../library/re.rst:663 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -853,17 +922,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:607 +#: ../../library/re.rst:670 msgid "Flags" msgstr "" -#: ../../library/re.rst:609 +#: ../../library/re.rst:672 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:618 +#: ../../library/re.rst:679 +msgid "" +"An :class:`enum.IntFlag` class containing the regex options listed below." +msgstr "" + +#: ../../library/re.rst:681 +msgid "- added to ``__all__``" +msgstr "" + +#: ../../library/re.rst:686 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and ``" "\\S`` perform ASCII-only matching instead of full Unicode matching. This is " @@ -871,7 +949,7 @@ msgid "" "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:623 +#: ../../library/re.rst:691 msgid "" "Note that for backward compatibility, the :const:`re.U` flag still exists " "(as well as its synonym :const:`re.UNICODE` and its embedded counterpart ``(?" @@ -879,13 +957,13 @@ msgid "" "default for strings (and Unicode matching isn't allowed for bytes)." msgstr "" -#: ../../library/re.rst:632 +#: ../../library/re.rst:700 msgid "" "Display debug information about compiled expression. No corresponding inline " "flag." msgstr "" -#: ../../library/re.rst:639 +#: ../../library/re.rst:707 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -895,7 +973,7 @@ msgid "" "flag ``(?i)``." msgstr "" -#: ../../library/re.rst:646 +#: ../../library/re.rst:714 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " @@ -906,7 +984,7 @@ msgid "" "matched." msgstr "" -#: ../../library/re.rst:657 +#: ../../library/re.rst:725 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " @@ -917,20 +995,20 @@ msgid "" "locales/languages. Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:666 +#: ../../library/re.rst:734 msgid "" ":const:`re.LOCALE` can be used only with bytes patterns and is not " "compatible with :const:`re.ASCII`." msgstr "" -#: ../../library/re.rst:670 +#: ../../library/re.rst:738 msgid "" "Compiled regular expression objects with the :const:`re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:679 +#: ../../library/re.rst:747 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -941,14 +1019,22 @@ msgid "" "the end of the string. Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:691 +#: ../../library/re.rst:757 +msgid "" +"Indicates no flag being applied, the value is ``0``. This flag may be used " +"as a default value for a function keyword argument or as a base value that " +"will be conditionally ORed with other flags. Example of use as a default " +"value::" +msgstr "" + +#: ../../library/re.rst:770 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline. " "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:701 +#: ../../library/re.rst:780 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -961,53 +1047,53 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:711 +#: ../../library/re.rst:790 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:719 +#: ../../library/re.rst:798 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:723 +#: ../../library/re.rst:802 msgid "Functions" msgstr "" -#: ../../library/re.rst:727 +#: ../../library/re.rst:806 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" -#: ../../library/re.rst:732 +#: ../../library/re.rst:811 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the following variables, combined using bitwise OR (the " "``|`` operator)." msgstr "" -#: ../../library/re.rst:736 +#: ../../library/re.rst:815 msgid "The sequence ::" msgstr "" -#: ../../library/re.rst:741 +#: ../../library/re.rst:820 msgid "is equivalent to ::" msgstr "" "等價於:\n" "\n" "::" -#: ../../library/re.rst:745 +#: ../../library/re.rst:824 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " "times in a single program." msgstr "" -#: ../../library/re.rst:751 +#: ../../library/re.rst:830 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " @@ -1015,7 +1101,7 @@ msgid "" "compiling regular expressions." msgstr "" -#: ../../library/re.rst:759 +#: ../../library/re.rst:838 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :ref:" @@ -1024,7 +1110,7 @@ msgid "" "length match at some point in the string." msgstr "" -#: ../../library/re.rst:768 +#: ../../library/re.rst:847 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :ref:`match object `. Return ``None`` if the " @@ -1052,7 +1138,7 @@ msgid "" "length match." msgstr "" -#: ../../library/re.rst:792 +#: ../../library/re.rst:871 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1061,42 +1147,42 @@ msgid "" "final element of the list. ::" msgstr "" -#: ../../library/re.rst:807 +#: ../../library/re.rst:886 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" -#: ../../library/re.rst:814 +#: ../../library/re.rst:893 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "" -#: ../../library/re.rst:817 +#: ../../library/re.rst:896 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." msgstr "" -#: ../../library/re.rst:827 ../../library/re.rst:917 ../../library/re.rst:941 +#: ../../library/re.rst:906 ../../library/re.rst:996 ../../library/re.rst:1024 msgid "Added the optional flags argument." msgstr "" -#: ../../library/re.rst:830 +#: ../../library/re.rst:909 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "" -#: ../../library/re.rst:836 +#: ../../library/re.rst:915 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" -#: ../../library/re.rst:840 +#: ../../library/re.rst:919 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1106,11 +1192,11 @@ msgid "" "result." msgstr "" -#: ../../library/re.rst:852 ../../library/re.rst:863 +#: ../../library/re.rst:931 ../../library/re.rst:942 msgid "Non-empty matches can now start just after a previous empty match." msgstr "" -#: ../../library/re.rst:858 +#: ../../library/re.rst:937 msgid "" "Return an :term:`iterator` yielding :ref:`match objects ` " "over all non-overlapping matches for the RE *pattern* in *string*. The " @@ -1118,7 +1204,7 @@ msgid "" "found. Empty matches are included in the result." msgstr "" -#: ../../library/re.rst:869 +#: ../../library/re.rst:948 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1132,18 +1218,18 @@ msgid "" "For example::" msgstr "" -#: ../../library/re.rst:885 +#: ../../library/re.rst:964 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :ref:`match object ` argument, and returns the replacement string. For example::" msgstr "" -#: ../../library/re.rst:897 +#: ../../library/re.rst:976 msgid "The pattern may be a string or a :ref:`pattern object `." msgstr "" -#: ../../library/re.rst:899 +#: ../../library/re.rst:978 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1152,7 +1238,7 @@ msgid "" "'abxd')`` returns ``'-a-b--d-'``." msgstr "" -#: ../../library/re.rst:907 +#: ../../library/re.rst:986 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1165,52 +1251,58 @@ msgid "" "RE." msgstr "" -#: ../../library/re.rst:920 ../../library/re.rst:944 ../../library/re.rst:1178 +#: ../../library/re.rst:999 ../../library/re.rst:1027 ../../library/re.rst:1261 msgid "Unmatched groups are replaced with an empty string." msgstr "" -#: ../../library/re.rst:923 +#: ../../library/re.rst:1002 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" -#: ../../library/re.rst:927 +#: ../../library/re.rst:1006 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors." msgstr "" -#: ../../library/re.rst:931 +#: ../../library/re.rst:1010 msgid "" "Empty matches for the pattern are replaced when adjacent to a previous non-" "empty match." msgstr "" -#: ../../library/re.rst:938 +#: ../../library/re.rst:1014 +msgid "" +"Group *id* containing anything except ASCII digits. Group names containing " +"non-ASCII characters in bytes replacement strings." +msgstr "" + +#: ../../library/re.rst:1021 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" -#: ../../library/re.rst:950 +#: ../../library/re.rst:1033 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" -#: ../../library/re.rst:965 +#: ../../library/re.rst:1048 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" -#: ../../library/re.rst:973 +#: ../../library/re.rst:1056 msgid "The ``'_'`` character is no longer escaped." msgstr "" -#: ../../library/re.rst:976 +#: ../../library/re.rst:1059 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1218,15 +1310,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:985 +#: ../../library/re.rst:1068 msgid "Clear the regular expression cache." msgstr "" -#: ../../library/re.rst:989 +#: ../../library/re.rst:1072 msgid "Exceptions" msgstr "" -#: ../../library/re.rst:993 +#: ../../library/re.rst:1076 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1235,41 +1327,41 @@ msgid "" "pattern. The error instance has the following additional attributes:" msgstr "" -#: ../../library/re.rst:1001 +#: ../../library/re.rst:1084 msgid "The unformatted error message." msgstr "" -#: ../../library/re.rst:1005 +#: ../../library/re.rst:1088 msgid "The regular expression pattern." msgstr "" -#: ../../library/re.rst:1009 +#: ../../library/re.rst:1092 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "" -#: ../../library/re.rst:1013 +#: ../../library/re.rst:1096 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1017 +#: ../../library/re.rst:1100 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1019 +#: ../../library/re.rst:1102 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1025 +#: ../../library/re.rst:1108 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1027 +#: ../../library/re.rst:1110 msgid "" "Compiled regular expression objects support the following methods and " "attributes:" msgstr "" -#: ../../library/re.rst:1032 +#: ../../library/re.rst:1115 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :ref:`match object " @@ -1278,7 +1370,7 @@ msgid "" "some point in the string." msgstr "" -#: ../../library/re.rst:1038 +#: ../../library/re.rst:1121 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1287,7 +1379,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1044 +#: ../../library/re.rst:1127 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1297,7 +1389,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1059 +#: ../../library/re.rst:1142 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :ref:`match object `. " @@ -1305,19 +1397,19 @@ msgid "" "different from a zero-length match." msgstr "" -#: ../../library/re.rst:1064 ../../library/re.rst:1082 +#: ../../library/re.rst:1147 ../../library/re.rst:1165 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1072 +#: ../../library/re.rst:1155 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1078 +#: ../../library/re.rst:1161 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :ref:`match object `. Return ``None`` if the " @@ -1325,76 +1417,76 @@ msgid "" "length match." msgstr "" -#: ../../library/re.rst:1096 +#: ../../library/re.rst:1179 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1101 +#: ../../library/re.rst:1184 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1108 +#: ../../library/re.rst:1191 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1115 +#: ../../library/re.rst:1198 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1120 +#: ../../library/re.rst:1203 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1125 +#: ../../library/re.rst:1208 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :data:`UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1132 +#: ../../library/re.rst:1215 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1137 +#: ../../library/re.rst:1220 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1144 +#: ../../library/re.rst:1227 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1147 +#: ../../library/re.rst:1230 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1155 +#: ../../library/re.rst:1238 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1157 +#: ../../library/re.rst:1240 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1166 +#: ../../library/re.rst:1249 msgid "Match objects support the following methods and attributes:" msgstr "" -#: ../../library/re.rst:1171 +#: ../../library/re.rst:1254 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1403,7 +1495,7 @@ msgid "" "\\g``) are replaced by the contents of the corresponding group." msgstr "" -#: ../../library/re.rst:1183 +#: ../../library/re.rst:1266 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1418,7 +1510,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1205 +#: ../../library/re.rst:1288 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1426,53 +1518,57 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1210 +#: ../../library/re.rst:1293 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1218 +#: ../../library/re.rst:1301 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1225 +#: ../../library/re.rst:1308 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1234 +#: ../../library/re.rst:1317 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1250 +#: ../../library/re.rst:1328 +msgid "Named groups are supported as well::" +msgstr "" + +#: ../../library/re.rst:1341 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1254 ../../library/re.rst:1476 +#: ../../library/re.rst:1345 ../../library/re.rst:1567 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/re.rst:1260 +#: ../../library/re.rst:1351 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1273 +#: ../../library/re.rst:1364 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1285 +#: ../../library/re.rst:1376 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -1481,7 +1577,7 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1293 +#: ../../library/re.rst:1384 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -1489,32 +1585,32 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1298 +#: ../../library/re.rst:1389 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1308 +#: ../../library/re.rst:1399 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1315 +#: ../../library/re.rst:1406 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1322 +#: ../../library/re.rst:1413 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1329 +#: ../../library/re.rst:1420 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -1523,43 +1619,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1338 +#: ../../library/re.rst:1429 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1344 +#: ../../library/re.rst:1435 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1350 +#: ../../library/re.rst:1441 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1353 +#: ../../library/re.rst:1444 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1361 +#: ../../library/re.rst:1452 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1365 +#: ../../library/re.rst:1456 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1367 +#: ../../library/re.rst:1458 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1375 +#: ../../library/re.rst:1466 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -1567,28 +1663,28 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1380 +#: ../../library/re.rst:1471 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1390 +#: ../../library/re.rst:1481 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1400 +#: ../../library/re.rst:1491 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1419 +#: ../../library/re.rst:1510 msgid "Simulating scanf()" msgstr "" -#: ../../library/re.rst:1423 +#: ../../library/re.rst:1514 msgid "" "Python does not currently have an equivalent to :c:func:`scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -1597,99 +1693,99 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1430 +#: ../../library/re.rst:1521 msgid ":c:func:`scanf` Token" msgstr "" -#: ../../library/re.rst:1430 +#: ../../library/re.rst:1521 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1432 +#: ../../library/re.rst:1523 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1525 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1525 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1436 +#: ../../library/re.rst:1527 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1436 +#: ../../library/re.rst:1527 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1438 +#: ../../library/re.rst:1529 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1438 +#: ../../library/re.rst:1529 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1440 +#: ../../library/re.rst:1531 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1440 +#: ../../library/re.rst:1531 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1442 +#: ../../library/re.rst:1533 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1442 +#: ../../library/re.rst:1533 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1444 +#: ../../library/re.rst:1535 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1444 +#: ../../library/re.rst:1535 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1446 +#: ../../library/re.rst:1537 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1446 +#: ../../library/re.rst:1537 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1448 +#: ../../library/re.rst:1539 msgid "``%x``, ``%X``" msgstr "``%x``\\ 、\\ ``%X``" -#: ../../library/re.rst:1448 +#: ../../library/re.rst:1539 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1451 +#: ../../library/re.rst:1542 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1455 +#: ../../library/re.rst:1546 msgid "you would use a :c:func:`scanf` format like ::" msgstr "" -#: ../../library/re.rst:1459 +#: ../../library/re.rst:1550 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1558 msgid "search() vs. match()" msgstr "" -#: ../../library/re.rst:1471 +#: ../../library/re.rst:1562 msgid "" "Python offers two different primitive operations based on regular " "expressions: :func:`re.match` checks for a match only at the beginning of " @@ -1697,13 +1793,13 @@ msgid "" "string (this is what Perl does by default)." msgstr "" -#: ../../library/re.rst:1482 +#: ../../library/re.rst:1573 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1581 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -1711,11 +1807,11 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1500 +#: ../../library/re.rst:1591 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1502 +#: ../../library/re.rst:1593 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -1723,37 +1819,37 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1507 +#: ../../library/re.rst:1598 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1520 +#: ../../library/re.rst:1611 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1533 +#: ../../library/re.rst:1624 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1546 +#: ../../library/re.rst:1637 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1561 +#: ../../library/re.rst:1652 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1563 +#: ../../library/re.rst:1654 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -1761,11 +1857,11 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1580 +#: ../../library/re.rst:1671 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1582 +#: ../../library/re.rst:1673 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -1773,11 +1869,11 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1593 +#: ../../library/re.rst:1684 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1595 +#: ../../library/re.rst:1686 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :ref:`match objects " @@ -1786,11 +1882,11 @@ msgid "" "text, they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1609 +#: ../../library/re.rst:1700 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1611 +#: ../../library/re.rst:1702 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -1798,7 +1894,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1621 +#: ../../library/re.rst:1712 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -1806,29 +1902,29 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1633 +#: ../../library/re.rst:1724 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1635 +#: ../../library/re.rst:1726 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1639 +#: ../../library/re.rst:1730 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1695 +#: ../../library/re.rst:1786 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1718 +#: ../../library/re.rst:1809 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " diff --git a/library/reprlib.po b/library/reprlib.po index d8160f5603..c53296946e 100644 --- a/library/reprlib.po +++ b/library/reprlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -86,24 +86,29 @@ msgstr "" #: ../../library/reprlib.rst:81 msgid "" +"This string is displayed for recursive references. It defaults to ``...``." +msgstr "" + +#: ../../library/reprlib.rst:89 +msgid "" "Depth limit on the creation of recursive representations. The default is " "``6``." msgstr "" -#: ../../library/reprlib.rst:92 +#: ../../library/reprlib.rst:100 msgid "" "Limits on the number of entries represented for the named object type. The " "default is ``4`` for :attr:`maxdict`, ``5`` for :attr:`maxarray`, and ``6`` " "for the others." msgstr "" -#: ../../library/reprlib.rst:99 +#: ../../library/reprlib.rst:107 msgid "" "Maximum number of characters in the representation for an integer. Digits " "are dropped from the middle. The default is ``40``." msgstr "" -#: ../../library/reprlib.rst:105 +#: ../../library/reprlib.rst:113 msgid "" "Limit on the number of characters in the representation of the string. Note " "that the \"normal\" representation of the string is used as the character " @@ -111,20 +116,20 @@ msgid "" "mangled when the representation is shortened. The default is ``30``." msgstr "" -#: ../../library/reprlib.rst:113 +#: ../../library/reprlib.rst:121 msgid "" "This limit is used to control the size of object types for which no specific " "formatting method is available on the :class:`Repr` object. It is applied in " "a similar manner as :attr:`maxstring`. The default is ``20``." msgstr "" -#: ../../library/reprlib.rst:120 +#: ../../library/reprlib.rst:128 msgid "" "The equivalent to the built-in :func:`repr` that uses the formatting imposed " "by the instance." msgstr "" -#: ../../library/reprlib.rst:126 +#: ../../library/reprlib.rst:134 msgid "" "Recursive implementation used by :meth:`.repr`. This uses the type of *obj* " "to determine which formatting method to call, passing it *obj* and *level*. " @@ -133,7 +138,7 @@ msgid "" "call." msgstr "" -#: ../../library/reprlib.rst:135 +#: ../../library/reprlib.rst:143 msgid "" "Formatting methods for specific types are implemented as methods with a name " "based on the type name. In the method name, **TYPE** is replaced by ``'_'." @@ -142,11 +147,11 @@ msgid "" "should call ``self.repr1(subobj, level - 1)``." msgstr "" -#: ../../library/reprlib.rst:145 +#: ../../library/reprlib.rst:153 msgid "Subclassing Repr Objects" msgstr "" -#: ../../library/reprlib.rst:147 +#: ../../library/reprlib.rst:155 msgid "" "The use of dynamic dispatching by :meth:`Repr.repr1` allows subclasses of :" "class:`Repr` to add support for additional built-in object types or to " diff --git a/library/resource.po b/library/resource.po index c3acffe387..9403c548d8 100644 --- a/library/resource.po +++ b/library/resource.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,29 +28,40 @@ msgid "" "resources utilized by a program." msgstr "" -#: ../../library/resource.rst:16 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/resource.rst:18 msgid "" "Symbolic constants are used to specify particular system resources and to " "request usage information about either the current process or its children." msgstr "" -#: ../../library/resource.rst:19 +#: ../../library/resource.rst:21 msgid "An :exc:`OSError` is raised on syscall failure." msgstr "" -#: ../../library/resource.rst:24 +#: ../../library/resource.rst:26 msgid "A deprecated alias of :exc:`OSError`." msgstr "" -#: ../../library/resource.rst:26 +#: ../../library/resource.rst:28 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/resource.rst:31 +#: ../../library/resource.rst:33 msgid "Resource Limits" msgstr "" -#: ../../library/resource.rst:33 +#: ../../library/resource.rst:35 msgid "" "Resources usage can be limited using the :func:`setrlimit` function " "described below. Each resource is controlled by a pair of limits: a soft " @@ -61,7 +72,7 @@ msgid "" "super-user can raise a hard limit.)" msgstr "" -#: ../../library/resource.rst:41 +#: ../../library/resource.rst:43 msgid "" "The specific resources that can be limited are system dependent. They are " "described in the :manpage:`getrlimit(2)` man page. The resources listed " @@ -70,18 +81,18 @@ msgid "" "not defined in this module for those platforms." msgstr "" -#: ../../library/resource.rst:50 +#: ../../library/resource.rst:52 msgid "Constant used to represent the limit for an unlimited resource." msgstr "" -#: ../../library/resource.rst:55 +#: ../../library/resource.rst:57 msgid "" "Returns a tuple ``(soft, hard)`` with the current soft and hard limits of " "*resource*. Raises :exc:`ValueError` if an invalid resource is specified, " "or :exc:`error` if the underlying system call fails unexpectedly." msgstr "" -#: ../../library/resource.rst:62 +#: ../../library/resource.rst:64 msgid "" "Sets new limits of consumption of *resource*. The *limits* argument must be " "a tuple ``(soft, hard)`` of two integers describing the new limits. A value " @@ -89,7 +100,7 @@ msgid "" "unlimited." msgstr "" -#: ../../library/resource.rst:67 +#: ../../library/resource.rst:69 msgid "" "Raises :exc:`ValueError` if an invalid resource is specified, if the new " "soft limit exceeds the hard limit, or if a process tries to raise its hard " @@ -100,23 +111,23 @@ msgid "" "be raised if the requested limit exceeds the system imposed limit." msgstr "" -#: ../../library/resource.rst:76 +#: ../../library/resource.rst:78 msgid "" "``setrlimit`` may also raise :exc:`error` if the underlying system call " "fails." msgstr "" -#: ../../library/resource.rst:79 +#: ../../library/resource.rst:81 msgid "VxWorks only supports setting :data:`RLIMIT_NOFILE`." msgstr "" -#: ../../library/resource.rst:81 +#: ../../library/resource.rst:94 msgid "" "Raises an :ref:`auditing event ` ``resource.setrlimit`` with " "arguments ``resource``, ``limits``." msgstr "" -#: ../../library/resource.rst:86 +#: ../../library/resource.rst:88 msgid "" "Combines :func:`setrlimit` and :func:`getrlimit` in one function and " "supports to get and set the resources limits of an arbitrary process. If " @@ -125,40 +136,38 @@ msgid "" "is optional." msgstr "" -#: ../../library/resource.rst:92 +#: ../../library/resource.rst:94 msgid "" "When *limits* is not given the function returns the *resource* limit of the " "process *pid*. When *limits* is given the *resource* limit of the process is " "set and the former resource limit is returned." msgstr "" -#: ../../library/resource.rst:96 +#: ../../library/resource.rst:98 msgid "" "Raises :exc:`ProcessLookupError` when *pid* can't be found and :exc:" "`PermissionError` when the user doesn't have ``CAP_SYS_RESOURCE`` for the " "process." msgstr "" -#: ../../library/resource.rst:100 +#: ../../library/resource.rst:113 msgid "" "Raises an :ref:`auditing event ` ``resource.prlimit`` with " "arguments ``pid``, ``resource``, ``limits``." msgstr "" -#: ../../library/resource.rst:103 -msgid "" -":ref:`Availability `: Linux 2.6.36 or later with glibc 2.13 or " -"later." -msgstr "" +#: ../../library/resource.rst:105 +msgid ":ref:`Availability `: Linux >= 2.6.36 with glibc >= 2.13." +msgstr ":ref:`適用 `:Linux 2.6.36 以上且具有 glibc 2.13 以上。" -#: ../../library/resource.rst:107 +#: ../../library/resource.rst:109 msgid "" "These symbols define resources whose consumption can be controlled using " "the :func:`setrlimit` and :func:`getrlimit` functions described below. The " "values of these symbols are exactly the constants used by C programs." msgstr "" -#: ../../library/resource.rst:111 +#: ../../library/resource.rst:113 msgid "" "The Unix man page for :manpage:`getrlimit(2)` lists the available resources. " "Note that not all systems use the same symbol or same value to denote the " @@ -167,14 +176,14 @@ msgid "" "module on that platform." msgstr "" -#: ../../library/resource.rst:120 +#: ../../library/resource.rst:122 msgid "" "The maximum size (in bytes) of a core file that the current process can " "create. This may result in the creation of a partial core file if a larger " "core would be required to contain the entire process image." msgstr "" -#: ../../library/resource.rst:127 +#: ../../library/resource.rst:129 msgid "" "The maximum amount of processor time (in seconds) that a process can use. If " "this limit is exceeded, a :const:`SIGXCPU` signal is sent to the process. " @@ -182,98 +191,98 @@ msgid "" "catch this signal and do something useful, e.g. flush open files to disk.)" msgstr "" -#: ../../library/resource.rst:135 +#: ../../library/resource.rst:137 msgid "The maximum size of a file which the process may create." msgstr "" -#: ../../library/resource.rst:140 +#: ../../library/resource.rst:142 msgid "The maximum size (in bytes) of the process's heap." msgstr "" -#: ../../library/resource.rst:145 +#: ../../library/resource.rst:147 msgid "" "The maximum size (in bytes) of the call stack for the current process. This " "only affects the stack of the main thread in a multi-threaded process." msgstr "" -#: ../../library/resource.rst:151 +#: ../../library/resource.rst:153 msgid "" "The maximum resident set size that should be made available to the process." msgstr "" -#: ../../library/resource.rst:156 +#: ../../library/resource.rst:158 msgid "The maximum number of processes the current process may create." msgstr "" -#: ../../library/resource.rst:161 +#: ../../library/resource.rst:163 msgid "The maximum number of open file descriptors for the current process." msgstr "" -#: ../../library/resource.rst:166 +#: ../../library/resource.rst:168 msgid "The BSD name for :const:`RLIMIT_NOFILE`." msgstr "" -#: ../../library/resource.rst:171 +#: ../../library/resource.rst:173 msgid "The maximum address space which may be locked in memory." msgstr "" -#: ../../library/resource.rst:176 +#: ../../library/resource.rst:178 msgid "The largest area of mapped memory which the process may occupy." msgstr "" -#: ../../library/resource.rst:181 +#: ../../library/resource.rst:183 msgid "" "The maximum area (in bytes) of address space which may be taken by the " "process." msgstr "" -#: ../../library/resource.rst:186 +#: ../../library/resource.rst:188 msgid "The number of bytes that can be allocated for POSIX message queues." msgstr "" -#: ../../library/resource.rst:189 ../../library/resource.rst:226 -msgid ":ref:`Availability `: Linux 2.6.8 or later." +#: ../../library/resource.rst:191 ../../library/resource.rst:228 +msgid ":ref:`Availability `: Linux >= 2.6.8." msgstr ":ref:`適用 `:Linux 2.6.8 以上。" -#: ../../library/resource.rst:195 +#: ../../library/resource.rst:197 msgid "The ceiling for the process's nice level (calculated as 20 - rlim_cur)." msgstr "" -#: ../../library/resource.rst:198 ../../library/resource.rst:207 -msgid ":ref:`Availability `: Linux 2.6.12 or later." +#: ../../library/resource.rst:200 ../../library/resource.rst:209 +msgid ":ref:`Availability `: Linux >= 2.6.12." msgstr ":ref:`適用 `:Linux 2.6.12 以上。" -#: ../../library/resource.rst:204 +#: ../../library/resource.rst:206 msgid "The ceiling of the real-time priority." msgstr "" -#: ../../library/resource.rst:213 +#: ../../library/resource.rst:215 msgid "" "The time limit (in microseconds) on CPU time that a process can spend under " "real-time scheduling without making a blocking syscall." msgstr "" -#: ../../library/resource.rst:217 -msgid ":ref:`Availability `: Linux 2.6.25 or later." +#: ../../library/resource.rst:219 +msgid ":ref:`Availability `: Linux >= 2.6.25." msgstr ":ref:`適用 `:Linux 2.6.25 以上。" -#: ../../library/resource.rst:223 +#: ../../library/resource.rst:225 msgid "The number of signals which the process may queue." msgstr "" -#: ../../library/resource.rst:231 +#: ../../library/resource.rst:233 msgid "" "The maximum size (in bytes) of socket buffer usage for this user. This " "limits the amount of network memory, and hence the amount of mbufs, that " "this user may hold at any time." msgstr "" -#: ../../library/resource.rst:236 ../../library/resource.rst:249 -#: ../../library/resource.rst:257 -msgid ":ref:`Availability `: FreeBSD 9 or later." -msgstr ":ref:`適用 `:FreeBSD 9 以上。" +#: ../../library/resource.rst:238 ../../library/resource.rst:251 +#: ../../library/resource.rst:259 +msgid ":ref:`Availability `: FreeBSD." +msgstr ":ref:`適用 `:FreeBSD。" -#: ../../library/resource.rst:241 +#: ../../library/resource.rst:243 msgid "" "The maximum size (in bytes) of the swap space that may be reserved or used " "by all of this user id's processes. This limit is enforced only if bit 1 of " @@ -282,27 +291,27 @@ msgid "" "this sysctl." msgstr "" -#: ../../library/resource.rst:254 +#: ../../library/resource.rst:256 msgid "The maximum number of pseudo-terminals created by this user id." msgstr "" -#: ../../library/resource.rst:262 +#: ../../library/resource.rst:264 msgid "The maximum number of kqueues this user id is allowed to create." msgstr "" -#: ../../library/resource.rst:265 -msgid ":ref:`Availability `: FreeBSD 11 or later." +#: ../../library/resource.rst:267 +msgid ":ref:`Availability `: FreeBSD >= 11." msgstr ":ref:`適用 `:FreeBSD 11 以上。" -#: ../../library/resource.rst:269 +#: ../../library/resource.rst:271 msgid "Resource Usage" msgstr "" -#: ../../library/resource.rst:271 +#: ../../library/resource.rst:273 msgid "These functions are used to retrieve resource usage information:" msgstr "" -#: ../../library/resource.rst:276 +#: ../../library/resource.rst:278 msgid "" "This function returns an object that describes the resources consumed by " "either the current process or its children, as specified by the *who* " @@ -310,14 +319,14 @@ msgid "" "`RUSAGE_\\*` constants described below." msgstr "" -#: ../../library/resource.rst:281 +#: ../../library/resource.rst:283 msgid "A simple example::" msgstr "" "一個簡單範例:\n" "\n" "::" -#: ../../library/resource.rst:295 +#: ../../library/resource.rst:297 msgid "" "The fields of the return value each describe how a particular system " "resource has been used, e.g. amount of time spent running is user mode or " @@ -326,13 +335,13 @@ msgid "" "is using." msgstr "" -#: ../../library/resource.rst:300 +#: ../../library/resource.rst:302 msgid "" "For backward compatibility, the return value is also accessible as a tuple " "of 16 elements." msgstr "" -#: ../../library/resource.rst:303 +#: ../../library/resource.rst:305 msgid "" "The fields :attr:`ru_utime` and :attr:`ru_stime` of the return value are " "floating point values representing the amount of time spent executing in " @@ -342,249 +351,249 @@ msgid "" "summary is presented here:" msgstr "" -#: ../../library/resource.rst:310 +#: ../../library/resource.rst:312 msgid "Index" msgstr "" -#: ../../library/resource.rst:310 +#: ../../library/resource.rst:312 msgid "Field" msgstr "" -#: ../../library/resource.rst:310 +#: ../../library/resource.rst:312 msgid "Resource" msgstr "" -#: ../../library/resource.rst:312 +#: ../../library/resource.rst:314 msgid "``0``" msgstr "``0``" -#: ../../library/resource.rst:312 +#: ../../library/resource.rst:314 msgid ":attr:`ru_utime`" msgstr ":attr:`ru_utime`" -#: ../../library/resource.rst:312 +#: ../../library/resource.rst:314 msgid "time in user mode (float seconds)" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:316 msgid "``1``" msgstr "``1``" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:316 msgid ":attr:`ru_stime`" msgstr ":attr:`ru_stime`" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:316 msgid "time in system mode (float seconds)" msgstr "" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:318 msgid "``2``" msgstr "``2``" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:318 msgid ":attr:`ru_maxrss`" msgstr ":attr:`ru_maxrss`" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:318 msgid "maximum resident set size" msgstr "" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:320 msgid "``3``" msgstr "``3``" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:320 msgid ":attr:`ru_ixrss`" msgstr ":attr:`ru_ixrss`" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:320 msgid "shared memory size" msgstr "" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:322 msgid "``4``" msgstr "``4``" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:322 msgid ":attr:`ru_idrss`" msgstr ":attr:`ru_idrss`" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:322 msgid "unshared memory size" msgstr "" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:324 msgid "``5``" msgstr "``5``" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:324 msgid ":attr:`ru_isrss`" msgstr ":attr:`ru_isrss`" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:324 msgid "unshared stack size" msgstr "" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:326 msgid "``6``" msgstr "``6``" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:326 msgid ":attr:`ru_minflt`" msgstr ":attr:`ru_minflt`" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:326 msgid "page faults not requiring I/O" msgstr "" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:328 msgid "``7``" msgstr "``7``" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:328 msgid ":attr:`ru_majflt`" msgstr ":attr:`ru_majflt`" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:328 msgid "page faults requiring I/O" msgstr "" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:330 msgid "``8``" msgstr "``8``" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:330 msgid ":attr:`ru_nswap`" msgstr ":attr:`ru_nswap`" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:330 msgid "number of swap outs" msgstr "" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:332 msgid "``9``" msgstr "``9``" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:332 msgid ":attr:`ru_inblock`" msgstr ":attr:`ru_inblock`" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:332 msgid "block input operations" msgstr "" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:334 msgid "``10``" msgstr "``10``" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:334 msgid ":attr:`ru_oublock`" msgstr ":attr:`ru_oublock`" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:334 msgid "block output operations" msgstr "" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:336 msgid "``11``" msgstr "``11``" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:336 msgid ":attr:`ru_msgsnd`" msgstr ":attr:`ru_msgsnd`" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:336 msgid "messages sent" msgstr "" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:338 msgid "``12``" msgstr "``12``" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:338 msgid ":attr:`ru_msgrcv`" msgstr ":attr:`ru_msgrcv`" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:338 msgid "messages received" msgstr "" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:340 msgid "``13``" msgstr "``13``" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:340 msgid ":attr:`ru_nsignals`" msgstr ":attr:`ru_nsignals`" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:340 msgid "signals received" msgstr "" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:342 msgid "``14``" msgstr "``14``" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:342 msgid ":attr:`ru_nvcsw`" msgstr ":attr:`ru_nvcsw`" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:342 msgid "voluntary context switches" msgstr "" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:344 msgid "``15``" msgstr "``15``" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:344 msgid ":attr:`ru_nivcsw`" msgstr ":attr:`ru_nivcsw`" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:344 msgid "involuntary context switches" msgstr "" -#: ../../library/resource.rst:345 +#: ../../library/resource.rst:347 msgid "" "This function will raise a :exc:`ValueError` if an invalid *who* parameter " "is specified. It may also raise :exc:`error` exception in unusual " "circumstances." msgstr "" -#: ../../library/resource.rst:351 +#: ../../library/resource.rst:353 msgid "" "Returns the number of bytes in a system page. (This need not be the same as " "the hardware page size.)" msgstr "" -#: ../../library/resource.rst:354 +#: ../../library/resource.rst:356 msgid "" "The following :const:`RUSAGE_\\*` symbols are passed to the :func:" "`getrusage` function to specify which processes information should be " "provided for." msgstr "" -#: ../../library/resource.rst:360 +#: ../../library/resource.rst:362 msgid "" "Pass to :func:`getrusage` to request resources consumed by the calling " "process, which is the sum of resources used by all threads in the process." msgstr "" -#: ../../library/resource.rst:366 +#: ../../library/resource.rst:368 msgid "" "Pass to :func:`getrusage` to request resources consumed by child processes " "of the calling process which have been terminated and waited for." msgstr "" -#: ../../library/resource.rst:372 +#: ../../library/resource.rst:374 msgid "" "Pass to :func:`getrusage` to request resources consumed by both the current " "process and child processes. May not be available on all systems." msgstr "" -#: ../../library/resource.rst:378 +#: ../../library/resource.rst:380 msgid "" "Pass to :func:`getrusage` to request resources consumed by the current " "thread. May not be available on all systems." diff --git a/library/security_warnings.po b/library/security_warnings.po index 4fa1c7cbce..b095f78d8f 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-02 00:16+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -102,3 +102,12 @@ msgid "" ":mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume " "exhaustion `" msgstr "" + +#: ../../library/security_warnings.rst:36 +msgid "" +"The :option:`-I` command line option can be used to run Python in isolated " +"mode. When it cannot be used, the :option:`-P` option or the :envvar:" +"`PYTHONSAFEPATH` environment variable can be used to not prepend a " +"potentially unsafe path to :data:`sys.path` such as the current directory, " +"the script's directory or an empty string." +msgstr "" diff --git a/library/select.po b/library/select.po index 3f23fcd6c1..dc425ac81e 100644 --- a/library/select.po +++ b/library/select.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,26 +41,37 @@ msgid "" "precise control over the OS-level primitives used." msgstr "" -#: ../../library/select.rst:26 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/select.rst:27 msgid "The module defines the following:" msgstr "" -#: ../../library/select.rst:31 +#: ../../library/select.rst:32 msgid "A deprecated alias of :exc:`OSError`." msgstr "" -#: ../../library/select.rst:33 +#: ../../library/select.rst:34 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/select.rst:39 +#: ../../library/select.rst:40 msgid "" "(Only supported on Solaris and derivatives.) Returns a ``/dev/poll`` " "polling object; see section :ref:`devpoll-objects` below for the methods " "supported by devpoll objects." msgstr "" -#: ../../library/select.rst:43 +#: ../../library/select.rst:44 msgid "" ":c:func:`devpoll` objects are linked to the number of file descriptors " "allowed at the time of instantiation. If your program reduces this value, :c:" @@ -68,22 +79,22 @@ msgid "" "`devpoll` may return an incomplete list of active file descriptors." msgstr "" -#: ../../library/select.rst:49 ../../library/select.rst:78 -#: ../../library/select.rst:105 +#: ../../library/select.rst:50 ../../library/select.rst:79 +#: ../../library/select.rst:106 msgid "The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/select.rst:53 ../../library/select.rst:107 +#: ../../library/select.rst:54 ../../library/select.rst:108 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/select.rst:58 +#: ../../library/select.rst:59 msgid "" "(Only supported on Linux 2.5.44 and newer.) Return an edge polling object, " "which can be used as Edge or Level Triggered interface for I/O events." msgstr "" -#: ../../library/select.rst:62 +#: ../../library/select.rst:63 msgid "" "*sizehint* informs epoll about the expected number of events to be " "registered. It must be positive, or `-1` to use the default. It is only " @@ -91,43 +102,43 @@ msgid "" "otherwise it has no effect (though its value is still checked)." msgstr "" -#: ../../library/select.rst:67 +#: ../../library/select.rst:68 msgid "" "*flags* is deprecated and completely ignored. However, when supplied, its " "value must be ``0`` or ``select.EPOLL_CLOEXEC``, otherwise ``OSError`` is " "raised." msgstr "" -#: ../../library/select.rst:71 +#: ../../library/select.rst:72 msgid "" "See the :ref:`epoll-objects` section below for the methods supported by " "epolling objects." msgstr "" -#: ../../library/select.rst:74 +#: ../../library/select.rst:75 msgid "" "``epoll`` objects support the context management protocol: when used in a :" "keyword:`with` statement, the new file descriptor is automatically closed at " "the end of the block." msgstr "" -#: ../../library/select.rst:80 +#: ../../library/select.rst:81 msgid "Added the *flags* parameter." msgstr "新增 *flags* 參數。" -#: ../../library/select.rst:83 +#: ../../library/select.rst:84 msgid "" "Support for the :keyword:`with` statement was added. The new file descriptor " "is now non-inheritable." msgstr "" -#: ../../library/select.rst:87 +#: ../../library/select.rst:88 msgid "" "The *flags* parameter. ``select.EPOLL_CLOEXEC`` is used by default now. " "Use :func:`os.set_inheritable` to make the file descriptor inheritable." msgstr "" -#: ../../library/select.rst:94 +#: ../../library/select.rst:95 msgid "" "(Not supported by all operating systems.) Returns a polling object, which " "supports registering and unregistering file descriptors, and then polling " @@ -135,19 +146,19 @@ msgid "" "supported by polling objects." msgstr "" -#: ../../library/select.rst:102 +#: ../../library/select.rst:103 msgid "" "(Only supported on BSD.) Returns a kernel queue object; see section :ref:" "`kqueue-objects` below for the methods supported by kqueue objects." msgstr "" -#: ../../library/select.rst:113 +#: ../../library/select.rst:114 msgid "" "(Only supported on BSD.) Returns a kernel event object; see section :ref:" "`kevent-objects` below for the methods supported by kevent objects." msgstr "" -#: ../../library/select.rst:119 +#: ../../library/select.rst:120 msgid "" "This is a straightforward interface to the Unix :c:func:`select` system " "call. The first three arguments are iterables of 'waitable objects': either " @@ -155,21 +166,21 @@ msgid "" "method named :meth:`~io.IOBase.fileno` returning such an integer:" msgstr "" -#: ../../library/select.rst:124 +#: ../../library/select.rst:125 msgid "*rlist*: wait until ready for reading" msgstr "" -#: ../../library/select.rst:125 +#: ../../library/select.rst:126 msgid "*wlist*: wait until ready for writing" msgstr "" -#: ../../library/select.rst:126 +#: ../../library/select.rst:127 msgid "" "*xlist*: wait for an \"exceptional condition\" (see the manual page for what " "your system considers such a condition)" msgstr "" -#: ../../library/select.rst:129 +#: ../../library/select.rst:130 msgid "" "Empty iterables are allowed, but acceptance of three empty iterables is " "platform-dependent. (It is known to work on Unix but not on Windows.) The " @@ -179,14 +190,14 @@ msgid "" "specifies a poll and never blocks." msgstr "" -#: ../../library/select.rst:136 +#: ../../library/select.rst:137 msgid "" "The return value is a triple of lists of objects that are ready: subsets of " "the first three arguments. When the time-out is reached without a file " "descriptor becoming ready, three empty lists are returned." msgstr "" -#: ../../library/select.rst:144 +#: ../../library/select.rst:145 msgid "" "Among the acceptable object types in the iterables are Python :term:`file " "objects ` (e.g. ``sys.stdin``, or objects returned by :func:" @@ -196,23 +207,23 @@ msgid "" "file descriptor, not just a random integer)." msgstr "" -#: ../../library/select.rst:155 +#: ../../library/select.rst:156 msgid "" "File objects on Windows are not acceptable, but sockets are. On Windows, " "the underlying :c:func:`select` function is provided by the WinSock library, " "and does not handle file descriptors that don't originate from WinSock." msgstr "" -#: ../../library/select.rst:160 ../../library/select.rst:266 -#: ../../library/select.rst:366 ../../library/select.rst:454 -#: ../../library/select.rst:495 +#: ../../library/select.rst:161 ../../library/select.rst:267 +#: ../../library/select.rst:367 ../../library/select.rst:455 +#: ../../library/select.rst:496 msgid "" "The function is now retried with a recomputed timeout when interrupted by a " "signal, except if the signal handler raises an exception (see :pep:`475` for " "the rationale), instead of raising :exc:`InterruptedError`." msgstr "" -#: ../../library/select.rst:169 +#: ../../library/select.rst:170 msgid "" "The minimum number of bytes which can be written without blocking to a pipe " "when the pipe has been reported as ready for writing by :func:`~select." @@ -220,43 +231,43 @@ msgid "" "apply to other kind of file-like objects such as sockets." msgstr "" -#: ../../library/select.rst:174 +#: ../../library/select.rst:175 msgid "This value is guaranteed by POSIX to be at least 512." msgstr "" -#: ../../library/select.rst:177 +#: ../../library/select.rst:178 msgid ":ref:`Availability `: Unix" msgstr ":ref:`適用 `:Unix。" -#: ../../library/select.rst:184 +#: ../../library/select.rst:185 msgid "``/dev/poll`` Polling Objects" msgstr "" -#: ../../library/select.rst:186 +#: ../../library/select.rst:187 msgid "" "Solaris and derivatives have ``/dev/poll``. While :c:func:`select` is " "O(highest file descriptor) and :c:func:`poll` is O(number of file " "descriptors), ``/dev/poll`` is O(active file descriptors)." msgstr "" -#: ../../library/select.rst:190 +#: ../../library/select.rst:191 msgid "" "``/dev/poll`` behaviour is very close to the standard :c:func:`poll` object." msgstr "" -#: ../../library/select.rst:196 +#: ../../library/select.rst:197 msgid "Close the file descriptor of the polling object." msgstr "" -#: ../../library/select.rst:203 +#: ../../library/select.rst:204 msgid "``True`` if the polling object is closed." msgstr "" -#: ../../library/select.rst:210 +#: ../../library/select.rst:211 msgid "Return the file descriptor number of the polling object." msgstr "" -#: ../../library/select.rst:217 ../../library/select.rst:389 +#: ../../library/select.rst:218 ../../library/select.rst:390 msgid "" "Register a file descriptor with the polling object. Future calls to the :" "meth:`poll` method will then check whether the file descriptor has any " @@ -265,7 +276,7 @@ msgid "" "implement :meth:`!fileno`, so they can also be used as the argument." msgstr "" -#: ../../library/select.rst:223 +#: ../../library/select.rst:224 msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " "check for. The constants are the same that with :c:func:`poll` object. The " @@ -273,33 +284,33 @@ msgid "" "`POLLPRI`, and :const:`POLLOUT`." msgstr "" -#: ../../library/select.rst:230 +#: ../../library/select.rst:231 msgid "" "Registering a file descriptor that's already registered is not an error, but " "the result is undefined. The appropriate action is to unregister or modify " "it first. This is an important difference compared with :c:func:`poll`." msgstr "" -#: ../../library/select.rst:238 +#: ../../library/select.rst:239 msgid "" "This method does an :meth:`unregister` followed by a :meth:`register`. It is " "(a bit) more efficient that doing the same explicitly." msgstr "" -#: ../../library/select.rst:245 ../../library/select.rst:433 +#: ../../library/select.rst:246 ../../library/select.rst:434 msgid "" "Remove a file descriptor being tracked by a polling object. Just like the :" "meth:`register` method, *fd* can be an integer or an object with a :meth:" "`~io.IOBase.fileno` method that returns an integer." msgstr "" -#: ../../library/select.rst:249 +#: ../../library/select.rst:250 msgid "" "Attempting to remove a file descriptor that was never registered is safely " "ignored." msgstr "" -#: ../../library/select.rst:255 +#: ../../library/select.rst:256 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " @@ -313,196 +324,196 @@ msgid "" "the call will block until there is an event for this poll object." msgstr "" -#: ../../library/select.rst:276 +#: ../../library/select.rst:277 msgid "Edge and Level Trigger Polling (epoll) Objects" msgstr "" -#: ../../library/select.rst:278 +#: ../../library/select.rst:279 msgid "https://linux.die.net/man/4/epoll" msgstr "https://linux.die.net/man/4/epoll" -#: ../../library/select.rst:280 +#: ../../library/select.rst:281 msgid "*eventmask*" msgstr "" -#: ../../library/select.rst:283 ../../library/select.rst:401 -#: ../../library/select.rst:521 ../../library/select.rst:550 -#: ../../library/select.rst:581 ../../library/select.rst:589 -#: ../../library/select.rst:609 ../../library/select.rst:632 +#: ../../library/select.rst:284 ../../library/select.rst:402 +#: ../../library/select.rst:522 ../../library/select.rst:551 +#: ../../library/select.rst:582 ../../library/select.rst:590 +#: ../../library/select.rst:610 ../../library/select.rst:633 msgid "Constant" msgstr "常數" -#: ../../library/select.rst:283 ../../library/select.rst:401 -#: ../../library/select.rst:521 ../../library/select.rst:550 -#: ../../library/select.rst:581 ../../library/select.rst:589 -#: ../../library/select.rst:609 ../../library/select.rst:632 +#: ../../library/select.rst:284 ../../library/select.rst:402 +#: ../../library/select.rst:522 ../../library/select.rst:551 +#: ../../library/select.rst:582 ../../library/select.rst:590 +#: ../../library/select.rst:610 ../../library/select.rst:633 msgid "Meaning" msgstr "" -#: ../../library/select.rst:285 +#: ../../library/select.rst:286 msgid ":const:`EPOLLIN`" msgstr ":const:`EPOLLIN`" -#: ../../library/select.rst:285 +#: ../../library/select.rst:286 msgid "Available for read" msgstr "" -#: ../../library/select.rst:287 +#: ../../library/select.rst:288 msgid ":const:`EPOLLOUT`" msgstr ":const:`EPOLLOUT`" -#: ../../library/select.rst:287 +#: ../../library/select.rst:288 msgid "Available for write" msgstr "" -#: ../../library/select.rst:289 +#: ../../library/select.rst:290 msgid ":const:`EPOLLPRI`" msgstr ":const:`EPOLLPRI`" -#: ../../library/select.rst:289 +#: ../../library/select.rst:290 msgid "Urgent data for read" msgstr "" -#: ../../library/select.rst:291 +#: ../../library/select.rst:292 msgid ":const:`EPOLLERR`" msgstr ":const:`EPOLLERR`" -#: ../../library/select.rst:291 +#: ../../library/select.rst:292 msgid "Error condition happened on the assoc. fd" msgstr "" -#: ../../library/select.rst:293 +#: ../../library/select.rst:294 msgid ":const:`EPOLLHUP`" msgstr ":const:`EPOLLHUP`" -#: ../../library/select.rst:293 +#: ../../library/select.rst:294 msgid "Hang up happened on the assoc. fd" msgstr "" -#: ../../library/select.rst:295 +#: ../../library/select.rst:296 msgid ":const:`EPOLLET`" msgstr ":const:`EPOLLET`" -#: ../../library/select.rst:295 +#: ../../library/select.rst:296 msgid "Set Edge Trigger behavior, the default is Level Trigger behavior" msgstr "" -#: ../../library/select.rst:298 +#: ../../library/select.rst:299 msgid ":const:`EPOLLONESHOT`" msgstr ":const:`EPOLLONESHOT`" -#: ../../library/select.rst:298 +#: ../../library/select.rst:299 msgid "" "Set one-shot behavior. After one event is pulled out, the fd is internally " "disabled" msgstr "" -#: ../../library/select.rst:301 +#: ../../library/select.rst:302 msgid ":const:`EPOLLEXCLUSIVE`" msgstr ":const:`EPOLLEXCLUSIVE`" -#: ../../library/select.rst:301 +#: ../../library/select.rst:302 msgid "" "Wake only one epoll object when the associated fd has an event. The default " "(if this flag is not set) is to wake all epoll objects polling on a fd." msgstr "" -#: ../../library/select.rst:306 +#: ../../library/select.rst:307 msgid ":const:`EPOLLRDHUP`" msgstr ":const:`EPOLLRDHUP`" -#: ../../library/select.rst:306 +#: ../../library/select.rst:307 msgid "" "Stream socket peer closed connection or shut down writing half of connection." msgstr "" -#: ../../library/select.rst:309 +#: ../../library/select.rst:310 msgid ":const:`EPOLLRDNORM`" msgstr ":const:`EPOLLRDNORM`" -#: ../../library/select.rst:309 +#: ../../library/select.rst:310 msgid "Equivalent to :const:`EPOLLIN`" msgstr "等價於 :const:`EPOLLIN`" -#: ../../library/select.rst:311 +#: ../../library/select.rst:312 msgid ":const:`EPOLLRDBAND`" msgstr ":const:`EPOLLRDBAND`" -#: ../../library/select.rst:311 +#: ../../library/select.rst:312 msgid "Priority data band can be read." msgstr "" -#: ../../library/select.rst:313 +#: ../../library/select.rst:314 msgid ":const:`EPOLLWRNORM`" msgstr ":const:`EPOLLWRNORM`" -#: ../../library/select.rst:313 +#: ../../library/select.rst:314 msgid "Equivalent to :const:`EPOLLOUT`" msgstr "等價於 :const:`EPOLLOUT`" -#: ../../library/select.rst:315 +#: ../../library/select.rst:316 msgid ":const:`EPOLLWRBAND`" msgstr ":const:`EPOLLWRBAND`" -#: ../../library/select.rst:315 +#: ../../library/select.rst:316 msgid "Priority data may be written." msgstr "" -#: ../../library/select.rst:317 +#: ../../library/select.rst:318 msgid ":const:`EPOLLMSG`" msgstr ":const:`EPOLLMSG`" -#: ../../library/select.rst:317 +#: ../../library/select.rst:318 msgid "Ignored." msgstr "" -#: ../../library/select.rst:320 +#: ../../library/select.rst:321 msgid "" ":const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5 " "or later." msgstr "" -#: ../../library/select.rst:326 +#: ../../library/select.rst:327 msgid "Close the control file descriptor of the epoll object." msgstr "" -#: ../../library/select.rst:331 +#: ../../library/select.rst:332 msgid "``True`` if the epoll object is closed." msgstr "" -#: ../../library/select.rst:336 ../../library/select.rst:478 +#: ../../library/select.rst:337 ../../library/select.rst:479 msgid "Return the file descriptor number of the control fd." msgstr "" -#: ../../library/select.rst:341 +#: ../../library/select.rst:342 msgid "Create an epoll object from a given file descriptor." msgstr "" -#: ../../library/select.rst:346 +#: ../../library/select.rst:347 msgid "Register a fd descriptor with the epoll object." msgstr "" -#: ../../library/select.rst:351 +#: ../../library/select.rst:352 msgid "Modify a registered file descriptor." msgstr "" -#: ../../library/select.rst:356 +#: ../../library/select.rst:357 msgid "Remove a registered file descriptor from the epoll object." msgstr "" -#: ../../library/select.rst:358 +#: ../../library/select.rst:359 msgid "The method no longer ignores the :data:`~errno.EBADF` error." msgstr "" -#: ../../library/select.rst:364 +#: ../../library/select.rst:365 msgid "Wait for events. timeout in seconds (float)" msgstr "" -#: ../../library/select.rst:376 +#: ../../library/select.rst:377 msgid "Polling Objects" msgstr "" -#: ../../library/select.rst:378 +#: ../../library/select.rst:379 msgid "" "The :c:func:`poll` system call, supported on most Unix systems, provides " "better scalability for network servers that service many, many clients at " @@ -514,7 +525,7 @@ msgid "" "descriptors)." msgstr "" -#: ../../library/select.rst:395 +#: ../../library/select.rst:396 msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " "check for, and can be a combination of the constants :const:`POLLIN`, :const:" @@ -522,70 +533,70 @@ msgid "" "specified, the default value used will check for all 3 types of events." msgstr "" -#: ../../library/select.rst:403 +#: ../../library/select.rst:404 msgid ":const:`POLLIN`" msgstr ":const:`POLLIN`" -#: ../../library/select.rst:403 +#: ../../library/select.rst:404 msgid "There is data to read" msgstr "" -#: ../../library/select.rst:405 +#: ../../library/select.rst:406 msgid ":const:`POLLPRI`" msgstr ":const:`POLLPRI`" -#: ../../library/select.rst:405 +#: ../../library/select.rst:406 msgid "There is urgent data to read" msgstr "" -#: ../../library/select.rst:407 +#: ../../library/select.rst:408 msgid ":const:`POLLOUT`" msgstr ":const:`POLLOUT`" -#: ../../library/select.rst:407 +#: ../../library/select.rst:408 msgid "Ready for output: writing will not block" msgstr "" -#: ../../library/select.rst:409 +#: ../../library/select.rst:410 msgid ":const:`POLLERR`" msgstr ":const:`POLLERR`" -#: ../../library/select.rst:409 +#: ../../library/select.rst:410 msgid "Error condition of some sort" msgstr "" -#: ../../library/select.rst:411 +#: ../../library/select.rst:412 msgid ":const:`POLLHUP`" msgstr ":const:`POLLHUP`" -#: ../../library/select.rst:411 +#: ../../library/select.rst:412 msgid "Hung up" msgstr "" -#: ../../library/select.rst:413 +#: ../../library/select.rst:414 msgid ":const:`POLLRDHUP`" msgstr ":const:`POLLRDHUP`" -#: ../../library/select.rst:413 +#: ../../library/select.rst:414 msgid "" "Stream socket peer closed connection, or shut down writing half of connection" msgstr "" -#: ../../library/select.rst:416 +#: ../../library/select.rst:417 msgid ":const:`POLLNVAL`" msgstr ":const:`POLLNVAL`" -#: ../../library/select.rst:416 +#: ../../library/select.rst:417 msgid "Invalid request: descriptor not open" msgstr "" -#: ../../library/select.rst:419 +#: ../../library/select.rst:420 msgid "" "Registering a file descriptor that's already registered is not an error, and " "has the same effect as registering the descriptor exactly once." msgstr "" -#: ../../library/select.rst:425 +#: ../../library/select.rst:426 msgid "" "Modifies an already registered fd. This has the same effect as " "``register(fd, eventmask)``. Attempting to modify a file descriptor that " @@ -593,13 +604,13 @@ msgid "" "`ENOENT` to be raised." msgstr "" -#: ../../library/select.rst:437 +#: ../../library/select.rst:438 msgid "" "Attempting to remove a file descriptor that was never registered causes a :" "exc:`KeyError` exception to be raised." msgstr "" -#: ../../library/select.rst:443 +#: ../../library/select.rst:444 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " @@ -613,49 +624,49 @@ msgid "" "`None`, the call will block until there is an event for this poll object." msgstr "" -#: ../../library/select.rst:464 +#: ../../library/select.rst:465 msgid "Kqueue Objects" msgstr "" -#: ../../library/select.rst:468 +#: ../../library/select.rst:469 msgid "Close the control file descriptor of the kqueue object." msgstr "" -#: ../../library/select.rst:473 +#: ../../library/select.rst:474 msgid "``True`` if the kqueue object is closed." msgstr "" -#: ../../library/select.rst:483 +#: ../../library/select.rst:484 msgid "Create a kqueue object from a given file descriptor." msgstr "" -#: ../../library/select.rst:488 +#: ../../library/select.rst:489 msgid "Low level interface to kevent" msgstr "" -#: ../../library/select.rst:490 +#: ../../library/select.rst:491 msgid "changelist must be an iterable of kevent objects or ``None``" msgstr "" -#: ../../library/select.rst:491 +#: ../../library/select.rst:492 msgid "max_events must be 0 or a positive integer" msgstr "" -#: ../../library/select.rst:492 +#: ../../library/select.rst:493 msgid "" "timeout in seconds (floats possible); the default is ``None``, to wait " "forever" msgstr "" -#: ../../library/select.rst:505 +#: ../../library/select.rst:506 msgid "Kevent Objects" msgstr "" -#: ../../library/select.rst:507 +#: ../../library/select.rst:508 msgid "https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" msgstr "https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" -#: ../../library/select.rst:511 +#: ../../library/select.rst:512 msgid "" "Value used to identify the event. The interpretation depends on the filter " "but it's usually the file descriptor. In the constructor ident can either be " @@ -663,328 +674,328 @@ msgid "" "the integer internally." msgstr "" -#: ../../library/select.rst:518 +#: ../../library/select.rst:519 msgid "Name of the kernel filter." msgstr "" -#: ../../library/select.rst:523 +#: ../../library/select.rst:524 msgid ":const:`KQ_FILTER_READ`" msgstr ":const:`KQ_FILTER_READ`" -#: ../../library/select.rst:523 +#: ../../library/select.rst:524 msgid "Takes a descriptor and returns whenever there is data available to read" msgstr "" -#: ../../library/select.rst:526 +#: ../../library/select.rst:527 msgid ":const:`KQ_FILTER_WRITE`" msgstr ":const:`KQ_FILTER_WRITE`" -#: ../../library/select.rst:526 +#: ../../library/select.rst:527 msgid "" "Takes a descriptor and returns whenever there is data available to write" msgstr "" -#: ../../library/select.rst:529 +#: ../../library/select.rst:530 msgid ":const:`KQ_FILTER_AIO`" msgstr ":const:`KQ_FILTER_AIO`" -#: ../../library/select.rst:529 +#: ../../library/select.rst:530 msgid "AIO requests" msgstr "" -#: ../../library/select.rst:531 +#: ../../library/select.rst:532 msgid ":const:`KQ_FILTER_VNODE`" msgstr ":const:`KQ_FILTER_VNODE`" -#: ../../library/select.rst:531 +#: ../../library/select.rst:532 msgid "" "Returns when one or more of the requested events watched in *fflag* occurs" msgstr "" -#: ../../library/select.rst:534 +#: ../../library/select.rst:535 msgid ":const:`KQ_FILTER_PROC`" msgstr ":const:`KQ_FILTER_PROC`" -#: ../../library/select.rst:534 +#: ../../library/select.rst:535 msgid "Watch for events on a process id" msgstr "" -#: ../../library/select.rst:536 +#: ../../library/select.rst:537 msgid ":const:`KQ_FILTER_NETDEV`" msgstr ":const:`KQ_FILTER_NETDEV`" -#: ../../library/select.rst:536 +#: ../../library/select.rst:537 msgid "Watch for events on a network device [not available on macOS]" msgstr "" -#: ../../library/select.rst:539 +#: ../../library/select.rst:540 msgid ":const:`KQ_FILTER_SIGNAL`" msgstr ":const:`KQ_FILTER_SIGNAL`" -#: ../../library/select.rst:539 +#: ../../library/select.rst:540 msgid "Returns whenever the watched signal is delivered to the process" msgstr "" -#: ../../library/select.rst:542 +#: ../../library/select.rst:543 msgid ":const:`KQ_FILTER_TIMER`" msgstr ":const:`KQ_FILTER_TIMER`" -#: ../../library/select.rst:542 +#: ../../library/select.rst:543 msgid "Establishes an arbitrary timer" msgstr "" -#: ../../library/select.rst:547 +#: ../../library/select.rst:548 msgid "Filter action." msgstr "" -#: ../../library/select.rst:552 +#: ../../library/select.rst:553 msgid ":const:`KQ_EV_ADD`" msgstr ":const:`KQ_EV_ADD`" -#: ../../library/select.rst:552 +#: ../../library/select.rst:553 msgid "Adds or modifies an event" msgstr "" -#: ../../library/select.rst:554 +#: ../../library/select.rst:555 msgid ":const:`KQ_EV_DELETE`" msgstr ":const:`KQ_EV_DELETE`" -#: ../../library/select.rst:554 +#: ../../library/select.rst:555 msgid "Removes an event from the queue" msgstr "" -#: ../../library/select.rst:556 +#: ../../library/select.rst:557 msgid ":const:`KQ_EV_ENABLE`" msgstr ":const:`KQ_EV_ENABLE`" -#: ../../library/select.rst:556 +#: ../../library/select.rst:557 msgid "Permitscontrol() to returns the event" msgstr "" -#: ../../library/select.rst:558 +#: ../../library/select.rst:559 msgid ":const:`KQ_EV_DISABLE`" msgstr ":const:`KQ_EV_DISABLE`" -#: ../../library/select.rst:558 +#: ../../library/select.rst:559 msgid "Disablesevent" msgstr "" -#: ../../library/select.rst:560 +#: ../../library/select.rst:561 msgid ":const:`KQ_EV_ONESHOT`" msgstr ":const:`KQ_EV_ONESHOT`" -#: ../../library/select.rst:560 +#: ../../library/select.rst:561 msgid "Removes event after first occurrence" msgstr "" -#: ../../library/select.rst:562 +#: ../../library/select.rst:563 msgid ":const:`KQ_EV_CLEAR`" msgstr ":const:`KQ_EV_CLEAR`" -#: ../../library/select.rst:562 +#: ../../library/select.rst:563 msgid "Reset the state after an event is retrieved" msgstr "" -#: ../../library/select.rst:564 +#: ../../library/select.rst:565 msgid ":const:`KQ_EV_SYSFLAGS`" msgstr ":const:`KQ_EV_SYSFLAGS`" -#: ../../library/select.rst:564 ../../library/select.rst:566 +#: ../../library/select.rst:565 ../../library/select.rst:567 msgid "internal event" msgstr "" -#: ../../library/select.rst:566 +#: ../../library/select.rst:567 msgid ":const:`KQ_EV_FLAG1`" msgstr ":const:`KQ_EV_FLAG1`" -#: ../../library/select.rst:568 +#: ../../library/select.rst:569 msgid ":const:`KQ_EV_EOF`" msgstr ":const:`KQ_EV_EOF`" -#: ../../library/select.rst:568 +#: ../../library/select.rst:569 msgid "Filter specific EOF condition" msgstr "" -#: ../../library/select.rst:570 +#: ../../library/select.rst:571 msgid ":const:`KQ_EV_ERROR`" msgstr ":const:`KQ_EV_ERROR`" -#: ../../library/select.rst:570 +#: ../../library/select.rst:571 msgid "See return values" msgstr "" -#: ../../library/select.rst:576 +#: ../../library/select.rst:577 msgid "Filter specific flags." msgstr "" -#: ../../library/select.rst:578 +#: ../../library/select.rst:579 msgid ":const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:" msgstr "" -#: ../../library/select.rst:583 +#: ../../library/select.rst:584 msgid ":const:`KQ_NOTE_LOWAT`" msgstr ":const:`KQ_NOTE_LOWAT`" -#: ../../library/select.rst:583 +#: ../../library/select.rst:584 msgid "low water mark of a socket buffer" msgstr "" -#: ../../library/select.rst:586 +#: ../../library/select.rst:587 msgid ":const:`KQ_FILTER_VNODE` filter flags:" msgstr "" -#: ../../library/select.rst:591 +#: ../../library/select.rst:592 msgid ":const:`KQ_NOTE_DELETE`" msgstr ":const:`KQ_NOTE_DELETE`" -#: ../../library/select.rst:591 +#: ../../library/select.rst:592 msgid "*unlink()* was called" msgstr "" -#: ../../library/select.rst:593 +#: ../../library/select.rst:594 msgid ":const:`KQ_NOTE_WRITE`" msgstr ":const:`KQ_NOTE_WRITE`" -#: ../../library/select.rst:593 +#: ../../library/select.rst:594 msgid "a write occurred" msgstr "" -#: ../../library/select.rst:595 +#: ../../library/select.rst:596 msgid ":const:`KQ_NOTE_EXTEND`" msgstr ":const:`KQ_NOTE_EXTEND`" -#: ../../library/select.rst:595 +#: ../../library/select.rst:596 msgid "the file was extended" msgstr "" -#: ../../library/select.rst:597 +#: ../../library/select.rst:598 msgid ":const:`KQ_NOTE_ATTRIB`" msgstr ":const:`KQ_NOTE_ATTRIB`" -#: ../../library/select.rst:597 +#: ../../library/select.rst:598 msgid "an attribute was changed" msgstr "" -#: ../../library/select.rst:599 +#: ../../library/select.rst:600 msgid ":const:`KQ_NOTE_LINK`" msgstr ":const:`KQ_NOTE_LINK`" -#: ../../library/select.rst:599 +#: ../../library/select.rst:600 msgid "the link count has changed" msgstr "" -#: ../../library/select.rst:601 +#: ../../library/select.rst:602 msgid ":const:`KQ_NOTE_RENAME`" msgstr ":const:`KQ_NOTE_RENAME`" -#: ../../library/select.rst:601 +#: ../../library/select.rst:602 msgid "the file was renamed" msgstr "" -#: ../../library/select.rst:603 +#: ../../library/select.rst:604 msgid ":const:`KQ_NOTE_REVOKE`" msgstr ":const:`KQ_NOTE_REVOKE`" -#: ../../library/select.rst:603 +#: ../../library/select.rst:604 msgid "access to the file was revoked" msgstr "" -#: ../../library/select.rst:606 +#: ../../library/select.rst:607 msgid ":const:`KQ_FILTER_PROC` filter flags:" msgstr "" -#: ../../library/select.rst:611 +#: ../../library/select.rst:612 msgid ":const:`KQ_NOTE_EXIT`" msgstr ":const:`KQ_NOTE_EXIT`" -#: ../../library/select.rst:611 +#: ../../library/select.rst:612 msgid "the process has exited" msgstr "" -#: ../../library/select.rst:613 +#: ../../library/select.rst:614 msgid ":const:`KQ_NOTE_FORK`" msgstr ":const:`KQ_NOTE_FORK`" -#: ../../library/select.rst:613 +#: ../../library/select.rst:614 msgid "the process has called *fork()*" msgstr "" -#: ../../library/select.rst:615 +#: ../../library/select.rst:616 msgid ":const:`KQ_NOTE_EXEC`" msgstr ":const:`KQ_NOTE_EXEC`" -#: ../../library/select.rst:615 +#: ../../library/select.rst:616 msgid "the process has executed a new process" msgstr "" -#: ../../library/select.rst:617 +#: ../../library/select.rst:618 msgid ":const:`KQ_NOTE_PCTRLMASK`" msgstr ":const:`KQ_NOTE_PCTRLMASK`" -#: ../../library/select.rst:617 ../../library/select.rst:619 +#: ../../library/select.rst:618 ../../library/select.rst:620 msgid "internal filter flag" msgstr "" -#: ../../library/select.rst:619 +#: ../../library/select.rst:620 msgid ":const:`KQ_NOTE_PDATAMASK`" msgstr ":const:`KQ_NOTE_PDATAMASK`" -#: ../../library/select.rst:621 +#: ../../library/select.rst:622 msgid ":const:`KQ_NOTE_TRACK`" msgstr ":const:`KQ_NOTE_TRACK`" -#: ../../library/select.rst:621 +#: ../../library/select.rst:622 msgid "follow a process across *fork()*" msgstr "" -#: ../../library/select.rst:623 +#: ../../library/select.rst:624 msgid ":const:`KQ_NOTE_CHILD`" msgstr ":const:`KQ_NOTE_CHILD`" -#: ../../library/select.rst:623 +#: ../../library/select.rst:624 msgid "returned on the child process for *NOTE_TRACK*" msgstr "" -#: ../../library/select.rst:626 +#: ../../library/select.rst:627 msgid ":const:`KQ_NOTE_TRACKERR`" msgstr ":const:`KQ_NOTE_TRACKERR`" -#: ../../library/select.rst:626 +#: ../../library/select.rst:627 msgid "unable to attach to a child" msgstr "" -#: ../../library/select.rst:629 +#: ../../library/select.rst:630 msgid ":const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):" msgstr "" -#: ../../library/select.rst:634 +#: ../../library/select.rst:635 msgid ":const:`KQ_NOTE_LINKUP`" msgstr ":const:`KQ_NOTE_LINKUP`" -#: ../../library/select.rst:634 +#: ../../library/select.rst:635 msgid "link is up" msgstr "" -#: ../../library/select.rst:636 +#: ../../library/select.rst:637 msgid ":const:`KQ_NOTE_LINKDOWN`" msgstr ":const:`KQ_NOTE_LINKDOWN`" -#: ../../library/select.rst:636 +#: ../../library/select.rst:637 msgid "link is down" msgstr "" -#: ../../library/select.rst:638 +#: ../../library/select.rst:639 msgid ":const:`KQ_NOTE_LINKINV`" msgstr ":const:`KQ_NOTE_LINKINV`" -#: ../../library/select.rst:638 +#: ../../library/select.rst:639 msgid "link state is invalid" msgstr "" -#: ../../library/select.rst:644 +#: ../../library/select.rst:645 msgid "Filter specific data." msgstr "" -#: ../../library/select.rst:649 +#: ../../library/select.rst:650 msgid "User defined value." msgstr "" diff --git a/library/selectors.po b/library/selectors.po index a71c5256f9..14c6cdaf7f 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,46 +70,57 @@ msgstr ":mod:`select`" msgid "Low-level I/O multiplexing module." msgstr "" -#: ../../library/selectors.rst:43 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/selectors.rst:44 msgid "Classes" msgstr "" -#: ../../library/selectors.rst:45 +#: ../../library/selectors.rst:46 msgid "Classes hierarchy::" msgstr "" -#: ../../library/selectors.rst:55 +#: ../../library/selectors.rst:56 msgid "" "In the following, *events* is a bitwise mask indicating which I/O events " "should be waited for on a given file object. It can be a combination of the " "modules constants below:" msgstr "" -#: ../../library/selectors.rst:60 +#: ../../library/selectors.rst:61 msgid "Constant" msgstr "" -#: ../../library/selectors.rst:60 +#: ../../library/selectors.rst:61 msgid "Meaning" msgstr "" -#: ../../library/selectors.rst:62 +#: ../../library/selectors.rst:63 msgid ":const:`EVENT_READ`" msgstr ":const:`EVENT_READ`" -#: ../../library/selectors.rst:62 +#: ../../library/selectors.rst:63 msgid "Available for read" msgstr "" -#: ../../library/selectors.rst:64 +#: ../../library/selectors.rst:65 msgid ":const:`EVENT_WRITE`" msgstr ":const:`EVENT_WRITE`" -#: ../../library/selectors.rst:64 +#: ../../library/selectors.rst:65 msgid "Available for write" msgstr "" -#: ../../library/selectors.rst:70 +#: ../../library/selectors.rst:71 msgid "" "A :class:`SelectorKey` is a :class:`~collections.namedtuple` used to " "associate a file object to its underlying file descriptor, selected event " @@ -117,25 +128,25 @@ msgid "" "methods." msgstr "" -#: ../../library/selectors.rst:77 +#: ../../library/selectors.rst:78 msgid "File object registered." msgstr "" -#: ../../library/selectors.rst:81 +#: ../../library/selectors.rst:82 msgid "Underlying file descriptor." msgstr "" -#: ../../library/selectors.rst:85 +#: ../../library/selectors.rst:86 msgid "Events that must be waited for on this file object." msgstr "" -#: ../../library/selectors.rst:89 +#: ../../library/selectors.rst:90 msgid "" "Optional opaque data associated to this file object: for example, this could " "be used to store a per-client session ID." msgstr "" -#: ../../library/selectors.rst:95 +#: ../../library/selectors.rst:96 msgid "" "A :class:`BaseSelector` is used to wait for I/O event readiness on multiple " "file objects. It supports file stream registration, unregistration, and a " @@ -147,35 +158,35 @@ msgid "" "implementations support the :term:`context manager` protocol." msgstr "" -#: ../../library/selectors.rst:107 +#: ../../library/selectors.rst:108 msgid "Register a file object for selection, monitoring it for I/O events." msgstr "" -#: ../../library/selectors.rst:109 +#: ../../library/selectors.rst:110 msgid "" "*fileobj* is the file object to monitor. It may either be an integer file " "descriptor or an object with a ``fileno()`` method. *events* is a bitwise " "mask of events to monitor. *data* is an opaque object." msgstr "" -#: ../../library/selectors.rst:114 +#: ../../library/selectors.rst:115 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is already registered." msgstr "" -#: ../../library/selectors.rst:120 +#: ../../library/selectors.rst:121 msgid "" "Unregister a file object from selection, removing it from monitoring. A file " "object shall be unregistered prior to being closed." msgstr "" -#: ../../library/selectors.rst:123 +#: ../../library/selectors.rst:124 msgid "*fileobj* must be a file object previously registered." msgstr "" -#: ../../library/selectors.rst:125 +#: ../../library/selectors.rst:126 msgid "" "This returns the associated :class:`SelectorKey` instance, or raises a :exc:" "`KeyError` if *fileobj* is not registered. It will raise :exc:`ValueError` " @@ -183,30 +194,30 @@ msgid "" "``fileno()`` method has an invalid return value)." msgstr "" -#: ../../library/selectors.rst:132 +#: ../../library/selectors.rst:133 msgid "Change a registered file object's monitored events or attached data." msgstr "" -#: ../../library/selectors.rst:134 +#: ../../library/selectors.rst:135 msgid "" "This is equivalent to :meth:`BaseSelector.unregister(fileobj)` followed by :" "meth:`BaseSelector.register(fileobj, events, data)`, except that it can be " "implemented more efficiently." msgstr "" -#: ../../library/selectors.rst:138 +#: ../../library/selectors.rst:139 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:144 +#: ../../library/selectors.rst:145 msgid "" "Wait until some registered file objects become ready, or the timeout expires." msgstr "" -#: ../../library/selectors.rst:147 +#: ../../library/selectors.rst:148 msgid "" "If ``timeout > 0``, this specifies the maximum wait time, in seconds. If " "``timeout <= 0``, the call won't block, and will report the currently ready " @@ -214,26 +225,26 @@ msgid "" "monitored file object becomes ready." msgstr "" -#: ../../library/selectors.rst:153 +#: ../../library/selectors.rst:154 msgid "" "This returns a list of ``(key, events)`` tuples, one for each ready file " "object." msgstr "" -#: ../../library/selectors.rst:156 +#: ../../library/selectors.rst:157 msgid "" "*key* is the :class:`SelectorKey` instance corresponding to a ready file " "object. *events* is a bitmask of events ready on this file object." msgstr "" -#: ../../library/selectors.rst:161 +#: ../../library/selectors.rst:162 msgid "" "This method can return before any file object becomes ready or the timeout " "has elapsed if the current process receives a signal: in this case, an empty " "list will be returned." msgstr "" -#: ../../library/selectors.rst:165 +#: ../../library/selectors.rst:166 msgid "" "The selector is now retried with a recomputed timeout when interrupted by a " "signal if the signal handler did not raise an exception (see :pep:`475` for " @@ -241,85 +252,85 @@ msgid "" "timeout." msgstr "" -#: ../../library/selectors.rst:173 +#: ../../library/selectors.rst:174 msgid "Close the selector." msgstr "" -#: ../../library/selectors.rst:175 +#: ../../library/selectors.rst:176 msgid "" "This must be called to make sure that any underlying resource is freed. The " "selector shall not be used once it has been closed." msgstr "" -#: ../../library/selectors.rst:180 +#: ../../library/selectors.rst:181 msgid "Return the key associated with a registered file object." msgstr "" -#: ../../library/selectors.rst:182 +#: ../../library/selectors.rst:183 msgid "" "This returns the :class:`SelectorKey` instance associated to this file " "object, or raises :exc:`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:187 +#: ../../library/selectors.rst:188 msgid "Return a mapping of file objects to selector keys." msgstr "" -#: ../../library/selectors.rst:189 +#: ../../library/selectors.rst:190 msgid "" "This returns a :class:`~collections.abc.Mapping` instance mapping registered " "file objects to their associated :class:`SelectorKey` instance." msgstr "" -#: ../../library/selectors.rst:196 +#: ../../library/selectors.rst:197 msgid "" "The default selector class, using the most efficient implementation " "available on the current platform. This should be the default choice for " "most users." msgstr "" -#: ../../library/selectors.rst:203 +#: ../../library/selectors.rst:204 msgid ":func:`select.select`-based selector." msgstr "" -#: ../../library/selectors.rst:208 +#: ../../library/selectors.rst:209 msgid ":func:`select.poll`-based selector." msgstr "" -#: ../../library/selectors.rst:213 +#: ../../library/selectors.rst:214 msgid ":func:`select.epoll`-based selector." msgstr "" -#: ../../library/selectors.rst:217 +#: ../../library/selectors.rst:218 msgid "" "This returns the file descriptor used by the underlying :func:`select.epoll` " "object." msgstr "" -#: ../../library/selectors.rst:222 +#: ../../library/selectors.rst:223 msgid ":func:`select.devpoll`-based selector." msgstr "" -#: ../../library/selectors.rst:226 +#: ../../library/selectors.rst:227 msgid "" "This returns the file descriptor used by the underlying :func:`select." "devpoll` object." msgstr "" -#: ../../library/selectors.rst:233 +#: ../../library/selectors.rst:234 msgid ":func:`select.kqueue`-based selector." msgstr "" -#: ../../library/selectors.rst:237 +#: ../../library/selectors.rst:238 msgid "" "This returns the file descriptor used by the underlying :func:`select." "kqueue` object." msgstr "" -#: ../../library/selectors.rst:242 +#: ../../library/selectors.rst:243 msgid "Examples" msgstr "範例" -#: ../../library/selectors.rst:244 +#: ../../library/selectors.rst:245 msgid "Here is a simple echo server implementation::" msgstr "" diff --git a/library/shelve.po b/library/shelve.po index f514e2af4b..e4f13be88e 100644 --- a/library/shelve.po +++ b/library/shelve.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,26 +68,30 @@ msgid "" "mutated)." msgstr "" -#: ../../library/shelve.rst:44 ../../library/shelve.rst:142 +#: ../../library/shelve.rst:44 ../../library/shelve.rst:145 msgid "" ":data:`pickle.DEFAULT_PROTOCOL` is now used as the default pickle protocol." msgstr "" -#: ../../library/shelve.rst:50 +#: ../../library/shelve.rst:48 +msgid "Accepts :term:`path-like object` for filename." +msgstr "" + +#: ../../library/shelve.rst:53 msgid "" "Do not rely on the shelf being closed automatically; always call :meth:" "`~Shelf.close` explicitly when you don't need it any more, or use :func:" "`shelve.open` as a context manager::" msgstr "" -#: ../../library/shelve.rst:61 +#: ../../library/shelve.rst:64 msgid "" "Because the :mod:`shelve` module is backed by :mod:`pickle`, it is insecure " "to load a shelf from an untrusted source. Like with pickle, loading a shelf " "can execute arbitrary code." msgstr "" -#: ../../library/shelve.rst:65 +#: ../../library/shelve.rst:68 msgid "" "Shelf objects support most of methods and operations supported by " "dictionaries (except copying, constructors and operators ``|`` and ``|=``). " @@ -95,11 +99,11 @@ msgid "" "persistent storage." msgstr "" -#: ../../library/shelve.rst:69 +#: ../../library/shelve.rst:72 msgid "Two additional methods are supported:" msgstr "" -#: ../../library/shelve.rst:73 +#: ../../library/shelve.rst:76 msgid "" "Write back all entries in the cache if the shelf was opened with *writeback* " "set to :const:`True`. Also empty the cache and synchronize the persistent " @@ -107,24 +111,24 @@ msgid "" "shelf is closed with :meth:`close`." msgstr "" -#: ../../library/shelve.rst:80 +#: ../../library/shelve.rst:83 msgid "" "Synchronize and close the persistent *dict* object. Operations on a closed " "shelf will fail with a :exc:`ValueError`." msgstr "" -#: ../../library/shelve.rst:86 +#: ../../library/shelve.rst:89 msgid "" "`Persistent dictionary recipe `_ with widely supported storage formats and having the speed of native " "dictionaries." msgstr "" -#: ../../library/shelve.rst:92 +#: ../../library/shelve.rst:95 msgid "Restrictions" msgstr "" -#: ../../library/shelve.rst:98 +#: ../../library/shelve.rst:101 msgid "" "The choice of which database package will be used (such as :mod:`dbm.ndbm` " "or :mod:`dbm.gnu`) depends on which interface is available. Therefore it is " @@ -135,7 +139,7 @@ msgid "" "cause the database to refuse updates." msgstr "" -#: ../../library/shelve.rst:106 +#: ../../library/shelve.rst:109 msgid "" "The :mod:`shelve` module does not support *concurrent* read/write access to " "shelved objects. (Multiple simultaneous read accesses are safe.) When a " @@ -145,13 +149,13 @@ msgid "" "implementation used." msgstr "" -#: ../../library/shelve.rst:116 +#: ../../library/shelve.rst:119 msgid "" "A subclass of :class:`collections.abc.MutableMapping` which stores pickled " "values in the *dict* object." msgstr "" -#: ../../library/shelve.rst:119 +#: ../../library/shelve.rst:122 msgid "" "By default, pickles created with :data:`pickle.DEFAULT_PROTOCOL` are used to " "serialize values. The version of the pickle protocol can be specified with " @@ -159,7 +163,7 @@ msgid "" "discussion of the pickle protocols." msgstr "" -#: ../../library/shelve.rst:124 +#: ../../library/shelve.rst:127 msgid "" "If the *writeback* parameter is ``True``, the object will hold a cache of " "all entries accessed and write them back to the *dict* at sync and close " @@ -167,29 +171,29 @@ msgid "" "much more memory and make sync and close take a long time." msgstr "" -#: ../../library/shelve.rst:129 +#: ../../library/shelve.rst:132 msgid "" "The *keyencoding* parameter is the encoding used to encode keys before they " "are used with the underlying dict." msgstr "" -#: ../../library/shelve.rst:132 +#: ../../library/shelve.rst:135 msgid "" "A :class:`Shelf` object can also be used as a context manager, in which case " "it will be automatically closed when the :keyword:`with` block ends." msgstr "" -#: ../../library/shelve.rst:135 +#: ../../library/shelve.rst:138 msgid "" "Added the *keyencoding* parameter; previously, keys were always encoded in " "UTF-8." msgstr "" -#: ../../library/shelve.rst:139 +#: ../../library/shelve.rst:142 msgid "Added context manager support." msgstr "" -#: ../../library/shelve.rst:149 +#: ../../library/shelve.rst:152 msgid "" "A subclass of :class:`Shelf` which exposes :meth:`first`, :meth:`!next`, :" "meth:`previous`, :meth:`last` and :meth:`set_location` which are available " @@ -202,7 +206,7 @@ msgid "" "for the :class:`Shelf` class." msgstr "" -#: ../../library/shelve.rst:162 +#: ../../library/shelve.rst:165 msgid "" "A subclass of :class:`Shelf` which accepts a *filename* instead of a dict-" "like object. The underlying file will be opened using :func:`dbm.open`. By " @@ -212,28 +216,28 @@ msgid "" "same interpretation as for the :class:`Shelf` class." msgstr "" -#: ../../library/shelve.rst:173 +#: ../../library/shelve.rst:176 msgid "Example" msgstr "範例" -#: ../../library/shelve.rst:175 +#: ../../library/shelve.rst:178 msgid "" "To summarize the interface (``key`` is a string, ``data`` is an arbitrary " "object)::" msgstr "" -#: ../../library/shelve.rst:212 +#: ../../library/shelve.rst:215 msgid "Module :mod:`dbm`" msgstr ":mod:`dbm` 模組" -#: ../../library/shelve.rst:212 +#: ../../library/shelve.rst:215 msgid "Generic interface to ``dbm``-style databases." msgstr "" -#: ../../library/shelve.rst:214 +#: ../../library/shelve.rst:217 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/shelve.rst:215 +#: ../../library/shelve.rst:218 msgid "Object serialization used by :mod:`shelve`." msgstr "" diff --git a/library/shutil.po b/library/shutil.po index 4922360708..f9d05f3d16 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -113,7 +113,7 @@ msgstr "" #: ../../library/shutil.rst:81 ../../library/shutil.rst:185 #: ../../library/shutil.rst:217 ../../library/shutil.rst:287 -#: ../../library/shutil.rst:375 +#: ../../library/shutil.rst:381 msgid "" "Platform-specific fast-copy syscalls may be used internally in order to copy " "the file more efficiently. See :ref:`shutil-platform-dependent-efficient-" @@ -374,7 +374,13 @@ msgid "" "they raise an exception." msgstr "" -#: ../../library/shutil.rst:307 +#: ../../library/shutil.rst:305 +msgid "" +"This function can support :ref:`paths relative to directory descriptors " +"`." +msgstr "" + +#: ../../library/shutil.rst:310 msgid "" "On platforms that support the necessary fd-based functions a symlink attack " "resistant version of :func:`rmtree` is used by default. On other platforms, " @@ -385,13 +391,13 @@ msgid "" "attribute to determine which case applies." msgstr "" -#: ../../library/shutil.rst:315 +#: ../../library/shutil.rst:318 msgid "" "If *onerror* is provided, it must be a callable that accepts three " "parameters: *function*, *path*, and *excinfo*." msgstr "" -#: ../../library/shutil.rst:318 +#: ../../library/shutil.rst:321 msgid "" "The first parameter, *function*, is the function which raised the exception; " "it depends on the platform and implementation. The second parameter, " @@ -400,45 +406,49 @@ msgid "" "exc_info`. Exceptions raised by *onerror* will not be caught." msgstr "" -#: ../../library/shutil.rst:324 +#: ../../library/shutil.rst:327 msgid "" -"Raises an :ref:`auditing event ` ``shutil.rmtree`` with argument " -"``path``." +"Raises an :ref:`auditing event ` ``shutil.rmtree`` with arguments " +"``path``, ``dir_fd``." msgstr "" -#: ../../library/shutil.rst:326 +#: ../../library/shutil.rst:329 msgid "" "Added a symlink attack resistant version that is used automatically if " "platform supports fd-based functions." msgstr "" -#: ../../library/shutil.rst:330 +#: ../../library/shutil.rst:333 msgid "" "On Windows, will no longer delete the contents of a directory junction " "before removing the junction." msgstr "" -#: ../../library/shutil.rst:336 +#: ../../library/shutil.rst:337 +msgid "The *dir_fd* parameter." +msgstr "*dir_fd* 參數。" + +#: ../../library/shutil.rst:342 msgid "" "Indicates whether the current platform and implementation provides a symlink " "attack resistant version of :func:`rmtree`. Currently this is only true for " "platforms supporting fd-based directory access functions." msgstr "" -#: ../../library/shutil.rst:345 +#: ../../library/shutil.rst:351 msgid "" "Recursively move a file or directory (*src*) to another location (*dst*) and " "return the destination." msgstr "" -#: ../../library/shutil.rst:348 +#: ../../library/shutil.rst:354 msgid "" "If the destination is an existing directory, then *src* is moved inside that " "directory. If the destination already exists but is not a directory, it may " "be overwritten depending on :func:`os.rename` semantics." msgstr "" -#: ../../library/shutil.rst:352 +#: ../../library/shutil.rst:358 msgid "" "If the destination is on the current filesystem, then :func:`os.rename` is " "used. Otherwise, *src* is copied to *dst* using *copy_function* and then " @@ -446,7 +456,7 @@ msgid "" "will be created in or as *dst* and *src* will be removed." msgstr "" -#: ../../library/shutil.rst:357 +#: ../../library/shutil.rst:363 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments " "*src* and *dst*, and will be used to copy *src* to *dst* if :func:`os." @@ -457,84 +467,84 @@ msgid "" "the expense of not copying any of the metadata." msgstr "" -#: ../../library/shutil.rst:365 +#: ../../library/shutil.rst:371 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" -#: ../../library/shutil.rst:367 +#: ../../library/shutil.rst:373 msgid "" "Added explicit symlink handling for foreign filesystems, thus adapting it to " "the behavior of GNU's :program:`mv`. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:372 +#: ../../library/shutil.rst:378 msgid "Added the *copy_function* keyword argument." msgstr "新增 *copy_function* 關鍵字引數。" -#: ../../library/shutil.rst:380 +#: ../../library/shutil.rst:386 msgid "Accepts a :term:`path-like object` for both *src* and *dst*." msgstr "" -#: ../../library/shutil.rst:385 +#: ../../library/shutil.rst:391 msgid "" "Return disk usage statistics about the given path as a :term:`named tuple` " "with the attributes *total*, *used* and *free*, which are the amount of " "total, used and free space, in bytes. *path* may be a file or a directory." msgstr "" -#: ../../library/shutil.rst:392 +#: ../../library/shutil.rst:398 msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: ../../library/shutil.rst:395 +#: ../../library/shutil.rst:401 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/shutil.rst:399 +#: ../../library/shutil.rst:405 msgid "Change owner *user* and/or *group* of the given *path*." msgstr "" -#: ../../library/shutil.rst:401 +#: ../../library/shutil.rst:407 msgid "" "*user* can be a system user name or a uid; the same applies to *group*. At " "least one argument is required." msgstr "" -#: ../../library/shutil.rst:404 +#: ../../library/shutil.rst:410 msgid "See also :func:`os.chown`, the underlying function." msgstr "" -#: ../../library/shutil.rst:406 +#: ../../library/shutil.rst:412 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." msgstr "" -#: ../../library/shutil.rst:409 +#: ../../library/shutil.rst:415 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/shutil.rst:415 +#: ../../library/shutil.rst:421 msgid "" "Return the path to an executable which would be run if the given *cmd* was " "called. If no *cmd* would be called, return ``None``." msgstr "" -#: ../../library/shutil.rst:418 +#: ../../library/shutil.rst:424 msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " "determining if the file exists and executable." msgstr "" -#: ../../library/shutil.rst:421 +#: ../../library/shutil.rst:427 msgid "" "When no *path* is specified, the results of :func:`os.environ` are used, " "returning either the \"PATH\" value or a fallback of :attr:`os.defpath`." msgstr "" -#: ../../library/shutil.rst:424 +#: ../../library/shutil.rst:430 msgid "" "On Windows, the current directory is always prepended to the *path* whether " "or not you use the default or provide your own, which is the behavior the " @@ -545,24 +555,24 @@ msgid "" "directories. For example, on Windows::" msgstr "" -#: ../../library/shutil.rst:437 +#: ../../library/shutil.rst:443 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:443 +#: ../../library/shutil.rst:449 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:450 +#: ../../library/shutil.rst:456 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:452 +#: ../../library/shutil.rst:458 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -572,51 +582,51 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:460 +#: ../../library/shutil.rst:466 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:462 +#: ../../library/shutil.rst:468 msgid "On Linux :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:464 +#: ../../library/shutil.rst:470 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:468 +#: ../../library/shutil.rst:474 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:477 +#: ../../library/shutil.rst:483 msgid "copytree example" msgstr "" -#: ../../library/shutil.rst:479 +#: ../../library/shutil.rst:485 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:485 +#: ../../library/shutil.rst:491 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:488 +#: ../../library/shutil.rst:494 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:503 +#: ../../library/shutil.rst:509 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:505 +#: ../../library/shutil.rst:511 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onerror callback to " @@ -624,25 +634,25 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:523 +#: ../../library/shutil.rst:529 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:527 +#: ../../library/shutil.rst:533 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:531 +#: ../../library/shutil.rst:537 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:536 +#: ../../library/shutil.rst:542 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:538 +#: ../../library/shutil.rst:544 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension. *format* is the archive format: one of \"zip" @@ -651,14 +661,14 @@ msgid "" "available), or \"xztar\" (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:544 +#: ../../library/shutil.rst:550 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:548 +#: ../../library/shutil.rst:554 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -666,99 +676,99 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:554 +#: ../../library/shutil.rst:560 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:556 +#: ../../library/shutil.rst:562 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:559 +#: ../../library/shutil.rst:565 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:562 +#: ../../library/shutil.rst:568 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:565 +#: ../../library/shutil.rst:571 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:567 +#: ../../library/shutil.rst:573 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." msgstr "" -#: ../../library/shutil.rst:571 +#: ../../library/shutil.rst:577 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` are used. In this case it temporarily changes the " "current working directory of the process to perform archiving." msgstr "" -#: ../../library/shutil.rst:576 +#: ../../library/shutil.rst:582 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:580 +#: ../../library/shutil.rst:586 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:586 +#: ../../library/shutil.rst:592 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:589 ../../library/shutil.rst:677 +#: ../../library/shutil.rst:595 ../../library/shutil.rst:683 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:591 +#: ../../library/shutil.rst:597 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:592 +#: ../../library/shutil.rst:598 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:593 ../../library/shutil.rst:682 +#: ../../library/shutil.rst:599 ../../library/shutil.rst:688 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:594 ../../library/shutil.rst:683 +#: ../../library/shutil.rst:600 ../../library/shutil.rst:689 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:595 ../../library/shutil.rst:684 +#: ../../library/shutil.rst:601 ../../library/shutil.rst:690 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:597 +#: ../../library/shutil.rst:603 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:603 +#: ../../library/shutil.rst:609 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:605 +#: ../../library/shutil.rst:611 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -767,33 +777,33 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:611 +#: ../../library/shutil.rst:617 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:614 +#: ../../library/shutil.rst:620 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:620 +#: ../../library/shutil.rst:626 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:625 +#: ../../library/shutil.rst:631 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:627 +#: ../../library/shutil.rst:633 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:630 +#: ../../library/shutil.rst:636 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", \"bztar" "\", or \"xztar\". Or any other format registered with :func:" @@ -802,13 +812,13 @@ msgid "" "that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:637 +#: ../../library/shutil.rst:643 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." msgstr "" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:647 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -816,120 +826,120 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:646 +#: ../../library/shutil.rst:652 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:651 +#: ../../library/shutil.rst:657 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:655 +#: ../../library/shutil.rst:661 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the path of the archive, followed by the directory the " "archive must be extracted to." msgstr "" -#: ../../library/shutil.rst:659 +#: ../../library/shutil.rst:665 msgid "" "When provided, *extra_args* is a sequence of ``(name, value)`` tuples that " "will be passed as keywords arguments to the callable." msgstr "" -#: ../../library/shutil.rst:662 +#: ../../library/shutil.rst:668 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:668 +#: ../../library/shutil.rst:674 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:673 +#: ../../library/shutil.rst:679 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:679 +#: ../../library/shutil.rst:685 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:681 +#: ../../library/shutil.rst:687 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:686 +#: ../../library/shutil.rst:692 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:693 +#: ../../library/shutil.rst:699 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:695 +#: ../../library/shutil.rst:701 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:705 +#: ../../library/shutil.rst:711 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:723 +#: ../../library/shutil.rst:729 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:725 +#: ../../library/shutil.rst:731 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:739 +#: ../../library/shutil.rst:745 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:753 +#: ../../library/shutil.rst:759 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:763 +#: ../../library/shutil.rst:769 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:767 +#: ../../library/shutil.rst:773 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:769 +#: ../../library/shutil.rst:775 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:773 +#: ../../library/shutil.rst:779 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:777 +#: ../../library/shutil.rst:783 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -938,12 +948,18 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:783 +#: ../../library/shutil.rst:789 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:785 +#: ../../library/shutil.rst:791 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" + +#: ../../library/shutil.rst:796 +msgid "" +"The ``fallback`` values are also used if :func:`os.get_terminal_size` " +"returns zeroes." +msgstr "" diff --git a/library/signal.po b/library/signal.po index a6be03a3da..8c3eb90062 100644 --- a/library/signal.po +++ b/library/signal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-21 00:16+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -48,11 +48,18 @@ msgid "" "`SIGCHLD`, which follows the underlying implementation." msgstr "" -#: ../../library/signal.rst:29 +#: ../../library/signal.rst:27 +msgid "" +"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, signals " +"are emulated and therefore behave differently. Several functions and signals " +"are not available on these platforms." +msgstr "" + +#: ../../library/signal.rst:32 msgid "Execution of Python signal handlers" msgstr "" -#: ../../library/signal.rst:31 +#: ../../library/signal.rst:34 msgid "" "A Python signal handler does not get executed inside the low-level (C) " "signal handler. Instead, the low-level signal handler sets a flag which " @@ -61,7 +68,7 @@ msgid "" "instruction). This has consequences:" msgstr "" -#: ../../library/signal.rst:37 +#: ../../library/signal.rst:40 msgid "" "It makes little sense to catch synchronous errors like :const:`SIGFPE` or :" "const:`SIGSEGV` that are caused by an invalid operation in C code. Python " @@ -71,7 +78,7 @@ msgid "" "errors." msgstr "" -#: ../../library/signal.rst:44 +#: ../../library/signal.rst:47 msgid "" "A long-running calculation implemented purely in C (such as regular " "expression matching on a large body of text) may run uninterrupted for an " @@ -79,18 +86,18 @@ msgid "" "signal handlers will be called when the calculation finishes." msgstr "" -#: ../../library/signal.rst:49 +#: ../../library/signal.rst:52 msgid "" "If the handler raises an exception, it will be raised \"out of thin air\" in " "the main thread. See the :ref:`note below ` for a " "discussion." msgstr "" -#: ../../library/signal.rst:57 +#: ../../library/signal.rst:60 msgid "Signals and threads" msgstr "" -#: ../../library/signal.rst:59 +#: ../../library/signal.rst:62 msgid "" "Python signal handlers are always executed in the main Python thread of the " "main interpreter, even if the signal was received in another thread. This " @@ -99,30 +106,69 @@ msgid "" "instead." msgstr "" -#: ../../library/signal.rst:64 +#: ../../library/signal.rst:67 msgid "" "Besides, only the main thread of the main interpreter is allowed to set a " "new signal handler." msgstr "" -#: ../../library/signal.rst:68 +#: ../../library/signal.rst:71 msgid "Module contents" msgstr "模組內容" -#: ../../library/signal.rst:70 +#: ../../library/signal.rst:73 msgid "" "signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" "const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " -"constants listed below were turned into :class:`enums `. :func:" -"`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:`sigwait` " -"functions return human-readable :class:`enums `." +"constants listed below were turned into :class:`enums ` (:" +"class:`Signals`, :class:`Handlers` and :class:`Sigmasks` respectively). :" +"func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:" +"`sigwait` functions return human-readable :class:`enums ` as :" +"class:`Signals` objects." msgstr "" -#: ../../library/signal.rst:80 +#: ../../library/signal.rst:83 +msgid "The signal module defines three enums:" +msgstr "" + +#: ../../library/signal.rst:87 +msgid "" +":class:`enum.IntEnum` collection of SIG* constants and the CTRL_* constants." +msgstr "" + +#: ../../library/signal.rst:93 +msgid "" +":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" +"`SIG_IGN`." +msgstr "" + +#: ../../library/signal.rst:99 +msgid "" +":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" +"`SIG_UNBLOCK` and :const:`SIG_SETMASK`." +msgstr "" + +#: ../../library/signal.rst:-1 ../../library/signal.rst:134 +#: ../../library/signal.rst:146 ../../library/signal.rst:152 +#: ../../library/signal.rst:162 ../../library/signal.rst:176 +#: ../../library/signal.rst:194 ../../library/signal.rst:202 +#: ../../library/signal.rst:228 ../../library/signal.rst:234 +#: ../../library/signal.rst:240 ../../library/signal.rst:497 +#: ../../library/signal.rst:504 +msgid ":ref:`Availability `: Unix." +msgstr ":ref:`適用 `:Unix。" + +#: ../../library/signal.rst:103 ../../library/signal.rst:469 +msgid "" +"See the man page :manpage:`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` " +"for further information." +msgstr "更多資訊請見 :manpage:`sigprocmask(2)` 與 :manpage:`pthread_sigmask(3)` 手冊頁。" + +#: ../../library/signal.rst:109 msgid "The variables defined in the :mod:`signal` module are:" msgstr "" -#: ../../library/signal.rst:85 +#: ../../library/signal.rst:114 msgid "" "This is one of two standard signal handling options; it will simply perform " "the default function for the signal. For example, on most systems the " @@ -130,118 +176,125 @@ msgid "" "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" -#: ../../library/signal.rst:93 +#: ../../library/signal.rst:122 msgid "" "This is another standard signal handler, which will simply ignore the given " "signal." msgstr "" -#: ../../library/signal.rst:99 +#: ../../library/signal.rst:128 msgid "Abort signal from :manpage:`abort(3)`." msgstr "" -#: ../../library/signal.rst:103 +#: ../../library/signal.rst:132 msgid "Timer signal from :manpage:`alarm(2)`." msgstr "" -#: ../../library/signal.rst:105 ../../library/signal.rst:117 -#: ../../library/signal.rst:123 ../../library/signal.rst:133 -#: ../../library/signal.rst:147 ../../library/signal.rst:165 -#: ../../library/signal.rst:173 ../../library/signal.rst:187 -#: ../../library/signal.rst:193 ../../library/signal.rst:199 -#: ../../library/signal.rst:450 ../../library/signal.rst:457 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - -#: ../../library/signal.rst:109 +#: ../../library/signal.rst:138 msgid "Interrupt from keyboard (CTRL + BREAK)." msgstr "" -#: ../../library/signal.rst:111 ../../library/signal.rst:218 -#: ../../library/signal.rst:228 +#: ../../library/signal.rst:140 ../../library/signal.rst:259 +#: ../../library/signal.rst:269 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/signal.rst:115 +#: ../../library/signal.rst:144 msgid "Bus error (bad memory access)." msgstr "" -#: ../../library/signal.rst:121 +#: ../../library/signal.rst:150 msgid "Child process stopped or terminated." msgstr "" -#: ../../library/signal.rst:127 +#: ../../library/signal.rst:156 msgid "Alias to :data:`SIGCHLD`." msgstr "" -#: ../../library/signal.rst:131 +#: ../../library/signal.rst:160 msgid "Continue the process if it is currently stopped" msgstr "" -#: ../../library/signal.rst:137 +#: ../../library/signal.rst:166 msgid "Floating-point exception. For example, division by zero." msgstr "" -#: ../../library/signal.rst:140 +#: ../../library/signal.rst:169 msgid "" ":exc:`ZeroDivisionError` is raised when the second argument of a division or " "modulo operation is zero." msgstr "" -#: ../../library/signal.rst:145 +#: ../../library/signal.rst:174 msgid "" "Hangup detected on controlling terminal or death of controlling process." msgstr "" -#: ../../library/signal.rst:151 +#: ../../library/signal.rst:180 msgid "Illegal instruction." msgstr "" -#: ../../library/signal.rst:155 +#: ../../library/signal.rst:184 msgid "Interrupt from keyboard (CTRL + C)." msgstr "" -#: ../../library/signal.rst:157 +#: ../../library/signal.rst:186 msgid "Default action is to raise :exc:`KeyboardInterrupt`." msgstr "" -#: ../../library/signal.rst:161 +#: ../../library/signal.rst:190 msgid "Kill signal." msgstr "" -#: ../../library/signal.rst:163 +#: ../../library/signal.rst:192 msgid "It cannot be caught, blocked, or ignored." msgstr "" -#: ../../library/signal.rst:169 +#: ../../library/signal.rst:198 msgid "Broken pipe: write to pipe with no readers." msgstr "" -#: ../../library/signal.rst:171 +#: ../../library/signal.rst:200 msgid "Default action is to ignore the signal." msgstr "" -#: ../../library/signal.rst:177 +#: ../../library/signal.rst:206 msgid "Segmentation fault: invalid memory reference." msgstr "" -#: ../../library/signal.rst:181 +#: ../../library/signal.rst:210 +msgid "" +"Stack fault on coprocessor. The Linux kernel does not raise this signal: it " +"can only be raised in user space." +msgstr "" + +#: ../../library/signal.rst:-1 +msgid ":ref:`Availability `: Linux." +msgstr ":ref:`適用 `:Linux。" + +#: ../../library/signal.rst:215 +msgid "" +"On architectures where the signal is available. See the man page :manpage:" +"`signal(7)` for further information." +msgstr "" + +#: ../../library/signal.rst:222 msgid "Termination signal." msgstr "" -#: ../../library/signal.rst:185 +#: ../../library/signal.rst:226 msgid "User-defined signal 1." msgstr "" -#: ../../library/signal.rst:191 +#: ../../library/signal.rst:232 msgid "User-defined signal 2." msgstr "" -#: ../../library/signal.rst:197 +#: ../../library/signal.rst:238 msgid "Window resize signal." msgstr "" -#: ../../library/signal.rst:203 +#: ../../library/signal.rst:244 msgid "" "All the signal numbers are defined symbolically. For example, the hangup " "signal is defined as :const:`signal.SIGHUP`; the variable names are " @@ -252,35 +305,37 @@ msgid "" "only those names defined by the system are defined by this module." msgstr "" -#: ../../library/signal.rst:214 +#: ../../library/signal.rst:255 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -#: ../../library/signal.rst:224 +#: ../../library/signal.rst:265 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." msgstr "" -#: ../../library/signal.rst:234 -msgid "One more than the number of the highest signal number." +#: ../../library/signal.rst:275 +msgid "" +"One more than the number of the highest signal number. Use :func:" +"`valid_signals` to get valid signal numbers." msgstr "" -#: ../../library/signal.rst:239 +#: ../../library/signal.rst:281 msgid "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." msgstr "" -#: ../../library/signal.rst:245 +#: ../../library/signal.rst:287 msgid "" "Decrements interval timer only when the process is executing, and delivers " "SIGVTALRM upon expiration." msgstr "" -#: ../../library/signal.rst:251 +#: ../../library/signal.rst:293 msgid "" "Decrements interval timer both when the process executes and when the system " "is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this " @@ -288,29 +343,29 @@ msgid "" "and kernel space. SIGPROF is delivered upon expiration." msgstr "" -#: ../../library/signal.rst:259 +#: ../../library/signal.rst:301 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be blocked." msgstr "" -#: ../../library/signal.rst:266 +#: ../../library/signal.rst:308 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be unblocked." msgstr "" -#: ../../library/signal.rst:273 +#: ../../library/signal.rst:315 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." msgstr "" -#: ../../library/signal.rst:279 +#: ../../library/signal.rst:321 msgid "The :mod:`signal` module defines one exception:" msgstr "" -#: ../../library/signal.rst:283 +#: ../../library/signal.rst:325 msgid "" "Raised to signal an error from the underlying :func:`setitimer` or :func:" "`getitimer` implementation. Expect this error if an invalid interval timer " @@ -318,17 +373,17 @@ msgid "" "of :exc:`OSError`." msgstr "" -#: ../../library/signal.rst:288 +#: ../../library/signal.rst:330 msgid "" "This error used to be a subtype of :exc:`IOError`, which is now an alias of :" "exc:`OSError`." msgstr "" -#: ../../library/signal.rst:293 +#: ../../library/signal.rst:335 msgid "The :mod:`signal` module defines the following functions:" msgstr "" -#: ../../library/signal.rst:298 +#: ../../library/signal.rst:340 msgid "" "If *time* is non-zero, this function requests that a :const:`SIGALRM` signal " "be sent to the process in *time* seconds. Any previously scheduled alarm is " @@ -339,13 +394,11 @@ msgid "" "scheduled." msgstr "" -#: ../../library/signal.rst:306 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`alarm(2)` for further information." -msgstr "" +#: ../../library/signal.rst:349 +msgid "See the man page :manpage:`alarm(2)` for further information." +msgstr "更多資訊請見 :manpage:`alarm(2)` 手冊頁。" -#: ../../library/signal.rst:311 +#: ../../library/signal.rst:354 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " "value may be a callable Python object, or one of the special values :const:" @@ -356,43 +409,41 @@ msgid "" "not installed from Python." msgstr "" -#: ../../library/signal.rst:322 +#: ../../library/signal.rst:365 msgid "" "Return the system description of the signal *signalnum*, such as \"Interrupt" "\", \"Segmentation fault\", etc. Returns :const:`None` if the signal is not " "recognized." msgstr "" -#: ../../library/signal.rst:331 +#: ../../library/signal.rst:374 msgid "" "Return the set of valid signal numbers on this platform. This can be less " "than ``range(1, NSIG)`` if some signals are reserved by the system for " "internal use." msgstr "" -#: ../../library/signal.rst:340 +#: ../../library/signal.rst:383 msgid "" "Cause the process to sleep until a signal is received; the appropriate " "handler will then be called. Returns nothing." msgstr "" -#: ../../library/signal.rst:345 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`signal(2)` for further information." -msgstr "" +#: ../../library/signal.rst:388 +msgid "See the man page :manpage:`signal(2)` for further information." +msgstr "更多資訊請見 :manpage:`signal(2)` 手冊頁。" -#: ../../library/signal.rst:346 +#: ../../library/signal.rst:390 msgid "" "See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" "func:`sigpending`." msgstr "" -#: ../../library/signal.rst:352 +#: ../../library/signal.rst:396 msgid "Sends a signal to the calling process. Returns nothing." msgstr "" -#: ../../library/signal.rst:359 +#: ../../library/signal.rst:403 msgid "" "Send signal *sig* to the process referred to by file descriptor *pidfd*. " "Python does not currently support the *siginfo* parameter; it must be " @@ -400,15 +451,15 @@ msgid "" "values are currently defined." msgstr "" -#: ../../library/signal.rst:364 +#: ../../library/signal.rst:408 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" -#: ../../library/signal.rst:366 -msgid ":ref:`Availability `: Linux 5.1+" -msgstr ":ref:`適用 `:Linux 5.1+" +#: ../../library/signal.rst:410 +msgid ":ref:`Availability `: Linux >= 5.1" +msgstr ":ref:`適用 `:Linux 5.1 以上" -#: ../../library/signal.rst:372 +#: ../../library/signal.rst:416 msgid "" "Send the signal *signalnum* to the thread *thread_id*, another thread in the " "same process as the caller. The target thread can be executing any code " @@ -419,94 +470,86 @@ msgid "" "running system call to fail with :exc:`InterruptedError`." msgstr "" -#: ../../library/signal.rst:380 +#: ../../library/signal.rst:424 msgid "" "Use :func:`threading.get_ident()` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -#: ../../library/signal.rst:384 +#: ../../library/signal.rst:428 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." msgstr "" -#: ../../library/signal.rst:387 +#: ../../library/signal.rst:431 msgid "" "Raises an :ref:`auditing event ` ``signal.pthread_kill`` with " "arguments ``thread_id``, ``signalnum``." msgstr "" -#: ../../library/signal.rst:391 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`pthread_kill(3)` for further information." -msgstr "" +#: ../../library/signal.rst:435 +msgid "See the man page :manpage:`pthread_kill(3)` for further information." +msgstr "更多資訊請見 :manpage:`pthread_kill(3)` 手冊頁。" -#: ../../library/signal.rst:392 +#: ../../library/signal.rst:437 msgid "See also :func:`os.kill`." msgstr "另請參閱 :func:`os.kill`\\ 。" -#: ../../library/signal.rst:399 +#: ../../library/signal.rst:444 msgid "" "Fetch and/or change the signal mask of the calling thread. The signal mask " "is the set of signals whose delivery is currently blocked for the caller. " "Return the old signal mask as a set of signals." msgstr "" -#: ../../library/signal.rst:403 +#: ../../library/signal.rst:448 msgid "" "The behavior of the call is dependent on the value of *how*, as follows." msgstr "" -#: ../../library/signal.rst:405 +#: ../../library/signal.rst:450 msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" -#: ../../library/signal.rst:407 +#: ../../library/signal.rst:452 msgid "" ":data:`SIG_UNBLOCK`: The signals in *mask* are removed from the current set " "of blocked signals. It is permissible to attempt to unblock a signal which " "is not blocked." msgstr "" -#: ../../library/signal.rst:410 +#: ../../library/signal.rst:455 msgid "" ":data:`SIG_SETMASK`: The set of blocked signals is set to the *mask* " "argument." msgstr "" -#: ../../library/signal.rst:413 +#: ../../library/signal.rst:458 msgid "" "*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" "`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " "including all signals." msgstr "" -#: ../../library/signal.rst:417 +#: ../../library/signal.rst:462 msgid "" "For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the " "signal mask of the calling thread." msgstr "" -#: ../../library/signal.rst:420 +#: ../../library/signal.rst:465 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." msgstr "" -#: ../../library/signal.rst:424 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` for further information." -msgstr "" - -#: ../../library/signal.rst:425 +#: ../../library/signal.rst:472 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`\\ 、\\ :func:`sigpending` 與 :func:`sigwait`。" -#: ../../library/signal.rst:432 +#: ../../library/signal.rst:479 msgid "" "Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" "`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " @@ -516,7 +559,7 @@ msgid "" "zero." msgstr "" -#: ../../library/signal.rst:439 +#: ../../library/signal.rst:486 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " @@ -524,21 +567,21 @@ msgid "" "`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" -#: ../../library/signal.rst:445 +#: ../../library/signal.rst:492 msgid "The old values are returned as a tuple: (delay, interval)." msgstr "" -#: ../../library/signal.rst:447 +#: ../../library/signal.rst:494 msgid "" "Attempting to pass an invalid interval timer will cause an :exc:" "`ItimerError`." msgstr "" -#: ../../library/signal.rst:455 +#: ../../library/signal.rst:502 msgid "Returns current value of a given interval timer specified by *which*." msgstr "" -#: ../../library/signal.rst:462 +#: ../../library/signal.rst:509 msgid "" "Set the wakeup file descriptor to *fd*. When a signal is received, the " "signal number is written as a single byte into the fd. This can be used by " @@ -546,7 +589,7 @@ msgid "" "processed." msgstr "" -#: ../../library/signal.rst:467 +#: ../../library/signal.rst:514 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " @@ -554,7 +597,7 @@ msgid "" "*fd* before calling poll or select again." msgstr "" -#: ../../library/signal.rst:472 ../../library/signal.rst:526 +#: ../../library/signal.rst:519 ../../library/signal.rst:574 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -562,14 +605,14 @@ msgid "" "raised." msgstr "" -#: ../../library/signal.rst:477 +#: ../../library/signal.rst:524 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " "determine *which* signal or signals have arrived." msgstr "" -#: ../../library/signal.rst:482 +#: ../../library/signal.rst:529 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -580,7 +623,7 @@ msgid "" "warning to be printed to stderr when signals are lost." msgstr "" -#: ../../library/signal.rst:491 +#: ../../library/signal.rst:538 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -590,35 +633,33 @@ msgid "" "spurious warning messages." msgstr "" -#: ../../library/signal.rst:498 +#: ../../library/signal.rst:545 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../library/signal.rst:501 +#: ../../library/signal.rst:548 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:506 +#: ../../library/signal.rst:553 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " "system calls will be interrupted. Returns nothing." msgstr "" -#: ../../library/signal.rst:512 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`siginterrupt(3)` for further information." -msgstr "" +#: ../../library/signal.rst:559 +msgid "See the man page :manpage:`siginterrupt(3)` for further information." +msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 手冊頁。" -#: ../../library/signal.rst:513 +#: ../../library/signal.rst:561 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:" "`siginterrupt` with a true *flag* value for the given signal." msgstr "" -#: ../../library/signal.rst:520 +#: ../../library/signal.rst:568 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " @@ -628,7 +669,7 @@ msgid "" "information.)" msgstr "" -#: ../../library/signal.rst:531 +#: ../../library/signal.rst:579 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " @@ -636,7 +677,7 @@ msgid "" "see the attribute descriptions in the :mod:`inspect` module)." msgstr "" -#: ../../library/signal.rst:536 +#: ../../library/signal.rst:584 msgid "" "On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" "`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" @@ -646,25 +687,23 @@ msgid "" "``SIG*`` module level constant." msgstr "" -#: ../../library/signal.rst:547 +#: ../../library/signal.rst:595 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " "set of the pending signals." msgstr "" -#: ../../library/signal.rst:553 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`sigpending(2)` for further information." -msgstr "" +#: ../../library/signal.rst:601 +msgid "See the man page :manpage:`sigpending(2)` for further information." +msgstr "更多資訊請見 :manpage:`sigpending(2)` 手冊頁。" -#: ../../library/signal.rst:554 +#: ../../library/signal.rst:603 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "" "另請參閱 :func:`pause`\\ 、\\ :func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:561 +#: ../../library/signal.rst:610 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -672,19 +711,17 @@ msgid "" "number." msgstr "" -#: ../../library/signal.rst:567 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`sigwait(3)` for further information." -msgstr "" +#: ../../library/signal.rst:616 +msgid "See the man page :manpage:`sigwait(3)` for further information." +msgstr "更多資訊請見 :manpage:`sigwait(3)` 手冊頁。" -#: ../../library/signal.rst:568 +#: ../../library/signal.rst:618 msgid "" "See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" "`sigwaitinfo` and :func:`sigtimedwait`." msgstr "" -#: ../../library/signal.rst:576 +#: ../../library/signal.rst:626 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -695,7 +732,7 @@ msgid "" "`InterruptedError` if it is interrupted by a signal that is not in *sigset*." msgstr "" -#: ../../library/signal.rst:585 +#: ../../library/signal.rst:635 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" @@ -703,53 +740,49 @@ msgid "" "`si_band`." msgstr "" -#: ../../library/signal.rst:592 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`sigwaitinfo(2)` for further information." -msgstr "" +#: ../../library/signal.rst:642 +msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." +msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 手冊頁。" -#: ../../library/signal.rst:593 +#: ../../library/signal.rst:644 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "" "另請參閱 :func:`pause`\\ 、\\ :func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:597 +#: ../../library/signal.rst:648 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " "rationale)." msgstr "" -#: ../../library/signal.rst:605 +#: ../../library/signal.rst:656 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as :const:`0`, a poll is " "performed. Returns :const:`None` if a timeout occurs." msgstr "" -#: ../../library/signal.rst:611 -msgid "" -":ref:`Availability `: Unix. See the man page :manpage:" -"`sigtimedwait(2)` for further information." -msgstr "" +#: ../../library/signal.rst:662 +msgid "See the man page :manpage:`sigtimedwait(2)` for further information." +msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 手冊頁。" -#: ../../library/signal.rst:612 +#: ../../library/signal.rst:664 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`\\ 、\\ :func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:616 +#: ../../library/signal.rst:668 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " "(see :pep:`475` for the rationale)." msgstr "" -#: ../../library/signal.rst:625 -msgid "Example" +#: ../../library/signal.rst:677 +msgid "Examples" msgstr "範例" -#: ../../library/signal.rst:627 +#: ../../library/signal.rst:679 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -759,11 +792,11 @@ msgid "" "signal will be sent, and the handler raises an exception. ::" msgstr "" -#: ../../library/signal.rst:650 +#: ../../library/signal.rst:703 msgid "Note on SIGPIPE" msgstr "" -#: ../../library/signal.rst:652 +#: ../../library/signal.rst:705 msgid "" "Piping output of your program to tools like :manpage:`head(1)` will cause a :" "const:`SIGPIPE` signal to be sent to your process when the receiver of its " @@ -772,7 +805,7 @@ msgid "" "entry point to catch this exception as follows::" msgstr "" -#: ../../library/signal.rst:679 +#: ../../library/signal.rst:732 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " @@ -780,11 +813,11 @@ msgid "" "program is still writing to it." msgstr "" -#: ../../library/signal.rst:688 +#: ../../library/signal.rst:741 msgid "Note on Signal Handlers and Exceptions" msgstr "" -#: ../../library/signal.rst:690 +#: ../../library/signal.rst:743 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -795,11 +828,11 @@ msgid "" "program in an unexpected state." msgstr "" -#: ../../library/signal.rst:697 +#: ../../library/signal.rst:750 msgid "To illustrate this issue, consider the following code::" msgstr "" -#: ../../library/signal.rst:714 +#: ../../library/signal.rst:767 msgid "" "For many programs, especially those that merely want to exit on :exc:" "`KeyboardInterrupt`, this is not a problem, but applications that are " diff --git a/library/site.po b/library/site.po index 0affbfb039..caf8069b6d 100644 --- a/library/site.po +++ b/library/site.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-24 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -299,3 +299,7 @@ msgstr "" #: ../../library/site.rst:279 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" + +#: ../../library/site.rst:280 +msgid ":ref:`sys-path-init` -- The initialization of :data:`sys.path`." +msgstr "" diff --git a/library/smtpd.po b/library/smtpd.po index b03102d6b1..d9b750f237 100644 --- a/library/smtpd.po +++ b/library/smtpd.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" -"PO-Revision-Date: 2022-05-22 02:12+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 06:26+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/smtpd.rst:2 msgid ":mod:`smtpd` --- SMTP Server" @@ -31,16 +31,16 @@ msgstr "**原始碼:**\\ :source:`Lib/smtpd.py`" msgid "This module offers several classes to implement SMTP (email) servers." msgstr "" -#: ../../library/smtpd.rst:17 +#: ../../library/smtpd.rst:23 msgid "" -":mod:`smtpd` will be removed in Python 3.12 (see :pep:`PEP 594 <594#smtpd>` " -"for details). The `aiosmtpd `_ package is " -"a recommended replacement for this module. It is based on :mod:`asyncio` " -"and provides a more straightforward API." +"The :mod:`smtpd` module is deprecated (see :pep:`PEP 594 <594#smtpd>` for " +"details). The `aiosmtpd `_ package is a " +"recommended replacement for this module. It is based on :mod:`asyncio` and " +"provides a more straightforward API." msgstr "" -":mod:`smtpd` 將於 Python 3.12 中移除(詳見 :pep:`PEP 594 <594#smtpd>`\\ )。" -"基於 :mod:`asyncio` 且提供了更簡單易用 API 的 `aiosmtpd `_ 套件是個推薦的替代模組 (module)。" +":mod:`smtpd` 已被棄用(詳見 :pep:`PEP 594 <594#smtpd>`\\ )。基於 :mod:" +"`asyncio` 且提供了更簡單易用 API 的 `aiosmtpd `_ 套件是個推薦的替代模組 (module)。" #: ../../library/smtpd.rst:24 msgid "" @@ -61,11 +61,22 @@ msgid "" "SMTPUTF8 extensions." msgstr "" -#: ../../library/smtpd.rst:36 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/smtpd.rst:37 msgid "SMTPServer Objects" msgstr "SMTPServer 物件" -#: ../../library/smtpd.rst:42 +#: ../../library/smtpd.rst:43 msgid "" "Create a new :class:`SMTPServer` object, which binds to local address " "*localaddr*. It will treat *remoteaddr* as an upstream SMTP relayer. Both " @@ -74,20 +85,20 @@ msgid "" "insert itself into :mod:`asyncore`'s event loop on instantiation." msgstr "" -#: ../../library/smtpd.rst:48 ../../library/smtpd.rst:176 +#: ../../library/smtpd.rst:49 ../../library/smtpd.rst:159 msgid "" "*data_size_limit* specifies the maximum number of bytes that will be " "accepted in a ``DATA`` command. A value of ``None`` or ``0`` means no limit." msgstr "" -#: ../../library/smtpd.rst:52 +#: ../../library/smtpd.rst:53 msgid "" "*map* is the socket map to use for connections (an initially empty " "dictionary is a suitable value). If not specified the :mod:`asyncore` " "global socket map is used." msgstr "" -#: ../../library/smtpd.rst:56 +#: ../../library/smtpd.rst:57 msgid "" "*enable_SMTPUTF8* determines whether the ``SMTPUTF8`` extension (as defined " "in :RFC:`6531`) should be enabled. The default is ``False``. When ``True``, " @@ -97,7 +108,7 @@ msgid "" "be set to ``True`` at the same time." msgstr "" -#: ../../library/smtpd.rst:63 +#: ../../library/smtpd.rst:64 msgid "" "*decode_data* specifies whether the data portion of the SMTP transaction " "should be decoded using UTF-8. When *decode_data* is ``False`` (the " @@ -108,7 +119,7 @@ msgid "" "be set to ``True`` at the same time." msgstr "" -#: ../../library/smtpd.rst:73 +#: ../../library/smtpd.rst:74 msgid "" "Raise a :exc:`NotImplementedError` exception. Override this in subclasses to " "do something useful with this message. Whatever was passed in the " @@ -119,228 +130,209 @@ msgid "" "format)." msgstr "" -#: ../../library/smtpd.rst:81 +#: ../../library/smtpd.rst:82 msgid "" "If the *decode_data* constructor keyword is set to ``True``, the *data* " "argument will be a unicode string. If it is set to ``False``, it will be a " "bytes object." msgstr "" -#: ../../library/smtpd.rst:85 +#: ../../library/smtpd.rst:86 msgid "" "*kwargs* is a dictionary containing additional information. It is empty if " "``decode_data=True`` was given as an init argument, otherwise it contains " "the following keys:" msgstr "" -#: ../../library/smtpd.rst:92 +#: ../../library/smtpd.rst:93 msgid "*mail_options*:" msgstr "" -#: ../../library/smtpd.rst:90 +#: ../../library/smtpd.rst:91 msgid "" "a list of all received parameters to the ``MAIL`` command (the elements are " "uppercase strings; example: ``['BODY=8BITMIME', 'SMTPUTF8']``)." msgstr "" -#: ../../library/smtpd.rst:97 +#: ../../library/smtpd.rst:98 msgid "*rcpt_options*:" msgstr "" -#: ../../library/smtpd.rst:95 +#: ../../library/smtpd.rst:96 msgid "" "same as *mail_options* but for the ``RCPT`` command. Currently no ``RCPT " "TO`` options are supported, so for now this will always be an empty list." msgstr "" -#: ../../library/smtpd.rst:99 +#: ../../library/smtpd.rst:100 msgid "" "Implementations of ``process_message`` should use the ``**kwargs`` signature " "to accept arbitrary keyword arguments, since future feature enhancements may " "add keys to the kwargs dictionary." msgstr "" -#: ../../library/smtpd.rst:103 +#: ../../library/smtpd.rst:104 msgid "" "Return ``None`` to request a normal ``250 Ok`` response; otherwise return " "the desired response string in :RFC:`5321` format." msgstr "" -#: ../../library/smtpd.rst:108 +#: ../../library/smtpd.rst:109 msgid "" "Override this in subclasses to use a custom :class:`SMTPChannel` for " "managing SMTP clients." msgstr "" -#: ../../library/smtpd.rst:111 +#: ../../library/smtpd.rst:112 msgid "The *map* constructor argument." msgstr "" -#: ../../library/smtpd.rst:114 +#: ../../library/smtpd.rst:115 msgid "*localaddr* and *remoteaddr* may now contain IPv6 addresses." msgstr "" -#: ../../library/smtpd.rst:117 +#: ../../library/smtpd.rst:118 msgid "" "The *decode_data* and *enable_SMTPUTF8* constructor parameters, and the " "*kwargs* parameter to :meth:`process_message` when *decode_data* is " "``False``." msgstr "" -#: ../../library/smtpd.rst:122 ../../library/smtpd.rst:198 +#: ../../library/smtpd.rst:123 ../../library/smtpd.rst:181 msgid "*decode_data* is now ``False`` by default." msgstr "" -#: ../../library/smtpd.rst:127 +#: ../../library/smtpd.rst:128 msgid "DebuggingServer Objects" msgstr "DebuggingServer 物件" -#: ../../library/smtpd.rst:132 +#: ../../library/smtpd.rst:133 msgid "" "Create a new debugging server. Arguments are as per :class:`SMTPServer`. " "Messages will be discarded, and printed on stdout." msgstr "" -#: ../../library/smtpd.rst:137 +#: ../../library/smtpd.rst:138 msgid "PureProxy Objects" msgstr "PureProxy 物件" -#: ../../library/smtpd.rst:142 +#: ../../library/smtpd.rst:143 msgid "" "Create a new pure proxy server. Arguments are as per :class:`SMTPServer`. " "Everything will be relayed to *remoteaddr*. Note that running this has a " "good chance to make you into an open relay, so please be careful." msgstr "" -#: ../../library/smtpd.rst:148 -msgid "MailmanProxy Objects" -msgstr "MailmanProxy 物件" - -#: ../../library/smtpd.rst:155 -msgid "" -":class:`MailmanProxy` is deprecated, it depends on a ``Mailman`` module " -"which no longer exists and therefore is already broken." -msgstr "" - -#: ../../library/smtpd.rst:159 -msgid "" -"Create a new pure proxy server. Arguments are as per :class:`SMTPServer`. " -"Everything will be relayed to *remoteaddr*, unless local mailman " -"configurations knows about an address, in which case it will be handled via " -"mailman. Note that running this has a good chance to make you into an open " -"relay, so please be careful." -msgstr "" - -#: ../../library/smtpd.rst:166 +#: ../../library/smtpd.rst:149 msgid "SMTPChannel Objects" msgstr "SMTPChannel 物件" -#: ../../library/smtpd.rst:171 +#: ../../library/smtpd.rst:154 msgid "" "Create a new :class:`SMTPChannel` object which manages the communication " "between the server and a single SMTP client." msgstr "" -#: ../../library/smtpd.rst:174 +#: ../../library/smtpd.rst:157 msgid "*conn* and *addr* are as per the instance variables described below." msgstr "" -#: ../../library/smtpd.rst:180 +#: ../../library/smtpd.rst:163 msgid "" "*enable_SMTPUTF8* determines whether the ``SMTPUTF8`` extension (as defined " "in :RFC:`6531`) should be enabled. The default is ``False``. *decode_data* " "and *enable_SMTPUTF8* cannot be set to ``True`` at the same time." msgstr "" -#: ../../library/smtpd.rst:185 +#: ../../library/smtpd.rst:168 msgid "" "A dictionary can be specified in *map* to avoid using a global socket map." msgstr "" -#: ../../library/smtpd.rst:187 +#: ../../library/smtpd.rst:170 msgid "" "*decode_data* specifies whether the data portion of the SMTP transaction " "should be decoded using UTF-8. The default is ``False``. *decode_data* and " "*enable_SMTPUTF8* cannot be set to ``True`` at the same time." msgstr "" -#: ../../library/smtpd.rst:192 +#: ../../library/smtpd.rst:175 msgid "" "To use a custom SMTPChannel implementation you need to override the :attr:" "`SMTPServer.channel_class` of your :class:`SMTPServer`." msgstr "" -#: ../../library/smtpd.rst:195 +#: ../../library/smtpd.rst:178 msgid "The *decode_data* and *enable_SMTPUTF8* parameters were added." msgstr "新增 *decode_data* 與 *enable_SMTPUTF8* 參數。" -#: ../../library/smtpd.rst:201 +#: ../../library/smtpd.rst:184 msgid "The :class:`SMTPChannel` has the following instance variables:" msgstr "" -#: ../../library/smtpd.rst:205 +#: ../../library/smtpd.rst:188 msgid "Holds the :class:`SMTPServer` that spawned this channel." msgstr "" -#: ../../library/smtpd.rst:209 +#: ../../library/smtpd.rst:192 msgid "Holds the socket object connecting to the client." msgstr "" -#: ../../library/smtpd.rst:213 +#: ../../library/smtpd.rst:196 msgid "" "Holds the address of the client, the second value returned by :func:`socket." "accept `" msgstr "" -#: ../../library/smtpd.rst:218 +#: ../../library/smtpd.rst:201 msgid "" "Holds a list of the line strings (decoded using UTF-8) received from the " "client. The lines have their ``\"\\r\\n\"`` line ending translated to ``\"\\n" "\"``." msgstr "" -#: ../../library/smtpd.rst:224 +#: ../../library/smtpd.rst:207 msgid "" "Holds the current state of the channel. This will be either :attr:`COMMAND` " "initially and then :attr:`DATA` after the client sends a \"DATA\" line." msgstr "" -#: ../../library/smtpd.rst:230 +#: ../../library/smtpd.rst:213 msgid "" "Holds a string containing the greeting sent by the client in its \"HELO\"." msgstr "" -#: ../../library/smtpd.rst:234 +#: ../../library/smtpd.rst:217 msgid "" "Holds a string containing the address identified in the \"MAIL FROM:\" line " "from the client." msgstr "" -#: ../../library/smtpd.rst:239 +#: ../../library/smtpd.rst:222 msgid "" "Holds a list of strings containing the addresses identified in the \"RCPT TO:" "\" lines from the client." msgstr "" -#: ../../library/smtpd.rst:244 +#: ../../library/smtpd.rst:227 msgid "" "Holds a string containing all of the data sent by the client during the DATA " "state, up to but not including the terminating ``\"\\r\\n.\\r\\n\"``." msgstr "" -#: ../../library/smtpd.rst:249 +#: ../../library/smtpd.rst:232 msgid "" "Holds the fully qualified domain name of the server as returned by :func:" "`socket.getfqdn`." msgstr "" -#: ../../library/smtpd.rst:254 +#: ../../library/smtpd.rst:237 msgid "" "Holds the name of the client peer as returned by ``conn.getpeername()`` " "where ``conn`` is :attr:`conn`." msgstr "" -#: ../../library/smtpd.rst:257 +#: ../../library/smtpd.rst:240 msgid "" "The :class:`SMTPChannel` operates by invoking methods named " "``smtp_`` upon reception of a command line from the client. Built " @@ -348,112 +340,115 @@ msgid "" "following commands (and responding to them appropriately):" msgstr "" -#: ../../library/smtpd.rst:263 +#: ../../library/smtpd.rst:246 msgid "Command" msgstr "指令" -#: ../../library/smtpd.rst:263 +#: ../../library/smtpd.rst:246 msgid "Action taken" msgstr "" -#: ../../library/smtpd.rst:265 +#: ../../library/smtpd.rst:248 msgid "HELO" msgstr "HELO" -#: ../../library/smtpd.rst:265 +#: ../../library/smtpd.rst:248 msgid "" "Accepts the greeting from the client and stores it in :attr:" "`seen_greeting`. Sets server to base command mode." msgstr "" -#: ../../library/smtpd.rst:267 +#: ../../library/smtpd.rst:250 msgid "EHLO" msgstr "EHLO" -#: ../../library/smtpd.rst:267 +#: ../../library/smtpd.rst:250 msgid "" "Accepts the greeting from the client and stores it in :attr:" "`seen_greeting`. Sets server to extended command mode." msgstr "" -#: ../../library/smtpd.rst:269 +#: ../../library/smtpd.rst:252 msgid "NOOP" msgstr "NOOP" -#: ../../library/smtpd.rst:269 +#: ../../library/smtpd.rst:252 msgid "Takes no action." msgstr "" -#: ../../library/smtpd.rst:270 +#: ../../library/smtpd.rst:253 msgid "QUIT" msgstr "QUIT" -#: ../../library/smtpd.rst:270 +#: ../../library/smtpd.rst:253 msgid "Closes the connection cleanly." msgstr "" -#: ../../library/smtpd.rst:271 +#: ../../library/smtpd.rst:254 msgid "MAIL" msgstr "MAIL" -#: ../../library/smtpd.rst:271 +#: ../../library/smtpd.rst:254 msgid "" "Accepts the \"MAIL FROM:\" syntax and stores the supplied address as :attr:" "`mailfrom`. In extended command mode, accepts the :rfc:`1870` SIZE " "attribute and responds appropriately based on the value of *data_size_limit*." msgstr "" -#: ../../library/smtpd.rst:275 +#: ../../library/smtpd.rst:258 msgid "RCPT" msgstr "RCPT" -#: ../../library/smtpd.rst:275 +#: ../../library/smtpd.rst:258 msgid "" "Accepts the \"RCPT TO:\" syntax and stores the supplied addresses in the :" "attr:`rcpttos` list." msgstr "" -#: ../../library/smtpd.rst:277 +#: ../../library/smtpd.rst:260 msgid "RSET" msgstr "RSET" -#: ../../library/smtpd.rst:277 +#: ../../library/smtpd.rst:260 msgid "" "Resets the :attr:`mailfrom`, :attr:`rcpttos`, and :attr:`received_data`, but " "not the greeting." msgstr "" -#: ../../library/smtpd.rst:279 +#: ../../library/smtpd.rst:262 msgid "DATA" msgstr "DATA" -#: ../../library/smtpd.rst:279 +#: ../../library/smtpd.rst:262 msgid "" "Sets the internal state to :attr:`DATA` and stores remaining lines from the " "client in :attr:`received_data` until the terminator ``\"\\r\\n.\\r\\n\"`` " "is received." msgstr "" -#: ../../library/smtpd.rst:282 +#: ../../library/smtpd.rst:265 msgid "HELP" msgstr "HELP" -#: ../../library/smtpd.rst:282 +#: ../../library/smtpd.rst:265 msgid "Returns minimal information on command syntax" msgstr "" -#: ../../library/smtpd.rst:283 +#: ../../library/smtpd.rst:266 msgid "VRFY" msgstr "VRFY" -#: ../../library/smtpd.rst:283 +#: ../../library/smtpd.rst:266 msgid "Returns code 252 (the server doesn't know if the address is valid)" msgstr "" -#: ../../library/smtpd.rst:284 +#: ../../library/smtpd.rst:267 msgid "EXPN" msgstr "EXPN" -#: ../../library/smtpd.rst:284 +#: ../../library/smtpd.rst:267 msgid "Reports that the command is not implemented." msgstr "" + +#~ msgid "MailmanProxy Objects" +#~ msgstr "MailmanProxy 物件" diff --git a/library/smtplib.po b/library/smtplib.po index 4a3af01be1..2e34dff3b1 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -34,7 +34,18 @@ msgid "" "Mail Transfer Protocol) and :rfc:`1869` (SMTP Service Extensions)." msgstr "" -#: ../../library/smtplib.rst:25 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/smtplib.rst:26 msgid "" "An :class:`SMTP` instance encapsulates an SMTP connection. It has methods " "that support a full repertoire of SMTP and ESMTP operations. If the optional " @@ -54,51 +65,51 @@ msgid "" "and/or 0 respectively) the OS default behavior will be used." msgstr "" -#: ../../library/smtplib.rst:43 +#: ../../library/smtplib.rst:44 msgid "" "For normal use, you should only require the initialization/connect, :meth:" "`sendmail`, and :meth:`SMTP.quit` methods. An example is included below." msgstr "" -#: ../../library/smtplib.rst:47 +#: ../../library/smtplib.rst:48 msgid "" "The :class:`SMTP` class supports the :keyword:`with` statement. When used " "like this, the SMTP ``QUIT`` command is issued automatically when the :" "keyword:`!with` statement exits. E.g.::" msgstr "" -#: ../../library/smtplib.rst:58 +#: ../../library/smtplib.rst:70 msgid "" "Raises an :ref:`auditing event ` ``smtplib.send`` with arguments " "``self``, ``data``." msgstr "" -#: ../../library/smtplib.rst:60 +#: ../../library/smtplib.rst:61 msgid "" "All commands will raise an :ref:`auditing event ` ``smtplib.SMTP." "send`` with arguments ``self`` and ``data``, where ``data`` is the bytes " "about to be sent to the remote host." msgstr "" -#: ../../library/smtplib.rst:64 +#: ../../library/smtplib.rst:65 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/smtplib.rst:67 ../../library/smtplib.rst:99 +#: ../../library/smtplib.rst:68 ../../library/smtplib.rst:100 msgid "source_address argument was added." msgstr "新增 source_address 引數。" -#: ../../library/smtplib.rst:70 +#: ../../library/smtplib.rst:71 msgid "The SMTPUTF8 extension (:rfc:`6531`) is now supported." msgstr "" -#: ../../library/smtplib.rst:73 ../../library/smtplib.rst:114 +#: ../../library/smtplib.rst:74 ../../library/smtplib.rst:115 msgid "" "If the *timeout* parameter is set to be zero, it will raise a :class:" "`ValueError` to prevent the creation of a non-blocking socket" msgstr "" -#: ../../library/smtplib.rst:81 +#: ../../library/smtplib.rst:82 msgid "" "An :class:`SMTP_SSL` instance behaves exactly the same as instances of :" "class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is " @@ -112,31 +123,31 @@ msgid "" "practices." msgstr "" -#: ../../library/smtplib.rst:92 +#: ../../library/smtplib.rst:93 msgid "" "*keyfile* and *certfile* are a legacy alternative to *context*, and can " "point to a PEM formatted private key and certificate chain file for the SSL " "connection." msgstr "" -#: ../../library/smtplib.rst:96 ../../library/smtplib.rst:427 +#: ../../library/smtplib.rst:97 ../../library/smtplib.rst:428 msgid "*context* was added." msgstr "新增 *context*\\ 。" -#: ../../library/smtplib.rst:102 +#: ../../library/smtplib.rst:103 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/smtplib.rst:109 ../../library/smtplib.rst:413 +#: ../../library/smtplib.rst:110 ../../library/smtplib.rst:414 msgid "" "*keyfile* and *certfile* are deprecated in favor of *context*. Please use :" "meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." "create_default_context` select the system's trusted CA certificates for you." msgstr "" -#: ../../library/smtplib.rst:121 +#: ../../library/smtplib.rst:122 msgid "" "The LMTP protocol, which is very similar to ESMTP, is heavily based on the " "standard SMTP client. It's common to use Unix sockets for LMTP, so our :meth:" @@ -146,39 +157,39 @@ msgid "" "must use an absolute path for *host*, starting with a '/'." msgstr "" -#: ../../library/smtplib.rst:128 +#: ../../library/smtplib.rst:129 msgid "" "Authentication is supported, using the regular SMTP mechanism. When using a " "Unix socket, LMTP generally don't support or require any authentication, but " "your mileage might vary." msgstr "" -#: ../../library/smtplib.rst:132 +#: ../../library/smtplib.rst:133 msgid "The optional *timeout* parameter was added." msgstr "新增 *timeout* 選用參數。" -#: ../../library/smtplib.rst:136 +#: ../../library/smtplib.rst:137 msgid "A nice selection of exceptions is defined as well:" msgstr "" -#: ../../library/smtplib.rst:141 +#: ../../library/smtplib.rst:142 msgid "" "Subclass of :exc:`OSError` that is the base exception class for all the " "other exceptions provided by this module." msgstr "" -#: ../../library/smtplib.rst:144 +#: ../../library/smtplib.rst:145 msgid "SMTPException became subclass of :exc:`OSError`" msgstr "" -#: ../../library/smtplib.rst:150 +#: ../../library/smtplib.rst:151 msgid "" "This exception is raised when the server unexpectedly disconnects, or when " "an attempt is made to use the :class:`SMTP` instance before connecting it to " "a server." msgstr "" -#: ../../library/smtplib.rst:157 +#: ../../library/smtplib.rst:158 msgid "" "Base class for all exceptions that include an SMTP error code. These " "exceptions are generated in some instances when the SMTP server returns an " @@ -186,72 +197,72 @@ msgid "" "the error, and the :attr:`smtp_error` attribute is set to the error message." msgstr "" -#: ../../library/smtplib.rst:165 +#: ../../library/smtplib.rst:166 msgid "" "Sender address refused. In addition to the attributes set by on all :exc:" "`SMTPResponseException` exceptions, this sets 'sender' to the string that " "the SMTP server refused." msgstr "" -#: ../../library/smtplib.rst:172 +#: ../../library/smtplib.rst:173 msgid "" "All recipient addresses refused. The errors for each recipient are " "accessible through the attribute :attr:`recipients`, which is a dictionary " "of exactly the same sort as :meth:`SMTP.sendmail` returns." msgstr "" -#: ../../library/smtplib.rst:179 +#: ../../library/smtplib.rst:180 msgid "The SMTP server refused to accept the message data." msgstr "" -#: ../../library/smtplib.rst:184 +#: ../../library/smtplib.rst:185 msgid "Error occurred during establishment of a connection with the server." msgstr "" -#: ../../library/smtplib.rst:189 +#: ../../library/smtplib.rst:190 msgid "The server refused our ``HELO`` message." msgstr "" -#: ../../library/smtplib.rst:194 +#: ../../library/smtplib.rst:195 msgid "The command or option attempted is not supported by the server." msgstr "" -#: ../../library/smtplib.rst:201 +#: ../../library/smtplib.rst:202 msgid "" "SMTP authentication went wrong. Most probably the server didn't accept the " "username/password combination provided." msgstr "" -#: ../../library/smtplib.rst:209 +#: ../../library/smtplib.rst:210 msgid ":rfc:`821` - Simple Mail Transfer Protocol" msgstr "" -#: ../../library/smtplib.rst:208 +#: ../../library/smtplib.rst:209 msgid "" "Protocol definition for SMTP. This document covers the model, operating " "procedure, and protocol details for SMTP." msgstr "" -#: ../../library/smtplib.rst:213 +#: ../../library/smtplib.rst:214 msgid ":rfc:`1869` - SMTP Service Extensions" msgstr "" -#: ../../library/smtplib.rst:212 +#: ../../library/smtplib.rst:213 msgid "" "Definition of the ESMTP extensions for SMTP. This describes a framework for " "extending SMTP with new commands, supporting dynamic discovery of the " "commands provided by the server, and defines a few additional commands." msgstr "" -#: ../../library/smtplib.rst:220 +#: ../../library/smtplib.rst:221 msgid "SMTP Objects" msgstr "SMTP 物件" -#: ../../library/smtplib.rst:222 +#: ../../library/smtplib.rst:223 msgid "An :class:`SMTP` instance has the following methods:" msgstr "" -#: ../../library/smtplib.rst:227 +#: ../../library/smtplib.rst:228 msgid "" "Set the debug output level. A value of 1 or ``True`` for *level* results in " "debug messages for connection and for all messages sent to and received from " @@ -259,36 +270,36 @@ msgid "" "timestamped." msgstr "" -#: ../../library/smtplib.rst:232 +#: ../../library/smtplib.rst:233 msgid "Added debuglevel 2." msgstr "" -#: ../../library/smtplib.rst:237 +#: ../../library/smtplib.rst:238 msgid "" "Send a command *cmd* to the server. The optional argument *args* is simply " "concatenated to the command, separated by a space." msgstr "" -#: ../../library/smtplib.rst:240 +#: ../../library/smtplib.rst:241 msgid "" "This returns a 2-tuple composed of a numeric response code and the actual " "response line (multiline responses are joined into one long line.)" msgstr "" -#: ../../library/smtplib.rst:243 +#: ../../library/smtplib.rst:244 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It is used to implement other methods and may be useful for " "testing private extensions." msgstr "" -#: ../../library/smtplib.rst:247 +#: ../../library/smtplib.rst:248 msgid "" "If the connection to the server is lost while waiting for the reply, :exc:" "`SMTPServerDisconnected` will be raised." msgstr "" -#: ../../library/smtplib.rst:253 +#: ../../library/smtplib.rst:254 msgid "" "Connect to a host on a given port. The defaults are to connect to the local " "host at the standard SMTP port (25). If the hostname ends with a colon " @@ -299,13 +310,13 @@ msgid "" "connection response." msgstr "" -#: ../../library/smtplib.rst:261 +#: ../../library/smtplib.rst:273 msgid "" "Raises an :ref:`auditing event ` ``smtplib.connect`` with " "arguments ``self``, ``host``, ``port``." msgstr "" -#: ../../library/smtplib.rst:266 +#: ../../library/smtplib.rst:267 msgid "" "Identify yourself to the SMTP server using ``HELO``. The hostname argument " "defaults to the fully qualified domain name of the local host. The message " @@ -313,14 +324,14 @@ msgid "" "object." msgstr "" -#: ../../library/smtplib.rst:271 +#: ../../library/smtplib.rst:272 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It will be implicitly called by the :meth:`sendmail` when " "necessary." msgstr "" -#: ../../library/smtplib.rst:277 +#: ../../library/smtplib.rst:278 msgid "" "Identify yourself to an ESMTP server using ``EHLO``. The hostname argument " "defaults to the fully qualified domain name of the local host. Examine the " @@ -332,37 +343,37 @@ msgid "" "service extensions this server supports, and their parameters (if any)." msgstr "" -#: ../../library/smtplib.rst:287 +#: ../../library/smtplib.rst:288 msgid "" "Unless you wish to use :meth:`has_extn` before sending mail, it should not " "be necessary to call this method explicitly. It will be implicitly called " "by :meth:`sendmail` when necessary." msgstr "" -#: ../../library/smtplib.rst:293 +#: ../../library/smtplib.rst:294 msgid "" "This method calls :meth:`ehlo` and/or :meth:`helo` if there has been no " "previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO`` " "first." msgstr "" -#: ../../library/smtplib.rst:297 ../../library/smtplib.rst:327 -#: ../../library/smtplib.rst:419 ../../library/smtplib.rst:488 +#: ../../library/smtplib.rst:298 ../../library/smtplib.rst:328 +#: ../../library/smtplib.rst:420 ../../library/smtplib.rst:489 msgid ":exc:`SMTPHeloError`" msgstr ":exc:`SMTPHeloError`" -#: ../../library/smtplib.rst:298 ../../library/smtplib.rst:327 -#: ../../library/smtplib.rst:419 ../../library/smtplib.rst:488 +#: ../../library/smtplib.rst:299 ../../library/smtplib.rst:328 +#: ../../library/smtplib.rst:420 ../../library/smtplib.rst:489 msgid "The server didn't reply properly to the ``HELO`` greeting." msgstr "" -#: ../../library/smtplib.rst:302 +#: ../../library/smtplib.rst:303 msgid "" "Return :const:`True` if *name* is in the set of SMTP service extensions " "returned by the server, :const:`False` otherwise. Case is ignored." msgstr "" -#: ../../library/smtplib.rst:308 +#: ../../library/smtplib.rst:309 msgid "" "Check the validity of an address on this server using SMTP ``VRFY``. Returns " "a tuple consisting of code 250 and a full :rfc:`822` address (including " @@ -370,11 +381,11 @@ msgid "" "code of 400 or greater and an error string." msgstr "" -#: ../../library/smtplib.rst:315 +#: ../../library/smtplib.rst:316 msgid "Many sites disable SMTP ``VRFY`` in order to foil spammers." msgstr "" -#: ../../library/smtplib.rst:320 +#: ../../library/smtplib.rst:321 msgid "" "Log in on an SMTP server that requires authentication. The arguments are the " "username and the password to authenticate with. If there has been no " @@ -383,32 +394,32 @@ msgid "" "successful, or may raise the following exceptions:" msgstr "" -#: ../../library/smtplib.rst:330 +#: ../../library/smtplib.rst:331 msgid ":exc:`SMTPAuthenticationError`" msgstr ":exc:`SMTPAuthenticationError`" -#: ../../library/smtplib.rst:330 +#: ../../library/smtplib.rst:331 msgid "The server didn't accept the username/password combination." msgstr "" -#: ../../library/smtplib.rst:333 ../../library/smtplib.rst:422 -#: ../../library/smtplib.rst:499 +#: ../../library/smtplib.rst:334 ../../library/smtplib.rst:423 +#: ../../library/smtplib.rst:500 msgid ":exc:`SMTPNotSupportedError`" msgstr ":exc:`SMTPNotSupportedError`" -#: ../../library/smtplib.rst:333 +#: ../../library/smtplib.rst:334 msgid "The ``AUTH`` command is not supported by the server." msgstr "" -#: ../../library/smtplib.rst:336 +#: ../../library/smtplib.rst:337 msgid ":exc:`SMTPException`" msgstr ":exc:`SMTPException`" -#: ../../library/smtplib.rst:336 +#: ../../library/smtplib.rst:337 msgid "No suitable authentication method was found." msgstr "" -#: ../../library/smtplib.rst:338 +#: ../../library/smtplib.rst:339 msgid "" "Each of the authentication methods supported by :mod:`smtplib` are tried in " "turn if they are advertised as supported by the server. See :meth:`auth` " @@ -416,7 +427,7 @@ msgid "" "passed through to :meth:`auth`." msgstr "" -#: ../../library/smtplib.rst:343 +#: ../../library/smtplib.rst:344 msgid "" "Optional keyword argument *initial_response_ok* specifies whether, for " "authentication methods that support it, an \"initial response\" as specified " @@ -424,35 +435,35 @@ msgid "" "requiring a challenge/response." msgstr "" -#: ../../library/smtplib.rst:348 +#: ../../library/smtplib.rst:349 msgid "" ":exc:`SMTPNotSupportedError` may be raised, and the *initial_response_ok* " "parameter was added." msgstr "" -#: ../../library/smtplib.rst:355 +#: ../../library/smtplib.rst:356 msgid "" "Issue an ``SMTP`` ``AUTH`` command for the specified authentication " "*mechanism*, and handle the challenge response via *authobject*." msgstr "" -#: ../../library/smtplib.rst:358 +#: ../../library/smtplib.rst:359 msgid "" "*mechanism* specifies which authentication mechanism is to be used as " "argument to the ``AUTH`` command; the valid values are those listed in the " "``auth`` element of :attr:`esmtp_features`." msgstr "" -#: ../../library/smtplib.rst:362 +#: ../../library/smtplib.rst:363 msgid "" "*authobject* must be a callable object taking an optional single argument:" msgstr "" -#: ../../library/smtplib.rst:364 +#: ../../library/smtplib.rst:365 msgid "data = authobject(challenge=None)" msgstr "" -#: ../../library/smtplib.rst:366 +#: ../../library/smtplib.rst:367 msgid "" "If optional keyword argument *initial_response_ok* is true, ``authobject()`` " "will be called first with no argument. It can return the :rfc:`4954` " @@ -463,7 +474,7 @@ msgid "" "false, then ``authobject()`` will not be called first with ``None``." msgstr "" -#: ../../library/smtplib.rst:374 +#: ../../library/smtplib.rst:375 msgid "" "If the initial response check returns ``None``, or if *initial_response_ok* " "is false, ``authobject()`` will be called to process the server's challenge " @@ -472,7 +483,7 @@ msgid "" "the server." msgstr "" -#: ../../library/smtplib.rst:380 +#: ../../library/smtplib.rst:381 msgid "" "The ``SMTP`` class provides ``authobjects`` for the ``CRAM-MD5``, ``PLAIN``, " "and ``LOGIN`` mechanisms; they are named ``SMTP.auth_cram_md5``, ``SMTP." @@ -481,7 +492,7 @@ msgid "" "appropriate values." msgstr "" -#: ../../library/smtplib.rst:386 +#: ../../library/smtplib.rst:387 msgid "" "User code does not normally need to call ``auth`` directly, but can instead " "call the :meth:`login` method, which will try each of the above mechanisms " @@ -490,57 +501,57 @@ msgid "" "by :mod:`smtplib`." msgstr "" -#: ../../library/smtplib.rst:397 +#: ../../library/smtplib.rst:398 msgid "" "Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP " "commands that follow will be encrypted. You should then call :meth:`ehlo` " "again." msgstr "" -#: ../../library/smtplib.rst:401 +#: ../../library/smtplib.rst:402 msgid "" "If *keyfile* and *certfile* are provided, they are used to create an :class:" "`ssl.SSLContext`." msgstr "" -#: ../../library/smtplib.rst:404 +#: ../../library/smtplib.rst:405 msgid "" "Optional *context* parameter is an :class:`ssl.SSLContext` object; This is " "an alternative to using a keyfile and a certfile and if specified both " "*keyfile* and *certfile* should be ``None``." msgstr "" -#: ../../library/smtplib.rst:408 +#: ../../library/smtplib.rst:409 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first." msgstr "" -#: ../../library/smtplib.rst:422 +#: ../../library/smtplib.rst:423 msgid "The server does not support the STARTTLS extension." msgstr "" -#: ../../library/smtplib.rst:425 +#: ../../library/smtplib.rst:426 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../library/smtplib.rst:425 +#: ../../library/smtplib.rst:426 msgid "SSL/TLS support is not available to your Python interpreter." msgstr "" -#: ../../library/smtplib.rst:430 +#: ../../library/smtplib.rst:431 msgid "" "The method now supports hostname check with :attr:`SSLContext." "check_hostname` and *Server Name Indicator* (see :data:`~ssl.HAS_SNI`)." msgstr "" -#: ../../library/smtplib.rst:435 +#: ../../library/smtplib.rst:436 msgid "" "The error raised for lack of STARTTLS support is now the :exc:" "`SMTPNotSupportedError` subclass instead of the base :exc:`SMTPException`." msgstr "" -#: ../../library/smtplib.rst:443 +#: ../../library/smtplib.rst:444 msgid "" "Send mail. The required arguments are an :rfc:`822` from-address string, a " "list of :rfc:`822` to-address strings (a bare string will be treated as a " @@ -553,14 +564,14 @@ msgid "" "the message.)" msgstr "" -#: ../../library/smtplib.rst:454 +#: ../../library/smtplib.rst:455 msgid "" "The *from_addr* and *to_addrs* parameters are used to construct the message " "envelope used by the transport agents. ``sendmail`` does not modify the " "message headers in any way." msgstr "" -#: ../../library/smtplib.rst:458 +#: ../../library/smtplib.rst:459 msgid "" "*msg* may be a string containing characters in the ASCII range, or a byte " "string. A string is encoded to bytes using the ascii codec, and lone ``" @@ -568,7 +579,7 @@ msgid "" "string is not modified." msgstr "" -#: ../../library/smtplib.rst:463 +#: ../../library/smtplib.rst:464 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first. If the server does ESMTP, message " @@ -577,7 +588,7 @@ msgid "" "will be tried and ESMTP options suppressed." msgstr "" -#: ../../library/smtplib.rst:469 +#: ../../library/smtplib.rst:470 msgid "" "This method will return normally if the mail is accepted for at least one " "recipient. Otherwise it will raise an exception. That is, if this method " @@ -587,21 +598,21 @@ msgid "" "SMTP error code and the accompanying error message sent by the server." msgstr "" -#: ../../library/smtplib.rst:476 +#: ../../library/smtplib.rst:477 msgid "" "If ``SMTPUTF8`` is included in *mail_options*, and the server supports it, " "*from_addr* and *to_addrs* may contain non-ASCII characters." msgstr "" -#: ../../library/smtplib.rst:479 +#: ../../library/smtplib.rst:480 msgid "This method may raise the following exceptions:" msgstr "" -#: ../../library/smtplib.rst:485 +#: ../../library/smtplib.rst:486 msgid ":exc:`SMTPRecipientsRefused`" msgstr ":exc:`SMTPRecipientsRefused`" -#: ../../library/smtplib.rst:482 +#: ../../library/smtplib.rst:483 msgid "" "All recipients were refused. Nobody got the mail. The :attr:`recipients` " "attribute of the exception object is a dictionary with information about the " @@ -609,47 +620,47 @@ msgid "" "accepted)." msgstr "" -#: ../../library/smtplib.rst:491 +#: ../../library/smtplib.rst:492 msgid ":exc:`SMTPSenderRefused`" msgstr ":exc:`SMTPSenderRefused`" -#: ../../library/smtplib.rst:491 +#: ../../library/smtplib.rst:492 msgid "The server didn't accept the *from_addr*." msgstr "" -#: ../../library/smtplib.rst:495 +#: ../../library/smtplib.rst:496 msgid ":exc:`SMTPDataError`" msgstr ":exc:`SMTPDataError`" -#: ../../library/smtplib.rst:494 +#: ../../library/smtplib.rst:495 msgid "" "The server replied with an unexpected error code (other than a refusal of a " "recipient)." msgstr "" -#: ../../library/smtplib.rst:498 +#: ../../library/smtplib.rst:499 msgid "" "``SMTPUTF8`` was given in the *mail_options* but is not supported by the " "server." msgstr "" -#: ../../library/smtplib.rst:501 +#: ../../library/smtplib.rst:502 msgid "" "Unless otherwise noted, the connection will be open even after an exception " "is raised." msgstr "" -#: ../../library/smtplib.rst:504 +#: ../../library/smtplib.rst:505 msgid "*msg* may be a byte string." msgstr "" -#: ../../library/smtplib.rst:507 +#: ../../library/smtplib.rst:508 msgid "" "``SMTPUTF8`` support added, and :exc:`SMTPNotSupportedError` may be raised " "if ``SMTPUTF8`` is specified but the server does not support it." msgstr "" -#: ../../library/smtplib.rst:515 +#: ../../library/smtplib.rst:516 msgid "" "This is a convenience method for calling :meth:`sendmail` with the message " "represented by an :class:`email.message.Message` object. The arguments have " @@ -657,7 +668,7 @@ msgid "" "object." msgstr "" -#: ../../library/smtplib.rst:520 +#: ../../library/smtplib.rst:521 msgid "" "If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills " "those arguments with addresses extracted from the headers of *msg* as " @@ -672,7 +683,7 @@ msgid "" "most recent set of :mailheader:`Resent-` headers." msgstr "" -#: ../../library/smtplib.rst:532 +#: ../../library/smtplib.rst:533 msgid "" "``send_message`` serializes *msg* using :class:`~email.generator." "BytesGenerator` with ``\\r\\n`` as the *linesep*, and calls :meth:`sendmail` " @@ -687,17 +698,17 @@ msgid "" "to *mail_options*." msgstr "" -#: ../../library/smtplib.rst:546 +#: ../../library/smtplib.rst:547 msgid "Support for internationalized addresses (``SMTPUTF8``)." msgstr "" -#: ../../library/smtplib.rst:552 +#: ../../library/smtplib.rst:553 msgid "" "Terminate the SMTP session and close the connection. Return the result of " "the SMTP ``QUIT`` command." msgstr "" -#: ../../library/smtplib.rst:556 +#: ../../library/smtplib.rst:557 msgid "" "Low-level methods corresponding to the standard SMTP/ESMTP commands " "``HELP``, ``RSET``, ``NOOP``, ``MAIL``, ``RCPT``, and ``DATA`` are also " @@ -705,11 +716,11 @@ msgid "" "documented here. For details, consult the module code." msgstr "" -#: ../../library/smtplib.rst:565 +#: ../../library/smtplib.rst:566 msgid "SMTP Example" msgstr "SMTP 範例" -#: ../../library/smtplib.rst:567 +#: ../../library/smtplib.rst:568 msgid "" "This example prompts the user for addresses needed in the message envelope " "('To' and 'From' addresses), and the message to be delivered. Note that the " @@ -719,7 +730,7 @@ msgid "" "headers explicitly. ::" msgstr "" -#: ../../library/smtplib.rst:603 +#: ../../library/smtplib.rst:604 msgid "" "In general, you will want to use the :mod:`email` package's features to " "construct an email message, which you can then send via :meth:`~smtplib.SMTP." diff --git a/library/sndhdr.po b/library/sndhdr.po index f10d837327..790a1ec6bd 100644 --- a/library/sndhdr.po +++ b/library/sndhdr.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-06-11 15:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,7 +30,7 @@ msgstr ":mod:`sndhdr` --- 判定聲音檔案的型別" msgid "**Source code:** :source:`Lib/sndhdr.py`" msgstr "**原始碼:**\\ :source:`Lib/sndhdr.py`" -#: ../../library/sndhdr.rst:17 +#: ../../library/sndhdr.rst:20 msgid "" "The :mod:`sndhdr` module is deprecated (see :pep:`PEP 594 <594#sndhdr>` for " "details and alternatives)." @@ -88,3 +88,122 @@ msgid "" msgstr "" "根據檔案標頭 (header) 推測儲存在檔案中的聲音資料型別。檔名由 *filename* 給" "定。這個函式在成功時回傳上述 namedtuple,或在失敗時回傳 ``None``。" + +#: ../../library/sndhdr.rst:57 +msgid "" +"The following sound header types are recognized, as listed below with the " +"return value from :func:`whathdr`: and :func:`what`:" +msgstr "" + +#: ../../library/sndhdr.rst:61 +msgid "Value" +msgstr "" + +#: ../../library/sndhdr.rst:61 +msgid "Sound header format" +msgstr "" + +#: ../../library/sndhdr.rst:63 +msgid "``'aifc'``" +msgstr "``'aifc'``" + +#: ../../library/sndhdr.rst:63 +msgid "Compressed Audio Interchange Files" +msgstr "" + +#: ../../library/sndhdr.rst:65 +msgid "``'aiff'``" +msgstr "``'aiff'``" + +#: ../../library/sndhdr.rst:65 +msgid "Audio Interchange Files" +msgstr "" + +#: ../../library/sndhdr.rst:67 +msgid "``'au'``" +msgstr "``'au'``" + +#: ../../library/sndhdr.rst:67 +msgid "Au Files" +msgstr "Au 檔案" + +#: ../../library/sndhdr.rst:69 +msgid "``'hcom'``" +msgstr "``'hcom'``" + +#: ../../library/sndhdr.rst:69 +msgid "HCOM Files" +msgstr "HCOM 檔案" + +#: ../../library/sndhdr.rst:72 +msgid "``'sndt'``" +msgstr "``'sndt'``" + +#: ../../library/sndhdr.rst:72 +msgid "Sndtool Sound Files" +msgstr "" + +#: ../../library/sndhdr.rst:74 +msgid "``'voc'``" +msgstr "``'voc'``" + +#: ../../library/sndhdr.rst:74 +msgid "Creative Labs Audio Files" +msgstr "" + +#: ../../library/sndhdr.rst:76 +msgid "``'wav'``" +msgstr "``'wav'``" + +#: ../../library/sndhdr.rst:76 +msgid "Waveform Audio File Format Files" +msgstr "" + +#: ../../library/sndhdr.rst:78 +msgid "``'8svx'``" +msgstr "``'8svx'``" + +#: ../../library/sndhdr.rst:78 +msgid "8-Bit Sampled Voice Files" +msgstr "" + +#: ../../library/sndhdr.rst:80 +msgid "``'sb'``" +msgstr "``'sb'``" + +#: ../../library/sndhdr.rst:80 +msgid "Signed Byte Audio Data Files" +msgstr "" + +#: ../../library/sndhdr.rst:82 +msgid "``'ub'``" +msgstr "``'ub'``" + +#: ../../library/sndhdr.rst:82 +msgid "UB Files" +msgstr "UB 檔案" + +#: ../../library/sndhdr.rst:84 +msgid "``'ul'``" +msgstr "``'ul'``" + +#: ../../library/sndhdr.rst:84 +msgid "uLAW Audio Files" +msgstr "uLAW 音檔" + +#: ../../library/sndhdr.rst:89 +msgid "" +"A list of functions performing the individual tests. Each function takes " +"two arguments: the byte-stream and an open file-like object. When :func:" +"`what` is called with a byte-stream, the file-like object will be ``None``." +msgstr "" + +#: ../../library/sndhdr.rst:93 +msgid "" +"The test function should return a string describing the image type if the " +"test succeeded, or ``None`` if it failed." +msgstr "" + +#: ../../library/sndhdr.rst:96 +msgid "Example:" +msgstr "範例:" diff --git a/library/socket.po b/library/socket.po index a6876a3814..6e0dff4b2c 100644 --- a/library/socket.po +++ b/library/socket.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -39,7 +39,19 @@ msgid "" "operating system socket APIs." msgstr "" -#: ../../library/socket.rst:21 +#: ../../includes/wasm-notavail.rst:-1 +#, fuzzy +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/socket.rst:24 msgid "" "The Python interface is a straightforward transliteration of the Unix system " "call and library interface for sockets to Python's object-oriented style: " @@ -50,40 +62,40 @@ msgid "" "automatic, and buffer length is implicit on send operations." msgstr "" -#: ../../library/socket.rst:33 +#: ../../library/socket.rst:36 msgid "Module :mod:`socketserver`" msgstr ":mod:`socketserver` 模組" -#: ../../library/socket.rst:33 +#: ../../library/socket.rst:36 msgid "Classes that simplify writing network servers." msgstr "" -#: ../../library/socket.rst:35 +#: ../../library/socket.rst:38 msgid "Module :mod:`ssl`" msgstr ":mod:`ssl` 模組" -#: ../../library/socket.rst:36 +#: ../../library/socket.rst:39 msgid "A TLS/SSL wrapper for socket objects." msgstr "" -#: ../../library/socket.rst:40 +#: ../../library/socket.rst:43 msgid "Socket families" msgstr "" -#: ../../library/socket.rst:42 +#: ../../library/socket.rst:45 msgid "" "Depending on the system and the build options, various socket families are " "supported by this module." msgstr "" -#: ../../library/socket.rst:45 +#: ../../library/socket.rst:48 msgid "" "The address format required by a particular socket object is automatically " "selected based on the address family specified when the socket object was " "created. Socket addresses are represented as follows:" msgstr "" -#: ../../library/socket.rst:49 +#: ../../library/socket.rst:52 msgid "" "The address of an :const:`AF_UNIX` socket bound to a file system node is " "represented as a string, using the file system encoding and the " @@ -95,17 +107,17 @@ msgid "" "for either type of address when passing it as an argument." msgstr "" -#: ../../library/socket.rst:59 +#: ../../library/socket.rst:62 msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:63 ../../library/socket.rst:979 -#: ../../library/socket.rst:1021 ../../library/socket.rst:1751 +#: ../../library/socket.rst:66 ../../library/socket.rst:1043 +#: ../../library/socket.rst:1085 ../../library/socket.rst:1844 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: ../../library/socket.rst:68 +#: ../../library/socket.rst:71 msgid "" "A pair ``(host, port)`` is used for the :const:`AF_INET` address family, " "where *host* is a string representing either a hostname in internet domain " @@ -113,7 +125,7 @@ msgid "" "``'100.50.200.5'``, and *port* is an integer." msgstr "" -#: ../../library/socket.rst:73 +#: ../../library/socket.rst:76 msgid "" "For IPv4 addresses, two special forms are accepted instead of a host " "address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all " @@ -123,7 +135,7 @@ msgid "" "programs." msgstr "" -#: ../../library/socket.rst:80 +#: ../../library/socket.rst:83 msgid "" "For :const:`AF_INET6` address family, a four-tuple ``(host, port, flowinfo, " "scope_id)`` is used, where *flowinfo* and *scope_id* represent the " @@ -134,18 +146,18 @@ msgid "" "addresses." msgstr "" -#: ../../library/socket.rst:87 +#: ../../library/socket.rst:90 msgid "" "For multicast addresses (with *scope_id* meaningful) *address* may not " "contain ``%scope_id`` (or ``zone id``) part. This information is superfluous " "and may be safely omitted (recommended)." msgstr "" -#: ../../library/socket.rst:92 +#: ../../library/socket.rst:95 msgid ":const:`AF_NETLINK` sockets are represented as pairs ``(pid, groups)``." msgstr "" -#: ../../library/socket.rst:94 +#: ../../library/socket.rst:97 msgid "" "Linux-only support for TIPC is available using the :const:`AF_TIPC` address " "family. TIPC is an open, non-IP based networked protocol designed for use " @@ -154,37 +166,37 @@ msgid "" "``(addr_type, v1, v2, v3 [, scope])``, where:" msgstr "" -#: ../../library/socket.rst:100 +#: ../../library/socket.rst:103 msgid "" "*addr_type* is one of :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, " "or :const:`TIPC_ADDR_ID`." msgstr "" -#: ../../library/socket.rst:102 +#: ../../library/socket.rst:105 msgid "" "*scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`, " "and :const:`TIPC_NODE_SCOPE`." msgstr "" -#: ../../library/socket.rst:104 +#: ../../library/socket.rst:107 msgid "" "If *addr_type* is :const:`TIPC_ADDR_NAME`, then *v1* is the server type, " "*v2* is the port identifier, and *v3* should be 0." msgstr "" -#: ../../library/socket.rst:107 +#: ../../library/socket.rst:110 msgid "" "If *addr_type* is :const:`TIPC_ADDR_NAMESEQ`, then *v1* is the server type, " "*v2* is the lower port number, and *v3* is the upper port number." msgstr "" -#: ../../library/socket.rst:110 +#: ../../library/socket.rst:113 msgid "" "If *addr_type* is :const:`TIPC_ADDR_ID`, then *v1* is the node, *v2* is the " "reference, and *v3* should be set to 0." msgstr "" -#: ../../library/socket.rst:113 +#: ../../library/socket.rst:116 msgid "" "A tuple ``(interface, )`` is used for the :const:`AF_CAN` address family, " "where *interface* is a string representing a network interface name like " @@ -192,14 +204,14 @@ msgid "" "from all network interfaces of this family." msgstr "" -#: ../../library/socket.rst:118 +#: ../../library/socket.rst:121 msgid "" ":const:`CAN_ISOTP` protocol require a tuple ``(interface, rx_addr, " "tx_addr)`` where both additional parameters are unsigned long integer that " "represent a CAN identifier (standard or extended)." msgstr "" -#: ../../library/socket.rst:121 +#: ../../library/socket.rst:124 msgid "" ":const:`CAN_J1939` protocol require a tuple ``(interface, name, pgn, addr)`` " "where additional parameters are 64-bit unsigned integer representing the ECU " @@ -207,7 +219,7 @@ msgid "" "(PGN), and an 8-bit integer representing the address." msgstr "" -#: ../../library/socket.rst:126 +#: ../../library/socket.rst:129 msgid "" "A string or a tuple ``(id, unit)`` is used for the :const:`SYSPROTO_CONTROL` " "protocol of the :const:`PF_SYSTEM` family. The string is the name of a " @@ -216,24 +228,24 @@ msgid "" "used." msgstr "" -#: ../../library/socket.rst:134 +#: ../../library/socket.rst:137 msgid "" ":const:`AF_BLUETOOTH` supports the following protocols and address formats:" msgstr "" -#: ../../library/socket.rst:137 +#: ../../library/socket.rst:140 msgid "" ":const:`BTPROTO_L2CAP` accepts ``(bdaddr, psm)`` where ``bdaddr`` is the " "Bluetooth address as a string and ``psm`` is an integer." msgstr "" -#: ../../library/socket.rst:140 +#: ../../library/socket.rst:143 msgid "" ":const:`BTPROTO_RFCOMM` accepts ``(bdaddr, channel)`` where ``bdaddr`` is " "the Bluetooth address as a string and ``channel`` is an integer." msgstr "" -#: ../../library/socket.rst:143 +#: ../../library/socket.rst:146 msgid "" ":const:`BTPROTO_HCI` accepts ``(device_id,)`` where ``device_id`` is either " "an integer or a string with the Bluetooth address of the interface. (This " @@ -241,104 +253,112 @@ msgid "" "everything else expects an integer.)" msgstr "" -#: ../../library/socket.rst:148 +#: ../../library/socket.rst:151 msgid "NetBSD and DragonFlyBSD support added." msgstr "" -#: ../../library/socket.rst:151 +#: ../../library/socket.rst:154 msgid "" ":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is a :class:`bytes` " "object containing the Bluetooth address in a string format. (ex. " "``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." msgstr "" -#: ../../library/socket.rst:156 +#: ../../library/socket.rst:159 msgid "" ":const:`AF_ALG` is a Linux-only socket based interface to Kernel " "cryptography. An algorithm socket is configured with a tuple of two to four " "elements ``(type, name [, feat [, mask]])``, where:" msgstr "" -#: ../../library/socket.rst:160 +#: ../../library/socket.rst:163 msgid "" "*type* is the algorithm type as string, e.g. ``aead``, ``hash``, " "``skcipher`` or ``rng``." msgstr "" -#: ../../library/socket.rst:163 +#: ../../library/socket.rst:166 msgid "" "*name* is the algorithm name and operation mode as string, e.g. ``sha256``, " "``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``." msgstr "" -#: ../../library/socket.rst:166 +#: ../../library/socket.rst:169 msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:172 +#: ../../library/socket.rst:173 +msgid "Some algorithm types require more recent Kernels." +msgstr "" + +#: ../../library/socket.rst:177 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:180 +#: ../../library/socket.rst:183 +msgid "See :manpage:`vsock(7)`" +msgstr "" + +#: ../../library/socket.rst:187 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "packets are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" -#: ../../library/socket.rst:184 +#: ../../library/socket.rst:191 msgid "*ifname* - String specifying the device name." msgstr "" -#: ../../library/socket.rst:185 +#: ../../library/socket.rst:192 msgid "" "*proto* - An in network-byte-order integer specifying the Ethernet protocol " "number." msgstr "" -#: ../../library/socket.rst:187 +#: ../../library/socket.rst:194 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "" -#: ../../library/socket.rst:189 +#: ../../library/socket.rst:196 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." msgstr "" -#: ../../library/socket.rst:190 +#: ../../library/socket.rst:197 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." msgstr "" -#: ../../library/socket.rst:191 +#: ../../library/socket.rst:198 msgid "" -"``PACKET_MULTIHOST`` - Packet sent to a physical-layer multicast address." +"``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" -#: ../../library/socket.rst:192 +#: ../../library/socket.rst:199 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" -#: ../../library/socket.rst:194 +#: ../../library/socket.rst:201 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" -#: ../../library/socket.rst:196 +#: ../../library/socket.rst:203 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" -#: ../../library/socket.rst:197 +#: ../../library/socket.rst:204 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:202 +#: ../../library/socket.rst:209 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " @@ -346,7 +366,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:211 +#: ../../library/socket.rst:218 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " "what portion of a packet is covered with the checksum. It adds two socket " @@ -357,14 +377,14 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: ../../library/socket.rst:220 +#: ../../library/socket.rst:227 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: ../../library/socket.rst:228 +#: ../../library/socket.rst:235 msgid "" "If you use a hostname in the *host* portion of IPv4/v6 socket address, the " "program may show a nondeterministic behavior, as Python uses the first " @@ -374,41 +394,41 @@ msgid "" "deterministic behavior use a numeric address in *host* portion." msgstr "" -#: ../../library/socket.rst:235 +#: ../../library/socket.rst:242 msgid "" "All errors raise exceptions. The normal exceptions for invalid argument " "types and out-of-memory conditions can be raised. Errors related to socket " "or address semantics raise :exc:`OSError` or one of its subclasses." msgstr "" -#: ../../library/socket.rst:240 +#: ../../library/socket.rst:247 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " "generalization of this based on timeouts is supported through :meth:`~socket." "settimeout`." msgstr "" -#: ../../library/socket.rst:246 +#: ../../library/socket.rst:253 msgid "Module contents" msgstr "模組內容" -#: ../../library/socket.rst:248 +#: ../../library/socket.rst:255 msgid "The module :mod:`socket` exports the following elements." msgstr "" -#: ../../library/socket.rst:252 +#: ../../library/socket.rst:259 msgid "Exceptions" msgstr "例外" -#: ../../library/socket.rst:256 +#: ../../library/socket.rst:263 msgid "A deprecated alias of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:258 +#: ../../library/socket.rst:265 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:264 +#: ../../library/socket.rst:271 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" @@ -418,12 +438,12 @@ msgid "" "description of *h_errno*, as returned by the :c:func:`hstrerror` C function." msgstr "" -#: ../../library/socket.rst:272 ../../library/socket.rst:285 -#: ../../library/socket.rst:298 +#: ../../library/socket.rst:279 ../../library/socket.rst:292 +#: ../../library/socket.rst:305 msgid "This class was made a subclass of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:277 +#: ../../library/socket.rst:284 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -433,11 +453,11 @@ msgid "" "match one of the :const:`EAI_\\*` constants defined in this module." msgstr "" -#: ../../library/socket.rst:290 +#: ../../library/socket.rst:297 msgid "A deprecated alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:292 +#: ../../library/socket.rst:299 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " "on a socket which has had timeouts enabled via a prior call to :meth:" @@ -446,21 +466,21 @@ msgid "" "currently always \"timed out\"." msgstr "" -#: ../../library/socket.rst:301 +#: ../../library/socket.rst:308 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:306 +#: ../../library/socket.rst:313 msgid "Constants" msgstr "常數" -#: ../../library/socket.rst:308 +#: ../../library/socket.rst:315 msgid "" "The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" "`SocketKind` :class:`.IntEnum` collections." msgstr "" -#: ../../library/socket.rst:317 +#: ../../library/socket.rst:324 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`.socket`. If the :const:`AF_UNIX` constant is not " @@ -468,7 +488,7 @@ msgid "" "depending on the system." msgstr "" -#: ../../library/socket.rst:329 +#: ../../library/socket.rst:336 msgid "" "These constants represent the socket types, used for the second argument to :" "func:`.socket`. More constants may be available depending on the system. " @@ -476,24 +496,24 @@ msgid "" "useful.)" msgstr "" -#: ../../library/socket.rst:337 +#: ../../library/socket.rst:344 msgid "" "These two constants, if defined, can be combined with the socket types and " "allow you to set some flags atomically (thus avoiding possible race " "conditions and the need for separate calls)." msgstr "" -#: ../../library/socket.rst:343 +#: ../../library/socket.rst:350 msgid "" "`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -#: ../../library/socket.rst:347 +#: ../../library/socket.rst:354 msgid ":ref:`Availability `: Linux >= 2.6.27." msgstr ":ref:`適用 `:Linux >= 2.6.27。" -#: ../../library/socket.rst:365 +#: ../../library/socket.rst:372 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " @@ -503,187 +523,223 @@ msgid "" "default values are provided." msgstr "" -#: ../../library/socket.rst:372 +#: ../../library/socket.rst:379 msgid "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added." msgstr "" -#: ../../library/socket.rst:376 +#: ../../library/socket.rst:383 msgid "" "On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:380 +#: ../../library/socket.rst:387 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "" -#: ../../library/socket.rst:383 +#: ../../library/socket.rst:390 msgid "" "On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:386 +#: ../../library/socket.rst:393 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" -#: ../../library/socket.rst:396 ../../library/socket.rst:463 -#: ../../library/socket.rst:474 +#: ../../library/socket.rst:398 +msgid "" +"Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " +"same way that ``TCP_INFO`` is used on Linux and BSD." +msgstr "" + +#: ../../library/socket.rst:407 ../../library/socket.rst:477 +#: ../../library/socket.rst:488 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:400 ../../library/socket.rst:411 -#: ../../library/socket.rst:446 -msgid ":ref:`Availability `: Linux >= 2.6.25." -msgstr ":ref:`適用 `:Linux >= 2.6.25。" +#: ../../library/socket.rst:411 +msgid ":ref:`Availability `: Linux >= 2.6.25, NetBSD >= 8." +msgstr ":ref:`適用 `:Linux 2.6.25 以上、NetBSD 8 以上。" + +#: ../../library/socket.rst:414 +msgid "NetBSD support was added." +msgstr "" -#: ../../library/socket.rst:406 +#: ../../library/socket.rst:420 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:413 +#: ../../library/socket.rst:425 ../../library/socket.rst:460 +msgid ":ref:`Availability `: Linux >= 2.6.25." +msgstr ":ref:`適用 `:Linux >= 2.6.25。" + +#: ../../library/socket.rst:427 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:419 +#: ../../library/socket.rst:433 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:423 ../../library/socket.rst:434 +#: ../../library/socket.rst:437 ../../library/socket.rst:448 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:426 +#: ../../library/socket.rst:440 msgid ":ref:`Availability `: Linux >= 3.6." msgstr ":ref:`適用 `:Linux >= 3.6。" -#: ../../library/socket.rst:431 +#: ../../library/socket.rst:445 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:437 +#: ../../library/socket.rst:451 msgid ":ref:`Availability `: Linux >= 4.1." msgstr ":ref:`適用 `:Linux >= 4.1。" -#: ../../library/socket.rst:442 +#: ../../library/socket.rst:456 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:451 +#: ../../library/socket.rst:465 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:455 +#: ../../library/socket.rst:469 msgid ":ref:`Availability `: Linux >= 5.4." msgstr ":ref:`適用 `:Linux >= 5.4。" -#: ../../library/socket.rst:466 +#: ../../library/socket.rst:480 msgid ":ref:`Availability `: Linux >= 2.2." msgstr ":ref:`適用 `:Linux >= 2.2。" -#: ../../library/socket.rst:478 +#: ../../library/socket.rst:492 msgid ":ref:`Availability `: Linux >= 2.6.30." msgstr ":ref:`適用 `:Linux >= 2.6.30。" -#: ../../library/socket.rst:487 +#: ../../library/socket.rst:501 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:490 ../../library/socket.rst:1373 +#: ../../library/socket.rst:504 ../../library/socket.rst:1458 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:496 +#: ../../library/socket.rst:510 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:503 +#: ../../library/socket.rst:517 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:506 ../../library/socket.rst:1673 +#: ../../library/socket.rst:520 ../../library/socket.rst:1767 msgid ":ref:`Availability `: Linux >= 2.6.38." msgstr ":ref:`適用 `:Linux >= 2.6.38。" -#: ../../library/socket.rst:515 +#: ../../library/socket.rst:529 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:518 +#: ../../library/socket.rst:532 msgid ":ref:`Availability `: Linux >= 4.8." msgstr ":ref:`適用 `:Linux >= 4.8。" -#: ../../library/socket.rst:524 +#: ../../library/socket.rst:538 msgid ":ref:`Availability `: BSD, macOS." msgstr ":ref:`適用 `:BSD、macOS。" -#: ../../library/socket.rst:529 +#: ../../library/socket.rst:543 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:535 +#: ../../library/socket.rst:549 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:544 +#: ../../library/socket.rst:558 msgid "" "For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " "NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " "are not available for FreeBSD, NetBSD, or DragonFlyBSD." msgstr "" -#: ../../library/socket.rst:551 +#: ../../library/socket.rst:565 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:554 +#: ../../library/socket.rst:568 msgid ":ref:`Availability `: Linux >= 4.7." msgstr ":ref:`適用 `:Linux >= 4.7。" -#: ../../library/socket.rst:557 +#: ../../library/socket.rst:574 +msgid "" +"LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " +"SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " +"LOCAL_CREDS sends the credentials at first read, LOCAL_CREDS_PERSISTENT " +"sends for each read, SCM_CREDS2 must be then used for the latter for the " +"message type." +msgstr "" + +#: ../../library/socket.rst:583 +msgid ":ref:`Availability `: FreeBSD." +msgstr ":ref:`適用 `:FreeBSD。" + +#: ../../library/socket.rst:587 +msgid "" +"Constant to optimize CPU locality, to be used in conjunction with :data:" +"`SO_REUSEPORT`." +msgstr "" + +#: ../../library/socket.rst:592 +msgid ":ref:`Availability `: Linux >= 3.9" +msgstr ":ref:`適用 `:Linux 3.9 以上。" + +#: ../../library/socket.rst:595 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:560 +#: ../../library/socket.rst:598 msgid "Creating sockets" msgstr "" -#: ../../library/socket.rst:562 +#: ../../library/socket.rst:600 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:567 +#: ../../library/socket.rst:605 msgid "" "Create a new socket using the given address family, socket type and protocol " "number. The address family should be :const:`AF_INET` (the default), :const:" @@ -696,7 +752,7 @@ msgid "" "`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:577 +#: ../../library/socket.rst:615 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " @@ -707,55 +763,55 @@ msgid "" "This may help close a detached socket using :meth:`socket.close()`." msgstr "" -#: ../../library/socket.rst:586 ../../library/socket.rst:723 -#: ../../library/socket.rst:1203 ../../library/socket.rst:1290 +#: ../../library/socket.rst:624 ../../library/socket.rst:770 +#: ../../library/socket.rst:1277 ../../library/socket.rst:1371 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:588 +#: ../../library/socket.rst:637 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." msgstr "" -#: ../../library/socket.rst:590 +#: ../../library/socket.rst:628 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:594 +#: ../../library/socket.rst:632 msgid "The CAN_BCM protocol was added." msgstr "" -#: ../../library/socket.rst:597 ../../library/socket.rst:725 +#: ../../library/socket.rst:635 ../../library/socket.rst:772 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:600 +#: ../../library/socket.rst:638 msgid "The CAN_ISOTP protocol was added." msgstr "" -#: ../../library/socket.rst:603 +#: ../../library/socket.rst:641 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system `socket()` call. Therefore," msgstr "" -#: ../../library/socket.rst:615 +#: ../../library/socket.rst:653 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:619 +#: ../../library/socket.rst:657 msgid "The CAN_J1939 protocol was added." msgstr "" -#: ../../library/socket.rst:622 +#: ../../library/socket.rst:660 msgid "The IPPROTO_MPTCP protocol was added." msgstr "" -#: ../../library/socket.rst:627 +#: ../../library/socket.rst:665 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -764,25 +820,25 @@ msgid "" "`AF_INET`." msgstr "" -#: ../../library/socket.rst:632 +#: ../../library/socket.rst:670 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:634 +#: ../../library/socket.rst:672 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:638 +#: ../../library/socket.rst:676 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:641 +#: ../../library/socket.rst:679 msgid "Windows support added." msgstr "" -#: ../../library/socket.rst:647 +#: ../../library/socket.rst:685 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -793,31 +849,43 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:655 +#: ../../library/socket.rst:693 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:660 +#: ../../library/socket.rst:698 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:664 +#: ../../library/socket.rst:702 +msgid "" +"When a connection cannot be created, an exception is raised. By default, it " +"is the exception from the last address in the list. If *all_errors* is " +"``True``, it is an :exc:`ExceptionGroup` containing the errors of all " +"attempts." +msgstr "" + +#: ../../library/socket.rst:707 msgid "*source_address* was added." msgstr "新增 *source_address*\\ 。" -#: ../../library/socket.rst:669 +#: ../../library/socket.rst:710 +msgid "*all_errors* was added." +msgstr "新增 *all_errors*\\ 。" + +#: ../../library/socket.rst:716 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and return the socket object." msgstr "" -#: ../../library/socket.rst:672 +#: ../../library/socket.rst:719 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; when ``0`` a default " @@ -825,7 +893,7 @@ msgid "" "`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:677 +#: ../../library/socket.rst:724 msgid "" "If *dualstack_ipv6* is true and the platform supports it the socket will be " "able to accept both IPv4 and IPv6 connections, else it will raise :exc:" @@ -838,20 +906,20 @@ msgid "" "func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:699 +#: ../../library/socket.rst:746 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:707 +#: ../../library/socket.rst:754 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:714 +#: ../../library/socket.rst:761 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`fileno` method) and build a socket object from the result. " @@ -864,38 +932,38 @@ msgid "" "socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:731 +#: ../../library/socket.rst:778 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:735 ../../library/socket.rst:1776 +#: ../../library/socket.rst:782 ../../library/socket.rst:1873 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/socket.rst:741 +#: ../../library/socket.rst:788 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:746 +#: ../../library/socket.rst:793 msgid "Other functions" msgstr "" -#: ../../library/socket.rst:748 +#: ../../library/socket.rst:795 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:753 +#: ../../library/socket.rst:800 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:761 +#: ../../library/socket.rst:808 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -905,7 +973,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:768 +#: ../../library/socket.rst:815 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to narrow the list of addresses returned. Passing zero as a value for " @@ -916,15 +984,15 @@ msgid "" "domain name." msgstr "" -#: ../../library/socket.rst:776 +#: ../../library/socket.rst:823 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:778 +#: ../../library/socket.rst:825 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:780 +#: ../../library/socket.rst:827 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`.socket` function. *canonname* will be a string " @@ -936,30 +1004,30 @@ msgid "" "be passed to the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:790 +#: ../../library/socket.rst:848 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." msgstr "" -#: ../../library/socket.rst:792 +#: ../../library/socket.rst:839 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:802 +#: ../../library/socket.rst:849 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:805 +#: ../../library/socket.rst:852 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:811 +#: ../../library/socket.rst:858 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -970,7 +1038,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:822 +#: ../../library/socket.rst:869 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -980,13 +1048,24 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:828 ../../library/socket.rst:842 +#: ../../library/socket.rst:886 ../../library/socket.rst:902 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" -#: ../../library/socket.rst:833 +#: ../../library/socket.rst:877 ../../library/socket.rst:893 +#: ../../library/socket.rst:906 ../../library/socket.rst:921 +#: ../../library/socket.rst:938 ../../library/socket.rst:949 +#: ../../library/socket.rst:960 ../../library/socket.rst:971 +#: ../../library/socket.rst:1295 ../../library/socket.rst:1342 +#: ../../library/socket.rst:1356 ../../library/socket.rst:1376 +#: ../../library/socket.rst:1423 ../../library/socket.rst:1469 +#: ../../library/socket.rst:1850 ../../library/socket.rst:1860 +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" + +#: ../../library/socket.rst:882 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a " "triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -998,25 +1077,25 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:847 +#: ../../library/socket.rst:898 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:850 +#: ../../library/socket.rst:912 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" -#: ../../library/socket.rst:852 +#: ../../library/socket.rst:903 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:858 +#: ../../library/socket.rst:911 msgid "" "Return a triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1027,13 +1106,13 @@ msgid "" "`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:866 +#: ../../library/socket.rst:930 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" -#: ../../library/socket.rst:871 +#: ../../library/socket.rst:926 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1041,24 +1120,24 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:876 +#: ../../library/socket.rst:931 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:879 +#: ../../library/socket.rst:934 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:881 +#: ../../library/socket.rst:947 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" -#: ../../library/socket.rst:885 +#: ../../library/socket.rst:943 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to the :func:`.socket` " @@ -1067,66 +1146,66 @@ msgid "" "chosen automatically if the protocol is omitted or zero." msgstr "" -#: ../../library/socket.rst:894 +#: ../../library/socket.rst:954 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:898 +#: ../../library/socket.rst:969 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." msgstr "" -#: ../../library/socket.rst:903 +#: ../../library/socket.rst:965 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:907 +#: ../../library/socket.rst:980 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." msgstr "" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:976 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:919 +#: ../../library/socket.rst:983 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:923 ../../library/socket.rst:941 +#: ../../library/socket.rst:987 ../../library/socket.rst:1005 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:930 +#: ../../library/socket.rst:994 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:937 +#: ../../library/socket.rst:1001 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:948 +#: ../../library/socket.rst:1012 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1135,26 +1214,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:954 +#: ../../library/socket.rst:1018 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:957 +#: ../../library/socket.rst:1021 msgid "" "If the IPv4 address string passed to this function is invalid, :exc:" "`OSError` will be raised. Note that exactly what is valid depends on the " "underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:961 +#: ../../library/socket.rst:1025 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:967 +#: ../../library/socket.rst:1031 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1164,7 +1243,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:974 +#: ../../library/socket.rst:1038 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1172,7 +1251,7 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:985 +#: ../../library/socket.rst:1049 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " @@ -1180,7 +1259,7 @@ msgid "" "`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:990 +#: ../../library/socket.rst:1054 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" @@ -1189,16 +1268,15 @@ msgid "" "`inet_pton`." msgstr "" -#: ../../library/socket.rst:997 ../../library/socket.rst:1017 -msgid "" -":ref:`Availability `: Unix (maybe not all platforms), Windows." -msgstr "" +#: ../../library/socket.rst:1061 ../../library/socket.rst:1081 +msgid ":ref:`Availability `: Unix, Windows." +msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/socket.rst:998 ../../library/socket.rst:1018 +#: ../../library/socket.rst:1062 ../../library/socket.rst:1082 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1004 +#: ../../library/socket.rst:1068 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1207,7 +1285,7 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1011 +#: ../../library/socket.rst:1075 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " @@ -1215,7 +1293,7 @@ msgid "" "`OSError` is raised for errors from the call to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1033 +#: ../../library/socket.rst:1097 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1226,14 +1304,17 @@ msgid "" "the permissible range of values." msgstr "" -#: ../../library/socket.rst:1043 ../../library/socket.rst:1064 -#: ../../library/socket.rst:1509 ../../library/socket.rst:1551 -#: ../../library/socket.rst:1657 -msgid "" -":ref:`Availability `: most Unix platforms, possibly others." +#: ../../library/socket.rst:-1 +#, fuzzy +msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" + +#: ../../library/socket.rst:1108 ../../library/socket.rst:1598 +#: ../../library/socket.rst:1642 ../../library/socket.rst:1750 +msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1049 +#: ../../library/socket.rst:1115 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1243,7 +1324,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1057 +#: ../../library/socket.rst:1123 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1251,143 +1332,143 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1070 +#: ../../library/socket.rst:1131 +msgid "most Unix platforms." +msgstr "" + +#: ../../library/socket.rst:1138 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1077 +#: ../../library/socket.rst:1145 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " "socket module is first imported, the default is ``None``. See :meth:" "`~socket.settimeout` for possible values and their respective meanings." msgstr "" -#: ../../library/socket.rst:1085 +#: ../../library/socket.rst:1153 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1088 +#: ../../library/socket.rst:1167 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." msgstr "" -#: ../../library/socket.rst:1091 +#: ../../library/socket.rst:-1 ../../library/socket.rst:1159 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/socket.rst:1097 +#: ../../library/socket.rst:1165 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1102 ../../library/socket.rst:1129 -#: ../../library/socket.rst:1146 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix、Windows。" +#: ../../library/socket.rst:-1 ../../library/socket.rst:1170 +#: ../../library/socket.rst:1197 ../../library/socket.rst:1214 +#, fuzzy +msgid "" +":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." +msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" -#: ../../library/socket.rst:1105 ../../library/socket.rst:1132 -#: ../../library/socket.rst:1149 +#: ../../library/socket.rst:1173 ../../library/socket.rst:1200 +#: ../../library/socket.rst:1217 msgid "Windows support was added." msgstr "" -#: ../../library/socket.rst:1110 +#: ../../library/socket.rst:1178 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1113 +#: ../../library/socket.rst:1181 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "" -#: ../../library/socket.rst:1114 +#: ../../library/socket.rst:1182 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1115 +#: ../../library/socket.rst:1183 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1116 +#: ../../library/socket.rst:1184 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1118 +#: ../../library/socket.rst:1186 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1124 +#: ../../library/socket.rst:1192 msgid "" "Return a network interface index number corresponding to an interface name. :" "exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1136 ../../library/socket.rst:1153 +#: ../../library/socket.rst:1204 ../../library/socket.rst:1221 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1141 +#: ../../library/socket.rst:1209 msgid "" "Return a network interface name corresponding to an interface index number. :" "exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1158 +#: ../../library/socket.rst:1226 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" "`sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1163 +#: ../../library/socket.rst:1232 ../../library/socket.rst:1246 msgid "" -":ref:`Availability `: Unix supporting :meth:`~socket.sendmsg` " -"and :const:`SCM_RIGHTS` mechanism." +"Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " +"mechanism." msgstr "" -#: ../../library/socket.rst:1169 +#: ../../library/socket.rst:1240 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`recvmsg` " "for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1174 -msgid "" -":ref:`Availability `: Unix supporting :meth:`~socket.recvmsg` " -"and :const:`SCM_RIGHTS` mechanism." -msgstr "" - -#: ../../library/socket.rst:1179 +#: ../../library/socket.rst:1253 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1185 +#: ../../library/socket.rst:1259 msgid "Socket Objects" msgstr "" -#: ../../library/socket.rst:1187 +#: ../../library/socket.rst:1261 msgid "" "Socket objects have the following methods. Except for :meth:`~socket." "makefile`, these correspond to Unix system calls applicable to sockets." msgstr "" -#: ../../library/socket.rst:1191 +#: ../../library/socket.rst:1265 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1198 +#: ../../library/socket.rst:1272 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1396,33 +1477,33 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1205 ../../library/socket.rst:1292 +#: ../../library/socket.rst:1279 ../../library/socket.rst:1373 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1208 ../../library/socket.rst:1423 -#: ../../library/socket.rst:1437 ../../library/socket.rst:1512 -#: ../../library/socket.rst:1583 ../../library/socket.rst:1602 -#: ../../library/socket.rst:1619 ../../library/socket.rst:1662 +#: ../../library/socket.rst:1282 ../../library/socket.rst:1511 +#: ../../library/socket.rst:1525 ../../library/socket.rst:1602 +#: ../../library/socket.rst:1675 ../../library/socket.rst:1694 +#: ../../library/socket.rst:1711 ../../library/socket.rst:1756 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the method now retries the system call instead of raising an :exc:" "`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1216 +#: ../../library/socket.rst:1290 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1219 +#: ../../library/socket.rst:1304 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." msgstr "" -#: ../../library/socket.rst:1223 +#: ../../library/socket.rst:1300 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile()` are " @@ -1431,20 +1512,20 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1229 +#: ../../library/socket.rst:1306 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1233 +#: ../../library/socket.rst:1310 msgid "" ":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" "`close` call is made." msgstr "" -#: ../../library/socket.rst:1239 +#: ../../library/socket.rst:1316 msgid "" ":meth:`close()` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " @@ -1452,13 +1533,13 @@ msgid "" "`close()`." msgstr "" -#: ../../library/socket.rst:1247 +#: ../../library/socket.rst:1324 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1250 +#: ../../library/socket.rst:1327 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " @@ -1468,13 +1549,13 @@ msgid "" "(or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1257 ../../library/socket.rst:1275 +#: ../../library/socket.rst:1345 ../../library/socket.rst:1365 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." msgstr "" -#: ../../library/socket.rst:1259 +#: ../../library/socket.rst:1336 msgid "" "The method now waits until the connection completes instead of raising an :" "exc:`InterruptedError` exception if the connection is interrupted by a " @@ -1482,7 +1563,7 @@ msgid "" "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1268 +#: ../../library/socket.rst:1347 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1492,38 +1573,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1279 +#: ../../library/socket.rst:1360 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1288 +#: ../../library/socket.rst:1369 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1298 +#: ../../library/socket.rst:1381 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1301 +#: ../../library/socket.rst:1384 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1307 +#: ../../library/socket.rst:1390 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1316 +#: ../../library/socket.rst:1399 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1531,14 +1612,14 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1324 +#: ../../library/socket.rst:1407 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1331 +#: ../../library/socket.rst:1414 msgid "" "Return the value of the given socket option (see the Unix man page :manpage:" "`getsockopt(2)`). The needed symbolic constants (:const:`SO_\\*` etc.) are " @@ -1550,16 +1631,16 @@ msgid "" "`struct` for a way to decode C structures encoded as byte strings)." msgstr "" -#: ../../library/socket.rst:1343 +#: ../../library/socket.rst:1428 msgid "" "Return ``True`` if socket is in blocking mode, ``False`` if in non-blocking." msgstr "" -#: ../../library/socket.rst:1346 +#: ../../library/socket.rst:1431 msgid "This is equivalent to checking ``socket.gettimeout() == 0``." msgstr "" -#: ../../library/socket.rst:1353 +#: ../../library/socket.rst:1438 msgid "" "Return the timeout in seconds (float) associated with socket operations, or " "``None`` if no timeout is set. This reflects the last call to :meth:" @@ -1570,30 +1651,30 @@ msgstr "" msgid "platform" msgstr "平台" -#: ../../library/socket.rst:1360 +#: ../../library/socket.rst:1445 msgid "Windows" msgstr "Windows" -#: ../../library/socket.rst:1362 +#: ../../library/socket.rst:1447 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " "interface. Please refer to the `Win32 documentation `_ for more information." msgstr "" -#: ../../library/socket.rst:1367 +#: ../../library/socket.rst:1452 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1370 +#: ../../library/socket.rst:1455 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1378 +#: ../../library/socket.rst:1463 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1601,11 +1682,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1383 +#: ../../library/socket.rst:1470 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1391 +#: ../../library/socket.rst:1479 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1614,28 +1695,28 @@ msgid "" "``'b'``." msgstr "" -#: ../../library/socket.rst:1396 +#: ../../library/socket.rst:1484 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1400 +#: ../../library/socket.rst:1488 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " "original socket unless all other file objects have been closed and :meth:" "`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1406 +#: ../../library/socket.rst:1494 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1413 +#: ../../library/socket.rst:1501 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " @@ -1644,13 +1725,13 @@ msgid "" "zero." msgstr "" -#: ../../library/socket.rst:1420 +#: ../../library/socket.rst:1508 msgid "" "For best match with hardware and network realities, the value of *bufsize* " "should be a relatively small power of 2, for example, 4096." msgstr "" -#: ../../library/socket.rst:1431 +#: ../../library/socket.rst:1519 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1660,14 +1741,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1442 +#: ../../library/socket.rst:1530 msgid "" "For multicast IPv6 address, first item of *address* does not contain ``" "%scope_id`` part anymore. In order to get full IPv6 address use :func:" "`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1449 +#: ../../library/socket.rst:1537 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1678,7 +1759,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1459 +#: ../../library/socket.rst:1547 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1693,7 +1774,7 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1473 +#: ../../library/socket.rst:1561 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " @@ -1706,7 +1787,7 @@ msgid "" "descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1484 +#: ../../library/socket.rst:1572 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " @@ -1715,7 +1796,7 @@ msgid "" "provided it has not been truncated before the start of its associated data." msgstr "" -#: ../../library/socket.rst:1491 +#: ../../library/socket.rst:1579 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " @@ -1724,7 +1805,7 @@ msgid "" "meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1520 +#: ../../library/socket.rst:1610 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" "`recvmsg` would, but scatter the non-ancillary data into a series of buffers " @@ -1737,7 +1818,7 @@ msgid "" "arguments have the same meaning as for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1531 +#: ../../library/socket.rst:1621 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -1745,14 +1826,14 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1536 +#: ../../library/socket.rst:1626 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/socket.rst:1557 +#: ../../library/socket.rst:1649 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -1762,7 +1843,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1567 +#: ../../library/socket.rst:1659 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -1771,7 +1852,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1576 +#: ../../library/socket.rst:1668 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -1781,7 +1862,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1683 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -1791,13 +1872,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1598 +#: ../../library/socket.rst:1690 msgid "" "The socket timeout is no more reset each time data is sent successfully. The " "socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1611 +#: ../../library/socket.rst:1703 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -1806,13 +1887,13 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1617 +#: ../../library/socket.rst:1720 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." msgstr "" -#: ../../library/socket.rst:1627 +#: ../../library/socket.rst:1719 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " @@ -1832,27 +1913,32 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1647 +#: ../../library/socket.rst:1739 msgid "" "The following function sends the list of file descriptors *fds* over an :" "const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1658 +#: ../../library/socket.rst:-1 +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" + +#: ../../library/socket.rst:1763 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." msgstr "" -#: ../../library/socket.rst:1669 +#: ../../library/socket.rst:1763 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1678 +#: ../../library/socket.rst:1772 msgid "" "Send a file until EOF is reached by using high-performance :mod:`os." "sendfile` and return the total number of bytes which were sent. *file* must " @@ -1866,38 +1952,38 @@ msgid "" "be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1694 +#: ../../library/socket.rst:1788 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1702 +#: ../../library/socket.rst:1796 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1705 +#: ../../library/socket.rst:1799 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1707 +#: ../../library/socket.rst:1801 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1709 +#: ../../library/socket.rst:1803 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1711 +#: ../../library/socket.rst:1805 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1718 +#: ../../library/socket.rst:1812 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating point number expressing seconds, or ``None``. If a non-" @@ -1907,19 +1993,19 @@ msgid "" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1725 +#: ../../library/socket.rst:1819 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1727 +#: ../../library/socket.rst:1821 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1740 +#: ../../library/socket.rst:1834 msgid "" "Set the value of the given socket option (see the Unix manual page :manpage:" "`setsockopt(2)`). The needed symbolic constants are defined in the :mod:" @@ -1932,11 +2018,11 @@ msgid "" "C function with ``optval=NULL`` and ``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1754 +#: ../../library/socket.rst:1847 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:1760 +#: ../../library/socket.rst:1855 msgid "" "Shut down one or both halves of the connection. If *how* is :const:" "`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " @@ -1944,7 +2030,7 @@ msgid "" "and receives are disallowed." msgstr "" -#: ../../library/socket.rst:1768 +#: ../../library/socket.rst:1865 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " @@ -1955,48 +2041,48 @@ msgid "" "process." msgstr "" -#: ../../library/socket.rst:1780 +#: ../../library/socket.rst:1877 msgid "" "Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" "`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." msgstr "" -#: ../../library/socket.rst:1783 +#: ../../library/socket.rst:1880 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:1789 +#: ../../library/socket.rst:1886 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:1794 +#: ../../library/socket.rst:1891 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:1799 +#: ../../library/socket.rst:1896 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:1806 +#: ../../library/socket.rst:1903 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:1808 +#: ../../library/socket.rst:1905 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:1812 +#: ../../library/socket.rst:1909 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:1815 +#: ../../library/socket.rst:1912 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2004,14 +2090,14 @@ msgid "" "for reading or writing." msgstr "" -#: ../../library/socket.rst:1820 +#: ../../library/socket.rst:1917 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:1825 +#: ../../library/socket.rst:1922 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2020,11 +2106,11 @@ msgid "" "you decide to use the :meth:`~socket.fileno()` of a socket." msgstr "" -#: ../../library/socket.rst:1832 +#: ../../library/socket.rst:1929 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:1834 +#: ../../library/socket.rst:1931 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " @@ -2034,24 +2120,24 @@ msgid "" "setting." msgstr "" -#: ../../library/socket.rst:1842 +#: ../../library/socket.rst:1939 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:1844 +#: ../../library/socket.rst:1941 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" "meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " "depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:1848 +#: ../../library/socket.rst:1945 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:1851 +#: ../../library/socket.rst:1948 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2059,11 +2145,11 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:1860 +#: ../../library/socket.rst:1957 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:1862 +#: ../../library/socket.rst:1959 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2076,14 +2162,14 @@ msgid "" "new socket returned by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:1872 +#: ../../library/socket.rst:1969 msgid "The first two examples support IPv4 only. ::" msgstr "" "前兩個範例只支援 IPv4:\n" "\n" "::" -#: ../../library/socket.rst:1903 +#: ../../library/socket.rst:2000 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2093,73 +2179,73 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:1975 +#: ../../library/socket.rst:2072 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2000 +#: ../../library/socket.rst:2097 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2006 +#: ../../library/socket.rst:2103 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send`, and the :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2010 +#: ../../library/socket.rst:2107 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2050 +#: ../../library/socket.rst:2147 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2055 +#: ../../library/socket.rst:2152 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2058 +#: ../../library/socket.rst:2155 msgid "" "There is a :mod:`socket` flag to set, in order to prevent this, :data:" "`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2065 +#: ../../library/socket.rst:2162 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2071 +#: ../../library/socket.rst:2168 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2073 +#: ../../library/socket.rst:2170 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2075 +#: ../../library/socket.rst:2172 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2078 +#: ../../library/socket.rst:2175 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " diff --git a/library/socketserver.po b/library/socketserver.po index 1b423a674e..24894cb830 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -32,11 +32,22 @@ msgid "" "servers." msgstr "" -#: ../../library/socketserver.rst:13 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/socketserver.rst:15 msgid "There are four basic concrete server classes:" msgstr "" -#: ../../library/socketserver.rst:18 +#: ../../library/socketserver.rst:20 msgid "" "This uses the internet TCP protocol, which provides for continuous streams " "of data between the client and server. If *bind_and_activate* is true, the " @@ -45,21 +56,21 @@ msgid "" "the :class:`BaseServer` base class." msgstr "" -#: ../../library/socketserver.rst:28 +#: ../../library/socketserver.rst:30 msgid "" "This uses datagrams, which are discrete packets of information that may " "arrive out of order or be lost while in transit. The parameters are the " "same as for :class:`TCPServer`." msgstr "" -#: ../../library/socketserver.rst:36 +#: ../../library/socketserver.rst:38 msgid "" "These more infrequently used classes are similar to the TCP and UDP classes, " "but use Unix domain sockets; they're not available on non-Unix platforms. " "The parameters are the same as for :class:`TCPServer`." msgstr "" -#: ../../library/socketserver.rst:42 +#: ../../library/socketserver.rst:44 msgid "" "These four classes process requests :dfn:`synchronously`; each request must " "be completed before the next request can be started. This isn't suitable if " @@ -70,7 +81,7 @@ msgid "" "classes can be used to support asynchronous behaviour." msgstr "" -#: ../../library/socketserver.rst:50 +#: ../../library/socketserver.rst:52 msgid "" "Creating a server requires several steps. First, you must create a request " "handler class by subclassing the :class:`BaseRequestHandler` class and " @@ -84,7 +95,7 @@ msgid "" "keyword:`!with` statement)." msgstr "" -#: ../../library/socketserver.rst:62 +#: ../../library/socketserver.rst:64 msgid "" "When inheriting from :class:`ThreadingMixIn` for threaded connection " "behavior, you should explicitly declare how you want your threads to behave " @@ -96,23 +107,23 @@ msgid "" "`ThreadingMixIn` have exited." msgstr "" -#: ../../library/socketserver.rst:71 +#: ../../library/socketserver.rst:73 msgid "" "Server classes have the same external methods and attributes, no matter what " "network protocol they use." msgstr "" -#: ../../library/socketserver.rst:76 +#: ../../library/socketserver.rst:78 msgid "Server Creation Notes" msgstr "" -#: ../../library/socketserver.rst:78 +#: ../../library/socketserver.rst:80 msgid "" "There are five classes in an inheritance diagram, four of which represent " "synchronous servers of four types::" msgstr "" -#: ../../library/socketserver.rst:95 +#: ../../library/socketserver.rst:97 msgid "" "Note that :class:`UnixDatagramServer` derives from :class:`UDPServer`, not " "from :class:`UnixStreamServer` --- the only difference between an IP and a " @@ -120,34 +131,34 @@ msgid "" "Unix server classes." msgstr "" -#: ../../library/socketserver.rst:104 +#: ../../library/socketserver.rst:106 msgid "" "Forking and threading versions of each type of server can be created using " "these mix-in classes. For instance, :class:`ThreadingUDPServer` is created " "as follows::" msgstr "" -#: ../../library/socketserver.rst:111 +#: ../../library/socketserver.rst:113 msgid "" "The mix-in class comes first, since it overrides a method defined in :class:" "`UDPServer`. Setting the various attributes also changes the behavior of " "the underlying server mechanism." msgstr "" -#: ../../library/socketserver.rst:115 +#: ../../library/socketserver.rst:117 msgid "" ":class:`ForkingMixIn` and the Forking classes mentioned below are only " "available on POSIX platforms that support :func:`~os.fork`." msgstr "" -#: ../../library/socketserver.rst:118 +#: ../../library/socketserver.rst:120 msgid "" ":meth:`socketserver.ForkingMixIn.server_close` waits until all child " "processes complete, except if :attr:`socketserver.ForkingMixIn." "block_on_close` attribute is false." msgstr "" -#: ../../library/socketserver.rst:122 +#: ../../library/socketserver.rst:124 msgid "" ":meth:`socketserver.ThreadingMixIn.server_close` waits until all non-daemon " "threads complete, except if :attr:`socketserver.ThreadingMixIn." @@ -156,7 +167,7 @@ msgid "" "complete." msgstr "" -#: ../../library/socketserver.rst:131 +#: ../../library/socketserver.rst:133 msgid "" ":meth:`socketserver.ForkingMixIn.server_close` and :meth:`socketserver." "ThreadingMixIn.server_close` now waits until all child processes and non-" @@ -164,11 +175,11 @@ msgid "" "block_on_close` class attribute to opt-in for the pre-3.7 behaviour." msgstr "" -#: ../../library/socketserver.rst:143 +#: ../../library/socketserver.rst:145 msgid "These classes are pre-defined using the mix-in classes." msgstr "" -#: ../../library/socketserver.rst:146 +#: ../../library/socketserver.rst:148 msgid "" "To implement a service, you must derive a class from :class:" "`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " @@ -179,7 +190,7 @@ msgid "" "`DatagramRequestHandler`." msgstr "" -#: ../../library/socketserver.rst:154 +#: ../../library/socketserver.rst:156 msgid "" "Of course, you still have to use your head! For instance, it makes no sense " "to use a forking server if the service contains state in memory that can be " @@ -189,7 +200,7 @@ msgid "" "probably have to use locks to protect the integrity of the shared data." msgstr "" -#: ../../library/socketserver.rst:161 +#: ../../library/socketserver.rst:163 msgid "" "On the other hand, if you are building an HTTP server where all data is " "stored externally (for instance, in the file system), a synchronous class " @@ -199,7 +210,7 @@ msgid "" "appropriate." msgstr "" -#: ../../library/socketserver.rst:167 +#: ../../library/socketserver.rst:169 msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " @@ -208,7 +219,7 @@ msgid "" "`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:172 +#: ../../library/socketserver.rst:174 msgid "" "Another approach to handling multiple simultaneous requests in an " "environment that supports neither threads nor :func:`~os.fork` (or where " @@ -221,11 +232,11 @@ msgid "" "this." msgstr "" -#: ../../library/socketserver.rst:186 +#: ../../library/socketserver.rst:188 msgid "Server Objects" msgstr "" -#: ../../library/socketserver.rst:190 +#: ../../library/socketserver.rst:192 msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " @@ -233,14 +244,14 @@ msgid "" "`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" -#: ../../library/socketserver.rst:198 +#: ../../library/socketserver.rst:200 msgid "" "Return an integer file descriptor for the socket on which the server is " "listening. This function is most commonly passed to :mod:`selectors`, to " "allow monitoring multiple servers in the same process." msgstr "" -#: ../../library/socketserver.rst:205 +#: ../../library/socketserver.rst:207 msgid "" "Process a single request. This function calls the following methods in " "order: :meth:`get_request`, :meth:`verify_request`, and :meth:" @@ -251,7 +262,7 @@ msgid "" "`handle_request` will return." msgstr "" -#: ../../library/socketserver.rst:217 +#: ../../library/socketserver.rst:219 msgid "" "Handle requests until an explicit :meth:`shutdown` request. Poll for " "shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` " @@ -261,41 +272,41 @@ msgid "" "clean up zombie child processes." msgstr "" -#: ../../library/socketserver.rst:225 +#: ../../library/socketserver.rst:227 msgid "Added ``service_actions`` call to the ``serve_forever`` method." msgstr "" -#: ../../library/socketserver.rst:231 +#: ../../library/socketserver.rst:233 msgid "" "This is called in the :meth:`serve_forever` loop. This method can be " "overridden by subclasses or mixin classes to perform actions specific to a " "given service, such as cleanup actions." msgstr "" -#: ../../library/socketserver.rst:239 +#: ../../library/socketserver.rst:241 msgid "" "Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" "`shutdown` must be called while :meth:`serve_forever` is running in a " "different thread otherwise it will deadlock." msgstr "" -#: ../../library/socketserver.rst:246 +#: ../../library/socketserver.rst:248 msgid "Clean up the server. May be overridden." msgstr "" -#: ../../library/socketserver.rst:251 +#: ../../library/socketserver.rst:253 msgid "" "The family of protocols to which the server's socket belongs. Common " "examples are :const:`socket.AF_INET` and :const:`socket.AF_UNIX`." msgstr "" -#: ../../library/socketserver.rst:257 +#: ../../library/socketserver.rst:259 msgid "" "The user-provided request handler class; an instance of this class is " "created for each request." msgstr "" -#: ../../library/socketserver.rst:263 +#: ../../library/socketserver.rst:265 msgid "" "The address on which the server is listening. The format of addresses " "varies depending on the protocol family; see the documentation for the :mod:" @@ -304,22 +315,22 @@ msgid "" "``('127.0.0.1', 80)``, for example." msgstr "" -#: ../../library/socketserver.rst:272 +#: ../../library/socketserver.rst:274 msgid "" "The socket object on which the server will listen for incoming requests." msgstr "" -#: ../../library/socketserver.rst:275 +#: ../../library/socketserver.rst:277 msgid "The server classes support the following class variables:" msgstr "" -#: ../../library/socketserver.rst:281 +#: ../../library/socketserver.rst:283 msgid "" "Whether the server will allow the reuse of an address. This defaults to :" "const:`False`, and can be set in subclasses to change the policy." msgstr "" -#: ../../library/socketserver.rst:287 +#: ../../library/socketserver.rst:289 msgid "" "The size of the request queue. If it takes a long time to process a single " "request, any requests that arrive while the server is busy are placed into a " @@ -328,40 +339,40 @@ msgid "" "default value is usually 5, but this can be overridden by subclasses." msgstr "" -#: ../../library/socketserver.rst:296 +#: ../../library/socketserver.rst:298 msgid "" "The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" "const:`socket.SOCK_DGRAM` are two common values." msgstr "" -#: ../../library/socketserver.rst:302 +#: ../../library/socketserver.rst:304 msgid "" "Timeout duration, measured in seconds, or :const:`None` if no timeout is " "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -#: ../../library/socketserver.rst:307 +#: ../../library/socketserver.rst:309 msgid "" "There are various server methods that can be overridden by subclasses of " "base server classes like :class:`TCPServer`; these methods aren't useful to " "external users of the server object." msgstr "" -#: ../../library/socketserver.rst:316 +#: ../../library/socketserver.rst:318 msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:322 +#: ../../library/socketserver.rst:324 msgid "" "Must accept a request from the socket, and return a 2-tuple containing the " "*new* socket object to be used to communicate with the client, and the " "client's address." msgstr "" -#: ../../library/socketserver.rst:329 +#: ../../library/socketserver.rst:331 msgid "" "This function is called if the :meth:`~BaseRequestHandler.handle` method of " "a :attr:`RequestHandlerClass` instance raises an exception. The default " @@ -369,11 +380,11 @@ msgid "" "further requests." msgstr "" -#: ../../library/socketserver.rst:334 +#: ../../library/socketserver.rst:336 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" -#: ../../library/socketserver.rst:341 +#: ../../library/socketserver.rst:343 msgid "" "This function is called when the :attr:`timeout` attribute has been set to a " "value other than :const:`None` and the timeout period has passed with no " @@ -382,7 +393,7 @@ msgid "" "threading servers this method does nothing." msgstr "" -#: ../../library/socketserver.rst:350 +#: ../../library/socketserver.rst:352 msgid "" "Calls :meth:`finish_request` to create an instance of the :attr:" "`RequestHandlerClass`. If desired, this function can create a new process " @@ -390,20 +401,20 @@ msgid "" "`ThreadingMixIn` classes do this." msgstr "" -#: ../../library/socketserver.rst:362 +#: ../../library/socketserver.rst:364 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" -#: ../../library/socketserver.rst:369 +#: ../../library/socketserver.rst:371 msgid "" "Called by the server's constructor to bind the socket to the desired " "address. May be overridden." msgstr "" -#: ../../library/socketserver.rst:375 +#: ../../library/socketserver.rst:377 msgid "" "Must return a Boolean value; if the value is :const:`True`, the request will " "be processed, and if it's :const:`False`, the request will be denied. This " @@ -411,17 +422,17 @@ msgid "" "default implementation always returns :const:`True`." msgstr "" -#: ../../library/socketserver.rst:381 +#: ../../library/socketserver.rst:383 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`server_close`." msgstr "" -#: ../../library/socketserver.rst:387 +#: ../../library/socketserver.rst:389 msgid "Request Handler Objects" msgstr "" -#: ../../library/socketserver.rst:391 +#: ../../library/socketserver.rst:393 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " @@ -429,13 +440,13 @@ msgid "" "instance of the subclass is created for each request." msgstr "" -#: ../../library/socketserver.rst:400 +#: ../../library/socketserver.rst:402 msgid "" "Called before the :meth:`handle` method to perform any initialization " "actions required. The default implementation does nothing." msgstr "" -#: ../../library/socketserver.rst:406 +#: ../../library/socketserver.rst:408 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " @@ -444,21 +455,21 @@ msgid "" "attr:`self.server`, in case it needs access to per-server information." msgstr "" -#: ../../library/socketserver.rst:412 +#: ../../library/socketserver.rst:414 msgid "" "The type of :attr:`self.request` is different for datagram or stream " "services. For stream services, :attr:`self.request` is a socket object; for " "datagram services, :attr:`self.request` is a pair of string and socket." msgstr "" -#: ../../library/socketserver.rst:419 +#: ../../library/socketserver.rst:421 msgid "" "Called after the :meth:`handle` method to perform any clean-up actions " "required. The default implementation does nothing. If :meth:`setup` raises " "an exception, this function will not be called." msgstr "" -#: ../../library/socketserver.rst:427 +#: ../../library/socketserver.rst:429 msgid "" "These :class:`BaseRequestHandler` subclasses override the :meth:" "`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " @@ -467,39 +478,39 @@ msgid "" "respectively, to get the request data or return data to the client." msgstr "" -#: ../../library/socketserver.rst:434 +#: ../../library/socketserver.rst:436 msgid "" "The :attr:`rfile` attributes of both classes support the :class:`io." "BufferedIOBase` readable interface, and :attr:`DatagramRequestHandler.wfile` " "supports the :class:`io.BufferedIOBase` writable interface." msgstr "" -#: ../../library/socketserver.rst:439 +#: ../../library/socketserver.rst:441 msgid "" ":attr:`StreamRequestHandler.wfile` also supports the :class:`io." "BufferedIOBase` writable interface." msgstr "" -#: ../../library/socketserver.rst:445 +#: ../../library/socketserver.rst:447 msgid "Examples" msgstr "範例" -#: ../../library/socketserver.rst:448 +#: ../../library/socketserver.rst:450 msgid ":class:`socketserver.TCPServer` Example" msgstr ":class:`socketserver.TCPServer` 範例" -#: ../../library/socketserver.rst:450 ../../library/socketserver.rst:549 +#: ../../library/socketserver.rst:452 ../../library/socketserver.rst:551 msgid "This is the server side::" msgstr "" -#: ../../library/socketserver.rst:480 +#: ../../library/socketserver.rst:482 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: ../../library/socketserver.rst:495 +#: ../../library/socketserver.rst:497 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " @@ -507,47 +518,47 @@ msgid "" "has been sent from the client in one ``sendall()`` call." msgstr "" -#: ../../library/socketserver.rst:501 ../../library/socketserver.rst:573 +#: ../../library/socketserver.rst:503 ../../library/socketserver.rst:575 msgid "This is the client side::" msgstr "" -#: ../../library/socketserver.rst:522 ../../library/socketserver.rst:648 +#: ../../library/socketserver.rst:524 ../../library/socketserver.rst:650 msgid "The output of the example should look something like this:" msgstr "" -#: ../../library/socketserver.rst:524 +#: ../../library/socketserver.rst:526 msgid "Server:" msgstr "" -#: ../../library/socketserver.rst:534 +#: ../../library/socketserver.rst:536 msgid "Client:" msgstr "" -#: ../../library/socketserver.rst:547 +#: ../../library/socketserver.rst:549 msgid ":class:`socketserver.UDPServer` Example" msgstr ":class:`socketserver.UDPServer` 範例" -#: ../../library/socketserver.rst:592 +#: ../../library/socketserver.rst:594 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: ../../library/socketserver.rst:596 +#: ../../library/socketserver.rst:598 msgid "Asynchronous Mixins" msgstr "" -#: ../../library/socketserver.rst:598 +#: ../../library/socketserver.rst:600 msgid "" "To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" "`ForkingMixIn` classes." msgstr "" -#: ../../library/socketserver.rst:601 +#: ../../library/socketserver.rst:603 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: ../../library/socketserver.rst:659 +#: ../../library/socketserver.rst:661 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/spwd.po b/library/spwd.po index 5550962cc2..9378266318 100644 --- a/library/spwd.po +++ b/library/spwd.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:14+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr "" msgid ":mod:`spwd` --- The shadow password database" msgstr ":mod:`spwd` --- shadow 密碼資料庫" -#: ../../library/spwd.rst:9 +#: ../../library/spwd.rst:12 msgid "" "The :mod:`spwd` module is deprecated (see :pep:`PEP 594 <594#spwd>` for " "details and alternatives)." @@ -37,177 +37,188 @@ msgid "" "available on various Unix versions." msgstr "" -#: ../../library/spwd.rst:18 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/spwd.rst:20 msgid "" "You must have enough privileges to access the shadow password database (this " "usually means you have to be root)." msgstr "" -#: ../../library/spwd.rst:21 +#: ../../library/spwd.rst:23 msgid "" "Shadow password database entries are reported as a tuple-like object, whose " "attributes correspond to the members of the ``spwd`` structure (Attribute " "field below, see ````):" msgstr "" -#: ../../library/spwd.rst:26 +#: ../../library/spwd.rst:28 msgid "Index" msgstr "" -#: ../../library/spwd.rst:26 +#: ../../library/spwd.rst:28 msgid "Attribute" msgstr "屬性" -#: ../../library/spwd.rst:26 +#: ../../library/spwd.rst:28 msgid "Meaning" msgstr "" -#: ../../library/spwd.rst:28 +#: ../../library/spwd.rst:30 msgid "0" msgstr "0" -#: ../../library/spwd.rst:28 +#: ../../library/spwd.rst:30 msgid "``sp_namp``" msgstr "``sp_namp``" -#: ../../library/spwd.rst:28 +#: ../../library/spwd.rst:30 msgid "Login name" msgstr "" -#: ../../library/spwd.rst:30 +#: ../../library/spwd.rst:32 msgid "1" msgstr "1" -#: ../../library/spwd.rst:30 +#: ../../library/spwd.rst:32 msgid "``sp_pwdp``" msgstr "``sp_pwdp``" -#: ../../library/spwd.rst:30 +#: ../../library/spwd.rst:32 msgid "Encrypted password" msgstr "" -#: ../../library/spwd.rst:32 +#: ../../library/spwd.rst:34 msgid "2" msgstr "2" -#: ../../library/spwd.rst:32 +#: ../../library/spwd.rst:34 msgid "``sp_lstchg``" msgstr "``sp_lstchg``" -#: ../../library/spwd.rst:32 +#: ../../library/spwd.rst:34 msgid "Date of last change" msgstr "" -#: ../../library/spwd.rst:34 +#: ../../library/spwd.rst:36 msgid "3" msgstr "3" -#: ../../library/spwd.rst:34 +#: ../../library/spwd.rst:36 msgid "``sp_min``" msgstr "``sp_min``" -#: ../../library/spwd.rst:34 +#: ../../library/spwd.rst:36 msgid "Minimal number of days between changes" msgstr "" -#: ../../library/spwd.rst:37 +#: ../../library/spwd.rst:39 msgid "4" msgstr "4" -#: ../../library/spwd.rst:37 +#: ../../library/spwd.rst:39 msgid "``sp_max``" msgstr "``sp_max``" -#: ../../library/spwd.rst:37 +#: ../../library/spwd.rst:39 msgid "Maximum number of days between changes" msgstr "" -#: ../../library/spwd.rst:40 +#: ../../library/spwd.rst:42 msgid "5" msgstr "5" -#: ../../library/spwd.rst:40 +#: ../../library/spwd.rst:42 msgid "``sp_warn``" msgstr "``sp_warn``" -#: ../../library/spwd.rst:40 +#: ../../library/spwd.rst:42 msgid "Number of days before password expires to warn user about it" msgstr "" -#: ../../library/spwd.rst:43 +#: ../../library/spwd.rst:45 msgid "6" msgstr "6" -#: ../../library/spwd.rst:43 +#: ../../library/spwd.rst:45 msgid "``sp_inact``" msgstr "``sp_inact``" -#: ../../library/spwd.rst:43 +#: ../../library/spwd.rst:45 msgid "Number of days after password expires until account is disabled" msgstr "" -#: ../../library/spwd.rst:47 +#: ../../library/spwd.rst:49 msgid "7" msgstr "7" -#: ../../library/spwd.rst:47 +#: ../../library/spwd.rst:49 msgid "``sp_expire``" msgstr "``sp_expire``" -#: ../../library/spwd.rst:47 +#: ../../library/spwd.rst:49 msgid "Number of days since 1970-01-01 when account expires" msgstr "" -#: ../../library/spwd.rst:50 +#: ../../library/spwd.rst:52 msgid "8" msgstr "8" -#: ../../library/spwd.rst:50 +#: ../../library/spwd.rst:52 msgid "``sp_flag``" msgstr "``sp_flag``" -#: ../../library/spwd.rst:50 +#: ../../library/spwd.rst:52 msgid "Reserved" msgstr "" -#: ../../library/spwd.rst:53 +#: ../../library/spwd.rst:55 msgid "" "The sp_namp and sp_pwdp items are strings, all others are integers. :exc:" "`KeyError` is raised if the entry asked for cannot be found." msgstr "" -#: ../../library/spwd.rst:56 +#: ../../library/spwd.rst:58 msgid "The following functions are defined:" msgstr "" -#: ../../library/spwd.rst:61 +#: ../../library/spwd.rst:63 msgid "Return the shadow password database entry for the given user name." msgstr "" -#: ../../library/spwd.rst:63 +#: ../../library/spwd.rst:65 msgid "" "Raises a :exc:`PermissionError` instead of :exc:`KeyError` if the user " "doesn't have privileges." msgstr "" -#: ../../library/spwd.rst:69 +#: ../../library/spwd.rst:71 msgid "" "Return a list of all available shadow password database entries, in " "arbitrary order." msgstr "" -#: ../../library/spwd.rst:76 +#: ../../library/spwd.rst:78 msgid "Module :mod:`grp`" msgstr ":mod:`grp` 模組" -#: ../../library/spwd.rst:76 +#: ../../library/spwd.rst:78 msgid "An interface to the group database, similar to this." msgstr "" -#: ../../library/spwd.rst:78 +#: ../../library/spwd.rst:80 msgid "Module :mod:`pwd`" msgstr ":mod:`pwd` 模組" -#: ../../library/spwd.rst:79 +#: ../../library/spwd.rst:81 msgid "An interface to the normal password database, similar to this." msgstr "" diff --git a/library/sqlite3.po b/library/sqlite3.po index b6b8c0a866..41c64624ff 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -236,7 +236,7 @@ msgstr "" msgid ":ref:`sqlite3-converters`" msgstr "" -#: ../../library/sqlite3.rst:241 ../../library/sqlite3.rst:514 +#: ../../library/sqlite3.rst:241 ../../library/sqlite3.rst:556 msgid ":ref:`sqlite3-connection-context-manager`" msgstr "" @@ -313,7 +313,7 @@ msgstr "" #: ../../library/sqlite3.rst:310 msgid "" "The number of statements that :mod:`!sqlite3` should internally cache for " -"this connection, to avoid parsing overhead. By default, 100 statements." +"this connection, to avoid parsing overhead. By default, 128 statements." msgstr "" #: ../../library/sqlite3.rst:315 @@ -379,10 +379,16 @@ msgid "" "tracebacks in user-defined functions, aggregates, converters, authorizer " "callbacks etc. If you want to debug them, you can call this function with " "*flag* set to ``True``. Afterwards, you will get tracebacks from callbacks " -"on ``sys.stderr``. Use ``False`` to disable the feature again." +"on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:370 +#: ../../library/sqlite3.rst:368 +msgid "" +"Register an :func:`unraisable hook handler ` for an " +"improved debug experience:" +msgstr "" + +#: ../../library/sqlite3.rst:393 msgid "" "Register an *adapter* callable to adapt the Python type *type* into an " "SQLite type. The adapter is called with a Python object of type *type* as " @@ -390,7 +396,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:378 +#: ../../library/sqlite3.rst:401 msgid "" "Register the *converter* callable to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -400,17 +406,17 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:386 +#: ../../library/sqlite3.rst:409 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:393 +#: ../../library/sqlite3.rst:416 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:397 +#: ../../library/sqlite3.rst:420 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function by using the type name, parsed from the query " @@ -418,13 +424,13 @@ msgid "" "in square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:407 +#: ../../library/sqlite3.rst:430 msgid "" "This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:412 +#: ../../library/sqlite3.rst:435 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function using the declared types for each column. The " @@ -433,46 +439,46 @@ msgid "" "the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:428 +#: ../../library/sqlite3.rst:451 msgid "" "This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:458 msgid "" "Flags that should be returned by the *authorizer_callback* callable passed " "to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: ../../library/sqlite3.rst:438 +#: ../../library/sqlite3.rst:461 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:439 +#: ../../library/sqlite3.rst:462 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:440 +#: ../../library/sqlite3.rst:463 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:444 +#: ../../library/sqlite3.rst:467 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:449 +#: ../../library/sqlite3.rst:472 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:455 +#: ../../library/sqlite3.rst:478 msgid "" "The :mod:`!sqlite3` module supports both ``qmark`` and ``numeric`` DB-API " "parameter styles, because that is what the underlying SQLite library " @@ -480,169 +486,287 @@ msgid "" "``paramstyle`` attribute." msgstr "" -#: ../../library/sqlite3.rst:462 +#: ../../library/sqlite3.rst:485 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:466 +#: ../../library/sqlite3.rst:489 msgid "" "Version number of the runtime SQLite library as a :class:`tuple` of :class:" "`integers `." msgstr "" -#: ../../library/sqlite3.rst:471 +#: ../../library/sqlite3.rst:494 +msgid "" +"Integer constant required by the DB-API 2.0, stating the level of thread " +"safety the :mod:`!sqlite3` module supports. This attribute is set based on " +"the default `threading mode `_ the " +"underlying SQLite library is compiled with. The SQLite threading modes are:" +msgstr "" + +#: ../../library/sqlite3.rst:499 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 *" -"\"Threads may share the module, but not connections.\"* However, this may " -"not always be true. You can check the underlying SQLite library's compile-" -"time threaded mode using the following query::" +"**Single-thread**: In this mode, all mutexes are disabled and SQLite is " +"unsafe to use in more than a single thread at once." msgstr "" -#: ../../library/sqlite3.rst:484 +#: ../../library/sqlite3.rst:501 msgid "" -"Note that the `SQLITE_THREADSAFE levels `_ do not match the DB-API 2.0 ``threadsafety`` levels." +"**Multi-thread**: In this mode, SQLite can be safely used by multiple " +"threads provided that no single database connection is used simultaneously " +"in two or more threads." msgstr "" -#: ../../library/sqlite3.rst:490 +#: ../../library/sqlite3.rst:504 +msgid "" +"**Serialized**: In serialized mode, SQLite can be safely used by multiple " +"threads with no restriction." +msgstr "" + +#: ../../library/sqlite3.rst:507 +msgid "" +"The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " +"are as follows:" +msgstr "" + +#: ../../library/sqlite3.rst:511 +msgid "SQLite threading mode" +msgstr "" + +#: ../../library/sqlite3.rst:511 +msgid "`threadsafety`_" +msgstr "" + +#: ../../library/sqlite3.rst:511 +msgid "`SQLITE_THREADSAFE`_" +msgstr "" + +#: ../../library/sqlite3.rst:511 +msgid "DB-API 2.0 meaning" +msgstr "" + +#: ../../library/sqlite3.rst:514 +msgid "single-thread" +msgstr "" + +#: ../../library/sqlite3.rst:514 +msgid "0" +msgstr "" + +#: ../../library/sqlite3.rst:514 +msgid "Threads may not share the module" +msgstr "" + +#: ../../library/sqlite3.rst:517 +msgid "multi-thread" +msgstr "" + +#: ../../library/sqlite3.rst:517 ../../library/sqlite3.rst:520 +msgid "1" +msgstr "" + +#: ../../library/sqlite3.rst:517 +msgid "2" +msgstr "" + +#: ../../library/sqlite3.rst:517 +msgid "Threads may share the module, but not connections" +msgstr "" + +#: ../../library/sqlite3.rst:520 +msgid "serialized" +msgstr "" + +#: ../../library/sqlite3.rst:520 +msgid "3" +msgstr "" + +#: ../../library/sqlite3.rst:520 +msgid "Threads may share the module, connections and cursors" +msgstr "" + +#: ../../library/sqlite3.rst:527 +msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." +msgstr "" + +#: ../../library/sqlite3.rst:532 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:495 +#: ../../library/sqlite3.rst:537 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:502 +#: ../../library/sqlite3.rst:544 msgid "Connection objects" msgstr "" -#: ../../library/sqlite3.rst:506 +#: ../../library/sqlite3.rst:548 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " "is created using :func:`sqlite3.connect`. Their main purpose is creating :" "class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" -#: ../../library/sqlite3.rst:513 +#: ../../library/sqlite3.rst:555 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr "" -#: ../../library/sqlite3.rst:516 +#: ../../library/sqlite3.rst:558 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:520 +#: ../../library/sqlite3.rst:562 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a callable " "returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:527 +#: ../../library/sqlite3.rst:569 +msgid "" +"Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " +"OBject)`." +msgstr "" + +#: ../../library/sqlite3.rst:572 +msgid "The name of the table where the blob is located." +msgstr "" + +#: ../../library/sqlite3.rst:575 +msgid "The name of the column where the blob is located." +msgstr "" + +#: ../../library/sqlite3.rst:578 +msgid "The name of the row where the blob is located." +msgstr "" + +#: ../../library/sqlite3.rst:581 +msgid "" +"Set to ``True`` if the blob should be opened without write permissions. " +"Defaults to ``False``." +msgstr "" + +#: ../../library/sqlite3.rst:586 +msgid "" +"The name of the database where the blob is located. Defaults to ``\"main\"``." +msgstr "" + +#: ../../library/sqlite3.rst:0 +msgid "Raises" +msgstr "" + +#: ../../library/sqlite3.rst:590 +msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." +msgstr "" + +#: ../../library/sqlite3.rst:597 +msgid "" +"The blob size cannot be changed using the :class:`Blob` class. Use the SQL " +"function ``zeroblob`` to create a blob with a fixed size." +msgstr "" + +#: ../../library/sqlite3.rst:604 msgid "" "Commit any pending transaction to the database. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:609 msgid "" "Roll back to the start of any pending transaction. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:537 +#: ../../library/sqlite3.rst:614 msgid "" "Close the database connection. Any pending transaction is not committed " "implicitly; make sure to :meth:`commit` before closing to avoid losing " "pending changes." msgstr "" -#: ../../library/sqlite3.rst:544 +#: ../../library/sqlite3.rst:621 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:550 +#: ../../library/sqlite3.rst:627 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:556 +#: ../../library/sqlite3.rst:633 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:562 +#: ../../library/sqlite3.rst:639 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:564 +#: ../../library/sqlite3.rst:641 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:567 +#: ../../library/sqlite3.rst:644 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:571 +#: ../../library/sqlite3.rst:648 msgid "" "A callable that is called when the SQL function is invoked. The callable " "must return :ref:`a type natively supported by SQLite `. Set " "to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:578 +#: ../../library/sqlite3.rst:655 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:0 -msgid "Raises" -msgstr "" - -#: ../../library/sqlite3.rst:583 +#: ../../library/sqlite3.rst:660 msgid "If *deterministic* is used with SQLite versions older than 3.8.3." msgstr "" -#: ../../library/sqlite3.rst:586 +#: ../../library/sqlite3.rst:663 msgid "The *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:589 ../../library/sqlite3.rst:627 -#: ../../library/sqlite3.rst:846 ../../library/sqlite3.rst:952 -#: ../../library/sqlite3.rst:982 ../../library/sqlite3.rst:1087 -#: ../../library/sqlite3.rst:1108 ../../library/sqlite3.rst:1247 +#: ../../library/sqlite3.rst:666 ../../library/sqlite3.rst:704 +#: ../../library/sqlite3.rst:767 ../../library/sqlite3.rst:1018 +#: ../../library/sqlite3.rst:1242 ../../library/sqlite3.rst:1272 +#: ../../library/sqlite3.rst:1378 ../../library/sqlite3.rst:1399 +#: ../../library/sqlite3.rst:1538 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:605 +#: ../../library/sqlite3.rst:682 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:607 +#: ../../library/sqlite3.rst:684 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:610 +#: ../../library/sqlite3.rst:687 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:614 +#: ../../library/sqlite3.rst:691 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -651,64 +775,128 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:692 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:617 +#: ../../library/sqlite3.rst:694 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:618 +#: ../../library/sqlite3.rst:695 ../../library/sqlite3.rst:751 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:621 +#: ../../library/sqlite3.rst:698 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:624 +#: ../../library/sqlite3.rst:701 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:659 +#: ../../library/sqlite3.rst:736 +msgid "Create or remove a user-defined aggregate window function." +msgstr "" + +#: ../../library/sqlite3.rst:738 +msgid "The name of the SQL aggregate window function to create or remove." +msgstr "" + +#: ../../library/sqlite3.rst:741 +msgid "" +"The number of arguments the SQL aggregate window function can accept. If " +"``-1``, it may take any number of arguments." +msgstr "" + +#: ../../library/sqlite3.rst:745 +msgid "" +"A class that must implement the following methods: * ``step()``: Add a row " +"to the current window. * ``value()``: Return the current value of the " +"aggregate. * ``inverse()``: Remove a row from the current window. * " +"``finalize()``: Return the final result of the aggregate as :ref:`a type " +"natively supported by SQLite `. The number of arguments that " +"the ``step()`` and ``value()`` methods must accept is controlled by " +"*num_params*. Set to ``None`` to remove an existing SQL aggregate window " +"function." +msgstr "" + +#: ../../library/sqlite3.rst:746 +msgid "A class that must implement the following methods:" +msgstr "" + +#: ../../library/sqlite3.rst:748 +msgid "``step()``: Add a row to the current window." +msgstr "" + +#: ../../library/sqlite3.rst:749 +msgid "``value()``: Return the current value of the aggregate." +msgstr "" + +#: ../../library/sqlite3.rst:750 +msgid "``inverse()``: Remove a row from the current window." +msgstr "" + +#: ../../library/sqlite3.rst:754 +msgid "" +"The number of arguments that the ``step()`` and ``value()`` methods must " +"accept is controlled by *num_params*." +msgstr "" + +#: ../../library/sqlite3.rst:757 +msgid "Set to ``None`` to remove an existing SQL aggregate window function." +msgstr "" + +#: ../../library/sqlite3.rst:759 +msgid "" +"If used with a version of SQLite older than 3.25.0, which does not support " +"aggregate window functions." +msgstr "" + +#: ../../library/sqlite3.rst:822 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:663 +#: ../../library/sqlite3.rst:826 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:664 +#: ../../library/sqlite3.rst:827 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:665 +#: ../../library/sqlite3.rst:828 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:667 +#: ../../library/sqlite3.rst:830 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:858 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:700 +#: ../../library/sqlite3.rst:860 +msgid "" +"The collation name can contain any Unicode character. Earlier, only ASCII " +"characters were allowed." +msgstr "" + +#: ../../library/sqlite3.rst:867 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an exception." msgstr "" -#: ../../library/sqlite3.rst:707 +#: ../../library/sqlite3.rst:874 msgid "" "Register callable *authorizer_callback* to be invoked for each attempt to " "access a column of a table in the database. The callback should return one " @@ -717,7 +905,7 @@ msgid "" "library." msgstr "" -#: ../../library/sqlite3.rst:713 +#: ../../library/sqlite3.rst:880 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -727,7 +915,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:720 +#: ../../library/sqlite3.rst:887 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 " @@ -735,7 +923,15 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:727 +#: ../../library/sqlite3.rst:891 +msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." +msgstr "" + +#: ../../library/sqlite3.rst:893 +msgid "Added support for disabling the authorizer using ``None``." +msgstr "" + +#: ../../library/sqlite3.rst:899 msgid "" "Register callable *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -743,26 +939,26 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:732 +#: ../../library/sqlite3.rst:904 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:735 +#: ../../library/sqlite3.rst:907 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:742 +#: ../../library/sqlite3.rst:914 msgid "" "Register callable *trace_callback* to be invoked for each SQL statement that " "is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:745 +#: ../../library/sqlite3.rst:917 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 " @@ -772,18 +968,18 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:753 +#: ../../library/sqlite3.rst:925 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:756 +#: ../../library/sqlite3.rst:928 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:766 +#: ../../library/sqlite3.rst:938 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -792,7 +988,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:775 +#: ../../library/sqlite3.rst:947 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -801,61 +997,61 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:782 +#: ../../library/sqlite3.rst:954 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: ../../library/sqlite3.rst:786 +#: ../../library/sqlite3.rst:958 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:829 +#: ../../library/sqlite3.rst:1001 msgid "" "Load an SQLite extension from a shared library located at *path*. Enable " "extension loading with :meth:`enable_load_extension` before calling this " "method." msgstr "" -#: ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:1005 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: ../../library/sqlite3.rst:837 +#: ../../library/sqlite3.rst:1009 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:842 +#: ../../library/sqlite3.rst:1014 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:860 +#: ../../library/sqlite3.rst:1032 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:862 +#: ../../library/sqlite3.rst:1034 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:865 +#: ../../library/sqlite3.rst:1037 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:868 +#: ../../library/sqlite3.rst:1040 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:874 +#: ../../library/sqlite3.rst:1046 msgid "" "If set to a callable, it is invoked with three integer arguments for every " "backup iteration: the *status* of the last iteration, the *remaining* number " @@ -863,40 +1059,136 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:883 +#: ../../library/sqlite3.rst:1055 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:890 +#: ../../library/sqlite3.rst:1062 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:894 +#: ../../library/sqlite3.rst:1066 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:913 +#: ../../library/sqlite3.rst:1085 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:925 +#: ../../library/sqlite3.rst:1097 +msgid "Get a connection runtime limit." +msgstr "" + +#: ../../library/sqlite3.rst:1099 +msgid "The `SQLite limit category`_ to be queried." +msgstr "" + +#: ../../library/sqlite3.rst:1104 ../../library/sqlite3.rst:1141 +msgid "If *category* is not recognised by the underlying SQLite library." +msgstr "" + +#: ../../library/sqlite3.rst:1107 +msgid "" +"Example, query the maximum length of an SQL statement for :class:" +"`Connection` ``con`` (the default is 1000000000):" +msgstr "" + +#: ../../library/sqlite3.rst:1127 +msgid "" +"Set a connection runtime limit. Attempts to increase a limit above its hard " +"upper bound are silently truncated to the hard upper bound. Regardless of " +"whether or not the limit was changed, the prior value of the limit is " +"returned." +msgstr "" + +#: ../../library/sqlite3.rst:1132 +msgid "The `SQLite limit category`_ to be set." +msgstr "" + +#: ../../library/sqlite3.rst:1135 +msgid "" +"The value of the new limit. If negative, the current limit is unchanged." +msgstr "" + +#: ../../library/sqlite3.rst:1144 +msgid "" +"Example, limit the number of attached databases to 1 for :class:`Connection` " +"``con`` (the default limit is 10):" +msgstr "" + +#: ../../library/sqlite3.rst:1161 +msgid "" +"Serialize a database into a :class:`bytes` object. For an ordinary on-disk " +"database file, the serialization is just a copy of the disk file. For an in-" +"memory database or a \"temp\" database, the serialization is the same " +"sequence of bytes which would be written to disk if that database were " +"backed up to disk." +msgstr "" + +#: ../../library/sqlite3.rst:1167 +msgid "The database name to be serialized. Defaults to ``\"main\"``." +msgstr "" + +#: ../../library/sqlite3.rst:1175 +msgid "" +"This method is only available if the underlying SQLite library has the " +"serialize API." +msgstr "" + +#: ../../library/sqlite3.rst:1183 +msgid "" +"Deserialize a :meth:`serialized ` database into a :class:" +"`Connection`. This method causes the database connection to disconnect from " +"database *name*, and reopen *name* as an in-memory database based on the " +"serialization contained in *data*." +msgstr "" + +#: ../../library/sqlite3.rst:1189 +msgid "A serialized database." +msgstr "" + +#: ../../library/sqlite3.rst:1192 +msgid "The database name to deserialize into. Defaults to ``\"main\"``." +msgstr "" + +#: ../../library/sqlite3.rst:1196 +msgid "" +"If the database connection is currently involved in a read transaction or a " +"backup operation." +msgstr "" + +#: ../../library/sqlite3.rst:1200 +msgid "If *data* does not contain a valid SQLite database." +msgstr "" + +#: ../../library/sqlite3.rst:1203 +msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." +msgstr "" + +#: ../../library/sqlite3.rst:1208 +msgid "" +"This method is only available if the underlying SQLite library has the " +"deserialize API." +msgstr "" + +#: ../../library/sqlite3.rst:1215 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:928 +#: ../../library/sqlite3.rst:1218 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:935 +#: ../../library/sqlite3.rst:1225 msgid "" "This attribute controls the :ref:`transaction handling ` performed by :mod:`!sqlite3`. If set to ``None``, " @@ -906,20 +1198,20 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:943 +#: ../../library/sqlite3.rst:1233 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:948 +#: ../../library/sqlite3.rst:1238 msgid "" "A callable that accepts two arguments, a :class:`Cursor` object and the raw " "row results as a :class:`tuple`, and returns a custom object representing an " "SQLite row." msgstr "" -#: ../../library/sqlite3.rst:965 +#: ../../library/sqlite3.rst:1255 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 " @@ -929,7 +1221,7 @@ msgid "" "approach or even a db_row based solution." msgstr "" -#: ../../library/sqlite3.rst:976 +#: ../../library/sqlite3.rst:1266 msgid "" "A callable that accepts a :class:`bytes` parameter and returns a text " "representation of it. The callable is invoked for SQLite values with the " @@ -937,17 +1229,17 @@ msgid "" "you want to return ``bytes`` instead, set *text_factory* to ``bytes``." msgstr "" -#: ../../library/sqlite3.rst:1016 +#: ../../library/sqlite3.rst:1306 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1022 +#: ../../library/sqlite3.rst:1313 msgid "Cursor objects" msgstr "" -#: ../../library/sqlite3.rst:1024 +#: ../../library/sqlite3.rst:1315 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -955,33 +1247,33 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1031 +#: ../../library/sqlite3.rst:1322 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1056 +#: ../../library/sqlite3.rst:1347 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1063 +#: ../../library/sqlite3.rst:1354 msgid "" "Execute SQL statement *sql*. Bind values to the statement using :ref:" "`placeholders ` that map to the :term:`sequence` or :" "class:`dict` *parameters*." msgstr "" -#: ../../library/sqlite3.rst:1068 +#: ../../library/sqlite3.rst:1359 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`. " -"Use :meth:`executescript` if you want to execute multiple SQL statements " -"with one call." +"execute more than one statement with it, it will raise a :exc:" +"`ProgrammingError`. Use :meth:`executescript` if you want to execute " +"multiple SQL statements with one call." msgstr "" -#: ../../library/sqlite3.rst:1073 +#: ../../library/sqlite3.rst:1364 msgid "" "If :attr:`~Connection.isolation_level` is not ``None``, *sql* is an " "``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is " @@ -989,7 +1281,7 @@ msgid "" "*sql*." msgstr "" -#: ../../library/sqlite3.rst:1081 +#: ../../library/sqlite3.rst:1372 msgid "" "Execute :ref:`parameterized ` SQL statement *sql* " "against all parameter sequences or mappings found in the sequence " @@ -998,7 +1290,7 @@ msgid "" "handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1100 +#: ../../library/sqlite3.rst:1391 msgid "" "Execute the SQL statements in *sql_script*. If there is a pending " "transaction, an implicit ``COMMIT`` statement is executed first. No other " @@ -1006,24 +1298,24 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1106 +#: ../../library/sqlite3.rst:1397 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1124 +#: ../../library/sqlite3.rst:1415 msgid "" "If :attr:`~Connection.row_factory` is ``None``, return the next row query " "result set as a :class:`tuple`. Else, pass it to the row factory and return " "its result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1132 +#: ../../library/sqlite3.rst:1423 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1135 +#: ../../library/sqlite3.rst:1426 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -1031,7 +1323,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1141 +#: ../../library/sqlite3.rst:1432 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1039,36 +1331,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1148 +#: ../../library/sqlite3.rst:1439 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1155 +#: ../../library/sqlite3.rst:1446 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1157 +#: ../../library/sqlite3.rst:1448 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:1162 ../../library/sqlite3.rst:1166 +#: ../../library/sqlite3.rst:1453 ../../library/sqlite3.rst:1457 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1170 +#: ../../library/sqlite3.rst:1461 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:1175 +#: ../../library/sqlite3.rst:1466 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -1076,18 +1368,18 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1189 +#: ../../library/sqlite3.rst:1480 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1193 +#: ../../library/sqlite3.rst:1484 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1197 +#: ../../library/sqlite3.rst:1488 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -1097,15 +1389,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1205 +#: ../../library/sqlite3.rst:1496 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1207 +#: ../../library/sqlite3.rst:1498 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1212 +#: ../../library/sqlite3.rst:1503 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -1114,11 +1406,11 @@ msgid "" "methods." msgstr "" -#: ../../library/sqlite3.rst:1227 +#: ../../library/sqlite3.rst:1518 msgid "Row objects" msgstr "" -#: ../../library/sqlite3.rst:1231 +#: ../../library/sqlite3.rst:1522 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -1126,63 +1418,137 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1236 +#: ../../library/sqlite3.rst:1527 msgid "Two row objects compare equal if have equal columns and equal members." msgstr "" -#: ../../library/sqlite3.rst:1240 +#: ../../library/sqlite3.rst:1531 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1244 +#: ../../library/sqlite3.rst:1535 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:1264 +#: ../../library/sqlite3.rst:1557 +msgid "Blob objects" +msgstr "" + +#: ../../library/sqlite3.rst:1563 +msgid "" +"A :class:`Blob` instance is a :term:`file-like object` that can read and " +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" +"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " +"and :term:`slices ` for direct access to the blob data." +msgstr "" + +#: ../../library/sqlite3.rst:1568 +msgid "" +"Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " +"handle is closed after use." +msgstr "" + +#: ../../library/sqlite3.rst:1598 +msgid "Close the blob." +msgstr "" + +#: ../../library/sqlite3.rst:1600 +msgid "" +"The blob will be unusable from this point onward. An :class:`~sqlite3." +"Error` (or subclass) exception will be raised if any further operation is " +"attempted with the blob." +msgstr "" + +#: ../../library/sqlite3.rst:1606 +msgid "" +"Read *length* bytes of data from the blob at the current offset position. If " +"the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " +"will be returned. When *length* is not specified, or is negative, :meth:" +"`~Blob.read` will read until the end of the blob." +msgstr "" + +#: ../../library/sqlite3.rst:1614 +msgid "" +"Write *data* to the blob at the current offset. This function cannot change " +"the blob length. Writing beyond the end of the blob will raise :exc:" +"`ValueError`." +msgstr "" + +#: ../../library/sqlite3.rst:1620 +msgid "Return the current access position of the blob." +msgstr "" + +#: ../../library/sqlite3.rst:1624 +msgid "" +"Set the current access position of the blob to *offset*. The *origin* " +"argument defaults to :data:`os.SEEK_SET` (absolute blob positioning). Other " +"values for *origin* are :data:`os.SEEK_CUR` (seek relative to the current " +"position) and :data:`os.SEEK_END` (seek relative to the blob’s end)." +msgstr "" + +#: ../../library/sqlite3.rst:1632 msgid "PrepareProtocol objects" msgstr "" -#: ../../library/sqlite3.rst:1268 +#: ../../library/sqlite3.rst:1636 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1276 +#: ../../library/sqlite3.rst:1644 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1278 +#: ../../library/sqlite3.rst:1646 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1282 +#: ../../library/sqlite3.rst:1650 msgid "" -"This exception is raised by :mod:`!sqlite3` if an SQL query is not a :class:" -"`string `, or if multiple statements are passed to :meth:`~Cursor." -"execute` or :meth:`~Cursor.executemany`. ``Warning`` is a subclass of :exc:" -"`Exception`." +"This exception is not currently raised by the :mod:`!sqlite3` module, but " +"may be raised by applications using :mod:`!sqlite3`, for example if a user-" +"defined function truncates data while inserting. ``Warning`` is a subclass " +"of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1289 +#: ../../library/sqlite3.rst:1657 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1295 +#: ../../library/sqlite3.rst:1661 msgid "" -"This exception is raised by :mod:`!sqlite3` for fetch across rollback, or " -"if :mod:`!sqlite3` is unable to bind parameters. ``InterfaceError`` is a " -"subclass of :exc:`Error`." +"If the exception originated from within the SQLite library, the following " +"two attributes are added to the exception:" +msgstr "" + +#: ../../library/sqlite3.rst:1666 +msgid "" +"The numeric error code from the `SQLite API `_" +msgstr "" + +#: ../../library/sqlite3.rst:1673 +msgid "" +"The symbolic name of the numeric error code from the `SQLite API `_" +msgstr "" + +#: ../../library/sqlite3.rst:1680 +msgid "" +"Exception raised for misuse of the low-level SQLite C API. In other words, " +"if this exception is raised, it probably indicates a bug in the :mod:`!" +"sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1301 +#: ../../library/sqlite3.rst:1687 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -1190,14 +1556,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1308 +#: ../../library/sqlite3.rst:1694 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1314 +#: ../../library/sqlite3.rst:1700 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -1205,28 +1571,28 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1322 +#: ../../library/sqlite3.rst:1708 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:1327 +#: ../../library/sqlite3.rst:1713 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1720 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " -"trying to operate on a closed :class:`Connection`, or trying to execute non-" -"DML statements with :meth:`~Cursor.executemany`. ``ProgrammingError`` is a " -"subclass of :exc:`DatabaseError`." +"supplying the wrong number of bindings to a query, or trying to operate on a " +"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" +"`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1341 +#: ../../library/sqlite3.rst:1727 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -1235,78 +1601,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1351 +#: ../../library/sqlite3.rst:1737 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1353 +#: ../../library/sqlite3.rst:1739 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1356 +#: ../../library/sqlite3.rst:1742 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1359 ../../library/sqlite3.rst:1376 +#: ../../library/sqlite3.rst:1745 ../../library/sqlite3.rst:1762 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1359 ../../library/sqlite3.rst:1376 +#: ../../library/sqlite3.rst:1745 ../../library/sqlite3.rst:1762 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1361 ../../library/sqlite3.rst:1378 +#: ../../library/sqlite3.rst:1747 ../../library/sqlite3.rst:1764 msgid "``None``" msgstr "" -#: ../../library/sqlite3.rst:1361 ../../library/sqlite3.rst:1378 +#: ../../library/sqlite3.rst:1747 ../../library/sqlite3.rst:1764 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1363 ../../library/sqlite3.rst:1380 +#: ../../library/sqlite3.rst:1749 ../../library/sqlite3.rst:1766 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1363 ../../library/sqlite3.rst:1380 +#: ../../library/sqlite3.rst:1749 ../../library/sqlite3.rst:1766 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1365 ../../library/sqlite3.rst:1382 +#: ../../library/sqlite3.rst:1751 ../../library/sqlite3.rst:1768 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1365 ../../library/sqlite3.rst:1382 +#: ../../library/sqlite3.rst:1751 ../../library/sqlite3.rst:1768 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1367 +#: ../../library/sqlite3.rst:1753 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1367 ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1753 ../../library/sqlite3.rst:1770 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1369 ../../library/sqlite3.rst:1387 +#: ../../library/sqlite3.rst:1755 ../../library/sqlite3.rst:1773 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1369 ../../library/sqlite3.rst:1387 +#: ../../library/sqlite3.rst:1755 ../../library/sqlite3.rst:1773 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1373 +#: ../../library/sqlite3.rst:1759 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1770 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1390 +#: ../../library/sqlite3.rst:1776 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -1315,42 +1681,42 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1400 +#: ../../library/sqlite3.rst:1786 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1402 +#: ../../library/sqlite3.rst:1788 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:1405 +#: ../../library/sqlite3.rst:1791 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:1409 +#: ../../library/sqlite3.rst:1795 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:1413 +#: ../../library/sqlite3.rst:1799 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1417 +#: ../../library/sqlite3.rst:1803 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:1423 +#: ../../library/sqlite3.rst:1809 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1358,15 +1724,15 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1432 +#: ../../library/sqlite3.rst:1818 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:1437 +#: ../../library/sqlite3.rst:1823 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:1439 +#: ../../library/sqlite3.rst:1825 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -1374,7 +1740,7 @@ msgid "" "com/327/>`_ for a humorous example of what can go wrong)::" msgstr "" -#: ../../library/sqlite3.rst:1448 +#: ../../library/sqlite3.rst:1834 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -1390,18 +1756,18 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:1490 +#: ../../library/sqlite3.rst:1876 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:1492 +#: ../../library/sqlite3.rst:1878 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:1496 +#: ../../library/sqlite3.rst:1882 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -1411,11 +1777,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:1508 +#: ../../library/sqlite3.rst:1894 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:1510 +#: ../../library/sqlite3.rst:1896 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -1425,84 +1791,84 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1541 +#: ../../library/sqlite3.rst:1927 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:1543 +#: ../../library/sqlite3.rst:1929 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1573 +#: ../../library/sqlite3.rst:1959 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1575 +#: ../../library/sqlite3.rst:1961 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:1580 +#: ../../library/sqlite3.rst:1966 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:1583 +#: ../../library/sqlite3.rst:1969 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:1588 +#: ../../library/sqlite3.rst:1974 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:1597 +#: ../../library/sqlite3.rst:1983 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:1601 +#: ../../library/sqlite3.rst:1987 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:1602 +#: ../../library/sqlite3.rst:1988 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:1603 +#: ../../library/sqlite3.rst:1989 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:1607 +#: ../../library/sqlite3.rst:1993 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:1658 +#: ../../library/sqlite3.rst:2044 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:1660 +#: ../../library/sqlite3.rst:2046 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:1703 +#: ../../library/sqlite3.rst:2089 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:1705 +#: ../../library/sqlite3.rst:2091 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -1514,11 +1880,11 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:1746 +#: ../../library/sqlite3.rst:2132 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:1748 +#: ../../library/sqlite3.rst:2134 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -1528,61 +1894,61 @@ msgid "" "exception, the transaction is rolled back." msgstr "" -#: ../../library/sqlite3.rst:1757 +#: ../../library/sqlite3.rst:2143 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, the context manager is a no-op." msgstr "" -#: ../../library/sqlite3.rst:1762 +#: ../../library/sqlite3.rst:2148 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection." msgstr "" -#: ../../library/sqlite3.rst:1795 +#: ../../library/sqlite3.rst:2181 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:1797 +#: ../../library/sqlite3.rst:2183 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:1799 +#: ../../library/sqlite3.rst:2185 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:2194 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:1818 +#: ../../library/sqlite3.rst:2204 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:1832 +#: ../../library/sqlite3.rst:2218 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:1841 +#: ../../library/sqlite3.rst:2227 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:1846 +#: ../../library/sqlite3.rst:2232 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:1848 +#: ../../library/sqlite3.rst:2234 msgid "" "The :mod:`!sqlite3` module does not adhere to the transaction handling " "recommended by :pep:`249`." msgstr "" -#: ../../library/sqlite3.rst:1851 +#: ../../library/sqlite3.rst:2237 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -1596,7 +1962,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:1864 +#: ../../library/sqlite3.rst:2250 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -1606,14 +1972,14 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:1872 +#: ../../library/sqlite3.rst:2258 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:1876 +#: ../../library/sqlite3.rst:2262 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." diff --git a/library/ssl.po b/library/ssl.po index 38c0ecb76e..64c59bdae7 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -51,14 +51,25 @@ msgid "" "are not necessarily appropriate for your application." msgstr "" -#: ../../library/ssl.rst:37 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/ssl.rst:38 msgid "" "This section documents the objects and functions in the ``ssl`` module; for " "more general information about TLS, SSL, and certificates, the reader is " "referred to the documents in the \"See Also\" section at the bottom." msgstr "" -#: ../../library/ssl.rst:41 +#: ../../library/ssl.rst:42 msgid "" "This module provides a class, :class:`ssl.SSLSocket`, which is derived from " "the :class:`socket.socket` type, and provides a socket-like wrapper that " @@ -68,43 +79,43 @@ msgid "" "retrieves the cipher being used for the secure connection." msgstr "" -#: ../../library/ssl.rst:48 +#: ../../library/ssl.rst:49 msgid "" "For more sophisticated applications, the :class:`ssl.SSLContext` class helps " "manage settings and certificates, which can then be inherited by SSL sockets " "created through the :meth:`SSLContext.wrap_socket` method." msgstr "" -#: ../../library/ssl.rst:52 +#: ../../library/ssl.rst:53 msgid "Updated to support linking with OpenSSL 1.1.0" msgstr "" -#: ../../library/ssl.rst:57 +#: ../../library/ssl.rst:58 msgid "" "OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported. In " "the future the ssl module will require at least OpenSSL 1.0.2 or 1.1.0." msgstr "" -#: ../../library/ssl.rst:63 +#: ../../library/ssl.rst:64 msgid "" ":pep:`644` has been implemented. The ssl module requires OpenSSL 1.1.1 or " "newer." msgstr "" -#: ../../library/ssl.rst:66 +#: ../../library/ssl.rst:67 msgid "" "Use of deprecated constants and functions result in deprecation warnings." msgstr "" -#: ../../library/ssl.rst:70 +#: ../../library/ssl.rst:71 msgid "Functions, Constants, and Exceptions" msgstr "函式、常數與例外" -#: ../../library/ssl.rst:74 +#: ../../library/ssl.rst:75 msgid "Socket creation" msgstr "" -#: ../../library/ssl.rst:76 +#: ../../library/ssl.rst:77 msgid "" "Since Python 3.2 and 2.7.9, it is recommended to use the :meth:`SSLContext." "wrap_socket` of an :class:`SSLContext` instance to wrap sockets as :class:" @@ -114,29 +125,29 @@ msgid "" "support for server name indication (SNI) and hostname matching." msgstr "" -#: ../../library/ssl.rst:84 +#: ../../library/ssl.rst:85 msgid "Client socket example with default context and IPv4/IPv6 dual stack::" msgstr "" -#: ../../library/ssl.rst:97 +#: ../../library/ssl.rst:98 msgid "Client socket example with custom context and IPv4::" msgstr "" -#: ../../library/ssl.rst:109 +#: ../../library/ssl.rst:110 msgid "Server socket example listening on localhost IPv4::" msgstr "" -#: ../../library/ssl.rst:123 +#: ../../library/ssl.rst:124 msgid "Context creation" msgstr "" -#: ../../library/ssl.rst:125 +#: ../../library/ssl.rst:126 msgid "" "A convenience function helps create :class:`SSLContext` objects for common " "purposes." msgstr "" -#: ../../library/ssl.rst:130 +#: ../../library/ssl.rst:131 msgid "" "Return a new :class:`SSLContext` object with default settings for the given " "*purpose*. The settings are chosen by the :mod:`ssl` module, and usually " @@ -144,7 +155,7 @@ msgid "" "constructor directly." msgstr "" -#: ../../library/ssl.rst:135 +#: ../../library/ssl.rst:136 msgid "" "*cafile*, *capath*, *cadata* represent optional CA certificates to trust for " "certificate verification, as in :meth:`SSLContext.load_verify_locations`. " @@ -152,7 +163,7 @@ msgid "" "system's default CA certificates instead." msgstr "" -#: ../../library/ssl.rst:141 +#: ../../library/ssl.rst:142 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -164,27 +175,27 @@ msgid "" "certificates." msgstr "" -#: ../../library/ssl.rst:150 +#: ../../library/ssl.rst:151 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -#: ../../library/ssl.rst:155 +#: ../../library/ssl.rst:156 msgid "" "The protocol, options, cipher and other settings may change to more " "restrictive values anytime without prior deprecation. The values represent " "a fair balance between compatibility and security." msgstr "" -#: ../../library/ssl.rst:159 +#: ../../library/ssl.rst:160 msgid "" "If your application needs specific settings, you should create a :class:" "`SSLContext` and apply the settings yourself." msgstr "" -#: ../../library/ssl.rst:163 +#: ../../library/ssl.rst:164 msgid "" "If you find that when certain older clients or servers attempt to connect " "with a :class:`SSLContext` created by this function that they get an error " @@ -195,33 +206,33 @@ msgid "" "still allow SSL 3.0 connections you can re-enable them using::" msgstr "" -#: ../../library/ssl.rst:179 +#: ../../library/ssl.rst:180 msgid "RC4 was dropped from the default cipher string." msgstr "" -#: ../../library/ssl.rst:183 +#: ../../library/ssl.rst:184 msgid "ChaCha20/Poly1305 was added to the default cipher string." msgstr "" -#: ../../library/ssl.rst:185 +#: ../../library/ssl.rst:186 msgid "3DES was dropped from the default cipher string." msgstr "" -#: ../../library/ssl.rst:189 +#: ../../library/ssl.rst:190 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." msgstr "" -#: ../../library/ssl.rst:193 +#: ../../library/ssl.rst:194 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." msgstr "" -#: ../../library/ssl.rst:199 +#: ../../library/ssl.rst:200 msgid "Exceptions" msgstr "例外" -#: ../../library/ssl.rst:203 +#: ../../library/ssl.rst:204 msgid "" "Raised to signal an error from the underlying SSL implementation (currently " "provided by the OpenSSL library). This signifies some problem in the higher-" @@ -231,85 +242,85 @@ msgid "" "OpenSSL library." msgstr "" -#: ../../library/ssl.rst:210 +#: ../../library/ssl.rst:211 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." msgstr "" -#: ../../library/ssl.rst:215 +#: ../../library/ssl.rst:216 msgid "" "A string mnemonic designating the OpenSSL submodule in which the error " "occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible " "values depends on the OpenSSL version." msgstr "" -#: ../../library/ssl.rst:223 +#: ../../library/ssl.rst:224 msgid "" "A string mnemonic designating the reason this error occurred, for example " "``CERTIFICATE_VERIFY_FAILED``. The range of possible values depends on the " "OpenSSL version." msgstr "" -#: ../../library/ssl.rst:231 +#: ../../library/ssl.rst:232 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " "the underlying transport (read TCP) has been closed." msgstr "" -#: ../../library/ssl.rst:239 +#: ../../library/ssl.rst:240 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " "received on the underlying TCP transport before the request can be fulfilled." msgstr "" -#: ../../library/ssl.rst:248 +#: ../../library/ssl.rst:249 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " "sent on the underlying TCP transport before the request can be fulfilled." msgstr "" -#: ../../library/ssl.rst:257 +#: ../../library/ssl.rst:258 msgid "" "A subclass of :exc:`SSLError` raised when a system error was encountered " "while trying to fulfill an operation on a SSL socket. Unfortunately, there " "is no easy way to inspect the original errno number." msgstr "" -#: ../../library/ssl.rst:265 +#: ../../library/ssl.rst:266 msgid "" "A subclass of :exc:`SSLError` raised when the SSL connection has been " "terminated abruptly. Generally, you shouldn't try to reuse the underlying " "transport when this error is encountered." msgstr "" -#: ../../library/ssl.rst:273 +#: ../../library/ssl.rst:274 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "" -#: ../../library/ssl.rst:280 +#: ../../library/ssl.rst:281 msgid "A numeric error number that denotes the verification error." msgstr "" -#: ../../library/ssl.rst:284 +#: ../../library/ssl.rst:285 msgid "A human readable string of the verification error." msgstr "" -#: ../../library/ssl.rst:288 +#: ../../library/ssl.rst:289 msgid "An alias for :exc:`SSLCertVerificationError`." msgstr "" -#: ../../library/ssl.rst:290 +#: ../../library/ssl.rst:291 msgid "The exception is now an alias for :exc:`SSLCertVerificationError`." msgstr "" -#: ../../library/ssl.rst:295 +#: ../../library/ssl.rst:296 msgid "Random generation" msgstr "" -#: ../../library/ssl.rst:299 +#: ../../library/ssl.rst:300 msgid "" "Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" "`SSLError` if the PRNG has not been seeded with enough data or if the " @@ -318,11 +329,11 @@ msgid "" "to seed the PRNG." msgstr "" -#: ../../library/ssl.rst:305 ../../library/ssl.rst:326 +#: ../../library/ssl.rst:306 ../../library/ssl.rst:327 msgid "For almost all applications :func:`os.urandom` is preferable." msgstr "" -#: ../../library/ssl.rst:307 +#: ../../library/ssl.rst:308 msgid "" "Read the Wikipedia article, `Cryptographically secure pseudorandom number " "generator (CSPRNG) `: LibreSSL ignores the environment vars :" -"attr:`openssl_cafile_env` and :attr:`openssl_capath_env`." -msgstr "" - -#: ../../library/ssl.rst:484 +#: ../../library/ssl.rst:482 msgid "" "Retrieve certificates from Windows' system cert store. *store_name* may be " "one of ``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert " "stores, too." msgstr "" -#: ../../library/ssl.rst:488 +#: ../../library/ssl.rst:486 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -541,32 +546,32 @@ msgid "" "exactly ``True`` if the certificate is trustworthy for all purposes." msgstr "" -#: ../../library/ssl.rst:495 ../../library/ssl.rst:1639 -#: ../../library/ssl.rst:1934 +#: ../../library/ssl.rst:493 ../../library/ssl.rst:1637 +#: ../../library/ssl.rst:1932 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/ssl.rst:502 ../../library/ssl.rst:517 +#: ../../library/ssl.rst:500 ../../library/ssl.rst:515 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:只有 Windows。" -#: ../../library/ssl.rst:507 +#: ../../library/ssl.rst:505 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " "``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert stores, too." msgstr "" -#: ../../library/ssl.rst:511 +#: ../../library/ssl.rst:509 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" "`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." msgstr "" -#: ../../library/ssl.rst:525 +#: ../../library/ssl.rst:523 msgid "" "Takes an instance ``sock`` of :class:`socket.socket`, and returns an " "instance of :class:`ssl.SSLSocket`, a subtype of :class:`socket.socket`, " @@ -574,7 +579,7 @@ msgid "" "data:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:530 +#: ../../library/ssl.rst:528 msgid "" "Internally, function creates a :class:`SSLContext` with protocol " "*ssl_version* and :attr:`SSLContext.options` set to *cert_reqs*. If " @@ -583,14 +588,14 @@ msgid "" "load_verify_locations`, and :meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:537 +#: ../../library/ssl.rst:535 msgid "" "The arguments *server_side*, *do_handshake_on_connect*, and " "*suppress_ragged_eofs* have the same meaning as :meth:`SSLContext." "wrap_socket`." msgstr "" -#: ../../library/ssl.rst:543 +#: ../../library/ssl.rst:541 msgid "" "Since Python 3.2 and 2.7.9, it is recommended to use the :meth:`SSLContext." "wrap_socket` instead of :func:`wrap_socket`. The top-level function is " @@ -598,17 +603,17 @@ msgid "" "or hostname matching." msgstr "" -#: ../../library/ssl.rst:549 +#: ../../library/ssl.rst:547 msgid "Constants" msgstr "常數" -#: ../../library/ssl.rst:551 +#: ../../library/ssl.rst:549 msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" -#: ../../library/ssl.rst:557 +#: ../../library/ssl.rst:555 msgid "" "Possible value for :attr:`SSLContext.verify_mode`, or the ``cert_reqs`` " "parameter to :func:`wrap_socket`. Except for :const:`PROTOCOL_TLS_CLIENT`, " @@ -617,17 +622,17 @@ msgid "" "and do not abort the TLS/SSL handshake." msgstr "" -#: ../../library/ssl.rst:563 +#: ../../library/ssl.rst:561 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." msgstr "" -#: ../../library/ssl.rst:566 ../../library/ssl.rst:2342 +#: ../../library/ssl.rst:564 ../../library/ssl.rst:2340 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" -#: ../../library/ssl.rst:570 +#: ../../library/ssl.rst:568 msgid "" "Possible value for :attr:`SSLContext.verify_mode`, or the ``cert_reqs`` " "parameter to :func:`wrap_socket`. In client mode, :const:`CERT_OPTIONAL` " @@ -635,7 +640,7 @@ msgid "" "const:`CERT_REQUIRED` for client-side sockets instead." msgstr "" -#: ../../library/ssl.rst:575 +#: ../../library/ssl.rst:573 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -644,14 +649,14 @@ msgid "" "TLS handshake." msgstr "" -#: ../../library/ssl.rst:581 ../../library/ssl.rst:601 +#: ../../library/ssl.rst:579 ../../library/ssl.rst:599 msgid "" "Use of this setting requires a valid set of CA certificates to be passed, " "either to :meth:`SSLContext.load_verify_locations` or as a value of the " "``ca_certs`` parameter to :func:`wrap_socket`." msgstr "" -#: ../../library/ssl.rst:587 +#: ../../library/ssl.rst:585 msgid "" "Possible value for :attr:`SSLContext.verify_mode`, or the ``cert_reqs`` " "parameter to :func:`wrap_socket`. In this mode, certificates are required " @@ -664,25 +669,25 @@ msgid "" "default." msgstr "" -#: ../../library/ssl.rst:597 +#: ../../library/ssl.rst:595 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " "client must provide a valid and trusted certificate." msgstr "" -#: ../../library/ssl.rst:607 +#: ../../library/ssl.rst:605 msgid ":class:`enum.IntEnum` collection of CERT_* constants." msgstr "" -#: ../../library/ssl.rst:613 +#: ../../library/ssl.rst:611 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, " "certificate revocation lists (CRLs) are not checked. By default OpenSSL does " "neither require nor verify CRLs." msgstr "" -#: ../../library/ssl.rst:621 +#: ../../library/ssl.rst:619 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " @@ -691,32 +696,32 @@ msgid "" "load_verify_locations`, validation will fail." msgstr "" -#: ../../library/ssl.rst:631 +#: ../../library/ssl.rst:629 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, CRLs of " "all certificates in the peer cert chain are checked." msgstr "" -#: ../../library/ssl.rst:638 +#: ../../library/ssl.rst:636 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to disable workarounds " "for broken X.509 certificates." msgstr "" -#: ../../library/ssl.rst:645 +#: ../../library/ssl.rst:643 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr "" -#: ../../library/ssl.rst:652 +#: ../../library/ssl.rst:650 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "prefer trusted certificates when building the trust chain to validate a " "certificate. This flag is enabled by default." msgstr "" -#: ../../library/ssl.rst:660 +#: ../../library/ssl.rst:658 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -725,25 +730,25 @@ msgid "" "to trust its ancestor root CA." msgstr "" -#: ../../library/ssl.rst:671 +#: ../../library/ssl.rst:669 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." msgstr "" -#: ../../library/ssl.rst:677 +#: ../../library/ssl.rst:675 msgid "" "Selects the highest protocol version that both the client and server " "support. Despite the name, this option can select both \"SSL\" and \"TLS\" " "protocols." msgstr "" -#: ../../library/ssl.rst:684 +#: ../../library/ssl.rst:682 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" "data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:690 +#: ../../library/ssl.rst:688 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " @@ -751,53 +756,53 @@ msgid "" "default." msgstr "" -#: ../../library/ssl.rst:699 +#: ../../library/ssl.rst:697 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "" -#: ../../library/ssl.rst:706 +#: ../../library/ssl.rst:704 msgid "Alias for :data:`PROTOCOL_TLS`." msgstr "" -#: ../../library/ssl.rst:710 +#: ../../library/ssl.rst:708 msgid "Use :data:`PROTOCOL_TLS` instead." msgstr "" -#: ../../library/ssl.rst:714 +#: ../../library/ssl.rst:712 msgid "Selects SSL version 2 as the channel encryption protocol." msgstr "" -#: ../../library/ssl.rst:716 +#: ../../library/ssl.rst:714 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl2`` " "option." msgstr "" -#: ../../library/ssl.rst:721 +#: ../../library/ssl.rst:719 msgid "SSL version 2 is insecure. Its use is highly discouraged." msgstr "" -#: ../../library/ssl.rst:725 +#: ../../library/ssl.rst:723 msgid "OpenSSL has removed support for SSLv2." msgstr "" -#: ../../library/ssl.rst:729 +#: ../../library/ssl.rst:727 msgid "Selects SSL version 3 as the channel encryption protocol." msgstr "" -#: ../../library/ssl.rst:731 +#: ../../library/ssl.rst:729 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl3`` " "option." msgstr "" -#: ../../library/ssl.rst:736 +#: ../../library/ssl.rst:734 msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "" -#: ../../library/ssl.rst:740 +#: ../../library/ssl.rst:738 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" @@ -805,88 +810,88 @@ msgid "" "instead." msgstr "" -#: ../../library/ssl.rst:748 +#: ../../library/ssl.rst:746 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "" -#: ../../library/ssl.rst:752 ../../library/ssl.rst:763 -#: ../../library/ssl.rst:774 +#: ../../library/ssl.rst:750 ../../library/ssl.rst:761 +#: ../../library/ssl.rst:772 msgid "OpenSSL has deprecated all version specific protocols." msgstr "" -#: ../../library/ssl.rst:756 +#: ../../library/ssl.rst:754 msgid "" "Selects TLS version 1.1 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." msgstr "" -#: ../../library/ssl.rst:767 +#: ../../library/ssl.rst:765 msgid "" "Selects TLS version 1.2 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." msgstr "" -#: ../../library/ssl.rst:778 +#: ../../library/ssl.rst:776 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " "as OpenSSL's ``SSL_OP_ALL`` constant." msgstr "" -#: ../../library/ssl.rst:786 +#: ../../library/ssl.rst:784 msgid "" "Prevents an SSLv2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv2 as " "the protocol version." msgstr "" -#: ../../library/ssl.rst:794 +#: ../../library/ssl.rst:792 msgid "SSLv2 is deprecated" msgstr "" -#: ../../library/ssl.rst:798 +#: ../../library/ssl.rst:796 msgid "" "Prevents an SSLv3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv3 as " "the protocol version." msgstr "" -#: ../../library/ssl.rst:806 +#: ../../library/ssl.rst:804 msgid "SSLv3 is deprecated" msgstr "" -#: ../../library/ssl.rst:810 +#: ../../library/ssl.rst:808 msgid "" "Prevents a TLSv1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1 as " "the protocol version." msgstr "" -#: ../../library/ssl.rst:816 +#: ../../library/ssl.rst:814 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:823 +#: ../../library/ssl.rst:821 msgid "" "Prevents a TLSv1.1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.1 as " "the protocol version. Available only with openssl version 1.0.1+." msgstr "" -#: ../../library/ssl.rst:829 ../../library/ssl.rst:840 +#: ../../library/ssl.rst:827 ../../library/ssl.rst:838 msgid "The option is deprecated since OpenSSL 1.1.0." msgstr "" -#: ../../library/ssl.rst:834 +#: ../../library/ssl.rst:832 msgid "" "Prevents a TLSv1.2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.2 as " "the protocol version. Available only with openssl version 1.0.1+." msgstr "" -#: ../../library/ssl.rst:845 +#: ../../library/ssl.rst:843 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -895,100 +900,100 @@ msgid "" "defaults to *0*." msgstr "" -#: ../../library/ssl.rst:853 +#: ../../library/ssl.rst:851 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15, 3.6.3 " "and 3.7.0 for backwards compatibility with OpenSSL 1.0.2." msgstr "" -#: ../../library/ssl.rst:859 +#: ../../library/ssl.rst:857 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." msgstr "" -#: ../../library/ssl.rst:862 +#: ../../library/ssl.rst:860 msgid "This option is only available with OpenSSL 1.1.0h and later." msgstr "" -#: ../../library/ssl.rst:868 +#: ../../library/ssl.rst:866 msgid "" "Use the server's cipher ordering preference, rather than the client's. This " "option has no effect on client sockets and SSLv2 server sockets." msgstr "" -#: ../../library/ssl.rst:875 +#: ../../library/ssl.rst:873 msgid "" "Prevents re-use of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " "applies to server sockets." msgstr "" -#: ../../library/ssl.rst:883 +#: ../../library/ssl.rst:881 msgid "" "Prevents re-use of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " "option only applies to server sockets." msgstr "" -#: ../../library/ssl.rst:891 +#: ../../library/ssl.rst:889 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:894 +#: ../../library/ssl.rst:892 msgid "This option is only available with OpenSSL 1.1.1 and later." msgstr "" -#: ../../library/ssl.rst:900 +#: ../../library/ssl.rst:898 msgid "" "Disable compression on the SSL channel. This is useful if the application " "protocol supports its own compression scheme." msgstr "" -#: ../../library/ssl.rst:907 +#: ../../library/ssl.rst:905 msgid ":class:`enum.IntFlag` collection of OP_* constants." msgstr "" -#: ../../library/ssl.rst:911 +#: ../../library/ssl.rst:909 msgid "Prevent client side from requesting a session ticket." msgstr "" -#: ../../library/ssl.rst:917 +#: ../../library/ssl.rst:915 msgid "Ignore unexpected shutdown of TLS connections." msgstr "" -#: ../../library/ssl.rst:919 +#: ../../library/ssl.rst:917 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "" -#: ../../library/ssl.rst:925 +#: ../../library/ssl.rst:923 msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -#: ../../library/ssl.rst:932 +#: ../../library/ssl.rst:930 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -#: ../../library/ssl.rst:940 +#: ../../library/ssl.rst:938 msgid "" "Whether the OpenSSL library has built-in support for the Elliptic Curve-" "based Diffie-Hellman key exchange. This should be true unless the feature " "was explicitly disabled by the distributor." msgstr "" -#: ../../library/ssl.rst:948 +#: ../../library/ssl.rst:946 msgid "" "Whether the OpenSSL library has built-in support for the *Server Name " "Indication* extension (as defined in :rfc:`6066`)." msgstr "" -#: ../../library/ssl.rst:955 +#: ../../library/ssl.rst:953 msgid "" "Whether the OpenSSL library has built-in support for the *Next Protocol " "Negotiation* as described in the `Application Layer Protocol Negotiation " @@ -997,57 +1002,57 @@ msgid "" "advertise which protocols you want to support." msgstr "" -#: ../../library/ssl.rst:965 +#: ../../library/ssl.rst:963 msgid "" "Whether the OpenSSL library has built-in support for the SSL 2.0 protocol." msgstr "" -#: ../../library/ssl.rst:971 +#: ../../library/ssl.rst:969 msgid "" "Whether the OpenSSL library has built-in support for the SSL 3.0 protocol." msgstr "" -#: ../../library/ssl.rst:977 +#: ../../library/ssl.rst:975 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.0 protocol." msgstr "" -#: ../../library/ssl.rst:983 +#: ../../library/ssl.rst:981 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.1 protocol." msgstr "" -#: ../../library/ssl.rst:989 +#: ../../library/ssl.rst:987 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.2 protocol." msgstr "" -#: ../../library/ssl.rst:995 +#: ../../library/ssl.rst:993 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.3 protocol." msgstr "" -#: ../../library/ssl.rst:1001 +#: ../../library/ssl.rst:999 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -#: ../../library/ssl.rst:1008 +#: ../../library/ssl.rst:1006 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "" -#: ../../library/ssl.rst:1017 +#: ../../library/ssl.rst:1015 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "" -#: ../../library/ssl.rst:1027 +#: ../../library/ssl.rst:1025 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "" -#: ../../library/ssl.rst:1040 +#: ../../library/ssl.rst:1038 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`." msgstr "" -#: ../../library/ssl.rst:1139 +#: ../../library/ssl.rst:1137 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method." msgstr "" -#: ../../library/ssl.rst:1142 +#: ../../library/ssl.rst:1140 msgid "The :meth:`sendfile` method was added." msgstr "" -#: ../../library/ssl.rst:1145 +#: ../../library/ssl.rst:1143 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now to maximum total duration of the " "shutdown." msgstr "" -#: ../../library/ssl.rst:1150 +#: ../../library/ssl.rst:1148 msgid "" "It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" "`SSLContext.wrap_socket` to wrap a socket." msgstr "" -#: ../../library/ssl.rst:1154 +#: ../../library/ssl.rst:1152 msgid "" ":class:`SSLSocket` instances must to created with :meth:`~SSLContext." "wrap_socket`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:1160 +#: ../../library/ssl.rst:1158 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" "length data no longer fails with a protocol violation error." msgstr "" -#: ../../library/ssl.rst:1165 +#: ../../library/ssl.rst:1163 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "" -#: ../../library/ssl.rst:1169 +#: ../../library/ssl.rst:1167 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " "instead, and return the number of bytes read." msgstr "" -#: ../../library/ssl.rst:1173 +#: ../../library/ssl.rst:1171 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." msgstr "" -#: ../../library/ssl.rst:1176 +#: ../../library/ssl.rst:1174 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" -#: ../../library/ssl.rst:1179 +#: ../../library/ssl.rst:1177 msgid "" "The socket timeout is no more reset each time bytes are received or sent. " "The socket timeout is now to maximum total duration to read up to *len* " "bytes." msgstr "" -#: ../../library/ssl.rst:1184 +#: ../../library/ssl.rst:1182 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "" -#: ../../library/ssl.rst:1189 +#: ../../library/ssl.rst:1187 msgid "" "Write *buf* to the SSL socket and return the number of bytes written. The " "*buf* argument must be an object supporting the buffer interface." msgstr "" -#: ../../library/ssl.rst:1192 +#: ../../library/ssl.rst:1190 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." msgstr "" -#: ../../library/ssl.rst:1195 +#: ../../library/ssl.rst:1193 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" -#: ../../library/ssl.rst:1198 +#: ../../library/ssl.rst:1196 msgid "" "The socket timeout is no more reset each time bytes are received or sent. " "The socket timeout is now to maximum total duration to write *buf*." msgstr "" -#: ../../library/ssl.rst:1202 +#: ../../library/ssl.rst:1200 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "" -#: ../../library/ssl.rst:1207 +#: ../../library/ssl.rst:1205 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1306,30 +1311,30 @@ msgid "" "unwrap` was not called." msgstr "" -#: ../../library/ssl.rst:1213 +#: ../../library/ssl.rst:1211 msgid "" "Normally you should use the socket API methods like :meth:`~socket.socket." "recv` and :meth:`~socket.socket.send` instead of these methods." msgstr "" -#: ../../library/ssl.rst:1219 +#: ../../library/ssl.rst:1217 msgid "Perform the SSL setup handshake." msgstr "" -#: ../../library/ssl.rst:1221 +#: ../../library/ssl.rst:1219 msgid "" "The handshake method also performs :func:`match_hostname` when the :attr:" "`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." "context` is true." msgstr "" -#: ../../library/ssl.rst:1226 +#: ../../library/ssl.rst:1224 msgid "" "The socket timeout is no more reset each time bytes are received or sent. " "The socket timeout is now to maximum total duration of the handshake." msgstr "" -#: ../../library/ssl.rst:1230 +#: ../../library/ssl.rst:1228 msgid "" "Hostname or IP address is matched by OpenSSL during handshake. The function :" "func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " @@ -1337,14 +1342,14 @@ msgid "" "send to the peer." msgstr "" -#: ../../library/ssl.rst:1238 +#: ../../library/ssl.rst:1236 msgid "" "If there is no certificate for the peer on the other end of the connection, " "return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" "`ValueError`." msgstr "" -#: ../../library/ssl.rst:1242 +#: ../../library/ssl.rst:1240 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1356,7 +1361,7 @@ msgid "" "also be a ``subjectAltName`` key in the dictionary." msgstr "" -#: ../../library/ssl.rst:1251 +#: ../../library/ssl.rst:1249 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1364,13 +1369,13 @@ msgid "" "value pairs. Here is a real-world example::" msgstr "" -#: ../../library/ssl.rst:1277 +#: ../../library/ssl.rst:1275 msgid "" "To validate a certificate for a particular service, you can use the :func:" "`match_hostname` function." msgstr "" -#: ../../library/ssl.rst:1280 +#: ../../library/ssl.rst:1278 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1379,13 +1384,13 @@ msgid "" "socket's role:" msgstr "" -#: ../../library/ssl.rst:1286 +#: ../../library/ssl.rst:1284 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "" -#: ../../library/ssl.rst:1289 +#: ../../library/ssl.rst:1287 msgid "" "for a server SSL socket, the client will only provide a certificate when " "requested by the server; therefore :meth:`getpeercert` will return :const:" @@ -1393,24 +1398,24 @@ msgid "" "or :const:`CERT_REQUIRED`)." msgstr "" -#: ../../library/ssl.rst:1294 +#: ../../library/ssl.rst:1292 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: ../../library/ssl.rst:1298 +#: ../../library/ssl.rst:1296 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: ../../library/ssl.rst:1303 +#: ../../library/ssl.rst:1301 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: ../../library/ssl.rst:1308 +#: ../../library/ssl.rst:1306 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1418,7 +1423,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ssl.rst:1314 +#: ../../library/ssl.rst:1312 msgid "" "Return the list of ciphers shared by the client during the handshake. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1428,25 +1433,25 @@ msgid "" "socket." msgstr "" -#: ../../library/ssl.rst:1325 +#: ../../library/ssl.rst:1323 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: ../../library/ssl.rst:1328 +#: ../../library/ssl.rst:1326 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: ../../library/ssl.rst:1335 +#: ../../library/ssl.rst:1333 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: ../../library/ssl.rst:1338 +#: ../../library/ssl.rst:1336 msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " @@ -1455,7 +1460,7 @@ msgid "" "channel binding type is requested." msgstr "" -#: ../../library/ssl.rst:1348 +#: ../../library/ssl.rst:1346 msgid "" "Return the protocol that was selected during the TLS handshake. If :meth:" "`SSLContext.set_alpn_protocols` was not called, if the other party does not " @@ -1463,7 +1468,7 @@ msgid "" "protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" -#: ../../library/ssl.rst:1358 +#: ../../library/ssl.rst:1356 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1471,11 +1476,11 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1367 ../../library/ssl.rst:1727 +#: ../../library/ssl.rst:1365 ../../library/ssl.rst:1725 msgid "NPN has been superseded by ALPN" msgstr "" -#: ../../library/ssl.rst:1371 +#: ../../library/ssl.rst:1369 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1484,7 +1489,7 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: ../../library/ssl.rst:1379 +#: ../../library/ssl.rst:1377 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " @@ -1492,26 +1497,26 @@ msgid "" "`SSLContext.post_handshake_auth`." msgstr "" -#: ../../library/ssl.rst:1384 +#: ../../library/ssl.rst:1382 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: ../../library/ssl.rst:1388 +#: ../../library/ssl.rst:1386 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" -#: ../../library/ssl.rst:1392 +#: ../../library/ssl.rst:1390 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/ssl.rst:1399 +#: ../../library/ssl.rst:1397 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1520,13 +1525,13 @@ msgid "" "may define more return values." msgstr "" -#: ../../library/ssl.rst:1409 +#: ../../library/ssl.rst:1407 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: ../../library/ssl.rst:1414 +#: ../../library/ssl.rst:1412 msgid "" "The :class:`SSLContext` object this SSL socket is tied to. If the SSL " "socket was created using the deprecated :func:`wrap_socket` function (rather " @@ -1534,19 +1539,19 @@ msgid "" "created for this SSL socket." msgstr "" -#: ../../library/ssl.rst:1423 +#: ../../library/ssl.rst:1421 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1428 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: ../../library/ssl.rst:1435 +#: ../../library/ssl.rst:1433 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " @@ -1554,7 +1559,7 @@ msgid "" "org\"``)." msgstr "" -#: ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1441 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " @@ -1562,11 +1567,11 @@ msgid "" "`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: ../../library/ssl.rst:1456 +#: ../../library/ssl.rst:1454 msgid "SSL Contexts" msgstr "" -#: ../../library/ssl.rst:1460 +#: ../../library/ssl.rst:1458 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1574,7 +1579,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: ../../library/ssl.rst:1467 +#: ../../library/ssl.rst:1465 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1585,109 +1590,109 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: ../../library/ssl.rst:1476 +#: ../../library/ssl.rst:1474 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "*client* / **server**" msgstr "" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "**SSLv2**" msgstr "**SSLv2**" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "**SSLv3**" msgstr "**SSLv3**" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "**TLS** [3]_" msgstr "**TLS** [3]_" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "**TLSv1**" msgstr "**TLSv1**" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "**TLSv1.1**" msgstr "**TLSv1.1**" -#: ../../library/ssl.rst:1482 +#: ../../library/ssl.rst:1480 msgid "**TLSv1.2**" msgstr "**TLSv1.2**" -#: ../../library/ssl.rst:1484 +#: ../../library/ssl.rst:1482 msgid "*SSLv2*" msgstr "*SSLv2*" +#: ../../library/ssl.rst:1482 ../../library/ssl.rst:1483 #: ../../library/ssl.rst:1484 ../../library/ssl.rst:1485 #: ../../library/ssl.rst:1486 ../../library/ssl.rst:1487 -#: ../../library/ssl.rst:1488 ../../library/ssl.rst:1489 msgid "yes" msgstr "" -#: ../../library/ssl.rst:1484 ../../library/ssl.rst:1485 -#: ../../library/ssl.rst:1487 ../../library/ssl.rst:1488 -#: ../../library/ssl.rst:1489 +#: ../../library/ssl.rst:1482 ../../library/ssl.rst:1483 +#: ../../library/ssl.rst:1485 ../../library/ssl.rst:1486 +#: ../../library/ssl.rst:1487 msgid "no" msgstr "" -#: ../../library/ssl.rst:1484 ../../library/ssl.rst:1486 +#: ../../library/ssl.rst:1482 ../../library/ssl.rst:1484 msgid "no [1]_" msgstr "" -#: ../../library/ssl.rst:1485 +#: ../../library/ssl.rst:1483 msgid "*SSLv3*" msgstr "*SSLv3*" -#: ../../library/ssl.rst:1485 ../../library/ssl.rst:1486 +#: ../../library/ssl.rst:1483 ../../library/ssl.rst:1484 msgid "no [2]_" msgstr "" -#: ../../library/ssl.rst:1486 +#: ../../library/ssl.rst:1484 msgid "*TLS* (*SSLv23*) [3]_" msgstr "*TLS* (*SSLv23*) [3]_" -#: ../../library/ssl.rst:1487 +#: ../../library/ssl.rst:1485 msgid "*TLSv1*" msgstr "*TLSv1*" -#: ../../library/ssl.rst:1488 +#: ../../library/ssl.rst:1486 msgid "*TLSv1.1*" msgstr "*TLSv1.1*" -#: ../../library/ssl.rst:1489 +#: ../../library/ssl.rst:1487 msgid "*TLSv1.2*" msgstr "*TLSv1.2*" -#: ../../library/ssl.rst:1492 +#: ../../library/ssl.rst:1490 msgid "Footnotes" msgstr "註解" -#: ../../library/ssl.rst:1493 +#: ../../library/ssl.rst:1491 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr "" -#: ../../library/ssl.rst:1494 +#: ../../library/ssl.rst:1492 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr "" -#: ../../library/ssl.rst:1495 +#: ../../library/ssl.rst:1493 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: ../../library/ssl.rst:1500 +#: ../../library/ssl.rst:1498 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: ../../library/ssl.rst:1505 +#: ../../library/ssl.rst:1503 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -1698,14 +1703,14 @@ msgid "" "for :data:`PROTOCOL_SSLv2`)." msgstr "" -#: ../../library/ssl.rst:1516 +#: ../../library/ssl.rst:1514 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " "class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" -#: ../../library/ssl.rst:1522 +#: ../../library/ssl.rst:1520 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " @@ -1714,22 +1719,22 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1529 +#: ../../library/ssl.rst:1527 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr "" -#: ../../library/ssl.rst:1533 +#: ../../library/ssl.rst:1531 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1537 +#: ../../library/ssl.rst:1535 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1547 +#: ../../library/ssl.rst:1545 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -1740,7 +1745,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1556 +#: ../../library/ssl.rst:1554 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -1752,24 +1757,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1565 +#: ../../library/ssl.rst:1563 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1569 +#: ../../library/ssl.rst:1567 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1572 +#: ../../library/ssl.rst:1570 msgid "New optional argument *password*." msgstr "" -#: ../../library/ssl.rst:1577 +#: ../../library/ssl.rst:1575 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -1778,7 +1783,7 @@ msgid "" "from other locations, too." msgstr "" -#: ../../library/ssl.rst:1583 +#: ../../library/ssl.rst:1581 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :data:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -1787,28 +1792,28 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1593 +#: ../../library/ssl.rst:1591 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " "other peers' certificates when :data:`verify_mode` is other than :data:" "`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" -#: ../../library/ssl.rst:1597 +#: ../../library/ssl.rst:1595 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1601 +#: ../../library/ssl.rst:1599 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1606 +#: ../../library/ssl.rst:1604 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " @@ -1816,7 +1821,7 @@ msgid "" "html>`_." msgstr "" -#: ../../library/ssl.rst:1611 +#: ../../library/ssl.rst:1609 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -1824,11 +1829,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1616 +#: ../../library/ssl.rst:1614 msgid "New optional argument *cadata*" msgstr "" -#: ../../library/ssl.rst:1621 +#: ../../library/ssl.rst:1619 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -1838,19 +1843,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1629 +#: ../../library/ssl.rst:1627 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1636 +#: ../../library/ssl.rst:1634 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1673 +#: ../../library/ssl.rst:1671 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -1860,7 +1865,7 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1682 +#: ../../library/ssl.rst:1680 msgid "" "Set the available ciphers for sockets created with this context. It should " "be a string in the `OpenSSL cipher list format `_" msgstr "" -#: ../../library/ssl.rst:1820 +#: ../../library/ssl.rst:1818 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1826 +#: ../../library/ssl.rst:1824 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -2049,13 +2054,13 @@ msgid "" "a :data:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:1832 +#: ../../library/ssl.rst:1830 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1835 +#: ../../library/ssl.rst:1833 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -2066,7 +2071,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1843 +#: ../../library/ssl.rst:1841 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2075,7 +2080,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1849 +#: ../../library/ssl.rst:1847 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -2085,7 +2090,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1856 +#: ../../library/ssl.rst:1854 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -2095,34 +2100,34 @@ msgid "" "exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1863 +#: ../../library/ssl.rst:1861 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1865 +#: ../../library/ssl.rst:1863 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1869 ../../library/ssl.rst:1895 +#: ../../library/ssl.rst:1867 ../../library/ssl.rst:1893 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1872 +#: ../../library/ssl.rst:1870 msgid "" -"The method returns on instance of :attr:`SSLContext.sslsocket_class` instead " +"The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1878 +#: ../../library/ssl.rst:1876 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" "`SSLSocket`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1887 +#: ../../library/ssl.rst:1885 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2130,26 +2135,26 @@ msgid "" "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1892 +#: ../../library/ssl.rst:1890 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1898 +#: ../../library/ssl.rst:1896 msgid "" -"The method returns on instance of :attr:`SSLContext.sslobject_class` instead " +"The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1904 +#: ../../library/ssl.rst:1902 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1912 +#: ../../library/ssl.rst:1910 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2158,7 +2163,7 @@ msgid "" "misses in the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1923 +#: ../../library/ssl.rst:1921 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2171,7 +2176,7 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1951 +#: ../../library/ssl.rst:1949 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2179,7 +2184,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1958 +#: ../../library/ssl.rst:1956 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2188,7 +2193,7 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1968 +#: ../../library/ssl.rst:1966 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " @@ -2196,7 +2201,7 @@ msgid "" "`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1973 +#: ../../library/ssl.rst:1971 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2206,38 +2211,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1986 +#: ../../library/ssl.rst:1984 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1993 +#: ../../library/ssl.rst:1991 msgid "" "Control the number of TLS 1.3 session tickets of a :attr:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" -#: ../../library/ssl.rst:2001 +#: ../../library/ssl.rst:1999 msgid "" "An integer representing the set of SSL options enabled on this context. The " "default value is :data:`OP_ALL`, but you can specify other options such as :" "data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:2005 +#: ../../library/ssl.rst:2003 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" -#: ../../library/ssl.rst:2013 +#: ../../library/ssl.rst:2011 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:2019 +#: ../../library/ssl.rst:2017 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2245,13 +2250,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:2024 +#: ../../library/ssl.rst:2022 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:2027 +#: ../../library/ssl.rst:2025 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " @@ -2259,59 +2264,59 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:2037 +#: ../../library/ssl.rst:2035 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:2042 +#: ../../library/ssl.rst:2040 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:2050 +#: ../../library/ssl.rst:2048 msgid "" "The flag had no effect with OpenSSL before version 1.1.1k. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:2055 +#: ../../library/ssl.rst:2053 msgid "" "An integer representing the `security level `_ for the context. This " "attribute is read-only." msgstr "" -#: ../../library/ssl.rst:2063 +#: ../../library/ssl.rst:2061 msgid "" "The flags for certificate verification operations. You can set flags like :" "data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " "neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:2069 +#: ../../library/ssl.rst:2067 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr "" -#: ../../library/ssl.rst:2077 +#: ../../library/ssl.rst:2075 msgid "" "Whether to try to verify other peers' certificates and how to behave if " "verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" "`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:2081 +#: ../../library/ssl.rst:2079 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr "" -#: ../../library/ssl.rst:2094 +#: ../../library/ssl.rst:2092 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2096 +#: ../../library/ssl.rst:2094 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2322,7 +2327,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2104 +#: ../../library/ssl.rst:2102 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2336,7 +2341,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2114 +#: ../../library/ssl.rst:2112 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2349,18 +2354,18 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2124 +#: ../../library/ssl.rst:2122 msgid "" "Python uses files to contain certificates. They should be formatted as \"PEM" "\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a header " "line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2133 +#: ../../library/ssl.rst:2131 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2135 +#: ../../library/ssl.rst:2133 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -2376,11 +2381,11 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2159 +#: ../../library/ssl.rst:2157 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2161 +#: ../../library/ssl.rst:2159 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -2392,11 +2397,11 @@ msgid "" "create_default_context`." msgstr "" -#: ../../library/ssl.rst:2170 +#: ../../library/ssl.rst:2168 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2172 +#: ../../library/ssl.rst:2170 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -2405,11 +2410,11 @@ msgid "" "certificate chain::" msgstr "" -#: ../../library/ssl.rst:2186 +#: ../../library/ssl.rst:2184 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2188 +#: ../../library/ssl.rst:2186 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -2419,51 +2424,51 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2217 +#: ../../library/ssl.rst:2215 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2223 +#: ../../library/ssl.rst:2221 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2226 +#: ../../library/ssl.rst:2224 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2228 +#: ../../library/ssl.rst:2226 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2239 +#: ../../library/ssl.rst:2237 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2241 +#: ../../library/ssl.rst:2239 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2246 +#: ../../library/ssl.rst:2244 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2253 +#: ../../library/ssl.rst:2251 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2257 +#: ../../library/ssl.rst:2255 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -2471,7 +2476,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2262 +#: ../../library/ssl.rst:2260 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -2480,27 +2485,27 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2272 +#: ../../library/ssl.rst:2270 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2276 +#: ../../library/ssl.rst:2274 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2319 +#: ../../library/ssl.rst:2317 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2346 +#: ../../library/ssl.rst:2344 msgid "Server-side operation" msgstr "" -#: ../../library/ssl.rst:2348 +#: ../../library/ssl.rst:2346 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -2509,20 +2514,20 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2363 +#: ../../library/ssl.rst:2361 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " "new socket from the other end, and use the context's :meth:`SSLContext." "wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2376 +#: ../../library/ssl.rst:2374 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2390 +#: ../../library/ssl.rst:2388 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -2530,18 +2535,18 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2398 +#: ../../library/ssl.rst:2396 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2400 +#: ../../library/ssl.rst:2398 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2404 +#: ../../library/ssl.rst:2402 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -2553,13 +2558,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2416 +#: ../../library/ssl.rst:2414 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2420 +#: ../../library/ssl.rst:2418 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -2569,7 +2574,7 @@ msgid "" "`~select.select`." msgstr "" -#: ../../library/ssl.rst:2427 +#: ../../library/ssl.rst:2425 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -2578,13 +2583,13 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2433 +#: ../../library/ssl.rst:2431 msgid "" "(of course, similar provisions apply when using other primitives such as :" "func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2436 +#: ../../library/ssl.rst:2434 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -2592,7 +2597,7 @@ msgid "" "readiness::" msgstr "" -#: ../../library/ssl.rst:2452 +#: ../../library/ssl.rst:2450 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level API. It polls for events using " @@ -2601,26 +2606,26 @@ msgid "" "handshake asynchronously as well." msgstr "" -#: ../../library/ssl.rst:2461 +#: ../../library/ssl.rst:2459 msgid "Memory BIO Support" msgstr "" -#: ../../library/ssl.rst:2465 +#: ../../library/ssl.rst:2463 msgid "" "Ever since the SSL module was introduced in Python 2.6, the :class:" "`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: ../../library/ssl.rst:2468 +#: ../../library/ssl.rst:2466 msgid "SSL protocol handling" msgstr "" -#: ../../library/ssl.rst:2469 +#: ../../library/ssl.rst:2467 msgid "Network IO" msgstr "" -#: ../../library/ssl.rst:2471 +#: ../../library/ssl.rst:2469 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -2628,7 +2633,7 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: ../../library/ssl.rst:2476 +#: ../../library/ssl.rst:2474 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " @@ -2640,7 +2645,7 @@ msgid "" "`SSLObject` is provided." msgstr "" -#: ../../library/ssl.rst:2487 +#: ../../library/ssl.rst:2485 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -2648,7 +2653,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: ../../library/ssl.rst:2492 +#: ../../library/ssl.rst:2490 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -2656,7 +2661,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: ../../library/ssl.rst:2497 +#: ../../library/ssl.rst:2495 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -2665,214 +2670,214 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: ../../library/ssl.rst:2504 +#: ../../library/ssl.rst:2502 msgid "The following methods are available:" msgstr "" -#: ../../library/ssl.rst:2506 +#: ../../library/ssl.rst:2504 msgid ":attr:`~SSLSocket.context`" msgstr ":attr:`~SSLSocket.context`" -#: ../../library/ssl.rst:2507 +#: ../../library/ssl.rst:2505 msgid ":attr:`~SSLSocket.server_side`" msgstr ":attr:`~SSLSocket.server_side`" -#: ../../library/ssl.rst:2508 +#: ../../library/ssl.rst:2506 msgid ":attr:`~SSLSocket.server_hostname`" msgstr ":attr:`~SSLSocket.server_hostname`" -#: ../../library/ssl.rst:2509 +#: ../../library/ssl.rst:2507 msgid ":attr:`~SSLSocket.session`" msgstr ":attr:`~SSLSocket.session`" -#: ../../library/ssl.rst:2510 +#: ../../library/ssl.rst:2508 msgid ":attr:`~SSLSocket.session_reused`" msgstr ":attr:`~SSLSocket.session_reused`" -#: ../../library/ssl.rst:2511 +#: ../../library/ssl.rst:2509 msgid ":meth:`~SSLSocket.read`" msgstr ":meth:`~SSLSocket.read`" -#: ../../library/ssl.rst:2512 +#: ../../library/ssl.rst:2510 msgid ":meth:`~SSLSocket.write`" msgstr ":meth:`~SSLSocket.write`" -#: ../../library/ssl.rst:2513 +#: ../../library/ssl.rst:2511 msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2514 +#: ../../library/ssl.rst:2512 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr ":meth:`~SSLSocket.selected_alpn_protocol`" -#: ../../library/ssl.rst:2515 +#: ../../library/ssl.rst:2513 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr ":meth:`~SSLSocket.selected_npn_protocol`" -#: ../../library/ssl.rst:2516 +#: ../../library/ssl.rst:2514 msgid ":meth:`~SSLSocket.cipher`" msgstr ":meth:`~SSLSocket.cipher`" -#: ../../library/ssl.rst:2517 +#: ../../library/ssl.rst:2515 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr ":meth:`~SSLSocket.shared_ciphers`" -#: ../../library/ssl.rst:2518 +#: ../../library/ssl.rst:2516 msgid ":meth:`~SSLSocket.compression`" msgstr ":meth:`~SSLSocket.compression`" -#: ../../library/ssl.rst:2519 +#: ../../library/ssl.rst:2517 msgid ":meth:`~SSLSocket.pending`" msgstr ":meth:`~SSLSocket.pending`" -#: ../../library/ssl.rst:2520 +#: ../../library/ssl.rst:2518 msgid ":meth:`~SSLSocket.do_handshake`" msgstr ":meth:`~SSLSocket.do_handshake`" -#: ../../library/ssl.rst:2521 +#: ../../library/ssl.rst:2519 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr ":meth:`~SSLSocket.verify_client_post_handshake`" -#: ../../library/ssl.rst:2522 +#: ../../library/ssl.rst:2520 msgid ":meth:`~SSLSocket.unwrap`" msgstr ":meth:`~SSLSocket.unwrap`" -#: ../../library/ssl.rst:2523 +#: ../../library/ssl.rst:2521 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr ":meth:`~SSLSocket.get_channel_binding`" -#: ../../library/ssl.rst:2524 +#: ../../library/ssl.rst:2522 msgid ":meth:`~SSLSocket.version`" msgstr ":meth:`~SSLSocket.version`" -#: ../../library/ssl.rst:2526 +#: ../../library/ssl.rst:2524 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: ../../library/ssl.rst:2529 +#: ../../library/ssl.rst:2527 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: ../../library/ssl.rst:2532 +#: ../../library/ssl.rst:2530 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: ../../library/ssl.rst:2535 +#: ../../library/ssl.rst:2533 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " "that are in violation of the protocol are reported via the :exc:" "`SSLEOFError` exception." msgstr "" -#: ../../library/ssl.rst:2539 +#: ../../library/ssl.rst:2537 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: ../../library/ssl.rst:2542 +#: ../../library/ssl.rst:2540 msgid "" "The *server_name_callback* callback passed to :meth:`SSLContext." "set_servername_callback` will get an :class:`SSLObject` instance instead of " "a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: ../../library/ssl.rst:2546 +#: ../../library/ssl.rst:2544 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: ../../library/ssl.rst:2548 +#: ../../library/ssl.rst:2546 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " "This means that for example :meth:`~SSLSocket.read` will raise an :exc:" "`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: ../../library/ssl.rst:2553 +#: ../../library/ssl.rst:2551 msgid "" "There is no module-level ``wrap_bio()`` call like there is for :meth:" "`~SSLContext.wrap_socket`. An :class:`SSLObject` is always created via an :" "class:`SSLContext`." msgstr "" -#: ../../library/ssl.rst:2557 +#: ../../library/ssl.rst:2555 msgid "" ":class:`SSLObject` instances must to created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2563 +#: ../../library/ssl.rst:2561 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2569 +#: ../../library/ssl.rst:2567 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2574 +#: ../../library/ssl.rst:2572 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2578 +#: ../../library/ssl.rst:2576 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2583 +#: ../../library/ssl.rst:2581 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2588 +#: ../../library/ssl.rst:2586 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2591 +#: ../../library/ssl.rst:2589 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2596 +#: ../../library/ssl.rst:2594 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2602 +#: ../../library/ssl.rst:2600 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2608 +#: ../../library/ssl.rst:2606 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2620 +#: ../../library/ssl.rst:2618 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2623 +#: ../../library/ssl.rst:2621 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2625 +#: ../../library/ssl.rst:2623 msgid "" "For **client use**, if you don't have any special requirements for your " "security policy, it is highly recommended that you use the :func:" @@ -2882,19 +2887,19 @@ msgid "" "settings." msgstr "" -#: ../../library/ssl.rst:2632 +#: ../../library/ssl.rst:2630 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2641 +#: ../../library/ssl.rst:2639 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2644 +#: ../../library/ssl.rst:2642 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -2902,15 +2907,15 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2650 +#: ../../library/ssl.rst:2648 msgid "Manual settings" msgstr "" -#: ../../library/ssl.rst:2653 +#: ../../library/ssl.rst:2651 msgid "Verifying certificates" msgstr "" -#: ../../library/ssl.rst:2655 +#: ../../library/ssl.rst:2653 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " @@ -2925,13 +2930,13 @@ msgid "" "automatically performed when :attr:`SSLContext.check_hostname` is enabled." msgstr "" -#: ../../library/ssl.rst:2668 +#: ../../library/ssl.rst:2666 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" "`match_hostname`." msgstr "" -#: ../../library/ssl.rst:2672 +#: ../../library/ssl.rst:2670 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -2939,11 +2944,11 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2678 +#: ../../library/ssl.rst:2676 msgid "Protocol versions" msgstr "" -#: ../../library/ssl.rst:2680 +#: ../../library/ssl.rst:2678 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " @@ -2952,7 +2957,7 @@ msgid "" "by default." msgstr "" -#: ../../library/ssl.rst:2693 +#: ../../library/ssl.rst:2691 msgid "" "The SSL context created above will only allow TLSv1.2 and later (if " "supported by your system) connections to a server. :const:" @@ -2960,11 +2965,11 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2700 +#: ../../library/ssl.rst:2698 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2702 +#: ../../library/ssl.rst:2700 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" @@ -2977,11 +2982,11 @@ msgid "" "ciphers`` command on your system." msgstr "" -#: ../../library/ssl.rst:2713 +#: ../../library/ssl.rst:2711 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2715 +#: ../../library/ssl.rst:2713 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -2992,17 +2997,17 @@ msgid "" "`~ssl.RAND_pseudo_bytes` is sufficient." msgstr "" -#: ../../library/ssl.rst:2727 +#: ../../library/ssl.rst:2725 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2731 +#: ../../library/ssl.rst:2729 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2734 +#: ../../library/ssl.rst:2732 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " "cipher suites are enabled by default. The method :meth:`SSLContext." @@ -3010,14 +3015,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2738 +#: ../../library/ssl.rst:2736 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2741 +#: ../../library/ssl.rst:2739 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3025,102 +3030,102 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2745 +#: ../../library/ssl.rst:2743 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2752 +#: ../../library/ssl.rst:2750 msgid "Class :class:`socket.socket`" msgstr "" -#: ../../library/ssl.rst:2752 +#: ../../library/ssl.rst:2750 msgid "Documentation of underlying :mod:`socket` class" msgstr "" -#: ../../library/ssl.rst:2755 +#: ../../library/ssl.rst:2753 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" msgstr "" -#: ../../library/ssl.rst:2755 +#: ../../library/ssl.rst:2753 msgid "Intro from the Apache HTTP Server documentation" msgstr "" -#: ../../library/ssl.rst:2758 +#: ../../library/ssl.rst:2756 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" msgstr "" -#: ../../library/ssl.rst:2758 +#: ../../library/ssl.rst:2756 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2761 +#: ../../library/ssl.rst:2759 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr "" -#: ../../library/ssl.rst:2761 +#: ../../library/ssl.rst:2759 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2764 +#: ../../library/ssl.rst:2762 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" msgstr "" -#: ../../library/ssl.rst:2764 +#: ../../library/ssl.rst:2762 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2767 +#: ../../library/ssl.rst:2765 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" msgstr "" -#: ../../library/ssl.rst:2767 +#: ../../library/ssl.rst:2765 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2770 +#: ../../library/ssl.rst:2768 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr "" -#: ../../library/ssl.rst:2770 +#: ../../library/ssl.rst:2768 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2773 +#: ../../library/ssl.rst:2771 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" msgstr "" -#: ../../library/ssl.rst:2773 +#: ../../library/ssl.rst:2771 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2776 +#: ../../library/ssl.rst:2774 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" msgstr "" -#: ../../library/ssl.rst:2776 +#: ../../library/ssl.rst:2774 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2778 +#: ../../library/ssl.rst:2776 msgid "" "`Mozilla's Server Side TLS recommendations `_" msgstr "" -#: ../../library/ssl.rst:2779 +#: ../../library/ssl.rst:2777 msgid "Mozilla" msgstr "Mozilla" diff --git a/library/statistics.po b/library/statistics.po index 95ca852f31..4024ac327c 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-07-27 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,7 +88,7 @@ msgid ":func:`fmean`" msgstr ":func:`fmean`" #: ../../library/statistics.rst:75 -msgid "Fast, floating point arithmetic mean." +msgid "Fast, floating point arithmetic mean, with optional weighting." msgstr "" #: ../../library/statistics.rst:76 @@ -96,9 +96,8 @@ msgid ":func:`geometric_mean`" msgstr ":func:`geometric_mean`" #: ../../library/statistics.rst:76 -#, fuzzy msgid "Geometric mean of data." -msgstr "數據中較小的中位數。" +msgstr "數據中的幾何平均數。" #: ../../library/statistics.rst:77 msgid ":func:`harmonic_mean`" @@ -301,37 +300,54 @@ msgid "" "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" -#: ../../library/statistics.rst:179 +#: ../../library/statistics.rst:174 +msgid "" +"Optional weighting is supported. For example, a professor assigns a grade " +"for a course by weighting quizzes at 20%, homework at 20%, a midterm exam at " +"30%, and a final exam at 30%:" +msgstr "" + +#: ../../library/statistics.rst:185 +msgid "" +"If *weights* is supplied, it must be the same length as the *data* or a :exc:" +"`ValueError` will be raised." +msgstr "" + +#: ../../library/statistics.rst:190 ../../library/statistics.rst:258 +msgid "Added support for *weights*." +msgstr "新增 *weights* 的支援。" + +#: ../../library/statistics.rst:196 msgid "Convert *data* to floats and compute the geometric mean." msgstr "" -#: ../../library/statistics.rst:181 +#: ../../library/statistics.rst:198 msgid "" "The geometric mean indicates the central tendency or typical value of the " "*data* using the product of the values (as opposed to the arithmetic mean " "which uses their sum)." msgstr "" -#: ../../library/statistics.rst:185 +#: ../../library/statistics.rst:202 msgid "" "Raises a :exc:`StatisticsError` if the input dataset is empty, if it " "contains a zero, or if it contains a negative value. The *data* may be a " "sequence or iterable." msgstr "" -#: ../../library/statistics.rst:189 +#: ../../library/statistics.rst:206 msgid "" "No special efforts are made to achieve exact results. (However, this may " "change in the future.)" msgstr "" -#: ../../library/statistics.rst:202 +#: ../../library/statistics.rst:219 msgid "" "Return the harmonic mean of *data*, a sequence or iterable of real-valued " "numbers. If *weights* is omitted or *None*, then equal weighting is assumed." msgstr "" -#: ../../library/statistics.rst:206 +#: ../../library/statistics.rst:223 msgid "" "The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the " "reciprocals of the data. For example, the harmonic mean of three values *a*, " @@ -339,122 +355,118 @@ msgid "" "values is zero, the result will be zero." msgstr "" -#: ../../library/statistics.rst:211 +#: ../../library/statistics.rst:228 msgid "" "The harmonic mean is a type of average, a measure of the central location of " "the data. It is often appropriate when averaging ratios or rates, for " "example speeds." msgstr "" -#: ../../library/statistics.rst:215 +#: ../../library/statistics.rst:232 msgid "" "Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. " "What is the average speed?" msgstr "" -#: ../../library/statistics.rst:223 +#: ../../library/statistics.rst:240 msgid "" "Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up " "to 60 km/hr for the remaining 30 km of the journey. What is the average " "speed?" msgstr "" -#: ../../library/statistics.rst:232 +#: ../../library/statistics.rst:249 msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" -#: ../../library/statistics.rst:235 +#: ../../library/statistics.rst:252 msgid "" "The current algorithm has an early-out when it encounters a zero in the " "input. This means that the subsequent inputs are not tested for validity. " "(This behavior may change in the future.)" msgstr "" -#: ../../library/statistics.rst:241 -msgid "Added support for *weights*." -msgstr "新增 *weights* 的支援。" - -#: ../../library/statistics.rst:246 +#: ../../library/statistics.rst:263 msgid "" "Return the median (middle value) of numeric data, using the common \"mean of " "middle two\" method. If *data* is empty, :exc:`StatisticsError` is raised. " "*data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:250 +#: ../../library/statistics.rst:267 msgid "" "The median is a robust measure of central location and is less affected by " "the presence of outliers. When the number of data points is odd, the middle " "data point is returned:" msgstr "" -#: ../../library/statistics.rst:259 +#: ../../library/statistics.rst:276 msgid "" "When the number of data points is even, the median is interpolated by taking " "the average of the two middle values:" msgstr "" -#: ../../library/statistics.rst:267 +#: ../../library/statistics.rst:284 msgid "" "This is suited for when your data is discrete, and you don't mind that the " "median may not be an actual data point." msgstr "" -#: ../../library/statistics.rst:270 +#: ../../library/statistics.rst:287 msgid "" "If the data is ordinal (supports order operations) but not numeric (doesn't " "support addition), consider using :func:`median_low` or :func:`median_high` " "instead." msgstr "" -#: ../../library/statistics.rst:276 +#: ../../library/statistics.rst:293 msgid "" "Return the low median of numeric data. If *data* is empty, :exc:" "`StatisticsError` is raised. *data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:279 +#: ../../library/statistics.rst:296 msgid "" "The low median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the smaller " "of the two middle values is returned." msgstr "" -#: ../../library/statistics.rst:290 +#: ../../library/statistics.rst:307 msgid "" "Use the low median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." msgstr "" -#: ../../library/statistics.rst:296 +#: ../../library/statistics.rst:313 msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:299 +#: ../../library/statistics.rst:316 msgid "" "The high median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the larger of " "the two middle values is returned." msgstr "" -#: ../../library/statistics.rst:310 +#: ../../library/statistics.rst:327 msgid "" "Use the high median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." msgstr "" -#: ../../library/statistics.rst:316 +#: ../../library/statistics.rst:333 msgid "" "Return the median of grouped continuous data, calculated as the 50th " "percentile, using interpolation. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:325 +#: ../../library/statistics.rst:342 msgid "" "In the following example, the data are rounded, so that each value " "represents the midpoint of data classes, e.g. 1 is the midpoint of the class " @@ -463,31 +475,31 @@ msgid "" "3.5--4.5, and interpolation is used to estimate it:" msgstr "" -#: ../../library/statistics.rst:336 +#: ../../library/statistics.rst:353 msgid "" "Optional argument *interval* represents the class interval, and defaults to " "1. Changing the class interval naturally will change the interpolation:" msgstr "" -#: ../../library/statistics.rst:346 +#: ../../library/statistics.rst:363 msgid "" "This function does not check whether the data points are at least *interval* " "apart." msgstr "" -#: ../../library/statistics.rst:351 +#: ../../library/statistics.rst:368 msgid "" "Under some circumstances, :func:`median_grouped` may coerce data points to " "floats. This behaviour is likely to change in the future." msgstr "" -#: ../../library/statistics.rst:356 +#: ../../library/statistics.rst:373 msgid "" "\"Statistics for the Behavioral Sciences\", Frederick J Gravetter and Larry " "B Wallnau (8th Edition)." msgstr "" -#: ../../library/statistics.rst:359 +#: ../../library/statistics.rst:376 msgid "" "The `SSMEDIAN `_ function in the Gnome Gnumeric " @@ -495,14 +507,14 @@ msgid "" "gnumeric-list/2011-April/msg00018.html>`_." msgstr "" -#: ../../library/statistics.rst:367 +#: ../../library/statistics.rst:384 msgid "" "Return the single most common data point from discrete or nominal *data*. " "The mode (when it exists) is the most typical value and serves as a measure " "of central location." msgstr "" -#: ../../library/statistics.rst:371 +#: ../../library/statistics.rst:388 msgid "" "If there are multiple modes with the same frequency, returns the first one " "encountered in the *data*. If the smallest or largest of those is desired " @@ -510,38 +522,38 @@ msgid "" "input *data* is empty, :exc:`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:376 +#: ../../library/statistics.rst:393 msgid "" "``mode`` assumes discrete data and returns a single value. This is the " "standard treatment of the mode as commonly taught in schools:" msgstr "" -#: ../../library/statistics.rst:384 +#: ../../library/statistics.rst:401 msgid "" "The mode is unique in that it is the only statistic in this package that " "also applies to nominal (non-numeric) data:" msgstr "" -#: ../../library/statistics.rst:392 +#: ../../library/statistics.rst:409 msgid "" "Now handles multimodal datasets by returning the first mode encountered. " "Formerly, it raised :exc:`StatisticsError` when more than one mode was found." msgstr "" -#: ../../library/statistics.rst:400 +#: ../../library/statistics.rst:417 msgid "" "Return a list of the most frequently occurring values in the order they were " "first encountered in the *data*. Will return more than one result if there " "are multiple modes or an empty list if the *data* is empty:" msgstr "" -#: ../../library/statistics.rst:416 +#: ../../library/statistics.rst:433 msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." msgstr "" -#: ../../library/statistics.rst:427 +#: ../../library/statistics.rst:444 msgid "" "Return the population variance of *data*, a non-empty sequence or iterable " "of real-valued numbers. Variance, or second moment about the mean, is a " @@ -550,7 +562,7 @@ msgid "" "clustered closely around the mean." msgstr "" -#: ../../library/statistics.rst:433 +#: ../../library/statistics.rst:450 msgid "" "If the optional second argument *mu* is given, it is typically the mean of " "the *data*. It can also be used to compute the second moment around a point " @@ -558,40 +570,40 @@ msgid "" "arithmetic mean is automatically calculated." msgstr "" -#: ../../library/statistics.rst:438 +#: ../../library/statistics.rst:455 msgid "" "Use this function to calculate the variance from the entire population. To " "estimate the variance from a sample, the :func:`variance` function is " "usually a better choice." msgstr "" -#: ../../library/statistics.rst:442 +#: ../../library/statistics.rst:459 msgid "Raises :exc:`StatisticsError` if *data* is empty." msgstr "" -#: ../../library/statistics.rst:444 ../../library/statistics.rst:514 -#: ../../library/statistics.rst:618 ../../library/statistics.rst:646 +#: ../../library/statistics.rst:461 ../../library/statistics.rst:531 +#: ../../library/statistics.rst:635 ../../library/statistics.rst:663 msgid "Examples:" msgstr "範例:" -#: ../../library/statistics.rst:452 +#: ../../library/statistics.rst:469 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *mu* to avoid recalculation:" msgstr "" -#: ../../library/statistics.rst:461 +#: ../../library/statistics.rst:478 msgid "Decimals and Fractions are supported:" msgstr "" -#: ../../library/statistics.rst:475 +#: ../../library/statistics.rst:492 msgid "" "When called with the entire population, this gives the population variance " "σ². When called on a sample instead, this is the biased sample variance s², " "also known as variance with N degrees of freedom." msgstr "" -#: ../../library/statistics.rst:479 +#: ../../library/statistics.rst:496 msgid "" "If you somehow know the true population mean μ, you may use this function to " "calculate the variance of a sample, giving the known population mean as the " @@ -600,13 +612,13 @@ msgid "" "variance." msgstr "" -#: ../../library/statistics.rst:488 +#: ../../library/statistics.rst:505 msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." msgstr "" -#: ../../library/statistics.rst:499 +#: ../../library/statistics.rst:516 msgid "" "Return the sample variance of *data*, an iterable of at least two real-" "valued numbers. Variance, or second moment about the mean, is a measure of " @@ -615,41 +627,41 @@ msgid "" "closely around the mean." msgstr "" -#: ../../library/statistics.rst:505 +#: ../../library/statistics.rst:522 msgid "" "If the optional second argument *xbar* is given, it should be the mean of " "*data*. If it is missing or ``None`` (the default), the mean is " "automatically calculated." msgstr "" -#: ../../library/statistics.rst:509 +#: ../../library/statistics.rst:526 msgid "" "Use this function when your data is a sample from a population. To calculate " "the variance from the entire population, see :func:`pvariance`." msgstr "" -#: ../../library/statistics.rst:512 +#: ../../library/statistics.rst:529 msgid "Raises :exc:`StatisticsError` if *data* has fewer than two values." msgstr "" -#: ../../library/statistics.rst:522 +#: ../../library/statistics.rst:539 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *xbar* to avoid recalculation:" msgstr "" -#: ../../library/statistics.rst:531 +#: ../../library/statistics.rst:548 msgid "" "This function does not attempt to verify that you have passed the actual " "mean as *xbar*. Using arbitrary values for *xbar* can lead to invalid or " "impossible results." msgstr "" -#: ../../library/statistics.rst:535 +#: ../../library/statistics.rst:552 msgid "Decimal and Fraction values are supported:" msgstr "" -#: ../../library/statistics.rst:549 +#: ../../library/statistics.rst:566 msgid "" "This is the sample variance s² with Bessel's correction, also known as " "variance with N-1 degrees of freedom. Provided that the data points are " @@ -657,20 +669,20 @@ msgid "" "should be an unbiased estimate of the true population variance." msgstr "" -#: ../../library/statistics.rst:554 +#: ../../library/statistics.rst:571 msgid "" "If you somehow know the actual population mean μ you should pass it to the :" "func:`pvariance` function as the *mu* parameter to get the variance of a " "sample." msgstr "" -#: ../../library/statistics.rst:560 +#: ../../library/statistics.rst:577 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." msgstr "" -#: ../../library/statistics.rst:563 +#: ../../library/statistics.rst:580 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate " @@ -678,28 +690,28 @@ msgid "" "not least 1." msgstr "" -#: ../../library/statistics.rst:568 +#: ../../library/statistics.rst:585 msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " "Raises :exc:`StatisticsError` if there are not at least two data points." msgstr "" -#: ../../library/statistics.rst:572 +#: ../../library/statistics.rst:589 msgid "" "The cut points are linearly interpolated from the two nearest data points. " "For example, if a cut point falls one-third of the distance between two " "sample values, ``100`` and ``112``, the cut-point will evaluate to ``104``." msgstr "" -#: ../../library/statistics.rst:577 +#: ../../library/statistics.rst:594 msgid "" "The *method* for computing quantiles can be varied depending on whether the " "*data* includes or excludes the lowest and highest possible values from the " "population." msgstr "" -#: ../../library/statistics.rst:581 +#: ../../library/statistics.rst:598 msgid "" "The default *method* is \"exclusive\" and is used for data sampled from a " "population that can have more extreme values than found in the samples. The " @@ -709,7 +721,7 @@ msgid "" "70%, 80%, 90%." msgstr "" -#: ../../library/statistics.rst:588 +#: ../../library/statistics.rst:605 msgid "" "Setting the *method* to \"inclusive\" is used for describing population data " "or for samples that are known to include the most extreme values from the " @@ -721,19 +733,19 @@ msgid "" "80%, 90%, 100%." msgstr "" -#: ../../library/statistics.rst:612 +#: ../../library/statistics.rst:629 msgid "" "Return the sample covariance of two inputs *x* and *y*. Covariance is a " "measure of the joint variability of two inputs." msgstr "" -#: ../../library/statistics.rst:615 +#: ../../library/statistics.rst:632 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:636 +#: ../../library/statistics.rst:653 msgid "" "Return the `Pearson's correlation coefficient `_ for two inputs. Pearson's correlation " @@ -743,13 +755,13 @@ msgid "" "linear relationship." msgstr "" -#: ../../library/statistics.rst:643 +#: ../../library/statistics.rst:660 msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:661 +#: ../../library/statistics.rst:678 msgid "" "Return the slope and intercept of `simple linear regression `_ parameters estimated using " @@ -758,11 +770,11 @@ msgid "" "this linear function:" msgstr "" -#: ../../library/statistics.rst:667 +#: ../../library/statistics.rst:684 msgid "*y = slope \\* x + intercept + noise*" msgstr "*y = slope \\* x + intercept + noise*" -#: ../../library/statistics.rst:669 +#: ../../library/statistics.rst:686 msgid "" "where ``slope`` and ``intercept`` are the regression parameters that are " "estimated, and ``noise`` represents the variability of the data that was not " @@ -770,14 +782,14 @@ msgid "" "predicted and actual values of the dependent variable)." msgstr "" -#: ../../library/statistics.rst:675 +#: ../../library/statistics.rst:692 msgid "" "Both inputs must be of the same length (no less than two), and the " "independent variable *x* cannot be constant; otherwise a :exc:" "`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:679 +#: ../../library/statistics.rst:696 msgid "" "For example, we can use the `release dates of the Monty Python films " "`_ to predict the " @@ -785,23 +797,39 @@ msgid "" "2019 assuming that they had kept the pace." msgstr "" -#: ../../library/statistics.rst:697 +#: ../../library/statistics.rst:710 +msgid "" +"If *proportional* is true, the independent variable *x* and the dependent " +"variable *y* are assumed to be directly proportional. The data is fit to a " +"line passing through the origin. Since the *intercept* will always be 0.0, " +"the underlying linear function simplifies to:" +msgstr "" + +#: ../../library/statistics.rst:716 +msgid "*y = slope \\* x + noise*" +msgstr "*y = slope \\* x + noise*" + +#: ../../library/statistics.rst:720 +msgid "Added support for *proportional*." +msgstr "新增 *proportional* 的支援。" + +#: ../../library/statistics.rst:724 msgid "Exceptions" msgstr "例外" -#: ../../library/statistics.rst:699 +#: ../../library/statistics.rst:726 msgid "A single exception is defined:" msgstr "" -#: ../../library/statistics.rst:703 +#: ../../library/statistics.rst:730 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." msgstr "" -#: ../../library/statistics.rst:707 +#: ../../library/statistics.rst:734 msgid ":class:`NormalDist` objects" msgstr ":class:`NormalDist` 物件" -#: ../../library/statistics.rst:709 +#: ../../library/statistics.rst:736 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " "distributions of a `random variable `_ and have a wide range of " "applications in statistics." msgstr "" -#: ../../library/statistics.rst:721 +#: ../../library/statistics.rst:748 msgid "" "Returns a new *NormalDist* object where *mu* represents the `arithmetic mean " "`_ and *sigma* represents the " "`standard deviation `_." msgstr "" -#: ../../library/statistics.rst:726 +#: ../../library/statistics.rst:753 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." msgstr "" -#: ../../library/statistics.rst:730 +#: ../../library/statistics.rst:757 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:736 +#: ../../library/statistics.rst:763 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:742 +#: ../../library/statistics.rst:769 msgid "" "A read-only property for the `mode `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:748 +#: ../../library/statistics.rst:775 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:754 +#: ../../library/statistics.rst:781 msgid "" "A read-only property for the `variance `_ of a normal distribution. Equal to the square of the standard " "deviation." msgstr "" -#: ../../library/statistics.rst:760 +#: ../../library/statistics.rst:787 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." msgstr "" -#: ../../library/statistics.rst:763 +#: ../../library/statistics.rst:790 msgid "" "The *data* can be any :term:`iterable` and should consist of values that can " "be converted to type :class:`float`. If *data* does not contain at least " @@ -873,20 +901,20 @@ msgid "" "dispersion." msgstr "" -#: ../../library/statistics.rst:771 +#: ../../library/statistics.rst:798 msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" -#: ../../library/statistics.rst:774 +#: ../../library/statistics.rst:801 msgid "" "If *seed* is given, creates a new instance of the underlying random number " "generator. This is useful for creating reproducible results, even in a " "multi-threading context." msgstr "" -#: ../../library/statistics.rst:780 +#: ../../library/statistics.rst:807 msgid "" "Using a `probability density function (pdf) `_, compute the relative likelihood that a " @@ -894,7 +922,7 @@ msgid "" "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" -#: ../../library/statistics.rst:786 +#: ../../library/statistics.rst:813 msgid "" "The relative likelihood is computed as the probability of a sample occurring " "in a narrow range divided by the width of the range (hence the word \"density" @@ -902,7 +930,7 @@ msgid "" "greater than `1.0`." msgstr "" -#: ../../library/statistics.rst:793 +#: ../../library/statistics.rst:820 msgid "" "Using a `cumulative distribution function (cdf) `_, compute the probability that a " @@ -910,7 +938,7 @@ msgid "" "is written ``P(X <= x)``." msgstr "" -#: ../../library/statistics.rst:800 +#: ../../library/statistics.rst:827 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " @@ -919,34 +947,34 @@ msgid "" "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" -#: ../../library/statistics.rst:806 +#: ../../library/statistics.rst:833 msgid "" "Finds the value *x* of the random variable *X* such that the probability of " "the variable being less than or equal to that value equals the given " "probability *p*." msgstr "" -#: ../../library/statistics.rst:812 +#: ../../library/statistics.rst:839 msgid "" "Measures the agreement between two normal probability distributions. Returns " "a value between 0.0 and 1.0 giving `the overlapping area for the two " "probability density functions `_." msgstr "" -#: ../../library/statistics.rst:819 +#: ../../library/statistics.rst:846 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." msgstr "" -#: ../../library/statistics.rst:823 +#: ../../library/statistics.rst:850 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate the " "normal distribution into 100 equal sized groups." msgstr "" -#: ../../library/statistics.rst:829 +#: ../../library/statistics.rst:856 msgid "" "Compute the `Standard Score `_ describing *x* in terms of the number of standard " @@ -954,20 +982,20 @@ msgid "" "mean) / stdev``." msgstr "" -#: ../../library/statistics.rst:837 +#: ../../library/statistics.rst:864 msgid "" "Instances of :class:`NormalDist` support addition, subtraction, " "multiplication and division by a constant. These operations are used for " "translation and scaling. For example:" msgstr "" -#: ../../library/statistics.rst:847 +#: ../../library/statistics.rst:874 msgid "" "Dividing a constant by an instance of :class:`NormalDist` is not supported " "because the result wouldn't be normally distributed." msgstr "" -#: ../../library/statistics.rst:850 +#: ../../library/statistics.rst:877 msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " @@ -976,15 +1004,15 @@ msgid "" "class:`NormalDist`. For example:" msgstr "" -#: ../../library/statistics.rst:870 +#: ../../library/statistics.rst:897 msgid ":class:`NormalDist` Examples and Recipes" msgstr "" -#: ../../library/statistics.rst:872 +#: ../../library/statistics.rst:899 msgid ":class:`NormalDist` readily solves classic probability problems." msgstr "" -#: ../../library/statistics.rst:874 +#: ../../library/statistics.rst:901 msgid "" "For example, given `historical data for SAT exams `_ showing that scores are " @@ -993,27 +1021,27 @@ msgid "" "after rounding to the nearest whole number:" msgstr "" -#: ../../library/statistics.rst:887 +#: ../../library/statistics.rst:914 msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" msgstr "" -#: ../../library/statistics.rst:897 +#: ../../library/statistics.rst:924 msgid "" "To estimate the distribution for a model than isn't easy to solve " "analytically, :class:`NormalDist` can generate input samples for a `Monte " "Carlo simulation `_:" msgstr "" -#: ../../library/statistics.rst:913 +#: ../../library/statistics.rst:940 msgid "" "Normal distributions can be used to approximate `Binomial distributions " "`_ when the sample " "size is large and when the probability of a successful trial is near 50%." msgstr "" -#: ../../library/statistics.rst:918 +#: ../../library/statistics.rst:945 msgid "" "For example, an open source conference has 750 attendees and two rooms with " "a 500 person capacity. There is a talk about Python and another about Ruby. " @@ -1022,11 +1050,11 @@ msgid "" "probability that the Python room will stay within its capacity limits?" msgstr "" -#: ../../library/statistics.rst:949 +#: ../../library/statistics.rst:976 msgid "Normal distributions commonly arise in machine learning problems." msgstr "" -#: ../../library/statistics.rst:951 +#: ../../library/statistics.rst:978 msgid "" "Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " @@ -1034,20 +1062,20 @@ msgid "" "distributed features including height, weight, and foot size." msgstr "" -#: ../../library/statistics.rst:956 +#: ../../library/statistics.rst:983 msgid "" "We're given a training dataset with measurements for eight people. The " "measurements are assumed to be normally distributed, so we summarize the " "data with :class:`NormalDist`:" msgstr "" -#: ../../library/statistics.rst:969 +#: ../../library/statistics.rst:996 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" msgstr "" -#: ../../library/statistics.rst:978 +#: ../../library/statistics.rst:1005 msgid "" "Starting with a 50% `prior probability `_ of being male or female, we compute the posterior as " @@ -1055,7 +1083,7 @@ msgid "" "given the gender:" msgstr "" -#: ../../library/statistics.rst:993 +#: ../../library/statistics.rst:1020 msgid "" "The final prediction goes to the largest posterior. This is known as the " "`maximum a posteriori \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -122,21 +122,21 @@ msgstr "" #: ../../library/stdtypes.rst:85 ../../library/stdtypes.rst:143 #: ../../library/stdtypes.rst:275 ../../library/stdtypes.rst:364 -#: ../../library/stdtypes.rst:414 ../../library/stdtypes.rst:883 -#: ../../library/stdtypes.rst:1088 +#: ../../library/stdtypes.rst:414 ../../library/stdtypes.rst:921 +#: ../../library/stdtypes.rst:1126 msgid "Operation" msgstr "" #: ../../library/stdtypes.rst:85 ../../library/stdtypes.rst:275 #: ../../library/stdtypes.rst:364 ../../library/stdtypes.rst:414 -#: ../../library/stdtypes.rst:883 ../../library/stdtypes.rst:1088 +#: ../../library/stdtypes.rst:921 ../../library/stdtypes.rst:1126 msgid "Result" msgstr "結果" #: ../../library/stdtypes.rst:85 ../../library/stdtypes.rst:275 -#: ../../library/stdtypes.rst:414 ../../library/stdtypes.rst:883 -#: ../../library/stdtypes.rst:1088 ../../library/stdtypes.rst:2325 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:414 ../../library/stdtypes.rst:921 +#: ../../library/stdtypes.rst:1126 ../../library/stdtypes.rst:2365 +#: ../../library/stdtypes.rst:3577 msgid "Notes" msgstr "註解" @@ -149,9 +149,9 @@ msgid "if *x* is false, then *y*, else *x*" msgstr "" #: ../../library/stdtypes.rst:87 ../../library/stdtypes.rst:285 -#: ../../library/stdtypes.rst:885 ../../library/stdtypes.rst:888 -#: ../../library/stdtypes.rst:1099 ../../library/stdtypes.rst:2331 -#: ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:923 ../../library/stdtypes.rst:926 +#: ../../library/stdtypes.rst:1137 ../../library/stdtypes.rst:2371 +#: ../../library/stdtypes.rst:3583 msgid "\\(1)" msgstr "\\(1)" @@ -164,9 +164,9 @@ msgid "if *x* is false, then *x*, else *y*" msgstr "" #: ../../library/stdtypes.rst:90 ../../library/stdtypes.rst:288 -#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:1127 -#: ../../library/stdtypes.rst:2335 ../../library/stdtypes.rst:2337 -#: ../../library/stdtypes.rst:3547 ../../library/stdtypes.rst:3549 +#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:1165 +#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:2377 +#: ../../library/stdtypes.rst:3587 ../../library/stdtypes.rst:3589 msgid "\\(2)" msgstr "\\(2)" @@ -178,19 +178,19 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "" -#: ../../library/stdtypes.rst:93 ../../library/stdtypes.rst:897 -#: ../../library/stdtypes.rst:1130 ../../library/stdtypes.rst:2339 -#: ../../library/stdtypes.rst:2341 ../../library/stdtypes.rst:2343 -#: ../../library/stdtypes.rst:2345 ../../library/stdtypes.rst:3551 -#: ../../library/stdtypes.rst:3553 ../../library/stdtypes.rst:3555 -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:93 ../../library/stdtypes.rst:935 +#: ../../library/stdtypes.rst:1168 ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2381 ../../library/stdtypes.rst:2383 +#: ../../library/stdtypes.rst:2385 ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:3593 ../../library/stdtypes.rst:3595 +#: ../../library/stdtypes.rst:3597 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:102 ../../library/stdtypes.rst:319 -#: ../../library/stdtypes.rst:432 ../../library/stdtypes.rst:934 -#: ../../library/stdtypes.rst:1138 ../../library/stdtypes.rst:2371 -#: ../../library/stdtypes.rst:3587 +#: ../../library/stdtypes.rst:432 ../../library/stdtypes.rst:972 +#: ../../library/stdtypes.rst:1176 ../../library/stdtypes.rst:2411 +#: ../../library/stdtypes.rst:3627 msgid "Notes:" msgstr "註解:" @@ -229,9 +229,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "" -#: ../../library/stdtypes.rst:143 ../../library/stdtypes.rst:2302 -#: ../../library/stdtypes.rst:2325 ../../library/stdtypes.rst:3514 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:143 ../../library/stdtypes.rst:2342 +#: ../../library/stdtypes.rst:2365 ../../library/stdtypes.rst:3554 +#: ../../library/stdtypes.rst:3577 msgid "Meaning" msgstr "" @@ -513,8 +513,8 @@ msgid "" "zero." msgstr "" -#: ../../library/stdtypes.rst:301 ../../library/stdtypes.rst:1120 -#: ../../library/stdtypes.rst:2333 ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:301 ../../library/stdtypes.rst:1158 +#: ../../library/stdtypes.rst:2373 ../../library/stdtypes.rst:3614 msgid "\\(6)" msgstr "\\(6)" @@ -551,10 +551,10 @@ msgid "*x* to the power *y*" msgstr "" #: ../../library/stdtypes.rst:310 ../../library/stdtypes.rst:312 -#: ../../library/stdtypes.rst:1109 ../../library/stdtypes.rst:1112 -#: ../../library/stdtypes.rst:2358 ../../library/stdtypes.rst:2361 -#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3570 -#: ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:1147 ../../library/stdtypes.rst:1150 +#: ../../library/stdtypes.rst:2398 ../../library/stdtypes.rst:2401 +#: ../../library/stdtypes.rst:2404 ../../library/stdtypes.rst:3610 +#: ../../library/stdtypes.rst:3617 msgid "\\(5)" msgstr "\\(5)" @@ -607,7 +607,7 @@ msgstr "" #: ../../library/stdtypes.rst:356 msgid "" -"See https://www.unicode.org/Public/13.0.0/ucd/extracted/DerivedNumericType." +"See https://www.unicode.org/Public/14.0.0/ucd/extracted/DerivedNumericType." "txt for a complete list of code points with the ``Nd`` property." msgstr "" @@ -689,9 +689,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "" #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:419 -#: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1133 -#: ../../library/stdtypes.rst:2347 ../../library/stdtypes.rst:2351 -#: ../../library/stdtypes.rst:3559 ../../library/stdtypes.rst:3563 +#: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1171 +#: ../../library/stdtypes.rst:2387 ../../library/stdtypes.rst:2391 +#: ../../library/stdtypes.rst:3599 ../../library/stdtypes.rst:3603 msgid "\\(4)" msgstr "\\(4)" @@ -792,6 +792,7 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:473 ../../library/stdtypes.rst:496 +#: ../../library/stdtypes.rst:539 ../../library/stdtypes.rst:583 msgid "Equivalent to::" msgstr "" "等價於:\n" @@ -810,21 +811,20 @@ msgstr "" #: ../../library/stdtypes.rst:517 msgid "" -"The integer is represented using *length* bytes. An :exc:`OverflowError` is " -"raised if the integer is not representable with the given number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. An :exc:" +"`OverflowError` is raised if the integer is not representable with the given " +"number of bytes." msgstr "" -#: ../../library/stdtypes.rst:521 ../../library/stdtypes.rst:553 +#: ../../library/stdtypes.rst:521 msgid "" "The *byteorder* argument determines the byte order used to represent the " -"integer. If *byteorder* is ``\"big\"``, the most significant byte is at the " -"beginning of the byte array. If *byteorder* is ``\"little\"``, the most " -"significant byte is at the end of the byte array. To request the native " -"byte order of the host system, use :data:`sys.byteorder` as the byte order " -"value." +"integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " +"most significant byte is at the beginning of the byte array. If *byteorder* " +"is ``\"little\"``, the most significant byte is at the end of the byte array." msgstr "" -#: ../../library/stdtypes.rst:528 +#: ../../library/stdtypes.rst:527 msgid "" "The *signed* argument determines whether two's complement is used to " "represent the integer. If *signed* is ``False`` and a negative integer is " @@ -832,23 +832,48 @@ msgid "" "``False``." msgstr "" -#: ../../library/stdtypes.rst:537 +#: ../../library/stdtypes.rst:532 +msgid "" +"The default values can be used to conveniently turn an integer into a single " +"byte object. However, when using the default arguments, don't try to " +"convert a value greater than 255 or you'll get an :exc:`OverflowError`::" +msgstr "" + +#: ../../library/stdtypes.rst:552 +msgid "Added default argument values for ``length`` and ``byteorder``." +msgstr "" + +#: ../../library/stdtypes.rst:557 msgid "Return the integer represented by the given array of bytes." msgstr "" -#: ../../library/stdtypes.rst:550 +#: ../../library/stdtypes.rst:570 msgid "" "The argument *bytes* must either be a :term:`bytes-like object` or an " "iterable producing bytes." msgstr "" -#: ../../library/stdtypes.rst:560 +#: ../../library/stdtypes.rst:573 +msgid "" +"The *byteorder* argument determines the byte order used to represent the " +"integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " +"most significant byte is at the beginning of the byte array. If *byteorder* " +"is ``\"little\"``, the most significant byte is at the end of the byte " +"array. To request the native byte order of the host system, use :data:`sys." +"byteorder` as the byte order value." +msgstr "" + +#: ../../library/stdtypes.rst:580 msgid "" "The *signed* argument indicates whether two's complement is used to " "represent the integer." msgstr "" -#: ../../library/stdtypes.rst:567 +#: ../../library/stdtypes.rst:600 +msgid "Added default argument value for ``byteorder``." +msgstr "" + +#: ../../library/stdtypes.rst:605 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " "integer and with a positive denominator. The integer ratio of integers " @@ -856,30 +881,30 @@ msgid "" "denominator." msgstr "" -#: ../../library/stdtypes.rst:575 +#: ../../library/stdtypes.rst:613 msgid "Additional Methods on Float" msgstr "" -#: ../../library/stdtypes.rst:577 +#: ../../library/stdtypes.rst:615 msgid "" "The float type implements the :class:`numbers.Real` :term:`abstract base " "class`. float also has the following additional methods." msgstr "" -#: ../../library/stdtypes.rst:582 +#: ../../library/stdtypes.rst:620 msgid "" "Return a pair of integers whose ratio is exactly equal to the original float " "and with a positive denominator. Raises :exc:`OverflowError` on infinities " "and a :exc:`ValueError` on NaNs." msgstr "" -#: ../../library/stdtypes.rst:589 +#: ../../library/stdtypes.rst:627 msgid "" "Return ``True`` if the float instance is finite with integral value, and " "``False`` otherwise::" msgstr "" -#: ../../library/stdtypes.rst:597 +#: ../../library/stdtypes.rst:635 msgid "" "Two methods support conversion to and from hexadecimal strings. Since " "Python's floats are stored internally as binary numbers, converting a float " @@ -889,30 +914,30 @@ msgid "" "numerical work." msgstr "" -#: ../../library/stdtypes.rst:608 +#: ../../library/stdtypes.rst:646 msgid "" "Return a representation of a floating-point number as a hexadecimal string. " "For finite floating-point numbers, this representation will always include a " "leading ``0x`` and a trailing ``p`` and exponent." msgstr "" -#: ../../library/stdtypes.rst:616 +#: ../../library/stdtypes.rst:654 msgid "" "Class method to return the float represented by a hexadecimal string *s*. " "The string *s* may have leading and trailing whitespace." msgstr "" -#: ../../library/stdtypes.rst:621 +#: ../../library/stdtypes.rst:659 msgid "" "Note that :meth:`float.hex` is an instance method, while :meth:`float." "fromhex` is a class method." msgstr "" -#: ../../library/stdtypes.rst:624 +#: ../../library/stdtypes.rst:662 msgid "A hexadecimal string takes the form::" msgstr "" -#: ../../library/stdtypes.rst:628 +#: ../../library/stdtypes.rst:666 msgid "" "where the optional ``sign`` may by either ``+`` or ``-``, ``integer`` and " "``fraction`` are strings of hexadecimal digits, and ``exponent`` is a " @@ -926,7 +951,7 @@ msgid "" "by :meth:`float.fromhex`." msgstr "" -#: ../../library/stdtypes.rst:641 +#: ../../library/stdtypes.rst:679 msgid "" "Note that the exponent is written in decimal rather than hexadecimal, and " "that it gives the power of 2 by which to multiply the coefficient. For " @@ -934,17 +959,17 @@ msgid "" "number ``(3 + 10./16 + 7./16**2) * 2.0**10``, or ``3740.0``::" msgstr "" -#: ../../library/stdtypes.rst:651 +#: ../../library/stdtypes.rst:689 msgid "" "Applying the reverse conversion to ``3740.0`` gives a different hexadecimal " "string representing the same number::" msgstr "" -#: ../../library/stdtypes.rst:661 +#: ../../library/stdtypes.rst:699 msgid "Hashing of numeric types" msgstr "" -#: ../../library/stdtypes.rst:663 +#: ../../library/stdtypes.rst:701 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " "that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." @@ -960,24 +985,24 @@ msgid "" "of :data:`sys.hash_info`." msgstr "" -#: ../../library/stdtypes.rst:678 +#: ../../library/stdtypes.rst:716 msgid "" "Currently, the prime used is ``P = 2**31 - 1`` on machines with 32-bit C " "longs and ``P = 2**61 - 1`` on machines with 64-bit C longs." msgstr "" -#: ../../library/stdtypes.rst:681 +#: ../../library/stdtypes.rst:719 msgid "Here are the rules in detail:" msgstr "" -#: ../../library/stdtypes.rst:683 +#: ../../library/stdtypes.rst:721 msgid "" "If ``x = m / n`` is a nonnegative rational number and ``n`` is not divisible " "by ``P``, define ``hash(x)`` as ``m * invmod(n, P) % P``, where ``invmod(n, " "P)`` gives the inverse of ``n`` modulo ``P``." msgstr "" -#: ../../library/stdtypes.rst:687 +#: ../../library/stdtypes.rst:725 msgid "" "If ``x = m / n`` is a nonnegative rational number and ``n`` is divisible by " "``P`` (but ``m`` is not) then ``n`` has no inverse modulo ``P`` and the rule " @@ -985,20 +1010,20 @@ msgid "" "value ``sys.hash_info.inf``." msgstr "" -#: ../../library/stdtypes.rst:692 +#: ../../library/stdtypes.rst:730 msgid "" "If ``x = m / n`` is a negative rational number define ``hash(x)`` as ``-" "hash(-x)``. If the resulting hash is ``-1``, replace it with ``-2``." msgstr "" -#: ../../library/stdtypes.rst:696 +#: ../../library/stdtypes.rst:734 msgid "" "The particular values ``sys.hash_info.inf`` and ``-sys.hash_info.inf`` are " "used as hash values for positive infinity or negative infinity " "(respectively)." msgstr "" -#: ../../library/stdtypes.rst:700 +#: ../../library/stdtypes.rst:738 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " "imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." @@ -1007,18 +1032,18 @@ msgid "" "1))``. Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" -#: ../../library/stdtypes.rst:708 +#: ../../library/stdtypes.rst:746 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " "the built-in hash, for computing the hash of a rational number, :class:" "`float`, or :class:`complex`::" msgstr "" -#: ../../library/stdtypes.rst:763 +#: ../../library/stdtypes.rst:801 msgid "Iterator Types" msgstr "" -#: ../../library/stdtypes.rst:771 +#: ../../library/stdtypes.rst:809 msgid "" "Python supports a concept of iteration over containers. This is implemented " "using two distinct methods; these are used to allow user-defined classes to " @@ -1026,13 +1051,13 @@ msgid "" "support the iteration methods." msgstr "" -#: ../../library/stdtypes.rst:776 +#: ../../library/stdtypes.rst:814 msgid "" "One method needs to be defined for container objects to provide :term:" "`iterable` support:" msgstr "" -#: ../../library/stdtypes.rst:783 +#: ../../library/stdtypes.rst:821 msgid "" "Return an :term:`iterator` object. The object is required to support the " "iterator protocol described below. If a container supports different types " @@ -1044,13 +1069,13 @@ msgid "" "in the Python/C API." msgstr "" -#: ../../library/stdtypes.rst:792 +#: ../../library/stdtypes.rst:830 msgid "" "The iterator objects themselves are required to support the following two " "methods, which together form the :dfn:`iterator protocol`:" msgstr "" -#: ../../library/stdtypes.rst:798 +#: ../../library/stdtypes.rst:836 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " "containers and iterators to be used with the :keyword:`for` and :keyword:" @@ -1058,7 +1083,7 @@ msgid "" "tp_iter` slot of the type structure for Python objects in the Python/C API." msgstr "" -#: ../../library/stdtypes.rst:807 +#: ../../library/stdtypes.rst:845 msgid "" "Return the next item from the :term:`iterator`. If there are no further " "items, raise the :exc:`StopIteration` exception. This method corresponds to " @@ -1066,7 +1091,7 @@ msgid "" "Python objects in the Python/C API." msgstr "" -#: ../../library/stdtypes.rst:812 +#: ../../library/stdtypes.rst:850 msgid "" "Python defines several iterator objects to support iteration over general " "and specific sequence types, dictionaries, and other more specialized " @@ -1074,18 +1099,18 @@ msgid "" "the iterator protocol." msgstr "" -#: ../../library/stdtypes.rst:817 +#: ../../library/stdtypes.rst:855 msgid "" "Once an iterator's :meth:`~iterator.__next__` method raises :exc:" "`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" -#: ../../library/stdtypes.rst:825 +#: ../../library/stdtypes.rst:863 msgid "Generator Types" msgstr "" -#: ../../library/stdtypes.rst:827 +#: ../../library/stdtypes.rst:865 msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " "iterator protocol. If a container object's :meth:`__iter__` method is " @@ -1095,11 +1120,11 @@ msgid "" "found in :ref:`the documentation for the yield expression `." msgstr "" -#: ../../library/stdtypes.rst:839 +#: ../../library/stdtypes.rst:877 msgid "Sequence Types --- :class:`list`, :class:`tuple`, :class:`range`" msgstr "" -#: ../../library/stdtypes.rst:841 +#: ../../library/stdtypes.rst:879 msgid "" "There are three basic sequence types: lists, tuples, and range objects. " "Additional sequence types tailored for processing of :ref:`binary data " @@ -1107,11 +1132,11 @@ msgid "" "sections." msgstr "" -#: ../../library/stdtypes.rst:850 +#: ../../library/stdtypes.rst:888 msgid "Common Sequence Operations" msgstr "" -#: ../../library/stdtypes.rst:854 +#: ../../library/stdtypes.rst:892 msgid "" "The operations in the following table are supported by most sequence types, " "both mutable and immutable. The :class:`collections.abc.Sequence` ABC is " @@ -1119,7 +1144,7 @@ msgid "" "sequence types." msgstr "" -#: ../../library/stdtypes.rst:859 +#: ../../library/stdtypes.rst:897 msgid "" "This table lists the sequence operations sorted in ascending priority. In " "the table, *s* and *t* are sequences of the same type, *n*, *i*, *j* and *k* " @@ -1127,7 +1152,7 @@ msgid "" "restrictions imposed by *s*." msgstr "" -#: ../../library/stdtypes.rst:864 +#: ../../library/stdtypes.rst:902 msgid "" "The ``in`` and ``not in`` operations have the same priorities as the " "comparison operations. The ``+`` (concatenation) and ``*`` (repetition) " @@ -1135,125 +1160,125 @@ msgid "" "[3]_" msgstr "" -#: ../../library/stdtypes.rst:885 +#: ../../library/stdtypes.rst:923 msgid "``x in s``" msgstr "``x in s``" -#: ../../library/stdtypes.rst:885 +#: ../../library/stdtypes.rst:923 msgid "``True`` if an item of *s* is equal to *x*, else ``False``" msgstr "" -#: ../../library/stdtypes.rst:888 +#: ../../library/stdtypes.rst:926 msgid "``x not in s``" msgstr "``x not in s``" -#: ../../library/stdtypes.rst:888 +#: ../../library/stdtypes.rst:926 msgid "``False`` if an item of *s* is equal to *x*, else ``True``" msgstr "" -#: ../../library/stdtypes.rst:891 +#: ../../library/stdtypes.rst:929 msgid "``s + t``" msgstr "``s + t``" -#: ../../library/stdtypes.rst:891 +#: ../../library/stdtypes.rst:929 msgid "the concatenation of *s* and *t*" msgstr "" -#: ../../library/stdtypes.rst:891 +#: ../../library/stdtypes.rst:929 msgid "(6)(7)" msgstr "(6)(7)" -#: ../../library/stdtypes.rst:894 +#: ../../library/stdtypes.rst:932 msgid "``s * n`` or ``n * s``" msgstr "``s * n`` 或 ``n * s``" -#: ../../library/stdtypes.rst:894 +#: ../../library/stdtypes.rst:932 msgid "equivalent to adding *s* to itself *n* times" msgstr "" -#: ../../library/stdtypes.rst:894 +#: ../../library/stdtypes.rst:932 msgid "(2)(7)" msgstr "(2)(7)" -#: ../../library/stdtypes.rst:897 +#: ../../library/stdtypes.rst:935 msgid "``s[i]``" msgstr "``s[i]``" -#: ../../library/stdtypes.rst:897 +#: ../../library/stdtypes.rst:935 msgid "*i*\\ th item of *s*, origin 0" msgstr "" -#: ../../library/stdtypes.rst:899 +#: ../../library/stdtypes.rst:937 msgid "``s[i:j]``" msgstr "``s[i:j]``" -#: ../../library/stdtypes.rst:899 +#: ../../library/stdtypes.rst:937 msgid "slice of *s* from *i* to *j*" msgstr "" -#: ../../library/stdtypes.rst:899 +#: ../../library/stdtypes.rst:937 msgid "(3)(4)" msgstr "(3)(4)" -#: ../../library/stdtypes.rst:901 +#: ../../library/stdtypes.rst:939 msgid "``s[i:j:k]``" msgstr "``s[i:j:k]``" -#: ../../library/stdtypes.rst:901 +#: ../../library/stdtypes.rst:939 msgid "slice of *s* from *i* to *j* with step *k*" msgstr "" -#: ../../library/stdtypes.rst:901 +#: ../../library/stdtypes.rst:939 msgid "(3)(5)" msgstr "(3)(5)" -#: ../../library/stdtypes.rst:904 +#: ../../library/stdtypes.rst:942 msgid "``len(s)``" msgstr "``len(s)``" -#: ../../library/stdtypes.rst:904 +#: ../../library/stdtypes.rst:942 msgid "length of *s*" msgstr "" -#: ../../library/stdtypes.rst:906 +#: ../../library/stdtypes.rst:944 msgid "``min(s)``" msgstr "``min(s)``" -#: ../../library/stdtypes.rst:906 +#: ../../library/stdtypes.rst:944 msgid "smallest item of *s*" msgstr "" -#: ../../library/stdtypes.rst:908 +#: ../../library/stdtypes.rst:946 msgid "``max(s)``" msgstr "``max(s)``" -#: ../../library/stdtypes.rst:908 +#: ../../library/stdtypes.rst:946 msgid "largest item of *s*" msgstr "" -#: ../../library/stdtypes.rst:910 +#: ../../library/stdtypes.rst:948 msgid "``s.index(x[, i[, j]])``" msgstr "``s.index(x[, i[, j]])``" -#: ../../library/stdtypes.rst:910 +#: ../../library/stdtypes.rst:948 msgid "" "index of the first occurrence of *x* in *s* (at or after index *i* and " "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:910 ../../library/stdtypes.rst:3545 +#: ../../library/stdtypes.rst:948 ../../library/stdtypes.rst:3585 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:914 +#: ../../library/stdtypes.rst:952 msgid "``s.count(x)``" msgstr "``s.count(x)``" -#: ../../library/stdtypes.rst:914 +#: ../../library/stdtypes.rst:952 msgid "total number of occurrences of *x* in *s*" msgstr "" -#: ../../library/stdtypes.rst:918 +#: ../../library/stdtypes.rst:956 msgid "" "Sequences of the same type also support comparisons. In particular, tuples " "and lists are compared lexicographically by comparing corresponding " @@ -1262,7 +1287,7 @@ msgid "" "(For full details see :ref:`comparisons` in the language reference.)" msgstr "" -#: ../../library/stdtypes.rst:928 +#: ../../library/stdtypes.rst:966 msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " @@ -1271,7 +1296,7 @@ msgid "" "drops below zero)." msgstr "" -#: ../../library/stdtypes.rst:937 +#: ../../library/stdtypes.rst:975 msgid "" "While the ``in`` and ``not in`` operations are used only for simple " "containment testing in the general case, some specialised sequences (such " @@ -1279,7 +1304,7 @@ msgid "" "subsequence testing::" msgstr "" -#: ../../library/stdtypes.rst:946 +#: ../../library/stdtypes.rst:984 msgid "" "Values of *n* less than ``0`` are treated as ``0`` (which yields an empty " "sequence of the same type as *s*). Note that items in the sequence *s* are " @@ -1287,7 +1312,7 @@ msgid "" "Python programmers; consider::" msgstr "" -#: ../../library/stdtypes.rst:958 +#: ../../library/stdtypes.rst:996 msgid "" "What has happened is that ``[[]]`` is a one-element list containing an empty " "list, so all three elements of ``[[]] * 3`` are references to this single " @@ -1295,20 +1320,20 @@ msgid "" "list. You can create a list of different lists this way::" msgstr "" -#: ../../library/stdtypes.rst:970 +#: ../../library/stdtypes.rst:1008 msgid "" "Further explanation is available in the FAQ entry :ref:`faq-multidimensional-" "list`." msgstr "" -#: ../../library/stdtypes.rst:974 +#: ../../library/stdtypes.rst:1012 msgid "" "If *i* or *j* is negative, the index is relative to the end of sequence *s*: " "``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is " "still ``0``." msgstr "" -#: ../../library/stdtypes.rst:979 +#: ../../library/stdtypes.rst:1017 msgid "" "The slice of *s* from *i* to *j* is defined as the sequence of items with " "index *k* such that ``i <= k < j``. If *i* or *j* is greater than " @@ -1317,7 +1342,7 @@ msgid "" "to *j*, the slice is empty." msgstr "" -#: ../../library/stdtypes.rst:986 +#: ../../library/stdtypes.rst:1024 msgid "" "The slice of *s* from *i* to *j* with step *k* is defined as the sequence of " "items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other " @@ -1330,7 +1355,7 @@ msgid "" "``None``, it is treated like ``1``." msgstr "" -#: ../../library/stdtypes.rst:997 +#: ../../library/stdtypes.rst:1035 msgid "" "Concatenating immutable sequences always results in a new object. This " "means that building up a sequence by repeated concatenation will have a " @@ -1338,14 +1363,14 @@ msgid "" "runtime cost, you must switch to one of the alternatives below:" msgstr "" -#: ../../library/stdtypes.rst:1002 +#: ../../library/stdtypes.rst:1040 msgid "" "if concatenating :class:`str` objects, you can build a list and use :meth:" "`str.join` at the end or else write to an :class:`io.StringIO` instance and " "retrieve its value when complete" msgstr "" -#: ../../library/stdtypes.rst:1006 +#: ../../library/stdtypes.rst:1044 msgid "" "if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." "join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" @@ -1353,22 +1378,22 @@ msgid "" "an efficient overallocation mechanism" msgstr "" -#: ../../library/stdtypes.rst:1011 +#: ../../library/stdtypes.rst:1049 msgid "if concatenating :class:`tuple` objects, extend a :class:`list` instead" msgstr "" -#: ../../library/stdtypes.rst:1013 +#: ../../library/stdtypes.rst:1051 msgid "for other types, investigate the relevant class documentation" msgstr "" -#: ../../library/stdtypes.rst:1017 +#: ../../library/stdtypes.rst:1055 msgid "" "Some sequence types (such as :class:`range`) only support item sequences " "that follow specific patterns, and hence don't support sequence " "concatenation or repetition." msgstr "" -#: ../../library/stdtypes.rst:1022 +#: ../../library/stdtypes.rst:1060 msgid "" "``index`` raises :exc:`ValueError` when *x* is not found in *s*. Not all " "implementations support passing the additional arguments *i* and *j*. These " @@ -1378,42 +1403,42 @@ msgid "" "start of the sequence rather than the start of the slice." msgstr "" -#: ../../library/stdtypes.rst:1033 +#: ../../library/stdtypes.rst:1071 msgid "Immutable Sequence Types" msgstr "" -#: ../../library/stdtypes.rst:1040 +#: ../../library/stdtypes.rst:1078 msgid "" "The only operation that immutable sequence types generally implement that is " "not also implemented by mutable sequence types is support for the :func:" "`hash` built-in." msgstr "" -#: ../../library/stdtypes.rst:1044 +#: ../../library/stdtypes.rst:1082 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " "to be used as :class:`dict` keys and stored in :class:`set` and :class:" "`frozenset` instances." msgstr "" -#: ../../library/stdtypes.rst:1048 +#: ../../library/stdtypes.rst:1086 msgid "" "Attempting to hash an immutable sequence that contains unhashable values " "will result in :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:1055 +#: ../../library/stdtypes.rst:1093 msgid "Mutable Sequence Types" msgstr "" -#: ../../library/stdtypes.rst:1062 +#: ../../library/stdtypes.rst:1100 msgid "" "The operations in the following table are defined on mutable sequence types. " "The :class:`collections.abc.MutableSequence` ABC is provided to make it " "easier to correctly implement these operations on custom sequence types." msgstr "" -#: ../../library/stdtypes.rst:1066 +#: ../../library/stdtypes.rst:1104 msgid "" "In the table *s* is an instance of a mutable sequence type, *t* is any " "iterable object and *x* is an arbitrary object that meets any type and value " @@ -1421,145 +1446,145 @@ msgid "" "integers that meet the value restriction ``0 <= x <= 255``)." msgstr "" -#: ../../library/stdtypes.rst:1090 +#: ../../library/stdtypes.rst:1128 msgid "``s[i] = x``" msgstr "``s[i] = x``" -#: ../../library/stdtypes.rst:1090 +#: ../../library/stdtypes.rst:1128 msgid "item *i* of *s* is replaced by *x*" msgstr "" -#: ../../library/stdtypes.rst:1093 +#: ../../library/stdtypes.rst:1131 msgid "``s[i:j] = t``" msgstr "``s[i:j] = t``" -#: ../../library/stdtypes.rst:1093 +#: ../../library/stdtypes.rst:1131 msgid "" "slice of *s* from *i* to *j* is replaced by the contents of the iterable *t*" msgstr "" -#: ../../library/stdtypes.rst:1097 +#: ../../library/stdtypes.rst:1135 msgid "``del s[i:j]``" msgstr "``del s[i:j]``" -#: ../../library/stdtypes.rst:1097 +#: ../../library/stdtypes.rst:1135 msgid "same as ``s[i:j] = []``" msgstr "" -#: ../../library/stdtypes.rst:1099 +#: ../../library/stdtypes.rst:1137 msgid "``s[i:j:k] = t``" msgstr "``s[i:j:k] = t``" -#: ../../library/stdtypes.rst:1099 +#: ../../library/stdtypes.rst:1137 msgid "the elements of ``s[i:j:k]`` are replaced by those of *t*" msgstr "" -#: ../../library/stdtypes.rst:1102 +#: ../../library/stdtypes.rst:1140 msgid "``del s[i:j:k]``" msgstr "``del s[i:j:k]``" -#: ../../library/stdtypes.rst:1102 +#: ../../library/stdtypes.rst:1140 msgid "removes the elements of ``s[i:j:k]`` from the list" msgstr "" -#: ../../library/stdtypes.rst:1105 +#: ../../library/stdtypes.rst:1143 msgid "``s.append(x)``" msgstr "``s.append(x)``" -#: ../../library/stdtypes.rst:1105 +#: ../../library/stdtypes.rst:1143 msgid "" "appends *x* to the end of the sequence (same as ``s[len(s):len(s)] = [x]``)" msgstr "" -#: ../../library/stdtypes.rst:1109 +#: ../../library/stdtypes.rst:1147 msgid "``s.clear()``" msgstr "``s.clear()``" -#: ../../library/stdtypes.rst:1109 +#: ../../library/stdtypes.rst:1147 msgid "removes all items from *s* (same as ``del s[:]``)" msgstr "" -#: ../../library/stdtypes.rst:1112 +#: ../../library/stdtypes.rst:1150 msgid "``s.copy()``" msgstr "``s.copy()``" -#: ../../library/stdtypes.rst:1112 +#: ../../library/stdtypes.rst:1150 msgid "creates a shallow copy of *s* (same as ``s[:]``)" msgstr "" -#: ../../library/stdtypes.rst:1115 +#: ../../library/stdtypes.rst:1153 msgid "``s.extend(t)`` or ``s += t``" msgstr "``s.extend(t)`` 或 ``s += t``" -#: ../../library/stdtypes.rst:1115 +#: ../../library/stdtypes.rst:1153 msgid "" "extends *s* with the contents of *t* (for the most part the same as " "``s[len(s):len(s)] = t``)" msgstr "" -#: ../../library/stdtypes.rst:1120 +#: ../../library/stdtypes.rst:1158 msgid "``s *= n``" msgstr "``s *= n``" -#: ../../library/stdtypes.rst:1120 +#: ../../library/stdtypes.rst:1158 msgid "updates *s* with its contents repeated *n* times" msgstr "" -#: ../../library/stdtypes.rst:1123 +#: ../../library/stdtypes.rst:1161 msgid "``s.insert(i, x)``" msgstr "``s.insert(i, x)``" -#: ../../library/stdtypes.rst:1123 +#: ../../library/stdtypes.rst:1161 msgid "" "inserts *x* into *s* at the index given by *i* (same as ``s[i:i] = [x]``)" msgstr "" -#: ../../library/stdtypes.rst:1127 +#: ../../library/stdtypes.rst:1165 msgid "``s.pop()`` or ``s.pop(i)``" msgstr "``s.pop()`` 或 ``s.pop(i)``" -#: ../../library/stdtypes.rst:1127 +#: ../../library/stdtypes.rst:1165 msgid "retrieves the item at *i* and also removes it from *s*" msgstr "" -#: ../../library/stdtypes.rst:1130 +#: ../../library/stdtypes.rst:1168 msgid "``s.remove(x)``" msgstr "``s.remove(x)``" -#: ../../library/stdtypes.rst:1130 +#: ../../library/stdtypes.rst:1168 msgid "remove the first item from *s* where ``s[i]`` is equal to *x*" msgstr "" -#: ../../library/stdtypes.rst:1133 +#: ../../library/stdtypes.rst:1171 msgid "``s.reverse()``" msgstr "``s.reverse()``" -#: ../../library/stdtypes.rst:1133 +#: ../../library/stdtypes.rst:1171 msgid "reverses the items of *s* in place" msgstr "" -#: ../../library/stdtypes.rst:1141 +#: ../../library/stdtypes.rst:1179 msgid "*t* must have the same length as the slice it is replacing." msgstr "" -#: ../../library/stdtypes.rst:1144 +#: ../../library/stdtypes.rst:1182 msgid "" "The optional argument *i* defaults to ``-1``, so that by default the last " "item is removed and returned." msgstr "" -#: ../../library/stdtypes.rst:1148 +#: ../../library/stdtypes.rst:1186 msgid ":meth:`remove` raises :exc:`ValueError` when *x* is not found in *s*." msgstr "" -#: ../../library/stdtypes.rst:1151 +#: ../../library/stdtypes.rst:1189 msgid "" "The :meth:`reverse` method modifies the sequence in place for economy of " "space when reversing a large sequence. To remind users that it operates by " "side effect, it does not return the reversed sequence." msgstr "" -#: ../../library/stdtypes.rst:1156 +#: ../../library/stdtypes.rst:1194 msgid "" ":meth:`clear` and :meth:`!copy` are included for consistency with the " "interfaces of mutable containers that don't support slicing operations (such " @@ -1568,11 +1593,11 @@ msgid "" "classes provide it." msgstr "" -#: ../../library/stdtypes.rst:1162 +#: ../../library/stdtypes.rst:1200 msgid ":meth:`clear` and :meth:`!copy` methods." msgstr "" -#: ../../library/stdtypes.rst:1166 +#: ../../library/stdtypes.rst:1204 msgid "" "The value *n* is an integer, or an object implementing :meth:`~object." "__index__`. Zero and negative values of *n* clear the sequence. Items in " @@ -1580,39 +1605,39 @@ msgid "" "explained for ``s * n`` under :ref:`typesseq-common`." msgstr "" -#: ../../library/stdtypes.rst:1175 +#: ../../library/stdtypes.rst:1213 msgid "Lists" msgstr "List(串列)" -#: ../../library/stdtypes.rst:1179 +#: ../../library/stdtypes.rst:1217 msgid "" "Lists are mutable sequences, typically used to store collections of " "homogeneous items (where the precise degree of similarity will vary by " "application)." msgstr "" -#: ../../library/stdtypes.rst:1185 +#: ../../library/stdtypes.rst:1223 msgid "Lists may be constructed in several ways:" msgstr "" -#: ../../library/stdtypes.rst:1187 +#: ../../library/stdtypes.rst:1225 msgid "Using a pair of square brackets to denote the empty list: ``[]``" msgstr "" -#: ../../library/stdtypes.rst:1188 +#: ../../library/stdtypes.rst:1226 msgid "" "Using square brackets, separating items with commas: ``[a]``, ``[a, b, c]``" msgstr "" -#: ../../library/stdtypes.rst:1189 +#: ../../library/stdtypes.rst:1227 msgid "Using a list comprehension: ``[x for x in iterable]``" msgstr "" -#: ../../library/stdtypes.rst:1190 +#: ../../library/stdtypes.rst:1228 msgid "Using the type constructor: ``list()`` or ``list(iterable)``" msgstr "" -#: ../../library/stdtypes.rst:1192 +#: ../../library/stdtypes.rst:1230 msgid "" "The constructor builds a list whose items are the same and in the same order " "as *iterable*'s items. *iterable* may be either a sequence, a container " @@ -1623,20 +1648,20 @@ msgid "" "new empty list, ``[]``." msgstr "" -#: ../../library/stdtypes.rst:1201 +#: ../../library/stdtypes.rst:1239 msgid "" "Many other operations also produce lists, including the :func:`sorted` built-" "in." msgstr "" -#: ../../library/stdtypes.rst:1204 +#: ../../library/stdtypes.rst:1242 msgid "" "Lists implement all of the :ref:`common ` and :ref:`mutable " "` sequence operations. Lists also provide the following " "additional method:" msgstr "" -#: ../../library/stdtypes.rst:1210 +#: ../../library/stdtypes.rst:1248 msgid "" "This method sorts the list in place, using only ``<`` comparisons between " "items. Exceptions are not suppressed - if any comparison operations fail, " @@ -1644,13 +1669,13 @@ msgid "" "partially modified state)." msgstr "" -#: ../../library/stdtypes.rst:1215 +#: ../../library/stdtypes.rst:1253 msgid "" ":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" "`keyword-only arguments `):" msgstr "" -#: ../../library/stdtypes.rst:1218 +#: ../../library/stdtypes.rst:1256 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each list element (for example, ``key=str.lower``). The " @@ -1659,19 +1684,19 @@ msgid "" "list items are sorted directly without calculating a separate key value." msgstr "" -#: ../../library/stdtypes.rst:1225 +#: ../../library/stdtypes.rst:1263 msgid "" "The :func:`functools.cmp_to_key` utility is available to convert a 2.x style " "*cmp* function to a *key* function." msgstr "" -#: ../../library/stdtypes.rst:1228 +#: ../../library/stdtypes.rst:1266 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/stdtypes.rst:1231 +#: ../../library/stdtypes.rst:1269 msgid "" "This method modifies the sequence in place for economy of space when sorting " "a large sequence. To remind users that it operates by side effect, it does " @@ -1679,7 +1704,7 @@ msgid "" "new sorted list instance)." msgstr "" -#: ../../library/stdtypes.rst:1236 +#: ../../library/stdtypes.rst:1274 msgid "" "The :meth:`sort` method is guaranteed to be stable. A sort is stable if it " "guarantees not to change the relative order of elements that compare equal " @@ -1687,12 +1712,12 @@ msgid "" "department, then by salary grade)." msgstr "" -#: ../../library/stdtypes.rst:1241 +#: ../../library/stdtypes.rst:1279 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/stdtypes.rst:1245 +#: ../../library/stdtypes.rst:1283 msgid "" "While a list is being sorted, the effect of attempting to mutate, or even " "inspect, the list is undefined. The C implementation of Python makes the " @@ -1700,11 +1725,11 @@ msgid "" "detect that the list has been mutated during a sort." msgstr "" -#: ../../library/stdtypes.rst:1254 +#: ../../library/stdtypes.rst:1292 msgid "Tuples" msgstr "" -#: ../../library/stdtypes.rst:1258 +#: ../../library/stdtypes.rst:1296 msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " @@ -1713,27 +1738,27 @@ msgid "" "class:`dict` instance)." msgstr "" -#: ../../library/stdtypes.rst:1266 +#: ../../library/stdtypes.rst:1304 msgid "Tuples may be constructed in a number of ways:" msgstr "" -#: ../../library/stdtypes.rst:1268 +#: ../../library/stdtypes.rst:1306 msgid "Using a pair of parentheses to denote the empty tuple: ``()``" msgstr "" -#: ../../library/stdtypes.rst:1269 +#: ../../library/stdtypes.rst:1307 msgid "Using a trailing comma for a singleton tuple: ``a,`` or ``(a,)``" msgstr "" -#: ../../library/stdtypes.rst:1270 +#: ../../library/stdtypes.rst:1308 msgid "Separating items with commas: ``a, b, c`` or ``(a, b, c)``" msgstr "" -#: ../../library/stdtypes.rst:1271 +#: ../../library/stdtypes.rst:1309 msgid "Using the :func:`tuple` built-in: ``tuple()`` or ``tuple(iterable)``" msgstr "" -#: ../../library/stdtypes.rst:1273 +#: ../../library/stdtypes.rst:1311 msgid "" "The constructor builds a tuple whose items are the same and in the same " "order as *iterable*'s items. *iterable* may be either a sequence, a " @@ -1744,7 +1769,7 @@ msgid "" "``()``." msgstr "" -#: ../../library/stdtypes.rst:1281 +#: ../../library/stdtypes.rst:1319 msgid "" "Note that it is actually the comma which makes a tuple, not the parentheses. " "The parentheses are optional, except in the empty tuple case, or when they " @@ -1753,30 +1778,30 @@ msgid "" "call with a 3-tuple as the sole argument." msgstr "" -#: ../../library/stdtypes.rst:1287 +#: ../../library/stdtypes.rst:1325 msgid "" "Tuples implement all of the :ref:`common ` sequence " "operations." msgstr "" -#: ../../library/stdtypes.rst:1290 +#: ../../library/stdtypes.rst:1328 msgid "" "For heterogeneous collections of data where access by name is clearer than " "access by index, :func:`collections.namedtuple` may be a more appropriate " "choice than a simple tuple object." msgstr "" -#: ../../library/stdtypes.rst:1298 +#: ../../library/stdtypes.rst:1336 msgid "Ranges" msgstr "" -#: ../../library/stdtypes.rst:1302 +#: ../../library/stdtypes.rst:1340 msgid "" "The :class:`range` type represents an immutable sequence of numbers and is " "commonly used for looping a specific number of times in :keyword:`for` loops." msgstr "" -#: ../../library/stdtypes.rst:1309 +#: ../../library/stdtypes.rst:1347 msgid "" "The arguments to the range constructor must be integers (either built-in :" "class:`int` or any object that implements the :meth:`~object.__index__` " @@ -1785,38 +1810,38 @@ msgid "" "zero, :exc:`ValueError` is raised." msgstr "" -#: ../../library/stdtypes.rst:1315 +#: ../../library/stdtypes.rst:1353 msgid "" "For a positive *step*, the contents of a range ``r`` are determined by the " "formula ``r[i] = start + step*i`` where ``i >= 0`` and ``r[i] < stop``." msgstr "" -#: ../../library/stdtypes.rst:1319 +#: ../../library/stdtypes.rst:1357 msgid "" "For a negative *step*, the contents of the range are still determined by the " "formula ``r[i] = start + step*i``, but the constraints are ``i >= 0`` and " "``r[i] > stop``." msgstr "" -#: ../../library/stdtypes.rst:1323 +#: ../../library/stdtypes.rst:1361 msgid "" "A range object will be empty if ``r[0]`` does not meet the value constraint. " "Ranges do support negative indices, but these are interpreted as indexing " "from the end of the sequence determined by the positive indices." msgstr "" -#: ../../library/stdtypes.rst:1328 +#: ../../library/stdtypes.rst:1366 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " "permitted but some features (such as :func:`len`) may raise :exc:" "`OverflowError`." msgstr "" -#: ../../library/stdtypes.rst:1332 +#: ../../library/stdtypes.rst:1370 msgid "Range examples::" msgstr "" -#: ../../library/stdtypes.rst:1349 +#: ../../library/stdtypes.rst:1387 msgid "" "Ranges implement all of the :ref:`common ` sequence " "operations except concatenation and repetition (due to the fact that range " @@ -1824,23 +1849,23 @@ msgid "" "repetition and concatenation will usually violate that pattern)." msgstr "" -#: ../../library/stdtypes.rst:1356 +#: ../../library/stdtypes.rst:1394 msgid "" "The value of the *start* parameter (or ``0`` if the parameter was not " "supplied)" msgstr "" -#: ../../library/stdtypes.rst:1361 +#: ../../library/stdtypes.rst:1399 msgid "The value of the *stop* parameter" msgstr "" -#: ../../library/stdtypes.rst:1365 +#: ../../library/stdtypes.rst:1403 msgid "" "The value of the *step* parameter (or ``1`` if the parameter was not " "supplied)" msgstr "" -#: ../../library/stdtypes.rst:1368 +#: ../../library/stdtypes.rst:1406 msgid "" "The advantage of the :class:`range` type over a regular :class:`list` or :" "class:`tuple` is that a :class:`range` object will always take the same " @@ -1849,14 +1874,14 @@ msgid "" "individual items and subranges as needed)." msgstr "" -#: ../../library/stdtypes.rst:1374 +#: ../../library/stdtypes.rst:1412 msgid "" "Range objects implement the :class:`collections.abc.Sequence` ABC, and " "provide features such as containment tests, element index lookup, slicing " "and support for negative indices (see :ref:`typesseq`):" msgstr "" -#: ../../library/stdtypes.rst:1394 +#: ../../library/stdtypes.rst:1432 msgid "" "Testing range objects for equality with ``==`` and ``!=`` compares them as " "sequences. That is, two range objects are considered equal if they " @@ -1866,111 +1891,111 @@ msgid "" "3)`` or ``range(0, 3, 2) == range(0, 4, 2)``.)" msgstr "" -#: ../../library/stdtypes.rst:1401 +#: ../../library/stdtypes.rst:1439 msgid "" "Implement the Sequence ABC. Support slicing and negative indices. Test :" "class:`int` objects for membership in constant time instead of iterating " "through all items." msgstr "" -#: ../../library/stdtypes.rst:1407 +#: ../../library/stdtypes.rst:1445 msgid "" "Define '==' and '!=' to compare range objects based on the sequence of " "values they define (instead of comparing based on object identity)." msgstr "" -#: ../../library/stdtypes.rst:1412 +#: ../../library/stdtypes.rst:1450 msgid "" "The :attr:`~range.start`, :attr:`~range.stop` and :attr:`~range.step` " "attributes." msgstr "" -#: ../../library/stdtypes.rst:1418 +#: ../../library/stdtypes.rst:1456 msgid "" "The `linspace recipe `_ shows " "how to implement a lazy version of range suitable for floating point " "applications." msgstr "" -#: ../../library/stdtypes.rst:1430 +#: ../../library/stdtypes.rst:1468 msgid "Text Sequence Type --- :class:`str`" msgstr "" -#: ../../library/stdtypes.rst:1432 +#: ../../library/stdtypes.rst:1470 msgid "" "Textual data in Python is handled with :class:`str` objects, or :dfn:" "`strings`. Strings are immutable :ref:`sequences ` of Unicode code " "points. String literals are written in a variety of ways:" msgstr "" -#: ../../library/stdtypes.rst:1437 +#: ../../library/stdtypes.rst:1475 msgid "Single quotes: ``'allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:1438 +#: ../../library/stdtypes.rst:1476 msgid "Double quotes: ``\"allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:1439 +#: ../../library/stdtypes.rst:1477 msgid "" "Triple quoted: ``'''Three single quotes'''``, ``\"\"\"Three double quotes" "\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:1441 +#: ../../library/stdtypes.rst:1479 msgid "" "Triple quoted strings may span multiple lines - all associated whitespace " "will be included in the string literal." msgstr "" -#: ../../library/stdtypes.rst:1444 +#: ../../library/stdtypes.rst:1482 msgid "" "String literals that are part of a single expression and have only " "whitespace between them will be implicitly converted to a single string " "literal. That is, ``(\"spam \" \"eggs\") == \"spam eggs\"``." msgstr "" -#: ../../library/stdtypes.rst:1448 +#: ../../library/stdtypes.rst:1486 msgid "" "See :ref:`strings` for more about the various forms of string literal, " "including supported escape sequences, and the ``r`` (\"raw\") prefix that " "disables most escape sequence processing." msgstr "" -#: ../../library/stdtypes.rst:1452 +#: ../../library/stdtypes.rst:1490 msgid "" "Strings may also be created from other objects using the :class:`str` " "constructor." msgstr "" -#: ../../library/stdtypes.rst:1455 +#: ../../library/stdtypes.rst:1493 msgid "" "Since there is no separate \"character\" type, indexing a string produces " "strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``." msgstr "" -#: ../../library/stdtypes.rst:1461 +#: ../../library/stdtypes.rst:1499 msgid "" "There is also no mutable string type, but :meth:`str.join` or :class:`io." "StringIO` can be used to efficiently construct strings from multiple " "fragments." msgstr "" -#: ../../library/stdtypes.rst:1465 +#: ../../library/stdtypes.rst:1503 msgid "" "For backwards compatibility with the Python 2 series, the ``u`` prefix is " "once again permitted on string literals. It has no effect on the meaning of " "string literals and cannot be combined with the ``r`` prefix." msgstr "" -#: ../../library/stdtypes.rst:1477 +#: ../../library/stdtypes.rst:1515 msgid "" "Return a :ref:`string ` version of *object*. If *object* is not " "provided, returns the empty string. Otherwise, the behavior of ``str()`` " "depends on whether *encoding* or *errors* is given, as follows." msgstr "" -#: ../../library/stdtypes.rst:1481 +#: ../../library/stdtypes.rst:1519 msgid "" "If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" "`type(object).__str__(object) `, which is the \"informal\" " @@ -1980,7 +2005,7 @@ msgid "" "`repr(object) `." msgstr "" -#: ../../library/stdtypes.rst:1493 +#: ../../library/stdtypes.rst:1531 msgid "" "If at least one of *encoding* or *errors* is given, *object* should be a :" "term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " @@ -1992,7 +2017,7 @@ msgid "" "buffer objects." msgstr "" -#: ../../library/stdtypes.rst:1502 +#: ../../library/stdtypes.rst:1540 msgid "" "Passing a :class:`bytes` object to :func:`str` without the *encoding* or " "*errors* arguments falls under the first case of returning the informal " @@ -2000,7 +2025,7 @@ msgid "" "Python). For example::" msgstr "" -#: ../../library/stdtypes.rst:1510 +#: ../../library/stdtypes.rst:1548 msgid "" "For more information on the ``str`` class and its methods, see :ref:" "`textseq` and the :ref:`string-methods` section below. To output formatted " @@ -2008,17 +2033,17 @@ msgid "" "addition, see the :ref:`stringservices` section." msgstr "" -#: ../../library/stdtypes.rst:1522 +#: ../../library/stdtypes.rst:1560 msgid "String Methods" msgstr "" -#: ../../library/stdtypes.rst:1527 +#: ../../library/stdtypes.rst:1565 msgid "" "Strings implement all of the :ref:`common ` sequence " "operations, along with the additional methods described below." msgstr "" -#: ../../library/stdtypes.rst:1530 +#: ../../library/stdtypes.rst:1568 msgid "" "Strings also support two styles of string formatting, one providing a large " "degree of flexibility and customization (see :meth:`str.format`, :ref:" @@ -2028,33 +2053,33 @@ msgid "" "handle (:ref:`old-string-formatting`)." msgstr "" -#: ../../library/stdtypes.rst:1537 +#: ../../library/stdtypes.rst:1575 msgid "" "The :ref:`textservices` section of the standard library covers a number of " "other modules that provide various text related utilities (including regular " "expression support in the :mod:`re` module)." msgstr "" -#: ../../library/stdtypes.rst:1543 +#: ../../library/stdtypes.rst:1581 msgid "" "Return a copy of the string with its first character capitalized and the " "rest lowercased." msgstr "" -#: ../../library/stdtypes.rst:1546 +#: ../../library/stdtypes.rst:1584 msgid "" "The first character is now put into titlecase rather than uppercase. This " "means that characters like digraphs will only have their first letter " "capitalized, instead of the full character." msgstr "" -#: ../../library/stdtypes.rst:1553 +#: ../../library/stdtypes.rst:1591 msgid "" "Return a casefolded copy of the string. Casefolded strings may be used for " "caseless matching." msgstr "" -#: ../../library/stdtypes.rst:1556 +#: ../../library/stdtypes.rst:1594 msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " @@ -2063,27 +2088,27 @@ msgid "" "`casefold` converts it to ``\"ss\"``." msgstr "" -#: ../../library/stdtypes.rst:1562 +#: ../../library/stdtypes.rst:1600 msgid "" "The casefolding algorithm is described in section 3.13 of the Unicode " "Standard." msgstr "" -#: ../../library/stdtypes.rst:1570 +#: ../../library/stdtypes.rst:1608 msgid "" "Return centered in a string of length *width*. Padding is done using the " "specified *fillchar* (default is an ASCII space). The original string is " "returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1578 +#: ../../library/stdtypes.rst:1616 msgid "" "Return the number of non-overlapping occurrences of substring *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:1585 +#: ../../library/stdtypes.rst:1623 msgid "" "Return an encoded version of the string as a bytes object. Default encoding " "is ``'utf-8'``. *errors* may be given to set a different error handling " @@ -2095,24 +2120,24 @@ msgid "" "encodings`." msgstr "" -#: ../../library/stdtypes.rst:1594 +#: ../../library/stdtypes.rst:1632 msgid "" "By default, the *errors* argument is not checked for best performances, but " "only used at the first encoding error. Enable the :ref:`Python Development " "Mode `, or use a :ref:`debug build ` to check *errors*." msgstr "" -#: ../../library/stdtypes.rst:1599 +#: ../../library/stdtypes.rst:1637 msgid "Support for keyword arguments added." msgstr "" -#: ../../library/stdtypes.rst:1602 ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:1640 ../../library/stdtypes.rst:2773 msgid "" "The *errors* is now checked in development mode and in :ref:`debug mode " "`." msgstr "" -#: ../../library/stdtypes.rst:1609 +#: ../../library/stdtypes.rst:1647 msgid "" "Return ``True`` if the string ends with the specified *suffix*, otherwise " "return ``False``. *suffix* can also be a tuple of suffixes to look for. " @@ -2120,7 +2145,7 @@ msgid "" "*end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:1617 +#: ../../library/stdtypes.rst:1655 msgid "" "Return a copy of the string where all tab characters are replaced by one or " "more spaces, depending on the current column and the given tab size. Tab " @@ -2136,21 +2161,21 @@ msgid "" "printed." msgstr "" -#: ../../library/stdtypes.rst:1638 +#: ../../library/stdtypes.rst:1676 msgid "" "Return the lowest index in the string where substring *sub* is found within " "the slice ``s[start:end]``. Optional arguments *start* and *end* are " "interpreted as in slice notation. Return ``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:1644 +#: ../../library/stdtypes.rst:1682 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:1654 +#: ../../library/stdtypes.rst:1692 msgid "" "Perform a string formatting operation. The string on which this method is " "called can contain literal text or replacement fields delimited by braces " @@ -2160,13 +2185,13 @@ msgid "" "the corresponding argument." msgstr "" -#: ../../library/stdtypes.rst:1664 +#: ../../library/stdtypes.rst:1702 msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" -#: ../../library/stdtypes.rst:1668 +#: ../../library/stdtypes.rst:1706 msgid "" "When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" "class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." @@ -2177,26 +2202,26 @@ msgid "" "This temporary change affects other threads." msgstr "" -#: ../../library/stdtypes.rst:1677 +#: ../../library/stdtypes.rst:1715 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/stdtypes.rst:1685 +#: ../../library/stdtypes.rst:1723 msgid "" "Similar to ``str.format(**mapping)``, except that ``mapping`` is used " "directly and not copied to a :class:`dict`. This is useful if for example " "``mapping`` is a dict subclass:" msgstr "" -#: ../../library/stdtypes.rst:1701 +#: ../../library/stdtypes.rst:1739 msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" -#: ../../library/stdtypes.rst:1707 +#: ../../library/stdtypes.rst:1745 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " @@ -2204,7 +2229,7 @@ msgid "" "isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" -#: ../../library/stdtypes.rst:1715 +#: ../../library/stdtypes.rst:1753 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " @@ -2214,14 +2239,14 @@ msgid "" "property defined in the Unicode Standard." msgstr "" -#: ../../library/stdtypes.rst:1724 +#: ../../library/stdtypes.rst:1762 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range U" "+0000-U+007F." msgstr "" -#: ../../library/stdtypes.rst:1733 +#: ../../library/stdtypes.rst:1771 msgid "" "Return ``True`` if all characters in the string are decimal characters and " "there is at least one character, ``False`` otherwise. Decimal characters are " @@ -2230,7 +2255,7 @@ msgid "" "General Category \"Nd\"." msgstr "" -#: ../../library/stdtypes.rst:1743 +#: ../../library/stdtypes.rst:1781 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -2240,32 +2265,32 @@ msgid "" "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" -#: ../../library/stdtypes.rst:1753 +#: ../../library/stdtypes.rst:1791 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:1756 +#: ../../library/stdtypes.rst:1794 msgid "" "Call :func:`keyword.iskeyword` to test whether string ``s`` is a reserved " "identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" -#: ../../library/stdtypes.rst:1759 +#: ../../library/stdtypes.rst:1797 msgid "Example: ::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/stdtypes.rst:1772 +#: ../../library/stdtypes.rst:1810 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1778 +#: ../../library/stdtypes.rst:1816 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -2275,7 +2300,7 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric." msgstr "" -#: ../../library/stdtypes.rst:1788 +#: ../../library/stdtypes.rst:1826 msgid "" "Return ``True`` if all characters in the string are printable or the string " "is empty, ``False`` otherwise. Nonprintable characters are those characters " @@ -2286,20 +2311,20 @@ msgid "" "of strings written to :data:`sys.stdout` or :data:`sys.stderr`.)" msgstr "" -#: ../../library/stdtypes.rst:1799 +#: ../../library/stdtypes.rst:1837 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1802 +#: ../../library/stdtypes.rst:1840 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, space" "\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1810 +#: ../../library/stdtypes.rst:1848 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -2307,13 +2332,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1817 +#: ../../library/stdtypes.rst:1855 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1833 +#: ../../library/stdtypes.rst:1873 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -2321,26 +2346,26 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1841 +#: ../../library/stdtypes.rst:1881 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1848 +#: ../../library/stdtypes.rst:1888 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1851 +#: ../../library/stdtypes.rst:1891 msgid "" "The lowercasing algorithm used is described in section 3.13 of the Unicode " "Standard." msgstr "" -#: ../../library/stdtypes.rst:1857 +#: ../../library/stdtypes.rst:1897 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2349,19 +2374,19 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:1867 +#: ../../library/stdtypes.rst:1907 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:1878 +#: ../../library/stdtypes.rst:1918 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:1880 +#: ../../library/stdtypes.rst:1920 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -2369,7 +2394,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:1885 +#: ../../library/stdtypes.rst:1925 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in x will be mapped to the character at " @@ -2377,7 +2402,7 @@ msgid "" "whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:1893 +#: ../../library/stdtypes.rst:1933 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -2385,47 +2410,47 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:1901 +#: ../../library/stdtypes.rst:1941 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:1915 +#: ../../library/stdtypes.rst:1955 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:1929 +#: ../../library/stdtypes.rst:1969 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If the optional argument *count* is given, only the first *count* " "occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:1936 +#: ../../library/stdtypes.rst:1976 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:1943 +#: ../../library/stdtypes.rst:1983 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:1949 +#: ../../library/stdtypes.rst:1989 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1956 +#: ../../library/stdtypes.rst:1996 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -2433,7 +2458,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:1964 +#: ../../library/stdtypes.rst:2004 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -2442,7 +2467,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:1973 +#: ../../library/stdtypes.rst:2013 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2451,13 +2476,13 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:1983 +#: ../../library/stdtypes.rst:2023 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:1993 +#: ../../library/stdtypes.rst:2033 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -2466,7 +2491,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:1999 +#: ../../library/stdtypes.rst:2039 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -2475,23 +2500,23 @@ msgid "" "Splitting an empty string with a specified separator returns ``['']``." msgstr "" -#: ../../library/stdtypes.rst:2005 ../../library/stdtypes.rst:2021 -#: ../../library/stdtypes.rst:2073 ../../library/stdtypes.rst:2141 -#: ../../library/stdtypes.rst:2208 ../../library/stdtypes.rst:3049 -#: ../../library/stdtypes.rst:3065 ../../library/stdtypes.rst:3156 -#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:3197 -#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3239 -#: ../../library/stdtypes.rst:3253 ../../library/stdtypes.rst:3271 -#: ../../library/stdtypes.rst:3298 ../../library/stdtypes.rst:3321 -#: ../../library/stdtypes.rst:3348 ../../library/stdtypes.rst:3390 -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:2045 ../../library/stdtypes.rst:2061 +#: ../../library/stdtypes.rst:2113 ../../library/stdtypes.rst:2181 +#: ../../library/stdtypes.rst:2248 ../../library/stdtypes.rst:3089 +#: ../../library/stdtypes.rst:3105 ../../library/stdtypes.rst:3196 +#: ../../library/stdtypes.rst:3212 ../../library/stdtypes.rst:3237 +#: ../../library/stdtypes.rst:3251 ../../library/stdtypes.rst:3279 +#: ../../library/stdtypes.rst:3293 ../../library/stdtypes.rst:3311 +#: ../../library/stdtypes.rst:3338 ../../library/stdtypes.rst:3361 +#: ../../library/stdtypes.rst:3388 ../../library/stdtypes.rst:3430 +#: ../../library/stdtypes.rst:3454 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/stdtypes.rst:2014 +#: ../../library/stdtypes.rst:2054 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -2501,131 +2526,131 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2036 +#: ../../library/stdtypes.rst:2076 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2040 +#: ../../library/stdtypes.rst:2080 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2044 +#: ../../library/stdtypes.rst:2084 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2044 +#: ../../library/stdtypes.rst:2084 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2046 +#: ../../library/stdtypes.rst:2086 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2046 +#: ../../library/stdtypes.rst:2086 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2048 +#: ../../library/stdtypes.rst:2088 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2048 +#: ../../library/stdtypes.rst:2088 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2050 +#: ../../library/stdtypes.rst:2090 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2050 +#: ../../library/stdtypes.rst:2090 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2052 +#: ../../library/stdtypes.rst:2092 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2052 +#: ../../library/stdtypes.rst:2092 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2054 +#: ../../library/stdtypes.rst:2094 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2054 +#: ../../library/stdtypes.rst:2094 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2056 +#: ../../library/stdtypes.rst:2096 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2056 +#: ../../library/stdtypes.rst:2096 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2058 +#: ../../library/stdtypes.rst:2098 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2058 +#: ../../library/stdtypes.rst:2098 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2060 +#: ../../library/stdtypes.rst:2100 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2060 +#: ../../library/stdtypes.rst:2100 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2062 +#: ../../library/stdtypes.rst:2102 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2062 +#: ../../library/stdtypes.rst:2102 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2064 +#: ../../library/stdtypes.rst:2104 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2064 +#: ../../library/stdtypes.rst:2104 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2066 +#: ../../library/stdtypes.rst:2106 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2066 +#: ../../library/stdtypes.rst:2106 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2071 +#: ../../library/stdtypes.rst:2111 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2080 +#: ../../library/stdtypes.rst:2120 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2089 +#: ../../library/stdtypes.rst:2129 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2099 +#: ../../library/stdtypes.rst:2139 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -2633,7 +2658,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2107 +#: ../../library/stdtypes.rst:2147 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -2642,7 +2667,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2118 +#: ../../library/stdtypes.rst:2158 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -2650,20 +2675,20 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2131 +#: ../../library/stdtypes.rst:2171 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2138 +#: ../../library/stdtypes.rst:2178 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2146 ../../library/stdtypes.rst:3358 +#: ../../library/stdtypes.rst:2186 ../../library/stdtypes.rst:3398 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -2671,19 +2696,19 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2194 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2197 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2212 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -2695,19 +2720,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2181 +#: ../../library/stdtypes.rst:2221 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2224 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2190 +#: ../../library/stdtypes.rst:2230 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -2716,13 +2741,13 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2196 +#: ../../library/stdtypes.rst:2236 msgid "" "The uppercasing algorithm used is described in section 3.13 of the Unicode " "Standard." msgstr "" -#: ../../library/stdtypes.rst:2202 +#: ../../library/stdtypes.rst:2242 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -2730,11 +2755,11 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2220 +#: ../../library/stdtypes.rst:2260 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2233 +#: ../../library/stdtypes.rst:2273 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -2745,7 +2770,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2241 +#: ../../library/stdtypes.rst:2281 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -2755,7 +2780,7 @@ msgid "" "in the C language." msgstr "" -#: ../../library/stdtypes.rst:2247 +#: ../../library/stdtypes.rst:2287 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -2763,36 +2788,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2257 ../../library/stdtypes.rst:3469 +#: ../../library/stdtypes.rst:2297 ../../library/stdtypes.rst:3509 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2260 ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:2300 ../../library/stdtypes.rst:3512 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2262 ../../library/stdtypes.rst:3474 +#: ../../library/stdtypes.rst:2302 ../../library/stdtypes.rst:3514 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2265 ../../library/stdtypes.rst:3477 +#: ../../library/stdtypes.rst:2305 ../../library/stdtypes.rst:3517 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2268 ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:2308 ../../library/stdtypes.rst:3520 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2272 ../../library/stdtypes.rst:3484 +#: ../../library/stdtypes.rst:2312 ../../library/stdtypes.rst:3524 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -2800,15 +2825,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2277 ../../library/stdtypes.rst:3489 +#: ../../library/stdtypes.rst:2317 ../../library/stdtypes.rst:3529 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2279 ../../library/stdtypes.rst:3491 +#: ../../library/stdtypes.rst:2319 ../../library/stdtypes.rst:3531 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2281 +#: ../../library/stdtypes.rst:2321 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -2816,279 +2841,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2290 ../../library/stdtypes.rst:3502 +#: ../../library/stdtypes.rst:2330 ../../library/stdtypes.rst:3542 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2293 ../../library/stdtypes.rst:3505 +#: ../../library/stdtypes.rst:2333 ../../library/stdtypes.rst:3545 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2302 ../../library/stdtypes.rst:3514 +#: ../../library/stdtypes.rst:2342 ../../library/stdtypes.rst:3554 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2304 ../../library/stdtypes.rst:3516 +#: ../../library/stdtypes.rst:2344 ../../library/stdtypes.rst:3556 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2304 ../../library/stdtypes.rst:3516 +#: ../../library/stdtypes.rst:2344 ../../library/stdtypes.rst:3556 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2307 ../../library/stdtypes.rst:3519 +#: ../../library/stdtypes.rst:2347 ../../library/stdtypes.rst:3559 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2307 ../../library/stdtypes.rst:3519 +#: ../../library/stdtypes.rst:2347 ../../library/stdtypes.rst:3559 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3521 +#: ../../library/stdtypes.rst:2349 ../../library/stdtypes.rst:3561 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3521 +#: ../../library/stdtypes.rst:2349 ../../library/stdtypes.rst:3561 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2312 ../../library/stdtypes.rst:3524 +#: ../../library/stdtypes.rst:2352 ../../library/stdtypes.rst:3564 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2312 ../../library/stdtypes.rst:3524 +#: ../../library/stdtypes.rst:2352 ../../library/stdtypes.rst:3564 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2315 ../../library/stdtypes.rst:3527 +#: ../../library/stdtypes.rst:2355 ../../library/stdtypes.rst:3567 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2315 ../../library/stdtypes.rst:3527 +#: ../../library/stdtypes.rst:2355 ../../library/stdtypes.rst:3567 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2319 ../../library/stdtypes.rst:3531 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3571 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2322 ../../library/stdtypes.rst:3534 +#: ../../library/stdtypes.rst:2362 ../../library/stdtypes.rst:3574 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2325 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:2365 ../../library/stdtypes.rst:3577 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2327 ../../library/stdtypes.rst:3539 +#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3579 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2327 ../../library/stdtypes.rst:2329 -#: ../../library/stdtypes.rst:3539 ../../library/stdtypes.rst:3541 +#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:2369 +#: ../../library/stdtypes.rst:3579 ../../library/stdtypes.rst:3581 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2329 ../../library/stdtypes.rst:3541 +#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3581 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2331 ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:2371 ../../library/stdtypes.rst:3583 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2331 ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:2371 ../../library/stdtypes.rst:3583 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2333 ../../library/stdtypes.rst:3545 +#: ../../library/stdtypes.rst:2373 ../../library/stdtypes.rst:3585 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2333 ../../library/stdtypes.rst:3545 +#: ../../library/stdtypes.rst:2373 ../../library/stdtypes.rst:3585 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2335 ../../library/stdtypes.rst:3547 +#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3587 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2335 ../../library/stdtypes.rst:3547 +#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3587 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2337 ../../library/stdtypes.rst:3549 +#: ../../library/stdtypes.rst:2377 ../../library/stdtypes.rst:3589 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2337 ../../library/stdtypes.rst:3549 +#: ../../library/stdtypes.rst:2377 ../../library/stdtypes.rst:3589 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2339 ../../library/stdtypes.rst:3551 +#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3591 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2339 ../../library/stdtypes.rst:3551 +#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3591 msgid "Floating point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2341 ../../library/stdtypes.rst:3553 +#: ../../library/stdtypes.rst:2381 ../../library/stdtypes.rst:3593 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2341 ../../library/stdtypes.rst:3553 +#: ../../library/stdtypes.rst:2381 ../../library/stdtypes.rst:3593 msgid "Floating point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2343 ../../library/stdtypes.rst:3555 +#: ../../library/stdtypes.rst:2383 ../../library/stdtypes.rst:3595 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2343 ../../library/stdtypes.rst:2345 -#: ../../library/stdtypes.rst:3555 ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:2383 ../../library/stdtypes.rst:2385 +#: ../../library/stdtypes.rst:3595 ../../library/stdtypes.rst:3597 msgid "Floating point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2345 ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:2385 ../../library/stdtypes.rst:3597 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2347 ../../library/stdtypes.rst:3559 +#: ../../library/stdtypes.rst:2387 ../../library/stdtypes.rst:3599 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2347 ../../library/stdtypes.rst:3559 +#: ../../library/stdtypes.rst:2387 ../../library/stdtypes.rst:3599 msgid "" "Floating point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2351 ../../library/stdtypes.rst:3563 +#: ../../library/stdtypes.rst:2391 ../../library/stdtypes.rst:3603 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2351 ../../library/stdtypes.rst:3563 +#: ../../library/stdtypes.rst:2391 ../../library/stdtypes.rst:3603 msgid "" "Floating point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2355 ../../library/stdtypes.rst:3567 +#: ../../library/stdtypes.rst:2395 ../../library/stdtypes.rst:3607 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2355 +#: ../../library/stdtypes.rst:2395 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2358 ../../library/stdtypes.rst:3580 +#: ../../library/stdtypes.rst:2398 ../../library/stdtypes.rst:3620 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2358 +#: ../../library/stdtypes.rst:2398 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2361 ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:2401 ../../library/stdtypes.rst:3614 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2361 +#: ../../library/stdtypes.rst:2401 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:2404 ../../library/stdtypes.rst:3617 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2364 +#: ../../library/stdtypes.rst:2404 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:2407 ../../library/stdtypes.rst:3623 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:2407 ../../library/stdtypes.rst:3623 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2374 ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3630 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2378 ../../library/stdtypes.rst:3594 +#: ../../library/stdtypes.rst:2418 ../../library/stdtypes.rst:3634 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2382 ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3638 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2385 ../../library/stdtypes.rst:3601 +#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3641 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2389 ../../library/stdtypes.rst:3605 +#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3645 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2392 ../../library/stdtypes.rst:3608 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3648 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2396 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3652 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2399 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3661 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`\\ 。" -#: ../../library/stdtypes.rst:2401 +#: ../../library/stdtypes.rst:2441 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2406 +#: ../../library/stdtypes.rst:2446 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2417 +#: ../../library/stdtypes.rst:2457 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2425 +#: ../../library/stdtypes.rst:2465 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -3096,17 +3121,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2470 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:2476 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2440 +#: ../../library/stdtypes.rst:2480 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3114,40 +3139,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2447 +#: ../../library/stdtypes.rst:2487 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2450 +#: ../../library/stdtypes.rst:2490 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2451 +#: ../../library/stdtypes.rst:2491 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2452 +#: ../../library/stdtypes.rst:2492 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2454 +#: ../../library/stdtypes.rst:2494 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:2498 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2462 +#: ../../library/stdtypes.rst:2502 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3160,29 +3185,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2472 +#: ../../library/stdtypes.rst:2512 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2515 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2476 +#: ../../library/stdtypes.rst:2516 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2477 +#: ../../library/stdtypes.rst:2517 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2479 +#: ../../library/stdtypes.rst:2519 msgid "Also see the :ref:`bytes ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2521 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3190,32 +3215,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2487 +#: ../../library/stdtypes.rst:2527 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2494 +#: ../../library/stdtypes.rst:2534 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2498 +#: ../../library/stdtypes.rst:2538 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2503 ../../library/stdtypes.rst:2588 +#: ../../library/stdtypes.rst:2543 ../../library/stdtypes.rst:2628 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2509 +#: ../../library/stdtypes.rst:2549 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -3224,13 +3249,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2566 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:2570 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -3238,58 +3263,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2535 +#: ../../library/stdtypes.rst:2575 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2543 +#: ../../library/stdtypes.rst:2583 msgid "Bytearray Objects" msgstr "" -#: ../../library/stdtypes.rst:2547 +#: ../../library/stdtypes.rst:2587 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2552 +#: ../../library/stdtypes.rst:2592 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2555 +#: ../../library/stdtypes.rst:2595 msgid "Creating an empty instance: ``bytearray()``" msgstr "" -#: ../../library/stdtypes.rst:2556 +#: ../../library/stdtypes.rst:2596 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2557 +#: ../../library/stdtypes.rst:2597 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2598 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:2600 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2564 +#: ../../library/stdtypes.rst:2604 msgid "Also see the :ref:`bytearray ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2566 +#: ../../library/stdtypes.rst:2606 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3297,33 +3322,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2572 +#: ../../library/stdtypes.rst:2612 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2619 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2583 +#: ../../library/stdtypes.rst:2623 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2596 +#: ../../library/stdtypes.rst:2636 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2601 +#: ../../library/stdtypes.rst:2641 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -3331,7 +3356,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:2646 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -3339,11 +3364,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2615 +#: ../../library/stdtypes.rst:2655 msgid "Bytes and Bytearray Operations" msgstr "" -#: ../../library/stdtypes.rst:2620 +#: ../../library/stdtypes.rst:2660 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -3352,97 +3377,97 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2628 +#: ../../library/stdtypes.rst:2668 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2635 +#: ../../library/stdtypes.rst:2675 msgid "and::" msgstr "" "和:\n" "\n" "::" -#: ../../library/stdtypes.rst:2640 +#: ../../library/stdtypes.rst:2680 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2645 +#: ../../library/stdtypes.rst:2685 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2648 +#: ../../library/stdtypes.rst:2688 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2694 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2658 ../../library/stdtypes.rst:2757 -#: ../../library/stdtypes.rst:2779 ../../library/stdtypes.rst:2845 -#: ../../library/stdtypes.rst:2858 +#: ../../library/stdtypes.rst:2698 ../../library/stdtypes.rst:2797 +#: ../../library/stdtypes.rst:2819 ../../library/stdtypes.rst:2885 +#: ../../library/stdtypes.rst:2898 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:2769 -#: ../../library/stdtypes.rst:2782 ../../library/stdtypes.rst:2848 -#: ../../library/stdtypes.rst:2861 +#: ../../library/stdtypes.rst:2701 ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2822 ../../library/stdtypes.rst:2888 +#: ../../library/stdtypes.rst:2901 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2668 +#: ../../library/stdtypes.rst:2708 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2677 +#: ../../library/stdtypes.rst:2717 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2681 ../../library/stdtypes.rst:2703 -#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:2926 -#: ../../library/stdtypes.rst:2940 ../../library/stdtypes.rst:2971 -#: ../../library/stdtypes.rst:2985 ../../library/stdtypes.rst:3027 -#: ../../library/stdtypes.rst:3097 ../../library/stdtypes.rst:3115 -#: ../../library/stdtypes.rst:3143 ../../library/stdtypes.rst:3282 -#: ../../library/stdtypes.rst:3337 ../../library/stdtypes.rst:3380 -#: ../../library/stdtypes.rst:3401 ../../library/stdtypes.rst:3423 -#: ../../library/stdtypes.rst:3625 +#: ../../library/stdtypes.rst:2721 ../../library/stdtypes.rst:2743 +#: ../../library/stdtypes.rst:2873 ../../library/stdtypes.rst:2966 +#: ../../library/stdtypes.rst:2980 ../../library/stdtypes.rst:3011 +#: ../../library/stdtypes.rst:3025 ../../library/stdtypes.rst:3067 +#: ../../library/stdtypes.rst:3137 ../../library/stdtypes.rst:3155 +#: ../../library/stdtypes.rst:3183 ../../library/stdtypes.rst:3322 +#: ../../library/stdtypes.rst:3377 ../../library/stdtypes.rst:3420 +#: ../../library/stdtypes.rst:3441 ../../library/stdtypes.rst:3463 +#: ../../library/stdtypes.rst:3665 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2730 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:2699 +#: ../../library/stdtypes.rst:2739 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2712 +#: ../../library/stdtypes.rst:2752 msgid "" "Return a string decoded from the given bytes. Default encoding is " "``'utf-8'``. *errors* may be given to set a different error handling " @@ -3453,25 +3478,25 @@ msgid "" "encodings, see section :ref:`standard-encodings`." msgstr "" -#: ../../library/stdtypes.rst:2720 +#: ../../library/stdtypes.rst:2760 msgid "" "By default, the *errors* argument is not checked for best performances, but " "only used at the first decoding error. Enable the :ref:`Python Development " "Mode `, or use a :ref:`debug build ` to check *errors*." msgstr "" -#: ../../library/stdtypes.rst:2726 +#: ../../library/stdtypes.rst:2766 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary bytes or " "bytearray object." msgstr "" -#: ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2770 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2781 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -3479,11 +3504,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:2786 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2792 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -3491,20 +3516,20 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2762 +#: ../../library/stdtypes.rst:2802 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:2776 +#: ../../library/stdtypes.rst:2816 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2789 +#: ../../library/stdtypes.rst:2829 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -3514,7 +3539,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2840 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -3522,7 +3547,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:2851 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -3531,24 +3556,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:2858 ../../library/stdtypes.rst:2915 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:2864 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:2828 +#: ../../library/stdtypes.rst:2868 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2840 +#: ../../library/stdtypes.rst:2880 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -3556,13 +3581,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2855 +#: ../../library/stdtypes.rst:2895 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:2908 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -3571,7 +3596,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2881 +#: ../../library/stdtypes.rst:2921 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -3579,11 +3604,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2886 +#: ../../library/stdtypes.rst:2926 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2892 +#: ../../library/stdtypes.rst:2932 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -3591,22 +3616,22 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:2937 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:2900 +#: ../../library/stdtypes.rst:2940 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:2906 +#: ../../library/stdtypes.rst:2946 msgid "*delete* is now supported as a keyword argument." msgstr "" -#: ../../library/stdtypes.rst:2910 +#: ../../library/stdtypes.rst:2950 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -3615,7 +3640,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:2919 +#: ../../library/stdtypes.rst:2959 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -3623,7 +3648,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2933 +#: ../../library/stdtypes.rst:2973 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -3631,7 +3656,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2947 +#: ../../library/stdtypes.rst:2987 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -3641,14 +3666,14 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:2999 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2978 +#: ../../library/stdtypes.rst:3018 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -3656,7 +3681,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2992 +#: ../../library/stdtypes.rst:3032 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -3666,7 +3691,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3003 +#: ../../library/stdtypes.rst:3043 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -3676,14 +3701,14 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3015 +#: ../../library/stdtypes.rst:3055 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3034 +#: ../../library/stdtypes.rst:3074 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -3692,7 +3717,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3040 +#: ../../library/stdtypes.rst:3080 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -3703,7 +3728,7 @@ msgid "" "object being split. The *sep* argument may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3098 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -3713,7 +3738,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3079 +#: ../../library/stdtypes.rst:3119 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -3723,13 +3748,13 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3092 +#: ../../library/stdtypes.rst:3132 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3101 +#: ../../library/stdtypes.rst:3141 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -3737,14 +3762,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3109 +#: ../../library/stdtypes.rst:3149 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3122 +#: ../../library/stdtypes.rst:3162 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -3760,7 +3785,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3150 +#: ../../library/stdtypes.rst:3190 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -3769,7 +3794,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3167 +#: ../../library/stdtypes.rst:3207 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -3777,35 +3802,35 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3183 +#: ../../library/stdtypes.rst:3223 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3193 +#: ../../library/stdtypes.rst:3233 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3208 +#: ../../library/stdtypes.rst:3248 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3218 ../../library/stdtypes.rst:3260 -#: ../../library/stdtypes.rst:3276 ../../library/stdtypes.rst:3326 -#: ../../library/stdtypes.rst:3395 +#: ../../library/stdtypes.rst:3258 ../../library/stdtypes.rst:3300 +#: ../../library/stdtypes.rst:3316 ../../library/stdtypes.rst:3366 +#: ../../library/stdtypes.rst:3435 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3226 +#: ../../library/stdtypes.rst:3266 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -3813,27 +3838,27 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3275 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3290 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3268 +#: ../../library/stdtypes.rst:3308 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3293 +#: ../../library/stdtypes.rst:3333 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -3841,20 +3866,20 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3305 +#: ../../library/stdtypes.rst:3345 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3318 +#: ../../library/stdtypes.rst:3358 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3330 +#: ../../library/stdtypes.rst:3370 msgid "" "Unlike :func:`str.swapcase()`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -3862,14 +3887,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3344 +#: ../../library/stdtypes.rst:3384 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3353 +#: ../../library/stdtypes.rst:3393 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -3877,18 +3902,18 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3366 +#: ../../library/stdtypes.rst:3406 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3387 +#: ../../library/stdtypes.rst:3427 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3408 +#: ../../library/stdtypes.rst:3448 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -3897,11 +3922,11 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3430 +#: ../../library/stdtypes.rst:3470 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3447 +#: ../../library/stdtypes.rst:3487 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3909,7 +3934,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3452 +#: ../../library/stdtypes.rst:3492 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -3919,7 +3944,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3459 +#: ../../library/stdtypes.rst:3499 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3927,7 +3952,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3493 +#: ../../library/stdtypes.rst:3533 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -3935,73 +3960,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3567 +#: ../../library/stdtypes.rst:3607 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3570 +#: ../../library/stdtypes.rst:3610 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3570 +#: ../../library/stdtypes.rst:3610 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:3614 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:3617 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3580 +#: ../../library/stdtypes.rst:3620 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3580 +#: ../../library/stdtypes.rst:3620 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3615 +#: ../../library/stdtypes.rst:3655 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3618 +#: ../../library/stdtypes.rst:3658 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:3670 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3637 +#: ../../library/stdtypes.rst:3677 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:3679 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:3685 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3649 +#: ../../library/stdtypes.rst:3689 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -4009,7 +4034,7 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:3694 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`. If " "``view.ndim = 0``, the length is 1. If ``view.ndim = 1``, the length is " @@ -4019,13 +4044,13 @@ msgid "" "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:3701 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:3714 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -4036,82 +4061,82 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:3723 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3695 +#: ../../library/stdtypes.rst:3735 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3716 +#: ../../library/stdtypes.rst:3756 msgid "" "One-dimensional memoryviews of hashable (read-only) types with formats 'B', " "'b' or 'c' are also hashable. The hash is defined as ``hash(m) == hash(m." "tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:3728 +#: ../../library/stdtypes.rst:3768 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now hashable." msgstr "" -#: ../../library/stdtypes.rst:3732 +#: ../../library/stdtypes.rst:3772 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3736 +#: ../../library/stdtypes.rst:3776 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3739 +#: ../../library/stdtypes.rst:3779 msgid ":class:`memoryview` has several methods:" msgstr "" -#: ../../library/stdtypes.rst:3743 +#: ../../library/stdtypes.rst:3783 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:3747 +#: ../../library/stdtypes.rst:3787 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:3766 +#: ../../library/stdtypes.rst:3806 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:3822 msgid "" "Note that, as with floating point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3785 +#: ../../library/stdtypes.rst:3825 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3831 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:3800 +#: ../../library/stdtypes.rst:3840 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -4119,7 +4144,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3805 +#: ../../library/stdtypes.rst:3845 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -4128,36 +4153,36 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3814 +#: ../../library/stdtypes.rst:3854 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:3863 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3830 +#: ../../library/stdtypes.rst:3870 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:3880 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:3847 +#: ../../library/stdtypes.rst:3887 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3866 +#: ../../library/stdtypes.rst:3906 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -4166,20 +4191,20 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3872 +#: ../../library/stdtypes.rst:3912 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release()` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:3923 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:3939 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -4188,57 +4213,57 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:3945 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " "'c'). The byte length of the result must be the same as the original length." msgstr "" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3950 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:3933 +#: ../../library/stdtypes.rst:3973 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:3946 +#: ../../library/stdtypes.rst:3986 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:3972 +#: ../../library/stdtypes.rst:4012 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:3986 +#: ../../library/stdtypes.rst:4026 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:3989 +#: ../../library/stdtypes.rst:4029 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:3993 +#: ../../library/stdtypes.rst:4033 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4004 +#: ../../library/stdtypes.rst:4044 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4023 +#: ../../library/stdtypes.rst:4063 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4040 +#: ../../library/stdtypes.rst:4080 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4044 +#: ../../library/stdtypes.rst:4084 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -4246,59 +4271,59 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4049 +#: ../../library/stdtypes.rst:4089 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4055 +#: ../../library/stdtypes.rst:4095 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4068 +#: ../../library/stdtypes.rst:4108 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4073 +#: ../../library/stdtypes.rst:4113 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4076 ../../library/stdtypes.rst:4084 +#: ../../library/stdtypes.rst:4116 ../../library/stdtypes.rst:4124 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4081 +#: ../../library/stdtypes.rst:4121 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4089 +#: ../../library/stdtypes.rst:4129 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4093 +#: ../../library/stdtypes.rst:4133 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4099 +#: ../../library/stdtypes.rst:4139 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4105 +#: ../../library/stdtypes.rst:4145 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4153 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:4157 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -4308,7 +4333,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4124 +#: ../../library/stdtypes.rst:4164 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -4316,7 +4341,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4129 +#: ../../library/stdtypes.rst:4169 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -4328,18 +4353,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4137 +#: ../../library/stdtypes.rst:4177 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4181 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4146 +#: ../../library/stdtypes.rst:4186 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -4347,92 +4372,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4152 +#: ../../library/stdtypes.rst:4192 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4154 +#: ../../library/stdtypes.rst:4194 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4155 +#: ../../library/stdtypes.rst:4195 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4156 +#: ../../library/stdtypes.rst:4196 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4198 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4163 +#: ../../library/stdtypes.rst:4203 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:4207 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4171 +#: ../../library/stdtypes.rst:4211 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:4215 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:4221 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4185 +#: ../../library/stdtypes.rst:4225 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:4231 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4195 +#: ../../library/stdtypes.rst:4235 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4241 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4206 +#: ../../library/stdtypes.rst:4246 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4251 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4216 +#: ../../library/stdtypes.rst:4256 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4220 +#: ../../library/stdtypes.rst:4260 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4223 +#: ../../library/stdtypes.rst:4263 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -4442,7 +4467,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4230 +#: ../../library/stdtypes.rst:4270 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -4452,14 +4477,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4237 +#: ../../library/stdtypes.rst:4277 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4241 +#: ../../library/stdtypes.rst:4281 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -4467,71 +4492,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4246 +#: ../../library/stdtypes.rst:4286 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4249 +#: ../../library/stdtypes.rst:4289 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4251 +#: ../../library/stdtypes.rst:4291 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4295 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4261 +#: ../../library/stdtypes.rst:4301 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4266 +#: ../../library/stdtypes.rst:4306 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4271 +#: ../../library/stdtypes.rst:4311 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4316 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4280 +#: ../../library/stdtypes.rst:4320 msgid "Add element *elem* to the set." msgstr "" -#: ../../library/stdtypes.rst:4284 +#: ../../library/stdtypes.rst:4324 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4289 +#: ../../library/stdtypes.rst:4329 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4293 +#: ../../library/stdtypes.rst:4333 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4298 +#: ../../library/stdtypes.rst:4338 msgid "Remove all elements from the set." msgstr "" -#: ../../library/stdtypes.rst:4301 +#: ../../library/stdtypes.rst:4341 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -4539,18 +4564,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4306 +#: ../../library/stdtypes.rst:4346 msgid "" "Note, the *elem* argument to the :meth:`__contains__`, :meth:`remove`, and :" "meth:`discard` methods may be a set. To support searching for an equivalent " "frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4314 +#: ../../library/stdtypes.rst:4354 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4324 +#: ../../library/stdtypes.rst:4364 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -4559,7 +4584,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4330 +#: ../../library/stdtypes.rst:4370 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -4571,33 +4596,33 @@ msgid "" "approximations it is usually unwise to use them as dictionary keys.)" msgstr "" -#: ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:4383 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4346 +#: ../../library/stdtypes.rst:4386 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4348 +#: ../../library/stdtypes.rst:4388 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4350 +#: ../../library/stdtypes.rst:4390 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4351 +#: ../../library/stdtypes.rst:4391 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4354 +#: ../../library/stdtypes.rst:4394 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it is a mapping object, a dictionary is " @@ -4609,7 +4634,7 @@ msgid "" "value for that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4404 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -4617,39 +4642,39 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4409 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:4421 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4425 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4390 +#: ../../library/stdtypes.rst:4430 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4434 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:4438 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:4443 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -4660,51 +4685,51 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4461 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4427 +#: ../../library/stdtypes.rst:4467 msgid "Set ``d[key]`` to *value*." msgstr "" -#: ../../library/stdtypes.rst:4431 +#: ../../library/stdtypes.rst:4471 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" -#: ../../library/stdtypes.rst:4436 +#: ../../library/stdtypes.rst:4476 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "" -#: ../../library/stdtypes.rst:4440 +#: ../../library/stdtypes.rst:4480 msgid "Equivalent to ``not key in d``." msgstr "" -#: ../../library/stdtypes.rst:4444 +#: ../../library/stdtypes.rst:4484 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4489 msgid "Remove all items from the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4453 +#: ../../library/stdtypes.rst:4493 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:4497 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4459 +#: ../../library/stdtypes.rst:4499 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -4713,70 +4738,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4467 +#: ../../library/stdtypes.rst:4507 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4473 +#: ../../library/stdtypes.rst:4513 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4478 +#: ../../library/stdtypes.rst:4518 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4483 +#: ../../library/stdtypes.rst:4523 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4529 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4492 +#: ../../library/stdtypes.rst:4532 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4496 +#: ../../library/stdtypes.rst:4536 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4502 +#: ../../library/stdtypes.rst:4542 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4509 +#: ../../library/stdtypes.rst:4549 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4515 +#: ../../library/stdtypes.rst:4555 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4518 +#: ../../library/stdtypes.rst:4558 msgid "" ":meth:`update` accepts either another dictionary object or an iterable of " "key/value pairs (as tuples or other iterables of length two). If keyword " @@ -4784,71 +4809,71 @@ msgid "" "pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4525 +#: ../../library/stdtypes.rst:4565 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4528 +#: ../../library/stdtypes.rst:4568 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4538 +#: ../../library/stdtypes.rst:4578 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4546 +#: ../../library/stdtypes.rst:4586 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4552 +#: ../../library/stdtypes.rst:4592 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4556 +#: ../../library/stdtypes.rst:4596 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4574 +#: ../../library/stdtypes.rst:4614 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4578 +#: ../../library/stdtypes.rst:4618 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4590 +#: ../../library/stdtypes.rst:4630 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4595 +#: ../../library/stdtypes.rst:4635 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4602 +#: ../../library/stdtypes.rst:4642 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4604 +#: ../../library/stdtypes.rst:4644 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -4856,23 +4881,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4609 +#: ../../library/stdtypes.rst:4649 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4614 +#: ../../library/stdtypes.rst:4654 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4618 +#: ../../library/stdtypes.rst:4658 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4621 +#: ../../library/stdtypes.rst:4661 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -4880,39 +4905,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4626 +#: ../../library/stdtypes.rst:4666 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4669 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4634 +#: ../../library/stdtypes.rst:4674 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:4679 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4642 +#: ../../library/stdtypes.rst:4682 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4687 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4652 +#: ../../library/stdtypes.rst:4692 msgid "" "Keys views are set-like since their entries are unique and hashable. If all " "values are hashable, so that ``(key, value)`` pairs are unique and hashable, " @@ -4922,15 +4947,15 @@ msgid "" "abc.Set` are available (for example, ``==``, ``<``, or ``^``)." msgstr "" -#: ../../library/stdtypes.rst:4659 +#: ../../library/stdtypes.rst:4699 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4700 +#: ../../library/stdtypes.rst:4740 msgid "Context Manager Types" msgstr "" -#: ../../library/stdtypes.rst:4707 +#: ../../library/stdtypes.rst:4747 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -4938,7 +4963,7 @@ msgid "" "before the statement body is executed and exited when the statement ends:" msgstr "" -#: ../../library/stdtypes.rst:4715 +#: ../../library/stdtypes.rst:4755 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -4946,14 +4971,14 @@ msgid "" "using this context manager." msgstr "" -#: ../../library/stdtypes.rst:4720 +#: ../../library/stdtypes.rst:4760 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" "`open` to be used as the context expression in a :keyword:`with` statement." msgstr "" -#: ../../library/stdtypes.rst:4724 +#: ../../library/stdtypes.rst:4764 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -4963,7 +4988,7 @@ msgid "" "the :keyword:`!with` statement." msgstr "" -#: ../../library/stdtypes.rst:4734 +#: ../../library/stdtypes.rst:4774 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -4972,7 +4997,7 @@ msgid "" "arguments are ``None``." msgstr "" -#: ../../library/stdtypes.rst:4739 +#: ../../library/stdtypes.rst:4779 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -4983,7 +5008,7 @@ msgid "" "statement." msgstr "" -#: ../../library/stdtypes.rst:4746 +#: ../../library/stdtypes.rst:4786 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -4992,7 +5017,7 @@ msgid "" "method has actually failed." msgstr "" -#: ../../library/stdtypes.rst:4752 +#: ../../library/stdtypes.rst:4792 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -5001,7 +5026,7 @@ msgid "" "management protocol. See the :mod:`contextlib` module for some examples." msgstr "" -#: ../../library/stdtypes.rst:4758 +#: ../../library/stdtypes.rst:4798 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -5011,7 +5036,7 @@ msgid "" "rather than the iterator produced by an undecorated generator function." msgstr "" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:4805 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -5020,23 +5045,23 @@ msgid "" "a single class dictionary lookup is negligible." msgstr "" -#: ../../library/stdtypes.rst:4773 +#: ../../library/stdtypes.rst:4813 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" msgstr "" -#: ../../library/stdtypes.rst:4778 +#: ../../library/stdtypes.rst:4818 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." msgstr "" -#: ../../library/stdtypes.rst:4785 +#: ../../library/stdtypes.rst:4825 msgid "Generic Alias Type" msgstr "" -#: ../../library/stdtypes.rst:4791 +#: ../../library/stdtypes.rst:4831 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -5046,19 +5071,19 @@ msgid "" "are intended primarily for use with :term:`type annotations `." msgstr "" -#: ../../library/stdtypes.rst:4801 +#: ../../library/stdtypes.rst:4841 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." msgstr "" -#: ../../library/stdtypes.rst:4804 +#: ../../library/stdtypes.rst:4844 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." msgstr "" -#: ../../library/stdtypes.rst:4807 +#: ../../library/stdtypes.rst:4847 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -5067,7 +5092,7 @@ msgid "" "`bytes`." msgstr "" -#: ../../library/stdtypes.rst:4813 +#: ../../library/stdtypes.rst:4853 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -5076,7 +5101,7 @@ msgid "" "the :class:`str` data type and the :class:`bytes` data type:" msgstr "" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4859 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -5084,7 +5109,7 @@ msgid "" "annotations with the ``GenericAlias`` ``re.Match[str]``." msgstr "" -#: ../../library/stdtypes.rst:4825 +#: ../../library/stdtypes.rst:4865 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -5093,21 +5118,21 @@ msgid "" "objects>` objects with ``re.Match[bytes]``." msgstr "" -#: ../../library/stdtypes.rst:4831 +#: ../../library/stdtypes.rst:4871 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " "directly." msgstr "" -#: ../../library/stdtypes.rst:4837 +#: ../../library/stdtypes.rst:4877 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " "expecting a :class:`list` containing :class:`float` elements::" msgstr "" -#: ../../library/stdtypes.rst:4845 +#: ../../library/stdtypes.rst:4885 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -5115,13 +5140,13 @@ msgid "" "of type :class:`str` and values of type :class:`int`::" msgstr "" -#: ../../library/stdtypes.rst:4853 +#: ../../library/stdtypes.rst:4893 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" msgstr "" -#: ../../library/stdtypes.rst:4861 +#: ../../library/stdtypes.rst:4901 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -5130,325 +5155,331 @@ msgid "" "discouraged, but will run without errors::" msgstr "" -#: ../../library/stdtypes.rst:4871 +#: ../../library/stdtypes.rst:4911 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "" -#: ../../library/stdtypes.rst:4882 +#: ../../library/stdtypes.rst:4922 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "" -#: ../../library/stdtypes.rst:4890 +#: ../../library/stdtypes.rst:4930 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -#: ../../library/stdtypes.rst:4898 +#: ../../library/stdtypes.rst:4938 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" -#: ../../library/stdtypes.rst:4909 +#: ../../library/stdtypes.rst:4949 msgid "Standard Generic Classes" msgstr "" -#: ../../library/stdtypes.rst:4911 +#: ../../library/stdtypes.rst:4951 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:4954 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:4915 +#: ../../library/stdtypes.rst:4955 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:4916 +#: ../../library/stdtypes.rst:4956 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:4917 +#: ../../library/stdtypes.rst:4957 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:4958 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:4959 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:4960 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:4921 +#: ../../library/stdtypes.rst:4961 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:4922 +#: ../../library/stdtypes.rst:4962 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:4923 +#: ../../library/stdtypes.rst:4963 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:4924 +#: ../../library/stdtypes.rst:4964 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:4925 +#: ../../library/stdtypes.rst:4965 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:4926 +#: ../../library/stdtypes.rst:4966 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:4927 +#: ../../library/stdtypes.rst:4967 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:4968 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:4929 +#: ../../library/stdtypes.rst:4969 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4970 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:4971 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:4932 +#: ../../library/stdtypes.rst:4972 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4973 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:4934 +#: ../../library/stdtypes.rst:4974 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:4935 +#: ../../library/stdtypes.rst:4975 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:4936 +#: ../../library/stdtypes.rst:4976 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:4937 +#: ../../library/stdtypes.rst:4977 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4978 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:4939 +#: ../../library/stdtypes.rst:4979 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:4940 +#: ../../library/stdtypes.rst:4980 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:4941 +#: ../../library/stdtypes.rst:4981 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4982 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:4943 +#: ../../library/stdtypes.rst:4983 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:4944 +#: ../../library/stdtypes.rst:4984 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:4945 +#: ../../library/stdtypes.rst:4985 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:4946 +#: ../../library/stdtypes.rst:4986 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:4947 +#: ../../library/stdtypes.rst:4987 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:4948 +#: ../../library/stdtypes.rst:4988 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:4949 +#: ../../library/stdtypes.rst:4989 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:4950 +#: ../../library/stdtypes.rst:4990 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:4951 +#: ../../library/stdtypes.rst:4991 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:4952 +#: ../../library/stdtypes.rst:4992 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:4953 +#: ../../library/stdtypes.rst:4993 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:4954 +#: ../../library/stdtypes.rst:4994 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:4955 +#: ../../library/stdtypes.rst:4995 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:4956 +#: ../../library/stdtypes.rst:4996 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:4957 +#: ../../library/stdtypes.rst:4997 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:4958 +#: ../../library/stdtypes.rst:4998 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4999 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:4960 +#: ../../library/stdtypes.rst:5000 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:4961 +#: ../../library/stdtypes.rst:5001 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:4962 +#: ../../library/stdtypes.rst:5002 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:4963 +#: ../../library/stdtypes.rst:5003 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:4964 +#: ../../library/stdtypes.rst:5004 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:4965 +#: ../../library/stdtypes.rst:5005 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5006 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:4967 +#: ../../library/stdtypes.rst:5007 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:4972 +#: ../../library/stdtypes.rst:5012 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "" -#: ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:5014 msgid "All parameterized generics implement special read-only attributes." msgstr "" -#: ../../library/stdtypes.rst:4978 +#: ../../library/stdtypes.rst:5018 msgid "This attribute points at the non-parameterized generic class::" msgstr "" -#: ../../library/stdtypes.rst:4986 +#: ../../library/stdtypes.rst:5026 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" -#: ../../library/stdtypes.rst:4996 +#: ../../library/stdtypes.rst:5036 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" msgstr "" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5047 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." "ParamSpec` is intended primarily for static type checking." msgstr "" -#: ../../library/stdtypes.rst:5014 +#: ../../library/stdtypes.rst:5054 +msgid "" +"A boolean that is true if the alias has been unpacked using the ``*`` " +"operator (see :data:`~typing.TypeVarTuple`)." +msgstr "" + +#: ../../library/stdtypes.rst:5063 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../library/stdtypes.rst:5014 +#: ../../library/stdtypes.rst:5063 msgid "Introducing Python's framework for type annotations." msgstr "" -#: ../../library/stdtypes.rst:5019 +#: ../../library/stdtypes.rst:5068 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr "" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5066 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." "__class_getitem__`." msgstr "" -#: ../../library/stdtypes.rst:5022 +#: ../../library/stdtypes.rst:5071 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" msgstr "" -#: ../../library/stdtypes.rst:5022 +#: ../../library/stdtypes.rst:5071 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../library/stdtypes.rst:5031 +#: ../../library/stdtypes.rst:5080 msgid "Union Type" msgstr "" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5086 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -5457,7 +5488,7 @@ msgid "" "Union`." msgstr "" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5093 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -5465,76 +5496,76 @@ msgid "" "class:`float`::" msgstr "" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5103 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5105 msgid "Unions of unions are flattened::" msgstr "" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5109 msgid "Redundant types are removed::" msgstr "" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5113 msgid "When comparing unions, the order is ignored::" msgstr "" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5117 msgid "It is compatible with :data:`typing.Union`::" msgstr "" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5121 msgid "Optional types can be spelled as a union with ``None``::" msgstr "" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5128 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "" -#: ../../library/stdtypes.rst:5085 +#: ../../library/stdtypes.rst:5134 msgid "" "However, union objects containing :ref:`parameterized generics ` cannot be used::" msgstr "" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5142 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " "instantiated from the type::" msgstr "" -#: ../../library/stdtypes.rst:5106 +#: ../../library/stdtypes.rst:5155 msgid "" "The :meth:`__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`__or__`, the Union may override " "it::" msgstr "" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5173 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr "" -#: ../../library/stdtypes.rst:5132 +#: ../../library/stdtypes.rst:5181 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5183 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5141 +#: ../../library/stdtypes.rst:5190 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5143 +#: ../../library/stdtypes.rst:5192 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -5545,7 +5576,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5150 +#: ../../library/stdtypes.rst:5199 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -5556,32 +5587,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5207 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5166 +#: ../../library/stdtypes.rst:5215 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5168 +#: ../../library/stdtypes.rst:5217 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5223 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5176 +#: ../../library/stdtypes.rst:5225 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5179 +#: ../../library/stdtypes.rst:5228 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -5589,15 +5620,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5183 +#: ../../library/stdtypes.rst:5232 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`\\ 。" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5238 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5193 +#: ../../library/stdtypes.rst:5242 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: built-in methods (such as :meth:`append` on lists) and " @@ -5605,7 +5636,7 @@ msgid "" "support them." msgstr "" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5247 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :dfn:" @@ -5617,7 +5648,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5207 +#: ../../library/stdtypes.rst:5256 msgid "" "Like function objects, bound method objects support getting arbitrary " "attributes. However, since method attributes are actually stored on the " @@ -5627,15 +5658,15 @@ msgid "" "attribute, you need to explicitly set it on the underlying function object::" msgstr "" -#: ../../library/stdtypes.rst:5227 ../../library/stdtypes.rst:5258 +#: ../../library/stdtypes.rst:5276 ../../library/stdtypes.rst:5307 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`\\ 。" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5284 msgid "Code Objects" msgstr "" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5290 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -5645,23 +5676,23 @@ msgid "" "`__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5248 +#: ../../library/stdtypes.rst:5297 msgid "" "Accessing ``__code__`` raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"__code__\"``." msgstr "" -#: ../../library/stdtypes.rst:5255 +#: ../../library/stdtypes.rst:5304 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5313 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5319 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -5669,30 +5700,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5275 +#: ../../library/stdtypes.rst:5324 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5330 msgid "The Null Object" msgstr "" -#: ../../library/stdtypes.rst:5283 +#: ../../library/stdtypes.rst:5332 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5287 +#: ../../library/stdtypes.rst:5336 msgid "It is written as ``None``." msgstr "" -#: ../../library/stdtypes.rst:5294 +#: ../../library/stdtypes.rst:5343 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5296 +#: ../../library/stdtypes.rst:5345 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -5700,15 +5731,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5350 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5356 msgid "The NotImplemented Object" msgstr "" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5358 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -5716,15 +5747,15 @@ msgid "" "``type(NotImplemented)()`` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5363 msgid "It is written as ``NotImplemented``." msgstr "" -#: ../../library/stdtypes.rst:5320 +#: ../../library/stdtypes.rst:5369 msgid "Boolean Values" msgstr "" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5371 msgid "" "Boolean values are the two constant objects ``False`` and ``True``. They " "are used to represent truth values (although other values can also be " @@ -5735,81 +5766,81 @@ msgid "" "(see section :ref:`truth` above)." msgstr "" -#: ../../library/stdtypes.rst:5335 +#: ../../library/stdtypes.rst:5384 msgid "They are written as ``False`` and ``True``, respectively." msgstr "" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5390 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5343 +#: ../../library/stdtypes.rst:5392 msgid "" "See :ref:`types` for this information. It describes stack frame objects, " "traceback objects, and slice objects." msgstr "" -#: ../../library/stdtypes.rst:5350 +#: ../../library/stdtypes.rst:5399 msgid "Special Attributes" msgstr "" -#: ../../library/stdtypes.rst:5352 +#: ../../library/stdtypes.rst:5401 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5359 +#: ../../library/stdtypes.rst:5408 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes." msgstr "" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5414 msgid "The class to which a class instance belongs." msgstr "" -#: ../../library/stdtypes.rst:5370 +#: ../../library/stdtypes.rst:5419 msgid "The tuple of base classes of a class object." msgstr "" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5424 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5381 +#: ../../library/stdtypes.rst:5430 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5438 msgid "" "This attribute is a tuple of classes that are considered when looking for " "base classes during method resolution." msgstr "" -#: ../../library/stdtypes.rst:5395 +#: ../../library/stdtypes.rst:5444 msgid "" "This method can be overridden by a metaclass to customize the method " "resolution order for its instances. It is called at class instantiation, " "and its result is stored in :attr:`~class.__mro__`." msgstr "" -#: ../../library/stdtypes.rst:5402 +#: ../../library/stdtypes.rst:5451 msgid "" "Each class keeps a list of weak references to its immediate subclasses. " "This method returns a list of all those references still alive. The list is " "in definition order. Example::" msgstr "" -#: ../../library/stdtypes.rst:5413 +#: ../../library/stdtypes.rst:5462 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5464 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -5817,7 +5848,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5420 +#: ../../library/stdtypes.rst:5469 msgid "" "The :class:`int` type in CPython is an abitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -5827,25 +5858,25 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5427 +#: ../../library/stdtypes.rst:5476 msgid "" "Limiting conversion size offers a practical way to avoid `CVE-2020-10735 " "`_." msgstr "" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5479 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5483 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5456 +#: ../../library/stdtypes.rst:5505 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -5853,94 +5884,94 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5461 +#: ../../library/stdtypes.rst:5510 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5476 +#: ../../library/stdtypes.rst:5525 msgid "Affected APIs" msgstr "" -#: ../../library/stdtypes.rst:5478 +#: ../../library/stdtypes.rst:5527 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5481 +#: ../../library/stdtypes.rst:5530 msgid "``int(string)`` with default base 10." msgstr "" -#: ../../library/stdtypes.rst:5482 +#: ../../library/stdtypes.rst:5531 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5532 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5533 msgid "``repr(integer)``" msgstr "``repr(integer)``" -#: ../../library/stdtypes.rst:5485 +#: ../../library/stdtypes.rst:5534 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, ``" "\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5537 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5490 +#: ../../library/stdtypes.rst:5539 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5491 +#: ../../library/stdtypes.rst:5540 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr "" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5541 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr "" -#: ../../library/stdtypes.rst:5493 +#: ../../library/stdtypes.rst:5542 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5494 +#: ../../library/stdtypes.rst:5543 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5495 +#: ../../library/stdtypes.rst:5544 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5547 msgid "Configuring the limit" msgstr "" -#: ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5549 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5503 +#: ../../library/stdtypes.rst:5552 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5506 +#: ../../library/stdtypes.rst:5555 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" msgstr "" -#: ../../library/stdtypes.rst:5508 +#: ../../library/stdtypes.rst:5557 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -5949,38 +5980,38 @@ msgid "" "int_info.default_max_str_digits` was used during initilization." msgstr "" -#: ../../library/stdtypes.rst:5514 +#: ../../library/stdtypes.rst:5563 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5517 +#: ../../library/stdtypes.rst:5566 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5521 +#: ../../library/stdtypes.rst:5570 msgid "" "Information about the default and minimum can be found in :attr:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5523 +#: ../../library/stdtypes.rst:5572 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5525 +#: ../../library/stdtypes.rst:5574 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5581 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -5992,7 +6023,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5590 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -6000,11 +6031,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5596 msgid "Recommended configuration" msgstr "" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5598 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -6012,45 +6043,45 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.11." msgstr "" -#: ../../library/stdtypes.rst:5554 +#: ../../library/stdtypes.rst:5603 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5615 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5570 +#: ../../library/stdtypes.rst:5619 msgid "Footnotes" msgstr "註解" -#: ../../library/stdtypes.rst:5571 +#: ../../library/stdtypes.rst:5620 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5623 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5577 +#: ../../library/stdtypes.rst:5626 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5579 +#: ../../library/stdtypes.rst:5628 msgid "" "Cased characters are those with general category property being one of \"Lu" "\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5631 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." diff --git a/library/string.po b/library/string.po index 27115441c8..06b167553c 100644 --- a/library/string.po +++ b/library/string.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-06 00:16+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -402,8 +402,8 @@ msgid "Option" msgstr "" #: ../../library/string.rst:340 ../../library/string.rst:371 -#: ../../library/string.rst:445 ../../library/string.rst:456 -#: ../../library/string.rst:491 +#: ../../library/string.rst:454 ../../library/string.rst:465 +#: ../../library/string.rst:500 msgid "Meaning" msgstr "" @@ -492,6 +492,17 @@ msgstr "" #: ../../library/string.rst:386 msgid "" +"The ``'z'`` option coerces negative zero floating-point values to positive " +"zero after rounding to the format precision. This option is only valid for " +"floating-point presentation types." +msgstr "" + +#: ../../library/string.rst:390 +msgid "Added the ``'z'`` option (see also :pep:`682`)." +msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" + +#: ../../library/string.rst:395 +msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " "This option is only valid for integer, float and complex types. For " @@ -504,17 +515,17 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: ../../library/string.rst:400 +#: ../../library/string.rst:409 msgid "" "The ``','`` option signals the use of a comma for a thousands separator. For " "a locale aware separator, use the ``'n'`` integer presentation type instead." msgstr "" -#: ../../library/string.rst:404 +#: ../../library/string.rst:413 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" -#: ../../library/string.rst:409 +#: ../../library/string.rst:418 msgid "" "The ``'_'`` option signals the use of an underscore for a thousands " "separator for floating point presentation types and for integer presentation " @@ -523,18 +534,18 @@ msgid "" "presentation types, specifying this option is an error." msgstr "" -#: ../../library/string.rst:416 +#: ../../library/string.rst:425 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" -#: ../../library/string.rst:419 +#: ../../library/string.rst:428 msgid "" "*width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " "specified, then the field width will be determined by the content." msgstr "" -#: ../../library/string.rst:423 +#: ../../library/string.rst:432 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types. This " @@ -542,13 +553,13 @@ msgid "" "``'='``." msgstr "" -#: ../../library/string.rst:428 +#: ../../library/string.rst:437 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "" -#: ../../library/string.rst:432 +#: ../../library/string.rst:441 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -559,110 +570,110 @@ msgid "" "types." msgstr "" -#: ../../library/string.rst:440 +#: ../../library/string.rst:449 msgid "Finally, the *type* determines how the data should be presented." msgstr "" -#: ../../library/string.rst:442 +#: ../../library/string.rst:451 msgid "The available string presentation types are:" msgstr "" -#: ../../library/string.rst:445 ../../library/string.rst:456 -#: ../../library/string.rst:491 +#: ../../library/string.rst:454 ../../library/string.rst:465 +#: ../../library/string.rst:500 msgid "Type" msgstr "" -#: ../../library/string.rst:447 +#: ../../library/string.rst:456 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:447 +#: ../../library/string.rst:456 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:450 ../../library/string.rst:479 -#: ../../library/string.rst:566 +#: ../../library/string.rst:459 ../../library/string.rst:488 +#: ../../library/string.rst:575 msgid "None" msgstr "None" -#: ../../library/string.rst:450 +#: ../../library/string.rst:459 msgid "The same as ``'s'``." msgstr "" -#: ../../library/string.rst:453 +#: ../../library/string.rst:462 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:458 +#: ../../library/string.rst:467 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:458 +#: ../../library/string.rst:467 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:460 +#: ../../library/string.rst:469 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:460 +#: ../../library/string.rst:469 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:463 +#: ../../library/string.rst:472 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:463 +#: ../../library/string.rst:472 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:465 +#: ../../library/string.rst:474 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:465 +#: ../../library/string.rst:474 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:467 +#: ../../library/string.rst:476 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:467 +#: ../../library/string.rst:476 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "" -#: ../../library/string.rst:470 +#: ../../library/string.rst:479 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:470 +#: ../../library/string.rst:479 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " "upper-cased to ``'0X'`` as well." msgstr "" -#: ../../library/string.rst:475 ../../library/string.rst:559 +#: ../../library/string.rst:484 ../../library/string.rst:568 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:475 +#: ../../library/string.rst:484 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:488 msgid "The same as ``'d'``." msgstr "" -#: ../../library/string.rst:482 +#: ../../library/string.rst:491 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating point presentation types listed below (except ``'n'`` and " @@ -670,17 +681,17 @@ msgid "" "floating point number before formatting." msgstr "" -#: ../../library/string.rst:487 +#: ../../library/string.rst:496 msgid "" "The available presentation types for :class:`float` and :class:`~decimal." "Decimal` values are:" msgstr "" -#: ../../library/string.rst:493 +#: ../../library/string.rst:502 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:493 +#: ../../library/string.rst:502 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -692,21 +703,21 @@ msgid "" "removed unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:505 +#: ../../library/string.rst:514 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:505 +#: ../../library/string.rst:514 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:508 +#: ../../library/string.rst:517 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:508 +#: ../../library/string.rst:517 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -717,21 +728,21 @@ msgid "" "used." msgstr "" -#: ../../library/string.rst:518 +#: ../../library/string.rst:527 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:518 +#: ../../library/string.rst:527 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:521 +#: ../../library/string.rst:530 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:521 +#: ../../library/string.rst:530 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -739,7 +750,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:528 +#: ../../library/string.rst:537 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -752,7 +763,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:541 +#: ../../library/string.rst:550 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -762,40 +773,40 @@ msgid "" "notation is used otherwise." msgstr "" -#: ../../library/string.rst:550 +#: ../../library/string.rst:559 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:555 +#: ../../library/string.rst:564 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:555 +#: ../../library/string.rst:564 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:559 +#: ../../library/string.rst:568 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:563 +#: ../../library/string.rst:572 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:563 +#: ../../library/string.rst:572 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:566 +#: ../../library/string.rst:575 msgid "" "For :class:`float` this is the same as ``'g'``, except that when fixed-point " "notation is used to format the result, it always includes at least one digit " @@ -803,96 +814,96 @@ msgid "" "represent the given value faithfully." msgstr "" -#: ../../library/string.rst:572 +#: ../../library/string.rst:581 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:576 +#: ../../library/string.rst:585 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:584 +#: ../../library/string.rst:593 msgid "Format examples" msgstr "" -#: ../../library/string.rst:586 +#: ../../library/string.rst:595 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "" -#: ../../library/string.rst:589 +#: ../../library/string.rst:598 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " "example, ``'%03.2f'`` can be translated to ``'{:03.2f}'``." msgstr "" -#: ../../library/string.rst:593 +#: ../../library/string.rst:602 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "" -#: ../../library/string.rst:596 +#: ../../library/string.rst:605 msgid "Accessing arguments by position::" msgstr "" -#: ../../library/string.rst:609 +#: ../../library/string.rst:618 msgid "Accessing arguments by name::" msgstr "" -#: ../../library/string.rst:617 +#: ../../library/string.rst:626 msgid "Accessing arguments' attributes::" msgstr "" -#: ../../library/string.rst:632 +#: ../../library/string.rst:641 msgid "Accessing arguments' items::" msgstr "" -#: ../../library/string.rst:638 +#: ../../library/string.rst:647 msgid "Replacing ``%s`` and ``%r``::" msgstr "" -#: ../../library/string.rst:643 +#: ../../library/string.rst:652 msgid "Aligning the text and specifying a width::" msgstr "" -#: ../../library/string.rst:654 +#: ../../library/string.rst:663 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "" -#: ../../library/string.rst:663 +#: ../../library/string.rst:672 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "" -#: ../../library/string.rst:672 +#: ../../library/string.rst:681 msgid "Using the comma as a thousands separator::" msgstr "" -#: ../../library/string.rst:677 +#: ../../library/string.rst:686 msgid "Expressing a percentage::" msgstr "" -#: ../../library/string.rst:684 +#: ../../library/string.rst:693 msgid "Using type-specific formatting::" msgstr "" -#: ../../library/string.rst:691 +#: ../../library/string.rst:700 msgid "Nesting arguments and more complex examples::" msgstr "" -#: ../../library/string.rst:725 +#: ../../library/string.rst:734 msgid "Template strings" msgstr "" -#: ../../library/string.rst:727 +#: ../../library/string.rst:736 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -902,17 +913,17 @@ msgid "" "the `flufl.i18n `_ package." msgstr "" -#: ../../library/string.rst:737 +#: ../../library/string.rst:746 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:739 +#: ../../library/string.rst:748 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:741 +#: ../../library/string.rst:750 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of ``" "\"identifier\"``. By default, ``\"identifier\"`` is restricted to any case-" @@ -921,30 +932,30 @@ msgid "" "after the ``$`` character terminates this placeholder specification." msgstr "" -#: ../../library/string.rst:748 +#: ../../library/string.rst:757 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:761 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:755 +#: ../../library/string.rst:764 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:761 +#: ../../library/string.rst:770 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:766 +#: ../../library/string.rst:775 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -953,7 +964,7 @@ msgid "" "there are duplicates, the placeholders from *kwds* take precedence." msgstr "" -#: ../../library/string.rst:775 +#: ../../library/string.rst:784 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -962,7 +973,7 @@ msgid "" "simply return ``$`` instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/string.rst:781 +#: ../../library/string.rst:790 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -972,21 +983,33 @@ msgid "" "Python identifiers." msgstr "" -#: ../../library/string.rst:788 +#: ../../library/string.rst:800 +msgid "" +"Returns false if the template has invalid placeholders that will cause :meth:" +"`substitute` to raise :exc:`ValueError`." +msgstr "" + +#: ../../library/string.rst:808 +msgid "" +"Returns a list of the valid identifiers in the template, in the order they " +"first appear, ignoring any invalid identifiers." +msgstr "" + +#: ../../library/string.rst:813 msgid ":class:`Template` instances also provide one public data attribute:" msgstr "" -#: ../../library/string.rst:792 +#: ../../library/string.rst:817 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." msgstr "" -#: ../../library/string.rst:795 +#: ../../library/string.rst:820 msgid "Here is an example of how to use a Template::" msgstr "" -#: ../../library/string.rst:813 +#: ../../library/string.rst:838 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -994,7 +1017,7 @@ msgid "" "these class attributes:" msgstr "" -#: ../../library/string.rst:818 +#: ../../library/string.rst:843 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1004,7 +1027,7 @@ msgid "" "the subclass's class namespace)." msgstr "" -#: ../../library/string.rst:825 +#: ../../library/string.rst:850 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1012,19 +1035,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:832 +#: ../../library/string.rst:857 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:836 +#: ../../library/string.rst:861 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:840 +#: ../../library/string.rst:865 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1033,7 +1056,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:848 +#: ../../library/string.rst:873 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1042,7 +1065,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:856 +#: ../../library/string.rst:881 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1051,35 +1074,41 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:862 +#: ../../library/string.rst:887 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "" -#: ../../library/string.rst:865 +#: ../../library/string.rst:890 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." msgstr "" -#: ../../library/string.rst:868 +#: ../../library/string.rst:893 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." msgstr "" -#: ../../library/string.rst:871 +#: ../../library/string.rst:896 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." msgstr "" -#: ../../library/string.rst:876 +#: ../../library/string.rst:899 +msgid "" +"The methods on this class will raise :exc:`ValueError` if the pattern " +"matches the template without one of these named groups matching." +msgstr "" + +#: ../../library/string.rst:904 msgid "Helper functions" msgstr "" -#: ../../library/string.rst:880 +#: ../../library/string.rst:908 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" diff --git a/library/subprocess.po b/library/subprocess.po index f6fbe2ad7a..7be8fa22ed 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-01 00:26+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,24 +43,35 @@ msgstr "" msgid ":pep:`324` -- PEP proposing the subprocess module" msgstr "" -#: ../../library/subprocess.rst:30 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/subprocess.rst:31 msgid "Using the :mod:`subprocess` Module" msgstr "" -#: ../../library/subprocess.rst:32 +#: ../../library/subprocess.rst:33 msgid "" "The recommended approach to invoking subprocesses is to use the :func:`run` " "function for all use cases it can handle. For more advanced use cases, the " "underlying :class:`Popen` interface can be used directly." msgstr "" -#: ../../library/subprocess.rst:42 +#: ../../library/subprocess.rst:43 msgid "" "Run the command described by *args*. Wait for command to complete, then " "return a :class:`CompletedProcess` instance." msgstr "" -#: ../../library/subprocess.rst:45 +#: ../../library/subprocess.rst:46 msgid "" "The arguments shown above are merely the most common ones, described below " "in :ref:`frequently-used-arguments` (hence the use of keyword-only notation " @@ -70,7 +81,7 @@ msgid "" "*check*, and *capture_output* are not.)" msgstr "" -#: ../../library/subprocess.rst:52 +#: ../../library/subprocess.rst:53 msgid "" "If *capture_output* is true, stdout and stderr will be captured. When used, " "the internal :class:`Popen` object is automatically created with " @@ -80,7 +91,7 @@ msgid "" "``stderr=STDOUT`` instead of *capture_output*." msgstr "" -#: ../../library/subprocess.rst:59 +#: ../../library/subprocess.rst:60 msgid "" "The *timeout* argument is passed to :meth:`Popen.communicate`. If the " "timeout expires, the child process will be killed and waited for. The :exc:" @@ -88,7 +99,7 @@ msgid "" "terminated." msgstr "" -#: ../../library/subprocess.rst:64 +#: ../../library/subprocess.rst:65 msgid "" "The *input* argument is passed to :meth:`Popen.communicate` and thus to the " "subprocess's stdin. If used it must be a byte sequence, or a string if " @@ -97,7 +108,7 @@ msgid "" "and the *stdin* argument may not be used as well." msgstr "" -#: ../../library/subprocess.rst:70 +#: ../../library/subprocess.rst:71 msgid "" "If *check* is true, and the process exits with a non-zero exit code, a :exc:" "`CalledProcessError` exception will be raised. Attributes of that exception " @@ -105,7 +116,7 @@ msgid "" "captured." msgstr "" -#: ../../library/subprocess.rst:75 +#: ../../library/subprocess.rst:76 msgid "" "If *encoding* or *errors* are specified, or *text* is true, file objects for " "stdin, stdout and stderr are opened in text mode using the specified " @@ -114,7 +125,7 @@ msgid "" "backwards compatibility. By default, file objects are opened in binary mode." msgstr "" -#: ../../library/subprocess.rst:81 +#: ../../library/subprocess.rst:82 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " @@ -122,109 +133,109 @@ msgid "" "directly to :class:`Popen`." msgstr "" -#: ../../library/subprocess.rst:86 +#: ../../library/subprocess.rst:87 msgid "Examples::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/subprocess.rst:104 +#: ../../library/subprocess.rst:105 msgid "Added *encoding* and *errors* parameters" msgstr "新增 *encoding* 與 *errors* 參數。" -#: ../../library/subprocess.rst:108 +#: ../../library/subprocess.rst:109 msgid "" "Added the *text* parameter, as a more understandable alias of " "*universal_newlines*. Added the *capture_output* parameter." msgstr "" -#: ../../library/subprocess.rst:113 +#: ../../library/subprocess.rst:114 msgid "" "The return value from :func:`run`, representing a process that has finished." msgstr "" -#: ../../library/subprocess.rst:117 +#: ../../library/subprocess.rst:118 msgid "" "The arguments used to launch the process. This may be a list or a string." msgstr "" -#: ../../library/subprocess.rst:121 +#: ../../library/subprocess.rst:122 msgid "" "Exit status of the child process. Typically, an exit status of 0 indicates " "that it ran successfully." msgstr "" -#: ../../library/subprocess.rst:124 ../../library/subprocess.rst:899 +#: ../../library/subprocess.rst:125 ../../library/subprocess.rst:907 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." msgstr "" -#: ../../library/subprocess.rst:129 +#: ../../library/subprocess.rst:130 msgid "" "Captured stdout from the child process. A bytes sequence, or a string if :" "func:`run` was called with an encoding, errors, or text=True. ``None`` if " "stdout was not captured." msgstr "" -#: ../../library/subprocess.rst:133 +#: ../../library/subprocess.rst:134 msgid "" "If you ran the process with ``stderr=subprocess.STDOUT``, stdout and stderr " "will be combined in this attribute, and :attr:`stderr` will be ``None``." msgstr "" -#: ../../library/subprocess.rst:139 +#: ../../library/subprocess.rst:140 msgid "" "Captured stderr from the child process. A bytes sequence, or a string if :" "func:`run` was called with an encoding, errors, or text=True. ``None`` if " "stderr was not captured." msgstr "" -#: ../../library/subprocess.rst:145 +#: ../../library/subprocess.rst:146 msgid "If :attr:`returncode` is non-zero, raise a :exc:`CalledProcessError`." msgstr "" -#: ../../library/subprocess.rst:151 +#: ../../library/subprocess.rst:152 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to :class:`Popen` and indicates that the special file :data:`os.devnull` " "will be used." msgstr "" -#: ../../library/subprocess.rst:160 +#: ../../library/subprocess.rst:161 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to :class:`Popen` and indicates that a pipe to the standard stream should be " "opened. Most useful with :meth:`Popen.communicate`." msgstr "" -#: ../../library/subprocess.rst:167 +#: ../../library/subprocess.rst:168 msgid "" "Special value that can be used as the *stderr* argument to :class:`Popen` " "and indicates that standard error should go into the same handle as standard " "output." msgstr "" -#: ../../library/subprocess.rst:174 +#: ../../library/subprocess.rst:175 msgid "Base class for all other exceptions from this module." msgstr "" -#: ../../library/subprocess.rst:181 +#: ../../library/subprocess.rst:182 msgid "" "Subclass of :exc:`SubprocessError`, raised when a timeout expires while " "waiting for a child process." msgstr "" -#: ../../library/subprocess.rst:186 ../../library/subprocess.rst:230 +#: ../../library/subprocess.rst:187 ../../library/subprocess.rst:231 msgid "Command that was used to spawn the child process." msgstr "" -#: ../../library/subprocess.rst:190 +#: ../../library/subprocess.rst:191 msgid "Timeout in seconds." msgstr "" -#: ../../library/subprocess.rst:194 +#: ../../library/subprocess.rst:195 msgid "" "Output of the child process if it was captured by :func:`run` or :func:" "`check_output`. Otherwise, ``None``. This is always :class:`bytes` when " @@ -232,11 +243,11 @@ msgid "" "remain ``None`` instead of ``b''`` when no output was observed." msgstr "" -#: ../../library/subprocess.rst:202 ../../library/subprocess.rst:239 +#: ../../library/subprocess.rst:203 ../../library/subprocess.rst:240 msgid "Alias for output, for symmetry with :attr:`stderr`." msgstr "" -#: ../../library/subprocess.rst:206 +#: ../../library/subprocess.rst:207 msgid "" "Stderr output of the child process if it was captured by :func:`run`. " "Otherwise, ``None``. This is always :class:`bytes` when stderr output was " @@ -244,40 +255,40 @@ msgid "" "instead of ``b''`` when no stderr output was observed." msgstr "" -#: ../../library/subprocess.rst:213 ../../library/subprocess.rst:246 +#: ../../library/subprocess.rst:214 ../../library/subprocess.rst:247 msgid "*stdout* and *stderr* attributes added" msgstr "" -#: ../../library/subprocess.rst:218 +#: ../../library/subprocess.rst:219 msgid "" "Subclass of :exc:`SubprocessError`, raised when a process run by :func:" "`check_call`, :func:`check_output`, or :func:`run` (with ``check=True``) " "returns a non-zero exit status." msgstr "" -#: ../../library/subprocess.rst:225 +#: ../../library/subprocess.rst:226 msgid "" "Exit status of the child process. If the process exited due to a signal, " "this will be the negative signal number." msgstr "" -#: ../../library/subprocess.rst:234 +#: ../../library/subprocess.rst:235 msgid "" "Output of the child process if it was captured by :func:`run` or :func:" "`check_output`. Otherwise, ``None``." msgstr "" -#: ../../library/subprocess.rst:243 +#: ../../library/subprocess.rst:244 msgid "" "Stderr output of the child process if it was captured by :func:`run`. " "Otherwise, ``None``." msgstr "" -#: ../../library/subprocess.rst:253 +#: ../../library/subprocess.rst:254 msgid "Frequently Used Arguments" msgstr "" -#: ../../library/subprocess.rst:255 +#: ../../library/subprocess.rst:256 msgid "" "To support a wide variety of use cases, the :class:`Popen` constructor (and " "the convenience functions) accept a large number of optional arguments. For " @@ -285,7 +296,7 @@ msgid "" "default values. The arguments that are most commonly needed are:" msgstr "" -#: ../../library/subprocess.rst:260 +#: ../../library/subprocess.rst:261 msgid "" "*args* is required for all calls and should be a string, or a sequence of " "program arguments. Providing a sequence of arguments is generally preferred, " @@ -295,7 +306,7 @@ msgid "" "simply name the program to be executed without specifying any arguments." msgstr "" -#: ../../library/subprocess.rst:268 +#: ../../library/subprocess.rst:269 msgid "" "*stdin*, *stdout* and *stderr* specify the executed program's standard " "input, standard output and standard error file handles, respectively. Valid " @@ -310,7 +321,7 @@ msgid "" "handle as for *stdout*." msgstr "" -#: ../../library/subprocess.rst:283 +#: ../../library/subprocess.rst:284 msgid "" "If *encoding* or *errors* are specified, or *text* (also known as " "*universal_newlines*) is true, the file objects *stdin*, *stdout* and " @@ -318,7 +329,7 @@ msgid "" "specified in the call or the defaults for :class:`io.TextIOWrapper`." msgstr "" -#: ../../library/subprocess.rst:289 +#: ../../library/subprocess.rst:290 msgid "" "For *stdin*, line ending characters ``'\\n'`` in the input will be converted " "to the default line separator :data:`os.linesep`. For *stdout* and *stderr*, " @@ -327,28 +338,28 @@ msgid "" "when the *newline* argument to its constructor is ``None``." msgstr "" -#: ../../library/subprocess.rst:295 +#: ../../library/subprocess.rst:296 msgid "" "If text mode is not used, *stdin*, *stdout* and *stderr* will be opened as " "binary streams. No encoding or line ending conversion is performed." msgstr "" -#: ../../library/subprocess.rst:298 +#: ../../library/subprocess.rst:299 msgid "Added *encoding* and *errors* parameters." msgstr "新增 *encoding* 與 *errors* 參數。" -#: ../../library/subprocess.rst:301 +#: ../../library/subprocess.rst:302 msgid "Added the *text* parameter as an alias for *universal_newlines*." msgstr "" -#: ../../library/subprocess.rst:306 +#: ../../library/subprocess.rst:307 msgid "" "The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." "stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." "communicate` method." msgstr "" -#: ../../library/subprocess.rst:310 +#: ../../library/subprocess.rst:311 msgid "" "If *shell* is ``True``, the specified command will be executed through the " "shell. This can be useful if you are using Python primarily for the " @@ -361,7 +372,7 @@ msgid "" "expanduser`, and :mod:`shutil`)." msgstr "" -#: ../../library/subprocess.rst:320 +#: ../../library/subprocess.rst:321 msgid "" "When *universal_newlines* is ``True``, the class uses the encoding :func:" "`locale.getpreferredencoding(False) ` instead " @@ -369,22 +380,22 @@ msgid "" "class for more information on this change." msgstr "" -#: ../../library/subprocess.rst:328 ../../library/subprocess.rst:448 +#: ../../library/subprocess.rst:329 ../../library/subprocess.rst:450 msgid "" "Read the `Security Considerations`_ section before using ``shell=True``." msgstr "" -#: ../../library/subprocess.rst:330 +#: ../../library/subprocess.rst:331 msgid "" "These options, along with all of the other options, are described in more " "detail in the :class:`Popen` constructor documentation." msgstr "" -#: ../../library/subprocess.rst:335 +#: ../../library/subprocess.rst:336 msgid "Popen Constructor" msgstr "" -#: ../../library/subprocess.rst:337 +#: ../../library/subprocess.rst:338 msgid "" "The underlying process creation and management in this module is handled by " "the :class:`Popen` class. It offers a lot of flexibility so that developers " @@ -392,7 +403,7 @@ msgid "" "functions." msgstr "" -#: ../../library/subprocess.rst:351 +#: ../../library/subprocess.rst:353 msgid "" "Execute a child program in a new process. On POSIX, the class uses :meth:" "`os.execvpe`-like behavior to execute the child program. On Windows, the " @@ -400,7 +411,7 @@ msgid "" "class:`Popen` are as follows." msgstr "" -#: ../../library/subprocess.rst:356 +#: ../../library/subprocess.rst:358 msgid "" "*args* should be a sequence of program arguments or else a single string or :" "term:`path-like object`. By default, the program to execute is the first " @@ -411,7 +422,7 @@ msgid "" "sequence." msgstr "" -#: ../../library/subprocess.rst:366 +#: ../../library/subprocess.rst:368 msgid "" "For maximum reliability, use a fully qualified path for the executable. To " "search for an unqualified name on :envvar:`PATH`, use :meth:`shutil.which`. " @@ -420,7 +431,7 @@ msgid "" "format to launch an installed module." msgstr "" -#: ../../library/subprocess.rst:372 +#: ../../library/subprocess.rst:374 msgid "" "Resolving the path of *executable* (or the first item of *args*) is platform " "dependent. For POSIX, see :meth:`os.execvpe`, and note that when resolving " @@ -434,27 +445,27 @@ msgid "" "variations." msgstr "" -#: ../../library/subprocess.rst:383 +#: ../../library/subprocess.rst:385 msgid "" "An example of passing some arguments to an external program as a sequence " "is::" msgstr "" -#: ../../library/subprocess.rst:388 +#: ../../library/subprocess.rst:390 msgid "" "On POSIX, if *args* is a string, the string is interpreted as the name or " "path of the program to execute. However, this can only be done if not " "passing arguments to the program." msgstr "" -#: ../../library/subprocess.rst:394 +#: ../../library/subprocess.rst:396 msgid "" "It may not be obvious how to break a shell command into a sequence of " "arguments, especially in complex cases. :meth:`shlex.split` can illustrate " "how to determine the correct tokenization for *args*::" msgstr "" -#: ../../library/subprocess.rst:406 +#: ../../library/subprocess.rst:408 msgid "" "Note in particular that options (such as *-input*) and arguments (such as " "*eggs.txt*) that are separated by whitespace in the shell go in separate " @@ -463,33 +474,33 @@ msgid "" "shown above) are single list elements." msgstr "" -#: ../../library/subprocess.rst:412 +#: ../../library/subprocess.rst:414 msgid "" "On Windows, if *args* is a sequence, it will be converted to a string in a " "manner described in :ref:`converting-argument-sequence`. This is because " "the underlying ``CreateProcess()`` operates on strings." msgstr "" -#: ../../library/subprocess.rst:416 +#: ../../library/subprocess.rst:418 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing path-like objects on POSIX." msgstr "" -#: ../../library/subprocess.rst:420 +#: ../../library/subprocess.rst:422 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing bytes and path-like objects on Windows." msgstr "" -#: ../../library/subprocess.rst:425 +#: ../../library/subprocess.rst:427 msgid "" "The *shell* argument (which defaults to ``False``) specifies whether to use " "the shell as the program to execute. If *shell* is ``True``, it is " "recommended to pass *args* as a string rather than as a sequence." msgstr "" -#: ../../library/subprocess.rst:429 +#: ../../library/subprocess.rst:431 msgid "" "On POSIX with ``shell=True``, the shell defaults to :file:`/bin/sh`. If " "*args* is a string, the string specifies the command to execute through the " @@ -501,7 +512,7 @@ msgid "" "class:`Popen` does the equivalent of::" msgstr "" -#: ../../library/subprocess.rst:440 +#: ../../library/subprocess.rst:442 msgid "" "On Windows with ``shell=True``, the :envvar:`COMSPEC` environment variable " "specifies the default shell. The only time you need to specify " @@ -510,35 +521,35 @@ msgid "" "``shell=True`` to run a batch file or console-based executable." msgstr "" -#: ../../library/subprocess.rst:450 +#: ../../library/subprocess.rst:452 msgid "" "*bufsize* will be supplied as the corresponding argument to the :func:`open` " "function when creating the stdin/stdout/stderr pipe file objects:" msgstr "" -#: ../../library/subprocess.rst:454 +#: ../../library/subprocess.rst:456 msgid "" ":const:`0` means unbuffered (read and write are one system call and can " "return short)" msgstr "" -#: ../../library/subprocess.rst:456 +#: ../../library/subprocess.rst:458 msgid "" ":const:`1` means line buffered (only usable if ``universal_newlines=True`` i." "e., in a text mode)" msgstr "" -#: ../../library/subprocess.rst:458 +#: ../../library/subprocess.rst:460 msgid "any other positive value means use a buffer of approximately that size" msgstr "" -#: ../../library/subprocess.rst:460 +#: ../../library/subprocess.rst:462 msgid "" "negative bufsize (the default) means the system default of io." "DEFAULT_BUFFER_SIZE will be used." msgstr "" -#: ../../library/subprocess.rst:463 +#: ../../library/subprocess.rst:465 msgid "" "*bufsize* now defaults to -1 to enable buffering by default to match the " "behavior that most code expects. In versions prior to Python 3.2.4 and " @@ -547,7 +558,7 @@ msgid "" "of Python 2 as most code expected." msgstr "" -#: ../../library/subprocess.rst:470 +#: ../../library/subprocess.rst:472 msgid "" "The *executable* argument specifies a replacement program to execute. It " "is very seldom needed. When ``shell=False``, *executable* replaces the " @@ -560,17 +571,17 @@ msgid "" "default :file:`/bin/sh`." msgstr "" -#: ../../library/subprocess.rst:480 +#: ../../library/subprocess.rst:482 msgid "*executable* parameter accepts a :term:`path-like object` on POSIX." msgstr "" -#: ../../library/subprocess.rst:483 +#: ../../library/subprocess.rst:485 msgid "" "*executable* parameter accepts a bytes and :term:`path-like object` on " "Windows." msgstr "" -#: ../../library/subprocess.rst:487 +#: ../../library/subprocess.rst:489 msgid "" "*stdin*, *stdout* and *stderr* specify the executed program's standard " "input, standard output and standard error file handles, respectively. Valid " @@ -585,26 +596,24 @@ msgid "" "handle as for stdout." msgstr "" -#: ../../library/subprocess.rst:499 +#: ../../library/subprocess.rst:501 msgid "" "If *preexec_fn* is set to a callable object, this object will be called in " "the child process just before the child is executed. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:505 +#: ../../library/subprocess.rst:507 msgid "" -"The *preexec_fn* parameter is not safe to use in the presence of threads in " -"your application. The child process could deadlock before exec is called. " -"If you must use it, keep it trivial! Minimize the number of libraries you " -"call into." +"The *preexec_fn* parameter is NOT SAFE to use in the presence of threads in " +"your application. The child process could deadlock before exec is called." msgstr "" #: ../../library/subprocess.rst:513 msgid "" "If you need to modify the environment for the child use the *env* parameter " -"rather than doing it in a *preexec_fn*. The *start_new_session* parameter " -"can take the place of a previously common use of *preexec_fn* to call os." -"setsid() in the child." +"rather than doing it in a *preexec_fn*. The *start_new_session* and " +"*process_group* parameters should take the place of code using *preexec_fn* " +"to call :func:`os.setsid` or :func:`os.setpgid` in the child." msgstr "" #: ../../library/subprocess.rst:520 @@ -688,15 +697,32 @@ msgstr "新增 *restore_signals*\\ 。" #: ../../library/subprocess.rst:573 msgid "" -"If *start_new_session* is true the setsid() system call will be made in the " -"child process prior to the execution of the subprocess. (POSIX only)" +"If *start_new_session* is true the ``setsid()`` system call will be made in " +"the child process prior to the execution of the subprocess." msgstr "" -#: ../../library/subprocess.rst:576 +#: ../../library/subprocess.rst:576 ../../library/subprocess.rst:583 +#: ../../library/subprocess.rst:593 ../../library/subprocess.rst:602 +#: ../../library/subprocess.rst:611 ../../library/subprocess.rst:617 +msgid ":ref:`Availability `: POSIX" +msgstr ":ref:`適用 `:POSIX" + +#: ../../library/subprocess.rst:577 msgid "*start_new_session* was added." msgstr "新增 *start_new_session*\\ 。" -#: ../../library/subprocess.rst:579 +#: ../../library/subprocess.rst:580 +msgid "" +"If *process_group* is a non-negative integer, the ``setpgid(0, value)`` " +"system call will be made in the child process prior to the execution of the " +"subprocess." +msgstr "" + +#: ../../library/subprocess.rst:584 +msgid "*process_group* was added." +msgstr "新增 *process_group*\\ 。" + +#: ../../library/subprocess.rst:587 msgid "" "If *group* is not ``None``, the setregid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " @@ -705,12 +731,7 @@ msgid "" "passed verbatim. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:585 ../../library/subprocess.rst:594 -#: ../../library/subprocess.rst:603 ../../library/subprocess.rst:609 -msgid ":ref:`Availability `: POSIX" -msgstr ":ref:`適用 `:POSIX" - -#: ../../library/subprocess.rst:588 +#: ../../library/subprocess.rst:596 msgid "" "If *extra_groups* is not ``None``, the setgroups() system call will be made " "in the child process prior to the execution of the subprocess. Strings " @@ -719,7 +740,7 @@ msgid "" "verbatim. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:597 +#: ../../library/subprocess.rst:605 msgid "" "If *user* is not ``None``, the setreuid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " @@ -728,100 +749,100 @@ msgid "" "passed verbatim. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:606 +#: ../../library/subprocess.rst:614 msgid "" "If *umask* is not negative, the umask() system call will be made in the " "child process prior to the execution of the subprocess." msgstr "" -#: ../../library/subprocess.rst:612 +#: ../../library/subprocess.rst:620 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment." msgstr "" -#: ../../library/subprocess.rst:618 +#: ../../library/subprocess.rst:626 msgid "" "If specified, *env* must provide any variables required for the program to " "execute. On Windows, in order to run a `side-by-side assembly`_ the " "specified *env* **must** include a valid :envvar:`SystemRoot`." msgstr "" -#: ../../library/subprocess.rst:624 +#: ../../library/subprocess.rst:632 msgid "" "If *encoding* or *errors* are specified, or *text* is true, the file objects " "*stdin*, *stdout* and *stderr* are opened in text mode with the specified " -"encoding and *errors*, as described above in :ref:`frequently-used-" +"*encoding* and *errors*, as described above in :ref:`frequently-used-" "arguments`. The *universal_newlines* argument is equivalent to *text* and " "is provided for backwards compatibility. By default, file objects are opened " "in binary mode." msgstr "" -#: ../../library/subprocess.rst:630 +#: ../../library/subprocess.rst:638 msgid "*encoding* and *errors* were added." msgstr "新增 *encoding* 與 *errors*\\ 。" -#: ../../library/subprocess.rst:633 ../../library/subprocess.rst:1234 +#: ../../library/subprocess.rst:641 ../../library/subprocess.rst:1242 msgid "*text* was added as a more readable alias for *universal_newlines*." msgstr "" -#: ../../library/subprocess.rst:636 +#: ../../library/subprocess.rst:644 msgid "" "If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is " "passed to the underlying ``CreateProcess`` function. *creationflags*, if " "given, can be one or more of the following flags:" msgstr "" -#: ../../library/subprocess.rst:640 +#: ../../library/subprocess.rst:648 msgid ":data:`CREATE_NEW_CONSOLE`" msgstr ":data:`CREATE_NEW_CONSOLE`" -#: ../../library/subprocess.rst:641 +#: ../../library/subprocess.rst:649 msgid ":data:`CREATE_NEW_PROCESS_GROUP`" msgstr ":data:`CREATE_NEW_PROCESS_GROUP`" -#: ../../library/subprocess.rst:642 +#: ../../library/subprocess.rst:650 msgid ":data:`ABOVE_NORMAL_PRIORITY_CLASS`" msgstr ":data:`ABOVE_NORMAL_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:643 +#: ../../library/subprocess.rst:651 msgid ":data:`BELOW_NORMAL_PRIORITY_CLASS`" msgstr ":data:`BELOW_NORMAL_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:644 +#: ../../library/subprocess.rst:652 msgid ":data:`HIGH_PRIORITY_CLASS`" msgstr ":data:`HIGH_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:645 +#: ../../library/subprocess.rst:653 msgid ":data:`IDLE_PRIORITY_CLASS`" msgstr ":data:`IDLE_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:646 +#: ../../library/subprocess.rst:654 msgid ":data:`NORMAL_PRIORITY_CLASS`" msgstr ":data:`NORMAL_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:647 +#: ../../library/subprocess.rst:655 msgid ":data:`REALTIME_PRIORITY_CLASS`" msgstr ":data:`REALTIME_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:648 +#: ../../library/subprocess.rst:656 msgid ":data:`CREATE_NO_WINDOW`" msgstr ":data:`CREATE_NO_WINDOW`" -#: ../../library/subprocess.rst:649 +#: ../../library/subprocess.rst:657 msgid ":data:`DETACHED_PROCESS`" msgstr ":data:`DETACHED_PROCESS`" -#: ../../library/subprocess.rst:650 +#: ../../library/subprocess.rst:658 msgid ":data:`CREATE_DEFAULT_ERROR_MODE`" msgstr ":data:`CREATE_DEFAULT_ERROR_MODE`" -#: ../../library/subprocess.rst:651 +#: ../../library/subprocess.rst:659 msgid ":data:`CREATE_BREAKAWAY_FROM_JOB`" msgstr ":data:`CREATE_BREAKAWAY_FROM_JOB`" -#: ../../library/subprocess.rst:653 +#: ../../library/subprocess.rst:661 msgid "" "*pipesize* can be used to change the size of the pipe when :data:`PIPE` is " "used for *stdin*, *stdout* or *stderr*. The size of the pipe is only changed " @@ -829,24 +850,24 @@ msgid "" "platforms will ignore this parameter." msgstr "" -#: ../../library/subprocess.rst:658 +#: ../../library/subprocess.rst:666 msgid "The ``pipesize`` parameter was added." msgstr "新增 ``pipesize`` 參數。" -#: ../../library/subprocess.rst:661 +#: ../../library/subprocess.rst:669 msgid "" "Popen objects are supported as context managers via the :keyword:`with` " "statement: on exit, standard file descriptors are closed, and the process is " "waited for. ::" msgstr "" -#: ../../library/subprocess.rst:668 +#: ../../library/subprocess.rst:687 msgid "" "Raises an :ref:`auditing event ` ``subprocess.Popen`` with " "arguments ``executable``, ``args``, ``cwd``, ``env``." msgstr "" -#: ../../library/subprocess.rst:670 +#: ../../library/subprocess.rst:678 msgid "" "Popen and the other functions in this module that use it raise an :ref:" "`auditing event ` ``subprocess.Popen`` with arguments " @@ -854,17 +875,17 @@ msgid "" "be a single string or a list of strings, depending on platform." msgstr "" -#: ../../library/subprocess.rst:675 +#: ../../library/subprocess.rst:683 msgid "Added context manager support." msgstr "" -#: ../../library/subprocess.rst:678 +#: ../../library/subprocess.rst:686 msgid "" "Popen destructor now emits a :exc:`ResourceWarning` warning if the child " "process is still running." msgstr "" -#: ../../library/subprocess.rst:682 +#: ../../library/subprocess.rst:690 msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " @@ -873,17 +894,17 @@ msgid "" "returncode`." msgstr "" -#: ../../library/subprocess.rst:691 +#: ../../library/subprocess.rst:699 msgid "Exceptions" msgstr "例外" -#: ../../library/subprocess.rst:693 +#: ../../library/subprocess.rst:701 msgid "" "Exceptions raised in the child process, before the new program has started " "to execute, will be re-raised in the parent." msgstr "" -#: ../../library/subprocess.rst:696 +#: ../../library/subprocess.rst:704 msgid "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " @@ -894,39 +915,39 @@ msgid "" "subprocess." msgstr "" -#: ../../library/subprocess.rst:703 +#: ../../library/subprocess.rst:711 msgid "" "A :exc:`ValueError` will be raised if :class:`Popen` is called with invalid " "arguments." msgstr "" -#: ../../library/subprocess.rst:706 +#: ../../library/subprocess.rst:714 msgid "" ":func:`check_call` and :func:`check_output` will raise :exc:" "`CalledProcessError` if the called process returns a non-zero return code." msgstr "" -#: ../../library/subprocess.rst:710 +#: ../../library/subprocess.rst:718 msgid "" "All of the functions and methods that accept a *timeout* parameter, such as :" "func:`call` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` " "if the timeout expires before the process exits." msgstr "" -#: ../../library/subprocess.rst:714 +#: ../../library/subprocess.rst:722 msgid "" "Exceptions defined in this module all inherit from :exc:`SubprocessError`." msgstr "" -#: ../../library/subprocess.rst:716 +#: ../../library/subprocess.rst:724 msgid "The :exc:`SubprocessError` base class was added." msgstr "" -#: ../../library/subprocess.rst:722 +#: ../../library/subprocess.rst:730 msgid "Security Considerations" msgstr "" -#: ../../library/subprocess.rst:724 +#: ../../library/subprocess.rst:732 msgid "" "Unlike some other popen functions, this implementation will never implicitly " "call a system shell. This means that all characters, including shell " @@ -939,34 +960,34 @@ msgid "" "escaping." msgstr "" -#: ../../library/subprocess.rst:736 +#: ../../library/subprocess.rst:744 msgid "Popen Objects" msgstr "" -#: ../../library/subprocess.rst:738 +#: ../../library/subprocess.rst:746 msgid "Instances of the :class:`Popen` class have the following methods:" msgstr "" -#: ../../library/subprocess.rst:743 +#: ../../library/subprocess.rst:751 msgid "" "Check if child process has terminated. Set and return :attr:`~Popen." "returncode` attribute. Otherwise, returns ``None``." msgstr "" -#: ../../library/subprocess.rst:749 +#: ../../library/subprocess.rst:757 msgid "" "Wait for child process to terminate. Set and return :attr:`~Popen." "returncode` attribute." msgstr "" -#: ../../library/subprocess.rst:752 +#: ../../library/subprocess.rst:760 msgid "" "If the process does not terminate after *timeout* seconds, raise a :exc:" "`TimeoutExpired` exception. It is safe to catch this exception and retry " "the wait." msgstr "" -#: ../../library/subprocess.rst:758 +#: ../../library/subprocess.rst:766 msgid "" "This will deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and the " "child process generates enough output to a pipe such that it blocks waiting " @@ -974,20 +995,20 @@ msgid "" "when using pipes to avoid that." msgstr "" -#: ../../library/subprocess.rst:765 +#: ../../library/subprocess.rst:773 msgid "" "The function is implemented using a busy loop (non-blocking call and short " "sleeps). Use the :mod:`asyncio` module for an asynchronous wait: see :class:" "`asyncio.create_subprocess_exec`." msgstr "" -#: ../../library/subprocess.rst:769 ../../library/subprocess.rst:810 -#: ../../library/subprocess.rst:1147 ../../library/subprocess.rst:1179 -#: ../../library/subprocess.rst:1225 +#: ../../library/subprocess.rst:777 ../../library/subprocess.rst:818 +#: ../../library/subprocess.rst:1155 ../../library/subprocess.rst:1187 +#: ../../library/subprocess.rst:1233 msgid "*timeout* was added." msgstr "新增 *timeout*\\ 。" -#: ../../library/subprocess.rst:774 +#: ../../library/subprocess.rst:782 msgid "" "Interact with process: Send data to stdin. Read data from stdout and " "stderr, until end-of-file is reached. Wait for process to terminate and set " @@ -997,13 +1018,13 @@ msgid "" "must be a string. Otherwise, it must be bytes." msgstr "" -#: ../../library/subprocess.rst:781 +#: ../../library/subprocess.rst:789 msgid "" ":meth:`communicate` returns a tuple ``(stdout_data, stderr_data)``. The data " "will be strings if streams were opened in text mode; otherwise, bytes." msgstr "" -#: ../../library/subprocess.rst:785 +#: ../../library/subprocess.rst:793 msgid "" "Note that if you want to send data to the process's stdin, you need to " "create the Popen object with ``stdin=PIPE``. Similarly, to get anything " @@ -1011,65 +1032,65 @@ msgid "" "and/or ``stderr=PIPE`` too." msgstr "" -#: ../../library/subprocess.rst:790 +#: ../../library/subprocess.rst:798 msgid "" "If the process does not terminate after *timeout* seconds, a :exc:" "`TimeoutExpired` exception will be raised. Catching this exception and " "retrying communication will not lose any output." msgstr "" -#: ../../library/subprocess.rst:794 +#: ../../library/subprocess.rst:802 msgid "" "The child process is not killed if the timeout expires, so in order to " "cleanup properly a well-behaved application should kill the child process " "and finish communication::" msgstr "" -#: ../../library/subprocess.rst:807 +#: ../../library/subprocess.rst:815 msgid "" "The data read is buffered in memory, so do not use this method if the data " "size is large or unlimited." msgstr "" -#: ../../library/subprocess.rst:816 +#: ../../library/subprocess.rst:824 msgid "Sends the signal *signal* to the child." msgstr "" -#: ../../library/subprocess.rst:818 +#: ../../library/subprocess.rst:826 msgid "Do nothing if the process completed." msgstr "" -#: ../../library/subprocess.rst:822 +#: ../../library/subprocess.rst:830 msgid "" "On Windows, SIGTERM is an alias for :meth:`terminate`. CTRL_C_EVENT and " "CTRL_BREAK_EVENT can be sent to processes started with a *creationflags* " "parameter which includes `CREATE_NEW_PROCESS_GROUP`." msgstr "" -#: ../../library/subprocess.rst:829 +#: ../../library/subprocess.rst:837 msgid "" "Stop the child. On POSIX OSs the method sends SIGTERM to the child. On " "Windows the Win32 API function :c:func:`TerminateProcess` is called to stop " "the child." msgstr "" -#: ../../library/subprocess.rst:836 +#: ../../library/subprocess.rst:844 msgid "" "Kills the child. On POSIX OSs the function sends SIGKILL to the child. On " "Windows :meth:`kill` is an alias for :meth:`terminate`." msgstr "" -#: ../../library/subprocess.rst:840 +#: ../../library/subprocess.rst:848 msgid "The following attributes are also available:" msgstr "" -#: ../../library/subprocess.rst:844 +#: ../../library/subprocess.rst:852 msgid "" "The *args* argument as it was passed to :class:`Popen` -- a sequence of " "program arguments or else a single string." msgstr "" -#: ../../library/subprocess.rst:851 +#: ../../library/subprocess.rst:859 msgid "" "If the *stdin* argument was :data:`PIPE`, this attribute is a writeable " "stream object as returned by :func:`open`. If the *encoding* or *errors* " @@ -1078,7 +1099,7 @@ msgid "" "argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: ../../library/subprocess.rst:860 +#: ../../library/subprocess.rst:868 msgid "" "If the *stdout* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1088,7 +1109,7 @@ msgid "" "not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: ../../library/subprocess.rst:870 +#: ../../library/subprocess.rst:878 msgid "" "If the *stderr* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1098,7 +1119,7 @@ msgid "" "was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: ../../library/subprocess.rst:879 +#: ../../library/subprocess.rst:887 msgid "" "Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read `__ structure is used for :class:`Popen` " @@ -1141,38 +1162,38 @@ msgid "" "only arguments." msgstr "" -#: ../../library/subprocess.rst:917 +#: ../../library/subprocess.rst:925 msgid "Keyword-only argument support was added." msgstr "" -#: ../../library/subprocess.rst:922 +#: ../../library/subprocess.rst:930 msgid "" "A bit field that determines whether certain :class:`STARTUPINFO` attributes " "are used when the process creates a window. ::" msgstr "" -#: ../../library/subprocess.rst:930 +#: ../../library/subprocess.rst:938 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` " "is not specified, the default for standard input is the keyboard buffer." msgstr "" -#: ../../library/subprocess.rst:937 +#: ../../library/subprocess.rst:945 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard output handle for the process. Otherwise, this attribute is " "ignored and the default for standard output is the console window's buffer." msgstr "" -#: ../../library/subprocess.rst:944 +#: ../../library/subprocess.rst:952 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard error handle for the process. Otherwise, this attribute is " "ignored and the default for standard error is the console window's buffer." msgstr "" -#: ../../library/subprocess.rst:950 +#: ../../library/subprocess.rst:958 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute " "can be any of the values that can be specified in the ``nCmdShow`` parameter " @@ -1181,34 +1202,34 @@ msgid "" "Otherwise, this attribute is ignored." msgstr "" -#: ../../library/subprocess.rst:957 +#: ../../library/subprocess.rst:965 msgid "" ":data:`SW_HIDE` is provided for this attribute. It is used when :class:" "`Popen` is called with ``shell=True``." msgstr "" -#: ../../library/subprocess.rst:962 +#: ../../library/subprocess.rst:970 msgid "" "A dictionary of additional attributes for process creation as given in " "``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" -#: ../../library/subprocess.rst:966 +#: ../../library/subprocess.rst:974 msgid "Supported attributes:" msgstr "" -#: ../../library/subprocess.rst:984 +#: ../../library/subprocess.rst:992 msgid "**handle_list**" msgstr "**handle_list**" -#: ../../library/subprocess.rst:969 +#: ../../library/subprocess.rst:977 msgid "" "Sequence of handles that will be inherited. *close_fds* must be true if non-" "empty." msgstr "" -#: ../../library/subprocess.rst:972 +#: ../../library/subprocess.rst:980 msgid "" "The handles must be temporarily made inheritable by :func:`os." "set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" @@ -1216,7 +1237,7 @@ msgid "" "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" -#: ../../library/subprocess.rst:979 +#: ../../library/subprocess.rst:987 msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " @@ -1225,97 +1246,97 @@ msgid "" "temporarily creates inheritable handles." msgstr "" -#: ../../library/subprocess.rst:989 +#: ../../library/subprocess.rst:997 msgid "Windows Constants" msgstr "" -#: ../../library/subprocess.rst:991 +#: ../../library/subprocess.rst:999 msgid "The :mod:`subprocess` module exposes the following constants." msgstr "" -#: ../../library/subprocess.rst:995 +#: ../../library/subprocess.rst:1003 msgid "" "The standard input device. Initially, this is the console input buffer, " "``CONIN$``." msgstr "" -#: ../../library/subprocess.rst:1000 +#: ../../library/subprocess.rst:1008 msgid "" "The standard output device. Initially, this is the active console screen " "buffer, ``CONOUT$``." msgstr "" -#: ../../library/subprocess.rst:1005 +#: ../../library/subprocess.rst:1013 msgid "" "The standard error device. Initially, this is the active console screen " "buffer, ``CONOUT$``." msgstr "" -#: ../../library/subprocess.rst:1010 +#: ../../library/subprocess.rst:1018 msgid "Hides the window. Another window will be activated." msgstr "" -#: ../../library/subprocess.rst:1014 +#: ../../library/subprocess.rst:1022 msgid "" "Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." "hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " "information." msgstr "" -#: ../../library/subprocess.rst:1020 +#: ../../library/subprocess.rst:1028 msgid "" "Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains " "additional information." msgstr "" -#: ../../library/subprocess.rst:1025 +#: ../../library/subprocess.rst:1033 msgid "" "The new process has a new console, instead of inheriting its parent's " "console (the default)." msgstr "" -#: ../../library/subprocess.rst:1030 +#: ../../library/subprocess.rst:1038 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "group will be created. This flag is necessary for using :func:`os.kill` on " "the subprocess." msgstr "" -#: ../../library/subprocess.rst:1034 +#: ../../library/subprocess.rst:1042 msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified." msgstr "" -#: ../../library/subprocess.rst:1038 +#: ../../library/subprocess.rst:1046 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an above average priority." msgstr "" -#: ../../library/subprocess.rst:1045 +#: ../../library/subprocess.rst:1053 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a below average priority." msgstr "" -#: ../../library/subprocess.rst:1052 +#: ../../library/subprocess.rst:1060 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a high priority." msgstr "" -#: ../../library/subprocess.rst:1059 +#: ../../library/subprocess.rst:1067 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an idle (lowest) priority." msgstr "" -#: ../../library/subprocess.rst:1066 +#: ../../library/subprocess.rst:1074 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an normal priority. (default)" msgstr "" -#: ../../library/subprocess.rst:1073 +#: ../../library/subprocess.rst:1081 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have realtime priority. You should almost never use " @@ -1325,20 +1346,20 @@ msgid "" "perform brief tasks that should have limited interruptions." msgstr "" -#: ../../library/subprocess.rst:1084 +#: ../../library/subprocess.rst:1092 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not create a window." msgstr "" -#: ../../library/subprocess.rst:1091 +#: ../../library/subprocess.rst:1099 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not inherit its parent's console. This value cannot be used with " "CREATE_NEW_CONSOLE." msgstr "" -#: ../../library/subprocess.rst:1099 +#: ../../library/subprocess.rst:1107 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "does not inherit the error mode of the calling process. Instead, the new " @@ -1346,39 +1367,39 @@ msgid "" "multithreaded shell applications that run with hard errors disabled." msgstr "" -#: ../../library/subprocess.rst:1109 +#: ../../library/subprocess.rst:1117 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "is not associated with the job." msgstr "" -#: ../../library/subprocess.rst:1117 +#: ../../library/subprocess.rst:1125 msgid "Older high-level API" msgstr "" -#: ../../library/subprocess.rst:1119 +#: ../../library/subprocess.rst:1127 msgid "" "Prior to Python 3.5, these three functions comprised the high level API to " "subprocess. You can now use :func:`run` in many cases, but lots of existing " "code calls these functions." msgstr "" -#: ../../library/subprocess.rst:1126 +#: ../../library/subprocess.rst:1134 msgid "" "Run the command described by *args*. Wait for command to complete, then " "return the :attr:`~Popen.returncode` attribute." msgstr "" -#: ../../library/subprocess.rst:1129 ../../library/subprocess.rst:1161 +#: ../../library/subprocess.rst:1137 ../../library/subprocess.rst:1169 msgid "" "Code needing to capture stdout or stderr should use :func:`run` instead::" msgstr "" -#: ../../library/subprocess.rst:1133 ../../library/subprocess.rst:1165 +#: ../../library/subprocess.rst:1141 ../../library/subprocess.rst:1173 msgid "To suppress stdout or stderr, supply a value of :data:`DEVNULL`." msgstr "" -#: ../../library/subprocess.rst:1135 ../../library/subprocess.rst:1167 +#: ../../library/subprocess.rst:1143 ../../library/subprocess.rst:1175 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is the same as that of the :class:`Popen` constructor - this " @@ -1386,14 +1407,14 @@ msgid "" "to that interface." msgstr "" -#: ../../library/subprocess.rst:1142 ../../library/subprocess.rst:1174 +#: ../../library/subprocess.rst:1150 ../../library/subprocess.rst:1182 msgid "" "Do not use ``stdout=PIPE`` or ``stderr=PIPE`` with this function. The child " "process will block if it generates enough output to a pipe to fill up the OS " "pipe buffer as the pipes are not being read from." msgstr "" -#: ../../library/subprocess.rst:1154 +#: ../../library/subprocess.rst:1162 msgid "" "Run command with arguments. Wait for command to complete. If the return " "code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" @@ -1402,11 +1423,11 @@ msgid "" "to start the process it will propagate the exception that was raised." msgstr "" -#: ../../library/subprocess.rst:1188 +#: ../../library/subprocess.rst:1196 msgid "Run command with arguments and return its output." msgstr "" -#: ../../library/subprocess.rst:1190 +#: ../../library/subprocess.rst:1198 msgid "" "If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" "exc:`CalledProcessError` object will have the return code in the :attr:" @@ -1414,11 +1435,11 @@ msgid "" "`~CalledProcessError.output` attribute." msgstr "" -#: ../../library/subprocess.rst:1195 +#: ../../library/subprocess.rst:1203 msgid "This is equivalent to::" msgstr "" -#: ../../library/subprocess.rst:1199 +#: ../../library/subprocess.rst:1207 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " @@ -1428,52 +1449,52 @@ msgid "" "using the parent's standard input file handle." msgstr "" -#: ../../library/subprocess.rst:1206 +#: ../../library/subprocess.rst:1214 msgid "" "By default, this function will return the data as encoded bytes. The actual " "encoding of the output data may depend on the command being invoked, so the " "decoding to text will often need to be handled at the application level." msgstr "" -#: ../../library/subprocess.rst:1210 +#: ../../library/subprocess.rst:1218 msgid "" "This behaviour may be overridden by setting *text*, *encoding*, *errors*, or " "*universal_newlines* to ``True`` as described in :ref:`frequently-used-" "arguments` and :func:`run`." msgstr "" -#: ../../library/subprocess.rst:1214 +#: ../../library/subprocess.rst:1222 msgid "" "To also capture standard error in the result, use ``stderr=subprocess." "STDOUT``::" msgstr "" -#: ../../library/subprocess.rst:1228 +#: ../../library/subprocess.rst:1236 msgid "Support for the *input* keyword argument was added." msgstr "新增 *input* 關鍵字引數的支援。" -#: ../../library/subprocess.rst:1231 +#: ../../library/subprocess.rst:1239 msgid "*encoding* and *errors* were added. See :func:`run` for details." msgstr "新增 *encoding* 與 *errors*\\ 。細節請見 :func:`run`\\ 。" -#: ../../library/subprocess.rst:1241 +#: ../../library/subprocess.rst:1249 msgid "Replacing Older Functions with the :mod:`subprocess` Module" msgstr "" -#: ../../library/subprocess.rst:1243 +#: ../../library/subprocess.rst:1251 msgid "" "In this section, \"a becomes b\" means that b can be used as a replacement " "for a." msgstr "" -#: ../../library/subprocess.rst:1247 +#: ../../library/subprocess.rst:1255 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " "executed program cannot be found; the \"b\" replacements raise :exc:" "`OSError` instead." msgstr "" -#: ../../library/subprocess.rst:1251 +#: ../../library/subprocess.rst:1259 msgid "" "In addition, the replacements using :func:`check_output` will fail with a :" "exc:`CalledProcessError` if the requested operation produces a non-zero " @@ -1481,143 +1502,143 @@ msgid "" "output` attribute of the raised exception." msgstr "" -#: ../../library/subprocess.rst:1256 +#: ../../library/subprocess.rst:1264 msgid "" "In the following examples, we assume that the relevant functions have " "already been imported from the :mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1261 +#: ../../library/subprocess.rst:1269 msgid "Replacing :program:`/bin/sh` shell command substitution" msgstr "" -#: ../../library/subprocess.rst:1267 ../../library/subprocess.rst:1278 -#: ../../library/subprocess.rst:1295 +#: ../../library/subprocess.rst:1275 ../../library/subprocess.rst:1286 +#: ../../library/subprocess.rst:1303 msgid "becomes::" msgstr "" "變成:\n" "\n" "::" -#: ../../library/subprocess.rst:1272 +#: ../../library/subprocess.rst:1280 msgid "Replacing shell pipeline" msgstr "" -#: ../../library/subprocess.rst:1285 +#: ../../library/subprocess.rst:1293 msgid "" "The ``p1.stdout.close()`` call after starting the p2 is important in order " "for p1 to receive a SIGPIPE if p2 exits before p1." msgstr "" -#: ../../library/subprocess.rst:1288 +#: ../../library/subprocess.rst:1296 msgid "" "Alternatively, for trusted input, the shell's own pipeline support may still " "be used directly:" msgstr "" -#: ../../library/subprocess.rst:1301 +#: ../../library/subprocess.rst:1309 msgid "Replacing :func:`os.system`" msgstr "" -#: ../../library/subprocess.rst:1309 +#: ../../library/subprocess.rst:1317 msgid "Notes:" msgstr "註解:" -#: ../../library/subprocess.rst:1311 +#: ../../library/subprocess.rst:1319 msgid "Calling the program through the shell is usually not required." msgstr "" -#: ../../library/subprocess.rst:1312 +#: ../../library/subprocess.rst:1320 msgid "" "The :func:`call` return value is encoded differently to that of :func:`os." "system`." msgstr "" -#: ../../library/subprocess.rst:1315 +#: ../../library/subprocess.rst:1323 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " "command is running, but the caller must do this separately when using the :" "mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1319 +#: ../../library/subprocess.rst:1327 msgid "A more realistic example would look like this::" msgstr "" -#: ../../library/subprocess.rst:1332 +#: ../../library/subprocess.rst:1340 msgid "Replacing the :func:`os.spawn ` family" msgstr "" -#: ../../library/subprocess.rst:1334 +#: ../../library/subprocess.rst:1342 msgid "P_NOWAIT example::" msgstr "" "P_NOWAIT 範例:\n" "\n" "::" -#: ../../library/subprocess.rst:1340 +#: ../../library/subprocess.rst:1348 msgid "P_WAIT example::" msgstr "" "P_WAIT 範例:\n" "\n" "::" -#: ../../library/subprocess.rst:1346 +#: ../../library/subprocess.rst:1354 msgid "Vector example::" msgstr "" -#: ../../library/subprocess.rst:1352 +#: ../../library/subprocess.rst:1360 msgid "Environment example::" msgstr "" -#: ../../library/subprocess.rst:1361 +#: ../../library/subprocess.rst:1369 msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`" msgstr "" -#: ../../library/subprocess.rst:1391 +#: ../../library/subprocess.rst:1399 msgid "Return code handling translates as follows::" msgstr "" -#: ../../library/subprocess.rst:1407 +#: ../../library/subprocess.rst:1415 msgid "Replacing functions from the :mod:`popen2` module" msgstr "" -#: ../../library/subprocess.rst:1411 +#: ../../library/subprocess.rst:1419 msgid "" "If the cmd argument to popen2 functions is a string, the command is executed " "through /bin/sh. If it is a list, the command is directly executed." msgstr "" -#: ../../library/subprocess.rst:1430 +#: ../../library/subprocess.rst:1438 msgid "" ":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:" "`subprocess.Popen`, except that:" msgstr "" -#: ../../library/subprocess.rst:1433 +#: ../../library/subprocess.rst:1441 msgid ":class:`Popen` raises an exception if the execution fails." msgstr "" -#: ../../library/subprocess.rst:1435 +#: ../../library/subprocess.rst:1443 msgid "The *capturestderr* argument is replaced with the *stderr* argument." msgstr "" -#: ../../library/subprocess.rst:1437 +#: ../../library/subprocess.rst:1445 msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified." msgstr "" -#: ../../library/subprocess.rst:1439 +#: ../../library/subprocess.rst:1447 msgid "" "popen2 closes all file descriptors by default, but you have to specify " "``close_fds=True`` with :class:`Popen` to guarantee this behavior on all " "platforms or past Python versions." msgstr "" -#: ../../library/subprocess.rst:1445 +#: ../../library/subprocess.rst:1453 msgid "Legacy Shell Invocation Functions" msgstr "" -#: ../../library/subprocess.rst:1447 +#: ../../library/subprocess.rst:1455 msgid "" "This module also provides the following legacy functions from the 2.x " "``commands`` module. These operations implicitly invoke the system shell and " @@ -1625,92 +1646,97 @@ msgid "" "handling consistency are valid for these functions." msgstr "" -#: ../../library/subprocess.rst:1454 +#: ../../library/subprocess.rst:1462 msgid "Return ``(exitcode, output)`` of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1456 +#: ../../library/subprocess.rst:1464 msgid "" "Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " -"return a 2-tuple ``(exitcode, output)``. The locale encoding is used; see " -"the notes on :ref:`frequently-used-arguments` for more details." +"return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " +"decode output; see the notes on :ref:`frequently-used-arguments` for more " +"details." msgstr "" -#: ../../library/subprocess.rst:1460 +#: ../../library/subprocess.rst:1469 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" -#: ../../library/subprocess.rst:1474 ../../library/subprocess.rst:1494 -msgid ":ref:`Availability `: POSIX & Windows." -msgstr ":ref:`適用 `:POSIX 和 Windows。" +#: ../../library/subprocess.rst:1483 ../../library/subprocess.rst:1505 +msgid ":ref:`Availability `: Unix, Windows." +msgstr ":ref:`適用 `:Unix 和 Windows。" -#: ../../library/subprocess.rst:1475 +#: ../../library/subprocess.rst:1484 msgid "Windows support was added." msgstr "" -#: ../../library/subprocess.rst:1478 +#: ../../library/subprocess.rst:1487 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " "it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" "`~Popen.returncode`." msgstr "" -#: ../../library/subprocess.rst:1485 +#: ../../library/subprocess.rst:1491 ../../library/subprocess.rst:1509 +msgid "Added *encoding* and *errors* arguments." +msgstr "新增 *encoding* 與 *errors* 引數。" + +#: ../../library/subprocess.rst:1496 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1487 +#: ../../library/subprocess.rst:1498 msgid "" "Like :func:`getstatusoutput`, except the exit code is ignored and the return " "value is a string containing the command's output. Example::" msgstr "" -#: ../../library/subprocess.rst:1495 +#: ../../library/subprocess.rst:1506 msgid "Windows support added" msgstr "" -#: ../../library/subprocess.rst:1500 +#: ../../library/subprocess.rst:1514 msgid "Notes" msgstr "註解" -#: ../../library/subprocess.rst:1505 +#: ../../library/subprocess.rst:1519 msgid "Converting an argument sequence to a string on Windows" msgstr "" -#: ../../library/subprocess.rst:1507 +#: ../../library/subprocess.rst:1521 msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: ../../library/subprocess.rst:1511 +#: ../../library/subprocess.rst:1525 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: ../../library/subprocess.rst:1514 +#: ../../library/subprocess.rst:1528 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: ../../library/subprocess.rst:1519 +#: ../../library/subprocess.rst:1533 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1522 +#: ../../library/subprocess.rst:1536 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1525 +#: ../../library/subprocess.rst:1539 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -1718,10 +1744,67 @@ msgid "" "mark as described in rule 3." msgstr "" -#: ../../library/subprocess.rst:1534 +#: ../../library/subprocess.rst:1548 msgid ":mod:`shlex`" msgstr ":mod:`shlex`" -#: ../../library/subprocess.rst:1535 +#: ../../library/subprocess.rst:1549 msgid "Module which provides function to parse and escape command lines." msgstr "" + +#: ../../library/subprocess.rst:1556 +msgid "Disabling use of ``vfork()`` or ``posix_spawn()``" +msgstr "" + +#: ../../library/subprocess.rst:1558 +msgid "" +"On Linux, :mod:`subprocess` defaults to using the ``vfork()`` system call " +"internally when it is safe to do so rather than ``fork()``. This greatly " +"improves performance." +msgstr "" + +#: ../../library/subprocess.rst:1562 +msgid "" +"If you ever encounter a presumed highly unusual situation where you need to " +"prevent ``vfork()`` from being used by Python, you can set the :attr:" +"`subprocess._USE_VFORK` attribute to a false value." +msgstr "" + +#: ../../library/subprocess.rst:1566 +msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." +msgstr "" + +#: ../../library/subprocess.rst:1568 +msgid "" +"Setting this has no impact on use of ``posix_spawn()`` which could use " +"``vfork()`` internally within its libc implementation. There is a similar :" +"attr:`subprocess._USE_POSIX_SPAWN` attribute if you need to prevent use of " +"that." +msgstr "" + +#: ../../library/subprocess.rst:1573 +msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." +msgstr "" + +#: ../../library/subprocess.rst:1575 +msgid "" +"It is safe to set these to false on any Python version. They will have no " +"effect on older versions when unsupported. Do not assume the attributes are " +"available to read. Despite their names, a true value does not indicate that " +"the corresponding function will be used, only that that it may be." +msgstr "" + +#: ../../library/subprocess.rst:1580 +msgid "" +"Please file issues any time you have to use these private knobs with a way " +"to reproduce the issue you were seeing. Link to that issue from a comment in " +"your code." +msgstr "" + +#: ../../library/subprocess.rst:1584 +msgid "``_USE_POSIX_SPAWN``" +msgstr "" + +#: ../../library/subprocess.rst:1585 +msgid "``_USE_VFORK``" +msgstr "" diff --git a/library/sunau.po b/library/sunau.po index bf24c5bc23..47a0a831ea 100644 --- a/library/sunau.po +++ b/library/sunau.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,7 +28,7 @@ msgstr ":mod:`sunau` --- 讀寫 Sun AU 檔案" msgid "**Source code:** :source:`Lib/sunau.py`" msgstr "**原始碼:**\\ :source:`Lib/sunau.py`" -#: ../../library/sunau.rst:12 +#: ../../library/sunau.rst:15 msgid "" "The :mod:`sunau` module is deprecated (see :pep:`PEP 594 <594#sunau>` for " "details)." diff --git a/library/symtable.po b/library/symtable.po index 2309c737b6..6f7ee89852 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-12 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -223,6 +223,6 @@ msgstr "" #: ../../library/symtable.rst:198 msgid "" -"Return the namespace bound to this name. If more than one namespace is " -"bound, :exc:`ValueError` is raised." +"Return the namespace bound to this name. If more than one or no namespace is " +"bound to this name, a :exc:`ValueError` is raised." msgstr "" diff --git a/library/sys.po b/library/sys.po index afb2c1549a..5bf4e394ac 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-03 00:15+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -334,8 +334,8 @@ msgstr "" msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: ../../library/sys.rst:269 ../../library/sys.rst:819 -#: ../../library/sys.rst:1518 ../../library/sys.rst:1748 +#: ../../library/sys.rst:269 ../../library/sys.rst:865 +#: ../../library/sys.rst:1571 ../../library/sys.rst:1803 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" @@ -375,6 +375,63 @@ msgstr "" #: ../../library/sys.rst:319 msgid "" +"A :term:`named tuple` holding information about the environment on the " +"*wasm32-emscripten* platform. The named tuple is provisional and may change " +"in the future." +msgstr "" + +#: ../../library/sys.rst:326 ../../library/sys.rst:1011 +#: ../../library/sys.rst:1686 +msgid "Attribute" +msgstr "屬性" + +#: ../../library/sys.rst:326 ../../library/sys.rst:1011 +#: ../../library/sys.rst:1686 +msgid "Explanation" +msgstr "解釋" + +#: ../../library/sys.rst:328 +msgid ":const:`emscripten_version`" +msgstr ":const:`emscripten_version`" + +#: ../../library/sys.rst:328 +msgid "" +"Emscripten version as tuple of ints (major, minor, micro), e.g. ``(3, 1, " +"8)``." +msgstr "" + +#: ../../library/sys.rst:331 +msgid ":const:`runtime`" +msgstr ":const:`runtime`" + +#: ../../library/sys.rst:331 +msgid "" +"Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " +"``'UNKNOWN'``." +msgstr "" + +#: ../../library/sys.rst:334 +msgid ":const:`pthreads`" +msgstr ":const:`pthreads`" + +#: ../../library/sys.rst:334 +msgid "``True`` if Python is compiled with Emscripten pthreads support." +msgstr "" + +#: ../../library/sys.rst:337 +msgid ":const:`shared_memory`" +msgstr ":const:`shared_memory`" + +#: ../../library/sys.rst:337 +msgid "``True`` if Python is compiled with shared memory support." +msgstr "" + +#: ../../library/sys.rst:342 +msgid ":ref:`Availability `: Emscripten." +msgstr ":ref:`適用 `:Emscripten。" + +#: ../../library/sys.rst:348 +msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " "files to (and read them from) a parallel directory tree rooted at this " "directory, rather than from ``__pycache__`` directories in the source code " @@ -384,12 +441,12 @@ msgid "" "the same pycache prefix (if any) that you will use at runtime." msgstr "" -#: ../../library/sys.rst:327 +#: ../../library/sys.rst:356 msgid "" "A relative path is interpreted relative to the current working directory." msgstr "" -#: ../../library/sys.rst:329 +#: ../../library/sys.rst:358 msgid "" "This value is initially set based on the value of the :option:`-X` " "``pycache_prefix=PATH`` command-line option or the :envvar:" @@ -397,12 +454,12 @@ msgid "" "If neither are set, it is ``None``." msgstr "" -#: ../../library/sys.rst:339 +#: ../../library/sys.rst:368 msgid "" "This function prints out a given traceback and exception to ``sys.stderr``." msgstr "" -#: ../../library/sys.rst:341 +#: ../../library/sys.rst:370 msgid "" "When an exception is raised and uncaught, the interpreter calls ``sys." "excepthook`` with three arguments, the exception class, exception instance, " @@ -413,13 +470,13 @@ msgid "" "excepthook``." msgstr "" -#: ../../library/sys.rst:348 +#: ../../library/sys.rst:377 msgid "" "Raises an :ref:`auditing event ` ``sys.excepthook`` with arguments " "``hook``, ``type``, ``value``, ``traceback``." msgstr "" -#: ../../library/sys.rst:350 +#: ../../library/sys.rst:379 msgid "" "Raise an auditing event ``sys.excepthook`` with arguments ``hook``, " "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " @@ -429,14 +486,14 @@ msgid "" "excepthook`` will be called." msgstr "" -#: ../../library/sys.rst:359 +#: ../../library/sys.rst:388 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " "the :func:`threading.excepthook` function handles exception raised by :func:" "`threading.Thread.run`." msgstr "" -#: ../../library/sys.rst:369 +#: ../../library/sys.rst:398 msgid "" "These objects contain the original values of ``breakpointhook``, " "``displayhook``, ``excepthook``, and ``unraisablehook`` at the start of the " @@ -445,38 +502,52 @@ msgid "" "get replaced with broken or alternative objects." msgstr "" -#: ../../library/sys.rst:375 +#: ../../library/sys.rst:404 msgid "__breakpointhook__" msgstr "__breakpointhook__" -#: ../../library/sys.rst:378 +#: ../../library/sys.rst:407 msgid "__unraisablehook__" msgstr "__unraisablehook__" -#: ../../library/sys.rst:383 +#: ../../library/sys.rst:413 +msgid "" +"This function, when called while an exception handler is executing (such as " +"an ``except`` or ``except*`` clause), returns the exception instance that " +"was caught by this handler. When exception handlers are nested within one " +"another, only the exception handled by the innermost handler is accessible." +msgstr "" + +#: ../../library/sys.rst:418 +msgid "If no exception handler is executing, this function returns ``None``." +msgstr "" + +#: ../../library/sys.rst:425 msgid "" -"This function returns a tuple of three values that give information about " -"the exception that is currently being handled. The information returned is " -"specific both to the current thread and to the current stack frame. If the " -"current stack frame is not handling an exception, the information is taken " -"from the calling stack frame, or its caller, and so on until a stack frame " -"is found that is handling an exception. Here, \"handling an exception\" is " -"defined as \"executing an except clause.\" For any stack frame, only " -"information about the exception being currently handled is accessible." +"This function returns the old-style representation of the handled exception. " +"If an exception ``e`` is currently handled (so :func:`exception` would " +"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, e." +"__traceback__)``. That is, a tuple containing the type of the exception (a " +"subclass of :exc:`BaseException`), the exception itself, and a :ref:" +"`traceback object ` which typically encapsulates the call " +"stack at the point where the exception last occurred." msgstr "" -#: ../../library/sys.rst:394 +#: ../../library/sys.rst:436 msgid "" -"If no exception is being handled anywhere on the stack, a tuple containing " -"three ``None`` values is returned. Otherwise, the values returned are " -"``(type, value, traceback)``. Their meaning is: *type* gets the type of the " -"exception being handled (a subclass of :exc:`BaseException`); *value* gets " -"the exception instance (an instance of the exception type); *traceback* gets " -"a :ref:`traceback object ` which encapsulates the call " -"stack at the point where the exception originally occurred." +"If no exception is being handled anywhere on the stack, this function return " +"a tuple containing three ``None`` values." msgstr "" -#: ../../library/sys.rst:405 +#: ../../library/sys.rst:439 +msgid "" +"The ``type`` and ``traceback`` fields are now derived from the ``value`` " +"(the exception instance), so when an exception is modified while it is being " +"handled, the changes are reflected in the results of subsequent calls to :" +"func:`exc_info`." +msgstr "" + +#: ../../library/sys.rst:447 msgid "" "A string giving the site-specific directory prefix where the platform-" "dependent Python files are installed; by default, this is also ``'/usr/" @@ -488,7 +559,7 @@ msgid "" "is the version number of Python, for example ``3.2``." msgstr "" -#: ../../library/sys.rst:416 +#: ../../library/sys.rst:458 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 " @@ -496,7 +567,7 @@ msgid "" "`base_exec_prefix`." msgstr "" -#: ../../library/sys.rst:424 +#: ../../library/sys.rst:466 msgid "" "A string giving the absolute path of the executable binary for the Python " "interpreter, on systems where this makes sense. If Python is unable to " @@ -504,13 +575,13 @@ msgid "" "empty string or ``None``." msgstr "" -#: ../../library/sys.rst:432 +#: ../../library/sys.rst:474 msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" -#: ../../library/sys.rst:434 +#: ../../library/sys.rst:476 msgid "" "The optional argument *arg* can be an integer giving the exit status " "(defaulting to zero), or another type of object. If it is an integer, zero " @@ -526,7 +597,7 @@ msgid "" "way to exit a program when an error occurs." msgstr "" -#: ../../library/sys.rst:447 +#: ../../library/sys.rst:489 msgid "" "Since :func:`exit` ultimately \"only\" raises an exception, it will only " "exit the process when called from the main thread, and the exception is not " @@ -535,182 +606,194 @@ msgid "" "an outer level." msgstr "" -#: ../../library/sys.rst:452 +#: ../../library/sys.rst:494 msgid "" "If an error occurs in the cleanup after the Python interpreter has caught :" "exc:`SystemExit` (such as an error flushing buffered data in the standard " "streams), the exit status is changed to 120." msgstr "" -#: ../../library/sys.rst:460 +#: ../../library/sys.rst:502 msgid "" "The :term:`named tuple` *flags* exposes the status of command line flags. " "The attributes are read only." msgstr "" -#: ../../library/sys.rst:464 ../../library/sys.rst:517 -#: ../../library/sys.rst:864 +#: ../../library/sys.rst:506 ../../library/sys.rst:563 +#: ../../library/sys.rst:910 msgid "attribute" msgstr "" -#: ../../library/sys.rst:464 +#: ../../library/sys.rst:506 msgid "flag" msgstr "" -#: ../../library/sys.rst:466 +#: ../../library/sys.rst:508 msgid ":const:`debug`" msgstr ":const:`debug`" -#: ../../library/sys.rst:466 +#: ../../library/sys.rst:508 msgid ":option:`-d`" msgstr ":option:`-d`" -#: ../../library/sys.rst:467 +#: ../../library/sys.rst:509 msgid ":const:`inspect`" msgstr ":const:`inspect`" -#: ../../library/sys.rst:467 ../../library/sys.rst:468 +#: ../../library/sys.rst:509 ../../library/sys.rst:510 msgid ":option:`-i`" msgstr ":option:`-i`" -#: ../../library/sys.rst:468 +#: ../../library/sys.rst:510 msgid ":const:`interactive`" msgstr ":const:`interactive`" -#: ../../library/sys.rst:469 +#: ../../library/sys.rst:511 msgid ":const:`isolated`" msgstr ":const:`isolated`" -#: ../../library/sys.rst:469 +#: ../../library/sys.rst:511 msgid ":option:`-I`" msgstr ":option:`-I`" -#: ../../library/sys.rst:470 +#: ../../library/sys.rst:512 msgid ":const:`optimize`" msgstr ":const:`optimize`" -#: ../../library/sys.rst:470 +#: ../../library/sys.rst:512 msgid ":option:`-O` or :option:`-OO`" msgstr ":option:`-O` 或 :option:`-OO`" -#: ../../library/sys.rst:471 +#: ../../library/sys.rst:513 msgid ":const:`dont_write_bytecode`" msgstr ":const:`dont_write_bytecode`" -#: ../../library/sys.rst:471 +#: ../../library/sys.rst:513 msgid ":option:`-B`" msgstr ":option:`-B`" -#: ../../library/sys.rst:472 +#: ../../library/sys.rst:514 msgid ":const:`no_user_site`" msgstr ":const:`no_user_site`" -#: ../../library/sys.rst:472 +#: ../../library/sys.rst:514 msgid ":option:`-s`" msgstr ":option:`-s`" -#: ../../library/sys.rst:473 +#: ../../library/sys.rst:515 msgid ":const:`no_site`" msgstr ":const:`no_site`" -#: ../../library/sys.rst:473 +#: ../../library/sys.rst:515 msgid ":option:`-S`" msgstr ":option:`-S`" -#: ../../library/sys.rst:474 +#: ../../library/sys.rst:516 msgid ":const:`ignore_environment`" msgstr ":const:`ignore_environment`" -#: ../../library/sys.rst:474 +#: ../../library/sys.rst:516 msgid ":option:`-E`" msgstr ":option:`-E`" -#: ../../library/sys.rst:475 +#: ../../library/sys.rst:517 msgid ":const:`verbose`" msgstr ":const:`verbose`" -#: ../../library/sys.rst:475 +#: ../../library/sys.rst:517 msgid ":option:`-v`" msgstr ":option:`-v`" -#: ../../library/sys.rst:476 +#: ../../library/sys.rst:518 msgid ":const:`bytes_warning`" msgstr ":const:`bytes_warning`" -#: ../../library/sys.rst:476 +#: ../../library/sys.rst:518 msgid ":option:`-b`" msgstr ":option:`-b`" -#: ../../library/sys.rst:477 +#: ../../library/sys.rst:519 msgid ":const:`quiet`" msgstr ":const:`quiet`" -#: ../../library/sys.rst:477 +#: ../../library/sys.rst:519 msgid ":option:`-q`" msgstr ":option:`-q`" -#: ../../library/sys.rst:478 +#: ../../library/sys.rst:520 msgid ":const:`hash_randomization`" msgstr ":const:`hash_randomization`" -#: ../../library/sys.rst:478 +#: ../../library/sys.rst:520 msgid ":option:`-R`" msgstr ":option:`-R`" -#: ../../library/sys.rst:479 +#: ../../library/sys.rst:521 msgid ":const:`dev_mode`" msgstr ":const:`dev_mode`" -#: ../../library/sys.rst:479 +#: ../../library/sys.rst:521 msgid ":option:`-X dev <-X>` (:ref:`Python Development Mode `)" msgstr "" -#: ../../library/sys.rst:480 +#: ../../library/sys.rst:522 msgid ":const:`utf8_mode`" msgstr ":const:`utf8_mode`" -#: ../../library/sys.rst:480 +#: ../../library/sys.rst:522 msgid ":option:`-X utf8 <-X>`" msgstr ":option:`-X utf8 <-X>`" -#: ../../library/sys.rst:481 +#: ../../library/sys.rst:523 +msgid ":const:`safe_path`" +msgstr ":const:`safe_path`" + +#: ../../library/sys.rst:523 +msgid ":option:`-P`" +msgstr ":option:`-P`" + +#: ../../library/sys.rst:524 msgid ":const:`int_max_str_digits`" msgstr ":const:`int_max_str_digits`" -#: ../../library/sys.rst:481 +#: ../../library/sys.rst:524 msgid "" ":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " "limitation `)" msgstr "" -#: ../../library/sys.rst:484 +#: ../../library/sys.rst:527 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." msgstr "" -#: ../../library/sys.rst:487 +#: ../../library/sys.rst:530 msgid "The ``hash_randomization`` attribute." msgstr "" -#: ../../library/sys.rst:490 +#: ../../library/sys.rst:533 msgid "Removed obsolete ``division_warning`` attribute." msgstr "" -#: ../../library/sys.rst:493 +#: ../../library/sys.rst:536 msgid "Added ``isolated`` attribute for :option:`-I` ``isolated`` flag." msgstr "" -#: ../../library/sys.rst:496 +#: ../../library/sys.rst:539 msgid "" "Added the ``dev_mode`` attribute for the new :ref:`Python Development Mode " "` and the ``utf8_mode`` attribute for the new :option:`-X` " "``utf8`` flag." msgstr "" -#: ../../library/sys.rst:501 +#: ../../library/sys.rst:544 +msgid "Added the ``safe_path`` attribute for :option:`-P` option." +msgstr "" + +#: ../../library/sys.rst:547 msgid "Added the ``int_max_str_digits`` attribute." msgstr "" -#: ../../library/sys.rst:507 +#: ../../library/sys.rst:553 msgid "" "A :term:`named tuple` holding information about the float type. It contains " "low level information about the precision and internal representation. The " @@ -720,163 +803,163 @@ msgid "" "floating types', for details." msgstr "" -#: ../../library/sys.rst:517 +#: ../../library/sys.rst:563 msgid "float.h macro" msgstr "" -#: ../../library/sys.rst:517 ../../library/sys.rst:864 +#: ../../library/sys.rst:563 ../../library/sys.rst:910 msgid "explanation" msgstr "" -#: ../../library/sys.rst:519 +#: ../../library/sys.rst:565 msgid ":const:`epsilon`" msgstr ":const:`epsilon`" -#: ../../library/sys.rst:519 +#: ../../library/sys.rst:565 msgid "DBL_EPSILON" msgstr "DBL_EPSILON" -#: ../../library/sys.rst:519 +#: ../../library/sys.rst:565 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float" msgstr "" -#: ../../library/sys.rst:522 +#: ../../library/sys.rst:568 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`\\ 。" -#: ../../library/sys.rst:524 +#: ../../library/sys.rst:570 msgid ":const:`dig`" msgstr ":const:`dig`" -#: ../../library/sys.rst:524 +#: ../../library/sys.rst:570 msgid "DBL_DIG" msgstr "DBL_DIG" -#: ../../library/sys.rst:524 +#: ../../library/sys.rst:570 msgid "" "maximum number of decimal digits that can be faithfully represented in a " "float; see below" msgstr "" -#: ../../library/sys.rst:527 +#: ../../library/sys.rst:573 msgid ":const:`mant_dig`" msgstr ":const:`mant_dig`" -#: ../../library/sys.rst:527 +#: ../../library/sys.rst:573 msgid "DBL_MANT_DIG" msgstr "DBL_MANT_DIG" -#: ../../library/sys.rst:527 +#: ../../library/sys.rst:573 msgid "" "float precision: the number of base-``radix`` digits in the significand of a " "float" msgstr "" -#: ../../library/sys.rst:530 +#: ../../library/sys.rst:576 msgid ":const:`max`" msgstr ":const:`max`" -#: ../../library/sys.rst:530 +#: ../../library/sys.rst:576 msgid "DBL_MAX" msgstr "DBL_MAX" -#: ../../library/sys.rst:530 +#: ../../library/sys.rst:576 msgid "maximum representable positive finite float" msgstr "" -#: ../../library/sys.rst:532 +#: ../../library/sys.rst:578 msgid ":const:`max_exp`" msgstr ":const:`max_exp`" -#: ../../library/sys.rst:532 +#: ../../library/sys.rst:578 msgid "DBL_MAX_EXP" msgstr "DBL_MAX_EXP" -#: ../../library/sys.rst:532 +#: ../../library/sys.rst:578 msgid "" "maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float" msgstr "" -#: ../../library/sys.rst:535 +#: ../../library/sys.rst:581 msgid ":const:`max_10_exp`" msgstr ":const:`max_10_exp`" -#: ../../library/sys.rst:535 +#: ../../library/sys.rst:581 msgid "DBL_MAX_10_EXP" msgstr "DBL_MAX_10_EXP" -#: ../../library/sys.rst:535 +#: ../../library/sys.rst:581 msgid "" "maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats" msgstr "" -#: ../../library/sys.rst:538 +#: ../../library/sys.rst:584 msgid ":const:`min`" msgstr ":const:`min`" -#: ../../library/sys.rst:538 +#: ../../library/sys.rst:584 msgid "DBL_MIN" msgstr "DBL_MIN" -#: ../../library/sys.rst:538 +#: ../../library/sys.rst:584 msgid "minimum representable positive *normalized* float" msgstr "" -#: ../../library/sys.rst:540 +#: ../../library/sys.rst:586 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" -#: ../../library/sys.rst:544 +#: ../../library/sys.rst:590 msgid ":const:`min_exp`" msgstr ":const:`min_exp`" -#: ../../library/sys.rst:544 +#: ../../library/sys.rst:590 msgid "DBL_MIN_EXP" msgstr "DBL_MIN_EXP" -#: ../../library/sys.rst:544 +#: ../../library/sys.rst:590 msgid "minimum integer *e* such that ``radix**(e-1)`` is a normalized float" msgstr "" -#: ../../library/sys.rst:547 +#: ../../library/sys.rst:593 msgid ":const:`min_10_exp`" msgstr ":const:`min_10_exp`" -#: ../../library/sys.rst:547 +#: ../../library/sys.rst:593 msgid "DBL_MIN_10_EXP" msgstr "DBL_MIN_10_EXP" -#: ../../library/sys.rst:547 +#: ../../library/sys.rst:593 msgid "minimum integer *e* such that ``10**e`` is a normalized float" msgstr "" -#: ../../library/sys.rst:550 +#: ../../library/sys.rst:596 msgid ":const:`radix`" msgstr ":const:`radix`" -#: ../../library/sys.rst:550 +#: ../../library/sys.rst:596 msgid "FLT_RADIX" msgstr "FLT_RADIX" -#: ../../library/sys.rst:550 +#: ../../library/sys.rst:596 msgid "radix of exponent representation" msgstr "" -#: ../../library/sys.rst:552 +#: ../../library/sys.rst:598 msgid ":const:`rounds`" msgstr ":const:`rounds`" -#: ../../library/sys.rst:552 +#: ../../library/sys.rst:598 msgid "FLT_ROUNDS" msgstr "FLT_ROUNDS" -#: ../../library/sys.rst:552 +#: ../../library/sys.rst:598 msgid "" "integer constant representing the rounding mode used for arithmetic " "operations. This reflects the value of the system FLT_ROUNDS macro at " @@ -884,7 +967,7 @@ msgid "" "explanation of the possible values and their meanings." msgstr "" -#: ../../library/sys.rst:560 +#: ../../library/sys.rst:606 msgid "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " "``s`` is any string representing a decimal number with at most :attr:`sys." @@ -892,13 +975,13 @@ msgid "" "back again will recover a string representing the same decimal value::" msgstr "" -#: ../../library/sys.rst:573 +#: ../../library/sys.rst:619 msgid "" "But for strings with more than :attr:`sys.float_info.dig` significant " "digits, this isn't always true::" msgstr "" -#: ../../library/sys.rst:582 +#: ../../library/sys.rst:628 msgid "" "A string indicating how the :func:`repr` function behaves for floats. If " "the string has value ``'short'`` then for a finite float ``x``, ``repr(x)`` " @@ -908,7 +991,7 @@ msgid "" "same way as it did in versions of Python prior to 3.1." msgstr "" -#: ../../library/sys.rst:595 +#: ../../library/sys.rst:641 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " @@ -918,38 +1001,38 @@ msgid "" "results." msgstr "" -#: ../../library/sys.rst:602 +#: ../../library/sys.rst:648 msgid "" "If a Python build or implementation cannot reasonably compute this " "information, :func:`getallocatedblocks()` is allowed to return 0 instead." msgstr "" -#: ../../library/sys.rst:610 +#: ../../library/sys.rst:656 msgid "Return the build time API version of Android as an integer." msgstr "" -#: ../../library/sys.rst:613 +#: ../../library/sys.rst:659 msgid ":ref:`Availability `: Android." msgstr ":ref:`適用 `:Android。" -#: ../../library/sys.rst:619 +#: ../../library/sys.rst:665 msgid "" "Return the name of the current default string encoding used by the Unicode " "implementation." msgstr "" -#: ../../library/sys.rst:625 +#: ../../library/sys.rst:671 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (``RTLD_xxx`` constants, e.g. :data:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:630 ../../library/sys.rst:1279 +#: ../../library/sys.rst:676 ../../library/sys.rst:1332 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/sys.rst:635 +#: ../../library/sys.rst:681 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` is enabled." msgstr "" -#: ../../library/sys.rst:668 +#: ../../library/sys.rst:714 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " @@ -1004,20 +1087,20 @@ msgid "" "func:`getfilesystemencoding`." msgstr "" -#: ../../library/sys.rst:686 +#: ../../library/sys.rst:732 msgid "" "Returns the current value for the :ref:`integer string conversion length " "limitation `. See also :func:`set_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:693 +#: ../../library/sys.rst:739 msgid "" "Return the reference count of the *object*. The count returned is generally " "one higher than you might expect, because it includes the (temporary) " "reference as an argument to :func:`getrefcount`." msgstr "" -#: ../../library/sys.rst:700 +#: ../../library/sys.rst:746 msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " @@ -1025,46 +1108,46 @@ msgid "" "func:`setrecursionlimit`." msgstr "" -#: ../../library/sys.rst:708 +#: ../../library/sys.rst:754 msgid "" "Return the size of an object in bytes. The object can be any type of object. " "All built-in objects will return correct results, but this does not have to " "hold true for third-party extensions as it is implementation specific." msgstr "" -#: ../../library/sys.rst:713 +#: ../../library/sys.rst:759 msgid "" "Only the memory consumption directly attributed to the object is accounted " "for, not the memory consumption of objects it refers to." msgstr "" -#: ../../library/sys.rst:716 +#: ../../library/sys.rst:762 msgid "" "If given, *default* will be returned if the object does not provide means to " "retrieve the size. Otherwise a :exc:`TypeError` will be raised." msgstr "" -#: ../../library/sys.rst:719 +#: ../../library/sys.rst:765 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -#: ../../library/sys.rst:723 +#: ../../library/sys.rst:769 msgid "" "See `recursive sizeof recipe `_ " "for an example of using :func:`getsizeof` recursively to find the size of " "containers and all their contents." msgstr "" -#: ../../library/sys.rst:729 +#: ../../library/sys.rst:775 msgid "" "Return the interpreter's \"thread switch interval\"; see :func:" "`setswitchinterval`." msgstr "" -#: ../../library/sys.rst:737 +#: ../../library/sys.rst:783 msgid "" "Return a frame object from the call stack. If optional integer *depth* is " "given, return the frame object that many calls below the top of the stack. " @@ -1073,27 +1156,27 @@ msgid "" "stack." msgstr "" -#: ../../library/sys.rst:742 +#: ../../library/sys.rst:788 msgid "" -"Raises an :ref:`auditing event ` ``sys._getframe`` with no " -"arguments." +"Raises an :ref:`auditing event ` ``sys._getframe`` with argument " +"``frame``." msgstr "" -#: ../../library/sys.rst:746 +#: ../../library/sys.rst:792 msgid "" "This function should be used for internal and specialized purposes only. It " "is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:756 +#: ../../library/sys.rst:802 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/sys.rst:765 +#: ../../library/sys.rst:811 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/sys.rst:769 +#: ../../library/sys.rst:815 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1101,7 +1184,7 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:777 +#: ../../library/sys.rst:823 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " @@ -1113,54 +1196,54 @@ msgid "" "first 5 elements are retrievable by indexing." msgstr "" -#: ../../library/sys.rst:788 +#: ../../library/sys.rst:834 msgid "*platform* will be :const:`2 (VER_PLATFORM_WIN32_NT)`." msgstr "" -#: ../../library/sys.rst:790 +#: ../../library/sys.rst:836 msgid "*product_type* may be one of the following values:" msgstr "" -#: ../../library/sys.rst:793 +#: ../../library/sys.rst:839 msgid "Constant" msgstr "" -#: ../../library/sys.rst:793 +#: ../../library/sys.rst:839 msgid "Meaning" msgstr "" -#: ../../library/sys.rst:795 +#: ../../library/sys.rst:841 msgid ":const:`1 (VER_NT_WORKSTATION)`" msgstr ":const:`1 (VER_NT_WORKSTATION)`" -#: ../../library/sys.rst:795 +#: ../../library/sys.rst:841 msgid "The system is a workstation." msgstr "" -#: ../../library/sys.rst:797 +#: ../../library/sys.rst:843 msgid ":const:`2 (VER_NT_DOMAIN_CONTROLLER)`" msgstr ":const:`2 (VER_NT_DOMAIN_CONTROLLER)`" -#: ../../library/sys.rst:797 +#: ../../library/sys.rst:843 msgid "The system is a domain controller." msgstr "" -#: ../../library/sys.rst:800 +#: ../../library/sys.rst:846 msgid ":const:`3 (VER_NT_SERVER)`" msgstr ":const:`3 (VER_NT_SERVER)`" -#: ../../library/sys.rst:800 +#: ../../library/sys.rst:846 msgid "The system is a server, but not a domain controller." msgstr "" -#: ../../library/sys.rst:804 +#: ../../library/sys.rst:850 msgid "" "This function wraps the Win32 :c:func:`GetVersionEx` function; see the " "Microsoft documentation on :c:func:`OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: ../../library/sys.rst:808 +#: ../../library/sys.rst:854 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1168,24 +1251,24 @@ msgid "" "feature detection." msgstr "" -#: ../../library/sys.rst:814 +#: ../../library/sys.rst:860 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: ../../library/sys.rst:820 +#: ../../library/sys.rst:866 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: ../../library/sys.rst:824 +#: ../../library/sys.rst:870 msgid "Added *platform_version*" msgstr "新增 *platform_version*" -#: ../../library/sys.rst:830 +#: ../../library/sys.rst:876 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form `(firstiter, finalizer)`, where " @@ -1195,103 +1278,103 @@ msgid "" "loop." msgstr "" -#: ../../library/sys.rst:837 +#: ../../library/sys.rst:883 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`\\ 。" -#: ../../library/sys.rst:841 ../../library/sys.rst:1481 +#: ../../library/sys.rst:887 ../../library/sys.rst:1534 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: ../../library/sys.rst:847 +#: ../../library/sys.rst:893 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:853 ../../library/sys.rst:1502 +#: ../../library/sys.rst:899 ../../library/sys.rst:1555 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: ../../library/sys.rst:859 +#: ../../library/sys.rst:905 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: ../../library/sys.rst:866 +#: ../../library/sys.rst:912 msgid ":const:`width`" msgstr ":const:`width`" -#: ../../library/sys.rst:866 +#: ../../library/sys.rst:912 msgid "width in bits used for hash values" msgstr "" -#: ../../library/sys.rst:868 +#: ../../library/sys.rst:914 msgid ":const:`modulus`" msgstr ":const:`modulus`" -#: ../../library/sys.rst:868 +#: ../../library/sys.rst:914 msgid "prime modulus P used for numeric hash scheme" msgstr "" -#: ../../library/sys.rst:870 +#: ../../library/sys.rst:916 msgid ":const:`inf`" msgstr ":const:`inf`" -#: ../../library/sys.rst:870 +#: ../../library/sys.rst:916 msgid "hash value returned for a positive infinity" msgstr "" -#: ../../library/sys.rst:872 +#: ../../library/sys.rst:918 msgid ":const:`nan`" msgstr ":const:`nan`" -#: ../../library/sys.rst:872 +#: ../../library/sys.rst:918 msgid "(this attribute is no longer used)" msgstr "" -#: ../../library/sys.rst:874 +#: ../../library/sys.rst:920 msgid ":const:`imag`" msgstr ":const:`imag`" -#: ../../library/sys.rst:874 +#: ../../library/sys.rst:920 msgid "multiplier used for the imaginary part of a complex number" msgstr "" -#: ../../library/sys.rst:877 +#: ../../library/sys.rst:923 msgid ":const:`algorithm`" msgstr ":const:`algorithm`" -#: ../../library/sys.rst:877 +#: ../../library/sys.rst:923 msgid "name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: ../../library/sys.rst:880 +#: ../../library/sys.rst:926 msgid ":const:`hash_bits`" msgstr ":const:`hash_bits`" -#: ../../library/sys.rst:880 +#: ../../library/sys.rst:926 msgid "internal output size of the hash algorithm" msgstr "" -#: ../../library/sys.rst:882 +#: ../../library/sys.rst:928 msgid ":const:`seed_bits`" msgstr ":const:`seed_bits`" -#: ../../library/sys.rst:882 +#: ../../library/sys.rst:928 msgid "size of the seed key of the hash algorithm" msgstr "" -#: ../../library/sys.rst:888 +#: ../../library/sys.rst:934 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "新增 *algorithm*\\ 、\\ *hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:894 +#: ../../library/sys.rst:940 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1299,7 +1382,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:905 +#: ../../library/sys.rst:951 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1307,25 +1390,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:910 +#: ../../library/sys.rst:956 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:915 +#: ../../library/sys.rst:961 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: ../../library/sys.rst:919 +#: ../../library/sys.rst:965 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: ../../library/sys.rst:923 +#: ../../library/sys.rst:969 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1337,13 +1420,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:933 +#: ../../library/sys.rst:979 msgid "" "*hexversion* is the implementation version in hexadecimal format, like :data:" "`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:936 +#: ../../library/sys.rst:982 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1352,7 +1435,7 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:943 +#: ../../library/sys.rst:989 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " @@ -1362,69 +1445,61 @@ msgid "" "versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:954 +#: ../../library/sys.rst:1000 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:959 +#: ../../library/sys.rst:1005 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:965 ../../library/sys.rst:1633 -msgid "Attribute" -msgstr "屬性" - -#: ../../library/sys.rst:965 ../../library/sys.rst:1633 -msgid "Explanation" -msgstr "解釋" - -#: ../../library/sys.rst:967 +#: ../../library/sys.rst:1013 msgid ":const:`bits_per_digit`" msgstr ":const:`bits_per_digit`" -#: ../../library/sys.rst:967 +#: ../../library/sys.rst:1013 msgid "" "number of bits held in each digit. Python integers are stored internally in " "base ``2**int_info.bits_per_digit``" msgstr "" -#: ../../library/sys.rst:971 +#: ../../library/sys.rst:1017 msgid ":const:`sizeof_digit`" msgstr ":const:`sizeof_digit`" -#: ../../library/sys.rst:971 +#: ../../library/sys.rst:1017 msgid "size in bytes of the C type used to represent a digit" msgstr "" -#: ../../library/sys.rst:974 +#: ../../library/sys.rst:1020 msgid ":const:`default_max_str_digits`" msgstr ":const:`default_max_str_digits`" -#: ../../library/sys.rst:974 +#: ../../library/sys.rst:1020 msgid "" "default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: ../../library/sys.rst:978 +#: ../../library/sys.rst:1024 msgid ":const:`str_digits_check_threshold`" msgstr ":const:`str_digits_check_threshold`" -#: ../../library/sys.rst:978 +#: ../../library/sys.rst:1024 msgid "" "minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" "`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: ../../library/sys.rst:986 +#: ../../library/sys.rst:1032 msgid "Added ``default_max_str_digits`` and ``str_digits_check_threshold``." msgstr "新增 ``default_max_str_digits`` 和 ``str_digits_check_threshold``。" -#: ../../library/sys.rst:992 +#: ../../library/sys.rst:1038 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: ../../library/sys.rst:998 +#: ../../library/sys.rst:1044 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with argument ``hook``." msgstr "" -#: ../../library/sys.rst:1000 +#: ../../library/sys.rst:1046 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: ../../library/sys.rst:1009 +#: ../../library/sys.rst:1055 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1457,19 +1532,19 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:1017 +#: ../../library/sys.rst:1063 msgid "" "Interned strings are not immortal; you must keep a reference to the return " "value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1023 +#: ../../library/sys.rst:1069 msgid "" "Return :const:`True` if the Python interpreter is :term:`shutting down " "`, :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1033 +#: ../../library/sys.rst:1079 msgid "" "These three variables are not always defined; they are set when an exception " "is not handled and the interpreter prints an error message and a stack " @@ -1480,33 +1555,33 @@ msgid "" "information.)" msgstr "" -#: ../../library/sys.rst:1041 +#: ../../library/sys.rst:1087 msgid "" "The meaning of the variables is the same as that of the return values from :" "func:`exc_info` above." msgstr "" -#: ../../library/sys.rst:1047 +#: ../../library/sys.rst:1093 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1054 +#: ../../library/sys.rst:1100 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1057 +#: ../../library/sys.rst:1103 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1065 +#: ../../library/sys.rst:1111 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1519,27 +1594,27 @@ msgid "" "if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1078 +#: ../../library/sys.rst:1124 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1078 +#: ../../library/sys.rst:1124 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1082 +#: ../../library/sys.rst:1128 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1081 +#: ../../library/sys.rst:1127 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1087 +#: ../../library/sys.rst:1133 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`. Earlier versions of Python looked for a method called :meth:" @@ -1548,7 +1623,7 @@ msgid "" "MetaPathFinder.find_spec` method." msgstr "" -#: ../../library/sys.rst:1095 +#: ../../library/sys.rst:1141 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1560,60 +1635,78 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1107 +#: ../../library/sys.rst:1153 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1110 +#: ../../library/sys.rst:1156 msgid "See also :data:`sys.argv`." msgstr "另請參閱 :data:`sys.argv`\\ 。" -#: ../../library/sys.rst:1119 +#: ../../library/sys.rst:1165 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1123 +#: ../../library/sys.rst:1169 msgid "" -"As initialized upon program startup, the first item of this list, " -"``path[0]``, is the directory containing the script that was used to invoke " -"the Python interpreter. If the script directory is not available (e.g. if " -"the interpreter is invoked interactively or if the script is read from " -"standard input), ``path[0]`` is the empty string, which directs Python to " -"search modules in the current directory first. Notice that the script " -"directory is inserted *before* the entries inserted as a result of :envvar:" -"`PYTHONPATH`." +"By default, as initialized upon program startup, a potentially unsafe path " +"is prepended to :data:`sys.path` (*before* the entries inserted as a result " +"of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1131 +#: ../../library/sys.rst:1173 +msgid "" +"``python -m module`` command line: prepend the current working directory." +msgstr "" + +#: ../../library/sys.rst:1175 +msgid "" +"``python script.py`` command line: prepend the script's directory. If it's a " +"symbolic link, resolve symbolic links." +msgstr "" + +#: ../../library/sys.rst:1177 +msgid "" +"``python -c code`` and ``python`` (REPL) command lines: prepend an empty " +"string, which means the current working directory." +msgstr "" + +#: ../../library/sys.rst:1180 +msgid "" +"To not prepend this potentially unsafe path, use the :option:`-P` command " +"line option or the :envvar:`PYTHONSAFEPATH` environment variable?" +msgstr "" + +#: ../../library/sys.rst:1183 msgid "" "A program is free to modify this list for its own purposes. Only strings " -"and bytes should be added to :data:`sys.path`; all other data types are " -"ignored during import." +"should be added to :data:`sys.path`; all other data types are ignored during " +"import." msgstr "" -#: ../../library/sys.rst:1137 +#: ../../library/sys.rst:1189 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1143 +#: ../../library/sys.rst:1194 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1147 ../../library/sys.rst:1158 +#: ../../library/sys.rst:1198 ../../library/sys.rst:1209 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1152 +#: ../../library/sys.rst:1203 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1621,19 +1714,19 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1160 +#: ../../library/sys.rst:1211 msgid "" "``None`` is stored instead of :class:`imp.NullImporter` when no finder is " "found." msgstr "" -#: ../../library/sys.rst:1167 +#: ../../library/sys.rst:1218 msgid "" "This string contains a platform identifier that can be used to append " "platform-specific components to :data:`sys.path`, for instance." msgstr "" -#: ../../library/sys.rst:1170 +#: ../../library/sys.rst:1221 msgid "" "For Unix systems, except on Linux and AIX, this is the lowercased OS name as " "returned by ``uname -s`` with the first part of the version as returned by " @@ -1642,59 +1735,75 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1183 +#: ../../library/sys.rst:1234 msgid "For other systems, the values are:" msgstr "" -#: ../../library/sys.rst:1186 +#: ../../library/sys.rst:1237 msgid "System" msgstr "" -#: ../../library/sys.rst:1186 +#: ../../library/sys.rst:1237 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1188 +#: ../../library/sys.rst:1239 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1188 +#: ../../library/sys.rst:1239 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1189 +#: ../../library/sys.rst:1240 +msgid "Emscripten" +msgstr "Emscripten" + +#: ../../library/sys.rst:1240 +msgid "``'emscripten'``" +msgstr "``'emscripten'``" + +#: ../../library/sys.rst:1241 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1189 +#: ../../library/sys.rst:1241 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1190 +#: ../../library/sys.rst:1242 +msgid "WASI" +msgstr "" + +#: ../../library/sys.rst:1242 +msgid "``'wasi'``" +msgstr "``'wasi'``" + +#: ../../library/sys.rst:1243 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1190 +#: ../../library/sys.rst:1243 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1191 +#: ../../library/sys.rst:1244 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1191 +#: ../../library/sys.rst:1244 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1192 +#: ../../library/sys.rst:1245 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1192 +#: ../../library/sys.rst:1245 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1195 +#: ../../library/sys.rst:1248 msgid "" "On Linux, :attr:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since older " @@ -1702,7 +1811,7 @@ msgid "" "the ``startswith`` idiom presented above." msgstr "" -#: ../../library/sys.rst:1201 +#: ../../library/sys.rst:1254 msgid "" "On AIX, :attr:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since older " @@ -1710,57 +1819,57 @@ msgid "" "the ``startswith`` idiom presented above." msgstr "" -#: ../../library/sys.rst:1209 +#: ../../library/sys.rst:1262 msgid "" ":attr:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1212 +#: ../../library/sys.rst:1265 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1218 +#: ../../library/sys.rst:1271 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1221 +#: ../../library/sys.rst:1274 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1225 +#: ../../library/sys.rst:1278 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1227 +#: ../../library/sys.rst:1280 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1230 +#: ../../library/sys.rst:1283 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1232 +#: ../../library/sys.rst:1285 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1240 +#: ../../library/sys.rst:1293 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is ``'/usr/" @@ -1769,14 +1878,14 @@ msgid "" "paths." msgstr "" -#: ../../library/sys.rst:1246 +#: ../../library/sys.rst:1299 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:1261 +#: ../../library/sys.rst:1314 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1786,7 +1895,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1271 +#: ../../library/sys.rst:1324 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 " @@ -1797,14 +1906,14 @@ msgid "" "data:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1283 +#: ../../library/sys.rst:1336 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1295 +#: ../../library/sys.rst:1348 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 " @@ -1819,7 +1928,7 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1306 +#: ../../library/sys.rst:1359 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1827,71 +1936,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1311 +#: ../../library/sys.rst:1364 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:1313 ../../library/sys.rst:1394 +#: ../../library/sys.rst:1366 ../../library/sys.rst:1447 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1317 ../../library/sys.rst:1399 +#: ../../library/sys.rst:1370 ../../library/sys.rst:1452 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1316 +#: ../../library/sys.rst:1369 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1322 ../../library/sys.rst:1414 +#: ../../library/sys.rst:1375 ../../library/sys.rst:1467 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1320 +#: ../../library/sys.rst:1373 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:1326 +#: ../../library/sys.rst:1379 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1325 +#: ../../library/sys.rst:1378 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:1329 +#: ../../library/sys.rst:1382 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1329 +#: ../../library/sys.rst:1382 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1331 +#: ../../library/sys.rst:1384 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1332 +#: ../../library/sys.rst:1385 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1336 +#: ../../library/sys.rst:1389 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:1340 +#: ../../library/sys.rst:1393 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 " @@ -1899,19 +2008,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1345 +#: ../../library/sys.rst:1398 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1348 +#: ../../library/sys.rst:1401 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1355 +#: ../../library/sys.rst:1408 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -1922,7 +2031,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1372 +#: ../../library/sys.rst:1425 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 " @@ -1931,7 +2040,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1377 +#: ../../library/sys.rst:1430 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1939,7 +2048,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1382 +#: ../../library/sys.rst:1435 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 " @@ -1947,31 +2056,31 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1387 +#: ../../library/sys.rst:1440 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:1391 +#: ../../library/sys.rst:1444 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:1397 +#: ../../library/sys.rst:1450 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:1408 +#: ../../library/sys.rst:1461 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1402 +#: ../../library/sys.rst:1455 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``; " @@ -1981,7 +2090,7 @@ msgid "" "const:`False` on that frame." msgstr "" -#: ../../library/sys.rst:1411 +#: ../../library/sys.rst:1464 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 " @@ -1989,22 +2098,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1472 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1470 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:1427 +#: ../../library/sys.rst:1480 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1475 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 " @@ -2013,13 +2122,13 @@ msgid "" "`f_trace_opcodes` to :const:`True` on the frame." msgstr "" -#: ../../library/sys.rst:1429 +#: ../../library/sys.rst:1482 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:1432 +#: ../../library/sys.rst:1485 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 " @@ -2033,17 +2142,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1443 +#: ../../library/sys.rst:1496 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1445 +#: ../../library/sys.rst:1498 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:1449 +#: ../../library/sys.rst:1502 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2051,13 +2160,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1456 +#: ../../library/sys.rst:1509 msgid "" "``'opcode'`` event type added; :attr:`f_trace_lines` and :attr:" "`f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1461 +#: ../../library/sys.rst:1514 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2066,32 +2175,32 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1467 +#: ../../library/sys.rst:1520 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -#: ../../library/sys.rst:1469 +#: ../../library/sys.rst:1522 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -#: ../../library/sys.rst:1471 +#: ../../library/sys.rst:1524 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:1474 +#: ../../library/sys.rst:1527 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:1486 +#: ../../library/sys.rst:1539 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2100,74 +2209,74 @@ msgid "" "disabled, ``cr_origin`` will be None." msgstr "" -#: ../../library/sys.rst:1493 +#: ../../library/sys.rst:1546 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:1497 +#: ../../library/sys.rst:1550 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1507 +#: ../../library/sys.rst:1560 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:1511 +#: ../../library/sys.rst:1564 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1514 +#: ../../library/sys.rst:1567 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1519 +#: ../../library/sys.rst:1572 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`\\ 。" -#: ../../library/sys.rst:1526 +#: ../../library/sys.rst:1579 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1529 +#: ../../library/sys.rst:1582 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1531 +#: ../../library/sys.rst:1584 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:1533 +#: ../../library/sys.rst:1586 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1535 +#: ../../library/sys.rst:1588 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:1539 +#: ../../library/sys.rst:1592 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:1542 +#: ../../library/sys.rst:1595 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 " @@ -2178,14 +2287,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1551 +#: ../../library/sys.rst:1604 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:1556 +#: ../../library/sys.rst:1609 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2194,7 +2303,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1616 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2203,19 +2312,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1569 +#: ../../library/sys.rst:1622 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1575 +#: ../../library/sys.rst:1628 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:1579 +#: ../../library/sys.rst:1632 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 " @@ -2223,7 +2332,7 @@ msgid "" "support the :attr:`~io.BufferedIOBase.buffer` attribute." msgstr "" -#: ../../library/sys.rst:1589 +#: ../../library/sys.rst:1642 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2231,7 +2340,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1594 +#: ../../library/sys.rst:1647 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, " @@ -2239,7 +2348,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1600 +#: ../../library/sys.rst:1653 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2247,12 +2356,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1608 +#: ../../library/sys.rst:1661 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1610 +#: ../../library/sys.rst:1663 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 " @@ -2260,7 +2369,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1615 +#: ../../library/sys.rst:1668 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 " @@ -2268,66 +2377,72 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1620 +#: ../../library/sys.rst:1673 msgid "See also the :attr:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1627 +#: ../../library/sys.rst:1680 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1635 +#: ../../library/sys.rst:1688 msgid ":const:`name`" msgstr ":const:`name`" -#: ../../library/sys.rst:1635 +#: ../../library/sys.rst:1688 msgid "Name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1637 +#: ../../library/sys.rst:1690 msgid "``'nt'``: Windows threads" msgstr "" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1691 msgid "``'pthread'``: POSIX threads" msgstr "" -#: ../../library/sys.rst:1639 +#: ../../library/sys.rst:1692 +msgid "" +"``'pthread-stubs'``: stub POSIX threads (on WebAssembly platforms without " +"threading support)" +msgstr "" + +#: ../../library/sys.rst:1694 msgid "``'solaris'``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1641 +#: ../../library/sys.rst:1696 msgid ":const:`lock`" msgstr ":const:`lock`" -#: ../../library/sys.rst:1641 +#: ../../library/sys.rst:1696 msgid "Name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1643 +#: ../../library/sys.rst:1698 msgid "``'semaphore'``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1644 +#: ../../library/sys.rst:1699 msgid "``'mutex+cond'``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1701 msgid "``None`` if this information is unknown" msgstr "" -#: ../../library/sys.rst:1648 +#: ../../library/sys.rst:1703 msgid ":const:`version`" msgstr ":const:`version`" -#: ../../library/sys.rst:1648 +#: ../../library/sys.rst:1703 msgid "" "Name and version of the thread library. It is a string, or ``None`` if this " "information is unknown." msgstr "" -#: ../../library/sys.rst:1657 +#: ../../library/sys.rst:1712 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2336,78 +2451,78 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1665 +#: ../../library/sys.rst:1720 msgid "Handle an unraisable exception." msgstr "" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1722 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:1671 +#: ../../library/sys.rst:1726 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1673 +#: ../../library/sys.rst:1728 msgid "*exc_type*: Exception type." msgstr "" -#: ../../library/sys.rst:1674 +#: ../../library/sys.rst:1729 msgid "*exc_value*: Exception value, can be ``None``." msgstr "" -#: ../../library/sys.rst:1675 +#: ../../library/sys.rst:1730 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" -#: ../../library/sys.rst:1676 +#: ../../library/sys.rst:1731 msgid "*err_msg*: Error message, can be ``None``." msgstr "" -#: ../../library/sys.rst:1677 +#: ../../library/sys.rst:1732 msgid "*object*: Object causing the exception, can be ``None``." msgstr "" -#: ../../library/sys.rst:1679 +#: ../../library/sys.rst:1734 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:1683 +#: ../../library/sys.rst:1738 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1686 +#: ../../library/sys.rst:1741 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:1690 +#: ../../library/sys.rst:1745 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:1694 +#: ../../library/sys.rst:1749 msgid "See also :func:`excepthook` which handles uncaught exceptions." msgstr "" -#: ../../library/sys.rst:1696 +#: ../../library/sys.rst:1751 msgid "" "Raises an :ref:`auditing event ` ``sys.unraisablehook`` with " "arguments ``hook``, ``unraisable``." msgstr "" -#: ../../library/sys.rst:1698 +#: ../../library/sys.rst:1753 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments ``hook``, " "``unraisable`` when an exception that cannot be handled occurs. The " @@ -2415,7 +2530,7 @@ msgid "" "hook has been set, ``hook`` may be ``None``." msgstr "" -#: ../../library/sys.rst:1707 +#: ../../library/sys.rst:1762 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2424,13 +2539,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1716 +#: ../../library/sys.rst:1771 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:1722 +#: ../../library/sys.rst:1777 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2441,18 +2556,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1730 +#: ../../library/sys.rst:1785 msgid "Added named component attributes." msgstr "" -#: ../../library/sys.rst:1735 +#: ../../library/sys.rst:1790 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:1742 +#: ../../library/sys.rst:1797 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 " @@ -2461,25 +2576,25 @@ msgid "" "on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:1753 +#: ../../library/sys.rst:1808 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:1769 +#: ../../library/sys.rst:1824 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:1777 +#: ../../library/sys.rst:1832 msgid "Citations" msgstr "" -#: ../../library/sys.rst:1778 +#: ../../library/sys.rst:1833 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" diff --git a/library/sys_path_init.po b/library/sys_path_init.po new file mode 100644 index 0000000000..ef4f0cc47e --- /dev/null +++ b/library/sys_path_init.po @@ -0,0 +1,184 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/sys_path_init.rst:4 +msgid "The initialization of the :data:`sys.path` module search path" +msgstr "" + +#: ../../library/sys_path_init.rst:6 +msgid "" +"A module search path is initialized when Python starts. This module search " +"path may be accessed at :data:`sys.path`." +msgstr "" + +#: ../../library/sys_path_init.rst:9 +msgid "" +"The first entry in the module search path is the directory that contains the " +"input script, if there is one. Otherwise, the first entry is the current " +"directory, which is the case when executing the interactive shell, a :option:" +"`-c` command, or :option:`-m` module." +msgstr "" + +#: ../../library/sys_path_init.rst:14 +msgid "" +"The :envvar:`PYTHONPATH` environment variable is often used to add " +"directories to the search path. If this environment variable is found then " +"the contents are added to the module search path." +msgstr "" + +#: ../../library/sys_path_init.rst:20 +msgid "" +":envvar:`PYTHONPATH` will affect all installed Python versions/environments. " +"Be wary of setting this in your shell profile or global environment " +"variables. The :mod:`site` module offers more nuanced techniques as " +"mentioned below." +msgstr "" + +#: ../../library/sys_path_init.rst:24 +msgid "" +"The next items added are the directories containing standard Python modules " +"as well as any :term:`extension module`\\s that these modules depend on. " +"Extension modules are ``.pyd`` files on Windows and ``.so`` files on other " +"platforms. The directory with the platform-independent Python modules is " +"called ``prefix``. The directory with the extension modules is called " +"``exec_prefix``." +msgstr "" + +#: ../../library/sys_path_init.rst:30 +msgid "" +"The :envvar:`PYTHONHOME` environment variable may be used to set the " +"``prefix`` and ``exec_prefix`` locations. Otherwise these directories are " +"found by using the Python executable as a starting point and then looking " +"for various 'landmark' files and directories. Note that any symbolic links " +"are followed so the real Python executable location is used as the search " +"starting point. The Python executable location is called ``home``." +msgstr "" + +#: ../../library/sys_path_init.rst:37 +msgid "" +"Once ``home`` is determined, the ``prefix`` directory is found by first " +"looking for :file:`python{majorversion}{minorversion}.zip` (``python311." +"zip``). On Windows the zip archive is searched for in ``home`` and on Unix " +"the archive is expected to be in :file:`lib`. Note that the expected zip " +"archive location is added to the module search path even if the archive does " +"not exist. If no archive was found, Python on Windows will continue the " +"search for ``prefix`` by looking for :file:`Lib\\\\os.py`. Python on Unix " +"will look for :file:`lib/python{majorversion}.{minorversion}/os.py` (``lib/" +"python3.11/os.py``). On Windows ``prefix`` and ``exec_prefix`` are the same, " +"however on other platforms :file:`lib/python{majorversion}.{minorversion}/" +"lib-dynload` (``lib/python3.11/lib-dynload``) is searched for and used as an " +"anchor for ``exec_prefix``. On some platforms :file:`lib` may be :file:" +"`lib64` or another value, see :data:`sys.platlibdir` and :envvar:" +"`PYTHONPLATLIBDIR`." +msgstr "" + +#: ../../library/sys_path_init.rst:50 +msgid "" +"Once found, ``prefix`` and ``exec_prefix`` are available at :data:`sys." +"prefix` and :data:`sys.exec_prefix` respectively." +msgstr "" + +#: ../../library/sys_path_init.rst:53 +msgid "" +"Finally, the :mod:`site` module is processed and :file:`site-packages` " +"directories are added to the module search path. A common way to customize " +"the search path is to create :mod:`sitecustomize` or :mod:`usercustomize` " +"modules as described in the :mod:`site` module documentation." +msgstr "" + +#: ../../library/sys_path_init.rst:60 +msgid "" +"Certain command line options may further affect path calculations. See :" +"option:`-E`, :option:`-I`, :option:`-s` and :option:`-S` for further details." +msgstr "" + +#: ../../library/sys_path_init.rst:64 +msgid "Virtual environments" +msgstr "" + +#: ../../library/sys_path_init.rst:66 +msgid "" +"If Python is run in a virtual environment (as described at :ref:`tut-venv`) " +"then ``prefix`` and ``exec_prefix`` are specific to the virtual environment." +msgstr "" + +#: ../../library/sys_path_init.rst:69 +msgid "" +"If a ``pyvenv.cfg`` file is found alongside the main executable, or in the " +"directory one level above the executable, the following variations apply:" +msgstr "" + +#: ../../library/sys_path_init.rst:72 +msgid "" +"If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " +"path is used instead of the path to the main executable when deducing " +"``prefix`` and ``exec_prefix``." +msgstr "" + +#: ../../library/sys_path_init.rst:77 +msgid "_pth files" +msgstr "" + +#: ../../library/sys_path_init.rst:79 +msgid "" +"To completely override :data:`sys.path` create a ``._pth`` file with the " +"same name as the shared library or executable (``python._pth`` or " +"``python311._pth``). The shared library path is always known on Windows, " +"however it may not be available on other platforms. In the ``._pth`` file " +"specify one line for each path to add to :data:`sys.path`. The file based on " +"the shared library name overrides the one based on the executable, which " +"allows paths to be restricted for any program loading the runtime if desired." +msgstr "" + +#: ../../library/sys_path_init.rst:87 +msgid "" +"When the file exists, all registry and environment variables are ignored, " +"isolated mode is enabled, and :mod:`site` is not imported unless one line in " +"the file specifies ``import site``. Blank paths and lines starting with " +"``#`` are ignored. Each path may be absolute or relative to the location of " +"the file. Import statements other than to ``site`` are not permitted, and " +"arbitrary code cannot be specified." +msgstr "" + +#: ../../library/sys_path_init.rst:94 +msgid "" +"Note that ``.pth`` files (without leading underscore) will be processed " +"normally by the :mod:`site` module when ``import site`` has been specified." +msgstr "" + +#: ../../library/sys_path_init.rst:98 +msgid "Embedded Python" +msgstr "" + +#: ../../library/sys_path_init.rst:100 +msgid "" +"If Python is embedded within another application :c:func:" +"`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure can be used " +"to initialize Python. The path specific details are described at :ref:`init-" +"path-config`. Alternatively the older :c:func:`Py_SetPath` can be used to " +"bypass the initialization of the module search path." +msgstr "" + +#: ../../library/sys_path_init.rst:107 +msgid ":ref:`windows_finding_modules` for detailed Windows notes." +msgstr "" + +#: ../../library/sys_path_init.rst:108 +msgid ":ref:`using-on-unix` for Unix details." +msgstr "" diff --git a/library/sysconfig.po b/library/sysconfig.po index c91fe412ea..fcb48fb66c 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-19 00:09+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -108,7 +108,7 @@ msgid "" msgstr "" #: ../../library/sysconfig.rst:76 -msgid "Python currently supports six schemes:" +msgid "Python currently supports nine schemes:" msgstr "" #: ../../library/sysconfig.rst:78 @@ -132,96 +132,129 @@ msgid "" msgstr "" #: ../../library/sysconfig.rst:86 +msgid "" +"*posix_venv*: scheme for :mod:`Python virtual environments ` on POSIX " +"platforms; by default it is the same as *posix_prefix* ." +msgstr "" + +#: ../../library/sysconfig.rst:88 msgid "*nt*: scheme for NT platforms like Windows." msgstr "" -#: ../../library/sysconfig.rst:87 +#: ../../library/sysconfig.rst:89 msgid "*nt_user*: scheme for NT platforms, when the *user* option is used." msgstr "" -#: ../../library/sysconfig.rst:88 +#: ../../library/sysconfig.rst:90 +msgid "" +"*nt_venv*: scheme for :mod:`Python virtual environments ` on NT " +"platforms; by default it is the same as *nt* ." +msgstr "" + +#: ../../library/sysconfig.rst:92 +msgid "" +"*venv*: a scheme with values from ether *posix_venv* or *nt_venv* depending " +"on the platform Python runs on" +msgstr "" + +#: ../../library/sysconfig.rst:94 msgid "*osx_framework_user*: scheme for macOS, when the *user* option is used." msgstr "" -#: ../../library/sysconfig.rst:90 +#: ../../library/sysconfig.rst:96 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:93 +#: ../../library/sysconfig.rst:99 msgid "" "*stdlib*: directory containing the standard Python library files that are " "not platform-specific." msgstr "" -#: ../../library/sysconfig.rst:95 +#: ../../library/sysconfig.rst:101 msgid "" "*platstdlib*: directory containing the standard Python library files that " "are platform-specific." msgstr "" -#: ../../library/sysconfig.rst:97 +#: ../../library/sysconfig.rst:103 msgid "*platlib*: directory for site-specific, platform-specific files." msgstr "" -#: ../../library/sysconfig.rst:98 +#: ../../library/sysconfig.rst:104 msgid "*purelib*: directory for site-specific, non-platform-specific files." msgstr "" -#: ../../library/sysconfig.rst:99 -msgid "*include*: directory for non-platform-specific header files." +#: ../../library/sysconfig.rst:105 +msgid "" +"*include*: directory for non-platform-specific header files for the Python C-" +"API." msgstr "" -#: ../../library/sysconfig.rst:100 -msgid "*platinclude*: directory for platform-specific header files." +#: ../../library/sysconfig.rst:107 +msgid "" +"*platinclude*: directory for platform-specific header files for the Python C-" +"API." msgstr "" -#: ../../library/sysconfig.rst:101 +#: ../../library/sysconfig.rst:109 msgid "*scripts*: directory for script files." msgstr "" -#: ../../library/sysconfig.rst:102 +#: ../../library/sysconfig.rst:110 msgid "*data*: directory for data files." msgstr "" -#: ../../library/sysconfig.rst:104 +#: ../../library/sysconfig.rst:112 msgid ":mod:`sysconfig` provides some functions to determine these paths." msgstr "" -#: ../../library/sysconfig.rst:108 +#: ../../library/sysconfig.rst:116 msgid "" "Return a tuple containing all schemes currently supported in :mod:" "`sysconfig`." msgstr "" -#: ../../library/sysconfig.rst:114 +#: ../../library/sysconfig.rst:122 msgid "Return the default scheme name for the current platform." msgstr "" -#: ../../library/sysconfig.rst:116 +#: ../../library/sysconfig.rst:124 msgid "" "This function was previously named ``_get_default_scheme()`` and considered " "an implementation detail." msgstr "" -#: ../../library/sysconfig.rst:123 +#: ../../library/sysconfig.rst:128 +msgid "" +"When Python runs from a virtual environment, the *venv* scheme is returned." +msgstr "" + +#: ../../library/sysconfig.rst:134 msgid "" "Return a preferred scheme name for an installation layout specified by *key*." msgstr "" -#: ../../library/sysconfig.rst:125 +#: ../../library/sysconfig.rst:136 msgid "*key* must be either ``\"prefix\"``, ``\"home\"``, or ``\"user\"``." msgstr "" -#: ../../library/sysconfig.rst:127 +#: ../../library/sysconfig.rst:138 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:136 +#: ../../library/sysconfig.rst:144 +msgid "" +"When Python runs from a virtual environment and ``key=\"prefix\"``, the " +"*venv* scheme is returned." +msgstr "" + +#: ../../library/sysconfig.rst:151 msgid "" "Return a dict containing preferred scheme names on the current platform. " "Python implementers and redistributors may add their preferred schemes to " @@ -231,109 +264,109 @@ msgid "" "mix with those by the other." msgstr "" -#: ../../library/sysconfig.rst:143 +#: ../../library/sysconfig.rst:158 msgid "" "End users should not use this function, but :func:`get_default_scheme` and :" "func:`get_preferred_scheme()` instead." msgstr "" -#: ../../library/sysconfig.rst:151 +#: ../../library/sysconfig.rst:166 msgid "" "Return a tuple containing all path names currently supported in :mod:" "`sysconfig`." msgstr "" -#: ../../library/sysconfig.rst:157 +#: ../../library/sysconfig.rst:172 msgid "" "Return an installation path corresponding to the path *name*, from the " "install scheme named *scheme*." msgstr "" -#: ../../library/sysconfig.rst:160 +#: ../../library/sysconfig.rst:175 msgid "" "*name* has to be a value from the list returned by :func:`get_path_names`." msgstr "" -#: ../../library/sysconfig.rst:162 +#: ../../library/sysconfig.rst:177 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:166 +#: ../../library/sysconfig.rst:181 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:170 +#: ../../library/sysconfig.rst:185 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:174 +#: ../../library/sysconfig.rst:189 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:177 +#: ../../library/sysconfig.rst:192 msgid "" "If *expand* is set to ``False``, the path will not be expanded using the " "variables." msgstr "" -#: ../../library/sysconfig.rst:180 +#: ../../library/sysconfig.rst:195 msgid "If *name* is not found, raise a :exc:`KeyError`." msgstr "" -#: ../../library/sysconfig.rst:185 +#: ../../library/sysconfig.rst:200 msgid "" "Return a dictionary containing all installation paths corresponding to an " "installation scheme. See :func:`get_path` for more information." msgstr "" -#: ../../library/sysconfig.rst:188 +#: ../../library/sysconfig.rst:203 msgid "" "If *scheme* is not provided, will use the default scheme for the current " "platform." msgstr "" -#: ../../library/sysconfig.rst:191 +#: ../../library/sysconfig.rst:206 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:194 +#: ../../library/sysconfig.rst:209 msgid "If *expand* is set to false, the paths will not be expanded." msgstr "" -#: ../../library/sysconfig.rst:196 +#: ../../library/sysconfig.rst:211 msgid "" "If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" "`KeyError`." msgstr "" -#: ../../library/sysconfig.rst:201 +#: ../../library/sysconfig.rst:216 msgid "Other functions" msgstr "其他函式" -#: ../../library/sysconfig.rst:205 +#: ../../library/sysconfig.rst:220 msgid "" "Return the ``MAJOR.MINOR`` Python version number as a string. Similar to " "``'%d.%d' % sys.version_info[:2]``." msgstr "" -#: ../../library/sysconfig.rst:211 +#: ../../library/sysconfig.rst:226 msgid "Return a string that identifies the current platform." msgstr "" -#: ../../library/sysconfig.rst:213 +#: ../../library/sysconfig.rst:228 msgid "" "This is used mainly to distinguish platform-specific build directories and " "platform-specific built distributions. Typically includes the OS name and " @@ -342,99 +375,99 @@ msgid "" "version isn't particularly important." msgstr "" -#: ../../library/sysconfig.rst:219 +#: ../../library/sysconfig.rst:234 msgid "Examples of returned values:" msgstr "" -#: ../../library/sysconfig.rst:221 +#: ../../library/sysconfig.rst:236 msgid "linux-i586" msgstr "linux-i586" -#: ../../library/sysconfig.rst:222 +#: ../../library/sysconfig.rst:237 msgid "linux-alpha (?)" msgstr "linux-alpha (?)" -#: ../../library/sysconfig.rst:223 +#: ../../library/sysconfig.rst:238 msgid "solaris-2.6-sun4u" msgstr "solaris-2.6-sun4u" -#: ../../library/sysconfig.rst:225 +#: ../../library/sysconfig.rst:240 msgid "Windows will return one of:" msgstr "" -#: ../../library/sysconfig.rst:227 +#: ../../library/sysconfig.rst:242 msgid "win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" msgstr "" -#: ../../library/sysconfig.rst:228 +#: ../../library/sysconfig.rst:243 msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" -#: ../../library/sysconfig.rst:230 +#: ../../library/sysconfig.rst:245 msgid "macOS can return:" msgstr "" -#: ../../library/sysconfig.rst:232 +#: ../../library/sysconfig.rst:247 msgid "macosx-10.6-ppc" msgstr "macosx-10.6-ppc" -#: ../../library/sysconfig.rst:233 +#: ../../library/sysconfig.rst:248 msgid "macosx-10.4-ppc64" msgstr "macosx-10.4-ppc64" -#: ../../library/sysconfig.rst:234 +#: ../../library/sysconfig.rst:249 msgid "macosx-10.3-i386" msgstr "macosx-10.3-i386" -#: ../../library/sysconfig.rst:235 +#: ../../library/sysconfig.rst:250 msgid "macosx-10.4-fat" msgstr "macosx-10.4-fat" -#: ../../library/sysconfig.rst:237 +#: ../../library/sysconfig.rst:252 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: ../../library/sysconfig.rst:242 +#: ../../library/sysconfig.rst:257 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:249 +#: ../../library/sysconfig.rst:264 msgid "Parse a :file:`config.h`\\-style file." msgstr "" -#: ../../library/sysconfig.rst:251 +#: ../../library/sysconfig.rst:266 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: ../../library/sysconfig.rst:253 +#: ../../library/sysconfig.rst:268 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:260 +#: ../../library/sysconfig.rst:275 msgid "Return the path of :file:`pyconfig.h`." msgstr "" -#: ../../library/sysconfig.rst:264 +#: ../../library/sysconfig.rst:279 msgid "Return the path of :file:`Makefile`." msgstr "" -#: ../../library/sysconfig.rst:268 +#: ../../library/sysconfig.rst:283 msgid "Using :mod:`sysconfig` as a script" msgstr "" -#: ../../library/sysconfig.rst:270 +#: ../../library/sysconfig.rst:285 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:296 +#: ../../library/sysconfig.rst:311 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/syslog.po b/library/syslog.po index b561e873b4..b7343c775b 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-13 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -36,11 +36,22 @@ msgid "" "handlers` module as :class:`SysLogHandler`." msgstr "" -#: ../../library/syslog.rst:18 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/syslog.rst:20 msgid "The module defines the following functions:" msgstr "該模組定義了以下函式:" -#: ../../library/syslog.rst:24 +#: ../../library/syslog.rst:26 msgid "" "Send the string *message* to the system logger. A trailing newline is added " "if necessary. Each message is tagged with a priority composed of a " @@ -50,33 +61,33 @@ msgid "" "value given in the :func:`openlog` call is used." msgstr "" -#: ../../library/syslog.rst:31 +#: ../../library/syslog.rst:33 msgid "" "If :func:`openlog` has not been called prior to the call to :func:`syslog`, :" "func:`openlog` will be called with no arguments." msgstr "" -#: ../../library/syslog.rst:34 +#: ../../library/syslog.rst:47 msgid "" "Raises an :ref:`auditing event ` ``syslog.syslog`` with arguments " "``priority``, ``message``." msgstr "" -#: ../../library/syslog.rst:36 +#: ../../library/syslog.rst:38 msgid "" "In previous versions, :func:`openlog` would not be called automatically if " "it wasn't called prior to the call to :func:`syslog`, deferring to the " "syslog implementation to call ``openlog()``." msgstr "" -#: ../../library/syslog.rst:44 +#: ../../library/syslog.rst:46 msgid "" "Logging options of subsequent :func:`syslog` calls can be set by calling :" "func:`openlog`. :func:`syslog` will call :func:`openlog` with no arguments " "if the log is not currently open." msgstr "" -#: ../../library/syslog.rst:48 +#: ../../library/syslog.rst:50 msgid "" "The optional *ident* keyword argument is a string which is prepended to " "every message, and defaults to ``sys.argv[0]`` with leading path components " @@ -86,24 +97,24 @@ msgid "" "for messages which do not have a facility explicitly encoded." msgstr "" -#: ../../library/syslog.rst:55 +#: ../../library/syslog.rst:68 msgid "" "Raises an :ref:`auditing event ` ``syslog.openlog`` with arguments " "``ident``, ``logoption``, ``facility``." msgstr "" -#: ../../library/syslog.rst:57 +#: ../../library/syslog.rst:59 msgid "" "In previous versions, keyword arguments were not allowed, and *ident* was " "required." msgstr "" -#: ../../library/syslog.rst:64 +#: ../../library/syslog.rst:66 msgid "" "Reset the syslog module values and call the system library ``closelog()``." msgstr "" -#: ../../library/syslog.rst:66 +#: ../../library/syslog.rst:68 msgid "" "This causes the module to behave as it does when initially imported. For " "example, :func:`openlog` will be called on the first :func:`syslog` call " @@ -111,13 +122,13 @@ msgid "" "`openlog` parameters are reset to defaults." msgstr "" -#: ../../library/syslog.rst:71 +#: ../../library/syslog.rst:84 msgid "" "Raises an :ref:`auditing event ` ``syslog.closelog`` with no " "arguments." msgstr "" -#: ../../library/syslog.rst:76 +#: ../../library/syslog.rst:78 msgid "" "Set the priority mask to *maskpri* and return the previous mask value. " "Calls to :func:`syslog` with a priority level not set in *maskpri* are " @@ -127,32 +138,32 @@ msgid "" "and including *pri*." msgstr "" -#: ../../library/syslog.rst:83 +#: ../../library/syslog.rst:96 msgid "" "Raises an :ref:`auditing event ` ``syslog.setlogmask`` with " "argument ``maskpri``." msgstr "" -#: ../../library/syslog.rst:85 +#: ../../library/syslog.rst:87 msgid "The module defines the following constants:" msgstr "" -#: ../../library/syslog.rst:90 +#: ../../library/syslog.rst:92 msgid "Priority levels (high to low):" msgstr "" -#: ../../library/syslog.rst:88 +#: ../../library/syslog.rst:90 msgid "" ":const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:" "`LOG_ERR`, :const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`, :" "const:`LOG_DEBUG`." msgstr "" -#: ../../library/syslog.rst:97 +#: ../../library/syslog.rst:99 msgid "Facilities:" msgstr "" -#: ../../library/syslog.rst:93 +#: ../../library/syslog.rst:95 msgid "" ":const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:" "`LOG_DAEMON`, :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:" @@ -160,33 +171,33 @@ msgid "" "const:`LOG_LOCAL7`, and, if defined in ````, :const:`LOG_AUTHPRIV`." msgstr "" -#: ../../library/syslog.rst:103 +#: ../../library/syslog.rst:105 msgid "Log options:" msgstr "" -#: ../../library/syslog.rst:100 +#: ../../library/syslog.rst:102 msgid "" ":const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined in " "````, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and :const:" "`LOG_PERROR`." msgstr "" -#: ../../library/syslog.rst:106 +#: ../../library/syslog.rst:108 msgid "Examples" msgstr "範例" -#: ../../library/syslog.rst:109 +#: ../../library/syslog.rst:111 msgid "Simple example" msgstr "簡單範例" -#: ../../library/syslog.rst:111 +#: ../../library/syslog.rst:113 msgid "A simple set of examples::" msgstr "" "一組簡單範例:\n" "\n" "::" -#: ../../library/syslog.rst:119 +#: ../../library/syslog.rst:121 msgid "" "An example of setting some log options, these would include the process ID " "in logged messages, and write the messages to the destination facility used " diff --git a/library/tarfile.po b/library/tarfile.po index d2a99d87ae..dced3c99dd 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -137,7 +137,7 @@ msgstr "``'x'`` 或 ``'x:'``" #: ../../library/tarfile.rst:64 msgid "" -"Create a tarfile exclusively without compression. Raise an :exc:" +"Create a tarfile exclusively without compression. Raise a :exc:" "`FileExistsError` exception if it already exists." msgstr "" @@ -147,7 +147,7 @@ msgstr "``'x:gz'``" #: ../../library/tarfile.rst:69 msgid "" -"Create a tarfile with gzip compression. Raise an :exc:`FileExistsError` " +"Create a tarfile with gzip compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" @@ -157,7 +157,7 @@ msgstr "``'x:bz2'``" #: ../../library/tarfile.rst:73 msgid "" -"Create a tarfile with bzip2 compression. Raise an :exc:`FileExistsError` " +"Create a tarfile with bzip2 compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" @@ -167,7 +167,7 @@ msgstr "``'x:xz'``" #: ../../library/tarfile.rst:77 msgid "" -"Create a tarfile with lzma compression. Raise an :exc:`FileExistsError` " +"Create a tarfile with lzma compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" diff --git a/library/telnetlib.po b/library/telnetlib.po index 1e5255a873..836c01f2ee 100644 --- a/library/telnetlib.po +++ b/library/telnetlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`telnetlib` --- Telnet 客戶端" msgid "**Source code:** :source:`Lib/telnetlib.py`" msgstr "**原始碼:**\\ :source:`Lib/telnetlib.py`" -#: ../../library/telnetlib.rst:14 +#: ../../library/telnetlib.rst:17 msgid "" "The :mod:`telnetlib` module is deprecated (see :pep:`PEP 594 " "<594#telnetlib>` for details and alternatives)." @@ -54,7 +54,18 @@ msgid "" "(Erase Character), EL (Erase Line), GA (Go Ahead), SB (Subnegotiation Begin)." msgstr "" -#: ../../library/telnetlib.rst:36 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/telnetlib.rst:37 msgid "" ":class:`Telnet` represents a connection to a Telnet server. The instance is " "initially not connected by default; the :meth:`~Telnet.open` method must be " @@ -66,11 +77,11 @@ msgid "" "global default timeout setting will be used)." msgstr "" -#: ../../library/telnetlib.rst:45 +#: ../../library/telnetlib.rst:46 msgid "Do not reopen an already connected instance." msgstr "" -#: ../../library/telnetlib.rst:47 +#: ../../library/telnetlib.rst:48 msgid "" "This class has many :meth:`read_\\*` methods. Note that some of them " "raise :exc:`EOFError` when the end of the connection is read, because they " @@ -78,100 +89,100 @@ msgid "" "descriptions below." msgstr "" -#: ../../library/telnetlib.rst:51 +#: ../../library/telnetlib.rst:52 msgid "" "A :class:`Telnet` object is a context manager and can be used in a :keyword:" "`with` statement. When the :keyword:`!with` block ends, the :meth:`close` " "method is called::" msgstr "" -#: ../../library/telnetlib.rst:60 +#: ../../library/telnetlib.rst:61 msgid "Context manager support added" msgstr "" -#: ../../library/telnetlib.rst:65 +#: ../../library/telnetlib.rst:66 msgid ":rfc:`854` - Telnet Protocol Specification" msgstr "" -#: ../../library/telnetlib.rst:66 +#: ../../library/telnetlib.rst:67 msgid "Definition of the Telnet protocol." msgstr "" -#: ../../library/telnetlib.rst:72 +#: ../../library/telnetlib.rst:73 msgid "Telnet Objects" msgstr "" -#: ../../library/telnetlib.rst:74 +#: ../../library/telnetlib.rst:75 msgid ":class:`Telnet` instances have the following methods:" msgstr "" -#: ../../library/telnetlib.rst:79 +#: ../../library/telnetlib.rst:80 msgid "" "Read until a given byte string, *expected*, is encountered or until " "*timeout* seconds have passed." msgstr "" -#: ../../library/telnetlib.rst:82 +#: ../../library/telnetlib.rst:83 msgid "" "When no match is found, return whatever is available instead, possibly empty " "bytes. Raise :exc:`EOFError` if the connection is closed and no cooked data " "is available." msgstr "" -#: ../../library/telnetlib.rst:89 +#: ../../library/telnetlib.rst:90 msgid "Read all data until EOF as bytes; block until connection closed." msgstr "" -#: ../../library/telnetlib.rst:94 +#: ../../library/telnetlib.rst:95 msgid "" "Read at least one byte of cooked data unless EOF is hit. Return ``b''`` if " "EOF is hit. Block if no data is immediately available." msgstr "" -#: ../../library/telnetlib.rst:100 +#: ../../library/telnetlib.rst:101 msgid "Read everything that can be without blocking in I/O (eager)." msgstr "" -#: ../../library/telnetlib.rst:102 ../../library/telnetlib.rst:111 +#: ../../library/telnetlib.rst:103 ../../library/telnetlib.rst:112 msgid "" "Raise :exc:`EOFError` if connection closed and no cooked data available. " "Return ``b''`` if no cooked data available otherwise. Do not block unless in " "the midst of an IAC sequence." msgstr "" -#: ../../library/telnetlib.rst:109 +#: ../../library/telnetlib.rst:110 msgid "Read readily available data." msgstr "" -#: ../../library/telnetlib.rst:118 +#: ../../library/telnetlib.rst:119 msgid "Process and return data already in the queues (lazy)." msgstr "" -#: ../../library/telnetlib.rst:120 +#: ../../library/telnetlib.rst:121 msgid "" "Raise :exc:`EOFError` if connection closed and no data available. Return " "``b''`` if no cooked data available otherwise. Do not block unless in the " "midst of an IAC sequence." msgstr "" -#: ../../library/telnetlib.rst:127 +#: ../../library/telnetlib.rst:128 msgid "Return any data available in the cooked queue (very lazy)." msgstr "" -#: ../../library/telnetlib.rst:129 +#: ../../library/telnetlib.rst:130 msgid "" "Raise :exc:`EOFError` if connection closed and no data available. Return " "``b''`` if no cooked data available otherwise. This method never blocks." msgstr "" -#: ../../library/telnetlib.rst:135 +#: ../../library/telnetlib.rst:136 msgid "" "Return the data collected between a SB/SE pair (suboption begin/end). The " "callback should access these data when it was invoked with a ``SE`` command. " "This method never blocks." msgstr "" -#: ../../library/telnetlib.rst:142 +#: ../../library/telnetlib.rst:143 msgid "" "Connect to a host. The optional second argument is the port number, which " "defaults to the standard Telnet port (23). The optional *timeout* parameter " @@ -179,73 +190,73 @@ msgid "" "attempt (if not specified, the global default timeout setting will be used)." msgstr "" -#: ../../library/telnetlib.rst:147 +#: ../../library/telnetlib.rst:148 msgid "Do not try to reopen an already connected instance." msgstr "" -#: ../../library/telnetlib.rst:149 +#: ../../library/telnetlib.rst:161 msgid "" "Raises an :ref:`auditing event ` ``telnetlib.Telnet.open`` with " "arguments ``self``, ``host``, ``port``." msgstr "" -#: ../../library/telnetlib.rst:154 +#: ../../library/telnetlib.rst:155 msgid "" "Print a debug message when the debug level is ``>`` 0. If extra arguments " "are present, they are substituted in the message using the standard string " "formatting operator." msgstr "" -#: ../../library/telnetlib.rst:161 +#: ../../library/telnetlib.rst:162 msgid "" "Set the debug level. The higher the value of *debuglevel*, the more debug " "output you get (on ``sys.stdout``)." msgstr "" -#: ../../library/telnetlib.rst:167 +#: ../../library/telnetlib.rst:168 msgid "Close the connection." msgstr "" -#: ../../library/telnetlib.rst:172 +#: ../../library/telnetlib.rst:173 msgid "Return the socket object used internally." msgstr "" -#: ../../library/telnetlib.rst:177 +#: ../../library/telnetlib.rst:178 msgid "Return the file descriptor of the socket object used internally." msgstr "" -#: ../../library/telnetlib.rst:182 +#: ../../library/telnetlib.rst:183 msgid "" "Write a byte string to the socket, doubling any IAC characters. This can " "block if the connection is blocked. May raise :exc:`OSError` if the " "connection is closed." msgstr "" -#: ../../library/telnetlib.rst:186 +#: ../../library/telnetlib.rst:198 msgid "" "Raises an :ref:`auditing event ` ``telnetlib.Telnet.write`` with " "arguments ``self``, ``buffer``." msgstr "" -#: ../../library/telnetlib.rst:188 +#: ../../library/telnetlib.rst:189 msgid "" "This method used to raise :exc:`socket.error`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/telnetlib.rst:195 +#: ../../library/telnetlib.rst:196 msgid "Interaction function, emulates a very dumb Telnet client." msgstr "" -#: ../../library/telnetlib.rst:200 +#: ../../library/telnetlib.rst:201 msgid "Multithreaded version of :meth:`interact`." msgstr "" -#: ../../library/telnetlib.rst:205 +#: ../../library/telnetlib.rst:206 msgid "Read until one from a list of a regular expressions matches." msgstr "" -#: ../../library/telnetlib.rst:207 +#: ../../library/telnetlib.rst:208 msgid "" "The first argument is a list of regular expressions, either compiled (:ref:" "`regex objects `) or uncompiled (byte strings). The optional " @@ -253,28 +264,28 @@ msgid "" "indefinitely." msgstr "" -#: ../../library/telnetlib.rst:212 +#: ../../library/telnetlib.rst:213 msgid "" "Return a tuple of three items: the index in the list of the first regular " "expression that matches; the match object returned; and the bytes read up " "till and including the match." msgstr "" -#: ../../library/telnetlib.rst:216 +#: ../../library/telnetlib.rst:217 msgid "" "If end of file is found and no bytes were read, raise :exc:`EOFError`. " "Otherwise, when nothing matches, return ``(-1, None, data)`` where *data* is " "the bytes received so far (may be empty bytes if a timeout happened)." msgstr "" -#: ../../library/telnetlib.rst:220 +#: ../../library/telnetlib.rst:221 msgid "" "If a regular expression ends with a greedy match (such as ``.*``) or if more " "than one expression can match the same input, the results are non-" "deterministic, and may depend on the I/O timing." msgstr "" -#: ../../library/telnetlib.rst:227 +#: ../../library/telnetlib.rst:228 msgid "" "Each time a telnet option is read on the input flow, this *callback* (if " "set) is called with the following parameters: callback(telnet socket, " @@ -282,10 +293,10 @@ msgid "" "telnetlib." msgstr "" -#: ../../library/telnetlib.rst:235 +#: ../../library/telnetlib.rst:236 msgid "Telnet Example" msgstr "Telnet 範例" -#: ../../library/telnetlib.rst:240 +#: ../../library/telnetlib.rst:241 msgid "A simple example illustrating typical use::" msgstr "" diff --git a/library/tempfile.po b/library/tempfile.po index 40d4ac81de..c11126289e 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-06-12 15:17+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -134,8 +134,8 @@ msgid "" msgstr "" "在不是 Posix 或 Cygwin 的平臺上,TemporaryFile 是 NamedTemporaryFile 的別名。" -#: ../../library/tempfile.rst:68 ../../library/tempfile.rst:93 -#: ../../library/tempfile.rst:197 +#: ../../library/tempfile.rst:68 ../../library/tempfile.rst:96 +#: ../../library/tempfile.rst:205 msgid "" "Raises an :ref:`auditing event ` ``tempfile.mkstemp`` with " "argument ``fullpath``." @@ -147,8 +147,8 @@ msgstr "" msgid "The :py:data:`os.O_TMPFILE` flag is now used if available." msgstr "如果可用,自此開始使用 :py:data:`os.O_TMPFILE` 旗標。" -#: ../../library/tempfile.rst:74 ../../library/tempfile.rst:95 -#: ../../library/tempfile.rst:120 +#: ../../library/tempfile.rst:74 ../../library/tempfile.rst:98 +#: ../../library/tempfile.rst:123 msgid "Added *errors* parameter." msgstr "新增 *errors* 參數。" @@ -173,7 +173,13 @@ msgstr "" "傳的物件始終是 file-like object,它的 :attr:`!file` 屬性是底層的真實檔案物" "件。file-like object 可以像普通檔案一樣在 :keyword:`with` 陳述句中使用。" -#: ../../library/tempfile.rst:101 +#: ../../library/tempfile.rst:93 +msgid "" +"On POSIX (only), a process that is terminated abruptly with SIGKILL cannot " +"automatically delete any NamedTemporaryFiles it created." +msgstr "" + +#: ../../library/tempfile.rst:104 msgid "" "This class operates exactly as :func:`TemporaryFile` does, except that data " "is spooled in memory until the file size exceeds *max_size*, or until the " @@ -184,7 +190,7 @@ msgstr "" "在記憶體中,直到檔案大小超過 *max_size*,或檔案的 :func:`fileno` 方法被呼叫為" "止,此時資料會被寫入磁碟,並且之後的操作與 :func:`TemporaryFile` 相同。" -#: ../../library/tempfile.rst:107 +#: ../../library/tempfile.rst:110 msgid "" "The resulting file has one additional method, :func:`rollover`, which causes " "the file to roll over to an on-disk file regardless of its size." @@ -192,7 +198,7 @@ msgstr "" "生成的檔案物件有一個額外的方法 :func:`rollover`,忽略檔案大小並立即將其寫入磁" "碟。" -#: ../../library/tempfile.rst:110 +#: ../../library/tempfile.rst:113 msgid "" "The returned object is a file-like object whose :attr:`_file` attribute is " "either an :class:`io.BytesIO` or :class:`io.TextIOWrapper` object (depending " @@ -205,12 +211,19 @@ msgstr "" "真實的檔案物件(取決於是否已呼叫 :func:`rollover`)。file-like object 可以像" "普通檔案一樣在 :keyword:`with` 陳述式中使用。" -#: ../../library/tempfile.rst:117 +#: ../../library/tempfile.rst:120 msgid "the truncate method now accepts a ``size`` argument." msgstr "現在,檔案的截斷方法 (truncate method) 可接受一個 ``size`` 引數。" #: ../../library/tempfile.rst:126 msgid "" +"Fully implements the :class:`io.BufferedIOBase` and :class:`io.TextIOBase` " +"abstract base classes (depending on whether binary or text *mode* was " +"specified)." +msgstr "" + +#: ../../library/tempfile.rst:134 +msgid "" "This class securely creates a temporary directory using the same rules as :" "func:`mkdtemp`. The resulting object can be used as a context manager (see :" "ref:`tempfile-examples`). On completion of the context or destruction of " @@ -221,7 +234,7 @@ msgstr "" "情境管理器使用(參見\\ :ref:`tempfile-examples`)。在完成情境或銷毀臨時目錄物" "件時,新建立的臨時目錄及其所有內容會從檔案系統中被移除。" -#: ../../library/tempfile.rst:132 +#: ../../library/tempfile.rst:140 msgid "" "The directory name can be retrieved from the :attr:`name` attribute of the " "returned object. When the returned object is used as a context manager, " @@ -232,7 +245,7 @@ msgstr "" "管理器時,這個 :attr:`name` 會作為 :keyword:`with` 陳述句中 :keyword:`!as` 子" "句的目標(如果有 as 的話)。" -#: ../../library/tempfile.rst:137 +#: ../../library/tempfile.rst:145 msgid "" "The directory can be explicitly cleaned up by calling the :func:`cleanup` " "method. If *ignore_cleanup_errors* is true, any unhandled exceptions during " @@ -250,7 +263,7 @@ msgstr "" "被引發(:func:`cleanup` 呼叫、退出情境管理器、物件被作為垃圾回收或直譯器關閉" "等)。" -#: ../../library/tempfile.rst:146 ../../library/tempfile.rst:223 +#: ../../library/tempfile.rst:154 ../../library/tempfile.rst:231 msgid "" "Raises an :ref:`auditing event ` ``tempfile.mkdtemp`` with " "argument ``fullpath``." @@ -258,11 +271,11 @@ msgstr "" "引發一個附帶引數 ``fullpath`` 的 ``tempfile.mkdtemp`` :ref:`稽核事件 " "`。" -#: ../../library/tempfile.rst:150 +#: ../../library/tempfile.rst:158 msgid "Added *ignore_cleanup_errors* parameter." msgstr "新增 *ignore_cleanup_errors* 參數。" -#: ../../library/tempfile.rst:156 +#: ../../library/tempfile.rst:164 msgid "" "Creates a temporary file in the most secure manner possible. There are no " "race conditions in the file's creation, assuming that the platform properly " @@ -277,7 +290,7 @@ msgstr "" "況。該檔案只能由建立者讀寫,如果所在平臺用 permission bit(許可權位元)來表示" "檔案是否可執行,則沒有人有執行權。檔案描述器不會被子行程繼承。" -#: ../../library/tempfile.rst:164 +#: ../../library/tempfile.rst:172 msgid "" "Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible for " "deleting the temporary file when done with it." @@ -285,7 +298,7 @@ msgstr "" "與 :func:`TemporaryFile` 不同,:func:`mkstemp` 使用者用完臨時檔案後需要自行將" "其刪除。" -#: ../../library/tempfile.rst:167 +#: ../../library/tempfile.rst:175 msgid "" "If *suffix* is not ``None``, the file name will end with that suffix, " "otherwise there will be no suffix. :func:`mkstemp` does not put a dot " @@ -296,7 +309,7 @@ msgstr "" "func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將其放" "在 *suffix* 的開頭。" -#: ../../library/tempfile.rst:172 +#: ../../library/tempfile.rst:180 msgid "" "If *prefix* is not ``None``, the file name will begin with that prefix; " "otherwise, a default prefix is used. The default is the return value of :" @@ -306,7 +319,7 @@ msgstr "" "綴。預設前綴是 :func:`gettempprefix` 或 :func:`gettempprefixb` 函式的回傳值" "(自動呼叫合適的函式)。" -#: ../../library/tempfile.rst:176 +#: ../../library/tempfile.rst:184 msgid "" "If *dir* is not ``None``, the file will be created in that directory; " "otherwise, a default directory is used. The default directory is chosen " @@ -322,7 +335,7 @@ msgstr "" "檔案路徑是使用者友善的,比如透過 ``os.popen()`` 將路徑傳遞給外部命令時仍需要" "加引號 (quoting)。" -#: ../../library/tempfile.rst:184 +#: ../../library/tempfile.rst:192 msgid "" "If any of *suffix*, *prefix*, and *dir* are not ``None``, they must be the " "same type. If they are bytes, the returned name will be bytes instead of " @@ -333,7 +346,7 @@ msgstr "" "型別相同。如果它們是位元組串,則回傳名稱的型別就是位元組串而非字串。如果不想" "遵循預設行為但又想要回傳值是位元組串型別,請傳入 ``suffix=b''``。" -#: ../../library/tempfile.rst:190 +#: ../../library/tempfile.rst:198 msgid "" "If *text* is specified and true, the file is opened in text mode. Otherwise, " "(the default) the file is opened in binary mode." @@ -341,7 +354,7 @@ msgstr "" "如果指定了 *text* 且為真值,檔案會以文字模式開啟。否則,檔案(預設)以二進位" "制模式開啟。" -#: ../../library/tempfile.rst:193 +#: ../../library/tempfile.rst:201 msgid "" ":func:`mkstemp` returns a tuple containing an OS-level handle to an open " "file (as would be returned by :func:`os.open`) and the absolute pathname of " @@ -351,7 +364,7 @@ msgstr "" "level) 控制代碼,指向一個開啟的檔案(如同 :func:`os.open` 的回傳值),第二元" "素是該檔案的絕對路徑。" -#: ../../library/tempfile.rst:199 ../../library/tempfile.rst:225 +#: ../../library/tempfile.rst:207 ../../library/tempfile.rst:233 msgid "" "*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to " "obtain a bytes return value. Prior to this, only str was allowed. *suffix* " @@ -362,11 +375,11 @@ msgstr "" "串型別的回傳值。在之前只允許使用字串。*suffix* 和 *prefix* 現在可以接受 " "``None``,並且預設為 ``None`` 以使用合適的預設值。" -#: ../../library/tempfile.rst:205 ../../library/tempfile.rst:231 +#: ../../library/tempfile.rst:213 ../../library/tempfile.rst:239 msgid "The *dir* parameter now accepts a :term:`path-like object`." msgstr "*dir* 參數現在可接受一個類路徑物件 (:term:`path-like object`)。" -#: ../../library/tempfile.rst:211 +#: ../../library/tempfile.rst:219 msgid "" "Creates a temporary directory in the most secure manner possible. There are " "no race conditions in the directory's creation. The directory is readable, " @@ -375,54 +388,54 @@ msgstr "" "盡可能以最安全的方式建立一個臨時目錄,建立該目錄時不會有 race condition 的情" "況,該目錄只能由建立者讀取、寫入和搜尋。" -#: ../../library/tempfile.rst:215 +#: ../../library/tempfile.rst:223 msgid "" "The user of :func:`mkdtemp` is responsible for deleting the temporary " "directory and its contents when done with it." msgstr ":func:`mkdtemp` 的使用者用完臨時目錄後需要自行將其刪除。" -#: ../../library/tempfile.rst:218 +#: ../../library/tempfile.rst:226 msgid "" "The *prefix*, *suffix*, and *dir* arguments are the same as for :func:" "`mkstemp`." msgstr "" "引數 *prefix*、*suffix* 和 *dir* 的含義與它們在 :func:`mkstemp` 中相同。" -#: ../../library/tempfile.rst:221 +#: ../../library/tempfile.rst:229 msgid ":func:`mkdtemp` returns the absolute pathname of the new directory." msgstr ":func:`mkdtemp` 回傳新目錄的絕對路徑。" -#: ../../library/tempfile.rst:237 +#: ../../library/tempfile.rst:245 msgid "" "Return the name of the directory used for temporary files. This defines the " "default value for the *dir* argument to all functions in this module." msgstr "" "回傳儲存臨時檔案的目錄名稱。這設定了此 module 所有函式 *dir* 引數的預設值。" -#: ../../library/tempfile.rst:241 +#: ../../library/tempfile.rst:249 msgid "" "Python searches a standard list of directories to find one which the calling " "user can create files in. The list is:" msgstr "" "Python 搜尋標準目錄列表來找到呼叫者可以在其中建立檔案的目錄。這個列表是:" -#: ../../library/tempfile.rst:244 +#: ../../library/tempfile.rst:252 msgid "The directory named by the :envvar:`TMPDIR` environment variable." msgstr ":envvar:`TMPDIR` 環境變數指向的目錄。" -#: ../../library/tempfile.rst:246 +#: ../../library/tempfile.rst:254 msgid "The directory named by the :envvar:`TEMP` environment variable." msgstr ":envvar:`TEMP` 環境變數指向的目錄。" -#: ../../library/tempfile.rst:248 +#: ../../library/tempfile.rst:256 msgid "The directory named by the :envvar:`TMP` environment variable." msgstr ":envvar:`TMP` 環境變數指向的目錄。" -#: ../../library/tempfile.rst:250 +#: ../../library/tempfile.rst:258 msgid "A platform-specific location:" msgstr "與平臺相關的位置:" -#: ../../library/tempfile.rst:252 +#: ../../library/tempfile.rst:260 msgid "" "On Windows, the directories :file:`C:\\\\TEMP`, :file:`C:\\\\TMP`, :file:`\\" "\\TEMP`, and :file:`\\\\TMP`, in that order." @@ -430,7 +443,7 @@ msgstr "" "在 Windows 上,目錄依次為 :file:`C:\\\\TEMP`、:file:`C:\\\\TMP`、:file:`\\" "\\TEMP` 和 :file:`\\\\TMP`。" -#: ../../library/tempfile.rst:255 +#: ../../library/tempfile.rst:263 msgid "" "On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :" "file:`/usr/tmp`, in that order." @@ -438,17 +451,17 @@ msgstr "" "在所有其他平臺上,目錄依次為 :file:`/tmp`、:file:`/var/tmp` 和 :file:`/usr/" "tmp`。" -#: ../../library/tempfile.rst:258 +#: ../../library/tempfile.rst:266 msgid "As a last resort, the current working directory." msgstr "不得已時,使用當前工作目錄。" -#: ../../library/tempfile.rst:260 +#: ../../library/tempfile.rst:268 msgid "" "The result of this search is cached, see the description of :data:`tempdir` " "below." msgstr "搜尋的結果會被 cache(快取)起來,請見下面 :data:`tempdir` 的描述。" -#: ../../library/tempfile.rst:265 +#: ../../library/tempfile.rst:273 msgid "" "Always returns a str. Previously it would return any :data:`tempdir` value " "regardless of type so long as it was not ``None``." @@ -456,21 +469,21 @@ msgstr "" "回傳一個字串。在之前的版本中它會回傳任意 :data:`tempdir` 的值而不考慮它的型" "別,只要它不為 ``None``。" -#: ../../library/tempfile.rst:270 +#: ../../library/tempfile.rst:278 msgid "Same as :func:`gettempdir` but the return value is in bytes." msgstr "與 :func:`gettempdir` 相同,但回傳值為位元組串型別。" -#: ../../library/tempfile.rst:276 +#: ../../library/tempfile.rst:284 msgid "" "Return the filename prefix used to create temporary files. This does not " "contain the directory component." msgstr "回傳用於建立臨時檔案的檔名前綴,它不包含目錄部分。" -#: ../../library/tempfile.rst:281 +#: ../../library/tempfile.rst:289 msgid "Same as :func:`gettempprefix` but the return value is in bytes." msgstr "與 :func:`gettempprefix` 相同,但回傳值為位元組串型別。" -#: ../../library/tempfile.rst:285 +#: ../../library/tempfile.rst:293 msgid "" "The module uses a global variable to store the name of the directory used " "for temporary files returned by :func:`gettempdir`. It can be set directly " @@ -484,7 +497,7 @@ msgstr "" "式都接受一個 *dir* 引數,它可被用於指定目錄。這是個推薦的做法,它不會透過改變" "全域性 API 行為而對其他不預期此行為的程式造成影響。" -#: ../../library/tempfile.rst:294 +#: ../../library/tempfile.rst:302 msgid "" "When set to a value other than ``None``, this variable defines the default " "value for the *dir* argument to the functions defined in this module, " @@ -494,7 +507,7 @@ msgstr "" "預設值,包括確定其型別為位元組串還是字串。它不可以為 :term:`path-like " "object`。" -#: ../../library/tempfile.rst:299 +#: ../../library/tempfile.rst:307 msgid "" "If ``tempdir`` is ``None`` (the default) at any call to any of the above " "functions except :func:`gettempprefix` it is initialized following the " @@ -503,7 +516,7 @@ msgstr "" "如果在呼叫除 :func:`gettempprefix` 外的上述任何函式時 ``tempdir`` 為 " "``None`` (預設值) 則它會按照 :func:`gettempdir` 中所描述的演算法來初始化。" -#: ../../library/tempfile.rst:305 +#: ../../library/tempfile.rst:313 msgid "" "Beware that if you set ``tempdir`` to a bytes value, there is a nasty side " "effect: The global default return type of :func:`mkstemp` and :func:" @@ -517,22 +530,22 @@ msgstr "" "``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此行為或依" "賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" -#: ../../library/tempfile.rst:316 +#: ../../library/tempfile.rst:324 msgid "Examples" msgstr "範例" -#: ../../library/tempfile.rst:318 +#: ../../library/tempfile.rst:326 msgid "Here are some examples of typical usage of the :mod:`tempfile` module::" msgstr "" "以下是 :mod:`tempfile` module 的一些常見用法範例:\n" "\n" "::" -#: ../../library/tempfile.rst:350 +#: ../../library/tempfile.rst:358 msgid "Deprecated functions and variables" msgstr "已棄用的函式和變數" -#: ../../library/tempfile.rst:352 +#: ../../library/tempfile.rst:360 msgid "" "A historical way to create temporary files was to first generate a file name " "with the :func:`mktemp` function and then create a file using this name. " @@ -547,11 +560,11 @@ msgstr "" "之間的時間裡,其他程式可能會使用該名稱建立檔案。解決方案是將兩個步驟結合起" "來,並立即建立檔案。這個方案目前被 :func:`mkstemp` 和上述其他函式所採用。" -#: ../../library/tempfile.rst:363 +#: ../../library/tempfile.rst:371 msgid "Use :func:`mkstemp` instead." msgstr "使用 :func:`mkstemp` 代替。" -#: ../../library/tempfile.rst:366 +#: ../../library/tempfile.rst:374 msgid "" "Return an absolute pathname of a file that did not exist at the time the " "call is made. The *prefix*, *suffix*, and *dir* arguments are similar to " @@ -562,7 +575,7 @@ msgstr "" "與 :func:`mkstemp` 中所用的類似,除了在於不支援位元組串型別的檔名且不支援 " "``suffix=None`` 和 ``prefix=None``。" -#: ../../library/tempfile.rst:373 +#: ../../library/tempfile.rst:381 msgid "" "Use of this function may introduce a security hole in your program. By the " "time you get around to doing anything with the file name it returns, someone " diff --git a/library/termios.po b/library/termios.po index 48c856e99d..64ea4d2942 100644 --- a/library/termios.po +++ b/library/termios.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-11-05 17:14+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -96,18 +96,34 @@ msgid "" msgstr "" #: ../../library/termios.rst:79 +msgid "" +"Return a tuple ``(ws_row, ws_col)`` containing the tty window size for file " +"descriptor *fd*. Requires :const:`termios.TIOCGWINSZ` or :const:`termios." +"TIOCGSIZE`." +msgstr "" + +#: ../../library/termios.rst:88 +msgid "" +"Set the tty window size for file descriptor *fd* from *winsize*, which is a " +"two-item tuple ``(ws_row, ws_col)`` like the one returned by :func:" +"`tcgetwinsize`. Requires at least one of the pairs (:const:`termios." +"TIOCGWINSZ`, :const:`termios.TIOCSWINSZ`); (:const:`termios.TIOCGSIZE`, :" +"const:`termios.TIOCSSIZE`) to be defined." +msgstr "" + +#: ../../library/termios.rst:99 msgid "Module :mod:`tty`" msgstr ":mod:`tty` 模組" -#: ../../library/termios.rst:80 +#: ../../library/termios.rst:100 msgid "Convenience functions for common terminal control operations." msgstr "" -#: ../../library/termios.rst:86 +#: ../../library/termios.rst:106 msgid "Example" msgstr "範例" -#: ../../library/termios.rst:88 +#: ../../library/termios.rst:108 msgid "" "Here's a function that prompts for a password with echoing turned off. Note " "the technique using a separate :func:`tcgetattr` call and a :keyword:" diff --git a/library/test.po b/library/test.po index 59b82a7746..a252ce1480 100644 --- a/library/test.po +++ b/library/test.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-02 00:25+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -631,7 +631,7 @@ msgid "Context manager to swap out an attribute with a new object." msgstr "" #: ../../library/test.rst:581 ../../library/test.rst:599 -#: ../../library/test.rst:819 ../../library/test.rst:1292 +#: ../../library/test.rst:828 ../../library/test.rst:1301 msgid "Usage::" msgstr "" "用法:\n" @@ -664,64 +664,71 @@ msgstr "" #: ../../library/test.rst:615 msgid "" +"Call the ``flush()`` method on :data:`sys.stdout` and then on :data:`sys." +"stderr`. It can be used to make sure that the logs order is consistent " +"before writing into stderr." +msgstr "" + +#: ../../library/test.rst:624 +msgid "" "Print a warning into :data:`sys.__stderr__`. Format the message as: ``f" "\"Warning -- {msg}\"``. If *msg* is made of multiple lines, add ``\"Warning " "-- \"`` prefix to each line." msgstr "" -#: ../../library/test.rst:624 +#: ../../library/test.rst:633 msgid "" "Wait until process *pid* completes and check that the process exit code is " "*exitcode*." msgstr "" -#: ../../library/test.rst:627 +#: ../../library/test.rst:636 msgid "" "Raise an :exc:`AssertionError` if the process exit code is not equal to " "*exitcode*." msgstr "" -#: ../../library/test.rst:630 +#: ../../library/test.rst:639 msgid "" "If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by " "default), kill the process and raise an :exc:`AssertionError`. The timeout " "feature is not available on Windows." msgstr "" -#: ../../library/test.rst:639 +#: ../../library/test.rst:648 msgid "" "Return the size of the :c:type:`PyObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" -#: ../../library/test.rst:645 +#: ../../library/test.rst:654 msgid "" "Return the size of the :c:type:`PyVarObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" -#: ../../library/test.rst:651 +#: ../../library/test.rst:660 msgid "" "For testcase *test*, assert that the ``sys.getsizeof`` for *o* plus the GC " "header size equals *size*." msgstr "" -#: ../../library/test.rst:657 +#: ../../library/test.rst:666 msgid "" "A decorator to conditionally mark tests with :func:`unittest." "expectedFailure`. Any use of this decorator should have an associated " "comment identifying the relevant tracker issue." msgstr "" -#: ../../library/test.rst:664 +#: ../../library/test.rst:673 msgid "" "A decorator that skips the decorated test on TLS certification validation " "failures." msgstr "" -#: ../../library/test.rst:669 +#: ../../library/test.rst:678 msgid "" "A decorator for running a function in a different locale, correctly " "resetting it after it has finished. *catstr* is the locale category as a " @@ -729,73 +736,73 @@ msgid "" "sequentially, and the first valid locale will be used." msgstr "" -#: ../../library/test.rst:677 +#: ../../library/test.rst:686 msgid "" "A decorator for running a function in a specific timezone, correctly " "resetting it after it has finished." msgstr "" -#: ../../library/test.rst:683 +#: ../../library/test.rst:692 msgid "" "Decorator for the minimum version when running test on FreeBSD. If the " "FreeBSD version is less than the minimum, the test is skipped." msgstr "" -#: ../../library/test.rst:689 +#: ../../library/test.rst:698 msgid "" "Decorator for the minimum version when running test on Linux. If the Linux " "version is less than the minimum, the test is skipped." msgstr "" -#: ../../library/test.rst:695 +#: ../../library/test.rst:704 msgid "" "Decorator for the minimum version when running test on macOS. If the macOS " "version is less than the minimum, the test is skipped." msgstr "" -#: ../../library/test.rst:701 +#: ../../library/test.rst:710 msgid "Decorator for skipping tests on non-IEEE 754 platforms." msgstr "" -#: ../../library/test.rst:706 +#: ../../library/test.rst:715 msgid "Decorator for skipping tests if :mod:`zlib` doesn't exist." msgstr "" -#: ../../library/test.rst:711 +#: ../../library/test.rst:720 msgid "Decorator for skipping tests if :mod:`gzip` doesn't exist." msgstr "" -#: ../../library/test.rst:716 +#: ../../library/test.rst:725 msgid "Decorator for skipping tests if :mod:`bz2` doesn't exist." msgstr "" -#: ../../library/test.rst:721 +#: ../../library/test.rst:730 msgid "Decorator for skipping tests if :mod:`lzma` doesn't exist." msgstr "" -#: ../../library/test.rst:726 +#: ../../library/test.rst:735 msgid "Decorator for skipping tests if *resource* is not available." msgstr "" -#: ../../library/test.rst:731 +#: ../../library/test.rst:740 msgid "Decorator for only running the test if :data:`HAVE_DOCSTRINGS`." msgstr "" -#: ../../library/test.rst:736 +#: ../../library/test.rst:745 msgid "Decorator for tests only applicable to CPython." msgstr "" -#: ../../library/test.rst:741 +#: ../../library/test.rst:750 msgid "" "Decorator for invoking :func:`check_impl_detail` on *guards*. If that " "returns ``False``, then uses *msg* as the reason for skipping the test." msgstr "" -#: ../../library/test.rst:747 +#: ../../library/test.rst:756 msgid "Decorator to temporarily turn off tracing for the duration of the test." msgstr "" -#: ../../library/test.rst:752 +#: ../../library/test.rst:761 msgid "" "Decorator for tests which involve reference counting. The decorator does " "not run the test if it is not run by CPython. Any trace function is unset " @@ -803,11 +810,11 @@ msgid "" "trace function." msgstr "" -#: ../../library/test.rst:760 +#: ../../library/test.rst:769 msgid "Decorator for bigmem tests." msgstr "" -#: ../../library/test.rst:762 +#: ../../library/test.rst:771 msgid "" "*size* is a requested size for the test (in arbitrary, test-interpreted " "units.) *memuse* is the number of bytes per unit for the test, or a good " @@ -815,7 +822,7 @@ msgid "" "each, could be decorated with ``@bigmemtest(size=_4G, memuse=2)``." msgstr "" -#: ../../library/test.rst:767 +#: ../../library/test.rst:776 msgid "" "The *size* argument is normally passed to the decorated test method as an " "extra argument. If *dry_run* is ``True``, the value passed to the test " @@ -823,11 +830,11 @@ msgid "" "means the test doesn't support dummy runs when ``-M`` is not specified." msgstr "" -#: ../../library/test.rst:775 +#: ../../library/test.rst:784 msgid "Decorator for tests that fill the address space." msgstr "" -#: ../../library/test.rst:780 +#: ../../library/test.rst:789 msgid "" "Test for syntax errors in *statement* by attempting to compile *statement*. " "*testcase* is the :mod:`unittest` instance for the test. *errtext* is the " @@ -837,44 +844,44 @@ msgid "" "of the exception." msgstr "" -#: ../../library/test.rst:790 +#: ../../library/test.rst:799 msgid "Open *url*. If open fails, raises :exc:`TestFailed`." msgstr "" -#: ../../library/test.rst:795 +#: ../../library/test.rst:804 msgid "" "Use this at the end of ``test_main`` whenever sub-processes are started. " "This will help ensure that no extra children (zombies) stick around to hog " "resources and create problems when looking for refleaks." msgstr "" -#: ../../library/test.rst:802 +#: ../../library/test.rst:811 msgid "" "Get an attribute, raising :exc:`unittest.SkipTest` if :exc:`AttributeError` " "is raised." msgstr "" -#: ../../library/test.rst:808 +#: ../../library/test.rst:817 msgid "" "Context manager catching unraisable exception using :func:`sys." "unraisablehook`." msgstr "" -#: ../../library/test.rst:811 +#: ../../library/test.rst:820 msgid "" "Storing the exception value (``cm.unraisable.exc_value``) creates a " "reference cycle. The reference cycle is broken explicitly when the context " "manager exits." msgstr "" -#: ../../library/test.rst:815 +#: ../../library/test.rst:824 msgid "" "Storing the object (``cm.unraisable.object``) can resurrect it if it is set " "to an object which is being finalized. Exiting the context manager clears " "the stored object." msgstr "" -#: ../../library/test.rst:836 +#: ../../library/test.rst:845 msgid "" "Generic implementation of the :mod:`unittest` ``load_tests`` protocol for " "use in test packages. *pkg_dir* is the root directory of the package; " @@ -883,55 +890,55 @@ msgid "" "the following::" msgstr "" -#: ../../library/test.rst:851 +#: ../../library/test.rst:860 msgid "" "Returns the set of attributes, functions or methods of *ref_api* not found " "on *other_api*, except for a defined list of items to be ignored in this " "check specified in *ignore*." msgstr "" -#: ../../library/test.rst:855 +#: ../../library/test.rst:864 msgid "" "By default this skips private attributes beginning with '_' but includes all " "magic methods, i.e. those starting and ending in '__'." msgstr "" -#: ../../library/test.rst:863 +#: ../../library/test.rst:872 msgid "" "Override *object_to_patch.attr_name* with *new_value*. Also add cleanup " "procedure to *test_instance* to restore *object_to_patch* for *attr_name*. " "The *attr_name* should be a valid attribute for *object_to_patch*." msgstr "" -#: ../../library/test.rst:871 +#: ../../library/test.rst:880 msgid "" "Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` if :mod:" "`tracemalloc` is enabled." msgstr "" -#: ../../library/test.rst:877 +#: ../../library/test.rst:886 msgid "Assert instances of *cls* are deallocated after iterating." msgstr "" -#: ../../library/test.rst:882 +#: ../../library/test.rst:891 msgid "" "Check for the existence of the compiler executables whose names are listed " "in *cmd_names* or all the compiler executables when *cmd_names* is empty and " "return the first missing executable or ``None`` when none is found missing." msgstr "" -#: ../../library/test.rst:890 +#: ../../library/test.rst:899 msgid "" "Assert that the ``__all__`` variable of *module* contains all public names." msgstr "" -#: ../../library/test.rst:892 +#: ../../library/test.rst:901 msgid "" "The module's public names (its API) are detected automatically based on " "whether they match the public name convention and were defined in *module*." msgstr "" -#: ../../library/test.rst:896 +#: ../../library/test.rst:905 msgid "" "The *name_of_module* argument can specify (as a string or tuple thereof) " "what module(s) an API could be defined in order to be detected as a public " @@ -939,7 +946,7 @@ msgid "" "other modules, possibly a C backend (like ``csv`` and its ``_csv``)." msgstr "" -#: ../../library/test.rst:901 +#: ../../library/test.rst:910 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " "automatically detected as \"public\", like objects without a proper " @@ -947,31 +954,31 @@ msgid "" "detected ones." msgstr "" -#: ../../library/test.rst:905 +#: ../../library/test.rst:914 msgid "" "The *not_exported* argument can be a set of names that must not be treated " "as part of the public API even though their names indicate otherwise." msgstr "" -#: ../../library/test.rst:908 ../../library/test.rst:1541 +#: ../../library/test.rst:917 ../../library/test.rst:1550 msgid "Example use::" msgstr "" "用法範例:\n" "\n" "::" -#: ../../library/test.rst:931 +#: ../../library/test.rst:940 msgid "" "Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if " "there is no available semaphore implementation, or if creating a lock raises " "an :exc:`OSError`." msgstr "" -#: ../../library/test.rst:940 +#: ../../library/test.rst:949 msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" -#: ../../library/test.rst:947 +#: ../../library/test.rst:956 msgid "" "This function returns a context manager that will change the global :func:" "`sys.set_int_max_str_digits` setting for the duration of the context to " @@ -979,76 +986,76 @@ msgid "" "digits when converting between an integer and string." msgstr "" -#: ../../library/test.rst:955 +#: ../../library/test.rst:964 msgid "The :mod:`test.support` module defines the following classes:" msgstr "" -#: ../../library/test.rst:960 +#: ../../library/test.rst:969 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" -#: ../../library/test.rst:963 +#: ../../library/test.rst:972 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" -#: ../../library/test.rst:966 +#: ../../library/test.rst:975 msgid "" "On UNIX, :func:`resource.setrlimit` is used to set :attr:`resource." "RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." msgstr "" -#: ../../library/test.rst:970 +#: ../../library/test.rst:979 msgid "On both platforms, the old value is restored by :meth:`__exit__`." msgstr "" -#: ../../library/test.rst:975 +#: ../../library/test.rst:984 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" -#: ../../library/test.rst:980 +#: ../../library/test.rst:989 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" -#: ../../library/test.rst:985 +#: ../../library/test.rst:994 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" -#: ../../library/test.rst:993 +#: ../../library/test.rst:1002 msgid "Try to match a single dict with the supplied arguments." msgstr "" -#: ../../library/test.rst:998 +#: ../../library/test.rst:1007 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" -#: ../../library/test.rst:1005 +#: ../../library/test.rst:1014 msgid "Run *test* and return the result." msgstr "" -#: ../../library/test.rst:1009 +#: ../../library/test.rst:1018 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" msgstr "" -#: ../../library/test.rst:1015 +#: ../../library/test.rst:1024 msgid "" "The :mod:`test.support.socket_helper` module provides support for socket " "tests." msgstr "" -#: ../../library/test.rst:1022 +#: ../../library/test.rst:1031 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1027 +#: ../../library/test.rst:1036 msgid "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " @@ -1059,7 +1066,7 @@ msgid "" "port is returned." msgstr "" -#: ../../library/test.rst:1036 +#: ../../library/test.rst:1045 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " @@ -1072,7 +1079,7 @@ msgid "" "simultaneously, which is a problem for buildbots." msgstr "" -#: ../../library/test.rst:1050 +#: ../../library/test.rst:1059 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " @@ -1085,7 +1092,7 @@ msgid "" "testing multicasting via multiple UDP sockets." msgstr "" -#: ../../library/test.rst:1061 +#: ../../library/test.rst:1070 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " @@ -1093,58 +1100,58 @@ msgid "" "test." msgstr "" -#: ../../library/test.rst:1069 +#: ../../library/test.rst:1078 msgid "" "Bind a Unix socket, raising :exc:`unittest.SkipTest` if :exc:" "`PermissionError` is raised." msgstr "" -#: ../../library/test.rst:1075 +#: ../../library/test.rst:1084 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" -#: ../../library/test.rst:1081 +#: ../../library/test.rst:1090 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" -#: ../../library/test.rst:1087 +#: ../../library/test.rst:1096 msgid "" ":mod:`test.support.script_helper` --- Utilities for the Python execution " "tests" msgstr "" -#: ../../library/test.rst:1093 +#: ../../library/test.rst:1102 msgid "" "The :mod:`test.support.script_helper` module provides support for Python's " "script execution tests." msgstr "" -#: ../../library/test.rst:1098 +#: ../../library/test.rst:1107 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" -#: ../../library/test.rst:1101 +#: ../../library/test.rst:1110 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" -#: ../../library/test.rst:1105 +#: ../../library/test.rst:1114 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" -#: ../../library/test.rst:1109 +#: ../../library/test.rst:1118 msgid "" "Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run " "in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are " @@ -1152,85 +1159,85 @@ msgid "" "interpreter can start." msgstr "" -#: ../../library/test.rst:1117 +#: ../../library/test.rst:1126 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" -#: ../../library/test.rst:1121 ../../library/test.rst:1137 -#: ../../library/test.rst:1149 +#: ../../library/test.rst:1130 ../../library/test.rst:1146 +#: ../../library/test.rst:1158 msgid "The function no longer strips whitespaces from *stderr*." msgstr "" -#: ../../library/test.rst:1127 +#: ../../library/test.rst:1136 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1131 +#: ../../library/test.rst:1140 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" -#: ../../library/test.rst:1134 +#: ../../library/test.rst:1143 msgid "" "Python is started in isolated mode (command line option ``-I``), except if " "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: ../../library/test.rst:1143 +#: ../../library/test.rst:1152 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1147 +#: ../../library/test.rst:1156 msgid "See :func:`assert_python_ok` for more options." msgstr "更多選項請見 :func:`assert_python_ok`\\ 。" -#: ../../library/test.rst:1155 +#: ../../library/test.rst:1164 msgid "Run a Python subprocess with the given arguments." msgstr "" -#: ../../library/test.rst:1157 +#: ../../library/test.rst:1166 msgid "" "*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" "class:`subprocess.Popen` object." msgstr "" -#: ../../library/test.rst:1163 +#: ../../library/test.rst:1172 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" -#: ../../library/test.rst:1169 +#: ../../library/test.rst:1178 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" -#: ../../library/test.rst:1176 +#: ../../library/test.rst:1185 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" -#: ../../library/test.rst:1183 +#: ../../library/test.rst:1192 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" -#: ../../library/test.rst:1190 +#: ../../library/test.rst:1199 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1239,60 +1246,60 @@ msgid "" "path and the archive name for the zip file." msgstr "" -#: ../../library/test.rst:1198 +#: ../../library/test.rst:1207 msgid "" ":mod:`test.support.bytecode_helper` --- Support tools for testing correct " "bytecode generation" msgstr "" -#: ../../library/test.rst:1203 +#: ../../library/test.rst:1212 msgid "" "The :mod:`test.support.bytecode_helper` module provides support for testing " "and inspecting bytecode generation." msgstr "" -#: ../../library/test.rst:1208 +#: ../../library/test.rst:1217 msgid "The module defines the following class:" msgstr "" -#: ../../library/test.rst:1212 +#: ../../library/test.rst:1221 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" -#: ../../library/test.rst:1216 +#: ../../library/test.rst:1225 msgid "Return the disassembly of *co* as string." msgstr "" -#: ../../library/test.rst:1221 +#: ../../library/test.rst:1230 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" -#: ../../library/test.rst:1226 +#: ../../library/test.rst:1235 msgid "Throws :exc:`AssertionError` if *opname* is found." msgstr "" -#: ../../library/test.rst:1230 +#: ../../library/test.rst:1239 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" msgstr "" -#: ../../library/test.rst:1235 +#: ../../library/test.rst:1244 msgid "" "The :mod:`test.support.threading_helper` module provides support for " "threading tests." msgstr "" -#: ../../library/test.rst:1242 +#: ../../library/test.rst:1251 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" -#: ../../library/test.rst:1248 +#: ../../library/test.rst:1257 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" -#: ../../library/test.rst:1253 +#: ../../library/test.rst:1262 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " @@ -1300,79 +1307,79 @@ msgid "" "will attempt to join the started threads upon exit." msgstr "" -#: ../../library/test.rst:1261 +#: ../../library/test.rst:1270 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" -#: ../../library/test.rst:1267 +#: ../../library/test.rst:1276 msgid "Return current thread count and copy of dangling threads." msgstr "" -#: ../../library/test.rst:1272 +#: ../../library/test.rst:1281 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" -#: ../../library/test.rst:1278 +#: ../../library/test.rst:1287 msgid "" "Context manager catching :class:`threading.Thread` exception using :func:" "`threading.excepthook`." msgstr "" -#: ../../library/test.rst:1281 +#: ../../library/test.rst:1290 msgid "Attributes set when an exception is caught:" msgstr "" -#: ../../library/test.rst:1283 +#: ../../library/test.rst:1292 msgid "``exc_type``" msgstr "``exc_type``" -#: ../../library/test.rst:1284 +#: ../../library/test.rst:1293 msgid "``exc_value``" msgstr "``exc_value``" -#: ../../library/test.rst:1285 +#: ../../library/test.rst:1294 msgid "``exc_traceback``" msgstr "``exc_traceback``" -#: ../../library/test.rst:1286 +#: ../../library/test.rst:1295 msgid "``thread``" msgstr "``thread``" -#: ../../library/test.rst:1288 +#: ../../library/test.rst:1297 msgid "See :func:`threading.excepthook` documentation." msgstr "參閱 :func:`threading.excepthook` 文件。" -#: ../../library/test.rst:1290 +#: ../../library/test.rst:1299 msgid "These attributes are deleted at the context manager exit." msgstr "" -#: ../../library/test.rst:1310 +#: ../../library/test.rst:1319 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" msgstr "" -#: ../../library/test.rst:1315 +#: ../../library/test.rst:1324 msgid "The :mod:`test.support.os_helper` module provides support for os tests." msgstr "" -#: ../../library/test.rst:1322 +#: ../../library/test.rst:1331 msgid "A non-ASCII character encodable by :func:`os.fsencode`." msgstr "" -#: ../../library/test.rst:1327 +#: ../../library/test.rst:1336 msgid "Set to :func:`os.getcwd`." msgstr "" -#: ../../library/test.rst:1332 +#: ../../library/test.rst:1341 msgid "" "Set to a name that is safe to use as the name of a temporary file. Any " "temporary file that is created should be closed and unlinked (removed)." msgstr "" -#: ../../library/test.rst:1338 +#: ../../library/test.rst:1347 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " @@ -1380,25 +1387,25 @@ msgid "" "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" -#: ../../library/test.rst:1346 +#: ../../library/test.rst:1355 msgid "" "Set to a filename (str type) that should not be able to be encoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1353 +#: ../../library/test.rst:1362 msgid "" "Set to a filename (bytes type) that should not be able to be decoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1360 +#: ../../library/test.rst:1369 msgid "Set to a non-ASCII name for a temporary file." msgstr "" -#: ../../library/test.rst:1365 +#: ../../library/test.rst:1374 msgid "" "Class used to temporarily set or unset environment variables. Instances can " "be used as a context manager and have a complete dictionary interface for " @@ -1407,75 +1414,75 @@ msgid "" "instance will be rolled back." msgstr "" -#: ../../library/test.rst:1371 +#: ../../library/test.rst:1380 msgid "Added dictionary interface." msgstr "" -#: ../../library/test.rst:1377 +#: ../../library/test.rst:1386 msgid "" "Simple :term:`path-like object`. It implements the :meth:`__fspath__` " "method which just returns the *path* argument. If *path* is an exception, " "it will be raised in :meth:`!__fspath__`." msgstr "" -#: ../../library/test.rst:1384 +#: ../../library/test.rst:1393 msgid "" "Temporarily set the environment variable ``envvar`` to the value of " "``value``." msgstr "" -#: ../../library/test.rst:1390 +#: ../../library/test.rst:1399 msgid "Temporarily unset the environment variable ``envvar``." msgstr "" -#: ../../library/test.rst:1395 +#: ../../library/test.rst:1404 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1401 +#: ../../library/test.rst:1410 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1407 +#: ../../library/test.rst:1416 msgid "" "A context manager that temporarily changes the current working directory to " "*path* and yields the directory." msgstr "" -#: ../../library/test.rst:1410 +#: ../../library/test.rst:1419 msgid "" "If *quiet* is ``False``, the context manager raises an exception on error. " "Otherwise, it issues only a warning and keeps the current working directory " "the same." msgstr "" -#: ../../library/test.rst:1417 +#: ../../library/test.rst:1426 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" -#: ../../library/test.rst:1422 +#: ../../library/test.rst:1431 msgid "Count the number of open file descriptors." msgstr "" -#: ../../library/test.rst:1427 +#: ../../library/test.rst:1436 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" -#: ../../library/test.rst:1432 +#: ../../library/test.rst:1441 msgid "" "Create an invalid file descriptor by opening and closing a temporary file, " "and returning its descriptor." msgstr "" -#: ../../library/test.rst:1438 +#: ../../library/test.rst:1447 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" -#: ../../library/test.rst:1446 +#: ../../library/test.rst:1455 msgid "" "Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." "rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " @@ -1483,21 +1490,21 @@ msgid "" "the files." msgstr "" -#: ../../library/test.rst:1454 +#: ../../library/test.rst:1463 msgid "A decorator for running tests that require support for symbolic links." msgstr "" -#: ../../library/test.rst:1459 +#: ../../library/test.rst:1468 msgid "A decorator for running tests that require support for xattr." msgstr "" -#: ../../library/test.rst:1464 +#: ../../library/test.rst:1473 msgid "" "A context manager that temporarily creates a new directory and changes the " "current working directory (CWD)." msgstr "" -#: ../../library/test.rst:1467 +#: ../../library/test.rst:1476 msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " @@ -1505,20 +1512,20 @@ msgid "" "`tempfile.mkdtemp`." msgstr "" -#: ../../library/test.rst:1472 +#: ../../library/test.rst:1481 msgid "" "If *quiet* is ``False`` and it is not possible to create or change the CWD, " "an error is raised. Otherwise, only a warning is raised and the original " "CWD is used." msgstr "" -#: ../../library/test.rst:1479 +#: ../../library/test.rst:1488 msgid "" "A context manager that creates a temporary directory at *path* and yields " "the directory." msgstr "" -#: ../../library/test.rst:1482 +#: ../../library/test.rst:1491 msgid "" "If *path* is ``None``, the temporary directory is created using :func:" "`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " @@ -1526,34 +1533,34 @@ msgid "" "created, only a warning is issued." msgstr "" -#: ../../library/test.rst:1490 +#: ../../library/test.rst:1499 msgid "A context manager that temporarily sets the process umask." msgstr "" -#: ../../library/test.rst:1495 +#: ../../library/test.rst:1504 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" -#: ../../library/test.rst:1501 +#: ../../library/test.rst:1510 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" msgstr "" -#: ../../library/test.rst:1506 +#: ../../library/test.rst:1515 msgid "" "The :mod:`test.support.import_helper` module provides support for import " "tests." msgstr "" -#: ../../library/test.rst:1513 +#: ../../library/test.rst:1522 msgid "" "Remove the module named *module_name* from ``sys.modules`` and delete any " "byte-compiled files of the module." msgstr "" -#: ../../library/test.rst:1519 +#: ../../library/test.rst:1528 msgid "" "This function imports and returns a fresh copy of the named Python module by " "removing the named module from ``sys.modules`` before doing the import. Note " @@ -1561,46 +1568,46 @@ msgid "" "operation." msgstr "" -#: ../../library/test.rst:1524 +#: ../../library/test.rst:1533 msgid "" "*fresh* is an iterable of additional module names that are also removed from " "the ``sys.modules`` cache before doing the import." msgstr "" -#: ../../library/test.rst:1527 +#: ../../library/test.rst:1536 msgid "" "*blocked* is an iterable of module names that are replaced with ``None`` in " "the module cache during the import to ensure that attempts to import them " "raise :exc:`ImportError`." msgstr "" -#: ../../library/test.rst:1531 +#: ../../library/test.rst:1540 msgid "" "The named module and any modules named in the *fresh* and *blocked* " "parameters are saved before starting the import and then reinserted into " "``sys.modules`` when the fresh import is complete." msgstr "" -#: ../../library/test.rst:1535 +#: ../../library/test.rst:1544 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``." msgstr "" -#: ../../library/test.rst:1538 +#: ../../library/test.rst:1547 msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1555 +#: ../../library/test.rst:1564 msgid "" "This function imports and returns the named module. Unlike a normal import, " "this function raises :exc:`unittest.SkipTest` if the module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1559 +#: ../../library/test.rst:1568 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " @@ -1608,21 +1615,21 @@ msgid "" "which will be compared against :data:`sys.platform`." msgstr "" -#: ../../library/test.rst:1569 +#: ../../library/test.rst:1578 msgid "Return a copy of :data:`sys.modules`." msgstr "" -#: ../../library/test.rst:1574 +#: ../../library/test.rst:1583 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" -#: ../../library/test.rst:1580 +#: ../../library/test.rst:1589 msgid "Delete *name* from ``sys.modules``." msgstr "" -#: ../../library/test.rst:1585 +#: ../../library/test.rst:1594 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " @@ -1630,49 +1637,49 @@ msgid "" "3147/488 pyc file must exist." msgstr "" -#: ../../library/test.rst:1593 +#: ../../library/test.rst:1602 msgid "" "A context manager to force import to return a new module reference. This is " "useful for testing module-level behaviors, such as the emission of a :exc:" "`DeprecationWarning` on import. Example usage::" msgstr "" -#: ../../library/test.rst:1603 +#: ../../library/test.rst:1612 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" -#: ../../library/test.rst:1605 +#: ../../library/test.rst:1614 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" -#: ../../library/test.rst:1609 +#: ../../library/test.rst:1618 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" -#: ../../library/test.rst:1615 +#: ../../library/test.rst:1624 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" msgstr "" -#: ../../library/test.rst:1620 +#: ../../library/test.rst:1629 msgid "" "The :mod:`test.support.warnings_helper` module provides support for warnings " "tests." msgstr "" -#: ../../library/test.rst:1627 +#: ../../library/test.rst:1636 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" -#: ../../library/test.rst:1634 +#: ../../library/test.rst:1643 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " @@ -1684,7 +1691,7 @@ msgid "" "``None``, compares to the offset of the exception." msgstr "" -#: ../../library/test.rst:1648 +#: ../../library/test.rst:1657 msgid "" "A convenience wrapper for :func:`warnings.catch_warnings()` that makes it " "easier to test that a warning was correctly raised. It is approximately " @@ -1693,7 +1700,7 @@ msgid "" "automatically validate the results that are recorded." msgstr "" -#: ../../library/test.rst:1654 +#: ../../library/test.rst:1663 msgid "" "``check_warnings`` accepts 2-tuples of the form ``(\"message regexp\", " "WarningCategory)`` as positional arguments. If one or more *filters* are " @@ -1705,15 +1712,15 @@ msgid "" "*quiet* to ``True``." msgstr "" -#: ../../library/test.rst:1663 +#: ../../library/test.rst:1672 msgid "If no arguments are specified, it defaults to::" msgstr "" -#: ../../library/test.rst:1667 +#: ../../library/test.rst:1676 msgid "In this case all warnings are caught and no errors are raised." msgstr "" -#: ../../library/test.rst:1669 +#: ../../library/test.rst:1678 msgid "" "On entry to the context manager, a :class:`WarningRecorder` instance is " "returned. The underlying warnings list from :func:`~warnings.catch_warnings` " @@ -1725,39 +1732,39 @@ msgid "" "return ``None``." msgstr "" -#: ../../library/test.rst:1678 +#: ../../library/test.rst:1687 msgid "" "The recorder object also has a :meth:`reset` method, which clears the " "warnings list." msgstr "" -#: ../../library/test.rst:1681 +#: ../../library/test.rst:1690 msgid "The context manager is designed to be used like this::" msgstr "" -#: ../../library/test.rst:1688 +#: ../../library/test.rst:1697 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -#: ../../library/test.rst:1691 +#: ../../library/test.rst:1700 msgid "" "When a test needs to look more deeply into the warnings, rather than just " "checking whether or not they occurred, code like this can be used::" msgstr "" -#: ../../library/test.rst:1705 +#: ../../library/test.rst:1714 msgid "" "Here all warnings will be caught, and the test code tests the captured " "warnings directly." msgstr "" -#: ../../library/test.rst:1708 +#: ../../library/test.rst:1717 msgid "New optional arguments *filters* and *quiet*." msgstr "" -#: ../../library/test.rst:1714 +#: ../../library/test.rst:1723 msgid "" "Class used to record warnings for unit tests. See documentation of :func:" "`check_warnings` above for more details." diff --git a/library/threading.po b/library/threading.po index 9cd3c1e503..b9fc294cca 100644 --- a/library/threading.po +++ b/library/threading.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-22 00:19+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -74,21 +74,32 @@ msgid "" "appropriate model if you want to run multiple I/O-bound tasks simultaneously." msgstr "" -#: ../../library/threading.rst:49 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/threading.rst:50 msgid "This module defines the following functions:" msgstr "" -#: ../../library/threading.rst:54 +#: ../../library/threading.rst:55 msgid "" "Return the number of :class:`Thread` objects currently alive. The returned " "count is equal to the length of the list returned by :func:`.enumerate`." msgstr "" -#: ../../library/threading.rst:57 +#: ../../library/threading.rst:58 msgid "The function ``activeCount`` is a deprecated alias for this function." msgstr "" -#: ../../library/threading.rst:62 +#: ../../library/threading.rst:63 msgid "" "Return the current :class:`Thread` object, corresponding to the caller's " "thread of control. If the caller's thread of control was not created " @@ -96,78 +107,78 @@ msgid "" "functionality is returned." msgstr "" -#: ../../library/threading.rst:67 +#: ../../library/threading.rst:68 msgid "The function ``currentThread`` is a deprecated alias for this function." msgstr "" -#: ../../library/threading.rst:72 +#: ../../library/threading.rst:73 msgid "Handle uncaught exception raised by :func:`Thread.run`." msgstr "" -#: ../../library/threading.rst:74 +#: ../../library/threading.rst:75 msgid "The *args* argument has the following attributes:" msgstr "" -#: ../../library/threading.rst:76 +#: ../../library/threading.rst:77 msgid "*exc_type*: Exception type." msgstr "" -#: ../../library/threading.rst:77 +#: ../../library/threading.rst:78 msgid "*exc_value*: Exception value, can be ``None``." msgstr "" -#: ../../library/threading.rst:78 +#: ../../library/threading.rst:79 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" -#: ../../library/threading.rst:79 +#: ../../library/threading.rst:80 msgid "*thread*: Thread which raised the exception, can be ``None``." msgstr "" -#: ../../library/threading.rst:81 +#: ../../library/threading.rst:82 msgid "" "If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. " "Otherwise, the exception is printed out on :data:`sys.stderr`." msgstr "" -#: ../../library/threading.rst:84 +#: ../../library/threading.rst:85 msgid "" "If this function raises an exception, :func:`sys.excepthook` is called to " "handle it." msgstr "" -#: ../../library/threading.rst:87 +#: ../../library/threading.rst:88 msgid "" ":func:`threading.excepthook` can be overridden to control how uncaught " "exceptions raised by :func:`Thread.run` are handled." msgstr "" -#: ../../library/threading.rst:90 +#: ../../library/threading.rst:91 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/threading.rst:94 +#: ../../library/threading.rst:95 msgid "" "Storing *thread* using a custom hook can resurrect it if it is set to an " "object which is being finalized. Avoid storing *thread* after the custom " "hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/threading.rst:99 +#: ../../library/threading.rst:100 msgid ":func:`sys.excepthook` handles uncaught exceptions." msgstr "" -#: ../../library/threading.rst:105 +#: ../../library/threading.rst:106 msgid "" "Holds the original value of :func:`threading.excepthook`. It is saved so " "that the original value can be restored in case they happen to get replaced " "with broken or alternative objects." msgstr "" -#: ../../library/threading.rst:113 +#: ../../library/threading.rst:114 msgid "" "Return the 'thread identifier' of the current thread. This is a nonzero " "integer. Its value has no direct meaning; it is intended as a magic cookie " @@ -176,7 +187,7 @@ msgid "" "created." msgstr "" -#: ../../library/threading.rst:124 +#: ../../library/threading.rst:125 msgid "" "Return the native integral Thread ID of the current thread assigned by the " "kernel. This is a non-negative integer. Its value may be used to uniquely " @@ -184,13 +195,13 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:130 +#: ../../library/threading.rst:131 msgid "" ":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " "NetBSD, AIX." msgstr "" -#: ../../library/threading.rst:136 +#: ../../library/threading.rst:137 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " "includes daemonic threads and dummy thread objects created by :func:" @@ -199,35 +210,35 @@ msgid "" "even when terminated." msgstr "" -#: ../../library/threading.rst:145 +#: ../../library/threading.rst:146 msgid "" "Return the main :class:`Thread` object. In normal conditions, the main " "thread is the thread from which the Python interpreter was started." msgstr "" -#: ../../library/threading.rst:156 +#: ../../library/threading.rst:157 msgid "" "Set a trace function for all threads started from the :mod:`threading` " "module. The *func* will be passed to :func:`sys.settrace` for each thread, " "before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:167 +#: ../../library/threading.rst:168 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/threading.rst:176 +#: ../../library/threading.rst:177 msgid "" "Set a profile function for all threads started from the :mod:`threading` " "module. The *func* will be passed to :func:`sys.setprofile` for each " "thread, before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:185 +#: ../../library/threading.rst:186 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/threading.rst:192 +#: ../../library/threading.rst:193 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -246,16 +257,19 @@ msgid "" "information)." msgstr "" -#: ../../library/threading.rst:207 -msgid "" -":ref:`Availability `: Windows, systems with POSIX threads." -msgstr "" +#: ../../library/threading.rst:-1 +msgid ":ref:`Availability `: Windows, pthreads." +msgstr ":ref:`適用 `:Windows, pthreads。" #: ../../library/threading.rst:210 +msgid "Unix platforms with POSIX threads support." +msgstr "" + +#: ../../library/threading.rst:213 msgid "This module also defines the following constant:" msgstr "" -#: ../../library/threading.rst:214 +#: ../../library/threading.rst:217 msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " @@ -263,13 +277,13 @@ msgid "" "`OverflowError`." msgstr "" -#: ../../library/threading.rst:222 +#: ../../library/threading.rst:225 msgid "" "This module defines a number of classes, which are detailed in the sections " "below." msgstr "" -#: ../../library/threading.rst:225 +#: ../../library/threading.rst:228 msgid "" "The design of this module is loosely based on Java's threading model. " "However, where Java makes locks and condition variables basic behavior of " @@ -280,40 +294,40 @@ msgid "" "Thread class, when implemented, are mapped to module-level functions." msgstr "" -#: ../../library/threading.rst:233 +#: ../../library/threading.rst:236 msgid "All of the methods described below are executed atomically." msgstr "" -#: ../../library/threading.rst:237 +#: ../../library/threading.rst:240 msgid "Thread-Local Data" msgstr "" -#: ../../library/threading.rst:239 +#: ../../library/threading.rst:242 msgid "" "Thread-local data is data whose values are thread specific. To manage " "thread-local data, just create an instance of :class:`local` (or a subclass) " "and store attributes on it::" msgstr "" -#: ../../library/threading.rst:246 +#: ../../library/threading.rst:249 msgid "The instance's values will be different for separate threads." msgstr "" -#: ../../library/threading.rst:251 +#: ../../library/threading.rst:254 msgid "A class that represents thread-local data." msgstr "" -#: ../../library/threading.rst:253 +#: ../../library/threading.rst:256 msgid "" "For more details and extensive examples, see the documentation string of " "the :mod:`_threading_local` module." msgstr "" -#: ../../library/threading.rst:260 +#: ../../library/threading.rst:263 msgid "Thread Objects" msgstr "" -#: ../../library/threading.rst:262 +#: ../../library/threading.rst:265 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -323,14 +337,14 @@ msgid "" "`~Thread.__init__` and :meth:`~Thread.run` methods of this class." msgstr "" -#: ../../library/threading.rst:269 +#: ../../library/threading.rst:272 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" -#: ../../library/threading.rst:273 +#: ../../library/threading.rst:276 msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " @@ -338,27 +352,27 @@ msgid "" "is_alive` method tests whether the thread is alive." msgstr "" -#: ../../library/threading.rst:278 +#: ../../library/threading.rst:281 msgid "" "Other threads can call a thread's :meth:`~Thread.join` method. This blocks " "the calling thread until the thread whose :meth:`~Thread.join` method is " "called is terminated." msgstr "" -#: ../../library/threading.rst:282 +#: ../../library/threading.rst:285 msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -#: ../../library/threading.rst:285 +#: ../../library/threading.rst:288 msgid "" "If the :meth:`~Thread.run` method raises an exception, :func:`threading." "excepthook` is called to handle it. By default, :func:`threading.excepthook` " "ignores silently :exc:`SystemExit`." msgstr "" -#: ../../library/threading.rst:289 +#: ../../library/threading.rst:292 msgid "" "A thread can be flagged as a \"daemon thread\". The significance of this " "flag is that the entire Python program exits when only daemon threads are " @@ -367,7 +381,7 @@ msgid "" "constructor argument." msgstr "" -#: ../../library/threading.rst:296 +#: ../../library/threading.rst:299 msgid "" "Daemon threads are abruptly stopped at shutdown. Their resources (such as " "open files, database transactions, etc.) may not be released properly. If " @@ -375,41 +389,42 @@ msgid "" "suitable signalling mechanism such as an :class:`Event`." msgstr "" -#: ../../library/threading.rst:301 +#: ../../library/threading.rst:304 msgid "" "There is a \"main thread\" object; this corresponds to the initial thread of " "control in the Python program. It is not a daemon thread." msgstr "" -#: ../../library/threading.rst:304 +#: ../../library/threading.rst:307 msgid "" "There is the possibility that \"dummy thread objects\" are created. These " "are thread objects corresponding to \"alien threads\", which are threads of " "control started outside the threading module, such as directly from C code. " "Dummy thread objects have limited functionality; they are always considered " -"alive and daemonic, and cannot be :meth:`~Thread.join`\\ ed. They are never " -"deleted, since it is impossible to detect the termination of alien threads." +"alive and daemonic, and cannot be :ref:`joined `. They " +"are never deleted, since it is impossible to detect the termination of alien " +"threads." msgstr "" -#: ../../library/threading.rst:315 +#: ../../library/threading.rst:318 msgid "" "This constructor should always be called with keyword arguments. Arguments " "are:" msgstr "" -#: ../../library/threading.rst:318 +#: ../../library/threading.rst:321 msgid "" "*group* should be ``None``; reserved for future extension when a :class:" "`ThreadGroup` class is implemented." msgstr "" -#: ../../library/threading.rst:321 +#: ../../library/threading.rst:324 msgid "" "*target* is the callable object to be invoked by the :meth:`run` method. " "Defaults to ``None``, meaning nothing is called." msgstr "" -#: ../../library/threading.rst:324 +#: ../../library/threading.rst:327 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -417,61 +432,62 @@ msgid "" "is specified." msgstr "" -#: ../../library/threading.rst:329 +#: ../../library/threading.rst:332 msgid "" -"*args* is the argument tuple for the target invocation. Defaults to ``()``." +"*args* is a list or tuple of arguments for the target invocation. Defaults " +"to ``()``." msgstr "" -#: ../../library/threading.rst:331 +#: ../../library/threading.rst:334 msgid "" "*kwargs* is a dictionary of keyword arguments for the target invocation. " "Defaults to ``{}``." msgstr "" -#: ../../library/threading.rst:334 +#: ../../library/threading.rst:337 msgid "" "If not ``None``, *daemon* explicitly sets whether the thread is daemonic. If " "``None`` (the default), the daemonic property is inherited from the current " "thread." msgstr "" -#: ../../library/threading.rst:338 +#: ../../library/threading.rst:341 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: ../../library/threading.rst:342 +#: ../../library/threading.rst:345 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: ../../library/threading.rst:345 +#: ../../library/threading.rst:348 msgid "Added the *daemon* argument." msgstr "新增 *daemon* 引數。" -#: ../../library/threading.rst:350 +#: ../../library/threading.rst:353 msgid "Start the thread's activity." msgstr "" -#: ../../library/threading.rst:352 +#: ../../library/threading.rst:355 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: ../../library/threading.rst:356 +#: ../../library/threading.rst:359 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: ../../library/threading.rst:361 +#: ../../library/threading.rst:364 msgid "Method representing the thread's activity." msgstr "" -#: ../../library/threading.rst:363 +#: ../../library/threading.rst:366 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -479,7 +495,20 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/threading.rst:370 +#: ../../library/threading.rst:371 +msgid "" +"Using list or tuple as the *args* argument which passed to the :class:" +"`Thread` could achieve the same effect." +msgstr "" + +#: ../../library/threading.rst:374 +msgid "Example::" +msgstr "" +"舉例來說:\n" +"\n" +"::" + +#: ../../library/threading.rst:388 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -487,7 +516,7 @@ msgid "" "occurs." msgstr "" -#: ../../library/threading.rst:375 +#: ../../library/threading.rst:393 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating point number specifying a timeout for the operation in seconds (or " @@ -497,17 +526,17 @@ msgid "" "`~Thread.join` call timed out." msgstr "" -#: ../../library/threading.rst:382 +#: ../../library/threading.rst:400 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: ../../library/threading.rst:385 -msgid "A thread can be :meth:`~Thread.join`\\ ed many times." +#: ../../library/threading.rst:403 +msgid "A thread can be joined many times." msgstr "" -#: ../../library/threading.rst:387 +#: ../../library/threading.rst:405 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -515,20 +544,20 @@ msgid "" "do so raise the same exception." msgstr "" -#: ../../library/threading.rst:394 +#: ../../library/threading.rst:412 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: ../../library/threading.rst:401 +#: ../../library/threading.rst:419 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: ../../library/threading.rst:408 +#: ../../library/threading.rst:426 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -537,7 +566,7 @@ msgid "" "thread has exited." msgstr "" -#: ../../library/threading.rst:416 +#: ../../library/threading.rst:434 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -546,30 +575,31 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:425 +#: ../../library/threading.rst:443 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: ../../library/threading.rst:430 +#: ../../library/threading.rst:448 msgid "" -":ref:`Availability `: Requires :func:`get_native_id` function." +":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " +"NetBSD, AIX, DragonFlyBSD." msgstr "" -#: ../../library/threading.rst:435 +#: ../../library/threading.rst:453 msgid "Return whether the thread is alive." msgstr "" -#: ../../library/threading.rst:437 +#: ../../library/threading.rst:455 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: ../../library/threading.rst:443 +#: ../../library/threading.rst:461 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " @@ -579,22 +609,22 @@ msgid "" "`~Thread.daemon` = ``False``." msgstr "" -#: ../../library/threading.rst:450 +#: ../../library/threading.rst:468 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: ../../library/threading.rst:455 +#: ../../library/threading.rst:473 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: ../../library/threading.rst:464 +#: ../../library/threading.rst:482 msgid "Lock Objects" msgstr "" -#: ../../library/threading.rst:466 +#: ../../library/threading.rst:484 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " @@ -602,7 +632,7 @@ msgid "" "`_thread` extension module." msgstr "" -#: ../../library/threading.rst:471 +#: ../../library/threading.rst:489 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " "created in the unlocked state. It has two basic methods, :meth:`~Lock." @@ -616,11 +646,11 @@ msgid "" "an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" -#: ../../library/threading.rst:482 +#: ../../library/threading.rst:500 msgid "Locks also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:484 +#: ../../library/threading.rst:502 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " "the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." @@ -628,42 +658,42 @@ msgid "" "proceeds is not defined, and may vary across implementations." msgstr "" -#: ../../library/threading.rst:489 +#: ../../library/threading.rst:507 msgid "All methods are executed atomically." msgstr "" -#: ../../library/threading.rst:494 +#: ../../library/threading.rst:512 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " "thread may release it." msgstr "" -#: ../../library/threading.rst:498 +#: ../../library/threading.rst:516 msgid "" "Note that ``Lock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete Lock class that is supported " "by the platform." msgstr "" -#: ../../library/threading.rst:505 ../../library/threading.rst:585 +#: ../../library/threading.rst:523 ../../library/threading.rst:603 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/threading.rst:507 +#: ../../library/threading.rst:525 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" -#: ../../library/threading.rst:510 +#: ../../library/threading.rst:528 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" -#: ../../library/threading.rst:514 +#: ../../library/threading.rst:532 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -672,53 +702,53 @@ msgid "" "*blocking* is ``False``." msgstr "" -#: ../../library/threading.rst:520 +#: ../../library/threading.rst:538 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." msgstr "" -#: ../../library/threading.rst:523 ../../library/threading.rst:607 -#: ../../library/threading.rst:854 +#: ../../library/threading.rst:541 ../../library/threading.rst:625 +#: ../../library/threading.rst:872 msgid "The *timeout* parameter is new." msgstr "" -#: ../../library/threading.rst:526 +#: ../../library/threading.rst:544 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." msgstr "" -#: ../../library/threading.rst:533 +#: ../../library/threading.rst:551 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." msgstr "" -#: ../../library/threading.rst:536 +#: ../../library/threading.rst:554 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " "one of them to proceed." msgstr "" -#: ../../library/threading.rst:540 +#: ../../library/threading.rst:558 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:542 ../../library/threading.rst:623 +#: ../../library/threading.rst:560 ../../library/threading.rst:641 msgid "There is no return value." msgstr "" -#: ../../library/threading.rst:546 +#: ../../library/threading.rst:564 msgid "Return ``True`` if the lock is acquired." msgstr "" -#: ../../library/threading.rst:553 +#: ../../library/threading.rst:571 msgid "RLock Objects" msgstr "RLock 物件" -#: ../../library/threading.rst:555 +#: ../../library/threading.rst:573 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -727,7 +757,7 @@ msgid "" "lock; in the unlocked state, no thread owns it." msgstr "" -#: ../../library/threading.rst:561 +#: ../../library/threading.rst:579 msgid "" "To lock the lock, a thread calls its :meth:`~RLock.acquire` method; this " "returns once the thread owns the lock. To unlock the lock, a thread calls " @@ -738,13 +768,13 @@ msgid "" "proceed." msgstr "" -#: ../../library/threading.rst:568 +#: ../../library/threading.rst:586 msgid "" "Reentrant locks also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:573 +#: ../../library/threading.rst:591 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " @@ -752,14 +782,14 @@ msgid "" "thread must release it once for each time it has acquired it." msgstr "" -#: ../../library/threading.rst:578 +#: ../../library/threading.rst:596 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " "by the platform." msgstr "" -#: ../../library/threading.rst:587 +#: ../../library/threading.rst:605 msgid "" "When invoked without arguments: if this thread already owns the lock, " "increment the recursion level by one, and return immediately. Otherwise, if " @@ -770,13 +800,13 @@ msgid "" "ownership of the lock. There is no return value in this case." msgstr "" -#: ../../library/threading.rst:595 +#: ../../library/threading.rst:613 msgid "" "When invoked with the *blocking* argument set to ``True``, do the same thing " "as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:598 +#: ../../library/threading.rst:616 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. " "If a call without an argument would block, return ``False`` immediately; " @@ -784,7 +814,7 @@ msgid "" "``True``." msgstr "" -#: ../../library/threading.rst:602 +#: ../../library/threading.rst:620 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -792,7 +822,7 @@ msgid "" "acquired, ``False`` if the timeout has elapsed." msgstr "" -#: ../../library/threading.rst:613 +#: ../../library/threading.rst:631 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -801,17 +831,17 @@ msgid "" "is still nonzero, the lock remains locked and owned by the calling thread." msgstr "" -#: ../../library/threading.rst:619 +#: ../../library/threading.rst:637 msgid "" "Only call this method when the calling thread owns the lock. A :exc:" "`RuntimeError` is raised if this method is called when the lock is unlocked." msgstr "" -#: ../../library/threading.rst:629 +#: ../../library/threading.rst:647 msgid "Condition Objects" msgstr "" -#: ../../library/threading.rst:631 +#: ../../library/threading.rst:649 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -819,7 +849,7 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: ../../library/threading.rst:636 +#: ../../library/threading.rst:654 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " @@ -828,7 +858,7 @@ msgid "" "associated lock." msgstr "" -#: ../../library/threading.rst:642 +#: ../../library/threading.rst:660 msgid "" "Other methods must be called with the associated lock held. The :meth:" "`~Condition.wait` method releases the lock, and then blocks until another " @@ -837,14 +867,14 @@ msgid "" "and returns. It is also possible to specify a timeout." msgstr "" -#: ../../library/threading.rst:648 +#: ../../library/threading.rst:666 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " "the condition variable, if any are waiting. The :meth:`~Condition." "notify_all` method wakes up all threads waiting for the condition variable." msgstr "" -#: ../../library/threading.rst:652 +#: ../../library/threading.rst:670 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -853,7 +883,7 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: ../../library/threading.rst:658 +#: ../../library/threading.rst:676 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " @@ -865,7 +895,7 @@ msgid "" "situation with unlimited buffer capacity::" msgstr "" -#: ../../library/threading.rst:678 +#: ../../library/threading.rst:696 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " @@ -875,7 +905,7 @@ msgid "" "checking, and eases the computation of timeouts::" msgstr "" -#: ../../library/threading.rst:690 +#: ../../library/threading.rst:708 msgid "" "To choose between :meth:`~Condition.notify` and :meth:`~Condition." "notify_all`, consider whether one state change can be interesting for only " @@ -884,45 +914,45 @@ msgid "" "thread." msgstr "" -#: ../../library/threading.rst:698 +#: ../../library/threading.rst:716 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: ../../library/threading.rst:701 +#: ../../library/threading.rst:719 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: ../../library/threading.rst:705 ../../library/threading.rst:829 -#: ../../library/threading.rst:875 ../../library/threading.rst:927 -#: ../../library/threading.rst:998 +#: ../../library/threading.rst:723 ../../library/threading.rst:847 +#: ../../library/threading.rst:893 ../../library/threading.rst:945 +#: ../../library/threading.rst:1016 msgid "changed from a factory function to a class." msgstr "" -#: ../../library/threading.rst:710 +#: ../../library/threading.rst:728 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: ../../library/threading.rst:715 +#: ../../library/threading.rst:733 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: ../../library/threading.rst:720 +#: ../../library/threading.rst:738 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: ../../library/threading.rst:724 +#: ../../library/threading.rst:742 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -930,14 +960,14 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: ../../library/threading.rst:729 +#: ../../library/threading.rst:747 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:733 +#: ../../library/threading.rst:751 msgid "" "When the underlying lock is an :class:`RLock`, it is not released using its :" "meth:`release` method, since this may not actually unlock the lock when it " @@ -947,24 +977,24 @@ msgid "" "used to restore the recursion level when the lock is reacquired." msgstr "" -#: ../../library/threading.rst:741 +#: ../../library/threading.rst:759 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: ../../library/threading.rst:744 ../../library/threading.rst:963 +#: ../../library/threading.rst:762 ../../library/threading.rst:981 msgid "Previously, the method always returned ``None``." msgstr "" -#: ../../library/threading.rst:749 +#: ../../library/threading.rst:767 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: ../../library/threading.rst:753 +#: ../../library/threading.rst:771 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -972,33 +1002,33 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:758 +#: ../../library/threading.rst:776 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: ../../library/threading.rst:764 +#: ../../library/threading.rst:782 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: ../../library/threading.rst:772 +#: ../../library/threading.rst:790 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " "calling thread has not acquired the lock when this method is called, a :exc:" "`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:776 +#: ../../library/threading.rst:794 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: ../../library/threading.rst:779 +#: ../../library/threading.rst:797 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1006,14 +1036,14 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:784 +#: ../../library/threading.rst:802 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: ../../library/threading.rst:790 +#: ../../library/threading.rst:808 msgid "" "Wake up all threads waiting on this condition. This method acts like :meth:" "`notify`, but wakes up all waiting threads instead of one. If the calling " @@ -1021,15 +1051,15 @@ msgid "" "`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:795 +#: ../../library/threading.rst:813 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:801 +#: ../../library/threading.rst:819 msgid "Semaphore Objects" msgstr "" -#: ../../library/threading.rst:803 +#: ../../library/threading.rst:821 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " @@ -1037,7 +1067,7 @@ msgid "" "acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: ../../library/threading.rst:808 +#: ../../library/threading.rst:826 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " @@ -1046,12 +1076,12 @@ msgid "" "meth:`~Semaphore.release`." msgstr "" -#: ../../library/threading.rst:814 +#: ../../library/threading.rst:832 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:819 +#: ../../library/threading.rst:837 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1060,28 +1090,28 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:825 +#: ../../library/threading.rst:843 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: ../../library/threading.rst:834 +#: ../../library/threading.rst:852 msgid "Acquire a semaphore." msgstr "" -#: ../../library/threading.rst:836 +#: ../../library/threading.rst:854 msgid "When invoked without arguments:" msgstr "" -#: ../../library/threading.rst:838 +#: ../../library/threading.rst:856 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: ../../library/threading.rst:840 +#: ../../library/threading.rst:858 msgid "" "If the internal counter is zero on entry, block until awoken by a call to :" "meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " @@ -1090,32 +1120,32 @@ msgid "" "threads are awoken should not be relied on." msgstr "" -#: ../../library/threading.rst:846 +#: ../../library/threading.rst:864 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:850 +#: ../../library/threading.rst:868 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: ../../library/threading.rst:859 +#: ../../library/threading.rst:877 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: ../../library/threading.rst:863 +#: ../../library/threading.rst:881 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: ../../library/threading.rst:869 +#: ../../library/threading.rst:887 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " "make sure its current value doesn't exceed its initial value. If it does, :" @@ -1124,11 +1154,11 @@ msgid "" "times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:882 +#: ../../library/threading.rst:900 msgid ":class:`Semaphore` Example" msgstr ":class:`Semaphore` 範例" -#: ../../library/threading.rst:884 +#: ../../library/threading.rst:902 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1136,37 +1166,37 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: ../../library/threading.rst:893 +#: ../../library/threading.rst:911 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: ../../library/threading.rst:903 +#: ../../library/threading.rst:921 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: ../../library/threading.rst:910 +#: ../../library/threading.rst:928 msgid "Event Objects" msgstr "" -#: ../../library/threading.rst:912 +#: ../../library/threading.rst:930 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: ../../library/threading.rst:915 +#: ../../library/threading.rst:933 msgid "" "An event object manages an internal flag that can be set to true with the :" "meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " "method. The :meth:`~Event.wait` method blocks until the flag is true." msgstr "" -#: ../../library/threading.rst:922 +#: ../../library/threading.rst:940 msgid "" "Class implementing event objects. An event manages a flag that can be set " "to true with the :meth:`~Event.set` method and reset to false with the :meth:" @@ -1174,43 +1204,43 @@ msgid "" "flag is initially false." msgstr "" -#: ../../library/threading.rst:932 +#: ../../library/threading.rst:950 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: ../../library/threading.rst:934 +#: ../../library/threading.rst:952 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:938 +#: ../../library/threading.rst:956 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: ../../library/threading.rst:944 +#: ../../library/threading.rst:962 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: ../../library/threading.rst:950 +#: ../../library/threading.rst:968 msgid "" "Block until the internal flag is true. If the internal flag is true on " "entry, return immediately. Otherwise, block until another thread calls :" "meth:`.set` to set the flag to true, or until the optional timeout occurs." msgstr "" -#: ../../library/threading.rst:954 +#: ../../library/threading.rst:972 msgid "" "When the timeout argument is present and not ``None``, it should be a " "floating point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:958 +#: ../../library/threading.rst:976 msgid "" "This method returns ``True`` if and only if the internal flag has been set " "to true, either before the wait call or after the wait starts, so it will " @@ -1218,11 +1248,11 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:970 +#: ../../library/threading.rst:988 msgid "Timer Objects" msgstr "" -#: ../../library/threading.rst:972 +#: ../../library/threading.rst:990 msgid "" "This class represents an action that should be run only after a certain " "amount of time has passed --- a timer. :class:`Timer` is a subclass of :" @@ -1230,7 +1260,7 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:976 +#: ../../library/threading.rst:994 msgid "" "Timers are started, as with threads, by calling their :meth:`~Timer.start` " "method. The timer can be stopped (before its action has begun) by calling " @@ -1239,14 +1269,14 @@ msgid "" "by the user." msgstr "" -#: ../../library/threading.rst:982 +#: ../../library/threading.rst:1000 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/threading.rst:993 +#: ../../library/threading.rst:1011 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1254,17 +1284,17 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: ../../library/threading.rst:1003 +#: ../../library/threading.rst:1021 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: ../../library/threading.rst:1008 +#: ../../library/threading.rst:1026 msgid "Barrier Objects" msgstr "" -#: ../../library/threading.rst:1012 +#: ../../library/threading.rst:1030 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1273,18 +1303,18 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: ../../library/threading.rst:1018 +#: ../../library/threading.rst:1036 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: ../../library/threading.rst:1020 +#: ../../library/threading.rst:1038 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: ../../library/threading.rst:1040 +#: ../../library/threading.rst:1058 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1292,7 +1322,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: ../../library/threading.rst:1047 +#: ../../library/threading.rst:1065 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1300,44 +1330,44 @@ msgid "" "constructor." msgstr "" -#: ../../library/threading.rst:1052 +#: ../../library/threading.rst:1070 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/threading.rst:1061 +#: ../../library/threading.rst:1079 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1065 +#: ../../library/threading.rst:1083 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1067 +#: ../../library/threading.rst:1085 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: ../../library/threading.rst:1072 +#: ../../library/threading.rst:1090 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/threading.rst:1075 +#: ../../library/threading.rst:1093 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: ../../library/threading.rst:1081 +#: ../../library/threading.rst:1099 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1345,36 +1375,36 @@ msgid "" "application." msgstr "" -#: ../../library/threading.rst:1086 +#: ../../library/threading.rst:1104 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: ../../library/threading.rst:1092 +#: ../../library/threading.rst:1110 msgid "The number of threads required to pass the barrier." msgstr "" -#: ../../library/threading.rst:1096 +#: ../../library/threading.rst:1114 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: ../../library/threading.rst:1100 +#: ../../library/threading.rst:1118 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/threading.rst:1105 +#: ../../library/threading.rst:1123 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/threading.rst:1112 +#: ../../library/threading.rst:1130 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: ../../library/threading.rst:1114 +#: ../../library/threading.rst:1132 msgid "" "All of the objects provided by this module that have :meth:`acquire` and :" "meth:`release` methods can be used as context managers for a :keyword:`with` " @@ -1383,11 +1413,11 @@ msgid "" "Hence, the following snippet::" msgstr "" -#: ../../library/threading.rst:1123 +#: ../../library/threading.rst:1141 msgid "is equivalent to::" msgstr "" -#: ../../library/threading.rst:1131 +#: ../../library/threading.rst:1149 msgid "" "Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" "`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" diff --git a/library/time.po b/library/time.po index 37c5ee6b8c..eec664ca75 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-12 00:12+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -43,26 +43,25 @@ msgstr "" #: ../../library/time.rst:24 msgid "" -"The :dfn:`epoch` is the point where the time starts, and is platform " -"dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC). To find " -"out what the epoch is on a given platform, look at ``time.gmtime(0)``." +"The :dfn:`epoch` is the point where the time starts, the return value of " +"``time.gmtime(0)``. It is January 1, 1970, 00:00:00 (UTC) on all platforms." msgstr "" -#: ../../library/time.rst:33 +#: ../../library/time.rst:31 msgid "" "The term :dfn:`seconds since the epoch` refers to the total number of " "elapsed seconds since the epoch, typically excluding `leap seconds`_. Leap " "seconds are excluded from this total on all POSIX-compliant platforms." msgstr "" -#: ../../library/time.rst:40 +#: ../../library/time.rst:38 msgid "" -"The functions in this module may not handle dates and times before the epoch " -"or far in the future. The cut-off point in the future is determined by the " -"C library; for 32-bit systems, it is typically in 2038." +"The functions in this module may not handle dates and times before the " +"epoch_ or far in the future. The cut-off point in the future is determined " +"by the C library; for 32-bit systems, it is typically in 2038." msgstr "" -#: ../../library/time.rst:47 +#: ../../library/time.rst:45 msgid "" "Function :func:`strptime` can parse 2-digit years when given ``%y`` format " "code. When 2-digit years are parsed, they are converted according to the " @@ -70,14 +69,14 @@ msgid "" "values 0--68 are mapped to 2000--2068." msgstr "" -#: ../../library/time.rst:57 +#: ../../library/time.rst:55 msgid "" "UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, or " "GMT). The acronym UTC is not a mistake but a compromise between English and " "French." msgstr "" -#: ../../library/time.rst:63 +#: ../../library/time.rst:61 msgid "" "DST is Daylight Saving Time, an adjustment of the timezone by (usually) one " "hour during part of the year. DST rules are magic (determined by local law) " @@ -86,14 +85,14 @@ msgid "" "only source of True Wisdom in this respect." msgstr "" -#: ../../library/time.rst:69 +#: ../../library/time.rst:67 msgid "" "The precision of the various real-time functions may be less than suggested " "by the units in which their value or argument is expressed. E.g. on most " "Unix systems, the clock \"ticks\" only 50 or 100 times a second." msgstr "" -#: ../../library/time.rst:73 +#: ../../library/time.rst:71 msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " "better than their Unix equivalents: times are expressed as floating point " @@ -103,7 +102,7 @@ msgid "" "where available)." msgstr "" -#: ../../library/time.rst:80 +#: ../../library/time.rst:78 msgid "" "The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" "`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" @@ -112,73 +111,73 @@ msgid "" "for individual fields." msgstr "" -#: ../../library/time.rst:86 +#: ../../library/time.rst:84 msgid "See :class:`struct_time` for a description of these objects." msgstr "關於這些物件的敘述請見 :class:`struct_time`\\ 。" -#: ../../library/time.rst:88 +#: ../../library/time.rst:86 msgid "" "The :class:`struct_time` type was extended to provide the :attr:`tm_gmtoff` " "and :attr:`tm_zone` attributes when platform supports corresponding ``struct " "tm`` members." msgstr "" -#: ../../library/time.rst:93 +#: ../../library/time.rst:91 msgid "" "The :class:`struct_time` attributes :attr:`tm_gmtoff` and :attr:`tm_zone` " "are now available on all platforms." msgstr "" -#: ../../library/time.rst:97 +#: ../../library/time.rst:95 msgid "Use the following functions to convert between time representations:" msgstr "" -#: ../../library/time.rst:100 +#: ../../library/time.rst:98 msgid "From" msgstr "" -#: ../../library/time.rst:100 +#: ../../library/time.rst:98 msgid "To" msgstr "" -#: ../../library/time.rst:100 +#: ../../library/time.rst:98 msgid "Use" msgstr "" -#: ../../library/time.rst:102 ../../library/time.rst:105 -#: ../../library/time.rst:108 ../../library/time.rst:111 +#: ../../library/time.rst:100 ../../library/time.rst:103 +#: ../../library/time.rst:106 ../../library/time.rst:109 msgid "seconds since the epoch" msgstr "" -#: ../../library/time.rst:102 ../../library/time.rst:108 +#: ../../library/time.rst:100 ../../library/time.rst:106 msgid ":class:`struct_time` in UTC" msgstr "" -#: ../../library/time.rst:102 +#: ../../library/time.rst:100 msgid ":func:`gmtime`" msgstr ":func:`gmtime`" -#: ../../library/time.rst:105 ../../library/time.rst:111 +#: ../../library/time.rst:103 ../../library/time.rst:109 msgid ":class:`struct_time` in local time" msgstr "" -#: ../../library/time.rst:105 +#: ../../library/time.rst:103 msgid ":func:`localtime`" msgstr ":func:`localtime`" -#: ../../library/time.rst:108 +#: ../../library/time.rst:106 msgid ":func:`calendar.timegm`" msgstr ":func:`calendar.timegm`" -#: ../../library/time.rst:111 +#: ../../library/time.rst:109 msgid ":func:`mktime`" msgstr ":func:`mktime`" -#: ../../library/time.rst:119 +#: ../../library/time.rst:117 msgid "Functions" msgstr "函式" -#: ../../library/time.rst:123 +#: ../../library/time.rst:121 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " @@ -186,41 +185,45 @@ msgid "" "padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 1993'``." msgstr "" -#: ../../library/time.rst:129 +#: ../../library/time.rst:127 msgid "" "If *t* is not provided, the current time as returned by :func:`localtime` is " "used. Locale information is not used by :func:`asctime`." msgstr "" -#: ../../library/time.rst:134 +#: ../../library/time.rst:132 msgid "" "Unlike the C function of the same name, :func:`asctime` does not add a " "trailing newline." msgstr "" -#: ../../library/time.rst:139 +#: ../../library/time.rst:137 msgid "" "Return the *clk_id* of the thread-specific CPU-time clock for the specified " "*thread_id*." msgstr "" -#: ../../library/time.rst:141 +#: ../../library/time.rst:139 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -#: ../../library/time.rst:146 +#: ../../library/time.rst:144 msgid "" "Passing an invalid or expired *thread_id* may result in undefined behavior, " "such as segmentation fault." msgstr "" -#: ../../library/time.rst:151 +#: ../../library/time.rst:-1 +msgid ":ref:`Availability `: Unix" +msgstr ":ref:`適用 `:Unix" + +#: ../../library/time.rst:149 msgid "" -":ref:`Availability `: Unix (see the man page for :manpage:" -"`pthread_getcpuclockid(3)` for further information)." +"See the man page for :manpage:`pthread_getcpuclockid(3)` for further " +"information." msgstr "" #: ../../library/time.rst:156 @@ -231,9 +234,9 @@ msgstr "" #: ../../library/time.rst:160 ../../library/time.rst:173 #: ../../library/time.rst:182 ../../library/time.rst:195 -#: ../../library/time.rst:204 ../../library/time.rst:664 -#: ../../library/time.rst:781 ../../library/time.rst:800 -#: ../../library/time.rst:828 ../../library/time.rst:863 +#: ../../library/time.rst:204 ../../library/time.rst:681 +#: ../../library/time.rst:798 ../../library/time.rst:817 +#: ../../library/time.rst:845 ../../library/time.rst:880 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -271,7 +274,7 @@ msgstr "" #: ../../library/time.rst:210 msgid "" -"Convert a time expressed in seconds since the epoch to a string of a form: " +"Convert a time expressed in seconds since the epoch_ to a string of a form: " "``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field is two " "characters long and is space padded if the day is a single digit, e.g.: " "``'Wed Jun 9 04:26:40 1993'``." @@ -338,7 +341,7 @@ msgstr "" #: ../../library/time.rst:248 msgid "" -"Convert a time expressed in seconds since the epoch to a :class:" +"Convert a time expressed in seconds since the epoch_ to a :class:" "`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " "provided or :const:`None`, the current time as returned by :func:`.time` is " "used. Fractions of a second are ignored. See above for a description of " @@ -447,21 +450,62 @@ msgstr "" msgid "" "Suspend execution of the calling thread for the given number of seconds. The " "argument may be a floating point number to indicate a more precise sleep " -"time. The actual suspension time may be less than that requested because any " -"caught signal will terminate the :func:`sleep` following execution of that " -"signal's catching routine. Also, the suspension time may be longer than " -"requested by an arbitrary amount because of the scheduling of other activity " -"in the system." +"time." +msgstr "" + +#: ../../library/time.rst:362 +msgid "" +"If the sleep is interrupted by a signal and no exception is raised by the " +"signal handler, the sleep is restarted with a recomputed timeout." +msgstr "" + +#: ../../library/time.rst:365 +msgid "" +"The suspension time may be longer than requested by an arbitrary amount, " +"because of the scheduling of other activity in the system." +msgstr "" + +#: ../../library/time.rst:368 +msgid "" +"On Windows, if *secs* is zero, the thread relinquishes the remainder of its " +"time slice to any other thread that is ready to run. If there are no other " +"threads ready to run, the function returns immediately, and the thread " +"continues execution. On Windows 8.1 and newer the implementation uses a " +"`high-resolution timer `_ which provides resolution of 100 " +"nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." +msgstr "" + +#: ../../library/time.rst:376 +msgid "Unix implementation:" +msgstr "" + +#: ../../library/time.rst:378 +msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" +msgstr "" + +#: ../../library/time.rst:379 +msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" +msgstr "" + +#: ../../library/time.rst:380 +msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "" -#: ../../library/time.rst:366 +#: ../../library/time.rst:382 +msgid "" +"On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " +"used if available. On Windows, a waitable timer is now used." +msgstr "" + +#: ../../library/time.rst:386 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " "for the rationale)." msgstr "" -#: ../../library/time.rst:377 +#: ../../library/time.rst:397 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string as specified by the *format* " @@ -470,267 +514,267 @@ msgid "" "raised if any field in *t* is outside of the allowed range." msgstr "" -#: ../../library/time.rst:383 +#: ../../library/time.rst:403 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." msgstr "" -#: ../../library/time.rst:386 +#: ../../library/time.rst:406 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " "replaced by the indicated characters in the :func:`strftime` result:" msgstr "" -#: ../../library/time.rst:391 +#: ../../library/time.rst:411 msgid "Directive" msgstr "" -#: ../../library/time.rst:391 +#: ../../library/time.rst:411 msgid "Meaning" msgstr "" -#: ../../library/time.rst:391 +#: ../../library/time.rst:411 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:393 +#: ../../library/time.rst:413 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:393 +#: ../../library/time.rst:413 msgid "Locale's abbreviated weekday name." msgstr "" -#: ../../library/time.rst:396 +#: ../../library/time.rst:416 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:396 +#: ../../library/time.rst:416 msgid "Locale's full weekday name." msgstr "" -#: ../../library/time.rst:398 +#: ../../library/time.rst:418 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:398 +#: ../../library/time.rst:418 msgid "Locale's abbreviated month name." msgstr "" -#: ../../library/time.rst:401 +#: ../../library/time.rst:421 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:401 +#: ../../library/time.rst:421 msgid "Locale's full month name." msgstr "" -#: ../../library/time.rst:403 +#: ../../library/time.rst:423 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:403 +#: ../../library/time.rst:423 msgid "Locale's appropriate date and time representation." msgstr "" -#: ../../library/time.rst:406 +#: ../../library/time.rst:426 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:406 +#: ../../library/time.rst:426 msgid "Day of the month as a decimal number [01,31]." msgstr "" -#: ../../library/time.rst:409 +#: ../../library/time.rst:429 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:409 +#: ../../library/time.rst:429 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "" -#: ../../library/time.rst:412 +#: ../../library/time.rst:432 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:412 +#: ../../library/time.rst:432 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "" -#: ../../library/time.rst:415 +#: ../../library/time.rst:435 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:415 +#: ../../library/time.rst:435 msgid "Day of the year as a decimal number [001,366]." msgstr "" -#: ../../library/time.rst:418 +#: ../../library/time.rst:438 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:418 +#: ../../library/time.rst:438 msgid "Month as a decimal number [01,12]." msgstr "" -#: ../../library/time.rst:421 +#: ../../library/time.rst:441 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:421 +#: ../../library/time.rst:441 msgid "Minute as a decimal number [00,59]." msgstr "" -#: ../../library/time.rst:424 +#: ../../library/time.rst:444 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:424 +#: ../../library/time.rst:444 msgid "Locale's equivalent of either AM or PM." msgstr "" -#: ../../library/time.rst:424 +#: ../../library/time.rst:444 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:427 +#: ../../library/time.rst:447 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:427 +#: ../../library/time.rst:447 msgid "Second as a decimal number [00,61]." msgstr "" -#: ../../library/time.rst:427 +#: ../../library/time.rst:447 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:430 +#: ../../library/time.rst:450 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:430 +#: ../../library/time.rst:450 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/time.rst:430 ../../library/time.rst:441 +#: ../../library/time.rst:450 ../../library/time.rst:461 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:438 +#: ../../library/time.rst:458 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:438 +#: ../../library/time.rst:458 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "" -#: ../../library/time.rst:441 +#: ../../library/time.rst:461 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:441 +#: ../../library/time.rst:461 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/time.rst:449 +#: ../../library/time.rst:469 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:449 +#: ../../library/time.rst:469 msgid "Locale's appropriate date representation." msgstr "" -#: ../../library/time.rst:452 +#: ../../library/time.rst:472 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:452 +#: ../../library/time.rst:472 msgid "Locale's appropriate time representation." msgstr "" -#: ../../library/time.rst:455 +#: ../../library/time.rst:475 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:455 +#: ../../library/time.rst:475 msgid "Year without century as a decimal number [00,99]." msgstr "" -#: ../../library/time.rst:458 +#: ../../library/time.rst:478 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:458 +#: ../../library/time.rst:478 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/time.rst:461 +#: ../../library/time.rst:481 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:461 +#: ../../library/time.rst:481 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " "represents decimal minute digits [-23:59, +23:59]. [1]_" msgstr "" -#: ../../library/time.rst:467 +#: ../../library/time.rst:487 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:467 +#: ../../library/time.rst:487 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "" -#: ../../library/time.rst:470 +#: ../../library/time.rst:490 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:470 +#: ../../library/time.rst:490 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/time.rst:473 +#: ../../library/time.rst:493 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:476 +#: ../../library/time.rst:496 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " "hour." msgstr "" -#: ../../library/time.rst:480 +#: ../../library/time.rst:500 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " "reasons." msgstr "" -#: ../../library/time.rst:485 +#: ../../library/time.rst:505 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." msgstr "" -#: ../../library/time.rst:488 +#: ../../library/time.rst:508 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" msgstr "" -#: ../../library/time.rst:495 +#: ../../library/time.rst:515 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " @@ -738,7 +782,7 @@ msgid "" "`strftime(3)` documentation." msgstr "" -#: ../../library/time.rst:500 +#: ../../library/time.rst:520 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -746,13 +790,13 @@ msgid "" "%j`` where it is 3." msgstr "" -#: ../../library/time.rst:511 +#: ../../library/time.rst:531 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." msgstr "" -#: ../../library/time.rst:515 +#: ../../library/time.rst:535 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -763,11 +807,11 @@ msgid "" "Both *string* and *format* must be strings." msgstr "" -#: ../../library/time.rst:523 +#: ../../library/time.rst:543 msgid "For example:" msgstr "" -#: ../../library/time.rst:530 +#: ../../library/time.rst:550 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -775,7 +819,7 @@ msgid "" "(and are considered to be non-daylight savings timezones)." msgstr "" -#: ../../library/time.rst:535 +#: ../../library/time.rst:555 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -784,7 +828,7 @@ msgid "" "are not documented as supported." msgstr "" -#: ../../library/time.rst:544 +#: ../../library/time.rst:564 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " @@ -792,153 +836,153 @@ msgid "" "The following values are present:" msgstr "" -#: ../../library/time.rst:550 +#: ../../library/time.rst:570 msgid "Index" msgstr "" -#: ../../library/time.rst:550 +#: ../../library/time.rst:570 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:550 +#: ../../library/time.rst:570 msgid "Values" msgstr "" -#: ../../library/time.rst:552 +#: ../../library/time.rst:572 msgid "0" msgstr "0" -#: ../../library/time.rst:552 +#: ../../library/time.rst:572 msgid ":attr:`tm_year`" msgstr ":attr:`tm_year`" -#: ../../library/time.rst:552 +#: ../../library/time.rst:572 msgid "(for example, 1993)" msgstr "" -#: ../../library/time.rst:554 +#: ../../library/time.rst:574 msgid "1" msgstr "1" -#: ../../library/time.rst:554 +#: ../../library/time.rst:574 msgid ":attr:`tm_mon`" msgstr ":attr:`tm_mon`" -#: ../../library/time.rst:554 +#: ../../library/time.rst:574 msgid "range [1, 12]" msgstr "" -#: ../../library/time.rst:556 +#: ../../library/time.rst:576 msgid "2" msgstr "2" -#: ../../library/time.rst:556 +#: ../../library/time.rst:576 msgid ":attr:`tm_mday`" msgstr ":attr:`tm_mday`" -#: ../../library/time.rst:556 +#: ../../library/time.rst:576 msgid "range [1, 31]" msgstr "" -#: ../../library/time.rst:558 +#: ../../library/time.rst:578 msgid "3" msgstr "3" -#: ../../library/time.rst:558 +#: ../../library/time.rst:578 msgid ":attr:`tm_hour`" msgstr ":attr:`tm_hour`" -#: ../../library/time.rst:558 +#: ../../library/time.rst:578 msgid "range [0, 23]" msgstr "" -#: ../../library/time.rst:560 +#: ../../library/time.rst:580 msgid "4" msgstr "4" -#: ../../library/time.rst:560 +#: ../../library/time.rst:580 msgid ":attr:`tm_min`" msgstr ":attr:`tm_min`" -#: ../../library/time.rst:560 +#: ../../library/time.rst:580 msgid "range [0, 59]" msgstr "" -#: ../../library/time.rst:562 +#: ../../library/time.rst:582 msgid "5" msgstr "5" -#: ../../library/time.rst:562 +#: ../../library/time.rst:582 msgid ":attr:`tm_sec`" msgstr ":attr:`tm_sec`" -#: ../../library/time.rst:562 +#: ../../library/time.rst:582 msgid "range [0, 61]; see **(2)** in :func:`strftime` description" msgstr "" -#: ../../library/time.rst:565 +#: ../../library/time.rst:585 msgid "6" msgstr "6" -#: ../../library/time.rst:565 +#: ../../library/time.rst:585 msgid ":attr:`tm_wday`" msgstr ":attr:`tm_wday`" -#: ../../library/time.rst:565 +#: ../../library/time.rst:585 msgid "range [0, 6], Monday is 0" msgstr "" -#: ../../library/time.rst:567 +#: ../../library/time.rst:587 msgid "7" msgstr "7" -#: ../../library/time.rst:567 +#: ../../library/time.rst:587 msgid ":attr:`tm_yday`" msgstr ":attr:`tm_yday`" -#: ../../library/time.rst:567 +#: ../../library/time.rst:587 msgid "range [1, 366]" msgstr "" -#: ../../library/time.rst:569 +#: ../../library/time.rst:589 msgid "8" msgstr "8" -#: ../../library/time.rst:569 +#: ../../library/time.rst:589 msgid ":attr:`tm_isdst`" msgstr ":attr:`tm_isdst`" -#: ../../library/time.rst:569 +#: ../../library/time.rst:589 msgid "0, 1 or -1; see below" msgstr "" -#: ../../library/time.rst:571 ../../library/time.rst:573 +#: ../../library/time.rst:591 ../../library/time.rst:593 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:571 +#: ../../library/time.rst:591 msgid ":attr:`tm_zone`" msgstr ":attr:`tm_zone`" -#: ../../library/time.rst:571 +#: ../../library/time.rst:591 msgid "abbreviation of timezone name" msgstr "" -#: ../../library/time.rst:573 +#: ../../library/time.rst:593 msgid ":attr:`tm_gmtoff`" msgstr ":attr:`tm_gmtoff`" -#: ../../library/time.rst:573 +#: ../../library/time.rst:593 msgid "offset east of UTC in seconds" msgstr "" -#: ../../library/time.rst:576 +#: ../../library/time.rst:596 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "" -#: ../../library/time.rst:579 +#: ../../library/time.rst:599 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -946,25 +990,23 @@ msgid "" "filled in." msgstr "" -#: ../../library/time.rst:583 +#: ../../library/time.rst:603 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" "`TypeError` is raised." msgstr "" -#: ../../library/time.rst:589 +#: ../../library/time.rst:609 msgid "" "Return the time in seconds since the epoch_ as a floating point number. The " -"specific date of the epoch and the handling of `leap seconds`_ is platform " -"dependent. On Windows and most Unix systems, the epoch is January 1, 1970, " -"00:00:00 (UTC) and leap seconds are not counted towards the time in seconds " -"since the epoch. This is commonly referred to as `Unix time `_. To find out what the epoch is on a given " -"platform, look at ``gmtime(0)``." +"handling of `leap seconds`_ is platform dependent. On Windows and most Unix " +"systems, the leap seconds are not counted towards the time in seconds since " +"the epoch_. This is commonly referred to as `Unix time `_." msgstr "" -#: ../../library/time.rst:599 +#: ../../library/time.rst:615 msgid "" "Note that even though the time is always returned as a floating point " "number, not all systems provide time with a better precision than 1 second. " @@ -973,7 +1015,7 @@ msgid "" "between the two calls." msgstr "" -#: ../../library/time.rst:605 +#: ../../library/time.rst:621 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -983,19 +1025,19 @@ msgid "" "attributes." msgstr "" -#: ../../library/time.rst:612 +#: ../../library/time.rst:628 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "" -#: ../../library/time.rst:618 +#: ../../library/time.rst:634 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "" -#: ../../library/time.rst:631 +#: ../../library/time.rst:647 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1004,23 +1046,25 @@ msgid "" "of two calls in the same thread is valid." msgstr "" -#: ../../library/time.rst:637 +#: ../../library/time.rst:653 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" -#: ../../library/time.rst:642 -msgid "" -":ref:`Availability `: Windows, Linux, Unix systems supporting " -"``CLOCK_THREAD_CPUTIME_ID``." +#: ../../library/time.rst:-1 +msgid ":ref:`Availability `: Linux, Unix, Windows." +msgstr ":ref:`適用 `:Linux、Unix、Windows。" + +#: ../../library/time.rst:658 +msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "" -#: ../../library/time.rst:648 +#: ../../library/time.rst:665 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "" -#: ../../library/time.rst:655 +#: ../../library/time.rst:672 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1031,42 +1075,42 @@ msgid "" "when daylight saving time applies)." msgstr "" -#: ../../library/time.rst:667 +#: ../../library/time.rst:684 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" -#: ../../library/time.rst:671 +#: ../../library/time.rst:688 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr "" -#: ../../library/time.rst:673 +#: ../../library/time.rst:690 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" -#: ../../library/time.rst:678 +#: ../../library/time.rst:695 msgid "Where the components are:" msgstr "" -#: ../../library/time.rst:682 +#: ../../library/time.rst:699 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:681 +#: ../../library/time.rst:698 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -#: ../../library/time.rst:688 +#: ../../library/time.rst:705 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:685 +#: ../../library/time.rst:702 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1074,41 +1118,41 @@ msgid "" "summer time is assumed to be one hour ahead of standard time." msgstr "" -#: ../../library/time.rst:710 +#: ../../library/time.rst:727 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:691 +#: ../../library/time.rst:708 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" -#: ../../library/time.rst:696 +#: ../../library/time.rst:713 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:695 +#: ../../library/time.rst:712 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" -#: ../../library/time.rst:700 +#: ../../library/time.rst:717 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:699 +#: ../../library/time.rst:716 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" -#: ../../library/time.rst:707 +#: ../../library/time.rst:724 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:703 +#: ../../library/time.rst:720 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month *m*" @@ -1116,13 +1160,13 @@ msgid "" "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" -#: ../../library/time.rst:709 +#: ../../library/time.rst:726 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" -#: ../../library/time.rst:723 +#: ../../library/time.rst:740 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1133,23 +1177,23 @@ msgid "" "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" -#: ../../library/time.rst:744 +#: ../../library/time.rst:761 msgid "Clock ID Constants" msgstr "" -#: ../../library/time.rst:746 +#: ../../library/time.rst:763 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" -#: ../../library/time.rst:751 +#: ../../library/time.rst:768 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" -#: ../../library/time.rst:754 +#: ../../library/time.rst:771 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " @@ -1157,106 +1201,103 @@ msgid "" "similar." msgstr "" -#: ../../library/time.rst:760 -msgid ":ref:`Availability `: Linux 2.6.39 or later." +#: ../../library/time.rst:777 +msgid ":ref:`Availability `: Linux >= 2.6.39." msgstr ":ref:`適用 `:Linux 2.6.39 以上。" -#: ../../library/time.rst:766 +#: ../../library/time.rst:783 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -#: ../../library/time.rst:771 +#: ../../library/time.rst:788 msgid ":ref:`Availability `: Solaris." msgstr ":ref:`適用 `:Solaris。" -#: ../../library/time.rst:777 +#: ../../library/time.rst:794 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "" -#: ../../library/time.rst:787 +#: ../../library/time.rst:804 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" -#: ../../library/time.rst:791 -msgid "" -":ref:`Availability `: Linux 2.6.28 and newer, macOS 10.12 and " -"newer." -msgstr "" +#: ../../library/time.rst:808 +msgid ":ref:`Availability `: Linux >= 2.6.28, macOS >= 10.12." +msgstr ":ref:`適用 `:Linux 2.6.28 以上、macOS 10.12 以上。" -#: ../../library/time.rst:797 ../../library/time.rst:806 +#: ../../library/time.rst:814 ../../library/time.rst:823 msgid "High-resolution per-process timer from the CPU." msgstr "" -#: ../../library/time.rst:809 -msgid "" -":ref:`Availability `: FreeBSD, NetBSD 7 or later, OpenBSD." -msgstr "" +#: ../../library/time.rst:826 +msgid ":ref:`Availability `: FreeBSD, NetBSD >= 7, OpenBSD." +msgstr ":ref:`適用 `:FreeBSD、NetBSD 7 以上、OpenBSD。" -#: ../../library/time.rst:814 +#: ../../library/time.rst:831 msgid "" "`International Atomic Time `_" msgstr "" -#: ../../library/time.rst:816 +#: ../../library/time.rst:833 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -#: ../../library/time.rst:820 +#: ../../library/time.rst:837 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/time.rst:825 +#: ../../library/time.rst:842 msgid "Thread-specific CPU-time clock." msgstr "" -#: ../../library/time.rst:834 +#: ../../library/time.rst:851 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" -#: ../../library/time.rst:839 -msgid ":ref:`Availability `: FreeBSD, OpenBSD 5.5 or later." +#: ../../library/time.rst:856 +msgid ":ref:`Availability `: FreeBSD, OpenBSD >= 5.5." msgstr ":ref:`適用 `:FreeBSD、OpenBSD 5.5 以上。" -#: ../../library/time.rst:845 +#: ../../library/time.rst:862 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" -#: ../../library/time.rst:850 -msgid ":ref:`Availability `: macOS 10.12 and newer." +#: ../../library/time.rst:867 +msgid ":ref:`Availability `: macOS >= 10.12." msgstr ":ref:`適用 `:macOS 10.12 以上。" -#: ../../library/time.rst:853 +#: ../../library/time.rst:870 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "" -#: ../../library/time.rst:859 +#: ../../library/time.rst:876 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "" -#: ../../library/time.rst:870 +#: ../../library/time.rst:887 msgid "Timezone Constants" msgstr "" -#: ../../library/time.rst:874 +#: ../../library/time.rst:891 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1264,25 +1305,25 @@ msgid "" "nonzero. See note below." msgstr "" -#: ../../library/time.rst:880 +#: ../../library/time.rst:897 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "" -#: ../../library/time.rst:884 +#: ../../library/time.rst:901 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" -#: ../../library/time.rst:889 +#: ../../library/time.rst:906 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" -#: ../../library/time.rst:895 +#: ../../library/time.rst:912 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1292,40 +1333,40 @@ msgid "" "obtain timezone information." msgstr "" -#: ../../library/time.rst:905 +#: ../../library/time.rst:922 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:905 +#: ../../library/time.rst:922 msgid "More object-oriented interface to dates and times." msgstr "" -#: ../../library/time.rst:909 +#: ../../library/time.rst:926 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:908 +#: ../../library/time.rst:925 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" -#: ../../library/time.rst:912 +#: ../../library/time.rst:929 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:912 +#: ../../library/time.rst:929 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" -#: ../../library/time.rst:916 +#: ../../library/time.rst:933 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:917 +#: ../../library/time.rst:934 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " diff --git a/library/timeit.po b/library/timeit.po index d6e619fbe4..d1f065ba5e 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-15 00:10+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -248,7 +248,8 @@ msgstr "" #: ../../library/timeit.rst:236 msgid "" -"specify a time unit for timer output; can select nsec, usec, msec, or sec" +"specify a time unit for timer output; can select ``nsec``, ``usec``, " +"``msec``, or ``sec``" msgstr "" #: ../../library/timeit.rst:242 diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 9a67599372..3232f039cc 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,43 +29,41 @@ msgstr "**原始碼:**\\ :source:`Lib/tkinter/ttk.py`" #: ../../library/tkinter.ttk.rst:15 msgid "" "The :mod:`tkinter.ttk` module provides access to the Tk themed widget set, " -"introduced in Tk 8.5. If Python has not been compiled against Tk 8.5, this " -"module can still be accessed if *Tile* has been installed. The former " -"method using Tk 8.5 provides additional benefits including anti-aliased font " -"rendering under X11 and window transparency (requiring a composition window " -"manager on X11)." +"introduced in Tk 8.5. It provides additional benefits including anti-aliased " +"font rendering under X11 and window transparency (requiring a composition " +"window manager on X11)." msgstr "" -#: ../../library/tkinter.ttk.rst:22 +#: ../../library/tkinter.ttk.rst:20 msgid "" "The basic idea for :mod:`tkinter.ttk` is to separate, to the extent " "possible, the code implementing a widget's behavior from the code " "implementing its appearance." msgstr "" -#: ../../library/tkinter.ttk.rst:29 +#: ../../library/tkinter.ttk.rst:27 msgid "" "`Tk Widget Styling Support `_" msgstr "" -#: ../../library/tkinter.ttk.rst:30 +#: ../../library/tkinter.ttk.rst:28 msgid "A document introducing theming support for Tk" msgstr "" -#: ../../library/tkinter.ttk.rst:34 +#: ../../library/tkinter.ttk.rst:32 msgid "Using Ttk" msgstr "" -#: ../../library/tkinter.ttk.rst:36 +#: ../../library/tkinter.ttk.rst:34 msgid "To start using Ttk, import its module::" msgstr "" -#: ../../library/tkinter.ttk.rst:40 +#: ../../library/tkinter.ttk.rst:38 msgid "" "To override the basic Tk widgets, the import should follow the Tk import::" msgstr "" -#: ../../library/tkinter.ttk.rst:45 +#: ../../library/tkinter.ttk.rst:43 msgid "" "That code causes several :mod:`tkinter.ttk` widgets (:class:`Button`, :class:" "`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:" @@ -74,7 +72,7 @@ msgid "" "replace the Tk widgets." msgstr "" -#: ../../library/tkinter.ttk.rst:51 +#: ../../library/tkinter.ttk.rst:49 msgid "" "This has the direct benefit of using the new widgets which gives a better " "look and feel across platforms; however, the replacement widgets are not " @@ -84,23 +82,23 @@ msgid "" "styling effects." msgstr "" -#: ../../library/tkinter.ttk.rst:62 +#: ../../library/tkinter.ttk.rst:60 msgid "" "`Converting existing applications to use Tile widgets `_" msgstr "" -#: ../../library/tkinter.ttk.rst:62 +#: ../../library/tkinter.ttk.rst:60 msgid "" "A monograph (using Tcl terminology) about differences typically encountered " "when moving applications to use the new widgets." msgstr "" -#: ../../library/tkinter.ttk.rst:67 +#: ../../library/tkinter.ttk.rst:65 msgid "Ttk Widgets" msgstr "" -#: ../../library/tkinter.ttk.rst:69 +#: ../../library/tkinter.ttk.rst:67 msgid "" "Ttk comes with 18 widgets, twelve of which already existed in tkinter: :" "class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:" @@ -111,70 +109,70 @@ msgid "" "`Treeview`. And all them are subclasses of :class:`Widget`." msgstr "" -#: ../../library/tkinter.ttk.rst:77 +#: ../../library/tkinter.ttk.rst:75 msgid "" "Using the Ttk widgets gives the application an improved look and feel. As " "discussed above, there are differences in how the styling is coded." msgstr "" -#: ../../library/tkinter.ttk.rst:80 +#: ../../library/tkinter.ttk.rst:78 msgid "Tk code::" msgstr "" -#: ../../library/tkinter.ttk.rst:86 +#: ../../library/tkinter.ttk.rst:84 msgid "Ttk code::" msgstr "" -#: ../../library/tkinter.ttk.rst:94 +#: ../../library/tkinter.ttk.rst:92 msgid "" "For more information about TtkStyling_, see the :class:`Style` class " "documentation." msgstr "" -#: ../../library/tkinter.ttk.rst:98 +#: ../../library/tkinter.ttk.rst:96 msgid "Widget" msgstr "" -#: ../../library/tkinter.ttk.rst:100 +#: ../../library/tkinter.ttk.rst:98 msgid "" ":class:`ttk.Widget` defines standard options and methods supported by Tk " "themed widgets and is not supposed to be directly instantiated." msgstr "" -#: ../../library/tkinter.ttk.rst:105 +#: ../../library/tkinter.ttk.rst:103 msgid "Standard Options" msgstr "" -#: ../../library/tkinter.ttk.rst:107 +#: ../../library/tkinter.ttk.rst:105 msgid "All the :mod:`ttk` Widgets accepts the following options:" msgstr "" -#: ../../library/tkinter.ttk.rst:112 ../../library/tkinter.ttk.rst:147 -#: ../../library/tkinter.ttk.rst:173 ../../library/tkinter.ttk.rst:216 -#: ../../library/tkinter.ttk.rst:319 ../../library/tkinter.ttk.rst:405 -#: ../../library/tkinter.ttk.rst:481 ../../library/tkinter.ttk.rst:507 -#: ../../library/tkinter.ttk.rst:671 ../../library/tkinter.ttk.rst:742 -#: ../../library/tkinter.ttk.rst:810 ../../library/tkinter.ttk.rst:861 -#: ../../library/tkinter.ttk.rst:889 +#: ../../library/tkinter.ttk.rst:110 ../../library/tkinter.ttk.rst:145 +#: ../../library/tkinter.ttk.rst:171 ../../library/tkinter.ttk.rst:214 +#: ../../library/tkinter.ttk.rst:317 ../../library/tkinter.ttk.rst:403 +#: ../../library/tkinter.ttk.rst:479 ../../library/tkinter.ttk.rst:505 +#: ../../library/tkinter.ttk.rst:669 ../../library/tkinter.ttk.rst:740 +#: ../../library/tkinter.ttk.rst:808 ../../library/tkinter.ttk.rst:859 +#: ../../library/tkinter.ttk.rst:887 msgid "Option" msgstr "" -#: ../../library/tkinter.ttk.rst:112 ../../library/tkinter.ttk.rst:147 -#: ../../library/tkinter.ttk.rst:173 ../../library/tkinter.ttk.rst:216 -#: ../../library/tkinter.ttk.rst:232 ../../library/tkinter.ttk.rst:319 -#: ../../library/tkinter.ttk.rst:405 ../../library/tkinter.ttk.rst:481 -#: ../../library/tkinter.ttk.rst:507 ../../library/tkinter.ttk.rst:671 -#: ../../library/tkinter.ttk.rst:742 ../../library/tkinter.ttk.rst:810 -#: ../../library/tkinter.ttk.rst:861 ../../library/tkinter.ttk.rst:889 -#: ../../library/tkinter.ttk.rst:934 +#: ../../library/tkinter.ttk.rst:110 ../../library/tkinter.ttk.rst:145 +#: ../../library/tkinter.ttk.rst:171 ../../library/tkinter.ttk.rst:214 +#: ../../library/tkinter.ttk.rst:230 ../../library/tkinter.ttk.rst:317 +#: ../../library/tkinter.ttk.rst:403 ../../library/tkinter.ttk.rst:479 +#: ../../library/tkinter.ttk.rst:505 ../../library/tkinter.ttk.rst:669 +#: ../../library/tkinter.ttk.rst:740 ../../library/tkinter.ttk.rst:808 +#: ../../library/tkinter.ttk.rst:859 ../../library/tkinter.ttk.rst:887 +#: ../../library/tkinter.ttk.rst:932 msgid "Description" msgstr "描述" -#: ../../library/tkinter.ttk.rst:114 +#: ../../library/tkinter.ttk.rst:112 msgid "class" msgstr "" -#: ../../library/tkinter.ttk.rst:114 +#: ../../library/tkinter.ttk.rst:112 msgid "" "Specifies the window class. The class is used when querying the option " "database for the window's other options, to determine the default bindtags " @@ -182,21 +180,21 @@ msgid "" "option is read-only, and may only be specified when the window is created." msgstr "" -#: ../../library/tkinter.ttk.rst:121 +#: ../../library/tkinter.ttk.rst:119 msgid "cursor" msgstr "" -#: ../../library/tkinter.ttk.rst:121 +#: ../../library/tkinter.ttk.rst:119 msgid "" "Specifies the mouse cursor to be used for the widget. If set to the empty " "string (the default), the cursor is inherited for the parent widget." msgstr "" -#: ../../library/tkinter.ttk.rst:125 +#: ../../library/tkinter.ttk.rst:123 msgid "takefocus" msgstr "" -#: ../../library/tkinter.ttk.rst:125 +#: ../../library/tkinter.ttk.rst:123 msgid "" "Determines whether the window accepts the focus during keyboard traversal. " "0, 1 or an empty string is returned. If 0 is returned, it means that the " @@ -206,100 +204,100 @@ msgid "" "whether or not to focus on the window." msgstr "" -#: ../../library/tkinter.ttk.rst:134 +#: ../../library/tkinter.ttk.rst:132 msgid "style" msgstr "" -#: ../../library/tkinter.ttk.rst:134 +#: ../../library/tkinter.ttk.rst:132 msgid "May be used to specify a custom widget style." msgstr "" -#: ../../library/tkinter.ttk.rst:139 +#: ../../library/tkinter.ttk.rst:137 msgid "Scrollable Widget Options" msgstr "" -#: ../../library/tkinter.ttk.rst:141 +#: ../../library/tkinter.ttk.rst:139 msgid "" "The following options are supported by widgets that are controlled by a " "scrollbar." msgstr "" -#: ../../library/tkinter.ttk.rst:149 +#: ../../library/tkinter.ttk.rst:147 msgid "xscrollcommand" msgstr "" -#: ../../library/tkinter.ttk.rst:149 +#: ../../library/tkinter.ttk.rst:147 msgid "Used to communicate with horizontal scrollbars." msgstr "" -#: ../../library/tkinter.ttk.rst:151 +#: ../../library/tkinter.ttk.rst:149 msgid "" "When the view in the widget's window change, the widget will generate a Tcl " "command based on the scrollcommand." msgstr "" -#: ../../library/tkinter.ttk.rst:154 +#: ../../library/tkinter.ttk.rst:152 msgid "" "Usually this option consists of the method :meth:`Scrollbar.set` of some " "scrollbar. This will cause the scrollbar to be updated whenever the view in " "the window changes." msgstr "" -#: ../../library/tkinter.ttk.rst:159 +#: ../../library/tkinter.ttk.rst:157 msgid "yscrollcommand" msgstr "" -#: ../../library/tkinter.ttk.rst:159 +#: ../../library/tkinter.ttk.rst:157 msgid "" "Used to communicate with vertical scrollbars. For some more information, see " "above." msgstr "" -#: ../../library/tkinter.ttk.rst:165 +#: ../../library/tkinter.ttk.rst:163 msgid "Label Options" msgstr "" -#: ../../library/tkinter.ttk.rst:167 +#: ../../library/tkinter.ttk.rst:165 msgid "" "The following options are supported by labels, buttons and other button-like " "widgets." msgstr "" -#: ../../library/tkinter.ttk.rst:175 ../../library/tkinter.ttk.rst:523 -#: ../../library/tkinter.ttk.rst:863 +#: ../../library/tkinter.ttk.rst:173 ../../library/tkinter.ttk.rst:521 +#: ../../library/tkinter.ttk.rst:861 msgid "text" msgstr "" -#: ../../library/tkinter.ttk.rst:175 +#: ../../library/tkinter.ttk.rst:173 msgid "Specifies a text string to be displayed inside the widget." msgstr "" -#: ../../library/tkinter.ttk.rst:177 ../../library/tkinter.ttk.rst:341 +#: ../../library/tkinter.ttk.rst:175 ../../library/tkinter.ttk.rst:339 msgid "textvariable" msgstr "" -#: ../../library/tkinter.ttk.rst:177 +#: ../../library/tkinter.ttk.rst:175 msgid "" "Specifies a name whose value will be used in place of the text option " "resource." msgstr "" -#: ../../library/tkinter.ttk.rst:180 ../../library/tkinter.ttk.rst:532 +#: ../../library/tkinter.ttk.rst:178 ../../library/tkinter.ttk.rst:530 msgid "underline" msgstr "" -#: ../../library/tkinter.ttk.rst:180 +#: ../../library/tkinter.ttk.rst:178 msgid "" "If set, specifies the index (0-based) of a character to underline in the " "text string. The underline character is used for mnemonic activation." msgstr "" -#: ../../library/tkinter.ttk.rst:184 ../../library/tkinter.ttk.rst:525 -#: ../../library/tkinter.ttk.rst:865 ../../library/tkinter.ttk.rst:897 +#: ../../library/tkinter.ttk.rst:182 ../../library/tkinter.ttk.rst:523 +#: ../../library/tkinter.ttk.rst:863 ../../library/tkinter.ttk.rst:895 msgid "image" msgstr "" -#: ../../library/tkinter.ttk.rst:184 +#: ../../library/tkinter.ttk.rst:182 msgid "" "Specifies an image to display. This is a list of 1 or more elements. The " "first element is the default image name. The rest of the list if a sequence " @@ -308,187 +306,187 @@ msgid "" "combination of states. All images in the list should have the same size." msgstr "" -#: ../../library/tkinter.ttk.rst:192 ../../library/tkinter.ttk.rst:528 +#: ../../library/tkinter.ttk.rst:190 ../../library/tkinter.ttk.rst:526 msgid "compound" msgstr "" -#: ../../library/tkinter.ttk.rst:192 +#: ../../library/tkinter.ttk.rst:190 msgid "" "Specifies how to display the image relative to the text, in the case both " "text and images options are present. Valid values are:" msgstr "" -#: ../../library/tkinter.ttk.rst:196 +#: ../../library/tkinter.ttk.rst:194 msgid "text: display text only" msgstr "" -#: ../../library/tkinter.ttk.rst:197 +#: ../../library/tkinter.ttk.rst:195 msgid "image: display image only" msgstr "" -#: ../../library/tkinter.ttk.rst:198 +#: ../../library/tkinter.ttk.rst:196 msgid "" "top, bottom, left, right: display image above, below, left of, or right of " "the text, respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:200 +#: ../../library/tkinter.ttk.rst:198 msgid "none: the default. display the image if present, otherwise the text." msgstr "" -#: ../../library/tkinter.ttk.rst:203 ../../library/tkinter.ttk.rst:349 -#: ../../library/tkinter.ttk.rst:493 +#: ../../library/tkinter.ttk.rst:201 ../../library/tkinter.ttk.rst:347 +#: ../../library/tkinter.ttk.rst:491 msgid "width" msgstr "" -#: ../../library/tkinter.ttk.rst:203 +#: ../../library/tkinter.ttk.rst:201 msgid "" "If greater than zero, specifies how much space, in character widths, to " "allocate for the text label, if less than zero, specifies a minimum width. " "If zero or unspecified, the natural width of the text label is used." msgstr "" -#: ../../library/tkinter.ttk.rst:211 +#: ../../library/tkinter.ttk.rst:209 msgid "Compatibility Options" msgstr "" -#: ../../library/tkinter.ttk.rst:218 ../../library/tkinter.ttk.rst:334 -#: ../../library/tkinter.ttk.rst:509 +#: ../../library/tkinter.ttk.rst:216 ../../library/tkinter.ttk.rst:332 +#: ../../library/tkinter.ttk.rst:507 msgid "state" msgstr "" -#: ../../library/tkinter.ttk.rst:218 +#: ../../library/tkinter.ttk.rst:216 msgid "" "May be set to \"normal\" or \"disabled\" to control the \"disabled\" state " "bit. This is a write-only option: setting it changes the widget state, but " "the :meth:`Widget.state` method does not affect this option." msgstr "" -#: ../../library/tkinter.ttk.rst:225 +#: ../../library/tkinter.ttk.rst:223 msgid "Widget States" msgstr "" -#: ../../library/tkinter.ttk.rst:227 +#: ../../library/tkinter.ttk.rst:225 msgid "The widget state is a bitmap of independent state flags." msgstr "" -#: ../../library/tkinter.ttk.rst:232 +#: ../../library/tkinter.ttk.rst:230 msgid "Flag" msgstr "" -#: ../../library/tkinter.ttk.rst:234 +#: ../../library/tkinter.ttk.rst:232 msgid "active" msgstr "" -#: ../../library/tkinter.ttk.rst:234 +#: ../../library/tkinter.ttk.rst:232 msgid "" "The mouse cursor is over the widget and pressing a mouse button will cause " "some action to occur" msgstr "" -#: ../../library/tkinter.ttk.rst:237 +#: ../../library/tkinter.ttk.rst:235 msgid "disabled" msgstr "" -#: ../../library/tkinter.ttk.rst:237 +#: ../../library/tkinter.ttk.rst:235 msgid "Widget is disabled under program control" msgstr "" -#: ../../library/tkinter.ttk.rst:239 +#: ../../library/tkinter.ttk.rst:237 msgid "focus" msgstr "" -#: ../../library/tkinter.ttk.rst:239 +#: ../../library/tkinter.ttk.rst:237 msgid "Widget has keyboard focus" msgstr "" -#: ../../library/tkinter.ttk.rst:241 +#: ../../library/tkinter.ttk.rst:239 msgid "pressed" msgstr "" -#: ../../library/tkinter.ttk.rst:241 +#: ../../library/tkinter.ttk.rst:239 msgid "Widget is being pressed" msgstr "" -#: ../../library/tkinter.ttk.rst:243 +#: ../../library/tkinter.ttk.rst:241 msgid "selected" msgstr "" -#: ../../library/tkinter.ttk.rst:243 +#: ../../library/tkinter.ttk.rst:241 msgid "" "\"On\", \"true\", or \"current\" for things like Checkbuttons and " "radiobuttons" msgstr "" -#: ../../library/tkinter.ttk.rst:246 ../../library/tkinter.ttk.rst:893 +#: ../../library/tkinter.ttk.rst:244 ../../library/tkinter.ttk.rst:891 msgid "background" msgstr "" -#: ../../library/tkinter.ttk.rst:246 +#: ../../library/tkinter.ttk.rst:244 msgid "" "Windows and Mac have a notion of an \"active\" or foreground window. The " "*background* state is set for widgets in a background window, and cleared " "for those in the foreground window" msgstr "" -#: ../../library/tkinter.ttk.rst:251 +#: ../../library/tkinter.ttk.rst:249 msgid "readonly" msgstr "" -#: ../../library/tkinter.ttk.rst:251 +#: ../../library/tkinter.ttk.rst:249 msgid "Widget should not allow user modification" msgstr "" -#: ../../library/tkinter.ttk.rst:253 +#: ../../library/tkinter.ttk.rst:251 msgid "alternate" msgstr "" -#: ../../library/tkinter.ttk.rst:253 +#: ../../library/tkinter.ttk.rst:251 msgid "A widget-specific alternate display format" msgstr "" -#: ../../library/tkinter.ttk.rst:255 +#: ../../library/tkinter.ttk.rst:253 msgid "invalid" msgstr "" -#: ../../library/tkinter.ttk.rst:255 +#: ../../library/tkinter.ttk.rst:253 msgid "The widget's value is invalid" msgstr "" -#: ../../library/tkinter.ttk.rst:258 +#: ../../library/tkinter.ttk.rst:256 msgid "" "A state specification is a sequence of state names, optionally prefixed with " "an exclamation point indicating that the bit is off." msgstr "" -#: ../../library/tkinter.ttk.rst:263 +#: ../../library/tkinter.ttk.rst:261 msgid "ttk.Widget" msgstr "ttk.Widget" -#: ../../library/tkinter.ttk.rst:265 +#: ../../library/tkinter.ttk.rst:263 msgid "" "Besides the methods described below, the :class:`ttk.Widget` supports the " "methods :meth:`tkinter.Widget.cget` and :meth:`tkinter.Widget.configure`." msgstr "" -#: ../../library/tkinter.ttk.rst:272 +#: ../../library/tkinter.ttk.rst:270 msgid "" "Returns the name of the element at position *x* *y*, or the empty string if " "the point does not lie within any element." msgstr "" -#: ../../library/tkinter.ttk.rst:275 +#: ../../library/tkinter.ttk.rst:273 msgid "*x* and *y* are pixel coordinates relative to the widget." msgstr "" -#: ../../library/tkinter.ttk.rst:280 +#: ../../library/tkinter.ttk.rst:278 msgid "" "Test the widget's state. If a callback is not specified, returns ``True`` if " "the widget state matches *statespec* and ``False`` otherwise. If callback is " "specified then it is called with args if widget state matches *statespec*." msgstr "" -#: ../../library/tkinter.ttk.rst:288 +#: ../../library/tkinter.ttk.rst:286 msgid "" "Modify or inquire widget state. If *statespec* is specified, sets the widget " "state according to it and return a new *statespec* indicating which flags " @@ -496,21 +494,21 @@ msgid "" "state flags." msgstr "" -#: ../../library/tkinter.ttk.rst:293 +#: ../../library/tkinter.ttk.rst:291 msgid "*statespec* will usually be a list or a tuple." msgstr "" -#: ../../library/tkinter.ttk.rst:297 +#: ../../library/tkinter.ttk.rst:295 msgid "Combobox" msgstr "" -#: ../../library/tkinter.ttk.rst:299 +#: ../../library/tkinter.ttk.rst:297 msgid "" "The :class:`ttk.Combobox` widget combines a text field with a pop-down list " "of values. This widget is a subclass of :class:`Entry`." msgstr "" -#: ../../library/tkinter.ttk.rst:302 +#: ../../library/tkinter.ttk.rst:300 msgid "" "Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" "meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " @@ -520,59 +518,59 @@ msgid "" "it has some other methods, described at :class:`ttk.Combobox`." msgstr "" -#: ../../library/tkinter.ttk.rst:312 ../../library/tkinter.ttk.rst:398 -#: ../../library/tkinter.ttk.rst:474 ../../library/tkinter.ttk.rst:664 -#: ../../library/tkinter.ttk.rst:735 ../../library/tkinter.ttk.rst:803 +#: ../../library/tkinter.ttk.rst:310 ../../library/tkinter.ttk.rst:396 +#: ../../library/tkinter.ttk.rst:472 ../../library/tkinter.ttk.rst:662 +#: ../../library/tkinter.ttk.rst:733 ../../library/tkinter.ttk.rst:801 msgid "Options" msgstr "" -#: ../../library/tkinter.ttk.rst:314 ../../library/tkinter.ttk.rst:400 -#: ../../library/tkinter.ttk.rst:476 ../../library/tkinter.ttk.rst:666 -#: ../../library/tkinter.ttk.rst:805 +#: ../../library/tkinter.ttk.rst:312 ../../library/tkinter.ttk.rst:398 +#: ../../library/tkinter.ttk.rst:474 ../../library/tkinter.ttk.rst:664 +#: ../../library/tkinter.ttk.rst:803 msgid "This widget accepts the following specific options:" msgstr "" -#: ../../library/tkinter.ttk.rst:321 +#: ../../library/tkinter.ttk.rst:319 msgid "exportselection" msgstr "" -#: ../../library/tkinter.ttk.rst:321 +#: ../../library/tkinter.ttk.rst:319 msgid "" "Boolean value. If set, the widget selection is linked to the Window Manager " "selection (which can be returned by invoking Misc.selection_get, for " "example)." msgstr "" -#: ../../library/tkinter.ttk.rst:325 +#: ../../library/tkinter.ttk.rst:323 msgid "justify" msgstr "" -#: ../../library/tkinter.ttk.rst:325 +#: ../../library/tkinter.ttk.rst:323 msgid "" "Specifies how the text is aligned within the widget. One of \"left\", " "\"center\", or \"right\"." msgstr "" -#: ../../library/tkinter.ttk.rst:328 ../../library/tkinter.ttk.rst:483 -#: ../../library/tkinter.ttk.rst:820 +#: ../../library/tkinter.ttk.rst:326 ../../library/tkinter.ttk.rst:481 +#: ../../library/tkinter.ttk.rst:818 msgid "height" msgstr "" -#: ../../library/tkinter.ttk.rst:328 +#: ../../library/tkinter.ttk.rst:326 msgid "Specifies the height of the pop-down listbox, in rows." msgstr "" -#: ../../library/tkinter.ttk.rst:330 +#: ../../library/tkinter.ttk.rst:328 msgid "postcommand" msgstr "" -#: ../../library/tkinter.ttk.rst:330 +#: ../../library/tkinter.ttk.rst:328 msgid "" "A script (possibly registered with Misc.register) that is called immediately " "before displaying the values. It may specify which values to display." msgstr "" -#: ../../library/tkinter.ttk.rst:334 +#: ../../library/tkinter.ttk.rst:332 msgid "" "One of \"normal\", \"readonly\", or \"disabled\". In the \"readonly\" state, " "the value may not be edited directly, and the user can only selection of the " @@ -580,69 +578,69 @@ msgid "" "directly editable. In the \"disabled\" state, no interaction is possible." msgstr "" -#: ../../library/tkinter.ttk.rst:341 +#: ../../library/tkinter.ttk.rst:339 msgid "" "Specifies a name whose value is linked to the widget value. Whenever the " "value associated with that name changes, the widget value is updated, and " "vice versa. See :class:`tkinter.StringVar`." msgstr "" -#: ../../library/tkinter.ttk.rst:346 ../../library/tkinter.ttk.rst:419 -#: ../../library/tkinter.ttk.rst:867 +#: ../../library/tkinter.ttk.rst:344 ../../library/tkinter.ttk.rst:417 +#: ../../library/tkinter.ttk.rst:865 msgid "values" msgstr "" -#: ../../library/tkinter.ttk.rst:346 +#: ../../library/tkinter.ttk.rst:344 msgid "Specifies the list of values to display in the drop-down listbox." msgstr "" -#: ../../library/tkinter.ttk.rst:349 +#: ../../library/tkinter.ttk.rst:347 msgid "" "Specifies an integer value indicating the desired width of the entry window, " "in average-size characters of the widget's font." msgstr "" -#: ../../library/tkinter.ttk.rst:356 ../../library/tkinter.ttk.rst:444 +#: ../../library/tkinter.ttk.rst:354 ../../library/tkinter.ttk.rst:442 msgid "Virtual events" msgstr "" -#: ../../library/tkinter.ttk.rst:358 +#: ../../library/tkinter.ttk.rst:356 msgid "" "The combobox widgets generates a **<>** virtual event when " "the user selects an element from the list of values." msgstr "" -#: ../../library/tkinter.ttk.rst:363 +#: ../../library/tkinter.ttk.rst:361 msgid "ttk.Combobox" msgstr "ttk.Combobox" -#: ../../library/tkinter.ttk.rst:369 +#: ../../library/tkinter.ttk.rst:367 msgid "" "If *newindex* is specified, sets the combobox value to the element position " "*newindex*. Otherwise, returns the index of the current value or -1 if the " "current value is not in the values list." msgstr "" -#: ../../library/tkinter.ttk.rst:376 +#: ../../library/tkinter.ttk.rst:374 msgid "Returns the current value of the combobox." msgstr "" -#: ../../library/tkinter.ttk.rst:381 +#: ../../library/tkinter.ttk.rst:379 msgid "Sets the value of the combobox to *value*." msgstr "" -#: ../../library/tkinter.ttk.rst:385 +#: ../../library/tkinter.ttk.rst:383 msgid "Spinbox" msgstr "" -#: ../../library/tkinter.ttk.rst:386 +#: ../../library/tkinter.ttk.rst:384 msgid "" "The :class:`ttk.Spinbox` widget is a :class:`ttk.Entry` enhanced with " "increment and decrement arrows. It can be used for numbers or lists of " "string values. This widget is a subclass of :class:`Entry`." msgstr "" -#: ../../library/tkinter.ttk.rst:390 +#: ../../library/tkinter.ttk.rst:388 msgid "" "Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" "meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " @@ -652,119 +650,119 @@ msgid "" "methods, described at :class:`ttk.Spinbox`." msgstr "" -#: ../../library/tkinter.ttk.rst:407 +#: ../../library/tkinter.ttk.rst:405 msgid "from" msgstr "" -#: ../../library/tkinter.ttk.rst:407 +#: ../../library/tkinter.ttk.rst:405 msgid "" "Float value. If set, this is the minimum value to which the decrement " "button will decrement. Must be spelled as ``from_`` when used as an " "argument, since ``from`` is a Python keyword." msgstr "" -#: ../../library/tkinter.ttk.rst:412 +#: ../../library/tkinter.ttk.rst:410 msgid "to" msgstr "" -#: ../../library/tkinter.ttk.rst:412 +#: ../../library/tkinter.ttk.rst:410 msgid "" "Float value. If set, this is the maximum value to which the increment " "button will increment." msgstr "" -#: ../../library/tkinter.ttk.rst:415 +#: ../../library/tkinter.ttk.rst:413 msgid "increment" msgstr "" -#: ../../library/tkinter.ttk.rst:415 +#: ../../library/tkinter.ttk.rst:413 msgid "" "Float value. Specifies the amount which the increment/decrement buttons " "change the value. Defaults to 1.0." msgstr "" -#: ../../library/tkinter.ttk.rst:419 +#: ../../library/tkinter.ttk.rst:417 msgid "" "Sequence of string or float values. If specified, the increment/decrement " "buttons will cycle through the items in this sequence rather than " "incrementing or decrementing numbers." msgstr "" -#: ../../library/tkinter.ttk.rst:425 +#: ../../library/tkinter.ttk.rst:423 msgid "wrap" msgstr "" -#: ../../library/tkinter.ttk.rst:425 +#: ../../library/tkinter.ttk.rst:423 msgid "" "Boolean value. If ``True``, increment and decrement buttons will cycle from " "the ``to`` value to the ``from`` value or the ``from`` value to the ``to`` " "value, respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:430 +#: ../../library/tkinter.ttk.rst:428 msgid "format" msgstr "" -#: ../../library/tkinter.ttk.rst:430 +#: ../../library/tkinter.ttk.rst:428 msgid "" "String value. This specifies the format of numbers set by the increment/" "decrement buttons. It must be in the form \"%W.Pf\", where W is the padded " "width of the value, P is the precision, and '%' and 'f' are literal." msgstr "" -#: ../../library/tkinter.ttk.rst:436 +#: ../../library/tkinter.ttk.rst:434 msgid "command" msgstr "" -#: ../../library/tkinter.ttk.rst:436 +#: ../../library/tkinter.ttk.rst:434 msgid "" "Python callable. Will be called with no arguments whenever either of the " "increment or decrement buttons are pressed." msgstr "" -#: ../../library/tkinter.ttk.rst:446 +#: ../../library/tkinter.ttk.rst:444 msgid "" "The spinbox widget generates an **<>** virtual event when the " "user presses , and a **<>** virtual event when the user " "presses ." msgstr "" -#: ../../library/tkinter.ttk.rst:451 +#: ../../library/tkinter.ttk.rst:449 msgid "ttk.Spinbox" msgstr "ttk.Spinbox" -#: ../../library/tkinter.ttk.rst:457 +#: ../../library/tkinter.ttk.rst:455 msgid "Returns the current value of the spinbox." msgstr "" -#: ../../library/tkinter.ttk.rst:462 +#: ../../library/tkinter.ttk.rst:460 msgid "Sets the value of the spinbox to *value*." msgstr "" -#: ../../library/tkinter.ttk.rst:466 +#: ../../library/tkinter.ttk.rst:464 msgid "Notebook" msgstr "" -#: ../../library/tkinter.ttk.rst:468 +#: ../../library/tkinter.ttk.rst:466 msgid "" "Ttk Notebook widget manages a collection of windows and displays a single " "one at a time. Each child window is associated with a tab, which the user " "may select to change the currently displayed window." msgstr "" -#: ../../library/tkinter.ttk.rst:483 +#: ../../library/tkinter.ttk.rst:481 msgid "" "If present and greater than zero, specifies the desired height of the pane " "area (not including internal padding or tabs). Otherwise, the maximum height " "of all panes is used." msgstr "" -#: ../../library/tkinter.ttk.rst:487 ../../library/tkinter.ttk.rst:519 -#: ../../library/tkinter.ttk.rst:824 +#: ../../library/tkinter.ttk.rst:485 ../../library/tkinter.ttk.rst:517 +#: ../../library/tkinter.ttk.rst:822 msgid "padding" msgstr "" -#: ../../library/tkinter.ttk.rst:487 +#: ../../library/tkinter.ttk.rst:485 msgid "" "Specifies the amount of extra space to add around the outside of the " "notebook. The padding is a list up to four length specifications left top " @@ -772,32 +770,32 @@ msgid "" "top, right defaults to left, and top defaults to left." msgstr "" -#: ../../library/tkinter.ttk.rst:493 +#: ../../library/tkinter.ttk.rst:491 msgid "" "If present and greater than zero, specified the desired width of the pane " "area (not including internal padding). Otherwise, the maximum width of all " "panes is used." msgstr "" -#: ../../library/tkinter.ttk.rst:500 +#: ../../library/tkinter.ttk.rst:498 msgid "Tab Options" msgstr "" -#: ../../library/tkinter.ttk.rst:502 +#: ../../library/tkinter.ttk.rst:500 msgid "There are also specific options for tabs:" msgstr "" -#: ../../library/tkinter.ttk.rst:509 +#: ../../library/tkinter.ttk.rst:507 msgid "" "Either \"normal\", \"disabled\" or \"hidden\". If \"disabled\", then the tab " "is not selectable. If \"hidden\", then the tab is not shown." msgstr "" -#: ../../library/tkinter.ttk.rst:513 +#: ../../library/tkinter.ttk.rst:511 msgid "sticky" msgstr "" -#: ../../library/tkinter.ttk.rst:513 +#: ../../library/tkinter.ttk.rst:511 msgid "" "Specifies how the child window is positioned within the pane area. Value is " "a string containing zero or more of the characters \"n\", \"s\", \"e\" or \"w" @@ -805,203 +803,203 @@ msgid "" "window will stick to, as per the :meth:`grid` geometry manager." msgstr "" -#: ../../library/tkinter.ttk.rst:519 +#: ../../library/tkinter.ttk.rst:517 msgid "" "Specifies the amount of extra space to add between the notebook and this " "pane. Syntax is the same as for the option padding used by this widget." msgstr "" -#: ../../library/tkinter.ttk.rst:523 +#: ../../library/tkinter.ttk.rst:521 msgid "Specifies a text to be displayed in the tab." msgstr "" -#: ../../library/tkinter.ttk.rst:525 +#: ../../library/tkinter.ttk.rst:523 msgid "" "Specifies an image to display in the tab. See the option image described in :" "class:`Widget`." msgstr "" -#: ../../library/tkinter.ttk.rst:528 +#: ../../library/tkinter.ttk.rst:526 msgid "" "Specifies how to display the image relative to the text, in the case both " "options text and image are present. See `Label Options`_ for legal values." msgstr "" -#: ../../library/tkinter.ttk.rst:532 +#: ../../library/tkinter.ttk.rst:530 msgid "" "Specifies the index (0-based) of a character to underline in the text " "string. The underlined character is used for mnemonic activation if :meth:" "`Notebook.enable_traversal` is called." msgstr "" -#: ../../library/tkinter.ttk.rst:540 +#: ../../library/tkinter.ttk.rst:538 msgid "Tab Identifiers" msgstr "" -#: ../../library/tkinter.ttk.rst:542 +#: ../../library/tkinter.ttk.rst:540 msgid "" "The tab_id present in several methods of :class:`ttk.Notebook` may take any " "of the following forms:" msgstr "" -#: ../../library/tkinter.ttk.rst:545 +#: ../../library/tkinter.ttk.rst:543 msgid "An integer between zero and the number of tabs" msgstr "" -#: ../../library/tkinter.ttk.rst:546 +#: ../../library/tkinter.ttk.rst:544 msgid "The name of a child window" msgstr "" -#: ../../library/tkinter.ttk.rst:547 +#: ../../library/tkinter.ttk.rst:545 msgid "" "A positional specification of the form \"@x,y\", which identifies the tab" msgstr "" -#: ../../library/tkinter.ttk.rst:548 +#: ../../library/tkinter.ttk.rst:546 msgid "" "The literal string \"current\", which identifies the currently selected tab" msgstr "" -#: ../../library/tkinter.ttk.rst:549 +#: ../../library/tkinter.ttk.rst:547 msgid "" "The literal string \"end\", which returns the number of tabs (only valid " "for :meth:`Notebook.index`)" msgstr "" -#: ../../library/tkinter.ttk.rst:554 ../../library/tkinter.ttk.rst:927 +#: ../../library/tkinter.ttk.rst:552 ../../library/tkinter.ttk.rst:925 msgid "Virtual Events" msgstr "" -#: ../../library/tkinter.ttk.rst:556 +#: ../../library/tkinter.ttk.rst:554 msgid "" "This widget generates a **<>** virtual event after a new " "tab is selected." msgstr "" -#: ../../library/tkinter.ttk.rst:561 +#: ../../library/tkinter.ttk.rst:559 msgid "ttk.Notebook" msgstr "ttk.Notebook" -#: ../../library/tkinter.ttk.rst:567 +#: ../../library/tkinter.ttk.rst:565 msgid "Adds a new tab to the notebook." msgstr "" -#: ../../library/tkinter.ttk.rst:569 +#: ../../library/tkinter.ttk.rst:567 msgid "" "If window is currently managed by the notebook but hidden, it is restored to " "its previous position." msgstr "" -#: ../../library/tkinter.ttk.rst:572 ../../library/tkinter.ttk.rst:610 +#: ../../library/tkinter.ttk.rst:570 ../../library/tkinter.ttk.rst:608 msgid "See `Tab Options`_ for the list of available options." msgstr "可用的選項清單請見 `Tab Options`_\\ 。" -#: ../../library/tkinter.ttk.rst:577 +#: ../../library/tkinter.ttk.rst:575 msgid "" "Removes the tab specified by *tab_id*, unmaps and unmanages the associated " "window." msgstr "" -#: ../../library/tkinter.ttk.rst:583 +#: ../../library/tkinter.ttk.rst:581 msgid "Hides the tab specified by *tab_id*." msgstr "" -#: ../../library/tkinter.ttk.rst:585 +#: ../../library/tkinter.ttk.rst:583 msgid "" "The tab will not be displayed, but the associated window remains managed by " "the notebook and its configuration remembered. Hidden tabs may be restored " "with the :meth:`add` command." msgstr "" -#: ../../library/tkinter.ttk.rst:592 +#: ../../library/tkinter.ttk.rst:590 msgid "" "Returns the name of the tab element at position *x*, *y*, or the empty " "string if none." msgstr "" -#: ../../library/tkinter.ttk.rst:598 +#: ../../library/tkinter.ttk.rst:596 msgid "" "Returns the numeric index of the tab specified by *tab_id*, or the total " "number of tabs if *tab_id* is the string \"end\"." msgstr "" -#: ../../library/tkinter.ttk.rst:604 +#: ../../library/tkinter.ttk.rst:602 msgid "Inserts a pane at the specified position." msgstr "" -#: ../../library/tkinter.ttk.rst:606 +#: ../../library/tkinter.ttk.rst:604 msgid "" "*pos* is either the string \"end\", an integer index, or the name of a " "managed child. If *child* is already managed by the notebook, moves it to " "the specified position." msgstr "" -#: ../../library/tkinter.ttk.rst:615 +#: ../../library/tkinter.ttk.rst:613 msgid "Selects the specified *tab_id*." msgstr "" -#: ../../library/tkinter.ttk.rst:617 +#: ../../library/tkinter.ttk.rst:615 msgid "" "The associated child window will be displayed, and the previously selected " "window (if different) is unmapped. If *tab_id* is omitted, returns the " "widget name of the currently selected pane." msgstr "" -#: ../../library/tkinter.ttk.rst:624 +#: ../../library/tkinter.ttk.rst:622 msgid "Query or modify the options of the specific *tab_id*." msgstr "" -#: ../../library/tkinter.ttk.rst:626 +#: ../../library/tkinter.ttk.rst:624 msgid "" "If *kw* is not given, returns a dictionary of the tab option values. If " "*option* is specified, returns the value of that *option*. Otherwise, sets " "the options to the corresponding values." msgstr "" -#: ../../library/tkinter.ttk.rst:633 +#: ../../library/tkinter.ttk.rst:631 msgid "Returns a list of windows managed by the notebook." msgstr "" -#: ../../library/tkinter.ttk.rst:638 +#: ../../library/tkinter.ttk.rst:636 msgid "" "Enable keyboard traversal for a toplevel window containing this notebook." msgstr "" -#: ../../library/tkinter.ttk.rst:640 +#: ../../library/tkinter.ttk.rst:638 msgid "" "This will extend the bindings for the toplevel window containing the " "notebook as follows:" msgstr "" -#: ../../library/tkinter.ttk.rst:643 +#: ../../library/tkinter.ttk.rst:641 msgid "" ":kbd:`Control-Tab`: selects the tab following the currently selected one." msgstr "" -#: ../../library/tkinter.ttk.rst:644 +#: ../../library/tkinter.ttk.rst:642 msgid "" ":kbd:`Shift-Control-Tab`: selects the tab preceding the currently selected " "one." msgstr "" -#: ../../library/tkinter.ttk.rst:645 +#: ../../library/tkinter.ttk.rst:643 msgid "" ":kbd:`Alt-K`: where *K* is the mnemonic (underlined) character of any tab, " "will select that tab." msgstr "" -#: ../../library/tkinter.ttk.rst:648 +#: ../../library/tkinter.ttk.rst:646 msgid "" "Multiple notebooks in a single toplevel may be enabled for traversal, " "including nested notebooks. However, notebook traversal only works properly " "if all panes have the notebook they are in as master." msgstr "" -#: ../../library/tkinter.ttk.rst:654 +#: ../../library/tkinter.ttk.rst:652 msgid "Progressbar" msgstr "" -#: ../../library/tkinter.ttk.rst:656 +#: ../../library/tkinter.ttk.rst:654 msgid "" "The :class:`ttk.Progressbar` widget shows the status of a long-running " "operation. It can operate in two modes: 1) the determinate mode which shows " @@ -1010,47 +1008,47 @@ msgid "" "know that work is progressing." msgstr "" -#: ../../library/tkinter.ttk.rst:673 ../../library/tkinter.ttk.rst:744 +#: ../../library/tkinter.ttk.rst:671 ../../library/tkinter.ttk.rst:742 msgid "orient" msgstr "" -#: ../../library/tkinter.ttk.rst:673 +#: ../../library/tkinter.ttk.rst:671 msgid "" "One of \"horizontal\" or \"vertical\". Specifies the orientation of the " "progress bar." msgstr "" -#: ../../library/tkinter.ttk.rst:676 +#: ../../library/tkinter.ttk.rst:674 msgid "length" msgstr "" -#: ../../library/tkinter.ttk.rst:676 +#: ../../library/tkinter.ttk.rst:674 msgid "" "Specifies the length of the long axis of the progress bar (width if " "horizontal, height if vertical)." msgstr "" -#: ../../library/tkinter.ttk.rst:679 +#: ../../library/tkinter.ttk.rst:677 msgid "mode" msgstr "" -#: ../../library/tkinter.ttk.rst:679 +#: ../../library/tkinter.ttk.rst:677 msgid "One of \"determinate\" or \"indeterminate\"." msgstr "" -#: ../../library/tkinter.ttk.rst:681 +#: ../../library/tkinter.ttk.rst:679 msgid "maximum" msgstr "" -#: ../../library/tkinter.ttk.rst:681 +#: ../../library/tkinter.ttk.rst:679 msgid "A number specifying the maximum value. Defaults to 100." msgstr "" -#: ../../library/tkinter.ttk.rst:683 +#: ../../library/tkinter.ttk.rst:681 msgid "value" msgstr "" -#: ../../library/tkinter.ttk.rst:683 +#: ../../library/tkinter.ttk.rst:681 msgid "" "The current value of the progress bar. In \"determinate\" mode, this " "represents the amount of work completed. In \"indeterminate\" mode, it is " @@ -1058,22 +1056,22 @@ msgid "" "\"cycle\" when its value increases by *maximum*." msgstr "" -#: ../../library/tkinter.ttk.rst:689 +#: ../../library/tkinter.ttk.rst:687 msgid "variable" msgstr "" -#: ../../library/tkinter.ttk.rst:689 +#: ../../library/tkinter.ttk.rst:687 msgid "" "A name which is linked to the option value. If specified, the value of the " "progress bar is automatically set to the value of this name whenever the " "latter is modified." msgstr "" -#: ../../library/tkinter.ttk.rst:693 +#: ../../library/tkinter.ttk.rst:691 msgid "phase" msgstr "" -#: ../../library/tkinter.ttk.rst:693 +#: ../../library/tkinter.ttk.rst:691 msgid "" "Read-only option. The widget periodically increments the value of this " "option whenever its value is greater than 0 and, in determinate mode, less " @@ -1081,103 +1079,103 @@ msgid "" "additional animation effects." msgstr "" -#: ../../library/tkinter.ttk.rst:701 +#: ../../library/tkinter.ttk.rst:699 msgid "ttk.Progressbar" msgstr "ttk.Progressbar" -#: ../../library/tkinter.ttk.rst:707 +#: ../../library/tkinter.ttk.rst:705 msgid "" "Begin autoincrement mode: schedules a recurring timer event that calls :meth:" "`Progressbar.step` every *interval* milliseconds. If omitted, *interval* " "defaults to 50 milliseconds." msgstr "" -#: ../../library/tkinter.ttk.rst:714 +#: ../../library/tkinter.ttk.rst:712 msgid "Increments the progress bar's value by *amount*." msgstr "" -#: ../../library/tkinter.ttk.rst:716 +#: ../../library/tkinter.ttk.rst:714 msgid "*amount* defaults to 1.0 if omitted." msgstr "" -#: ../../library/tkinter.ttk.rst:721 +#: ../../library/tkinter.ttk.rst:719 msgid "" "Stop autoincrement mode: cancels any recurring timer event initiated by :" "meth:`Progressbar.start` for this progress bar." msgstr "" -#: ../../library/tkinter.ttk.rst:726 +#: ../../library/tkinter.ttk.rst:724 msgid "Separator" msgstr "" -#: ../../library/tkinter.ttk.rst:728 +#: ../../library/tkinter.ttk.rst:726 msgid "" "The :class:`ttk.Separator` widget displays a horizontal or vertical " "separator bar." msgstr "" -#: ../../library/tkinter.ttk.rst:731 +#: ../../library/tkinter.ttk.rst:729 msgid "" "It has no other methods besides the ones inherited from :class:`ttk.Widget`." msgstr "" -#: ../../library/tkinter.ttk.rst:737 +#: ../../library/tkinter.ttk.rst:735 msgid "This widget accepts the following specific option:" msgstr "" -#: ../../library/tkinter.ttk.rst:744 +#: ../../library/tkinter.ttk.rst:742 msgid "" "One of \"horizontal\" or \"vertical\". Specifies the orientation of the " "separator." msgstr "" -#: ../../library/tkinter.ttk.rst:750 +#: ../../library/tkinter.ttk.rst:748 msgid "Sizegrip" msgstr "" -#: ../../library/tkinter.ttk.rst:752 +#: ../../library/tkinter.ttk.rst:750 msgid "" "The :class:`ttk.Sizegrip` widget (also known as a grow box) allows the user " "to resize the containing toplevel window by pressing and dragging the grip." msgstr "" -#: ../../library/tkinter.ttk.rst:755 +#: ../../library/tkinter.ttk.rst:753 msgid "" "This widget has neither specific options nor specific methods, besides the " "ones inherited from :class:`ttk.Widget`." msgstr "" -#: ../../library/tkinter.ttk.rst:760 +#: ../../library/tkinter.ttk.rst:758 msgid "Platform-specific notes" msgstr "" -#: ../../library/tkinter.ttk.rst:762 +#: ../../library/tkinter.ttk.rst:760 msgid "" "On macOS, toplevel windows automatically include a built-in size grip by " "default. Adding a :class:`Sizegrip` is harmless, since the built-in grip " "will just mask the widget." msgstr "" -#: ../../library/tkinter.ttk.rst:768 +#: ../../library/tkinter.ttk.rst:766 msgid "Bugs" msgstr "" -#: ../../library/tkinter.ttk.rst:770 +#: ../../library/tkinter.ttk.rst:768 msgid "" "If the containing toplevel's position was specified relative to the right or " "bottom of the screen (e.g. ....), the :class:`Sizegrip` widget will not " "resize the window." msgstr "" -#: ../../library/tkinter.ttk.rst:773 +#: ../../library/tkinter.ttk.rst:771 msgid "This widget supports only \"southeast\" resizing." msgstr "" -#: ../../library/tkinter.ttk.rst:777 +#: ../../library/tkinter.ttk.rst:775 msgid "Treeview" msgstr "" -#: ../../library/tkinter.ttk.rst:779 +#: ../../library/tkinter.ttk.rst:777 msgid "" "The :class:`ttk.Treeview` widget displays a hierarchical collection of " "items. Each item has a textual label, an optional image, and an optional " @@ -1185,7 +1183,7 @@ msgid "" "after the tree label." msgstr "" -#: ../../library/tkinter.ttk.rst:784 +#: ../../library/tkinter.ttk.rst:782 msgid "" "The order in which data values are displayed may be controlled by setting " "the widget option ``displaycolumns``. The tree widget can also display " @@ -1193,7 +1191,7 @@ msgid "" "in the widget option columns. See `Column Identifiers`_." msgstr "" -#: ../../library/tkinter.ttk.rst:789 +#: ../../library/tkinter.ttk.rst:787 msgid "" "Each item is identified by a unique name. The widget will generate item IDs " "if they are not supplied by the caller. There is a distinguished root item, " @@ -1201,57 +1199,57 @@ msgid "" "the top level of the hierarchy." msgstr "" -#: ../../library/tkinter.ttk.rst:794 +#: ../../library/tkinter.ttk.rst:792 msgid "" "Each item also has a list of tags, which can be used to associate event " "bindings with individual items and control the appearance of the item." msgstr "" -#: ../../library/tkinter.ttk.rst:797 +#: ../../library/tkinter.ttk.rst:795 msgid "" "The Treeview widget supports horizontal and vertical scrolling, according to " "the options described in `Scrollable Widget Options`_ and the methods :meth:" "`Treeview.xview` and :meth:`Treeview.yview`." msgstr "" -#: ../../library/tkinter.ttk.rst:812 +#: ../../library/tkinter.ttk.rst:810 msgid "columns" msgstr "" -#: ../../library/tkinter.ttk.rst:812 +#: ../../library/tkinter.ttk.rst:810 msgid "" "A list of column identifiers, specifying the number of columns and their " "names." msgstr "" -#: ../../library/tkinter.ttk.rst:815 +#: ../../library/tkinter.ttk.rst:813 msgid "displaycolumns" msgstr "" -#: ../../library/tkinter.ttk.rst:815 +#: ../../library/tkinter.ttk.rst:813 msgid "" "A list of column identifiers (either symbolic or integer indices) specifying " "which data columns are displayed and the order in which they appear, or the " "string \"#all\"." msgstr "" -#: ../../library/tkinter.ttk.rst:820 +#: ../../library/tkinter.ttk.rst:818 msgid "" "Specifies the number of rows which should be visible. Note: the requested " "width is determined from the sum of the column widths." msgstr "" -#: ../../library/tkinter.ttk.rst:824 +#: ../../library/tkinter.ttk.rst:822 msgid "" "Specifies the internal padding for the widget. The padding is a list of up " "to four length specifications." msgstr "" -#: ../../library/tkinter.ttk.rst:827 +#: ../../library/tkinter.ttk.rst:825 msgid "selectmode" msgstr "" -#: ../../library/tkinter.ttk.rst:827 +#: ../../library/tkinter.ttk.rst:825 msgid "" "Controls how the built-in class bindings manage the selection. One of " "\"extended\", \"browse\" or \"none\". If set to \"extended\" (the default), " @@ -1259,63 +1257,63 @@ msgid "" "selected at a time. If \"none\", the selection will not be changed." msgstr "" -#: ../../library/tkinter.ttk.rst:834 +#: ../../library/tkinter.ttk.rst:832 msgid "" "Note that the application code and tag bindings can set the selection " "however they wish, regardless of the value of this option." msgstr "" -#: ../../library/tkinter.ttk.rst:838 +#: ../../library/tkinter.ttk.rst:836 msgid "show" msgstr "" -#: ../../library/tkinter.ttk.rst:838 +#: ../../library/tkinter.ttk.rst:836 msgid "" "A list containing zero or more of the following values, specifying which " "elements of the tree to display." msgstr "" -#: ../../library/tkinter.ttk.rst:841 +#: ../../library/tkinter.ttk.rst:839 msgid "tree: display tree labels in column #0." msgstr "" -#: ../../library/tkinter.ttk.rst:842 +#: ../../library/tkinter.ttk.rst:840 msgid "headings: display the heading row." msgstr "" -#: ../../library/tkinter.ttk.rst:844 +#: ../../library/tkinter.ttk.rst:842 msgid "The default is \"tree headings\", i.e., show all elements." msgstr "" -#: ../../library/tkinter.ttk.rst:847 +#: ../../library/tkinter.ttk.rst:845 msgid "" "**Note**: Column #0 always refers to the tree column, even if show=\"tree\" " "is not specified." msgstr "" -#: ../../library/tkinter.ttk.rst:853 +#: ../../library/tkinter.ttk.rst:851 msgid "Item Options" msgstr "" -#: ../../library/tkinter.ttk.rst:855 +#: ../../library/tkinter.ttk.rst:853 msgid "" "The following item options may be specified for items in the insert and item " "widget commands." msgstr "" -#: ../../library/tkinter.ttk.rst:863 +#: ../../library/tkinter.ttk.rst:861 msgid "The textual label to display for the item." msgstr "" -#: ../../library/tkinter.ttk.rst:865 +#: ../../library/tkinter.ttk.rst:863 msgid "A Tk Image, displayed to the left of the label." msgstr "" -#: ../../library/tkinter.ttk.rst:867 +#: ../../library/tkinter.ttk.rst:865 msgid "The list of values associated with the item." msgstr "" -#: ../../library/tkinter.ttk.rst:869 +#: ../../library/tkinter.ttk.rst:867 msgid "" "Each item should have the same number of values as the widget option " "columns. If there are fewer values than columns, the remaining values are " @@ -1323,95 +1321,95 @@ msgid "" "ignored." msgstr "" -#: ../../library/tkinter.ttk.rst:874 +#: ../../library/tkinter.ttk.rst:872 msgid "open" msgstr "" -#: ../../library/tkinter.ttk.rst:874 +#: ../../library/tkinter.ttk.rst:872 msgid "" "``True``/``False`` value indicating whether the item's children should be " "displayed or hidden." msgstr "" -#: ../../library/tkinter.ttk.rst:877 +#: ../../library/tkinter.ttk.rst:875 msgid "tags" msgstr "" -#: ../../library/tkinter.ttk.rst:877 +#: ../../library/tkinter.ttk.rst:875 msgid "A list of tags associated with this item." msgstr "" -#: ../../library/tkinter.ttk.rst:882 +#: ../../library/tkinter.ttk.rst:880 msgid "Tag Options" msgstr "" -#: ../../library/tkinter.ttk.rst:884 +#: ../../library/tkinter.ttk.rst:882 msgid "The following options may be specified on tags:" msgstr "" -#: ../../library/tkinter.ttk.rst:891 +#: ../../library/tkinter.ttk.rst:889 msgid "foreground" msgstr "" -#: ../../library/tkinter.ttk.rst:891 +#: ../../library/tkinter.ttk.rst:889 msgid "Specifies the text foreground color." msgstr "" -#: ../../library/tkinter.ttk.rst:893 +#: ../../library/tkinter.ttk.rst:891 msgid "Specifies the cell or item background color." msgstr "" -#: ../../library/tkinter.ttk.rst:895 +#: ../../library/tkinter.ttk.rst:893 msgid "font" msgstr "" -#: ../../library/tkinter.ttk.rst:895 +#: ../../library/tkinter.ttk.rst:893 msgid "Specifies the font to use when drawing text." msgstr "" -#: ../../library/tkinter.ttk.rst:897 +#: ../../library/tkinter.ttk.rst:895 msgid "Specifies the item image, in case the item's image option is empty." msgstr "" -#: ../../library/tkinter.ttk.rst:903 +#: ../../library/tkinter.ttk.rst:901 msgid "Column Identifiers" msgstr "" -#: ../../library/tkinter.ttk.rst:905 +#: ../../library/tkinter.ttk.rst:903 msgid "Column identifiers take any of the following forms:" msgstr "" -#: ../../library/tkinter.ttk.rst:907 +#: ../../library/tkinter.ttk.rst:905 msgid "A symbolic name from the list of columns option." msgstr "" -#: ../../library/tkinter.ttk.rst:908 +#: ../../library/tkinter.ttk.rst:906 msgid "An integer n, specifying the nth data column." msgstr "" -#: ../../library/tkinter.ttk.rst:909 +#: ../../library/tkinter.ttk.rst:907 msgid "" "A string of the form #n, where n is an integer, specifying the nth display " "column." msgstr "" -#: ../../library/tkinter.ttk.rst:912 +#: ../../library/tkinter.ttk.rst:910 msgid "Notes:" msgstr "註解:" -#: ../../library/tkinter.ttk.rst:914 +#: ../../library/tkinter.ttk.rst:912 msgid "" "Item's option values may be displayed in a different order than the order in " "which they are stored." msgstr "" -#: ../../library/tkinter.ttk.rst:916 +#: ../../library/tkinter.ttk.rst:914 msgid "" "Column #0 always refers to the tree column, even if show=\"tree\" is not " "specified." msgstr "" -#: ../../library/tkinter.ttk.rst:919 +#: ../../library/tkinter.ttk.rst:917 msgid "" "A data column number is an index into an item's option values list; a " "display column number is the column number in the tree where the values are " @@ -1420,74 +1418,74 @@ msgid "" "#0 always refers to the tree column**." msgstr "" -#: ../../library/tkinter.ttk.rst:929 +#: ../../library/tkinter.ttk.rst:927 msgid "The Treeview widget generates the following virtual events." msgstr "" -#: ../../library/tkinter.ttk.rst:934 +#: ../../library/tkinter.ttk.rst:932 msgid "Event" msgstr "" -#: ../../library/tkinter.ttk.rst:936 +#: ../../library/tkinter.ttk.rst:934 msgid "<>" msgstr "" -#: ../../library/tkinter.ttk.rst:936 +#: ../../library/tkinter.ttk.rst:934 msgid "Generated whenever the selection changes." msgstr "" -#: ../../library/tkinter.ttk.rst:938 +#: ../../library/tkinter.ttk.rst:936 msgid "<>" msgstr "" -#: ../../library/tkinter.ttk.rst:938 +#: ../../library/tkinter.ttk.rst:936 msgid "Generated just before settings the focus item to open=True." msgstr "" -#: ../../library/tkinter.ttk.rst:941 +#: ../../library/tkinter.ttk.rst:939 msgid "<>" msgstr "" -#: ../../library/tkinter.ttk.rst:941 +#: ../../library/tkinter.ttk.rst:939 msgid "Generated just after setting the focus item to open=False." msgstr "" -#: ../../library/tkinter.ttk.rst:945 +#: ../../library/tkinter.ttk.rst:943 msgid "" "The :meth:`Treeview.focus` and :meth:`Treeview.selection` methods can be " "used to determine the affected item or items." msgstr "" -#: ../../library/tkinter.ttk.rst:950 +#: ../../library/tkinter.ttk.rst:948 msgid "ttk.Treeview" msgstr "ttk.Treeview" -#: ../../library/tkinter.ttk.rst:956 +#: ../../library/tkinter.ttk.rst:954 msgid "" "Returns the bounding box (relative to the treeview widget's window) of the " "specified *item* in the form (x, y, width, height)." msgstr "" -#: ../../library/tkinter.ttk.rst:959 +#: ../../library/tkinter.ttk.rst:957 msgid "" "If *column* is specified, returns the bounding box of that cell. If the " "*item* is not visible (i.e., if it is a descendant of a closed item or is " "scrolled offscreen), returns an empty string." msgstr "" -#: ../../library/tkinter.ttk.rst:966 +#: ../../library/tkinter.ttk.rst:964 msgid "Returns the list of children belonging to *item*." msgstr "" -#: ../../library/tkinter.ttk.rst:968 +#: ../../library/tkinter.ttk.rst:966 msgid "If *item* is not specified, returns root children." msgstr "" -#: ../../library/tkinter.ttk.rst:973 +#: ../../library/tkinter.ttk.rst:971 msgid "Replaces *item*'s child with *newchildren*." msgstr "" -#: ../../library/tkinter.ttk.rst:975 +#: ../../library/tkinter.ttk.rst:973 msgid "" "Children present in *item* that are not present in *newchildren* are " "detached from the tree. No items in *newchildren* may be an ancestor of " @@ -1495,235 +1493,235 @@ msgid "" "children." msgstr "" -#: ../../library/tkinter.ttk.rst:983 +#: ../../library/tkinter.ttk.rst:981 msgid "Query or modify the options for the specified *column*." msgstr "" -#: ../../library/tkinter.ttk.rst:985 +#: ../../library/tkinter.ttk.rst:983 msgid "" "If *kw* is not given, returns a dict of the column option values. If " "*option* is specified then the value for that *option* is returned. " "Otherwise, sets the options to the corresponding values." msgstr "" -#: ../../library/tkinter.ttk.rst:989 ../../library/tkinter.ttk.rst:1044 +#: ../../library/tkinter.ttk.rst:987 ../../library/tkinter.ttk.rst:1042 msgid "The valid options/values are:" msgstr "" -#: ../../library/tkinter.ttk.rst:991 +#: ../../library/tkinter.ttk.rst:989 msgid "id" msgstr "id" -#: ../../library/tkinter.ttk.rst:992 +#: ../../library/tkinter.ttk.rst:990 msgid "Returns the column name. This is a read-only option." msgstr "" -#: ../../library/tkinter.ttk.rst:994 +#: ../../library/tkinter.ttk.rst:992 msgid "anchor: One of the standard Tk anchor values." msgstr "" -#: ../../library/tkinter.ttk.rst:994 +#: ../../library/tkinter.ttk.rst:992 msgid "" "Specifies how the text in this column should be aligned with respect to the " "cell." msgstr "" -#: ../../library/tkinter.ttk.rst:998 +#: ../../library/tkinter.ttk.rst:996 msgid "minwidth: width" msgstr "" -#: ../../library/tkinter.ttk.rst:997 +#: ../../library/tkinter.ttk.rst:995 msgid "" "The minimum width of the column in pixels. The treeview widget will not make " "the column any smaller than specified by this option when the widget is " "resized or the user drags a column." msgstr "" -#: ../../library/tkinter.ttk.rst:1001 +#: ../../library/tkinter.ttk.rst:999 msgid "stretch: ``True``/``False``" msgstr "" -#: ../../library/tkinter.ttk.rst:1001 +#: ../../library/tkinter.ttk.rst:999 msgid "" "Specifies whether the column's width should be adjusted when the widget is " "resized." msgstr "" -#: ../../library/tkinter.ttk.rst:1004 +#: ../../library/tkinter.ttk.rst:1002 msgid "width: width" msgstr "" -#: ../../library/tkinter.ttk.rst:1004 +#: ../../library/tkinter.ttk.rst:1002 msgid "The width of the column in pixels." msgstr "" -#: ../../library/tkinter.ttk.rst:1006 +#: ../../library/tkinter.ttk.rst:1004 msgid "To configure the tree column, call this with column = \"#0\"" msgstr "" -#: ../../library/tkinter.ttk.rst:1010 +#: ../../library/tkinter.ttk.rst:1008 msgid "Delete all specified *items* and all their descendants." msgstr "" -#: ../../library/tkinter.ttk.rst:1012 +#: ../../library/tkinter.ttk.rst:1010 msgid "The root item may not be deleted." msgstr "" -#: ../../library/tkinter.ttk.rst:1017 +#: ../../library/tkinter.ttk.rst:1015 msgid "Unlinks all of the specified *items* from the tree." msgstr "" -#: ../../library/tkinter.ttk.rst:1019 +#: ../../library/tkinter.ttk.rst:1017 msgid "" "The items and all of their descendants are still present, and may be " "reinserted at another point in the tree, but will not be displayed." msgstr "" -#: ../../library/tkinter.ttk.rst:1022 +#: ../../library/tkinter.ttk.rst:1020 msgid "The root item may not be detached." msgstr "" -#: ../../library/tkinter.ttk.rst:1027 +#: ../../library/tkinter.ttk.rst:1025 msgid "Returns ``True`` if the specified *item* is present in the tree." msgstr "" -#: ../../library/tkinter.ttk.rst:1032 +#: ../../library/tkinter.ttk.rst:1030 msgid "" "If *item* is specified, sets the focus item to *item*. Otherwise, returns " "the current focus item, or '' if there is none." msgstr "" -#: ../../library/tkinter.ttk.rst:1038 +#: ../../library/tkinter.ttk.rst:1036 msgid "Query or modify the heading options for the specified *column*." msgstr "" -#: ../../library/tkinter.ttk.rst:1040 +#: ../../library/tkinter.ttk.rst:1038 msgid "" "If *kw* is not given, returns a dict of the heading option values. If " "*option* is specified then the value for that *option* is returned. " "Otherwise, sets the options to the corresponding values." msgstr "" -#: ../../library/tkinter.ttk.rst:1046 +#: ../../library/tkinter.ttk.rst:1044 msgid "text: text" msgstr "" -#: ../../library/tkinter.ttk.rst:1047 +#: ../../library/tkinter.ttk.rst:1045 msgid "The text to display in the column heading." msgstr "" -#: ../../library/tkinter.ttk.rst:1048 +#: ../../library/tkinter.ttk.rst:1046 msgid "image: imageName" msgstr "" -#: ../../library/tkinter.ttk.rst:1049 +#: ../../library/tkinter.ttk.rst:1047 msgid "Specifies an image to display to the right of the column heading." msgstr "" -#: ../../library/tkinter.ttk.rst:1051 +#: ../../library/tkinter.ttk.rst:1049 msgid "anchor: anchor" msgstr "" -#: ../../library/tkinter.ttk.rst:1051 +#: ../../library/tkinter.ttk.rst:1049 msgid "" "Specifies how the heading text should be aligned. One of the standard Tk " "anchor values." msgstr "" -#: ../../library/tkinter.ttk.rst:1054 +#: ../../library/tkinter.ttk.rst:1052 msgid "command: callback" msgstr "" -#: ../../library/tkinter.ttk.rst:1054 +#: ../../library/tkinter.ttk.rst:1052 msgid "A callback to be invoked when the heading label is pressed." msgstr "" -#: ../../library/tkinter.ttk.rst:1056 +#: ../../library/tkinter.ttk.rst:1054 msgid "To configure the tree column heading, call this with column = \"#0\"." msgstr "" -#: ../../library/tkinter.ttk.rst:1061 +#: ../../library/tkinter.ttk.rst:1059 msgid "" "Returns a description of the specified *component* under the point given by " "*x* and *y*, or the empty string if no such *component* is present at that " "position." msgstr "" -#: ../../library/tkinter.ttk.rst:1068 +#: ../../library/tkinter.ttk.rst:1066 msgid "Returns the item ID of the item at position *y*." msgstr "" -#: ../../library/tkinter.ttk.rst:1073 +#: ../../library/tkinter.ttk.rst:1071 msgid "Returns the data column identifier of the cell at position *x*." msgstr "" -#: ../../library/tkinter.ttk.rst:1075 +#: ../../library/tkinter.ttk.rst:1073 msgid "The tree column has ID #0." msgstr "" -#: ../../library/tkinter.ttk.rst:1080 +#: ../../library/tkinter.ttk.rst:1078 msgid "Returns one of:" msgstr "" -#: ../../library/tkinter.ttk.rst:1083 +#: ../../library/tkinter.ttk.rst:1081 msgid "region" msgstr "" -#: ../../library/tkinter.ttk.rst:1083 +#: ../../library/tkinter.ttk.rst:1081 msgid "meaning" msgstr "" -#: ../../library/tkinter.ttk.rst:1085 +#: ../../library/tkinter.ttk.rst:1083 msgid "heading" msgstr "" -#: ../../library/tkinter.ttk.rst:1085 +#: ../../library/tkinter.ttk.rst:1083 msgid "Tree heading area." msgstr "" -#: ../../library/tkinter.ttk.rst:1087 +#: ../../library/tkinter.ttk.rst:1085 msgid "separator" msgstr "" -#: ../../library/tkinter.ttk.rst:1087 +#: ../../library/tkinter.ttk.rst:1085 msgid "Space between two columns headings." msgstr "" -#: ../../library/tkinter.ttk.rst:1089 +#: ../../library/tkinter.ttk.rst:1087 msgid "tree" msgstr "" -#: ../../library/tkinter.ttk.rst:1089 +#: ../../library/tkinter.ttk.rst:1087 msgid "The tree area." msgstr "" -#: ../../library/tkinter.ttk.rst:1091 +#: ../../library/tkinter.ttk.rst:1089 msgid "cell" msgstr "" -#: ../../library/tkinter.ttk.rst:1091 +#: ../../library/tkinter.ttk.rst:1089 msgid "A data cell." msgstr "" -#: ../../library/tkinter.ttk.rst:1094 ../../library/tkinter.ttk.rst:1101 +#: ../../library/tkinter.ttk.rst:1092 ../../library/tkinter.ttk.rst:1099 msgid "Availability: Tk 8.6." msgstr "" -#: ../../library/tkinter.ttk.rst:1099 +#: ../../library/tkinter.ttk.rst:1097 msgid "Returns the element at position *x*, *y*." msgstr "" -#: ../../library/tkinter.ttk.rst:1106 +#: ../../library/tkinter.ttk.rst:1104 msgid "" "Returns the integer index of *item* within its parent's list of children." msgstr "" -#: ../../library/tkinter.ttk.rst:1111 +#: ../../library/tkinter.ttk.rst:1109 msgid "" "Creates a new item and returns the item identifier of the newly created item." msgstr "" -#: ../../library/tkinter.ttk.rst:1114 +#: ../../library/tkinter.ttk.rst:1112 msgid "" "*parent* is the item ID of the parent item, or the empty string to create a " "new top-level item. *index* is an integer, or the value \"end\", specifying " @@ -1735,15 +1733,15 @@ msgid "" "unique identifier is generated." msgstr "" -#: ../../library/tkinter.ttk.rst:1123 +#: ../../library/tkinter.ttk.rst:1121 msgid "See `Item Options`_ for the list of available points." msgstr "" -#: ../../library/tkinter.ttk.rst:1128 +#: ../../library/tkinter.ttk.rst:1126 msgid "Query or modify the options for the specified *item*." msgstr "" -#: ../../library/tkinter.ttk.rst:1130 +#: ../../library/tkinter.ttk.rst:1128 msgid "" "If no options are given, a dict with options/values for the item is " "returned. If *option* is specified then the value for that option is " @@ -1751,11 +1749,11 @@ msgid "" "by *kw*." msgstr "" -#: ../../library/tkinter.ttk.rst:1138 +#: ../../library/tkinter.ttk.rst:1136 msgid "Moves *item* to position *index* in *parent*'s list of children." msgstr "" -#: ../../library/tkinter.ttk.rst:1140 +#: ../../library/tkinter.ttk.rst:1138 msgid "" "It is illegal to move an item under one of its descendants. If *index* is " "less than or equal to zero, *item* is moved to the beginning; if greater " @@ -1763,71 +1761,71 @@ msgid "" "was detached it is reattached." msgstr "" -#: ../../library/tkinter.ttk.rst:1148 +#: ../../library/tkinter.ttk.rst:1146 msgid "" "Returns the identifier of *item*'s next sibling, or '' if *item* is the last " "child of its parent." msgstr "" -#: ../../library/tkinter.ttk.rst:1154 +#: ../../library/tkinter.ttk.rst:1152 msgid "" "Returns the ID of the parent of *item*, or '' if *item* is at the top level " "of the hierarchy." msgstr "" -#: ../../library/tkinter.ttk.rst:1160 +#: ../../library/tkinter.ttk.rst:1158 msgid "" "Returns the identifier of *item*'s previous sibling, or '' if *item* is the " "first child of its parent." msgstr "" -#: ../../library/tkinter.ttk.rst:1166 +#: ../../library/tkinter.ttk.rst:1164 msgid "An alias for :meth:`Treeview.move`." msgstr "" -#: ../../library/tkinter.ttk.rst:1171 +#: ../../library/tkinter.ttk.rst:1169 msgid "Ensure that *item* is visible." msgstr "" -#: ../../library/tkinter.ttk.rst:1173 +#: ../../library/tkinter.ttk.rst:1171 msgid "" "Sets all of *item*'s ancestors open option to ``True``, and scrolls the " "widget if necessary so that *item* is within the visible portion of the tree." msgstr "" -#: ../../library/tkinter.ttk.rst:1180 +#: ../../library/tkinter.ttk.rst:1178 msgid "Returns a tuple of selected items." msgstr "" -#: ../../library/tkinter.ttk.rst:1182 +#: ../../library/tkinter.ttk.rst:1180 msgid "" "``selection()`` no longer takes arguments. For changing the selection state " "use the following selection methods." msgstr "" -#: ../../library/tkinter.ttk.rst:1189 +#: ../../library/tkinter.ttk.rst:1187 msgid "*items* becomes the new selection." msgstr "" -#: ../../library/tkinter.ttk.rst:1191 ../../library/tkinter.ttk.rst:1199 -#: ../../library/tkinter.ttk.rst:1207 ../../library/tkinter.ttk.rst:1215 +#: ../../library/tkinter.ttk.rst:1189 ../../library/tkinter.ttk.rst:1197 +#: ../../library/tkinter.ttk.rst:1205 ../../library/tkinter.ttk.rst:1213 msgid "" "*items* can be passed as separate arguments, not just as a single tuple." msgstr "" -#: ../../library/tkinter.ttk.rst:1197 +#: ../../library/tkinter.ttk.rst:1195 msgid "Add *items* to the selection." msgstr "" -#: ../../library/tkinter.ttk.rst:1205 +#: ../../library/tkinter.ttk.rst:1203 msgid "Remove *items* from the selection." msgstr "" -#: ../../library/tkinter.ttk.rst:1213 +#: ../../library/tkinter.ttk.rst:1211 msgid "Toggle the selection state of each item in *items*." msgstr "" -#: ../../library/tkinter.ttk.rst:1221 +#: ../../library/tkinter.ttk.rst:1219 msgid "" "With one argument, returns a dictionary of column/value pairs for the " "specified *item*. With two arguments, returns the current value of the " @@ -1835,18 +1833,18 @@ msgid "" "in given *item* to the specified *value*." msgstr "" -#: ../../library/tkinter.ttk.rst:1229 +#: ../../library/tkinter.ttk.rst:1227 msgid "" "Bind a callback for the given event *sequence* to the tag *tagname*. When an " "event is delivered to an item, the callbacks for each of the item's tags " "option are called." msgstr "" -#: ../../library/tkinter.ttk.rst:1236 +#: ../../library/tkinter.ttk.rst:1234 msgid "Query or modify the options for the specified *tagname*." msgstr "" -#: ../../library/tkinter.ttk.rst:1238 +#: ../../library/tkinter.ttk.rst:1236 msgid "" "If *kw* is not given, returns a dict of the option settings for *tagname*. " "If *option* is specified, returns the value for that *option* for the " @@ -1854,30 +1852,30 @@ msgid "" "for the given *tagname*." msgstr "" -#: ../../library/tkinter.ttk.rst:1246 +#: ../../library/tkinter.ttk.rst:1244 msgid "" "If *item* is specified, returns 1 or 0 depending on whether the specified " "*item* has the given *tagname*. Otherwise, returns a list of all items that " "have the specified tag." msgstr "" -#: ../../library/tkinter.ttk.rst:1250 +#: ../../library/tkinter.ttk.rst:1248 msgid "Availability: Tk 8.6" msgstr "" -#: ../../library/tkinter.ttk.rst:1255 +#: ../../library/tkinter.ttk.rst:1253 msgid "Query or modify horizontal position of the treeview." msgstr "" -#: ../../library/tkinter.ttk.rst:1260 +#: ../../library/tkinter.ttk.rst:1258 msgid "Query or modify vertical position of the treeview." msgstr "" -#: ../../library/tkinter.ttk.rst:1266 +#: ../../library/tkinter.ttk.rst:1264 msgid "Ttk Styling" msgstr "" -#: ../../library/tkinter.ttk.rst:1268 +#: ../../library/tkinter.ttk.rst:1266 msgid "" "Each widget in :mod:`ttk` is assigned a style, which specifies the set of " "elements making up the widget and how they are arranged, along with dynamic " @@ -1887,52 +1885,52 @@ msgid "" "meth:`Misc.winfo_class` (somewidget.winfo_class())." msgstr "" -#: ../../library/tkinter.ttk.rst:1277 +#: ../../library/tkinter.ttk.rst:1275 msgid "" "`Tcl'2004 conference presentation `_" msgstr "" -#: ../../library/tkinter.ttk.rst:1278 +#: ../../library/tkinter.ttk.rst:1276 msgid "This document explains how the theme engine works" msgstr "" -#: ../../library/tkinter.ttk.rst:1283 +#: ../../library/tkinter.ttk.rst:1281 msgid "This class is used to manipulate the style database." msgstr "" -#: ../../library/tkinter.ttk.rst:1288 +#: ../../library/tkinter.ttk.rst:1286 msgid "Query or set the default value of the specified option(s) in *style*." msgstr "" -#: ../../library/tkinter.ttk.rst:1290 +#: ../../library/tkinter.ttk.rst:1288 msgid "" "Each key in *kw* is an option and each value is a string identifying the " "value for that option." msgstr "" -#: ../../library/tkinter.ttk.rst:1293 +#: ../../library/tkinter.ttk.rst:1291 msgid "" "For example, to change every default button to be a flat button with some " "padding and a different background color::" msgstr "" -#: ../../library/tkinter.ttk.rst:1312 +#: ../../library/tkinter.ttk.rst:1310 msgid "Query or sets dynamic values of the specified option(s) in *style*." msgstr "" -#: ../../library/tkinter.ttk.rst:1314 +#: ../../library/tkinter.ttk.rst:1312 msgid "" "Each key in *kw* is an option and each value should be a list or a tuple " "(usually) containing statespecs grouped in tuples, lists, or some other " "preference. A statespec is a compound of one or more states and then a value." msgstr "" -#: ../../library/tkinter.ttk.rst:1319 +#: ../../library/tkinter.ttk.rst:1317 msgid "An example may make it more understandable::" msgstr "" -#: ../../library/tkinter.ttk.rst:1337 +#: ../../library/tkinter.ttk.rst:1335 msgid "" "Note that the order of the (states, value) sequences for an option does " "matter, if the order is changed to ``[('active', 'blue'), ('pressed', " @@ -1940,28 +1938,28 @@ msgid "" "foreground when the widget were in active or pressed states." msgstr "" -#: ../../library/tkinter.ttk.rst:1345 +#: ../../library/tkinter.ttk.rst:1343 msgid "Returns the value specified for *option* in *style*." msgstr "" -#: ../../library/tkinter.ttk.rst:1347 +#: ../../library/tkinter.ttk.rst:1345 msgid "" "If *state* is specified, it is expected to be a sequence of one or more " "states. If the *default* argument is set, it is used as a fallback value in " "case no specification for option is found." msgstr "" -#: ../../library/tkinter.ttk.rst:1351 +#: ../../library/tkinter.ttk.rst:1349 msgid "To check what font a Button uses by default::" msgstr "" -#: ../../library/tkinter.ttk.rst:1360 +#: ../../library/tkinter.ttk.rst:1358 msgid "" "Define the widget layout for given *style*. If *layoutspec* is omitted, " "return the layout specification for given style." msgstr "" -#: ../../library/tkinter.ttk.rst:1363 +#: ../../library/tkinter.ttk.rst:1361 msgid "" "*layoutspec*, if specified, is expected to be a list or some other sequence " "type (excluding strings), where each item should be a tuple and the first " @@ -1969,77 +1967,77 @@ msgid "" "in `Layouts`_." msgstr "" -#: ../../library/tkinter.ttk.rst:1368 +#: ../../library/tkinter.ttk.rst:1366 msgid "" "To understand the format, see the following example (it is not intended to " "do anything useful)::" msgstr "" -#: ../../library/tkinter.ttk.rst:1395 +#: ../../library/tkinter.ttk.rst:1393 msgid "" "Create a new element in the current theme, of the given *etype* which is " "expected to be either \"image\", \"from\" or \"vsapi\". The latter is only " "available in Tk 8.6a for Windows XP and Vista and is not described here." msgstr "" -#: ../../library/tkinter.ttk.rst:1399 +#: ../../library/tkinter.ttk.rst:1397 msgid "" "If \"image\" is used, *args* should contain the default image name followed " "by statespec/value pairs (this is the imagespec), and *kw* may have the " "following options:" msgstr "" -#: ../../library/tkinter.ttk.rst:1405 +#: ../../library/tkinter.ttk.rst:1403 msgid "border=padding" msgstr "" -#: ../../library/tkinter.ttk.rst:1404 +#: ../../library/tkinter.ttk.rst:1402 msgid "" "padding is a list of up to four integers, specifying the left, top, right, " "and bottom borders, respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:1409 +#: ../../library/tkinter.ttk.rst:1407 msgid "height=height" msgstr "" -#: ../../library/tkinter.ttk.rst:1408 +#: ../../library/tkinter.ttk.rst:1406 msgid "" "Specifies a minimum height for the element. If less than zero, the base " "image's height is used as a default." msgstr "" -#: ../../library/tkinter.ttk.rst:1413 +#: ../../library/tkinter.ttk.rst:1411 msgid "padding=padding" msgstr "" -#: ../../library/tkinter.ttk.rst:1412 +#: ../../library/tkinter.ttk.rst:1410 msgid "" "Specifies the element's interior padding. Defaults to border's value if not " "specified." msgstr "" -#: ../../library/tkinter.ttk.rst:1417 +#: ../../library/tkinter.ttk.rst:1415 msgid "sticky=spec" msgstr "" -#: ../../library/tkinter.ttk.rst:1416 +#: ../../library/tkinter.ttk.rst:1414 msgid "" "Specifies how the image is placed within the final parcel. spec contains " "zero or more characters \"n\", \"s\", \"w\", or \"e\"." msgstr "" -#: ../../library/tkinter.ttk.rst:1421 +#: ../../library/tkinter.ttk.rst:1419 msgid "width=width" msgstr "" -#: ../../library/tkinter.ttk.rst:1420 +#: ../../library/tkinter.ttk.rst:1418 msgid "" "Specifies a minimum width for the element. If less than zero, the base " "image's width is used as a default." msgstr "" -#: ../../library/tkinter.ttk.rst:1423 +#: ../../library/tkinter.ttk.rst:1421 msgid "" "If \"from\" is used as the value of *etype*, :meth:`element_create` will " "clone an existing element. *args* is expected to contain a themename, from " @@ -2048,19 +2046,19 @@ msgid "" "used. *kw* is discarded." msgstr "" -#: ../../library/tkinter.ttk.rst:1433 +#: ../../library/tkinter.ttk.rst:1431 msgid "Returns the list of elements defined in the current theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1438 +#: ../../library/tkinter.ttk.rst:1436 msgid "Returns the list of *elementname*'s options." msgstr "" -#: ../../library/tkinter.ttk.rst:1443 +#: ../../library/tkinter.ttk.rst:1441 msgid "Create a new theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1445 +#: ../../library/tkinter.ttk.rst:1443 msgid "" "It is an error if *themename* already exists. If *parent* is specified, the " "new theme will inherit styles, elements and layouts from the parent theme. " @@ -2068,13 +2066,13 @@ msgid "" "for :meth:`theme_settings`." msgstr "" -#: ../../library/tkinter.ttk.rst:1453 +#: ../../library/tkinter.ttk.rst:1451 msgid "" "Temporarily sets the current theme to *themename*, apply specified " "*settings* and then restore the previous theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1456 +#: ../../library/tkinter.ttk.rst:1454 msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " @@ -2083,26 +2081,26 @@ msgid "" "respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:1462 +#: ../../library/tkinter.ttk.rst:1460 msgid "As an example, let's change the Combobox for the default theme a bit::" msgstr "" -#: ../../library/tkinter.ttk.rst:1490 +#: ../../library/tkinter.ttk.rst:1488 msgid "Returns a list of all known themes." msgstr "" -#: ../../library/tkinter.ttk.rst:1495 +#: ../../library/tkinter.ttk.rst:1493 msgid "" "If *themename* is not given, returns the theme in use. Otherwise, sets the " "current theme to *themename*, refreshes all widgets and emits a " "<> event." msgstr "" -#: ../../library/tkinter.ttk.rst:1501 +#: ../../library/tkinter.ttk.rst:1499 msgid "Layouts" msgstr "" -#: ../../library/tkinter.ttk.rst:1503 +#: ../../library/tkinter.ttk.rst:1501 msgid "" "A layout can be just ``None``, if it takes no options, or a dict of options " "specifying how to arrange the element. The layout mechanism uses a " @@ -2110,40 +2108,40 @@ msgid "" "each element is allocated a parcel. Valid options/values are:" msgstr "" -#: ../../library/tkinter.ttk.rst:1512 +#: ../../library/tkinter.ttk.rst:1510 msgid "side: whichside" msgstr "" -#: ../../library/tkinter.ttk.rst:1510 +#: ../../library/tkinter.ttk.rst:1508 msgid "" "Specifies which side of the cavity to place the element; one of top, right, " "bottom or left. If omitted, the element occupies the entire cavity." msgstr "" -#: ../../library/tkinter.ttk.rst:1515 +#: ../../library/tkinter.ttk.rst:1513 msgid "sticky: nswe" msgstr "" -#: ../../library/tkinter.ttk.rst:1515 +#: ../../library/tkinter.ttk.rst:1513 msgid "Specifies where the element is placed inside its allocated parcel." msgstr "" -#: ../../library/tkinter.ttk.rst:1520 +#: ../../library/tkinter.ttk.rst:1518 msgid "unit: 0 or 1" msgstr "" -#: ../../library/tkinter.ttk.rst:1518 +#: ../../library/tkinter.ttk.rst:1516 msgid "" "If set to 1, causes the element and all of its descendants to be treated as " "a single element for the purposes of :meth:`Widget.identify` et al. It's " "used for things like scrollbar thumbs with grips." msgstr "" -#: ../../library/tkinter.ttk.rst:1525 +#: ../../library/tkinter.ttk.rst:1523 msgid "children: [sublayout... ]" msgstr "" -#: ../../library/tkinter.ttk.rst:1523 +#: ../../library/tkinter.ttk.rst:1521 msgid "" "Specifies a list of elements to place inside the element. Each element is a " "tuple (or other sequence type) where the first item is the layout name, and " diff --git a/library/tomllib.po b/library/tomllib.po new file mode 100644 index 0000000000..e0a1460729 --- /dev/null +++ b/library/tomllib.po @@ -0,0 +1,194 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/tomllib.rst:2 +msgid ":mod:`tomllib` --- Parse TOML files" +msgstr ":mod:`tomllib` --- 剖析 TOML 檔案" + +#: ../../library/tomllib.rst:12 +msgid "**Source code:** :source:`Lib/tomllib`" +msgstr "**原始碼:**\\ :source:`Lib/tomllib`" + +#: ../../library/tomllib.rst:16 +msgid "" +"This module provides an interface for parsing TOML (Tom's Obvious Minimal " +"Language, `https://toml.io `_). This module does not " +"support writing TOML." +msgstr "" + +#: ../../library/tomllib.rst:22 +msgid "" +"The `Tomli-W package `__ is a TOML writer " +"that can be used in conjunction with this module, providing a write API " +"familiar to users of the standard library :mod:`marshal` and :mod:`pickle` " +"modules." +msgstr "" + +#: ../../library/tomllib.rst:29 +msgid "" +"The `TOML Kit package `__ is a style-" +"preserving TOML library with both read and write capability. It is a " +"recommended replacement for this module for editing already existing TOML " +"files." +msgstr "" + +#: ../../library/tomllib.rst:35 +msgid "This module defines the following functions:" +msgstr "" + +#: ../../library/tomllib.rst:39 +msgid "" +"Read a TOML file. The first argument should be a readable and binary file " +"object. Return a :class:`dict`. Convert TOML types to Python using this :ref:" +"`conversion table `." +msgstr "" + +#: ../../library/tomllib.rst:43 +msgid "" +"*parse_float* will be called with the string of every TOML float to be " +"decoded. By default, this is equivalent to ``float(num_str)``. This can be " +"used to use another datatype or parser for TOML floats (e.g. :class:`decimal." +"Decimal`). The callable must not return a :class:`dict` or a :class:`list`, " +"else a :exc:`ValueError` is raised." +msgstr "" + +#: ../../library/tomllib.rst:49 ../../library/tomllib.rst:58 +msgid "A :exc:`TOMLDecodeError` will be raised on an invalid TOML document." +msgstr "" + +#: ../../library/tomllib.rst:54 +msgid "" +"Load TOML from a :class:`str` object. Return a :class:`dict`. Convert TOML " +"types to Python using this :ref:`conversion table `. The " +"*parse_float* argument has the same meaning as in :func:`load`." +msgstr "" + +#: ../../library/tomllib.rst:61 +msgid "The following exceptions are available:" +msgstr "" + +#: ../../library/tomllib.rst:65 +msgid "Subclass of :exc:`ValueError`." +msgstr "" + +#: ../../library/tomllib.rst:69 +msgid "Examples" +msgstr "範例" + +#: ../../library/tomllib.rst:71 +msgid "Parsing a TOML file::" +msgstr "" + +#: ../../library/tomllib.rst:78 +msgid "Parsing a TOML string::" +msgstr "" + +#: ../../library/tomllib.rst:91 +msgid "Conversion Table" +msgstr "" + +#: ../../library/tomllib.rst:96 +msgid "TOML" +msgstr "TOML" + +#: ../../library/tomllib.rst:96 +msgid "Python" +msgstr "Python" + +#: ../../library/tomllib.rst:98 +msgid "table" +msgstr "table" + +#: ../../library/tomllib.rst:98 +msgid "dict" +msgstr "dict" + +#: ../../library/tomllib.rst:100 +msgid "string" +msgstr "string" + +#: ../../library/tomllib.rst:100 +msgid "str" +msgstr "str" + +#: ../../library/tomllib.rst:102 +msgid "integer" +msgstr "integer" + +#: ../../library/tomllib.rst:102 +msgid "int" +msgstr "int" + +#: ../../library/tomllib.rst:104 +msgid "float" +msgstr "float" + +#: ../../library/tomllib.rst:104 +msgid "float (configurable with *parse_float*)" +msgstr "" + +#: ../../library/tomllib.rst:106 +msgid "boolean" +msgstr "boolean" + +#: ../../library/tomllib.rst:106 +msgid "bool" +msgstr "bool" + +#: ../../library/tomllib.rst:108 +msgid "offset date-time" +msgstr "offset date-time" + +#: ../../library/tomllib.rst:108 +msgid "" +"datetime.datetime (``tzinfo`` attribute set to an instance of ``datetime." +"timezone``)" +msgstr "" + +#: ../../library/tomllib.rst:110 +msgid "local date-time" +msgstr "local date-time" + +#: ../../library/tomllib.rst:110 +msgid "datetime.datetime (``tzinfo`` attribute set to ``None``)" +msgstr "" + +#: ../../library/tomllib.rst:112 +msgid "local date" +msgstr "local date" + +#: ../../library/tomllib.rst:112 +msgid "datetime.date" +msgstr "datetime.date" + +#: ../../library/tomllib.rst:114 +msgid "local time" +msgstr "local time" + +#: ../../library/tomllib.rst:114 +msgid "datetime.time" +msgstr "datetime.time" + +#: ../../library/tomllib.rst:116 +msgid "array" +msgstr "array" + +#: ../../library/tomllib.rst:116 +msgid "list" +msgstr "list" diff --git a/library/traceback.po b/library/traceback.po index d1ca0eb958..f6b7fad4fa 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-08 00:20+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -241,7 +241,7 @@ msgid "" "capture data for later printing in a lightweight fashion." msgstr "" -#: ../../library/traceback.rst:217 ../../library/traceback.rst:269 +#: ../../library/traceback.rst:217 ../../library/traceback.rst:277 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." @@ -255,7 +255,7 @@ msgid "" "is ``None`` and ``__suppress_context__`` is false." msgstr "" -#: ../../library/traceback.rst:225 ../../library/traceback.rst:272 +#: ../../library/traceback.rst:225 ../../library/traceback.rst:280 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" @@ -273,91 +273,104 @@ msgid "The ``__suppress_context__`` value from the original exception." msgstr "" #: ../../library/traceback.rst:241 +msgid "" +"The ``__notes__`` value from the original exception, or ``None`` if the " +"exception does not have any notes. If it is not ``None`` is it formatted in " +"the traceback after the exception string." +msgstr "" + +#: ../../library/traceback.rst:249 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:245 +#: ../../library/traceback.rst:253 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:249 +#: ../../library/traceback.rst:257 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:253 +#: ../../library/traceback.rst:261 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:257 +#: ../../library/traceback.rst:265 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:261 +#: ../../library/traceback.rst:269 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:265 +#: ../../library/traceback.rst:273 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:276 +#: ../../library/traceback.rst:284 +msgid "" +"Print to *file* (default ``sys.stderr``) the exception information returned " +"by :meth:`format`." +msgstr "" + +#: ../../library/traceback.rst:291 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:278 +#: ../../library/traceback.rst:293 msgid "" "If *chain* is not ``True``, ``__cause__`` and ``__context__`` will not be " "formatted." msgstr "" -#: ../../library/traceback.rst:281 +#: ../../library/traceback.rst:296 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:285 ../../library/traceback.rst:299 +#: ../../library/traceback.rst:300 ../../library/traceback.rst:314 msgid "" "The message indicating which exception occurred is always the last string in " "the output." msgstr "" -#: ../../library/traceback.rst:290 +#: ../../library/traceback.rst:305 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:292 +#: ../../library/traceback.rst:307 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:294 +#: ../../library/traceback.rst:309 msgid "" "Normally, the generator emits a single string; however, for :exc:" "`SyntaxError` exceptions, it emits several lines that (when printed) display " "detailed information about where the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:302 +#: ../../library/traceback.rst:317 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:307 +#: ../../library/traceback.rst:322 msgid ":class:`StackSummary` Objects" msgstr ":class:`StackSummary` 物件" -#: ../../library/traceback.rst:311 +#: ../../library/traceback.rst:326 msgid "" ":class:`StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:317 +#: ../../library/traceback.rst:332 msgid "" "Construct a :class:`StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:321 +#: ../../library/traceback.rst:336 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -367,14 +380,14 @@ msgid "" "class:`FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:331 +#: ../../library/traceback.rst:346 msgid "" "Construct a :class:`StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with filename, lineno, name, line as the elements." msgstr "" -#: ../../library/traceback.rst:337 +#: ../../library/traceback.rst:352 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single frame from the stack. Each string ends in a " @@ -382,26 +395,35 @@ msgid "" "with source text lines." msgstr "" -#: ../../library/traceback.rst:342 +#: ../../library/traceback.rst:357 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:346 +#: ../../library/traceback.rst:361 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:351 +#: ../../library/traceback.rst:366 +msgid "" +"Returns a string for printing one of the frames involved in the stack. This " +"method is called for each :class:`FrameSummary` object to be printed by :" +"meth:`StackSummary.format`. If it returns ``None``, the frame is omitted " +"from the output." +msgstr "" + +#: ../../library/traceback.rst:375 msgid ":class:`FrameSummary` Objects" msgstr ":class:`FrameSummary` 物件" -#: ../../library/traceback.rst:355 -msgid ":class:`FrameSummary` objects represent a single frame in a traceback." +#: ../../library/traceback.rst:379 +msgid "" +"A :class:`FrameSummary` object represents a single frame in a traceback." msgstr "" -#: ../../library/traceback.rst:359 +#: ../../library/traceback.rst:383 msgid "" "Represent a single frame in the traceback or stack that is being formatted " "or printed. It may optionally have a stringified version of the frames " @@ -414,11 +436,11 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:372 +#: ../../library/traceback.rst:396 msgid "Traceback Examples" msgstr "" -#: ../../library/traceback.rst:374 +#: ../../library/traceback.rst:398 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -426,22 +448,22 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:396 +#: ../../library/traceback.rst:420 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:431 +#: ../../library/traceback.rst:455 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:473 +#: ../../library/traceback.rst:497 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:499 +#: ../../library/traceback.rst:523 msgid "This last example demonstrates the final few formatting functions:" msgstr "" diff --git a/library/turtle.po b/library/turtle.po index a1c891b321..93aeec3950 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1725,7 +1725,7 @@ msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " "to input. default: default value, minval: minimum value for input, maxval: " -"maximum value for input The number input must be in the range minval .. " +"maximum value for input. The number input must be in the range minval .. " "maxval if these are given. If not, a hint is issued and the dialog remains " "open for correction. Return the number input. If the dialog is canceled, " "return ``None``. ::" @@ -1792,7 +1792,7 @@ msgstr "" #: ../../library/turtle.rst:1944 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " -"values of color triples have to be in the range 0..\\ *cmode*." +"values of color triples have to be in the range 0..*cmode*." msgstr "" #: ../../library/turtle.rst:1965 @@ -1829,7 +1829,7 @@ msgstr "" #: ../../library/turtle.rst:2009 msgid "" -"*name* is an arbitrary string and shape is a (compound) :class:`Shape` " +"*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" @@ -2203,7 +2203,7 @@ msgstr "" msgid "" "If you set e.g. ``language = italian`` the docstringdict :file:" "`turtle_docstringdict_italian.py` will be loaded at import time (if present " -"on the import path, e.g. in the same directory as :mod:`turtle`." +"on the import path, e.g. in the same directory as :mod:`turtle`)." msgstr "" #: ../../library/turtle.rst:2357 @@ -2216,8 +2216,8 @@ msgstr "" #: ../../library/turtle.rst:2361 msgid "" -"*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its -" -"n switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " +"*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " +"``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" diff --git a/library/types.po b/library/types.po index f46da4133c..8db3bad99f 100644 --- a/library/types.po +++ b/library/types.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -291,7 +291,7 @@ msgstr "" #: ../../library/types.rst:241 msgid "" "This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader` as " -"stored in the attr:`__spec__` object." +"stored in the :attr:`__spec__` object." msgstr "" #: ../../library/types.rst:245 @@ -323,7 +323,7 @@ msgstr "" #: ../../library/types.rst:266 msgid "" "This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent` as " -"stored in the attr:`__spec__` object." +"stored in the :attr:`__spec__` object." msgstr "" #: ../../library/types.rst:270 diff --git a/library/typing.po b/library/typing.po index 72227567d9..ba18ccceff 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -60,158 +60,207 @@ msgid "" "provides backports of these new features to older versions of Python." msgstr "" -#: ../../library/typing.rst:41 +#: ../../library/typing.rst:39 +msgid "" +"For a summary of deprecated features and a deprecation timeline, please see " +"`Deprecation Timeline of Major Features`_." +msgstr "" + +#: ../../library/typing.rst:44 msgid "" "The documentation at https://typing.readthedocs.io/ serves as useful " "reference for type system features, useful typing related tools and typing " "best practices." msgstr "" -#: ../../library/typing.rst:47 +#: ../../library/typing.rst:51 msgid "Relevant PEPs" msgstr "" -#: ../../library/typing.rst:49 +#: ../../library/typing.rst:53 msgid "" "Since the initial introduction of type hints in :pep:`484` and :pep:`483`, a " "number of PEPs have modified and enhanced Python's framework for type " "annotations. These include:" msgstr "" -#: ../../library/typing.rst:54 +#: ../../library/typing.rst:58 msgid ":pep:`526`: Syntax for Variable Annotations" msgstr "" -#: ../../library/typing.rst:54 +#: ../../library/typing.rst:58 msgid "" "*Introducing* syntax for annotating variables outside of function " "definitions, and :data:`ClassVar`" msgstr "" -#: ../../library/typing.rst:57 +#: ../../library/typing.rst:61 msgid ":pep:`544`: Protocols: Structural subtyping (static duck typing)" msgstr "" -#: ../../library/typing.rst:57 +#: ../../library/typing.rst:61 msgid "" "*Introducing* :class:`Protocol` and the :func:" "`@runtime_checkable` decorator" msgstr "" -#: ../../library/typing.rst:60 +#: ../../library/typing.rst:64 msgid ":pep:`585`: Type Hinting Generics In Standard Collections" msgstr "" -#: ../../library/typing.rst:60 +#: ../../library/typing.rst:64 msgid "" "*Introducing* :class:`types.GenericAlias` and the ability to use standard " "library classes as :ref:`generic types`" msgstr "" -#: ../../library/typing.rst:62 +#: ../../library/typing.rst:66 msgid ":pep:`586`: Literal Types" msgstr "" -#: ../../library/typing.rst:63 +#: ../../library/typing.rst:67 msgid "*Introducing* :data:`Literal`" msgstr "" -#: ../../library/typing.rst:64 +#: ../../library/typing.rst:68 msgid "" ":pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys" msgstr "" -#: ../../library/typing.rst:65 +#: ../../library/typing.rst:69 msgid "*Introducing* :class:`TypedDict`" msgstr "" -#: ../../library/typing.rst:66 +#: ../../library/typing.rst:70 msgid ":pep:`591`: Adding a final qualifier to typing" msgstr "" -#: ../../library/typing.rst:67 +#: ../../library/typing.rst:71 msgid "*Introducing* :data:`Final` and the :func:`@final` decorator" msgstr "" -#: ../../library/typing.rst:68 +#: ../../library/typing.rst:72 msgid ":pep:`593`: Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:69 +#: ../../library/typing.rst:73 msgid "*Introducing* :data:`Annotated`" msgstr "" -#: ../../library/typing.rst:72 +#: ../../library/typing.rst:76 msgid ":pep:`604`: Allow writing union types as ``X | Y``" msgstr "" -#: ../../library/typing.rst:71 +#: ../../library/typing.rst:75 msgid "" "*Introducing* :data:`types.UnionType` and the ability to use the binary-or " "operator ``|`` to signify a :ref:`union of types`" msgstr "" -#: ../../library/typing.rst:74 +#: ../../library/typing.rst:78 msgid ":pep:`612`: Parameter Specification Variables" msgstr "" -#: ../../library/typing.rst:75 +#: ../../library/typing.rst:79 msgid "*Introducing* :class:`ParamSpec` and :data:`Concatenate`" msgstr "" -#: ../../library/typing.rst:76 +#: ../../library/typing.rst:80 msgid ":pep:`613`: Explicit Type Aliases" msgstr "" -#: ../../library/typing.rst:77 +#: ../../library/typing.rst:81 msgid "*Introducing* :data:`TypeAlias`" msgstr "" -#: ../../library/typing.rst:79 +#: ../../library/typing.rst:82 +msgid ":pep:`646`: Variadic Generics" +msgstr "" + +#: ../../library/typing.rst:83 +msgid "*Introducing* :data:`TypeVarTuple`" +msgstr "" + +#: ../../library/typing.rst:84 msgid ":pep:`647`: User-Defined Type Guards" msgstr "" -#: ../../library/typing.rst:79 +#: ../../library/typing.rst:85 msgid "*Introducing* :data:`TypeGuard`" msgstr "" -#: ../../library/typing.rst:84 +#: ../../library/typing.rst:86 +msgid "" +":pep:`655`: Marking individual TypedDict items as required or potentially " +"missing" +msgstr "" + +#: ../../library/typing.rst:87 +msgid "*Introducing* :data:`Required` and :data:`NotRequired`" +msgstr "" + +#: ../../library/typing.rst:88 +msgid ":pep:`673`: Self type" +msgstr "" + +#: ../../library/typing.rst:89 +msgid "*Introducing* :data:`Self`" +msgstr "" + +#: ../../library/typing.rst:90 +msgid ":pep:`675`: Arbitrary Literal String Type" +msgstr "" + +#: ../../library/typing.rst:91 +msgid "*Introducing* :data:`LiteralString`" +msgstr "" + +#: ../../library/typing.rst:93 +msgid ":pep:`681`: Data Class Transforms" +msgstr "" + +#: ../../library/typing.rst:93 +msgid "" +"*Introducing* the :func:`@dataclass_transform` decorator" +msgstr "" + +#: ../../library/typing.rst:98 msgid "Type aliases" msgstr "" -#: ../../library/typing.rst:86 +#: ../../library/typing.rst:100 msgid "" "A type alias is defined by assigning the type to the alias. In this example, " "``Vector`` and ``list[float]`` will be treated as interchangeable synonyms::" msgstr "" -#: ../../library/typing.rst:97 +#: ../../library/typing.rst:111 msgid "" "Type aliases are useful for simplifying complex type signatures. For " "example::" msgstr "" -#: ../../library/typing.rst:115 +#: ../../library/typing.rst:129 msgid "" "Note that ``None`` as a type hint is a special case and is replaced by " "``type(None)``." msgstr "" -#: ../../library/typing.rst:121 +#: ../../library/typing.rst:135 msgid "NewType" msgstr "NewType" -#: ../../library/typing.rst:123 +#: ../../library/typing.rst:137 msgid "Use the :class:`NewType` helper to create distinct types::" msgstr "" -#: ../../library/typing.rst:130 +#: ../../library/typing.rst:144 msgid "" "The static type checker will treat the new type as if it were a subclass of " "the original type. This is useful in helping catch logical errors::" msgstr "" -#: ../../library/typing.rst:142 +#: ../../library/typing.rst:156 msgid "" "You may still perform all ``int`` operations on a variable of type " "``UserId``, but the result will always be of type ``int``. This lets you " @@ -219,7 +268,7 @@ msgid "" "you from accidentally creating a ``UserId`` in an invalid way::" msgstr "" -#: ../../library/typing.rst:150 +#: ../../library/typing.rst:164 msgid "" "Note that these checks are enforced only by the static type checker. At " "runtime, the statement ``Derived = NewType('Derived', Base)`` will make " @@ -228,31 +277,31 @@ msgid "" "class or introduce much overhead beyond that of a regular function call." msgstr "" -#: ../../library/typing.rst:156 +#: ../../library/typing.rst:170 msgid "" "More precisely, the expression ``some_value is Derived(some_value)`` is " "always true at runtime." msgstr "" -#: ../../library/typing.rst:159 +#: ../../library/typing.rst:173 msgid "It is invalid to create a subtype of ``Derived``::" msgstr "" -#: ../../library/typing.rst:168 +#: ../../library/typing.rst:182 msgid "" "However, it is possible to create a :class:`NewType` based on a 'derived' " "``NewType``::" msgstr "" -#: ../../library/typing.rst:176 +#: ../../library/typing.rst:190 msgid "and typechecking for ``ProUserId`` will work as expected." msgstr "" -#: ../../library/typing.rst:178 +#: ../../library/typing.rst:192 msgid "See :pep:`484` for more details." msgstr "更多細節請見 :pep:`484`\\ 。" -#: ../../library/typing.rst:182 +#: ../../library/typing.rst:196 msgid "" "Recall that the use of a type alias declares two types to be *equivalent* to " "one another. Doing ``Alias = Original`` will make the static type checker " @@ -260,7 +309,7 @@ msgid "" "This is useful when you want to simplify complex type signatures." msgstr "" -#: ../../library/typing.rst:187 +#: ../../library/typing.rst:201 msgid "" "In contrast, ``NewType`` declares one type to be a *subtype* of another. " "Doing ``Derived = NewType('Derived', Original)`` will make the static type " @@ -270,39 +319,39 @@ msgid "" "errors with minimal runtime cost." msgstr "" -#: ../../library/typing.rst:196 +#: ../../library/typing.rst:210 msgid "" "``NewType`` is now a class rather than a function. There is some additional " "runtime cost when calling ``NewType`` over a regular function. However, " "this cost will be reduced in 3.11.0." msgstr "" -#: ../../library/typing.rst:203 +#: ../../library/typing.rst:217 msgid "Callable" msgstr "" -#: ../../library/typing.rst:205 +#: ../../library/typing.rst:219 msgid "" "Frameworks expecting callback functions of specific signatures might be type " "hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``." msgstr "" -#: ../../library/typing.rst:208 ../../library/typing.rst:1023 -#: ../../library/typing.rst:2257 +#: ../../library/typing.rst:222 ../../library/typing.rst:1164 +#: ../../library/typing.rst:2795 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:223 +#: ../../library/typing.rst:237 msgid "" "It is possible to declare the return type of a callable without specifying " "the call signature by substituting a literal ellipsis for the list of " "arguments in the type hint: ``Callable[..., ReturnType]``." msgstr "" -#: ../../library/typing.rst:227 ../../library/typing.rst:714 +#: ../../library/typing.rst:241 ../../library/typing.rst:843 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -313,97 +362,97 @@ msgid "" "ReturnType]`` respectively." msgstr "" -#: ../../library/typing.rst:235 ../../library/typing.rst:726 +#: ../../library/typing.rst:249 ../../library/typing.rst:855 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" -"pep:`612` for more information." +"pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:240 +#: ../../library/typing.rst:254 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provides " "examples of usage in ``Callable``." msgstr "" -#: ../../library/typing.rst:246 +#: ../../library/typing.rst:260 msgid "Generics" msgstr "" -#: ../../library/typing.rst:248 +#: ../../library/typing.rst:262 msgid "" "Since type information about objects kept in containers cannot be statically " "inferred in a generic way, abstract base classes have been extended to " "support subscription to denote expected types for container elements." msgstr "" -#: ../../library/typing.rst:259 +#: ../../library/typing.rst:273 msgid "" "Generics can be parameterized by using a factory available in typing called :" "class:`TypeVar`." msgstr "" -#: ../../library/typing.rst:275 +#: ../../library/typing.rst:289 msgid "User-defined generic types" msgstr "" -#: ../../library/typing.rst:277 +#: ../../library/typing.rst:291 msgid "A user-defined class can be defined as a generic class." msgstr "" -#: ../../library/typing.rst:303 +#: ../../library/typing.rst:317 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:307 +#: ../../library/typing.rst:321 msgid "" "The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so " "that ``LoggedVar[t]`` is valid as a type::" msgstr "" -#: ../../library/typing.rst:316 +#: ../../library/typing.rst:330 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" -#: ../../library/typing.rst:328 +#: ../../library/typing.rst:342 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr "" -#: ../../library/typing.rst:339 +#: ../../library/typing.rst:353 msgid "You can use multiple inheritance with :class:`Generic`::" msgstr "" -#: ../../library/typing.rst:349 +#: ../../library/typing.rst:363 msgid "" "When inheriting from generic classes, some type variables could be fixed::" msgstr "" -#: ../../library/typing.rst:359 +#: ../../library/typing.rst:373 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "" -#: ../../library/typing.rst:361 +#: ../../library/typing.rst:375 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:369 +#: ../../library/typing.rst:383 msgid "User defined generic type aliases are also supported. Examples::" msgstr "" -#: ../../library/typing.rst:386 +#: ../../library/typing.rst:400 msgid ":class:`Generic` no longer has a custom metaclass." msgstr "" -#: ../../library/typing.rst:389 +#: ../../library/typing.rst:403 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``Generic[P]``. The behavior " @@ -413,7 +462,7 @@ msgid "" "used to substitute a :class:`ParamSpec`::" msgstr "" -#: ../../library/typing.rst:406 +#: ../../library/typing.rst:420 msgid "" "Furthermore, a generic with only one parameter specification variable will " "accept parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also " @@ -421,20 +470,20 @@ msgid "" "converted to the former, so the following are equivalent::" msgstr "" -#: ../../library/typing.rst:418 +#: ../../library/typing.rst:432 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:422 +#: ../../library/typing.rst:436 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:426 +#: ../../library/typing.rst:440 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -442,24 +491,24 @@ msgid "" "hashable and comparable for equality." msgstr "" -#: ../../library/typing.rst:433 +#: ../../library/typing.rst:447 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:435 +#: ../../library/typing.rst:449 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:439 +#: ../../library/typing.rst:453 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:457 +#: ../../library/typing.rst:471 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -468,19 +517,19 @@ msgid "" "runtime!" msgstr "" -#: ../../library/typing.rst:463 +#: ../../library/typing.rst:477 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -#: ../../library/typing.rst:476 +#: ../../library/typing.rst:490 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:479 +#: ../../library/typing.rst:493 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, " @@ -488,7 +537,7 @@ msgid "" "subtype of every other type." msgstr "" -#: ../../library/typing.rst:484 +#: ../../library/typing.rst:498 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 " @@ -496,24 +545,24 @@ msgid "" "example::" msgstr "" -#: ../../library/typing.rst:506 +#: ../../library/typing.rst:520 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:511 +#: ../../library/typing.rst:525 msgid "Nominal vs structural subtyping" msgstr "" -#: ../../library/typing.rst:513 +#: ../../library/typing.rst:527 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " "expected if and only if ``A`` is a subclass of ``B``." msgstr "" -#: ../../library/typing.rst:517 +#: ../../library/typing.rst:531 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -522,7 +571,7 @@ msgid "" "code. For example, this conforms to :pep:`484`::" msgstr "" -#: ../../library/typing.rst:530 +#: ../../library/typing.rst:544 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 " @@ -531,22 +580,22 @@ msgid "" "subtyping* (or static duck-typing)::" msgstr "" -#: ../../library/typing.rst:546 +#: ../../library/typing.rst:560 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:551 +#: ../../library/typing.rst:565 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:553 +#: ../../library/typing.rst:567 msgid "The module defines the following classes, functions and decorators." msgstr "" -#: ../../library/typing.rst:557 +#: ../../library/typing.rst:571 msgid "" "This module defines several types that are subclasses of pre-existing " "standard library classes which also extend :class:`Generic` to support type " @@ -554,7 +603,7 @@ msgid "" "corresponding pre-existing classes were enhanced to support ``[]``." msgstr "" -#: ../../library/typing.rst:563 +#: ../../library/typing.rst:577 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 " @@ -562,147 +611,244 @@ msgid "" "Python 3.9 or newer." msgstr "" -#: ../../library/typing.rst:568 +#: ../../library/typing.rst:582 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:574 +#: ../../library/typing.rst:588 msgid "Special typing primitives" msgstr "" -#: ../../library/typing.rst:577 +#: ../../library/typing.rst:591 msgid "Special types" msgstr "" -#: ../../library/typing.rst:579 +#: ../../library/typing.rst:593 msgid "These can be used as types in annotations and do not support ``[]``." msgstr "" -#: ../../library/typing.rst:583 +#: ../../library/typing.rst:597 msgid "Special type indicating an unconstrained type." msgstr "" -#: ../../library/typing.rst:585 +#: ../../library/typing.rst:599 msgid "Every type is compatible with :data:`Any`." msgstr "" -#: ../../library/typing.rst:586 +#: ../../library/typing.rst:600 msgid ":data:`Any` is compatible with every type." msgstr "" -#: ../../library/typing.rst:590 +#: ../../library/typing.rst:602 +msgid "" +":data:`Any` can now be used as a base class. This can be useful for avoiding " +"type checker errors with classes that can duck type anywhere or are highly " +"dynamic." +msgstr "" + +#: ../../library/typing.rst:609 +msgid "" +"Special type that includes only literal strings. A string literal is " +"compatible with ``LiteralString``, as is another ``LiteralString``, but an " +"object typed as just ``str`` is not. A string created by composing " +"``LiteralString``-typed objects is also acceptable as a ``LiteralString``." +msgstr "" + +#: ../../library/typing.rst:615 ../../library/typing.rst:2437 +msgid "Example::" +msgstr "" +"舉例來說:\n" +"\n" +"::" + +#: ../../library/typing.rst:629 +msgid "" +"This is useful for sensitive APIs where arbitrary user-generated strings " +"could generate problems. For example, the two cases above that generate type " +"checker errors could be vulnerable to an SQL injection attack." +msgstr "" + +#: ../../library/typing.rst:634 +msgid "See :pep:`675` for more details." +msgstr "更多細節請見 :pep:`675`。" + +#: ../../library/typing.rst:640 +msgid "" +"The `bottom type `_, a type that " +"has no members." +msgstr "" + +#: ../../library/typing.rst:643 +msgid "" +"This can be used to define a function that should never be called, or a " +"function that never returns::" +msgstr "" + +#: ../../library/typing.rst:663 +msgid "" +"On older Python versions, :data:`NoReturn` may be used to express the same " +"concept. ``Never`` was added to make the intended meaning more explicit." +msgstr "" + +#: ../../library/typing.rst:668 msgid "Special type indicating that a function never returns. For example::" msgstr "" -#: ../../library/typing.rst:603 +#: ../../library/typing.rst:676 +msgid "" +"``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " +"the :data:`Never` type should be used for this concept instead. Type " +"checkers should treat the two equivalently." +msgstr "" + +#: ../../library/typing.rst:687 +msgid "Special type to represent the current enclosed class. For example::" +msgstr "" + +#: ../../library/typing.rst:698 +msgid "" +"This annotation is semantically equivalent to the following, albeit in a " +"more succinct fashion::" +msgstr "" + +#: ../../library/typing.rst:710 +msgid "In general if something currently follows the pattern of::" +msgstr "" + +#: ../../library/typing.rst:717 +msgid "" +"You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would " +"have ``Foo`` as the return type and not ``SubclassOfFoo``." +msgstr "" + +#: ../../library/typing.rst:720 +msgid "Other common use cases include:" +msgstr "" + +#: ../../library/typing.rst:722 +msgid "" +":class:`classmethod`\\s that are used as alternative constructors and return " +"instances of the ``cls`` parameter." +msgstr "" + +#: ../../library/typing.rst:724 +msgid "Annotating an :meth:`~object.__enter__` method which returns self." +msgstr "" + +#: ../../library/typing.rst:726 +msgid "See :pep:`673` for more details." +msgstr "更多細節請見 :pep:`673`。" + +#: ../../library/typing.rst:732 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `. For example::" msgstr "" -#: ../../library/typing.rst:610 +#: ../../library/typing.rst:739 msgid "See :pep:`613` for more details about explicit type aliases." msgstr "" -#: ../../library/typing.rst:615 +#: ../../library/typing.rst:744 msgid "Special forms" msgstr "" -#: ../../library/typing.rst:617 +#: ../../library/typing.rst:746 msgid "" "These can be used as types in annotations using ``[]``, each having a unique " "syntax." msgstr "" -#: ../../library/typing.rst:621 +#: ../../library/typing.rst:750 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:625 +#: ../../library/typing.rst:754 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:629 +#: ../../library/typing.rst:758 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:633 +#: ../../library/typing.rst:762 msgid "" ":class:`builtins.tuple ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:639 +#: ../../library/typing.rst:768 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" -#: ../../library/typing.rst:641 +#: ../../library/typing.rst:770 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" msgstr "" -#: ../../library/typing.rst:643 +#: ../../library/typing.rst:772 msgid "The arguments must be types and there must be at least one." msgstr "" -#: ../../library/typing.rst:645 +#: ../../library/typing.rst:774 msgid "Unions of unions are flattened, e.g.::" msgstr "" -#: ../../library/typing.rst:649 +#: ../../library/typing.rst:778 msgid "Unions of a single argument vanish, e.g.::" msgstr "" -#: ../../library/typing.rst:653 +#: ../../library/typing.rst:782 msgid "Redundant arguments are skipped, e.g.::" msgstr "" -#: ../../library/typing.rst:657 +#: ../../library/typing.rst:786 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "" -#: ../../library/typing.rst:661 +#: ../../library/typing.rst:790 msgid "You cannot subclass or instantiate a ``Union``." msgstr "" -#: ../../library/typing.rst:663 +#: ../../library/typing.rst:792 msgid "You cannot write ``Union[X][Y]``." msgstr "" -#: ../../library/typing.rst:665 +#: ../../library/typing.rst:794 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" -#: ../../library/typing.rst:668 +#: ../../library/typing.rst:797 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:674 +#: ../../library/typing.rst:803 msgid "Optional type." msgstr "" -#: ../../library/typing.rst:676 +#: ../../library/typing.rst:805 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "" -#: ../../library/typing.rst:678 +#: ../../library/typing.rst:807 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 " @@ -710,31 +856,31 @@ msgid "" "optional. For example::" msgstr "" -#: ../../library/typing.rst:686 +#: ../../library/typing.rst:815 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:693 +#: ../../library/typing.rst:822 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:699 +#: ../../library/typing.rst:828 msgid "Callable type; ``Callable[[int], str]`` is a function of (int) -> str." msgstr "" -#: ../../library/typing.rst:701 +#: ../../library/typing.rst:830 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:706 +#: ../../library/typing.rst:835 msgid "" "There is no syntax to indicate optional or keyword arguments; such function " "types are rarely used as callback types. ``Callable[..., ReturnType]`` " @@ -744,29 +890,29 @@ msgid "" "Callable`." msgstr "" -#: ../../library/typing.rst:722 +#: ../../library/typing.rst:851 msgid "" ":class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:731 +#: ../../library/typing.rst:860 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provide " "examples of usage with ``Callable``." msgstr "" -#: ../../library/typing.rst:736 +#: ../../library/typing.rst:865 msgid "" "Used with :data:`Callable` and :class:`ParamSpec` to type annotate a higher " "order callable which adds, removes, or transforms parameters of another " "callable. Usage is in the form ``Concatenate[Arg1Type, Arg2Type, ..., " "ParamSpecVariable]``. ``Concatenate`` is currently only valid when used as " "the first argument to a :data:`Callable`. The last parameter to " -"``Concatenate`` must be a :class:`ParamSpec`." +"``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -#: ../../library/typing.rst:743 +#: ../../library/typing.rst:873 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -777,17 +923,17 @@ msgid "" "passed in::" msgstr "" -#: ../../library/typing.rst:782 ../../library/typing.rst:1269 +#: ../../library/typing.rst:912 ../../library/typing.rst:1500 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)." msgstr "" -#: ../../library/typing.rst:784 +#: ../../library/typing.rst:914 msgid ":class:`ParamSpec` and :class:`Callable`." msgstr ":class:`ParamSpec` 和 :class:`Callable`\\ 。" -#: ../../library/typing.rst:789 +#: ../../library/typing.rst:919 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 " @@ -795,11 +941,11 @@ msgid "" "``C``. For example::" msgstr "" -#: ../../library/typing.rst:798 +#: ../../library/typing.rst:928 msgid "Note that ``Type[C]`` is covariant::" msgstr "" -#: ../../library/typing.rst:810 +#: ../../library/typing.rst:940 msgid "" "The fact that ``Type[C]`` is covariant implies that all subclasses of ``C`` " "should implement the same constructor signature and class method signatures " @@ -809,39 +955,39 @@ msgid "" "particular case may change in future revisions of :pep:`484`." msgstr "" -#: ../../library/typing.rst:818 +#: ../../library/typing.rst:948 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:824 +#: ../../library/typing.rst:954 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:829 +#: ../../library/typing.rst:959 msgid "" ":class:`builtins.type ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:835 +#: ../../library/typing.rst:965 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:849 +#: ../../library/typing.rst:979 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:855 +#: ../../library/typing.rst:985 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -849,22 +995,22 @@ msgid "" "their parameters are not :term:`hashable`." msgstr "" -#: ../../library/typing.rst:863 +#: ../../library/typing.rst:993 msgid "Special type construct to mark class variables." msgstr "" -#: ../../library/typing.rst:865 +#: ../../library/typing.rst:995 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:873 +#: ../../library/typing.rst:1003 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr "" -#: ../../library/typing.rst:875 +#: ../../library/typing.rst:1005 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 " @@ -872,19 +1018,29 @@ msgid "" "example, a type checker might flag the following code as an error::" msgstr "" -#: ../../library/typing.rst:889 +#: ../../library/typing.rst:1019 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:901 ../../library/typing.rst:2152 +#: ../../library/typing.rst:1031 ../../library/typing.rst:2678 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -#: ../../library/typing.rst:908 +#: ../../library/typing.rst:1040 +msgid "" +"Special typing constructs that mark individual keys of a :class:`TypedDict` " +"as either required or non-required respectively." +msgstr "" + +#: ../../library/typing.rst:1043 +msgid "See :class:`TypedDict` and :pep:`655` for more details." +msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" + +#: ../../library/typing.rst:1049 msgid "" "A type, introduced in :pep:`593` (``Flexible function and variable " "annotations``), to decorate existing types with context-specific metadata " @@ -901,7 +1057,7 @@ msgid "" "application." msgstr "" -#: ../../library/typing.rst:922 +#: ../../library/typing.rst:1063 msgid "" "Ultimately, the responsibility of how to interpret the annotations (if at " "all) is the responsibility of the tool or library encountering the " @@ -910,21 +1066,21 @@ msgid "" "using ``isinstance()``)." msgstr "" -#: ../../library/typing.rst:928 +#: ../../library/typing.rst:1069 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:932 +#: ../../library/typing.rst:1073 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:936 +#: ../../library/typing.rst:1077 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 " @@ -932,59 +1088,59 @@ msgid "" "example, if you are doing value range analysis you might allow this::" msgstr "" -#: ../../library/typing.rst:945 +#: ../../library/typing.rst:1086 msgid "" "Passing ``include_extras=True`` to :func:`get_type_hints` lets one access " "the extra annotations at runtime." msgstr "" -#: ../../library/typing.rst:948 +#: ../../library/typing.rst:1089 msgid "The details of the syntax:" msgstr "" -#: ../../library/typing.rst:950 +#: ../../library/typing.rst:1091 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:952 +#: ../../library/typing.rst:1093 msgid "" "Multiple type annotations are supported (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:957 +#: ../../library/typing.rst:1098 msgid "" "``Annotated`` must be called with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:960 +#: ../../library/typing.rst:1101 msgid "" "The order of the annotations is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:967 +#: ../../library/typing.rst:1108 msgid "" "Nested ``Annotated`` types are flattened, with metadata ordered starting " "with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:974 +#: ../../library/typing.rst:1115 msgid "Duplicated annotations are not removed::" msgstr "" -#: ../../library/typing.rst:980 +#: ../../library/typing.rst:1121 msgid "``Annotated`` can be used with nested and generic aliases::" msgstr "" -#: ../../library/typing.rst:993 +#: ../../library/typing.rst:1134 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:997 +#: ../../library/typing.rst:1138 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 " @@ -993,96 +1149,96 @@ msgid "" "conditional expression here is sometimes referred to as a \"type guard\"::" msgstr "" -#: ../../library/typing.rst:1012 +#: ../../library/typing.rst:1153 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:1016 +#: ../../library/typing.rst:1157 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1019 +#: ../../library/typing.rst:1160 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1020 +#: ../../library/typing.rst:1161 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1037 +#: ../../library/typing.rst:1178 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:1041 +#: ../../library/typing.rst:1182 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:1047 +#: ../../library/typing.rst:1188 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]`` " -"to ``List[str]`` even though the latter is not a subtype of the former, " -"since ``List`` is invariant. The responsibility of writing type-safe type " +"form. The main reason is to allow for things like narrowing ``list[object]`` " +"to ``list[str]`` even though the latter is not a subtype of the former, " +"since ``list`` is invariant. The responsibility of writing type-safe type " "guards is left to the user." msgstr "" -#: ../../library/typing.rst:1053 +#: ../../library/typing.rst:1194 msgid "" -"``TypeGuard`` also works with type variables. For more information, see :" -"pep:`647` (User-Defined Type Guards)." +"``TypeGuard`` also works with type variables. See :pep:`647` for more " +"details." msgstr "" -#: ../../library/typing.rst:1060 +#: ../../library/typing.rst:1200 msgid "Building generic types" msgstr "" -#: ../../library/typing.rst:1062 +#: ../../library/typing.rst:1202 msgid "" "These are not used in annotations. They are building blocks for creating " "generic types." msgstr "" -#: ../../library/typing.rst:1066 +#: ../../library/typing.rst:1206 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1068 +#: ../../library/typing.rst:1208 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:1077 +#: ../../library/typing.rst:1217 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1090 +#: ../../library/typing.rst:1230 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1092 ../../library/typing.rst:1198 -#: ../../library/typing.rst:1375 +#: ../../library/typing.rst:1232 ../../library/typing.rst:1429 +#: ../../library/typing.rst:1606 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/typing.rst:1098 +#: ../../library/typing.rst:1238 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 " @@ -1090,64 +1246,132 @@ msgid "" "types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1118 +#: ../../library/typing.rst:1258 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1121 -msgid "" -"Constrained type variables and bound type variables have different semantics " -"in several important ways. Using a *constrained* type variable means that " -"the ``TypeVar`` can only ever be solved as being exactly one of the " -"constraints given::" -msgstr "" - -#: ../../library/typing.rst:1131 +#: ../../library/typing.rst:1261 msgid "" -"Using a *bound* type variable, however, means that the ``TypeVar`` will be " -"solved using the most specific type possible::" +"Bound type variables and constrained type variables have different semantics " +"in several important ways. Using a *bound* type variable means that the " +"``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1142 +#: ../../library/typing.rst:1276 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1148 +#: ../../library/typing.rst:1282 msgid "" -"Bound type variables are particularly useful for annotating :func:" -"`classmethods ` that serve as alternative constructors. In the " -"following example (by `Raymond Hettinger `_), the type variable ``C`` is bound to the ``Circle`` class " -"through the use of a forward reference. Using this type variable to annotate " -"the ``with_circumference`` classmethod, rather than hardcoding the return " -"type as ``Circle``, means that a type checker can correctly infer the return " -"type even if the method is called on a subclass::" +"Using a *constrained* type variable, however, means that the ``TypeVar`` can " +"only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1186 +#: ../../library/typing.rst:1293 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:1189 +#: ../../library/typing.rst:1296 msgid "" "Type variables may be marked covariant or contravariant by passing " "``covariant=True`` or ``contravariant=True``. See :pep:`484` for more " "details. By default, type variables are invariant." msgstr "" -#: ../../library/typing.rst:1195 +#: ../../library/typing.rst:1302 +msgid "" +"Type variable tuple. A specialized form of :class:`type variable ` " +"that enables *variadic* generics." +msgstr "" + +#: ../../library/typing.rst:1305 +msgid "" +"A normal type variable enables parameterization with a single type. A type " +"variable tuple, in contrast, allows parameterization with an *arbitrary* " +"number of types by acting like an *arbitrary* number of type variables " +"wrapped in a tuple. For example::" +msgstr "" + +#: ../../library/typing.rst:1333 +msgid "" +"Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " +"Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " +"T2, ...)``. ``tuple[T, *Ts]`` would then become ``tuple[T, *(T1, " +"T2, ...)]``, which is equivalent to ``tuple[T, T1, T2, ...]``. (Note that in " +"older versions of Python, you might see this written using :data:`Unpack " +"` instead, as ``Unpack[Ts]``.)" +msgstr "" + +#: ../../library/typing.rst:1341 +msgid "" +"Type variable tuples must *always* be unpacked. This helps distinguish type " +"variable types from normal type variables::" +msgstr "" + +#: ../../library/typing.rst:1348 +msgid "" +"Type variable tuples can be used in the same contexts as normal type " +"variables. For example, in class definitions, arguments, and return types::" +msgstr "" + +#: ../../library/typing.rst:1357 +msgid "" +"Type variable tuples can be happily combined with normal type variables::" +msgstr "" + +#: ../../library/typing.rst:1370 +msgid "" +"However, note that at most one type variable tuple may appear in a single " +"list of type arguments or type parameters::" +msgstr "" + +#: ../../library/typing.rst:1377 +msgid "" +"Finally, an unpacked type variable tuple can be used as the type annotation " +"of ``*args``::" +msgstr "" + +#: ../../library/typing.rst:1387 +msgid "" +"In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " +"which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " +"enables reference to the types of the *individual* arguments in ``*args``. " +"Here, this allows us to ensure the types of the ``*args`` passed to " +"``call_soon`` match the types of the (positional) arguments of ``callback``." +msgstr "" + +#: ../../library/typing.rst:1394 +msgid "See :pep:`646` for more details on type variable tuples." +msgstr "" + +#: ../../library/typing.rst:1400 +msgid "" +"A typing operator that conceptually marks an object as having been unpacked. " +"For example, using the unpack operator ``*`` on a :class:`type variable " +"tuple ` is equivalent to using ``Unpack`` to mark the type " +"variable tuple as having been unpacked::" +msgstr "" + +#: ../../library/typing.rst:1410 +msgid "" +"In fact, ``Unpack`` can be used interchangeably with ``*`` in the context of " +"types. You might see ``Unpack`` being used explicitly in older versions of " +"Python, where ``*`` couldn't be used in certain places::" +msgstr "" + +#: ../../library/typing.rst:1426 msgid "" "Parameter specification variable. A specialized version of :class:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1202 +#: ../../library/typing.rst:1433 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1157,7 +1381,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1209 +#: ../../library/typing.rst:1440 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 " @@ -1165,27 +1389,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1233 +#: ../../library/typing.rst:1464 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:1237 +#: ../../library/typing.rst:1468 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:1239 +#: ../../library/typing.rst:1470 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:1246 +#: ../../library/typing.rst:1477 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1198,7 +1422,7 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1256 +#: ../../library/typing.rst:1487 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1207,17 +1431,17 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1265 +#: ../../library/typing.rst:1496 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1271 +#: ../../library/typing.rst:1502 msgid ":class:`Callable` and :class:`Concatenate`." msgstr ":class:`Callable` 和 :class:`Concatenate`\\ 。" -#: ../../library/typing.rst:1276 +#: ../../library/typing.rst:1507 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1225,52 +1449,52 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1281 +#: ../../library/typing.rst:1512 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``::" msgstr "" -#: ../../library/typing.rst:1293 +#: ../../library/typing.rst:1524 msgid "" "``AnyStr`` is a :class:`constrained type variable ` defined as " "``AnyStr = TypeVar('AnyStr', str, bytes)``." msgstr "" -#: ../../library/typing.rst:1296 +#: ../../library/typing.rst:1527 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:1308 +#: ../../library/typing.rst:1539 msgid "" "Base class for protocol classes. Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:1314 +#: ../../library/typing.rst:1545 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:1326 +#: ../../library/typing.rst:1557 msgid "" -"See :pep:`544` for details. Protocol classes decorated with :func:" +"See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " "that check only the presence of given attributes, ignoring their type " "signatures." msgstr "" -#: ../../library/typing.rst:1331 +#: ../../library/typing.rst:1562 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1572 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:1343 +#: ../../library/typing.rst:1574 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 " @@ -1279,7 +1503,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/typing.rst:1356 +#: ../../library/typing.rst:1587 msgid "" ":func:`runtime_checkable` will check only the presence of the required " "methods, not their type signatures. For example, :class:`ssl.SSLObject` is a " @@ -1289,38 +1513,38 @@ msgid "" "making it impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:1367 +#: ../../library/typing.rst:1598 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1369 +#: ../../library/typing.rst:1600 msgid "" "These are not used in annotations. They are building blocks for declaring " "types." msgstr "" -#: ../../library/typing.rst:1373 +#: ../../library/typing.rst:1604 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1381 +#: ../../library/typing.rst:1612 msgid "This is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/typing.rst:1385 +#: ../../library/typing.rst:1616 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1394 +#: ../../library/typing.rst:1625 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1396 +#: ../../library/typing.rst:1627 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 " @@ -1329,52 +1553,60 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:1402 +#: ../../library/typing.rst:1633 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:1412 +#: ../../library/typing.rst:1643 +msgid "``NamedTuple`` subclasses can be generic::" +msgstr "" + +#: ../../library/typing.rst:1649 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:1416 +#: ../../library/typing.rst:1653 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:1419 +#: ../../library/typing.rst:1656 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:1422 +#: ../../library/typing.rst:1659 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:1426 +#: ../../library/typing.rst:1663 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:1432 +#: ../../library/typing.rst:1667 +msgid "Added support for generic namedtuples." +msgstr "" + +#: ../../library/typing.rst:1672 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:1442 +#: ../../library/typing.rst:1682 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:1447 +#: ../../library/typing.rst:1687 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:1450 +#: ../../library/typing.rst:1690 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 " @@ -1382,27 +1614,53 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:1466 +#: ../../library/typing.rst:1706 msgid "" "To allow using this feature with older versions of Python that do not " "support :pep:`526`, ``TypedDict`` supports two additional equivalent " -"syntactic forms::" +"syntactic forms:" +msgstr "" + +#: ../../library/typing.rst:1710 +msgid "Using a literal :class:`dict` as the second argument::" +msgstr "" + +#: ../../library/typing.rst:1714 +msgid "Using keyword arguments::" +msgstr "" + +#: ../../library/typing.rst:1721 +msgid "" +"The keyword-argument syntax is deprecated in 3.11 and will be removed in " +"3.13. It may also be unsupported by static type checkers." msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1722 msgid "" "The functional syntax should also be used when any of the keys are not " "valid :ref:`identifiers `, for example because they are " "keywords or contain hyphens. Example::" msgstr "" -#: ../../library/typing.rst:1485 +#: ../../library/typing.rst:1734 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " -"override this by specifying totality. Usage::" +"mark individual keys as non-required using :data:`NotRequired`::" +msgstr "" + +#: ../../library/typing.rst:1745 +msgid "" +"This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " +"omitted." +msgstr "" + +#: ../../library/typing.rst:1748 +msgid "" +"It is also possible to mark all keys as non-required by default by " +"specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1758 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 " @@ -1410,192 +1668,225 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:1498 +#: ../../library/typing.rst:1763 +msgid "" +"Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " +"using :data:`Required`::" +msgstr "" + +#: ../../library/typing.rst:1778 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1785 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:1513 +#: ../../library/typing.rst:1793 msgid "" -"A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, notably " -"including :class:`Generic`. For example::" +"A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " +"for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:1531 +#: ../../library/typing.rst:1811 +msgid "A ``TypedDict`` can be generic::" +msgstr "" + +#: ../../library/typing.rst:1817 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:1537 +#: ../../library/typing.rst:1823 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example::" msgstr "" -#: ../../library/typing.rst:1557 +#: ../../library/typing.rst:1843 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " -"respectively. Currently the only way to declare both required and non-" -"required keys in the same ``TypedDict`` is mixed inheritance, declaring a " -"``TypedDict`` with one value for the ``total`` argument and then inheriting " -"it from another ``TypedDict`` with a different value for ``total``. Usage::" +"respectively." msgstr "" -#: ../../library/typing.rst:1579 +#: ../../library/typing.rst:1846 +msgid "" +"Keys marked with :data:`Required` will always appear in " +"``__required_keys__`` and keys marked with :data:`NotRequired` will always " +"appear in ``__optional_keys__``." +msgstr "" + +#: ../../library/typing.rst:1849 +msgid "" +"For backwards compatibility with Python 3.10 and below, it is also possible " +"to use inheritance to declare both required and non-required keys in the " +"same ``TypedDict`` . This is done by declaring a ``TypedDict`` with one " +"value for the ``total`` argument and then inheriting from it in another " +"``TypedDict`` with a different value for ``total``::" +msgstr "" + +#: ../../library/typing.rst:1870 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:1584 +#: ../../library/typing.rst:1874 +msgid "" +"Added support for marking individual keys as :data:`Required` or :data:" +"`NotRequired`. See :pep:`655`." +msgstr "" + +#: ../../library/typing.rst:1878 +msgid "Added support for generic ``TypedDict``\\ s." +msgstr "" + +#: ../../library/typing.rst:1882 msgid "Generic concrete collections" msgstr "" -#: ../../library/typing.rst:1587 +#: ../../library/typing.rst:1885 msgid "Corresponding to built-in types" msgstr "" -#: ../../library/typing.rst:1591 +#: ../../library/typing.rst:1889 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:1595 +#: ../../library/typing.rst:1893 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:1600 +#: ../../library/typing.rst:1898 msgid "" ":class:`builtins.dict ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1606 +#: ../../library/typing.rst:1904 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:1611 +#: ../../library/typing.rst:1909 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1919 msgid "" ":class:`builtins.list ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1925 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:1631 +#: ../../library/typing.rst:1929 msgid "" ":class:`builtins.set ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1637 +#: ../../library/typing.rst:1935 msgid "A generic version of :class:`builtins.frozenset `." msgstr "" -#: ../../library/typing.rst:1639 +#: ../../library/typing.rst:1937 msgid "" ":class:`builtins.frozenset ` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1643 +#: ../../library/typing.rst:1941 msgid ":data:`Tuple` is a special form." msgstr "" -#: ../../library/typing.rst:1646 +#: ../../library/typing.rst:1944 msgid "Corresponding to types in :mod:`collections`" msgstr "" -#: ../../library/typing.rst:1650 +#: ../../library/typing.rst:1948 msgid "A generic version of :class:`collections.defaultdict`." msgstr "" -#: ../../library/typing.rst:1654 +#: ../../library/typing.rst:1952 msgid "" ":class:`collections.defaultdict` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1660 +#: ../../library/typing.rst:1958 msgid "A generic version of :class:`collections.OrderedDict`." msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1962 msgid "" ":class:`collections.OrderedDict` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1968 msgid "A generic version of :class:`collections.ChainMap`." msgstr "" -#: ../../library/typing.rst:1675 +#: ../../library/typing.rst:1973 msgid "" ":class:`collections.ChainMap` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1681 +#: ../../library/typing.rst:1979 msgid "A generic version of :class:`collections.Counter`." msgstr "" -#: ../../library/typing.rst:1686 +#: ../../library/typing.rst:1984 msgid "" ":class:`collections.Counter` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1692 +#: ../../library/typing.rst:1990 msgid "A generic version of :class:`collections.deque`." msgstr "" -#: ../../library/typing.rst:1697 +#: ../../library/typing.rst:1995 msgid "" ":class:`collections.deque` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:2000 msgid "Other concrete types" msgstr "" -#: ../../library/typing.rst:1708 +#: ../../library/typing.rst:2006 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:1715 +#: ../../library/typing.rst:2013 msgid "" "The ``typing.io`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:1720 +#: ../../library/typing.rst:2018 msgid "" "These type aliases correspond to the return types from :func:`re.compile` " "and :func:`re.match`. These types (and the corresponding functions) are " @@ -1603,413 +1894,638 @@ msgid "" "``Pattern[bytes]``, ``Match[str]``, or ``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:1730 +#: ../../library/typing.rst:2028 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:1731 +#: ../../library/typing.rst:2029 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1737 +#: ../../library/typing.rst:2035 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:1741 +#: ../../library/typing.rst:2039 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:1750 +#: ../../library/typing.rst:2047 +msgid "" +"Python 2 is no longer supported, and most type checkers also no longer " +"support type checking Python 2 code. Removal of the alias is not currently " +"planned, but users are encouraged to use :class:`str` instead of ``Text`` " +"wherever possible." +msgstr "" + +#: ../../library/typing.rst:2054 msgid "Abstract Base Classes" msgstr "" -#: ../../library/typing.rst:1753 +#: ../../library/typing.rst:2057 msgid "Corresponding to collections in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:1757 +#: ../../library/typing.rst:2061 msgid "A generic version of :class:`collections.abc.Set`." msgstr "" -#: ../../library/typing.rst:1759 +#: ../../library/typing.rst:2063 msgid "" ":class:`collections.abc.Set` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1765 +#: ../../library/typing.rst:2069 msgid "A generic version of :class:`collections.abc.ByteString`." msgstr "" -#: ../../library/typing.rst:1767 +#: ../../library/typing.rst:2071 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:1770 +#: ../../library/typing.rst:2074 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:1773 +#: ../../library/typing.rst:2077 msgid "" ":class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1779 +#: ../../library/typing.rst:2083 msgid "A generic version of :class:`collections.abc.Collection`" msgstr "" -#: ../../library/typing.rst:1783 +#: ../../library/typing.rst:2087 msgid "" ":class:`collections.abc.Collection` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1789 +#: ../../library/typing.rst:2093 msgid "A generic version of :class:`collections.abc.Container`." msgstr "" -#: ../../library/typing.rst:1791 +#: ../../library/typing.rst:2095 msgid "" ":class:`collections.abc.Container` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1797 +#: ../../library/typing.rst:2101 msgid "A generic version of :class:`collections.abc.ItemsView`." msgstr "" -#: ../../library/typing.rst:1799 +#: ../../library/typing.rst:2103 msgid "" ":class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1805 +#: ../../library/typing.rst:2109 msgid "A generic version of :class:`collections.abc.KeysView`." msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:2111 msgid "" ":class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1813 +#: ../../library/typing.rst:2117 msgid "" "A generic version of :class:`collections.abc.Mapping`. This type can be used " "as follows::" msgstr "" -#: ../../library/typing.rst:1819 +#: ../../library/typing.rst:2123 msgid "" ":class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1825 +#: ../../library/typing.rst:2129 msgid "A generic version of :class:`collections.abc.MappingView`." msgstr "" -#: ../../library/typing.rst:1827 +#: ../../library/typing.rst:2131 msgid "" ":class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:2137 msgid "A generic version of :class:`collections.abc.MutableMapping`." msgstr "" -#: ../../library/typing.rst:1835 +#: ../../library/typing.rst:2139 msgid "" ":class:`collections.abc.MutableMapping` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:2145 msgid "A generic version of :class:`collections.abc.MutableSequence`." msgstr "" -#: ../../library/typing.rst:1843 +#: ../../library/typing.rst:2147 msgid "" ":class:`collections.abc.MutableSequence` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1849 +#: ../../library/typing.rst:2153 msgid "A generic version of :class:`collections.abc.MutableSet`." msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:2155 msgid "" ":class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:2161 msgid "A generic version of :class:`collections.abc.Sequence`." msgstr "" -#: ../../library/typing.rst:1859 +#: ../../library/typing.rst:2163 msgid "" ":class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1865 +#: ../../library/typing.rst:2169 msgid "A generic version of :class:`collections.abc.ValuesView`." msgstr "" -#: ../../library/typing.rst:1867 +#: ../../library/typing.rst:2171 msgid "" ":class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1872 +#: ../../library/typing.rst:2176 msgid "Corresponding to other types in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:1876 +#: ../../library/typing.rst:2180 msgid "A generic version of :class:`collections.abc.Iterable`." msgstr "" -#: ../../library/typing.rst:1878 +#: ../../library/typing.rst:2182 msgid "" ":class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1884 +#: ../../library/typing.rst:2188 msgid "A generic version of :class:`collections.abc.Iterator`." msgstr "" -#: ../../library/typing.rst:1886 +#: ../../library/typing.rst:2190 msgid "" ":class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1892 +#: ../../library/typing.rst:2196 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:1901 +#: ../../library/typing.rst:2205 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:1905 +#: ../../library/typing.rst:2209 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:1913 +#: ../../library/typing.rst:2217 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:1921 +#: ../../library/typing.rst:2225 msgid "" ":class:`collections.abc.Generator` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1927 +#: ../../library/typing.rst:2231 msgid "An alias to :class:`collections.abc.Hashable`." msgstr "" -#: ../../library/typing.rst:1931 +#: ../../library/typing.rst:2235 msgid "A generic version of :class:`collections.abc.Reversible`." msgstr "" -#: ../../library/typing.rst:1933 +#: ../../library/typing.rst:2237 msgid "" ":class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1939 +#: ../../library/typing.rst:2243 msgid "An alias to :class:`collections.abc.Sized`." msgstr "" -#: ../../library/typing.rst:1942 +#: ../../library/typing.rst:2246 msgid "Asynchronous programming" msgstr "" -#: ../../library/typing.rst:1946 +#: ../../library/typing.rst:2250 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:1958 +#: ../../library/typing.rst:2262 msgid "" ":class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1964 +#: ../../library/typing.rst:2268 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:2277 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:1977 +#: ../../library/typing.rst:2281 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:1985 +#: ../../library/typing.rst:2289 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:2299 msgid "" ":class:`collections.abc.AsyncGenerator` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2001 +#: ../../library/typing.rst:2305 msgid "A generic version of :class:`collections.abc.AsyncIterable`." msgstr "" -#: ../../library/typing.rst:2005 +#: ../../library/typing.rst:2309 msgid "" ":class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2011 +#: ../../library/typing.rst:2315 msgid "A generic version of :class:`collections.abc.AsyncIterator`." msgstr "" -#: ../../library/typing.rst:2015 +#: ../../library/typing.rst:2319 msgid "" ":class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2021 +#: ../../library/typing.rst:2325 msgid "A generic version of :class:`collections.abc.Awaitable`." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2329 msgid "" ":class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2031 +#: ../../library/typing.rst:2335 msgid "Context manager types" msgstr "" -#: ../../library/typing.rst:2035 +#: ../../library/typing.rst:2339 msgid "A generic version of :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:2040 +#: ../../library/typing.rst:2344 msgid "" ":class:`contextlib.AbstractContextManager` now supports ``[]``. See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2046 +#: ../../library/typing.rst:2350 msgid "A generic version of :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2355 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2056 +#: ../../library/typing.rst:2360 msgid "Protocols" msgstr "" -#: ../../library/typing.rst:2058 +#: ../../library/typing.rst:2362 msgid "These protocols are decorated with :func:`runtime_checkable`." msgstr "" -#: ../../library/typing.rst:2062 +#: ../../library/typing.rst:2366 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2067 +#: ../../library/typing.rst:2371 msgid "An ABC with one abstract method ``__bytes__``." msgstr "" -#: ../../library/typing.rst:2071 +#: ../../library/typing.rst:2375 msgid "An ABC with one abstract method ``__complex__``." msgstr "" -#: ../../library/typing.rst:2075 +#: ../../library/typing.rst:2379 msgid "An ABC with one abstract method ``__float__``." msgstr "" -#: ../../library/typing.rst:2079 +#: ../../library/typing.rst:2383 msgid "An ABC with one abstract method ``__index__``." msgstr "" -#: ../../library/typing.rst:2085 +#: ../../library/typing.rst:2389 msgid "An ABC with one abstract method ``__int__``." msgstr "" -#: ../../library/typing.rst:2089 +#: ../../library/typing.rst:2393 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2093 +#: ../../library/typing.rst:2397 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2097 +#: ../../library/typing.rst:2401 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2099 +#: ../../library/typing.rst:2403 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:2106 +#: ../../library/typing.rst:2410 +msgid "" +"Ask a static type checker to confirm that *val* has an inferred type of " +"*typ*." +msgstr "" + +#: ../../library/typing.rst:2412 +msgid "" +"When the type checker encounters a call to ``assert_type()``, it emits an " +"error if the value is not of the specified type::" +msgstr "" + +#: ../../library/typing.rst:2419 +msgid "" +"At runtime this returns the first argument unchanged with no side effects." +msgstr "" + +#: ../../library/typing.rst:2421 +msgid "" +"This function is useful for ensuring the type checker's understanding of a " +"script is in line with the developer's intentions::" +msgstr "" + +#: ../../library/typing.rst:2435 +msgid "" +"Ask a static type checker to confirm that a line of code is unreachable." +msgstr "" + +#: ../../library/typing.rst:2448 +msgid "" +"Here, the annotations allow the type checker to infer that the last case can " +"never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " +"and both options are covered by earlier cases. If a type checker finds that " +"a call to ``assert_never()`` is reachable, it will emit an error. For " +"example, if the type annotation for ``arg`` was instead ``int | str | " +"float``, the type checker would emit an error pointing out that " +"``unreachable`` is of type :class:`float`. For a call to ``assert_never`` to " +"pass type checking, the inferred type of the argument passed in must be the " +"bottom type, :data:`Never`, and nothing else." +msgstr "" + +#: ../../library/typing.rst:2460 +msgid "At runtime, this throws an exception when called." +msgstr "" + +#: ../../library/typing.rst:2463 +msgid "" +"`Unreachable Code and Exhaustiveness Checking `__ has more information about " +"exhaustiveness checking with static typing." +msgstr "" + +#: ../../library/typing.rst:2471 +msgid "Reveal the inferred static type of an expression." +msgstr "" + +#: ../../library/typing.rst:2473 +msgid "" +"When a static type checker encounters a call to this function, it emits a " +"diagnostic with the type of the argument. For example::" +msgstr "" + +#: ../../library/typing.rst:2479 +msgid "" +"This can be useful when you want to debug how your type checker handles a " +"particular piece of code." +msgstr "" + +#: ../../library/typing.rst:2482 +msgid "" +"The function returns its argument unchanged, which allows using it within an " +"expression::" +msgstr "" + +#: ../../library/typing.rst:2487 +msgid "" +"Most type checkers support ``reveal_type()`` anywhere, even if the name is " +"not imported from ``typing``. Importing the name from ``typing`` allows your " +"code to run without runtime errors and communicates intent more clearly." +msgstr "" + +#: ../../library/typing.rst:2492 +msgid "" +"At runtime, this function prints the runtime type of its argument to stderr " +"and returns it unchanged::" +msgstr "" + +#: ../../library/typing.rst:2502 +msgid "" +":data:`~typing.dataclass_transform` may be used to decorate a class, " +"metaclass, or a function that is itself a decorator. The presence of " +"``@dataclass_transform()`` tells a static type checker that the decorated " +"object performs runtime \"magic\" that transforms a class, giving it :func:" +"`dataclasses.dataclass`-like behaviors." +msgstr "" + +#: ../../library/typing.rst:2508 +msgid "Example usage with a decorator function::" +msgstr "" + +#: ../../library/typing.rst:2522 +msgid "On a base class::" +msgstr "" + +#: ../../library/typing.rst:2531 +msgid "On a metaclass::" +msgstr "" + +#: ../../library/typing.rst:2542 +msgid "" +"The ``CustomerModel`` classes defined above will be treated by type checkers " +"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " +"``__init__`` methods that accept ``id`` and ``name``." +msgstr "" + +#: ../../library/typing.rst:2548 +msgid "" +"The decorated class, metaclass, or function may accept the following bool " +"arguments which type checkers will assume have the same effect as they would " +"have on the :func:`@dataclasses.dataclass` decorator: " +"``init``, ``eq``, ``order``, ``unsafe_hash``, ``frozen``, ``match_args``, " +"``kw_only``, and ``slots``. It must be possible for the value of these " +"arguments (``True`` or ``False``) to be statically evaluated." +msgstr "" + +#: ../../library/typing.rst:2556 +msgid "" +"The arguments to the ``dataclass_transform`` decorator can be used to " +"customize the default behaviors of the decorated class, metaclass, or " +"function:" +msgstr "" + +#: ../../library/typing.rst:2560 +msgid "" +"``eq_default`` indicates whether the ``eq`` parameter is assumed to be " +"``True`` or ``False`` if it is omitted by the caller." +msgstr "" + +#: ../../library/typing.rst:2562 +msgid "" +"``order_default`` indicates whether the ``order`` parameter is assumed to be " +"True or False if it is omitted by the caller." +msgstr "" + +#: ../../library/typing.rst:2564 +msgid "" +"``kw_only_default`` indicates whether the ``kw_only`` parameter is assumed " +"to be True or False if it is omitted by the caller." +msgstr "" + +#: ../../library/typing.rst:2566 +msgid "" +"``field_specifiers`` specifies a static list of supported classes or " +"functions that describe fields, similar to ``dataclasses.field()``." +msgstr "" + +#: ../../library/typing.rst:2568 +msgid "" +"Arbitrary other keyword arguments are accepted in order to allow for " +"possible future extensions." +msgstr "" + +#: ../../library/typing.rst:2571 +msgid "" +"Type checkers recognize the following optional arguments on field specifiers:" +msgstr "" + +#: ../../library/typing.rst:2574 +msgid "" +"``init`` indicates whether the field should be included in the synthesized " +"``__init__`` method. If unspecified, ``init`` defaults to ``True``." +msgstr "" + +#: ../../library/typing.rst:2577 +msgid "``default`` provides the default value for the field." +msgstr "" + +#: ../../library/typing.rst:2578 +msgid "" +"``default_factory`` provides a runtime callback that returns the default " +"value for the field. If neither ``default`` nor ``default_factory`` are " +"specified, the field is assumed to have no default value and must be " +"provided a value when the class is instantiated." +msgstr "" + +#: ../../library/typing.rst:2583 +msgid "``factory`` is an alias for ``default_factory``." +msgstr "" + +#: ../../library/typing.rst:2584 +msgid "" +"``kw_only`` indicates whether the field should be marked as keyword-only. If " +"``True``, the field will be keyword-only. If ``False``, it will not be " +"keyword-only. If unspecified, the value of the ``kw_only`` parameter on the " +"object decorated with ``dataclass_transform`` will be used, or if that is " +"unspecified, the value of ``kw_only_default`` on ``dataclass_transform`` " +"will be used." +msgstr "" + +#: ../../library/typing.rst:2590 +msgid "" +"``alias`` provides an alternative name for the field. This alternative name " +"is used in the synthesized ``__init__`` method." +msgstr "" + +#: ../../library/typing.rst:2593 +msgid "" +"At runtime, this decorator records its arguments in the " +"``__dataclass_transform__`` attribute on the decorated object. It has no " +"other runtime effect." +msgstr "" + +#: ../../library/typing.rst:2597 +msgid "See :pep:`681` for more details." +msgstr "更多細節請見 :pep:`681`。" + +#: ../../library/typing.rst:2603 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -2024,101 +2540,147 @@ msgid "" "variable::" msgstr "" -#: ../../library/typing.rst:2130 -msgid "See :pep:`484` for details and comparison with other typing semantics." +#: ../../library/typing.rst:2627 +msgid "" +"See :pep:`484` for more details and comparison with other typing semantics." +msgstr "" + +#: ../../library/typing.rst:2629 +msgid "" +"Overloaded functions can now be introspected at runtime using :func:" +"`get_overloads`." +msgstr "" + +#: ../../library/typing.rst:2636 +msgid "" +"Return a sequence of :func:`@overload `-decorated definitions for " +"*func*. *func* is the function object for the implementation of the " +"overloaded function. For example, given the definition of ``process`` in the " +"documentation for :func:`@overload `, ``get_overloads(process)`` " +"will return a sequence of three function objects for the three defined " +"overloads. If called on a function with no overloads, ``get_overloads()`` " +"returns an empty sequence." +msgstr "" + +#: ../../library/typing.rst:2644 +msgid "" +"``get_overloads()`` can be used for introspecting an overloaded function at " +"runtime." +msgstr "" + +#: ../../library/typing.rst:2652 +msgid "" +"Clear all registered overloads in the internal registry. This can be used to " +"reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2134 +#: ../../library/typing.rst:2660 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:2159 +#: ../../library/typing.rst:2683 +msgid "" +"The decorator will now set the ``__final__`` attribute to ``True`` on the " +"decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " +"False)`` can be used at runtime to determine whether an object ``obj`` has " +"been marked as final. If the decorated object does not support setting " +"attributes, the decorator returns the object unchanged without raising an " +"exception." +msgstr "" + +#: ../../library/typing.rst:2694 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2161 +#: ../../library/typing.rst:2696 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)." +"recursively to all methods and classes defined in that class (but not to " +"methods defined in its superclasses or subclasses)." msgstr "" -#: ../../library/typing.rst:2165 +#: ../../library/typing.rst:2700 msgid "This mutates the function(s) in place." msgstr "" -#: ../../library/typing.rst:2169 +#: ../../library/typing.rst:2704 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2171 +#: ../../library/typing.rst:2706 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2176 +#: ../../library/typing.rst:2711 msgid "Decorator to mark a class or function to be unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2178 +#: ../../library/typing.rst:2713 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:2189 +#: ../../library/typing.rst:2724 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2193 +#: ../../library/typing.rst:2728 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2197 +#: ../../library/typing.rst:2732 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2200 +#: ../../library/typing.rst:2735 msgid "" "This is often the same as ``obj.__annotations__``. In addition, forward " "references encoded as string literals are handled by evaluating them in " -"``globals`` and ``locals`` namespaces. If necessary, ``Optional[t]`` is " -"added for function and method annotations if a default value equal to " -"``None`` is set. For a class ``C``, return a dictionary constructed by " -"merging all the ``__annotations__`` along ``C.__mro__`` in reverse order." +"``globals`` and ``locals`` namespaces. For a class ``C``, return a " +"dictionary constructed by merging all the ``__annotations__`` along ``C." +"__mro__`` in reverse order." msgstr "" -#: ../../library/typing.rst:2208 +#: ../../library/typing.rst:2741 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:2223 +#: ../../library/typing.rst:2756 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:2228 +#: ../../library/typing.rst:2761 msgid "Added ``include_extras`` parameter as part of :pep:`593`." msgstr "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。" -#: ../../library/typing.rst:2234 +#: ../../library/typing.rst:2764 +msgid "" +"Previously, ``Optional[t]`` was added for function and method annotations if " +"a default value equal to ``None`` was set. Now the annotation is returned " +"unchanged." +msgstr "" + +#: ../../library/typing.rst:2772 msgid "Provide basic introspection for generic types and special typing forms." msgstr "" -#: ../../library/typing.rst:2236 +#: ../../library/typing.rst:2774 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:" @@ -2129,11 +2691,11 @@ msgid "" "and ``()`` correspondingly. Examples::" msgstr "" -#: ../../library/typing.rst:2255 +#: ../../library/typing.rst:2793 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2270 +#: ../../library/typing.rst:2808 msgid "" "A class used for internal typing representation of string forward " "references. For example, ``List[\"SomeClass\"]`` is implicitly transformed " @@ -2141,24 +2703,24 @@ msgid "" "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2814 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:2283 +#: ../../library/typing.rst:2821 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:2287 +#: ../../library/typing.rst:2825 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:2296 +#: ../../library/typing.rst:2834 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2166,10 +2728,82 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2303 +#: ../../library/typing.rst:2841 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " "in ``__annotations__``. This makes it unnecessary to use quotes around the " "annotation (see :pep:`563`)." msgstr "" + +#: ../../library/typing.rst:2850 +msgid "Deprecation Timeline of Major Features" +msgstr "" + +#: ../../library/typing.rst:2852 +msgid "" +"Certain features in ``typing`` are deprecated and may be removed in a future " +"version of Python. The following table summarizes major deprecations for " +"your convenience. This is subject to change, and not all deprecations are " +"listed." +msgstr "" + +#: ../../library/typing.rst:2857 +msgid "Feature" +msgstr "" + +#: ../../library/typing.rst:2857 +msgid "Deprecated in" +msgstr "" + +#: ../../library/typing.rst:2857 +msgid "Projected removal" +msgstr "" + +#: ../../library/typing.rst:2857 +msgid "PEP/issue" +msgstr "" + +#: ../../library/typing.rst:2859 +msgid "``typing.io`` and ``typing.re`` submodules" +msgstr "" + +#: ../../library/typing.rst:2859 +msgid "3.8" +msgstr "" + +#: ../../library/typing.rst:2859 +msgid "3.12" +msgstr "" + +#: ../../library/typing.rst:2859 +msgid ":issue:`38291`" +msgstr "" + +#: ../../library/typing.rst:2862 +msgid "``typing`` versions of standard collections" +msgstr "" + +#: ../../library/typing.rst:2862 +msgid "3.9" +msgstr "" + +#: ../../library/typing.rst:2862 ../../library/typing.rst:2865 +msgid "Undecided" +msgstr "" + +#: ../../library/typing.rst:2862 +msgid ":pep:`585`" +msgstr "" + +#: ../../library/typing.rst:2865 +msgid "``typing.Text``" +msgstr "" + +#: ../../library/typing.rst:2865 +msgid "3.11" +msgstr "" + +#: ../../library/typing.rst:2865 +msgid ":gh:`92332`" +msgstr "" diff --git a/library/undoc.po b/library/undoc.po new file mode 100644 index 0000000000..0ed049a542 --- /dev/null +++ b/library/undoc.po @@ -0,0 +1,62 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.10\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-01-14 13:34+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/undoc.rst:5 +msgid "Undocumented Modules" +msgstr "" + +#: ../../library/undoc.rst:7 +msgid "" +"Here's a quick listing of modules that are currently undocumented, but that " +"should be documented. Feel free to contribute documentation for them! " +"(Send via email to docs@python.org.)" +msgstr "" + +#: ../../library/undoc.rst:11 +msgid "" +"The idea and original contents for this chapter were taken from a posting by " +"Fredrik Lundh; the specific contents of this chapter have been substantially " +"revised." +msgstr "" + +#: ../../library/undoc.rst:17 +msgid "Platform specific modules" +msgstr "" + +#: ../../library/undoc.rst:19 +msgid "" +"These modules are used to implement the :mod:`os.path` module, and are not " +"documented beyond this mention. There's little need to document these." +msgstr "" + +#: ../../library/undoc.rst:23 +msgid ":mod:`ntpath`" +msgstr "" + +#: ../../library/undoc.rst:23 +msgid "--- Implementation of :mod:`os.path` on Win32 and Win64 platforms." +msgstr "" + +#: ../../library/undoc.rst:25 +msgid ":mod:`posixpath`" +msgstr "" + +#: ../../library/undoc.rst:26 +msgid "--- Implementation of :mod:`os.path` on POSIX." +msgstr "" diff --git a/library/unicodedata.po b/library/unicodedata.po index 4bb1003250..a86aa8edf0 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -26,8 +26,8 @@ msgstr "" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 13.0.0 `_." +"in this database is compiled from the `UCD version 14.0.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -188,9 +188,9 @@ msgid "Footnotes" msgstr "註解" #: ../../library/unicodedata.rst:178 -msgid "https://www.unicode.org/Public/13.0.0/ucd/NameAliases.txt" -msgstr "https://www.unicode.org/Public/13.0.0/ucd/NameAliases.txt" +msgid "https://www.unicode.org/Public/14.0.0/ucd/NameAliases.txt" +msgstr "https://www.unicode.org/Public/14.0.0/ucd/NameAliases.txt" #: ../../library/unicodedata.rst:180 -msgid "https://www.unicode.org/Public/13.0.0/ucd/NamedSequences.txt" -msgstr "https://www.unicode.org/Public/13.0.0/ucd/NamedSequences.txt" +msgid "https://www.unicode.org/Public/14.0.0/ucd/NamedSequences.txt" +msgstr "https://www.unicode.org/Public/14.0.0/ucd/NamedSequences.txt" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 66808b017e..34ae6879f1 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2016-11-19 00:35+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -593,10 +593,10 @@ msgstr "" msgid "" "If you want several patches in place for multiple test methods the obvious " "way is to apply the patch decorators to every method. This can feel like " -"unnecessary repetition. For Python 2.6 or more recent you can use :func:" -"`patch` (in all its various forms) as a class decorator. This applies the " -"patches to all test methods on the class. A test method is identified by " -"methods whose names start with ``test``::" +"unnecessary repetition. Instead, you can use :func:`patch` (in all its " +"various forms) as a class decorator. This applies the patches to all test " +"methods on the class. A test method is identified by methods whose names " +"start with ``test``::" msgstr "" #: ../../library/unittest.mock-examples.rst:685 diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 3c8fc937f5..d201ca6205 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -263,7 +263,7 @@ msgstr "" #: ../../library/unittest.mock.rst:265 msgid "" -"*unsafe*: By default, accessing any attribute with name starting with " +"*unsafe*: By default, accessing any attribute whose name starts with " "*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" "`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." @@ -1604,10 +1604,9 @@ msgstr "" #: ../../library/unittest.mock.rst:2022 msgid "" "The numeric methods (including right hand and in-place variants): " -"``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__div__``, " -"``__truediv__``, ``__floordiv__``, ``__mod__``, ``__divmod__``, " -"``__lshift__``, ``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and " -"``__pow__``" +"``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " +"``__floordiv__``, ``__mod__``, ``__divmod__``, ``__lshift__``, " +"``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``" msgstr "" #: ../../library/unittest.mock.rst:2026 @@ -1851,8 +1850,8 @@ msgid "" msgstr "" #: ../../library/unittest.mock.rst:2168 -msgid "``__getformat__`` and ``__setformat__``" -msgstr "``__getformat__`` 和 ``__setformat__``" +msgid "``__getformat__``" +msgstr "``__getformat__``" #: ../../library/unittest.mock.rst:2172 msgid "" @@ -2058,10 +2057,10 @@ msgstr "FILTER_DIR" #: ../../library/unittest.mock.rst:2383 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " -"objects respond to :func:`dir` (only for Python 2.6 or more recent). The " -"default is ``True``, which uses the filtering described below, to only show " -"useful members. If you dislike this filtering, or need to switch it off for " -"diagnostic purposes, then set ``mock.FILTER_DIR = False``." +"objects respond to :func:`dir`. The default is ``True``, which uses the " +"filtering described below, to only show useful members. If you dislike this " +"filtering, or need to switch it off for diagnostic purposes, then set ``mock." +"FILTER_DIR = False``." msgstr "" #: ../../library/unittest.mock.rst:2389 @@ -2374,3 +2373,6 @@ msgid "" "won't be considered in the sealing chain. This allows one to prevent seal " "from fixing part of the mock object. ::" msgstr "" + +#~ msgid "``__getformat__`` and ``__setformat__``" +#~ msgstr "``__getformat__`` 和 ``__setformat__``" diff --git a/library/unittest.po b/library/unittest.po index fa9ba6c7da..72fac8bac1 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-04 00:24+0000\n" -"PO-Revision-Date: 2022-05-22 02:20+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -20,7 +20,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 3.1.1\n" #: ../../library/unittest.rst:2 msgid ":mod:`unittest` --- Unit testing framework" @@ -182,15 +182,15 @@ msgid "" "intended largely for ease of use for those new to unit testing. For " "production environments it is recommended that tests be driven by a " "continuous integration system such as `Buildbot `_, " -"`Jenkins `_ or `Travis-CI `_, or " -"`AppVeyor `_." +"`Jenkins `_, `GitHub Actions `_, or `AppVeyor `_." msgstr "" -#: ../../library/unittest.rst:82 +#: ../../library/unittest.rst:83 msgid "Basic example" msgstr "簡單範例" -#: ../../library/unittest.rst:84 +#: ../../library/unittest.rst:85 msgid "" "The :mod:`unittest` module provides a rich set of tools for constructing and " "running tests. This section demonstrates that a small subset of the tools " @@ -199,14 +199,14 @@ msgstr "" ":mod:`unittest` 模組提供一系列豐富的工具用來建構與執行測試。本節將展示這一系" "列工具中一部份,它們已能滿足大部份使用者需求。" -#: ../../library/unittest.rst:88 +#: ../../library/unittest.rst:89 msgid "Here is a short script to test three string methods::" msgstr "" "這是一段簡短的腳本用來測試 3 個字串方法:\n" "\n" "::" -#: ../../library/unittest.rst:112 +#: ../../library/unittest.rst:113 msgid "" "A testcase is created by subclassing :class:`unittest.TestCase`. The three " "individual tests are defined with methods whose names start with the letters " @@ -217,7 +217,7 @@ msgstr "" "定義了三個獨立的物件方法,名稱皆以 ``test`` 開頭。這樣的命名方式能告知 test " "runner 哪些物件方法為定義的測試。" -#: ../../library/unittest.rst:117 +#: ../../library/unittest.rst:118 msgid "" "The crux of each test is a call to :meth:`~TestCase.assertEqual` to check " "for an expected result; :meth:`~TestCase.assertTrue` or :meth:`~TestCase." @@ -232,7 +232,7 @@ msgstr "" "使用這些物件方法來取代 :keyword:`assert` 陳述句,將能使 test runner 收集所有" "的測試結果並產生一個報表。" -#: ../../library/unittest.rst:124 +#: ../../library/unittest.rst:125 msgid "" "The :meth:`~TestCase.setUp` and :meth:`~TestCase.tearDown` methods allow you " "to define instructions that will be executed before and after each test " @@ -240,7 +240,7 @@ msgid "" "tests`." msgstr "" -#: ../../library/unittest.rst:128 +#: ../../library/unittest.rst:129 msgid "" "The final block shows a simple way to run the tests. :func:`unittest.main` " "provides a command-line interface to the test script. When run from the " @@ -251,7 +251,7 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:138 +#: ../../library/unittest.rst:139 msgid "" "Passing the ``-v`` option to your test script will instruct :func:`unittest." "main` to enable a higher level of verbosity, and produce the following " @@ -262,7 +262,7 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:150 +#: ../../library/unittest.rst:151 msgid "" "The above examples show the most commonly used :mod:`unittest` features " "which are sufficient to meet many everyday testing needs. The remainder of " @@ -271,11 +271,17 @@ msgstr "" "以上的例子顯示大多數使用 :mod:`unittest` 特徵足以滿足大多數日常測試的需求。接" "下來第一部分文件的剩餘部分將繼續探索完整特徵設定。" -#: ../../library/unittest.rst:158 +#: ../../library/unittest.rst:155 +msgid "" +"The behavior of returning a value from a test method (other than the default " +"``None`` value), is now deprecated." +msgstr "" + +#: ../../library/unittest.rst:163 msgid "Command-Line Interface" msgstr "命令執行列介面 (Command-Line Interface)" -#: ../../library/unittest.rst:160 +#: ../../library/unittest.rst:165 msgid "" "The unittest module can be used from the command line to run tests from " "modules, classes or even individual test methods::" @@ -284,20 +290,20 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:167 +#: ../../library/unittest.rst:172 msgid "" "You can pass in a list with any combination of module names, and fully " "qualified class or method names." msgstr "你可以通過一個串列與任何模組名稱的組合,完全符合類別與方法的名稱。" -#: ../../library/unittest.rst:170 +#: ../../library/unittest.rst:175 msgid "Test modules can be specified by file path as well::" msgstr "" "測試模組可以根據檔案路徑指定:\n" "\n" "::" -#: ../../library/unittest.rst:174 +#: ../../library/unittest.rst:179 msgid "" "This allows you to use the shell filename completion to specify the test " "module. The file specified must still be importable as a module. The path is " @@ -310,7 +316,7 @@ msgstr "" "py' 並將路徑分隔符 (path separator) 轉換成 '.'。 假如你的測試檔案無法被 " "import 成模組,你應該直接執行該測試檔案。" -#: ../../library/unittest.rst:180 +#: ../../library/unittest.rst:185 msgid "" "You can run tests with more detail (higher verbosity) by passing in the -v " "flag::" @@ -319,7 +325,7 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:184 +#: ../../library/unittest.rst:189 msgid "" "When executed without arguments :ref:`unittest-test-discovery` is started::" msgstr "" @@ -327,28 +333,28 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:188 +#: ../../library/unittest.rst:193 msgid "For a list of all the command-line options::" msgstr "" "列出所有命令列選項:\n" "\n" "::" -#: ../../library/unittest.rst:192 +#: ../../library/unittest.rst:197 msgid "" "In earlier versions it was only possible to run individual test methods and " "not modules or classes." msgstr "在早期的版本可以個別執行測試方法和不需要模組或是類別。" -#: ../../library/unittest.rst:198 +#: ../../library/unittest.rst:203 msgid "Command-line options" msgstr "命令列模式選項" -#: ../../library/unittest.rst:200 +#: ../../library/unittest.rst:205 msgid ":program:`unittest` supports these command-line options:" msgstr ":program:`unittest` 支援以下命令列選項:" -#: ../../library/unittest.rst:206 +#: ../../library/unittest.rst:211 msgid "" "The standard output and standard error streams are buffered during the test " "run. Output during a passing test is discarded. Output is echoed normally on " @@ -358,7 +364,7 @@ msgstr "" "出在測試通過時被丟棄。若是測試錯誤或失則,這些輸出將會正常地被印出,並且被加" "入至錯誤訊息中。" -#: ../../library/unittest.rst:212 +#: ../../library/unittest.rst:217 msgid "" ":kbd:`Control-C` during the test run waits for the current test to end and " "then reports all the results so far. A second :kbd:`Control-C` raises the " @@ -367,85 +373,83 @@ msgstr "" ":kbd:`Control-C` 測試執行過程中等待正確的測試結果並回報目前為止所有的測試結" "果。第二個 :kbd:`Control-C` 拋出一般例外 :exc:`KeyboardInterrupt`\\ 。" -#: ../../library/unittest.rst:216 +#: ../../library/unittest.rst:221 msgid "" "See `Signal Handling`_ for the functions that provide this functionality." msgstr "參照 `Signal Handling`_ 針對函式提供的功能。" -#: ../../library/unittest.rst:220 +#: ../../library/unittest.rst:225 msgid "Stop the test run on the first error or failure." msgstr "在第一次錯誤或是失敗停止執行測試。" -#: ../../library/unittest.rst:224 +#: ../../library/unittest.rst:229 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 " "any of the given patterns are included." msgstr "" -#: ../../library/unittest.rst:228 +#: ../../library/unittest.rst:233 msgid "" "Patterns that contain a wildcard character (``*``) are matched against the " "test name using :meth:`fnmatch.fnmatchcase`; otherwise simple case-sensitive " "substring matching is used." msgstr "" -#: ../../library/unittest.rst:232 +#: ../../library/unittest.rst:237 msgid "" "Patterns are matched against the fully qualified test method name as " "imported by the test loader." msgstr "" -#: ../../library/unittest.rst:235 +#: ../../library/unittest.rst:240 msgid "" "For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``, " "``bar_tests.SomeTest.test_foo``, but not ``bar_tests.FooTest." "test_something``." msgstr "" -#: ../../library/unittest.rst:240 +#: ../../library/unittest.rst:245 msgid "Show local variables in tracebacks." msgstr "透過 traceback 顯示本地變數。" -#: ../../library/unittest.rst:242 +#: ../../library/unittest.rst:247 msgid "The command-line options ``-b``, ``-c`` and ``-f`` were added." msgstr "增加命令列模式選項 ``-b`` 、 ``-c`` 與 ``-f``\\ 。" -#: ../../library/unittest.rst:245 +#: ../../library/unittest.rst:250 msgid "The command-line option ``--locals``." msgstr "命令列選項 ``--locals``\\ 。" -#: ../../library/unittest.rst:248 +#: ../../library/unittest.rst:253 msgid "The command-line option ``-k``." msgstr "命令列選項 ``-k``\\ 。" -#: ../../library/unittest.rst:251 +#: ../../library/unittest.rst:256 msgid "" "The command line can also be used for test discovery, for running all of the " "tests in a project or just a subset." msgstr "" "對執行所有的專案或是一個子集合測試,命令列模式可以可以被用來做測試探索。" -#: ../../library/unittest.rst:258 +#: ../../library/unittest.rst:263 msgid "Test Discovery" msgstr "Test Discovery(測試探索)" -#: ../../library/unittest.rst:262 +#: ../../library/unittest.rst:267 msgid "" "Unittest supports simple test discovery. In order to be compatible with test " "discovery, all of the test files must be :ref:`modules ` or :" -"ref:`packages ` (including :term:`namespace packages " -"`) importable from the top-level directory of the project " -"(this means that their filenames must be valid :ref:`identifiers " +"ref:`packages ` importable from the top-level directory of the " +"project (this means that their filenames must be valid :ref:`identifiers " "`)." msgstr "" "單元測試支援簡單的 test discovery(測試探索)。為了相容於測試探索,所有的測試" -"檔案都要是\\ :ref:`模組 `\\ 或是\\ :ref:`套件 `\\ " -"(包含 :term:`namespace packages `\\ ),並能從專案的最上" -"層目錄中 import(代表它們的檔案名稱必須是有效的 :ref:`identifiers " -"`\\ )。" +"檔案都要是\\ :ref:`模組 `\\ 或是\\ :ref:`套件 `," +"並能從專案的最上層目錄中 import(代表它們的檔案名稱必須是有效的 :ref:" +"`identifiers `\\ )。" -#: ../../library/unittest.rst:269 +#: ../../library/unittest.rst:273 msgid "" "Test discovery is implemented in :meth:`TestLoader.discover`, but can also " "be used from the command line. The basic command-line usage is::" @@ -455,7 +459,7 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:277 +#: ../../library/unittest.rst:281 msgid "" "As a shortcut, ``python -m unittest`` is the equivalent of ``python -m " "unittest discover``. If you want to pass arguments to test discovery the " @@ -464,27 +468,27 @@ msgstr "" "``python -m unittest`` 作為捷徑,其功能相當於 ``python -m unittest discover``" "\\ 。假如你想傳遞引數至探索測試的話,一定要明確地加入 ``discover`` 子指令。" -#: ../../library/unittest.rst:281 +#: ../../library/unittest.rst:285 msgid "The ``discover`` sub-command has the following options:" msgstr "``discover`` 子指令有以下幾個選項:" -#: ../../library/unittest.rst:287 +#: ../../library/unittest.rst:291 msgid "Verbose output" msgstr "詳細(verbose)輸出" -#: ../../library/unittest.rst:291 +#: ../../library/unittest.rst:295 msgid "Directory to start discovery (``.`` default)" msgstr "開始尋找的資料夾(預設為 ``.``\\ )" -#: ../../library/unittest.rst:295 +#: ../../library/unittest.rst:299 msgid "Pattern to match test files (``test*.py`` default)" msgstr "匹配測試檔案的模式(預設為 ``test*.py``\\ )" -#: ../../library/unittest.rst:299 +#: ../../library/unittest.rst:303 msgid "Top level directory of project (defaults to start directory)" msgstr "專案的最高階層目錄 (defaults to start directory)" -#: ../../library/unittest.rst:301 +#: ../../library/unittest.rst:305 msgid "" "The :option:`-s`, :option:`-p`, and :option:`-t` options can be passed in as " "positional arguments in that order. The following two command lines are " @@ -495,7 +499,7 @@ msgstr "" "\n" "::" -#: ../../library/unittest.rst:308 +#: ../../library/unittest.rst:312 msgid "" "As well as being a path it is possible to pass a package name, for example " "``myproject.subpackage.test``, as the start directory. The package name you " @@ -503,7 +507,7 @@ msgid "" "as the start directory." msgstr "" -#: ../../library/unittest.rst:315 +#: ../../library/unittest.rst:319 msgid "" "Test discovery loads tests by importing them. Once test discovery has found " "all the test files from the start directory you specify it turns the paths " @@ -511,27 +515,27 @@ msgid "" "imported as ``foo.bar.baz``." msgstr "" -#: ../../library/unittest.rst:320 +#: ../../library/unittest.rst:324 msgid "" "If you have a package installed globally and attempt test discovery on a " "different copy of the package then the import *could* happen from the wrong " "place. If this happens test discovery will warn you and exit." msgstr "" -#: ../../library/unittest.rst:324 +#: ../../library/unittest.rst:328 msgid "" "If you supply the start directory as a package name rather than a path to a " "directory then discover assumes that whichever location it imports from is " "the location you intended, so you will not get the warning." msgstr "" -#: ../../library/unittest.rst:329 +#: ../../library/unittest.rst:333 msgid "" "Test modules and packages can customize test loading and discovery by " "through the `load_tests protocol`_." msgstr "" -#: ../../library/unittest.rst:332 +#: ../../library/unittest.rst:336 msgid "" "Test discovery supports :term:`namespace packages ` for " "the start directory. Note that you need to specify the top level directory " @@ -539,10 +543,25 @@ msgid "" msgstr "" #: ../../library/unittest.rst:342 +msgid "" +"Python 3.11 dropped the :term:`namespace packages ` " +"support. It has been broken since Python 3.7. Start directory and " +"subdirectories containing tests must be regular package that have ``__init__." +"py`` file." +msgstr "" + +#: ../../library/unittest.rst:348 +msgid "" +"Directories containing start directory still can be a namespace package. In " +"this case, you need to specify start directory as dotted package name, and " +"target directory explicitly. For example::" +msgstr "" + +#: ../../library/unittest.rst:364 msgid "Organizing test code" msgstr "" -#: ../../library/unittest.rst:344 +#: ../../library/unittest.rst:366 msgid "" "The basic building blocks of unit testing are :dfn:`test cases` --- single " "scenarios that must be set up and checked for correctness. In :mod:" @@ -551,21 +570,21 @@ msgid "" "`TestCase` or use :class:`FunctionTestCase`." msgstr "" -#: ../../library/unittest.rst:350 +#: ../../library/unittest.rst:372 msgid "" "The testing code of a :class:`TestCase` instance should be entirely self " "contained, such that it can be run either in isolation or in arbitrary " "combination with any number of other test cases." msgstr "" -#: ../../library/unittest.rst:354 +#: ../../library/unittest.rst:376 msgid "" "The simplest :class:`TestCase` subclass will simply implement a test method " "(i.e. a method whose name starts with ``test``) in order to perform specific " "testing code::" msgstr "" -#: ../../library/unittest.rst:365 +#: ../../library/unittest.rst:387 msgid "" "Note that in order to test something, we use one of the :meth:`assert\\*` " "methods provided by the :class:`TestCase` base class. If the test fails, an " @@ -574,7 +593,7 @@ msgid "" "be treated as :dfn:`errors`." msgstr "" -#: ../../library/unittest.rst:371 +#: ../../library/unittest.rst:393 msgid "" "Tests can be numerous, and their set-up can be repetitive. Luckily, we can " "factor out set-up code by implementing a method called :meth:`~TestCase." @@ -582,32 +601,32 @@ msgid "" "test we run::" msgstr "" -#: ../../library/unittest.rst:392 +#: ../../library/unittest.rst:414 msgid "" "The order in which the various tests will be run is determined by sorting " "the test method names with respect to the built-in ordering for strings." msgstr "" -#: ../../library/unittest.rst:396 +#: ../../library/unittest.rst:418 msgid "" "If the :meth:`~TestCase.setUp` method raises an exception while the test is " "running, the framework will consider the test to have suffered an error, and " "the test method will not be executed." msgstr "" -#: ../../library/unittest.rst:400 +#: ../../library/unittest.rst:422 msgid "" "Similarly, we can provide a :meth:`~TestCase.tearDown` method that tidies up " "after the test method has been run::" msgstr "" -#: ../../library/unittest.rst:412 +#: ../../library/unittest.rst:434 msgid "" "If :meth:`~TestCase.setUp` succeeded, :meth:`~TestCase.tearDown` will be run " "whether the test method succeeded or not." msgstr "" -#: ../../library/unittest.rst:415 +#: ../../library/unittest.rst:437 msgid "" "Such a working environment for the testing code is called a :dfn:`test " "fixture`. A new TestCase instance is created as a unique test fixture used " @@ -616,7 +635,7 @@ msgid "" "test." msgstr "" -#: ../../library/unittest.rst:421 +#: ../../library/unittest.rst:443 msgid "" "It is recommended that you use TestCase implementations to group tests " "together according to the features they test. :mod:`unittest` provides a " @@ -626,13 +645,13 @@ msgid "" "execute them." msgstr "" -#: ../../library/unittest.rst:428 +#: ../../library/unittest.rst:450 msgid "" "However, should you want to customize the building of your test suite, you " "can do it yourself::" msgstr "" -#: ../../library/unittest.rst:441 +#: ../../library/unittest.rst:463 msgid "" "You can place the definitions of test cases and test suites in the same " "modules as the code they are to test (such as :file:`widget.py`), but there " @@ -640,69 +659,69 @@ msgid "" "as :file:`test_widget.py`:" msgstr "" -#: ../../library/unittest.rst:446 +#: ../../library/unittest.rst:468 msgid "The test module can be run standalone from the command line." msgstr "" -#: ../../library/unittest.rst:448 +#: ../../library/unittest.rst:470 msgid "The test code can more easily be separated from shipped code." msgstr "" -#: ../../library/unittest.rst:450 +#: ../../library/unittest.rst:472 msgid "" "There is less temptation to change test code to fit the code it tests " "without a good reason." msgstr "" -#: ../../library/unittest.rst:453 +#: ../../library/unittest.rst:475 msgid "" "Test code should be modified much less frequently than the code it tests." msgstr "" -#: ../../library/unittest.rst:455 +#: ../../library/unittest.rst:477 msgid "Tested code can be refactored more easily." msgstr "" -#: ../../library/unittest.rst:457 +#: ../../library/unittest.rst:479 msgid "" "Tests for modules written in C must be in separate modules anyway, so why " "not be consistent?" msgstr "" -#: ../../library/unittest.rst:460 +#: ../../library/unittest.rst:482 msgid "" "If the testing strategy changes, there is no need to change the source code." msgstr "" -#: ../../library/unittest.rst:466 +#: ../../library/unittest.rst:488 msgid "Re-using old test code" msgstr "" -#: ../../library/unittest.rst:468 +#: ../../library/unittest.rst:490 msgid "" "Some users will find that they have existing test code that they would like " "to run from :mod:`unittest`, without converting every old test function to " "a :class:`TestCase` subclass." msgstr "" -#: ../../library/unittest.rst:472 +#: ../../library/unittest.rst:494 msgid "" "For this reason, :mod:`unittest` provides a :class:`FunctionTestCase` class. " "This subclass of :class:`TestCase` can be used to wrap an existing test " "function. Set-up and tear-down functions can also be provided." msgstr "" -#: ../../library/unittest.rst:476 +#: ../../library/unittest.rst:498 msgid "Given the following test function::" msgstr "" -#: ../../library/unittest.rst:483 +#: ../../library/unittest.rst:505 msgid "" "one can create an equivalent test case instance as follows, with optional " "set-up and tear-down methods::" msgstr "" -#: ../../library/unittest.rst:492 +#: ../../library/unittest.rst:514 msgid "" "Even though :class:`FunctionTestCase` can be used to quickly convert an " "existing test base over to a :mod:`unittest`\\ -based system, this approach " @@ -710,7 +729,7 @@ msgid "" "subclasses will make future test refactorings infinitely easier." msgstr "" -#: ../../library/unittest.rst:497 +#: ../../library/unittest.rst:519 msgid "" "In some cases, the existing tests may have been written using the :mod:" "`doctest` module. If so, :mod:`doctest` provides a :class:`DocTestSuite` " @@ -718,11 +737,11 @@ msgid "" "from the existing :mod:`doctest`\\ -based tests." msgstr "" -#: ../../library/unittest.rst:506 +#: ../../library/unittest.rst:528 msgid "Skipping tests and expected failures" msgstr "" -#: ../../library/unittest.rst:510 +#: ../../library/unittest.rst:532 msgid "" "Unittest supports skipping individual test methods and even whole classes of " "tests. In addition, it supports marking a test as an \"expected failure,\" " @@ -730,7 +749,7 @@ msgid "" "on a :class:`TestResult`." msgstr "" -#: ../../library/unittest.rst:515 +#: ../../library/unittest.rst:537 msgid "" "Skipping a test is simply a matter of using the :func:`skip` :term:" "`decorator` or one of its conditional variants, calling :meth:`TestCase." @@ -738,56 +757,56 @@ msgid "" "`SkipTest` directly." msgstr "" -#: ../../library/unittest.rst:519 +#: ../../library/unittest.rst:541 msgid "Basic skipping looks like this::" msgstr "" -#: ../../library/unittest.rst:544 +#: ../../library/unittest.rst:566 msgid "This is the output of running the example above in verbose mode::" msgstr "" -#: ../../library/unittest.rst:556 +#: ../../library/unittest.rst:578 msgid "Classes can be skipped just like methods::" msgstr "" -#: ../../library/unittest.rst:563 +#: ../../library/unittest.rst:585 msgid "" ":meth:`TestCase.setUp` can also skip the test. This is useful when a " "resource that needs to be set up is not available." msgstr "" -#: ../../library/unittest.rst:566 +#: ../../library/unittest.rst:588 msgid "Expected failures use the :func:`expectedFailure` decorator. ::" msgstr "" -#: ../../library/unittest.rst:573 +#: ../../library/unittest.rst:595 msgid "" "It's easy to roll your own skipping decorators by making a decorator that " "calls :func:`skip` on the test when it wants it to be skipped. This " "decorator skips the test unless the passed object has a certain attribute::" msgstr "" -#: ../../library/unittest.rst:582 +#: ../../library/unittest.rst:604 msgid "" "The following decorators and exception implement test skipping and expected " "failures:" msgstr "" -#: ../../library/unittest.rst:586 +#: ../../library/unittest.rst:608 msgid "" "Unconditionally skip the decorated test. *reason* should describe why the " "test is being skipped." msgstr "" -#: ../../library/unittest.rst:591 +#: ../../library/unittest.rst:613 msgid "Skip the decorated test if *condition* is true." msgstr "" -#: ../../library/unittest.rst:595 +#: ../../library/unittest.rst:617 msgid "Skip the decorated test unless *condition* is true." msgstr "" -#: ../../library/unittest.rst:599 +#: ../../library/unittest.rst:621 msgid "" "Mark the test as an expected failure or error. If the test fails or errors " "in the test function itself (rather than in one of the :dfn:`test fixture` " @@ -795,17 +814,17 @@ msgid "" "be considered a failure." msgstr "" -#: ../../library/unittest.rst:606 +#: ../../library/unittest.rst:628 msgid "This exception is raised to skip a test." msgstr "" -#: ../../library/unittest.rst:608 +#: ../../library/unittest.rst:630 msgid "" "Usually you can use :meth:`TestCase.skipTest` or one of the skipping " "decorators instead of raising this directly." msgstr "" -#: ../../library/unittest.rst:611 +#: ../../library/unittest.rst:633 msgid "" "Skipped tests will not have :meth:`~TestCase.setUp` or :meth:`~TestCase." "tearDown` run around them. Skipped classes will not have :meth:`~TestCase." @@ -813,51 +832,51 @@ msgid "" "have :func:`setUpModule` or :func:`tearDownModule` run." msgstr "" -#: ../../library/unittest.rst:619 +#: ../../library/unittest.rst:641 msgid "Distinguishing test iterations using subtests" msgstr "" -#: ../../library/unittest.rst:623 +#: ../../library/unittest.rst:645 msgid "" "When there are very small differences among your tests, for instance some " "parameters, unittest allows you to distinguish them inside the body of a " "test method using the :meth:`~TestCase.subTest` context manager." msgstr "" -#: ../../library/unittest.rst:627 +#: ../../library/unittest.rst:649 msgid "For example, the following test::" msgstr "" "舉例來說,以下測試:\n" "\n" "::" -#: ../../library/unittest.rst:639 +#: ../../library/unittest.rst:661 msgid "will produce the following output::" msgstr "" "會有以下輸出:\n" "\n" "::" -#: ../../library/unittest.rst:665 +#: ../../library/unittest.rst:693 msgid "" "Without using a subtest, execution would stop after the first failure, and " "the error would be less easy to diagnose because the value of ``i`` wouldn't " "be displayed::" msgstr "" -#: ../../library/unittest.rst:681 +#: ../../library/unittest.rst:709 msgid "Classes and functions" msgstr "" -#: ../../library/unittest.rst:683 +#: ../../library/unittest.rst:711 msgid "This section describes in depth the API of :mod:`unittest`." msgstr "" -#: ../../library/unittest.rst:689 +#: ../../library/unittest.rst:717 msgid "Test cases" msgstr "" -#: ../../library/unittest.rst:693 +#: ../../library/unittest.rst:721 msgid "" "Instances of the :class:`TestCase` class represent the logical test units in " "the :mod:`unittest` universe. This class is intended to be used as a base " @@ -867,21 +886,21 @@ msgid "" "report various kinds of failure." msgstr "" -#: ../../library/unittest.rst:700 +#: ../../library/unittest.rst:728 msgid "" "Each instance of :class:`TestCase` will run a single base method: the method " "named *methodName*. In most uses of :class:`TestCase`, you will neither " "change the *methodName* nor reimplement the default ``runTest()`` method." msgstr "" -#: ../../library/unittest.rst:705 +#: ../../library/unittest.rst:733 msgid "" ":class:`TestCase` can be instantiated successfully without providing a " "*methodName*. This makes it easier to experiment with :class:`TestCase` from " "the interactive interpreter." msgstr "" -#: ../../library/unittest.rst:710 +#: ../../library/unittest.rst:738 msgid "" ":class:`TestCase` instances provide three groups of methods: one group used " "to run the test, another used by the test implementation to check conditions " @@ -889,11 +908,11 @@ msgid "" "test itself to be gathered." msgstr "" -#: ../../library/unittest.rst:715 +#: ../../library/unittest.rst:743 msgid "Methods in the first group (running the test) are:" msgstr "" -#: ../../library/unittest.rst:719 +#: ../../library/unittest.rst:747 msgid "" "Method called to prepare the test fixture. This is called immediately " "before calling the test method; other than :exc:`AssertionError` or :exc:" @@ -901,7 +920,7 @@ msgid "" "rather than a test failure. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:727 +#: ../../library/unittest.rst:755 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called even if the test method raised an " @@ -914,25 +933,25 @@ msgid "" "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:740 +#: ../../library/unittest.rst:768 msgid "" "A class method called before tests in an individual class are run. " "``setUpClass`` is called with the class as the only argument and must be " "decorated as a :func:`classmethod`::" msgstr "" -#: ../../library/unittest.rst:748 ../../library/unittest.rst:763 +#: ../../library/unittest.rst:776 ../../library/unittest.rst:791 msgid "See `Class and Module Fixtures`_ for more details." msgstr "更多細節請見 `Class and Module Fixtures`_\\ 。" -#: ../../library/unittest.rst:755 +#: ../../library/unittest.rst:783 msgid "" "A class method called after tests in an individual class have run. " "``tearDownClass`` is called with the class as the only argument and must be " "decorated as a :meth:`classmethod`::" msgstr "" -#: ../../library/unittest.rst:770 +#: ../../library/unittest.rst:798 msgid "" "Run the test, collecting the result into the :class:`TestResult` object " "passed as *result*. If *result* is omitted or ``None``, a temporary result " @@ -940,184 +959,184 @@ msgid "" "used. The result object is returned to :meth:`run`'s caller." msgstr "" -#: ../../library/unittest.rst:776 +#: ../../library/unittest.rst:804 msgid "" "The same effect may be had by simply calling the :class:`TestCase` instance." msgstr "" -#: ../../library/unittest.rst:779 +#: ../../library/unittest.rst:807 msgid "" "Previous versions of ``run`` did not return the result. Neither did calling " "an instance." msgstr "" -#: ../../library/unittest.rst:785 +#: ../../library/unittest.rst:813 msgid "" "Calling this during a test method or :meth:`setUp` skips the current test. " "See :ref:`unittest-skipping` for more information." msgstr "" -#: ../../library/unittest.rst:793 +#: ../../library/unittest.rst:821 msgid "" "Return a context manager which executes the enclosed code block as a " "subtest. *msg* and *params* are optional, arbitrary values which are " "displayed whenever a subtest fails, allowing you to identify them clearly." msgstr "" -#: ../../library/unittest.rst:798 +#: ../../library/unittest.rst:826 msgid "" "A test case can contain any number of subtest declarations, and they can be " "arbitrarily nested." msgstr "" -#: ../../library/unittest.rst:801 +#: ../../library/unittest.rst:829 msgid "See :ref:`subtests` for more information." msgstr "更多資訊請見 :ref:`subtests`\\ 。" -#: ../../library/unittest.rst:808 +#: ../../library/unittest.rst:836 msgid "" "Run the test without collecting the result. This allows exceptions raised " "by the test to be propagated to the caller, and can be used to support " "running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:814 +#: ../../library/unittest.rst:842 msgid "" "The :class:`TestCase` class provides several assert methods to check for and " "report failures. The following table lists the most commonly used methods " "(see the tables below for more assert methods):" msgstr "" -#: ../../library/unittest.rst:819 ../../library/unittest.rst:940 -#: ../../library/unittest.rst:1154 ../../library/unittest.rst:1281 +#: ../../library/unittest.rst:847 ../../library/unittest.rst:968 +#: ../../library/unittest.rst:1182 ../../library/unittest.rst:1309 msgid "Method" msgstr "" -#: ../../library/unittest.rst:819 ../../library/unittest.rst:940 -#: ../../library/unittest.rst:1154 +#: ../../library/unittest.rst:847 ../../library/unittest.rst:968 +#: ../../library/unittest.rst:1182 msgid "Checks that" msgstr "" -#: ../../library/unittest.rst:819 ../../library/unittest.rst:940 -#: ../../library/unittest.rst:1154 ../../library/unittest.rst:1281 +#: ../../library/unittest.rst:847 ../../library/unittest.rst:968 +#: ../../library/unittest.rst:1182 ../../library/unittest.rst:1309 msgid "New in" msgstr "" -#: ../../library/unittest.rst:821 +#: ../../library/unittest.rst:849 msgid ":meth:`assertEqual(a, b) `" msgstr ":meth:`assertEqual(a, b) `" -#: ../../library/unittest.rst:821 +#: ../../library/unittest.rst:849 msgid "``a == b``" msgstr "``a == b``" -#: ../../library/unittest.rst:824 +#: ../../library/unittest.rst:852 msgid ":meth:`assertNotEqual(a, b) `" msgstr ":meth:`assertNotEqual(a, b) `" -#: ../../library/unittest.rst:824 +#: ../../library/unittest.rst:852 msgid "``a != b``" msgstr "``a != b``" -#: ../../library/unittest.rst:827 +#: ../../library/unittest.rst:855 msgid ":meth:`assertTrue(x) `" msgstr ":meth:`assertTrue(x) `" -#: ../../library/unittest.rst:827 +#: ../../library/unittest.rst:855 msgid "``bool(x) is True``" msgstr "``bool(x) is True``" -#: ../../library/unittest.rst:830 +#: ../../library/unittest.rst:858 msgid ":meth:`assertFalse(x) `" msgstr ":meth:`assertFalse(x) `" -#: ../../library/unittest.rst:830 +#: ../../library/unittest.rst:858 msgid "``bool(x) is False``" msgstr "``bool(x) is False``" -#: ../../library/unittest.rst:833 +#: ../../library/unittest.rst:861 msgid ":meth:`assertIs(a, b) `" msgstr ":meth:`assertIs(a, b) `" -#: ../../library/unittest.rst:833 +#: ../../library/unittest.rst:861 msgid "``a is b``" msgstr "``a is b``" -#: ../../library/unittest.rst:833 ../../library/unittest.rst:836 -#: ../../library/unittest.rst:839 ../../library/unittest.rst:842 -#: ../../library/unittest.rst:845 ../../library/unittest.rst:848 -#: ../../library/unittest.rst:945 ../../library/unittest.rst:1162 -#: ../../library/unittest.rst:1165 ../../library/unittest.rst:1168 -#: ../../library/unittest.rst:1171 ../../library/unittest.rst:1174 -#: ../../library/unittest.rst:1283 ../../library/unittest.rst:1286 -#: ../../library/unittest.rst:1289 ../../library/unittest.rst:1292 -#: ../../library/unittest.rst:1295 ../../library/unittest.rst:1298 +#: ../../library/unittest.rst:861 ../../library/unittest.rst:864 +#: ../../library/unittest.rst:867 ../../library/unittest.rst:870 +#: ../../library/unittest.rst:873 ../../library/unittest.rst:876 +#: ../../library/unittest.rst:973 ../../library/unittest.rst:1190 +#: ../../library/unittest.rst:1193 ../../library/unittest.rst:1196 +#: ../../library/unittest.rst:1199 ../../library/unittest.rst:1202 +#: ../../library/unittest.rst:1311 ../../library/unittest.rst:1314 +#: ../../library/unittest.rst:1317 ../../library/unittest.rst:1320 +#: ../../library/unittest.rst:1323 ../../library/unittest.rst:1326 msgid "3.1" msgstr "3.1" -#: ../../library/unittest.rst:836 +#: ../../library/unittest.rst:864 msgid ":meth:`assertIsNot(a, b) `" msgstr ":meth:`assertIsNot(a, b) `" -#: ../../library/unittest.rst:836 +#: ../../library/unittest.rst:864 msgid "``a is not b``" msgstr "``a is not b``" -#: ../../library/unittest.rst:839 +#: ../../library/unittest.rst:867 msgid ":meth:`assertIsNone(x) `" msgstr ":meth:`assertIsNone(x) `" -#: ../../library/unittest.rst:839 +#: ../../library/unittest.rst:867 msgid "``x is None``" msgstr "``x is None``" -#: ../../library/unittest.rst:842 +#: ../../library/unittest.rst:870 msgid ":meth:`assertIsNotNone(x) `" msgstr ":meth:`assertIsNotNone(x) `" -#: ../../library/unittest.rst:842 +#: ../../library/unittest.rst:870 msgid "``x is not None``" msgstr "``x is not None``" -#: ../../library/unittest.rst:845 +#: ../../library/unittest.rst:873 msgid ":meth:`assertIn(a, b) `" msgstr ":meth:`assertIn(a, b) `" -#: ../../library/unittest.rst:845 +#: ../../library/unittest.rst:873 msgid "``a in b``" msgstr "``a in b``" -#: ../../library/unittest.rst:848 +#: ../../library/unittest.rst:876 msgid ":meth:`assertNotIn(a, b) `" msgstr ":meth:`assertNotIn(a, b) `" -#: ../../library/unittest.rst:848 +#: ../../library/unittest.rst:876 msgid "``a not in b``" msgstr "``a not in b``" -#: ../../library/unittest.rst:851 +#: ../../library/unittest.rst:879 msgid ":meth:`assertIsInstance(a, b) `" msgstr ":meth:`assertIsInstance(a, b) `" -#: ../../library/unittest.rst:851 +#: ../../library/unittest.rst:879 msgid "``isinstance(a, b)``" msgstr "``isinstance(a, b)``" -#: ../../library/unittest.rst:851 ../../library/unittest.rst:854 -#: ../../library/unittest.rst:948 ../../library/unittest.rst:951 -#: ../../library/unittest.rst:1177 ../../library/unittest.rst:1180 +#: ../../library/unittest.rst:879 ../../library/unittest.rst:882 +#: ../../library/unittest.rst:976 ../../library/unittest.rst:979 +#: ../../library/unittest.rst:1205 ../../library/unittest.rst:1208 msgid "3.2" msgstr "3.2" -#: ../../library/unittest.rst:854 +#: ../../library/unittest.rst:882 msgid ":meth:`assertNotIsInstance(a, b) `" msgstr ":meth:`assertNotIsInstance(a, b) `" -#: ../../library/unittest.rst:854 +#: ../../library/unittest.rst:882 msgid "``not isinstance(a, b)``" msgstr "``not isinstance(a, b)``" -#: ../../library/unittest.rst:858 +#: ../../library/unittest.rst:886 msgid "" "All the assert methods accept a *msg* argument that, if specified, is used " "as the error message on failure (see also :data:`longMessage`). Note that " @@ -1126,13 +1145,13 @@ msgid "" "they are used as a context manager." msgstr "" -#: ../../library/unittest.rst:866 +#: ../../library/unittest.rst:894 msgid "" "Test that *first* and *second* are equal. If the values do not compare " "equal, the test will fail." msgstr "" -#: ../../library/unittest.rst:869 +#: ../../library/unittest.rst:897 msgid "" "In addition, if *first* and *second* are the exact same type and one of " "list, tuple, dict, set, frozenset or str or any type that a subclass " @@ -1142,27 +1161,27 @@ msgid "" "methods>`)." msgstr "" -#: ../../library/unittest.rst:876 +#: ../../library/unittest.rst:904 msgid "Added the automatic calling of type-specific equality function." msgstr "" -#: ../../library/unittest.rst:879 +#: ../../library/unittest.rst:907 msgid "" ":meth:`assertMultiLineEqual` added as the default type equality function for " "comparing strings." msgstr "" -#: ../../library/unittest.rst:886 +#: ../../library/unittest.rst:914 msgid "" "Test that *first* and *second* are not equal. If the values do compare " "equal, the test will fail." msgstr "" -#: ../../library/unittest.rst:892 +#: ../../library/unittest.rst:920 msgid "Test that *expr* is true (or false)." msgstr "" -#: ../../library/unittest.rst:894 +#: ../../library/unittest.rst:922 msgid "" "Note that this is equivalent to ``bool(expr) is True`` and not to ``expr is " "True`` (use ``assertIs(expr, True)`` for the latter). This method should " @@ -1171,96 +1190,96 @@ msgid "" "provide a better error message in case of failure." msgstr "" -#: ../../library/unittest.rst:904 +#: ../../library/unittest.rst:932 msgid "Test that *first* and *second* are (or are not) the same object." msgstr "" -#: ../../library/unittest.rst:912 +#: ../../library/unittest.rst:940 msgid "Test that *expr* is (or is not) ``None``." msgstr "" -#: ../../library/unittest.rst:920 +#: ../../library/unittest.rst:948 msgid "Test that *member* is (or is not) in *container*." msgstr "" -#: ../../library/unittest.rst:928 +#: ../../library/unittest.rst:956 msgid "" "Test that *obj* is (or is not) an instance of *cls* (which can be a class or " "a tuple of classes, as supported by :func:`isinstance`). To check for the " "exact type, use :func:`assertIs(type(obj), cls) `." msgstr "" -#: ../../library/unittest.rst:936 +#: ../../library/unittest.rst:964 msgid "" "It is also possible to check the production of exceptions, warnings, and log " "messages using the following methods:" msgstr "" -#: ../../library/unittest.rst:942 +#: ../../library/unittest.rst:970 msgid ":meth:`assertRaises(exc, fun, *args, **kwds) `" msgstr ":meth:`assertRaises(exc, fun, *args, **kwds) `" -#: ../../library/unittest.rst:942 +#: ../../library/unittest.rst:970 msgid "``fun(*args, **kwds)`` raises *exc*" msgstr "" -#: ../../library/unittest.rst:945 +#: ../../library/unittest.rst:973 msgid "" ":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" msgstr "" -#: ../../library/unittest.rst:945 +#: ../../library/unittest.rst:973 msgid "``fun(*args, **kwds)`` raises *exc* and the message matches regex *r*" msgstr "" -#: ../../library/unittest.rst:948 +#: ../../library/unittest.rst:976 msgid ":meth:`assertWarns(warn, fun, *args, **kwds) `" msgstr ":meth:`assertWarns(warn, fun, *args, **kwds) `" -#: ../../library/unittest.rst:948 +#: ../../library/unittest.rst:976 msgid "``fun(*args, **kwds)`` raises *warn*" msgstr "" -#: ../../library/unittest.rst:951 +#: ../../library/unittest.rst:979 msgid "" ":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) `" msgstr "" -#: ../../library/unittest.rst:951 +#: ../../library/unittest.rst:979 msgid "``fun(*args, **kwds)`` raises *warn* and the message matches regex *r*" msgstr "" -#: ../../library/unittest.rst:954 +#: ../../library/unittest.rst:982 msgid ":meth:`assertLogs(logger, level) `" msgstr ":meth:`assertLogs(logger, level) `" -#: ../../library/unittest.rst:954 +#: ../../library/unittest.rst:982 msgid "The ``with`` block logs on *logger* with minimum *level*" msgstr "" -#: ../../library/unittest.rst:954 +#: ../../library/unittest.rst:982 msgid "3.4" msgstr "3.4" -#: ../../library/unittest.rst:957 +#: ../../library/unittest.rst:985 msgid ":meth:`assertNoLogs(logger, level) `" msgstr ":meth:`assertNoLogs(logger, level) `" -#: ../../library/unittest.rst:957 +#: ../../library/unittest.rst:985 msgid "The ``with`` block does not log on" msgstr "" -#: ../../library/unittest.rst:958 +#: ../../library/unittest.rst:986 msgid "*logger* with minimum *level*" msgstr "" -#: ../../library/unittest.rst:957 +#: ../../library/unittest.rst:985 msgid "3.10" msgstr "3.10" -#: ../../library/unittest.rst:964 +#: ../../library/unittest.rst:992 msgid "" "Test that an exception is raised when *callable* is called with any " "positional or keyword arguments that are also passed to :meth:" @@ -1270,40 +1289,40 @@ msgid "" "be passed as *exception*." msgstr "" -#: ../../library/unittest.rst:971 +#: ../../library/unittest.rst:999 msgid "" "If only the *exception* and possibly the *msg* arguments are given, return a " "context manager so that the code under test can be written inline rather " "than as a function::" msgstr "" -#: ../../library/unittest.rst:978 +#: ../../library/unittest.rst:1006 msgid "" "When used as a context manager, :meth:`assertRaises` accepts the additional " "keyword argument *msg*." msgstr "" -#: ../../library/unittest.rst:981 +#: ../../library/unittest.rst:1009 msgid "" "The context manager will store the caught exception object in its :attr:" "`exception` attribute. This can be useful if the intention is to perform " "additional checks on the exception raised::" msgstr "" -#: ../../library/unittest.rst:991 +#: ../../library/unittest.rst:1019 msgid "Added the ability to use :meth:`assertRaises` as a context manager." msgstr "" -#: ../../library/unittest.rst:994 +#: ../../library/unittest.rst:1022 msgid "Added the :attr:`exception` attribute." msgstr "新增 :attr:`exception` 屬性。" -#: ../../library/unittest.rst:997 ../../library/unittest.rst:1023 -#: ../../library/unittest.rst:1064 ../../library/unittest.rst:1087 +#: ../../library/unittest.rst:1025 ../../library/unittest.rst:1051 +#: ../../library/unittest.rst:1092 ../../library/unittest.rst:1115 msgid "Added the *msg* keyword argument when used as a context manager." msgstr "" -#: ../../library/unittest.rst:1004 +#: ../../library/unittest.rst:1032 msgid "" "Like :meth:`assertRaises` but also tests that *regex* matches on the string " "representation of the raised exception. *regex* may be a regular expression " @@ -1311,22 +1330,22 @@ msgid "" "`re.search`. Examples::" msgstr "" -#: ../../library/unittest.rst:1012 ../../library/unittest.rst:1080 +#: ../../library/unittest.rst:1040 ../../library/unittest.rst:1108 msgid "or::" msgstr "" "或是:\n" "\n" "::" -#: ../../library/unittest.rst:1017 +#: ../../library/unittest.rst:1045 msgid "Added under the name ``assertRaisesRegexp``." msgstr "" -#: ../../library/unittest.rst:1020 +#: ../../library/unittest.rst:1048 msgid "Renamed to :meth:`assertRaisesRegex`." msgstr "重新命名為 :meth:`assertRaisesRegex`\\ 。" -#: ../../library/unittest.rst:1030 +#: ../../library/unittest.rst:1058 msgid "" "Test that a warning is triggered when *callable* is called with any " "positional or keyword arguments that are also passed to :meth:" @@ -1335,20 +1354,20 @@ msgid "" "tuple containing the warning classes may be passed as *warnings*." msgstr "" -#: ../../library/unittest.rst:1037 +#: ../../library/unittest.rst:1065 msgid "" "If only the *warning* and possibly the *msg* arguments are given, return a " "context manager so that the code under test can be written inline rather " "than as a function::" msgstr "" -#: ../../library/unittest.rst:1044 +#: ../../library/unittest.rst:1072 msgid "" "When used as a context manager, :meth:`assertWarns` accepts the additional " "keyword argument *msg*." msgstr "" -#: ../../library/unittest.rst:1047 +#: ../../library/unittest.rst:1075 msgid "" "The context manager will store the caught warning object in its :attr:" "`warning` attribute, and the source line which triggered the warnings in " @@ -1356,13 +1375,13 @@ msgid "" "the intention is to perform additional checks on the warning caught::" msgstr "" -#: ../../library/unittest.rst:1059 +#: ../../library/unittest.rst:1087 msgid "" "This method works regardless of the warning filters in place when it is " "called." msgstr "" -#: ../../library/unittest.rst:1071 +#: ../../library/unittest.rst:1099 msgid "" "Like :meth:`assertWarns` but also tests that *regex* matches on the message " "of the triggered warning. *regex* may be a regular expression object or a " @@ -1370,13 +1389,13 @@ msgid "" "search`. Example::" msgstr "" -#: ../../library/unittest.rst:1092 +#: ../../library/unittest.rst:1120 msgid "" "A context manager to test that at least one message is logged on the " "*logger* or one of its children, with at least the given *level*." msgstr "" -#: ../../library/unittest.rst:1096 +#: ../../library/unittest.rst:1124 msgid "" "If given, *logger* should be a :class:`logging.Logger` object or a :class:" "`str` giving the name of a logger. The default is the root logger, which " @@ -1384,141 +1403,141 @@ msgid "" "descendent logger." msgstr "" -#: ../../library/unittest.rst:1101 ../../library/unittest.rst:1142 +#: ../../library/unittest.rst:1129 ../../library/unittest.rst:1170 msgid "" "If given, *level* should be either a numeric logging level or its string " "equivalent (for example either ``\"ERROR\"`` or :attr:`logging.ERROR`). The " "default is :attr:`logging.INFO`." msgstr "" -#: ../../library/unittest.rst:1105 +#: ../../library/unittest.rst:1133 msgid "" "The test passes if at least one message emitted inside the ``with`` block " "matches the *logger* and *level* conditions, otherwise it fails." msgstr "" -#: ../../library/unittest.rst:1108 +#: ../../library/unittest.rst:1136 msgid "" "The object returned by the context manager is a recording helper which keeps " "tracks of the matching log messages. It has two attributes:" msgstr "" -#: ../../library/unittest.rst:1114 +#: ../../library/unittest.rst:1142 msgid "" "A list of :class:`logging.LogRecord` objects of the matching log messages." msgstr "" -#: ../../library/unittest.rst:1119 +#: ../../library/unittest.rst:1147 msgid "" "A list of :class:`str` objects with the formatted output of matching " "messages." msgstr "" -#: ../../library/unittest.rst:1122 +#: ../../library/unittest.rst:1150 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/unittest.rst:1134 +#: ../../library/unittest.rst:1162 msgid "" "A context manager to test that no messages are logged on the *logger* or one " "of its children, with at least the given *level*." msgstr "" -#: ../../library/unittest.rst:1138 +#: ../../library/unittest.rst:1166 msgid "" "If given, *logger* should be a :class:`logging.Logger` object or a :class:" "`str` giving the name of a logger. The default is the root logger, which " "will catch all messages." msgstr "" -#: ../../library/unittest.rst:1146 +#: ../../library/unittest.rst:1174 msgid "" "Unlike :meth:`assertLogs`, nothing will be returned by the context manager." msgstr "" -#: ../../library/unittest.rst:1151 +#: ../../library/unittest.rst:1179 msgid "" "There are also other methods used to perform more specific checks, such as:" msgstr "" -#: ../../library/unittest.rst:1156 +#: ../../library/unittest.rst:1184 msgid ":meth:`assertAlmostEqual(a, b) `" msgstr ":meth:`assertAlmostEqual(a, b) `" -#: ../../library/unittest.rst:1156 +#: ../../library/unittest.rst:1184 msgid "``round(a-b, 7) == 0``" msgstr "``round(a-b, 7) == 0``" -#: ../../library/unittest.rst:1159 +#: ../../library/unittest.rst:1187 msgid ":meth:`assertNotAlmostEqual(a, b) `" msgstr ":meth:`assertNotAlmostEqual(a, b) `" -#: ../../library/unittest.rst:1159 +#: ../../library/unittest.rst:1187 msgid "``round(a-b, 7) != 0``" msgstr "``round(a-b, 7) != 0``" -#: ../../library/unittest.rst:1162 +#: ../../library/unittest.rst:1190 msgid ":meth:`assertGreater(a, b) `" msgstr ":meth:`assertGreater(a, b) `" -#: ../../library/unittest.rst:1162 +#: ../../library/unittest.rst:1190 msgid "``a > b``" msgstr "``a > b``" -#: ../../library/unittest.rst:1165 +#: ../../library/unittest.rst:1193 msgid ":meth:`assertGreaterEqual(a, b) `" msgstr ":meth:`assertGreaterEqual(a, b) `" -#: ../../library/unittest.rst:1165 +#: ../../library/unittest.rst:1193 msgid "``a >= b``" msgstr "``a >= b``" -#: ../../library/unittest.rst:1168 +#: ../../library/unittest.rst:1196 msgid ":meth:`assertLess(a, b) `" msgstr ":meth:`assertLess(a, b) `" -#: ../../library/unittest.rst:1168 +#: ../../library/unittest.rst:1196 msgid "``a < b``" msgstr "``a < b``" -#: ../../library/unittest.rst:1171 +#: ../../library/unittest.rst:1199 msgid ":meth:`assertLessEqual(a, b) `" msgstr ":meth:`assertLessEqual(a, b) `" -#: ../../library/unittest.rst:1171 +#: ../../library/unittest.rst:1199 msgid "``a <= b``" msgstr "``a <= b``" -#: ../../library/unittest.rst:1174 +#: ../../library/unittest.rst:1202 msgid ":meth:`assertRegex(s, r) `" msgstr ":meth:`assertRegex(s, r) `" -#: ../../library/unittest.rst:1174 +#: ../../library/unittest.rst:1202 msgid "``r.search(s)``" msgstr "``r.search(s)``" -#: ../../library/unittest.rst:1177 +#: ../../library/unittest.rst:1205 msgid ":meth:`assertNotRegex(s, r) `" msgstr ":meth:`assertNotRegex(s, r) `" -#: ../../library/unittest.rst:1177 +#: ../../library/unittest.rst:1205 msgid "``not r.search(s)``" msgstr "``not r.search(s)``" -#: ../../library/unittest.rst:1180 +#: ../../library/unittest.rst:1208 msgid ":meth:`assertCountEqual(a, b) `" msgstr ":meth:`assertCountEqual(a, b) `" -#: ../../library/unittest.rst:1180 +#: ../../library/unittest.rst:1208 msgid "" "*a* and *b* have the same elements in the same number, regardless of their " "order." msgstr "" -#: ../../library/unittest.rst:1189 +#: ../../library/unittest.rst:1217 msgid "" "Test that *first* and *second* are approximately (or not approximately) " "equal by computing the difference, rounding to the given number of decimal " @@ -1527,30 +1546,30 @@ msgid "" "`round` function) and not *significant digits*." msgstr "" -#: ../../library/unittest.rst:1195 +#: ../../library/unittest.rst:1223 msgid "" "If *delta* is supplied instead of *places* then the difference between " "*first* and *second* must be less or equal to (or greater than) *delta*." msgstr "" -#: ../../library/unittest.rst:1198 +#: ../../library/unittest.rst:1226 msgid "Supplying both *delta* and *places* raises a :exc:`TypeError`." msgstr "" -#: ../../library/unittest.rst:1200 +#: ../../library/unittest.rst:1228 msgid "" ":meth:`assertAlmostEqual` automatically considers almost equal objects that " "compare equal. :meth:`assertNotAlmostEqual` automatically fails if the " "objects compare equal. Added the *delta* keyword argument." msgstr "" -#: ../../library/unittest.rst:1211 +#: ../../library/unittest.rst:1239 msgid "" "Test that *first* is respectively >, >=, < or <= than *second* depending on " "the method name. If not, the test will fail::" msgstr "" -#: ../../library/unittest.rst:1223 +#: ../../library/unittest.rst:1251 msgid "" "Test that a *regex* search matches (or does not match) *text*. In case of " "failure, the error message will include the pattern and the *text* (or the " @@ -1559,34 +1578,34 @@ msgid "" "suitable for use by :func:`re.search`." msgstr "" -#: ../../library/unittest.rst:1229 +#: ../../library/unittest.rst:1257 msgid "Added under the name ``assertRegexpMatches``." msgstr "" -#: ../../library/unittest.rst:1231 +#: ../../library/unittest.rst:1259 msgid "" "The method ``assertRegexpMatches()`` has been renamed to :meth:`." "assertRegex`." msgstr "" -#: ../../library/unittest.rst:1234 +#: ../../library/unittest.rst:1262 msgid ":meth:`.assertNotRegex`." msgstr ":meth:`.assertNotRegex`\\ 。" -#: ../../library/unittest.rst:1236 +#: ../../library/unittest.rst:1264 msgid "" "The name ``assertNotRegexpMatches`` is a deprecated alias for :meth:`." "assertNotRegex`." msgstr "" -#: ../../library/unittest.rst:1243 +#: ../../library/unittest.rst:1271 msgid "" "Test that sequence *first* contains the same elements as *second*, " "regardless of their order. When they don't, an error message listing the " "differences between the sequences will be generated." msgstr "" -#: ../../library/unittest.rst:1247 +#: ../../library/unittest.rst:1275 msgid "" "Duplicate elements are *not* ignored when comparing *first* and *second*. It " "verifies whether each element has the same count in both sequences. " @@ -1594,7 +1613,7 @@ msgid "" "but works with sequences of unhashable objects as well." msgstr "" -#: ../../library/unittest.rst:1258 +#: ../../library/unittest.rst:1286 msgid "" "The :meth:`assertEqual` method dispatches the equality check for objects of " "the same type to different type-specific methods. These methods are already " @@ -1602,7 +1621,7 @@ msgid "" "register new methods using :meth:`addTypeEqualityFunc`:" msgstr "" -#: ../../library/unittest.rst:1265 +#: ../../library/unittest.rst:1293 msgid "" "Registers a type-specific method called by :meth:`assertEqual` to check if " "two objects of exactly the same *typeobj* (not subclasses) compare equal. " @@ -1613,66 +1632,66 @@ msgid "" "explaining the inequalities in details in the error message." msgstr "" -#: ../../library/unittest.rst:1276 +#: ../../library/unittest.rst:1304 msgid "" "The list of type-specific methods automatically used by :meth:`~TestCase." "assertEqual` are summarized in the following table. Note that it's usually " "not necessary to invoke these methods directly." msgstr "" -#: ../../library/unittest.rst:1281 +#: ../../library/unittest.rst:1309 msgid "Used to compare" msgstr "" -#: ../../library/unittest.rst:1283 +#: ../../library/unittest.rst:1311 msgid ":meth:`assertMultiLineEqual(a, b) `" msgstr ":meth:`assertMultiLineEqual(a, b) `" -#: ../../library/unittest.rst:1283 +#: ../../library/unittest.rst:1311 msgid "strings" msgstr "" -#: ../../library/unittest.rst:1286 +#: ../../library/unittest.rst:1314 msgid ":meth:`assertSequenceEqual(a, b) `" msgstr ":meth:`assertSequenceEqual(a, b) `" -#: ../../library/unittest.rst:1286 +#: ../../library/unittest.rst:1314 msgid "sequences" msgstr "" -#: ../../library/unittest.rst:1289 +#: ../../library/unittest.rst:1317 msgid ":meth:`assertListEqual(a, b) `" msgstr ":meth:`assertListEqual(a, b) `" -#: ../../library/unittest.rst:1289 +#: ../../library/unittest.rst:1317 msgid "lists" msgstr "" -#: ../../library/unittest.rst:1292 +#: ../../library/unittest.rst:1320 msgid ":meth:`assertTupleEqual(a, b) `" msgstr ":meth:`assertTupleEqual(a, b) `" -#: ../../library/unittest.rst:1292 +#: ../../library/unittest.rst:1320 msgid "tuples" msgstr "" -#: ../../library/unittest.rst:1295 +#: ../../library/unittest.rst:1323 msgid ":meth:`assertSetEqual(a, b) `" msgstr ":meth:`assertSetEqual(a, b) `" -#: ../../library/unittest.rst:1295 +#: ../../library/unittest.rst:1323 msgid "sets or frozensets" msgstr "" -#: ../../library/unittest.rst:1298 +#: ../../library/unittest.rst:1326 msgid ":meth:`assertDictEqual(a, b) `" msgstr ":meth:`assertDictEqual(a, b) `" -#: ../../library/unittest.rst:1298 +#: ../../library/unittest.rst:1326 msgid "dicts" msgstr "" -#: ../../library/unittest.rst:1306 +#: ../../library/unittest.rst:1334 msgid "" "Test that the multiline string *first* is equal to the string *second*. When " "not equal a diff of the two strings highlighting the differences will be " @@ -1680,7 +1699,7 @@ msgid "" "strings with :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1316 +#: ../../library/unittest.rst:1344 msgid "" "Tests that two sequences are equal. If a *seq_type* is supplied, both " "*first* and *second* must be instances of *seq_type* or a failure will be " @@ -1688,13 +1707,13 @@ msgid "" "shows the difference between the two." msgstr "" -#: ../../library/unittest.rst:1321 +#: ../../library/unittest.rst:1349 msgid "" "This method is not called directly by :meth:`assertEqual`, but it's used to " "implement :meth:`assertListEqual` and :meth:`assertTupleEqual`." msgstr "" -#: ../../library/unittest.rst:1331 +#: ../../library/unittest.rst:1359 msgid "" "Tests that two lists or tuples are equal. If not, an error message is " "constructed that shows only the differences between the two. An error is " @@ -1702,38 +1721,38 @@ msgid "" "are used by default when comparing lists or tuples with :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1342 +#: ../../library/unittest.rst:1370 msgid "" "Tests that two sets are equal. If not, an error message is constructed that " "lists the differences between the sets. This method is used by default when " "comparing sets or frozensets with :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1346 +#: ../../library/unittest.rst:1374 msgid "" "Fails if either of *first* or *second* does not have a :meth:`set." "difference` method." msgstr "" -#: ../../library/unittest.rst:1354 +#: ../../library/unittest.rst:1382 msgid "" "Test that two dictionaries are equal. If not, an error message is " "constructed that shows the differences in the dictionaries. This method will " "be used by default to compare dictionaries in calls to :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1365 +#: ../../library/unittest.rst:1393 msgid "" "Finally the :class:`TestCase` provides the following methods and attributes:" msgstr "" -#: ../../library/unittest.rst:1370 +#: ../../library/unittest.rst:1398 msgid "" "Signals a test failure unconditionally, with *msg* or ``None`` for the error " "message." msgstr "" -#: ../../library/unittest.rst:1376 +#: ../../library/unittest.rst:1404 msgid "" "This class attribute gives the exception raised by the test method. If a " "test framework needs to use a specialized exception, possibly to carry " @@ -1742,7 +1761,7 @@ msgid "" "`AssertionError`." msgstr "" -#: ../../library/unittest.rst:1385 +#: ../../library/unittest.rst:1413 msgid "" "This class attribute determines what happens when a custom failure message " "is passed as the msg argument to an assertXYY call that fails. ``True`` is " @@ -1751,18 +1770,18 @@ msgid "" "replaces the standard message." msgstr "" -#: ../../library/unittest.rst:1391 +#: ../../library/unittest.rst:1419 msgid "" "The class setting can be overridden in individual test methods by assigning " "an instance attribute, self.longMessage, to ``True`` or ``False`` before " "calling the assert methods." msgstr "" -#: ../../library/unittest.rst:1395 +#: ../../library/unittest.rst:1423 msgid "The class setting gets reset before each test call." msgstr "" -#: ../../library/unittest.rst:1402 +#: ../../library/unittest.rst:1430 msgid "" "This attribute controls the maximum length of diffs output by assert methods " "that report diffs on failure. It defaults to 80*8 characters. Assert methods " @@ -1771,52 +1790,52 @@ msgid "" "`assertDictEqual` and :meth:`assertMultiLineEqual`." msgstr "" -#: ../../library/unittest.rst:1409 +#: ../../library/unittest.rst:1437 msgid "" "Setting ``maxDiff`` to ``None`` means that there is no maximum length of " "diffs." msgstr "" -#: ../../library/unittest.rst:1415 +#: ../../library/unittest.rst:1443 msgid "" "Testing frameworks can use the following methods to collect information on " "the test:" msgstr "" -#: ../../library/unittest.rst:1421 +#: ../../library/unittest.rst:1449 msgid "" "Return the number of tests represented by this test object. For :class:" "`TestCase` instances, this will always be ``1``." msgstr "" -#: ../../library/unittest.rst:1427 +#: ../../library/unittest.rst:1455 msgid "" "Return an instance of the test result class that should be used for this " "test case class (if no other result instance is provided to the :meth:`run` " "method)." msgstr "" -#: ../../library/unittest.rst:1431 +#: ../../library/unittest.rst:1459 msgid "" "For :class:`TestCase` instances, this will always be an instance of :class:" "`TestResult`; subclasses of :class:`TestCase` should override this as " "necessary." msgstr "" -#: ../../library/unittest.rst:1438 +#: ../../library/unittest.rst:1466 msgid "" "Return a string identifying the specific test case. This is usually the " "full name of the test method, including the module and class name." msgstr "" -#: ../../library/unittest.rst:1444 +#: ../../library/unittest.rst:1472 msgid "" "Returns a description of the test, or ``None`` if no description has been " "provided. The default implementation of this method returns the first line " "of the test method's docstring, if available, or ``None``." msgstr "" -#: ../../library/unittest.rst:1449 +#: ../../library/unittest.rst:1477 msgid "" "In 3.1 this was changed to add the test name to the short description even " "in the presence of a docstring. This caused compatibility issues with " @@ -1824,7 +1843,7 @@ msgid "" "`TextTestResult` in Python 3.2." msgstr "" -#: ../../library/unittest.rst:1458 +#: ../../library/unittest.rst:1486 msgid "" "Add a function to be called after :meth:`tearDown` to cleanup resources used " "during the test. Functions will be called in reverse order to the order they " @@ -1833,32 +1852,39 @@ msgid "" "added." msgstr "" -#: ../../library/unittest.rst:1464 +#: ../../library/unittest.rst:1492 msgid "" "If :meth:`setUp` fails, meaning that :meth:`tearDown` is not called, then " "any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:1472 +#: ../../library/unittest.rst:1500 +msgid "" +"Enter the supplied :term:`context manager`. If successful, also add its :" +"meth:`~object.__exit__` method as a cleanup function by :meth:`addCleanup` " +"and return the result of the :meth:`~object.__enter__` method." +msgstr "" + +#: ../../library/unittest.rst:1510 msgid "" "This method is called unconditionally after :meth:`tearDown`, or after :meth:" "`setUp` if :meth:`setUp` raises an exception." msgstr "" -#: ../../library/unittest.rst:1475 +#: ../../library/unittest.rst:1513 msgid "" "It is responsible for calling all the cleanup functions added by :meth:" "`addCleanup`. If you need cleanup functions to be called *prior* to :meth:" "`tearDown` then you can call :meth:`doCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:1480 +#: ../../library/unittest.rst:1518 msgid "" ":meth:`doCleanups` pops methods off the stack of cleanup functions one at a " "time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:1487 +#: ../../library/unittest.rst:1526 msgid "" "Add a function to be called after :meth:`tearDownClass` to cleanup resources " "used during the test class. Functions will be called in reverse order to the " @@ -1867,38 +1893,46 @@ msgid "" "when they are added." msgstr "" -#: ../../library/unittest.rst:1493 +#: ../../library/unittest.rst:1532 msgid "" "If :meth:`setUpClass` fails, meaning that :meth:`tearDownClass` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:1501 +#: ../../library/unittest.rst:1540 +msgid "" +"Enter the supplied :term:`context manager`. If successful, also add its :" +"meth:`~object.__exit__` method as a cleanup function by :meth:" +"`addClassCleanup` and return the result of the :meth:`~object.__enter__` " +"method." +msgstr "" + +#: ../../library/unittest.rst:1550 msgid "" "This method is called unconditionally after :meth:`tearDownClass`, or after :" "meth:`setUpClass` if :meth:`setUpClass` raises an exception." msgstr "" -#: ../../library/unittest.rst:1504 +#: ../../library/unittest.rst:1553 msgid "" "It is responsible for calling all the cleanup functions added by :meth:" "`addClassCleanup`. If you need cleanup functions to be called *prior* to :" "meth:`tearDownClass` then you can call :meth:`doClassCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:1509 +#: ../../library/unittest.rst:1558 msgid "" ":meth:`doClassCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:1517 +#: ../../library/unittest.rst:1566 msgid "" "This class provides an API similar to :class:`TestCase` and also accepts " "coroutines as test functions." msgstr "" -#: ../../library/unittest.rst:1524 +#: ../../library/unittest.rst:1573 msgid "" "Method called to prepare the test fixture. This is called after :meth:" "`setUp`. This is called immediately before calling the test method; other " @@ -1907,7 +1941,7 @@ msgid "" "implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1532 +#: ../../library/unittest.rst:1581 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -1920,11 +1954,19 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1544 +#: ../../library/unittest.rst:1593 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1548 +#: ../../library/unittest.rst:1597 +msgid "" +"Enter the supplied :term:`asynchronous context manager`. If successful, " +"also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" +"`addAsyncCleanup` and return the result of the :meth:`~object.__aenter__` " +"method." +msgstr "" + +#: ../../library/unittest.rst:1607 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " @@ -1934,17 +1976,17 @@ msgid "" "cancelled." msgstr "" -#: ../../library/unittest.rst:1556 +#: ../../library/unittest.rst:1615 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1592 +#: ../../library/unittest.rst:1651 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", \"asyncSetUp" "\", \"test_response\", \"asyncTearDown\", \"tearDown\", \"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1597 +#: ../../library/unittest.rst:1656 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -1953,150 +1995,150 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1607 +#: ../../library/unittest.rst:1666 msgid "Deprecated aliases" msgstr "" -#: ../../library/unittest.rst:1609 +#: ../../library/unittest.rst:1668 msgid "" "For historical reasons, some of the :class:`TestCase` methods had one or " "more aliases that are now deprecated. The following table lists the correct " "names along with their deprecated aliases:" msgstr "" -#: ../../library/unittest.rst:1614 +#: ../../library/unittest.rst:1673 msgid "Method Name" msgstr "" -#: ../../library/unittest.rst:1614 +#: ../../library/unittest.rst:1673 msgid "Deprecated alias" msgstr "" -#: ../../library/unittest.rst:1616 +#: ../../library/unittest.rst:1675 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../library/unittest.rst:1616 +#: ../../library/unittest.rst:1675 msgid "failUnlessEqual" msgstr "failUnlessEqual" -#: ../../library/unittest.rst:1616 +#: ../../library/unittest.rst:1675 msgid "assertEquals" msgstr "assertEquals" -#: ../../library/unittest.rst:1617 +#: ../../library/unittest.rst:1676 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../library/unittest.rst:1617 +#: ../../library/unittest.rst:1676 msgid "failIfEqual" msgstr "failIfEqual" -#: ../../library/unittest.rst:1617 +#: ../../library/unittest.rst:1676 msgid "assertNotEquals" msgstr "assertNotEquals" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1677 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1677 msgid "failUnless" msgstr "failUnless" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1677 msgid "assert\\_" msgstr "assert\\_" -#: ../../library/unittest.rst:1619 +#: ../../library/unittest.rst:1678 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../library/unittest.rst:1619 +#: ../../library/unittest.rst:1678 msgid "failIf" msgstr "failIf" -#: ../../library/unittest.rst:1620 +#: ../../library/unittest.rst:1679 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../library/unittest.rst:1620 +#: ../../library/unittest.rst:1679 msgid "failUnlessRaises" msgstr "failUnlessRaises" -#: ../../library/unittest.rst:1621 +#: ../../library/unittest.rst:1680 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../library/unittest.rst:1621 +#: ../../library/unittest.rst:1680 msgid "failUnlessAlmostEqual" msgstr "failUnlessAlmostEqual" -#: ../../library/unittest.rst:1621 +#: ../../library/unittest.rst:1680 msgid "assertAlmostEquals" msgstr "assertAlmostEquals" -#: ../../library/unittest.rst:1622 +#: ../../library/unittest.rst:1681 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../library/unittest.rst:1622 +#: ../../library/unittest.rst:1681 msgid "failIfAlmostEqual" msgstr "failIfAlmostEqual" -#: ../../library/unittest.rst:1622 +#: ../../library/unittest.rst:1681 msgid "assertNotAlmostEquals" msgstr "assertNotAlmostEquals" -#: ../../library/unittest.rst:1623 +#: ../../library/unittest.rst:1682 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../library/unittest.rst:1623 +#: ../../library/unittest.rst:1682 msgid "assertRegexpMatches" msgstr "assertRegexpMatches" -#: ../../library/unittest.rst:1624 +#: ../../library/unittest.rst:1683 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../library/unittest.rst:1624 +#: ../../library/unittest.rst:1683 msgid "assertNotRegexpMatches" msgstr "assertNotRegexpMatches" -#: ../../library/unittest.rst:1625 +#: ../../library/unittest.rst:1684 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../library/unittest.rst:1625 +#: ../../library/unittest.rst:1684 msgid "assertRaisesRegexp" msgstr "assertRaisesRegexp" -#: ../../library/unittest.rst:1628 +#: ../../library/unittest.rst:1687 msgid "The fail* aliases listed in the second column have been deprecated." msgstr "" -#: ../../library/unittest.rst:1630 +#: ../../library/unittest.rst:1689 msgid "The assert* aliases listed in the third column have been deprecated." msgstr "" -#: ../../library/unittest.rst:1632 +#: ../../library/unittest.rst:1691 msgid "" "``assertRegexpMatches`` and ``assertRaisesRegexp`` have been renamed to :" "meth:`.assertRegex` and :meth:`.assertRaisesRegex`." msgstr "" -#: ../../library/unittest.rst:1635 +#: ../../library/unittest.rst:1694 msgid "" "The ``assertNotRegexpMatches`` name is deprecated in favor of :meth:`." "assertNotRegex`." msgstr "" -#: ../../library/unittest.rst:1641 +#: ../../library/unittest.rst:1700 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1645 +#: ../../library/unittest.rst:1704 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2104,14 +2146,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1650 +#: ../../library/unittest.rst:1709 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1654 +#: ../../library/unittest.rst:1713 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2120,47 +2162,47 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1662 +#: ../../library/unittest.rst:1721 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1667 +#: ../../library/unittest.rst:1726 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1670 +#: ../../library/unittest.rst:1729 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1673 +#: ../../library/unittest.rst:1732 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1678 +#: ../../library/unittest.rst:1737 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: ../../library/unittest.rst:1686 +#: ../../library/unittest.rst:1745 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1693 +#: ../../library/unittest.rst:1752 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1699 +#: ../../library/unittest.rst:1758 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`__iter__`. Note " @@ -2172,31 +2214,31 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1709 +#: ../../library/unittest.rst:1768 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`__iter__` wasn't sufficient for " "providing tests." msgstr "" -#: ../../library/unittest.rst:1714 +#: ../../library/unittest.rst:1773 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " "by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1719 +#: ../../library/unittest.rst:1778 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1724 +#: ../../library/unittest.rst:1783 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1728 +#: ../../library/unittest.rst:1787 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -2205,11 +2247,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1734 +#: ../../library/unittest.rst:1793 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1739 +#: ../../library/unittest.rst:1798 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2217,17 +2259,17 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1748 +#: ../../library/unittest.rst:1807 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1753 +#: ../../library/unittest.rst:1812 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" "derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1756 +#: ../../library/unittest.rst:1815 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " @@ -2236,14 +2278,14 @@ msgid "" "method instead." msgstr "" -#: ../../library/unittest.rst:1765 +#: ../../library/unittest.rst:1824 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1772 +#: ../../library/unittest.rst:1831 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2252,7 +2294,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1778 +#: ../../library/unittest.rst:1837 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2260,11 +2302,11 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1783 +#: ../../library/unittest.rst:1842 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1786 +#: ../../library/unittest.rst:1845 msgid "" "The undocumented and unofficial *use_load_tests* default argument is " "deprecated and ignored, although it is still accepted for backward " @@ -2272,11 +2314,11 @@ msgid "" "*pattern* which is passed to ``load_tests`` as the third argument." msgstr "" -#: ../../library/unittest.rst:1795 +#: ../../library/unittest.rst:1854 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1797 +#: ../../library/unittest.rst:1856 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2287,7 +2329,7 @@ msgid "" "object\"." msgstr "" -#: ../../library/unittest.rst:1805 +#: ../../library/unittest.rst:1864 msgid "" "For example, if you have a module :mod:`SampleTests` containing a :class:" "`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " @@ -2300,31 +2342,31 @@ msgid "" "a side-effect." msgstr "" -#: ../../library/unittest.rst:1815 +#: ../../library/unittest.rst:1874 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1817 +#: ../../library/unittest.rst:1876 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1826 +#: ../../library/unittest.rst:1885 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1833 +#: ../../library/unittest.rst:1892 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1839 +#: ../../library/unittest.rst:1898 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2333,14 +2375,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1845 +#: ../../library/unittest.rst:1904 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then the top level " "directory must be specified separately." msgstr "" -#: ../../library/unittest.rst:1849 +#: ../../library/unittest.rst:1908 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2348,7 +2390,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1854 +#: ../../library/unittest.rst:1913 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2358,13 +2400,13 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1862 +#: ../../library/unittest.rst:1921 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1866 +#: ../../library/unittest.rst:1925 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves. *top_level_dir* is stored so " @@ -2372,75 +2414,81 @@ msgid "" "discover()``." msgstr "" -#: ../../library/unittest.rst:1871 +#: ../../library/unittest.rst:1930 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1875 +#: ../../library/unittest.rst:1934 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1879 +#: ../../library/unittest.rst:1938 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1882 +#: ../../library/unittest.rst:1941 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1887 +#: ../../library/unittest.rst:1946 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1893 +#: ../../library/unittest.rst:1951 +msgid "" +"*start_dir* can not be a :term:`namespace packages `. It " +"has been broken since Python 3.7 and Python 3.11 officially remove it." +msgstr "" + +#: ../../library/unittest.rst:1956 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1899 +#: ../../library/unittest.rst:1962 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1902 +#: ../../library/unittest.rst:1965 msgid "" "This affects :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\\*` " "methods." msgstr "" -#: ../../library/unittest.rst:1908 +#: ../../library/unittest.rst:1971 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the :meth:`loadTestsFrom\\*` methods." msgstr "" -#: ../../library/unittest.rst:1914 +#: ../../library/unittest.rst:1977 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1918 ../../library/unittest.rst:1931 +#: ../../library/unittest.rst:1981 ../../library/unittest.rst:1994 msgid "This affects all the :meth:`loadTestsFrom\\*` methods." msgstr "" -#: ../../library/unittest.rst:1922 +#: ../../library/unittest.rst:1985 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-v`` option)." msgstr "" -#: ../../library/unittest.rst:1925 +#: ../../library/unittest.rst:1988 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2449,13 +2497,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1938 +#: ../../library/unittest.rst:2001 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1941 +#: ../../library/unittest.rst:2004 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2463,7 +2511,7 @@ msgid "" "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1946 +#: ../../library/unittest.rst:2009 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " @@ -2471,55 +2519,55 @@ msgid "" "`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:1951 +#: ../../library/unittest.rst:2014 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:1957 +#: ../../library/unittest.rst:2020 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:1963 +#: ../../library/unittest.rst:2026 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :meth:`TestCase.assert\\*` methods." msgstr "" -#: ../../library/unittest.rst:1969 +#: ../../library/unittest.rst:2032 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:1976 +#: ../../library/unittest.rst:2039 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:1982 +#: ../../library/unittest.rst:2045 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:1987 +#: ../../library/unittest.rst:2050 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:1991 +#: ../../library/unittest.rst:2054 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:1995 +#: ../../library/unittest.rst:2058 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -2528,29 +2576,29 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2004 +#: ../../library/unittest.rst:2067 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2011 +#: ../../library/unittest.rst:2074 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2017 +#: ../../library/unittest.rst:2080 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2020 +#: ../../library/unittest.rst:2083 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2026 +#: ../../library/unittest.rst:2089 msgid "" "This method can be called to signal that the set of tests being run should " "be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" @@ -2558,7 +2606,7 @@ msgid "" "additional tests." msgstr "" -#: ../../library/unittest.rst:2031 +#: ../../library/unittest.rst:2094 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -2566,7 +2614,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2036 +#: ../../library/unittest.rst:2099 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -2574,136 +2622,136 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2044 +#: ../../library/unittest.rst:2107 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2048 +#: ../../library/unittest.rst:2111 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2053 +#: ../../library/unittest.rst:2116 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2060 +#: ../../library/unittest.rst:2123 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2067 +#: ../../library/unittest.rst:2130 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2071 +#: ../../library/unittest.rst:2134 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2078 +#: ../../library/unittest.rst:2141 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2081 +#: ../../library/unittest.rst:2144 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2088 +#: ../../library/unittest.rst:2151 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2090 +#: ../../library/unittest.rst:2153 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2095 +#: ../../library/unittest.rst:2158 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2098 +#: ../../library/unittest.rst:2161 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2104 +#: ../../library/unittest.rst:2167 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2107 +#: ../../library/unittest.rst:2170 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2114 +#: ../../library/unittest.rst:2177 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2117 +#: ../../library/unittest.rst:2180 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2123 +#: ../../library/unittest.rst:2186 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2127 +#: ../../library/unittest.rst:2190 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2131 +#: ../../library/unittest.rst:2194 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2139 +#: ../../library/unittest.rst:2202 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`." msgstr "" -#: ../../library/unittest.rst:2142 +#: ../../library/unittest.rst:2205 msgid "" "This class was previously named ``_TextTestResult``. The old name still " "exists as an alias but is deprecated." msgstr "" -#: ../../library/unittest.rst:2149 +#: ../../library/unittest.rst:2212 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2157 +#: ../../library/unittest.rst:2220 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -2714,7 +2762,7 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2164 +#: ../../library/unittest.rst:2227 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -2727,28 +2775,28 @@ msgid "" "warnings>`) and leaving *warnings* to ``None``." msgstr "" -#: ../../library/unittest.rst:2175 +#: ../../library/unittest.rst:2238 msgid "Added the ``warnings`` argument." msgstr "新增 ``warnings`` 引數。" -#: ../../library/unittest.rst:2178 +#: ../../library/unittest.rst:2241 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2182 +#: ../../library/unittest.rst:2245 msgid "Added the tb_locals parameter." msgstr "新增 tb_locals 參數。" -#: ../../library/unittest.rst:2187 +#: ../../library/unittest.rst:2250 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2191 +#: ../../library/unittest.rst:2254 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -2756,7 +2804,7 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2200 +#: ../../library/unittest.rst:2263 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -2764,7 +2812,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2211 +#: ../../library/unittest.rst:2274 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -2772,13 +2820,13 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2219 +#: ../../library/unittest.rst:2282 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2225 +#: ../../library/unittest.rst:2288 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -2786,40 +2834,40 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2230 +#: ../../library/unittest.rst:2293 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2234 +#: ../../library/unittest.rst:2297 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " "exit code indicating success or failure of the tests run." msgstr "" -#: ../../library/unittest.rst:2238 +#: ../../library/unittest.rst:2301 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2241 +#: ../../library/unittest.rst:2304 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2248 +#: ../../library/unittest.rst:2311 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2251 +#: ../../library/unittest.rst:2314 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -2828,56 +2876,56 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2257 +#: ../../library/unittest.rst:2320 msgid "" "Calling ``main`` actually returns an instance of the ``TestProgram`` class. " "This stores the result of the tests run as the ``result`` attribute." msgstr "" -#: ../../library/unittest.rst:2260 +#: ../../library/unittest.rst:2323 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2263 +#: ../../library/unittest.rst:2326 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2267 +#: ../../library/unittest.rst:2330 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2273 +#: ../../library/unittest.rst:2336 msgid "load_tests Protocol" msgstr "" -#: ../../library/unittest.rst:2277 +#: ../../library/unittest.rst:2340 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2280 +#: ../../library/unittest.rst:2343 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2285 +#: ../../library/unittest.rst:2348 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2288 +#: ../../library/unittest.rst:2351 msgid "It should return a :class:`TestSuite`." msgstr "" -#: ../../library/unittest.rst:2290 +#: ../../library/unittest.rst:2353 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -2886,13 +2934,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2296 +#: ../../library/unittest.rst:2359 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2308 +#: ../../library/unittest.rst:2371 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -2902,31 +2950,31 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2317 +#: ../../library/unittest.rst:2380 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2321 +#: ../../library/unittest.rst:2384 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2332 +#: ../../library/unittest.rst:2395 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2339 +#: ../../library/unittest.rst:2402 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2341 +#: ../../library/unittest.rst:2404 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " @@ -2934,27 +2982,27 @@ msgid "" "`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2346 +#: ../../library/unittest.rst:2409 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2350 +#: ../../library/unittest.rst:2413 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2353 +#: ../../library/unittest.rst:2416 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2356 +#: ../../library/unittest.rst:2419 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -2964,14 +3012,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2363 +#: ../../library/unittest.rst:2426 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2367 +#: ../../library/unittest.rst:2430 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -2981,22 +3029,22 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2376 +#: ../../library/unittest.rst:2439 msgid "setUpClass and tearDownClass" msgstr "" -#: ../../library/unittest.rst:2378 +#: ../../library/unittest.rst:2441 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2391 +#: ../../library/unittest.rst:2454 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2395 +#: ../../library/unittest.rst:2458 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -3005,15 +3053,15 @@ msgid "" "instead of as an error." msgstr "" -#: ../../library/unittest.rst:2403 +#: ../../library/unittest.rst:2466 msgid "setUpModule and tearDownModule" msgstr "" -#: ../../library/unittest.rst:2405 +#: ../../library/unittest.rst:2468 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2413 +#: ../../library/unittest.rst:2476 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3021,13 +3069,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2418 +#: ../../library/unittest.rst:2481 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2424 +#: ../../library/unittest.rst:2487 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -3036,36 +3084,44 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2430 +#: ../../library/unittest.rst:2493 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2438 +#: ../../library/unittest.rst:2501 +msgid "" +"Enter the supplied :term:`context manager`. If successful, also add its :" +"meth:`~object.__exit__` method as a cleanup function by :func:" +"`addModuleCleanup` and return the result of the :meth:`~object.__enter__` " +"method." +msgstr "" + +#: ../../library/unittest.rst:2511 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2441 +#: ../../library/unittest.rst:2514 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:2446 +#: ../../library/unittest.rst:2519 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2452 +#: ../../library/unittest.rst:2526 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2456 +#: ../../library/unittest.rst:2530 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main()`, provide " @@ -3075,7 +3131,7 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2463 +#: ../../library/unittest.rst:2537 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -3087,41 +3143,41 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2472 +#: ../../library/unittest.rst:2546 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2477 +#: ../../library/unittest.rst:2551 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2484 +#: ../../library/unittest.rst:2558 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2488 +#: ../../library/unittest.rst:2562 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2495 +#: ../../library/unittest.rst:2569 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: ../../library/unittest.rst:2502 +#: ../../library/unittest.rst:2576 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " diff --git a/library/urllib.request.po b/library/urllib.request.po index 0ca5de4298..e047504dbd 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,17 +46,28 @@ msgstr "" "有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_\\ 。" -#: ../../library/urllib.request.rst:25 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/urllib.request.rst:26 msgid "The :mod:`urllib.request` module defines the following functions:" msgstr ":mod:`urllib.request` module 定義下列函式:" -#: ../../library/urllib.request.rst:30 +#: ../../library/urllib.request.rst:31 msgid "" "Open the URL *url*, which can be either a string or a :class:`Request` " "object." msgstr "打開 URL *url*,其值可以是一個字串或是一個 :class:`Request` 物件。" -#: ../../library/urllib.request.rst:33 +#: ../../library/urllib.request.rst:34 msgid "" "*data* must be an object specifying additional data to be sent to the " "server, or ``None`` if no such data is needed. See :class:`Request` for " @@ -65,7 +76,7 @@ msgstr "" "*data* 必須是一個包含傳送給伺服器額外資料的物件,若不需要傳送額外資料則指定" "為 ``None``\\ 。更多細節請見 :class:`Request`\\ 。" -#: ../../library/urllib.request.rst:37 +#: ../../library/urllib.request.rst:38 msgid "" "urllib.request module uses HTTP/1.1 and includes ``Connection:close`` header " "in its HTTP requests." @@ -73,7 +84,7 @@ msgstr "" "urllib.request module 使用 HTTP/1.1 並包含 ``Connection:close`` header(標" "頭)在其 HTTP 請求中。" -#: ../../library/urllib.request.rst:40 +#: ../../library/urllib.request.rst:41 msgid "" "The optional *timeout* parameter specifies a timeout in seconds for blocking " "operations like the connection attempt (if not specified, the global default " @@ -84,7 +95,7 @@ msgstr "" "接)的 timeout(超時時間),以秒為單位。若沒有指定值,則會使用全域預設超時時" "間設定。實際上,此參數僅作用於 HTTP、HTTPS 以及 FTP 的連接。" -#: ../../library/urllib.request.rst:45 +#: ../../library/urllib.request.rst:46 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " "describing the various SSL options. See :class:`~http.client." @@ -93,7 +104,7 @@ msgstr "" "若 *context* 有被指定時,它必須是一個 :class:`ssl.SSLContext` 的實例並描述著" "各種 SSL 選項。更多細節請見 :class:`~http.client.HTTPSConnection`\\ 。" -#: ../../library/urllib.request.rst:49 +#: ../../library/urllib.request.rst:50 msgid "" "The optional *cafile* and *capath* parameters specify a set of trusted CA " "certificates for HTTPS requests. *cafile* should point to a single file " @@ -106,11 +117,11 @@ msgstr "" "放一堆雜湊後的憑證檔案的目錄。欲瞭解更多的資訊請參見 :meth:`ssl.SSLContext." "load_verify_locations`\\ 。" -#: ../../library/urllib.request.rst:55 +#: ../../library/urllib.request.rst:56 msgid "The *cadefault* parameter is ignored." msgstr "參數 *cadefault* 已被忽略。" -#: ../../library/urllib.request.rst:57 +#: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " "manager` and has the properties *url*, *headers*, and *status*. See :class:" @@ -120,7 +131,7 @@ msgstr "" "(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" "`urllib.response.addinfourl`\\ 。" -#: ../../library/urllib.request.rst:61 +#: ../../library/urllib.request.rst:62 msgid "" "For HTTP and HTTPS URLs, this function returns a :class:`http.client." "HTTPResponse` object slightly modified. In addition to the three new methods " @@ -135,7 +146,7 @@ msgstr "" "(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" "應 headers。" -#: ../../library/urllib.request.rst:69 +#: ../../library/urllib.request.rst:70 msgid "" "For FTP, file, and data URLs and requests explicitly handled by legacy :" "class:`URLopener` and :class:`FancyURLopener` classes, this function returns " @@ -145,11 +156,11 @@ msgstr "" "class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." "response.addinfourl` 物件。" -#: ../../library/urllib.request.rst:73 +#: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`\\ 。" -#: ../../library/urllib.request.rst:75 +#: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " "the default installed global :class:`OpenerDirector` uses :class:" @@ -159,7 +170,7 @@ msgstr "" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" "生)" -#: ../../library/urllib.request.rst:79 +#: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " "environment variable like :envvar:`http_proxy` is set), :class:" @@ -170,7 +181,7 @@ msgstr "" "`http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" "代理服務來處理。" -#: ../../library/urllib.request.rst:84 +#: ../../library/urllib.request.rst:85 msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " @@ -183,7 +194,7 @@ msgstr "" "的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," "現在則可以透過 :class:`ProxyHandler` 物件來取得。" -#: ../../library/urllib.request.rst:90 +#: ../../library/urllib.request.rst:102 msgid "" "Raises an :ref:`auditing event ` ``urllib.Request`` with arguments " "``fullurl``, ``data``, ``headers``, ``method``." @@ -191,7 +202,7 @@ msgstr "" "觸發一個 :ref:`auditing event ` ``urllib.Request`` 及其引數 " "``fullurl``、``data``、``headers``、``method``。" -#: ../../library/urllib.request.rst:92 +#: ../../library/urllib.request.rst:93 msgid "" "The default opener raises an :ref:`auditing event ` ``urllib." "Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " @@ -200,11 +211,11 @@ msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" -#: ../../library/urllib.request.rst:96 +#: ../../library/urllib.request.rst:97 msgid "*cafile* and *capath* were added." msgstr "新增 *cafile* 與 *capath*。" -#: ../../library/urllib.request.rst:99 +#: ../../library/urllib.request.rst:100 msgid "" "HTTPS virtual hosts are now supported if possible (that is, if :data:`ssl." "HAS_SNI` is true)." @@ -212,19 +223,19 @@ msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :data:`ssl.HAS_SNI` 的值為 " "true。" -#: ../../library/urllib.request.rst:103 +#: ../../library/urllib.request.rst:104 msgid "*data* can be an iterable object." msgstr "*data* 可以是一個可疊代物件。" -#: ../../library/urllib.request.rst:106 +#: ../../library/urllib.request.rst:107 msgid "*cadefault* was added." msgstr "*cadefault* 被新增。" -#: ../../library/urllib.request.rst:109 +#: ../../library/urllib.request.rst:110 msgid "*context* was added." msgstr "*context* 被新增。" -#: ../../library/urllib.request.rst:112 +#: ../../library/urllib.request.rst:113 msgid "" "HTTPS connection now send an ALPN extension with protocol indicator " "``http/1.1`` when no *context* is given. Custom *context* should set ALPN " @@ -234,7 +245,7 @@ msgstr "" "``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." "SSLContext.set_alpn_protocol` 來自行設定 ALPN 協定。" -#: ../../library/urllib.request.rst:119 +#: ../../library/urllib.request.rst:120 msgid "" "*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " "Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." @@ -244,7 +255,7 @@ msgstr "" "meth:`ssl.SSLContext.load_cert_chain`,或是讓 :func:`ssl." "create_default_context` 選取系統中受信任的 CA 憑證。" -#: ../../library/urllib.request.rst:127 +#: ../../library/urllib.request.rst:128 msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " @@ -258,7 +269,7 @@ msgstr "" "查 class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都" "能適用。" -#: ../../library/urllib.request.rst:137 +#: ../../library/urllib.request.rst:138 msgid "" "Return an :class:`OpenerDirector` instance, which chains the handlers in the " "order given. *handler*\\s can be either instances of :class:`BaseHandler`, " @@ -281,7 +292,7 @@ msgstr "" "`FTPHandler`\\ 、\\ :class:`FileHandler`\\ 、\\ :class:`HTTPErrorProcessor`" "\\ 。" -#: ../../library/urllib.request.rst:147 +#: ../../library/urllib.request.rst:148 msgid "" "If the Python installation has SSL support (i.e., if the :mod:`ssl` module " "can be imported), :class:`HTTPSHandler` will also be added." @@ -289,7 +300,7 @@ msgstr "" "如果 Python 安裝時已帶有 SSL 支援(如果 :mod:`ssl` module 能夠被 import)," "則 :class:`HTTPSHandler` 也在上述 class 之中。" -#: ../../library/urllib.request.rst:150 +#: ../../library/urllib.request.rst:151 msgid "" "A :class:`BaseHandler` subclass may also change its :attr:`handler_order` " "attribute to modify its position in the handlers list." @@ -297,7 +308,7 @@ msgstr "" "一個 :class:`BaseHandler` 的 subclass 可能透過改變其 :attr:`handler_order` 屬" "性來調整它在 handlers list 中的位置。" -#: ../../library/urllib.request.rst:156 +#: ../../library/urllib.request.rst:157 msgid "" "Convert the pathname *path* from the local syntax for a path to the form " "used in the path component of a URL. This does not produce a complete URL. " @@ -308,7 +319,7 @@ msgstr "" "component(路徑元件)格式。本函式並不會產生完整的 URL。回傳值將使用 :func:" "`~urllib.parse.quote` 函式先進行編碼過。" -#: ../../library/urllib.request.rst:163 +#: ../../library/urllib.request.rst:164 msgid "" "Convert the path component *path* from a percent-encoded URL to the local " "syntax for a path. This does not accept a complete URL. This function " @@ -318,7 +329,7 @@ msgstr "" "(local syntax)。本函式並不接受完整的 URL。本函式使用 :func:`~urllib.parse." "unquote` 來將 *path* 解碼。" -#: ../../library/urllib.request.rst:169 +#: ../../library/urllib.request.rst:170 msgid "" "This helper function returns a dictionary of scheme to proxy server URL " "mappings. It scans the environment for variables named ``_proxy``, " @@ -333,7 +344,7 @@ msgstr "" "Configuration) 或是 Windows 系統中的 Windows Systems Registry 尋找代理服務設" "定。如果大小寫的環境變數同時存在且值有不同,小寫的環境變數會被選用。" -#: ../../library/urllib.request.rst:179 +#: ../../library/urllib.request.rst:180 msgid "" "If the environment variable ``REQUEST_METHOD`` is set, which usually " "indicates your script is running in a CGI environment, the environment " @@ -350,19 +361,19 @@ msgstr "" "``ProxyHandler``,亦或是確認變數名稱是小寫的(或至少 ``_proxy`` 後綴是小寫" "的)。" -#: ../../library/urllib.request.rst:188 +#: ../../library/urllib.request.rst:189 msgid "The following classes are provided:" msgstr "提供了以下的 classes:" -#: ../../library/urllib.request.rst:192 +#: ../../library/urllib.request.rst:193 msgid "This class is an abstraction of a URL request." msgstr "這個 class 是一個 URL 請求的抽象 class。" -#: ../../library/urllib.request.rst:194 +#: ../../library/urllib.request.rst:195 msgid "*url* should be a string containing a valid URL." msgstr "*url* 是一個包含有效 URL 的字串。" -#: ../../library/urllib.request.rst:196 +#: ../../library/urllib.request.rst:197 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -383,7 +394,7 @@ msgstr "" "``Transfer-Encoding: chunked`` 則會被用來傳送檔案或是其它可疊代物件 " "(iterables)。" -#: ../../library/urllib.request.rst:206 +#: ../../library/urllib.request.rst:207 msgid "" "For an HTTP POST request method, *data* should be a buffer in the standard :" "mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." @@ -396,7 +407,7 @@ msgstr "" "個 mapping 或是 sequence(序列)的 2-tuples,並回傳一個對應格式的 ASCII 字" "串。在被作為 *data* 參數前它應該被編碼成位元組串。" -#: ../../library/urllib.request.rst:212 +#: ../../library/urllib.request.rst:213 msgid "" "*headers* should be a dictionary, and will be treated as if :meth:" "`add_header` was called with each key and value as arguments. This is often " @@ -417,7 +428,7 @@ msgstr "" "(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" "送。" -#: ../../library/urllib.request.rst:223 +#: ../../library/urllib.request.rst:224 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " @@ -428,14 +439,14 @@ msgstr "" "個 header 沒有被提供且 *data* 也不為 None 時,預設值 ``Content-Type: " "application/x-www-form-urlencoded`` 會被新增至請求中。" -#: ../../library/urllib.request.rst:228 +#: ../../library/urllib.request.rst:229 msgid "" "The next two arguments are only of interest for correct handling of third-" "party HTTP cookies:" msgstr "" "接下來的兩個引數的介紹提供給那些有興趣正確處理第三方 HTTP cookies 的使用者:" -#: ../../library/urllib.request.rst:231 +#: ../../library/urllib.request.rst:232 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " "defined by :rfc:`2965`. It defaults to ``http.cookiejar." @@ -449,7 +460,7 @@ msgstr "" "者發起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一" "個影像,則這個屬性應為請求包含影像頁面的請求主機。" -#: ../../library/urllib.request.rst:239 +#: ../../library/urllib.request.rst:240 msgid "" "*unverifiable* should indicate whether the request is unverifiable, as " "defined by :rfc:`2965`. It defaults to ``False``. An unverifiable request " @@ -462,7 +473,7 @@ msgstr "" "URL,例如一個對於 HTML 文件中的影像所做的請求,而使用者沒有機會去批准是否能自" "動擷取影像,則這個值應該為 true。" -#: ../../library/urllib.request.rst:246 +#: ../../library/urllib.request.rst:247 msgid "" "*method* should be a string that indicates the HTTP request method that will " "be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" @@ -477,7 +488,7 @@ msgstr "" "Subclasses 可以透過設置其 :attr:`~Request.method` 屬性來設定不一樣的預設請求" "方法。" -#: ../../library/urllib.request.rst:254 +#: ../../library/urllib.request.rst:255 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -491,15 +502,15 @@ msgstr "" "新嘗試傳送,則該請求不會正常運作。*data* 會接在 headers 之後被送至 HTTP 伺服" "器。此函式庫沒有支援 100-continue expectation。" -#: ../../library/urllib.request.rst:261 +#: ../../library/urllib.request.rst:262 msgid ":attr:`Request.method` argument is added to the Request class." msgstr "新增 :attr:`Request.method` 引數到 Request class。" -#: ../../library/urllib.request.rst:264 +#: ../../library/urllib.request.rst:265 msgid "Default :attr:`Request.method` may be indicated at the class level." msgstr "能夠在 class 中設置預設的 :attr:`Request.method`\\ 。" -#: ../../library/urllib.request.rst:267 +#: ../../library/urllib.request.rst:268 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " @@ -509,34 +520,34 @@ msgstr "" "串物件,則不會觸發錯誤,並 fall back(後備)使用分塊傳輸編碼 (chunked " "transfer encoding)。" -#: ../../library/urllib.request.rst:274 +#: ../../library/urllib.request.rst:275 msgid "" "The :class:`OpenerDirector` class opens URLs via :class:`BaseHandler`\\ s " "chained together. It manages the chaining of handlers, and recovery from " "errors." msgstr "" -#: ../../library/urllib.request.rst:280 +#: ../../library/urllib.request.rst:281 msgid "" "This is the base class for all registered handlers --- and handles only the " "simple mechanics of registration." msgstr "" -#: ../../library/urllib.request.rst:286 +#: ../../library/urllib.request.rst:287 msgid "" "A class which defines a default handler for HTTP error responses; all " "responses are turned into :exc:`~urllib.error.HTTPError` exceptions." msgstr "" -#: ../../library/urllib.request.rst:292 +#: ../../library/urllib.request.rst:293 msgid "A class to handle redirections." msgstr "" -#: ../../library/urllib.request.rst:297 +#: ../../library/urllib.request.rst:298 msgid "A class to handle HTTP Cookies." msgstr "" -#: ../../library/urllib.request.rst:302 +#: ../../library/urllib.request.rst:303 msgid "" "Cause requests to go through a proxy. If *proxies* is given, it must be a " "dictionary mapping protocol names to URLs of proxies. The default is to read " @@ -547,11 +558,11 @@ msgid "" "Configuration Framework." msgstr "" -#: ../../library/urllib.request.rst:310 +#: ../../library/urllib.request.rst:311 msgid "To disable autodetected proxy pass an empty dictionary." msgstr "" -#: ../../library/urllib.request.rst:312 +#: ../../library/urllib.request.rst:313 msgid "" "The :envvar:`no_proxy` environment variable can be used to specify hosts " "which shouldn't be reached via proxy; if set, it should be a comma-separated " @@ -559,24 +570,24 @@ msgid "" "``cern.ch,ncsa.uiuc.edu,some.host:8080``." msgstr "" -#: ../../library/urllib.request.rst:319 +#: ../../library/urllib.request.rst:320 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: ../../library/urllib.request.rst:325 +#: ../../library/urllib.request.rst:326 msgid "Keep a database of ``(realm, uri) -> (user, password)`` mappings." msgstr "" -#: ../../library/urllib.request.rst:330 +#: ../../library/urllib.request.rst:331 msgid "" "Keep a database of ``(realm, uri) -> (user, password)`` mappings. A realm " "of ``None`` is considered a catch-all realm, which is searched if no other " "realm fits." msgstr "" -#: ../../library/urllib.request.rst:337 +#: ../../library/urllib.request.rst:338 msgid "" "A variant of :class:`HTTPPasswordMgrWithDefaultRealm` that also has a " "database of ``uri -> is_authenticated`` mappings. Can be used by a " @@ -584,7 +595,7 @@ msgid "" "immediately instead of waiting for a ``401`` response first." msgstr "" -#: ../../library/urllib.request.rst:347 +#: ../../library/urllib.request.rst:348 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -603,11 +614,11 @@ msgid "" "will automatically include the authentication credentials." msgstr "" -#: ../../library/urllib.request.rst:364 +#: ../../library/urllib.request.rst:365 msgid "Added ``is_authenticated`` support." msgstr "新增 ``is_authenticated`` 的支援。" -#: ../../library/urllib.request.rst:370 +#: ../../library/urllib.request.rst:371 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -616,7 +627,7 @@ msgid "" "presented with a wrong Authentication scheme." msgstr "" -#: ../../library/urllib.request.rst:379 ../../library/urllib.request.rst:413 +#: ../../library/urllib.request.rst:380 ../../library/urllib.request.rst:414 msgid "" "Handle authentication with the proxy. *password_mgr*, if given, should be " "something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -624,7 +635,7 @@ msgid "" "be supported." msgstr "" -#: ../../library/urllib.request.rst:387 +#: ../../library/urllib.request.rst:388 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -632,7 +643,7 @@ msgid "" "`http-password-mgr` for information on the interface that must be supported." msgstr "" -#: ../../library/urllib.request.rst:396 +#: ../../library/urllib.request.rst:397 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -645,108 +656,108 @@ msgid "" "Digest or Basic." msgstr "" -#: ../../library/urllib.request.rst:406 +#: ../../library/urllib.request.rst:407 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." msgstr "" -#: ../../library/urllib.request.rst:421 +#: ../../library/urllib.request.rst:422 msgid "A class to handle opening of HTTP URLs." msgstr "" -#: ../../library/urllib.request.rst:426 +#: ../../library/urllib.request.rst:427 msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -#: ../../library/urllib.request.rst:429 +#: ../../library/urllib.request.rst:430 msgid "*context* and *check_hostname* were added." msgstr "新增 *context* 與 *check_hostname*\\ 。" -#: ../../library/urllib.request.rst:435 +#: ../../library/urllib.request.rst:436 msgid "Open local files." msgstr "" -#: ../../library/urllib.request.rst:439 +#: ../../library/urllib.request.rst:440 msgid "Open data URLs." msgstr "" -#: ../../library/urllib.request.rst:445 +#: ../../library/urllib.request.rst:446 msgid "Open FTP URLs." msgstr "" -#: ../../library/urllib.request.rst:450 +#: ../../library/urllib.request.rst:451 msgid "" "Open FTP URLs, keeping a cache of open FTP connections to minimize delays." msgstr "" -#: ../../library/urllib.request.rst:455 +#: ../../library/urllib.request.rst:456 msgid "A catch-all class to handle unknown URLs." msgstr "" -#: ../../library/urllib.request.rst:460 ../../library/urllib.request.rst:1156 +#: ../../library/urllib.request.rst:461 ../../library/urllib.request.rst:1167 msgid "Process HTTP error responses." msgstr "" -#: ../../library/urllib.request.rst:466 +#: ../../library/urllib.request.rst:467 msgid "Request Objects" msgstr "" -#: ../../library/urllib.request.rst:468 +#: ../../library/urllib.request.rst:469 msgid "" "The following methods describe :class:`Request`'s public interface, and so " "all may be overridden in subclasses. It also defines several public " "attributes that can be used by clients to inspect the parsed request." msgstr "" -#: ../../library/urllib.request.rst:475 +#: ../../library/urllib.request.rst:476 msgid "The original URL passed to the constructor." msgstr "" -#: ../../library/urllib.request.rst:479 +#: ../../library/urllib.request.rst:480 msgid "" "Request.full_url is a property with setter, getter and a deleter. Getting :" "attr:`~Request.full_url` returns the original request URL with the fragment, " "if it was present." msgstr "" -#: ../../library/urllib.request.rst:485 +#: ../../library/urllib.request.rst:486 msgid "The URI scheme." msgstr "" -#: ../../library/urllib.request.rst:489 +#: ../../library/urllib.request.rst:490 msgid "" "The URI authority, typically a host, but may also contain a port separated " "by a colon." msgstr "" -#: ../../library/urllib.request.rst:494 +#: ../../library/urllib.request.rst:495 msgid "The original host for the request, without port." msgstr "" -#: ../../library/urllib.request.rst:498 +#: ../../library/urllib.request.rst:499 msgid "" "The URI path. If the :class:`Request` uses a proxy, then selector will be " "the full URL that is passed to the proxy." msgstr "" -#: ../../library/urllib.request.rst:503 +#: ../../library/urllib.request.rst:504 msgid "The entity body for the request, or ``None`` if not specified." msgstr "" -#: ../../library/urllib.request.rst:505 +#: ../../library/urllib.request.rst:506 msgid "" "Changing value of :attr:`Request.data` now deletes \"Content-Length\" header " "if it was previously set or calculated." msgstr "" -#: ../../library/urllib.request.rst:511 +#: ../../library/urllib.request.rst:512 msgid "" "boolean, indicates whether the request is unverifiable as defined by :rfc:" "`2965`." msgstr "" -#: ../../library/urllib.request.rst:516 +#: ../../library/urllib.request.rst:517 msgid "" "The HTTP request method to use. By default its value is :const:`None`, " "which means that :meth:`~Request.get_method` will do its normal computation " @@ -757,13 +768,13 @@ msgid "" "argument." msgstr "" -#: ../../library/urllib.request.rst:526 +#: ../../library/urllib.request.rst:527 msgid "" "A default value can now be set in subclasses; previously it could only be " "set via the constructor argument." msgstr "" -#: ../../library/urllib.request.rst:533 +#: ../../library/urllib.request.rst:534 msgid "" "Return a string indicating the HTTP request method. If :attr:`Request." "method` is not ``None``, return its value, otherwise return ``'GET'`` if :" @@ -771,11 +782,11 @@ msgid "" "meaningful for HTTP requests." msgstr "" -#: ../../library/urllib.request.rst:538 +#: ../../library/urllib.request.rst:539 msgid "get_method now looks at the value of :attr:`Request.method`." msgstr "" -#: ../../library/urllib.request.rst:544 +#: ../../library/urllib.request.rst:545 msgid "" "Add another header to the request. Headers are currently ignored by all " "handlers except HTTP handlers, where they are added to the list of headers " @@ -787,64 +798,64 @@ msgid "" "headers added using this method are also added to redirected requests." msgstr "" -#: ../../library/urllib.request.rst:556 +#: ../../library/urllib.request.rst:557 msgid "Add a header that will not be added to a redirected request." msgstr "" -#: ../../library/urllib.request.rst:561 +#: ../../library/urllib.request.rst:562 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -#: ../../library/urllib.request.rst:567 +#: ../../library/urllib.request.rst:568 msgid "" "Remove named header from the request instance (both from regular and " "unredirected headers)." msgstr "" -#: ../../library/urllib.request.rst:575 +#: ../../library/urllib.request.rst:576 msgid "Return the URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:579 +#: ../../library/urllib.request.rst:580 msgid "Returns :attr:`Request.full_url`" msgstr "" -#: ../../library/urllib.request.rst:584 +#: ../../library/urllib.request.rst:585 msgid "" "Prepare the request by connecting to a proxy server. The *host* and *type* " "will replace those of the instance, and the instance's selector will be the " "original URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:591 +#: ../../library/urllib.request.rst:592 msgid "" "Return the value of the given header. If the header is not present, return " "the default value." msgstr "" -#: ../../library/urllib.request.rst:597 +#: ../../library/urllib.request.rst:598 msgid "" "Return a list of tuples (header_name, header_value) of the Request headers." msgstr "" -#: ../../library/urllib.request.rst:599 +#: ../../library/urllib.request.rst:600 msgid "" "The request methods add_data, has_data, get_data, get_type, get_host, " "get_selector, get_origin_req_host and is_unverifiable that were deprecated " "since 3.3 have been removed." msgstr "" -#: ../../library/urllib.request.rst:608 +#: ../../library/urllib.request.rst:609 msgid "OpenerDirector Objects" msgstr "OpenerDirector 物件" -#: ../../library/urllib.request.rst:610 +#: ../../library/urllib.request.rst:611 msgid ":class:`OpenerDirector` instances have the following methods:" msgstr "" -#: ../../library/urllib.request.rst:615 +#: ../../library/urllib.request.rst:616 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " @@ -855,53 +866,53 @@ msgid "" "`http_error_404` would handle HTTP 404 errors." msgstr "" -#: ../../library/urllib.request.rst:623 +#: ../../library/urllib.request.rst:624 msgid "" ":meth:`_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" -#: ../../library/urllib.request.rst:626 +#: ../../library/urllib.request.rst:627 msgid "See |protocol_open|_ for more information." msgstr "更多資訊請見 |protocol_open|_\\ 。" -#: ../../library/urllib.request.rst:628 +#: ../../library/urllib.request.rst:629 msgid "" ":meth:`http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" -#: ../../library/urllib.request.rst:631 +#: ../../library/urllib.request.rst:632 msgid "See |http_error_nnn|_ for more information." msgstr "更多資訊請見 |http_error_nnn|_\\ 。" -#: ../../library/urllib.request.rst:633 +#: ../../library/urllib.request.rst:634 msgid "" ":meth:`_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" -#: ../../library/urllib.request.rst:636 +#: ../../library/urllib.request.rst:637 msgid "" ":meth:`_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" -#: ../../library/urllib.request.rst:639 +#: ../../library/urllib.request.rst:640 msgid "See |protocol_request|_ for more information." msgstr "更多資訊請見 |protocol_request|_\\ 。" -#: ../../library/urllib.request.rst:641 +#: ../../library/urllib.request.rst:642 msgid "" ":meth:`_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" -#: ../../library/urllib.request.rst:644 +#: ../../library/urllib.request.rst:645 msgid "See |protocol_response|_ for more information." msgstr "更多資訊請見 |protocol_response|_\\ 。" -#: ../../library/urllib.request.rst:653 +#: ../../library/urllib.request.rst:654 msgid "" "Open the given *url* (which can be a request object or a string), optionally " "passing the given *data*. Arguments, return values and exceptions raised are " @@ -913,7 +924,7 @@ msgid "" "HTTP, HTTPS and FTP connections." msgstr "" -#: ../../library/urllib.request.rst:665 +#: ../../library/urllib.request.rst:666 msgid "" "Handle an error of the given protocol. This will call the registered error " "handlers for the given protocol with the given arguments (which are protocol " @@ -922,28 +933,28 @@ msgid "" "\\` methods of the handler classes." msgstr "" -#: ../../library/urllib.request.rst:671 +#: ../../library/urllib.request.rst:672 msgid "" "Return values and exceptions raised are the same as those of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:673 +#: ../../library/urllib.request.rst:674 msgid "OpenerDirector objects open URLs in three stages:" msgstr "" -#: ../../library/urllib.request.rst:675 +#: ../../library/urllib.request.rst:676 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -#: ../../library/urllib.request.rst:678 +#: ../../library/urllib.request.rst:679 msgid "" "Every handler with a method named like :meth:`_request` has that " "method called to pre-process the request." msgstr "" -#: ../../library/urllib.request.rst:681 +#: ../../library/urllib.request.rst:682 msgid "" "Handlers with a method named like :meth:`_open` are called to " "handle the request. This stage ends when a handler either returns a non-\\ :" @@ -951,7 +962,7 @@ msgid "" "`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" -#: ../../library/urllib.request.rst:686 +#: ../../library/urllib.request.rst:687 msgid "" "In fact, the above algorithm is first tried for methods named :meth:" "`default_open`. If all such methods return :const:`None`, the algorithm is " @@ -960,64 +971,64 @@ msgid "" "meth:`unknown_open`." msgstr "" -#: ../../library/urllib.request.rst:692 +#: ../../library/urllib.request.rst:693 msgid "" "Note that the implementation of these methods may involve calls of the " "parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" "meth:`~OpenerDirector.error` methods." msgstr "" -#: ../../library/urllib.request.rst:696 +#: ../../library/urllib.request.rst:697 msgid "" "Every handler with a method named like :meth:`_response` has that " "method called to post-process the response." msgstr "" -#: ../../library/urllib.request.rst:703 +#: ../../library/urllib.request.rst:704 msgid "BaseHandler Objects" msgstr "BaseHandler 物件" -#: ../../library/urllib.request.rst:705 +#: ../../library/urllib.request.rst:706 msgid "" ":class:`BaseHandler` objects provide a couple of methods that are directly " "useful, and others that are meant to be used by derived classes. These are " "intended for direct use:" msgstr "" -#: ../../library/urllib.request.rst:712 +#: ../../library/urllib.request.rst:713 msgid "Add a director as parent." msgstr "" -#: ../../library/urllib.request.rst:717 +#: ../../library/urllib.request.rst:718 msgid "Remove any parents." msgstr "" -#: ../../library/urllib.request.rst:719 +#: ../../library/urllib.request.rst:720 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -#: ../../library/urllib.request.rst:724 +#: ../../library/urllib.request.rst:725 msgid "" "The convention has been adopted that subclasses defining :meth:" "`_request` or :meth:`_response` methods are named :class:" "`\\*Processor`; all others are named :class:`\\*Handler`." msgstr "" -#: ../../library/urllib.request.rst:731 +#: ../../library/urllib.request.rst:732 msgid "" "A valid :class:`OpenerDirector`, which can be used to open using a different " "protocol, or handle errors." msgstr "" -#: ../../library/urllib.request.rst:737 +#: ../../library/urllib.request.rst:738 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs." msgstr "" -#: ../../library/urllib.request.rst:740 +#: ../../library/urllib.request.rst:741 msgid "" "This method, if implemented, will be called by the parent :class:" "`OpenerDirector`. It should return a file-like object as described in the " @@ -1027,38 +1038,38 @@ msgid "" "`MemoryError` should not be mapped to :exc:`URLError`)." msgstr "" -#: ../../library/urllib.request.rst:747 +#: ../../library/urllib.request.rst:748 msgid "This method will be called before any protocol-specific open method." msgstr "" -#: ../../library/urllib.request.rst:754 +#: ../../library/urllib.request.rst:755 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to handle URLs with the given protocol." msgstr "" -#: ../../library/urllib.request.rst:757 +#: ../../library/urllib.request.rst:758 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`default_open`." msgstr "" -#: ../../library/urllib.request.rst:763 +#: ../../library/urllib.request.rst:764 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs with no specific registered handler " "to open it." msgstr "" -#: ../../library/urllib.request.rst:767 +#: ../../library/urllib.request.rst:768 msgid "" "This method, if implemented, will be called by the :attr:`parent` :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`default_open`." msgstr "" -#: ../../library/urllib.request.rst:774 +#: ../../library/urllib.request.rst:775 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " @@ -1067,7 +1078,7 @@ msgid "" "other circumstances." msgstr "" -#: ../../library/urllib.request.rst:779 +#: ../../library/urllib.request.rst:780 msgid "" "*req* will be a :class:`Request` object, *fp* will be a file-like object " "with the HTTP error body, *code* will be the three-digit code of the error, " @@ -1075,49 +1086,49 @@ msgid "" "mapping object with the headers of the error." msgstr "" -#: ../../library/urllib.request.rst:784 +#: ../../library/urllib.request.rst:785 msgid "" "Return values and exceptions raised should be the same as those of :func:" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:791 +#: ../../library/urllib.request.rst:792 msgid "" "*nnn* should be a three-digit HTTP error code. This method is also not " "defined in :class:`BaseHandler`, but will be called, if it exists, on an " "instance of a subclass, when an HTTP error with code *nnn* occurs." msgstr "" -#: ../../library/urllib.request.rst:795 +#: ../../library/urllib.request.rst:796 msgid "Subclasses should override this method to handle specific HTTP errors." msgstr "" -#: ../../library/urllib.request.rst:797 +#: ../../library/urllib.request.rst:798 msgid "" "Arguments, return values and exceptions raised should be the same as for :" "meth:`http_error_default`." msgstr "" -#: ../../library/urllib.request.rst:805 +#: ../../library/urllib.request.rst:806 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to pre-process requests of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:808 +#: ../../library/urllib.request.rst:809 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. The return value " "should be a :class:`Request` object." msgstr "" -#: ../../library/urllib.request.rst:817 +#: ../../library/urllib.request.rst:818 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:820 +#: ../../library/urllib.request.rst:821 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " @@ -1126,25 +1137,25 @@ msgid "" "return value of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:830 +#: ../../library/urllib.request.rst:831 msgid "HTTPRedirectHandler Objects" msgstr "HTTPRedirectHandler 物件" -#: ../../library/urllib.request.rst:834 +#: ../../library/urllib.request.rst:835 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -#: ../../library/urllib.request.rst:838 +#: ../../library/urllib.request.rst:839 msgid "" "An :class:`HTTPError` exception raised as a security consideration if the " "HTTPRedirectHandler is presented with a redirected URL which is not an HTTP, " "HTTPS or FTP URL." msgstr "" -#: ../../library/urllib.request.rst:845 +#: ../../library/urllib.request.rst:846 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`http_error_30\\*` " @@ -1155,7 +1166,7 @@ msgid "" "URL, or return ``None`` if you can't but another handler might." msgstr "" -#: ../../library/urllib.request.rst:855 +#: ../../library/urllib.request.rst:856 msgid "" "The default implementation of this method does not strictly follow :rfc:" "`2616`, which says that 301 and 302 responses to ``POST`` requests must not " @@ -1164,46 +1175,54 @@ msgid "" "POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" -#: ../../library/urllib.request.rst:864 +#: ../../library/urllib.request.rst:865 msgid "" "Redirect to the ``Location:`` or ``URI:`` URL. This method is called by the " "parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' " "response." msgstr "" -#: ../../library/urllib.request.rst:870 +#: ../../library/urllib.request.rst:871 msgid "" "The same as :meth:`http_error_301`, but called for the 'found' response." msgstr "" -#: ../../library/urllib.request.rst:875 +#: ../../library/urllib.request.rst:876 msgid "" "The same as :meth:`http_error_301`, but called for the 'see other' response." msgstr "" -#: ../../library/urllib.request.rst:880 +#: ../../library/urllib.request.rst:881 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " -"response." +"response. It does not allow changing the request method from ``POST`` to " +"``GET``." +msgstr "" + +#: ../../library/urllib.request.rst:888 +msgid "" +"The same as :meth:`http_error_301`, but called for the 'permanent redirect' " +"response. It does not allow changing the request method from ``POST`` to " +"``GET``." msgstr "" -#: ../../library/urllib.request.rst:887 +#: ../../library/urllib.request.rst:898 msgid "HTTPCookieProcessor Objects" msgstr "HTTPCookieProcessor 物件" -#: ../../library/urllib.request.rst:889 +#: ../../library/urllib.request.rst:900 msgid ":class:`HTTPCookieProcessor` instances have one attribute:" msgstr "" -#: ../../library/urllib.request.rst:893 +#: ../../library/urllib.request.rst:904 msgid "The :class:`http.cookiejar.CookieJar` in which cookies are stored." msgstr "" -#: ../../library/urllib.request.rst:899 +#: ../../library/urllib.request.rst:910 msgid "ProxyHandler Objects" msgstr "ProxyHandler 物件" -#: ../../library/urllib.request.rst:905 +#: ../../library/urllib.request.rst:916 msgid "" "The :class:`ProxyHandler` will have a method :meth:`_open` for " "every *protocol* which has a proxy in the *proxies* dictionary given in the " @@ -1212,17 +1231,17 @@ msgid "" "actually execute the protocol." msgstr "" -#: ../../library/urllib.request.rst:915 +#: ../../library/urllib.request.rst:926 msgid "HTTPPasswordMgr Objects" msgstr "HTTPPasswordMgr 物件" -#: ../../library/urllib.request.rst:917 +#: ../../library/urllib.request.rst:928 msgid "" "These methods are available on :class:`HTTPPasswordMgr` and :class:" "`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -#: ../../library/urllib.request.rst:923 +#: ../../library/urllib.request.rst:934 msgid "" "*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and " "*passwd* must be strings. This causes ``(user, passwd)`` to be used as " @@ -1230,30 +1249,30 @@ msgid "" "of the given URIs is given." msgstr "" -#: ../../library/urllib.request.rst:931 +#: ../../library/urllib.request.rst:942 msgid "" "Get user/password for given realm and URI, if any. This method will return " "``(None, None)`` if there is no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:934 +#: ../../library/urllib.request.rst:945 msgid "" "For :class:`HTTPPasswordMgrWithDefaultRealm` objects, the realm ``None`` " "will be searched if the given *realm* has no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:941 +#: ../../library/urllib.request.rst:952 msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "HTTPPasswordMgrWithPriorAuth 物件" -#: ../../library/urllib.request.rst:943 +#: ../../library/urllib.request.rst:954 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" -#: ../../library/urllib.request.rst:950 +#: ../../library/urllib.request.rst:961 msgid "" "*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." "add_password`. *is_authenticated* sets the initial value of the " @@ -1261,25 +1280,25 @@ msgid "" "*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" -#: ../../library/urllib.request.rst:958 +#: ../../library/urllib.request.rst:969 msgid "Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects" msgstr "" -#: ../../library/urllib.request.rst:964 +#: ../../library/urllib.request.rst:975 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -#: ../../library/urllib.request.rst:970 +#: ../../library/urllib.request.rst:981 msgid "" "Returns the current state of the ``is_authenticated`` flag for the given URI." msgstr "" -#: ../../library/urllib.request.rst:977 +#: ../../library/urllib.request.rst:988 msgid "AbstractBasicAuthHandler Objects" msgstr "AbstractBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:982 +#: ../../library/urllib.request.rst:993 msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " @@ -1288,7 +1307,7 @@ msgid "" "`Request` object, and *headers* should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:988 +#: ../../library/urllib.request.rst:999 msgid "" "*host* is either an authority (e.g. ``\"python.org\"``) or a URL containing " "an authority component (e.g. ``\"http://python.org/\"``). In either case, " @@ -1296,24 +1315,24 @@ msgid "" "and ``\"python.org:80\"`` are fine, ``\"joe:password@python.org\"`` is not)." msgstr "" -#: ../../library/urllib.request.rst:997 +#: ../../library/urllib.request.rst:1008 msgid "HTTPBasicAuthHandler Objects" msgstr "HTTPBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1002 ../../library/urllib.request.rst:1013 -#: ../../library/urllib.request.rst:1038 ../../library/urllib.request.rst:1049 +#: ../../library/urllib.request.rst:1013 ../../library/urllib.request.rst:1024 +#: ../../library/urllib.request.rst:1049 ../../library/urllib.request.rst:1060 msgid "Retry the request with authentication information, if available." msgstr "" -#: ../../library/urllib.request.rst:1008 +#: ../../library/urllib.request.rst:1019 msgid "ProxyBasicAuthHandler Objects" msgstr "ProxyBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1019 +#: ../../library/urllib.request.rst:1030 msgid "AbstractDigestAuthHandler Objects" msgstr "AbstractDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1024 +#: ../../library/urllib.request.rst:1035 msgid "" "*authreq* should be the name of the header where the information about the " "realm is included in the request, *host* should be the host to authenticate " @@ -1321,55 +1340,55 @@ msgid "" "should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1033 +#: ../../library/urllib.request.rst:1044 msgid "HTTPDigestAuthHandler Objects" msgstr "HTTPDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1044 +#: ../../library/urllib.request.rst:1055 msgid "ProxyDigestAuthHandler Objects" msgstr "ProxyDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1055 +#: ../../library/urllib.request.rst:1066 msgid "HTTPHandler Objects" msgstr "HTTPHandler 物件" -#: ../../library/urllib.request.rst:1060 +#: ../../library/urllib.request.rst:1071 msgid "" "Send an HTTP request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1067 +#: ../../library/urllib.request.rst:1078 msgid "HTTPSHandler Objects" msgstr "HTTPSHandler 物件" -#: ../../library/urllib.request.rst:1072 +#: ../../library/urllib.request.rst:1083 msgid "" "Send an HTTPS request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1079 +#: ../../library/urllib.request.rst:1090 msgid "FileHandler Objects" msgstr "FileHandler 物件" -#: ../../library/urllib.request.rst:1084 +#: ../../library/urllib.request.rst:1095 msgid "" "Open the file locally, if there is no host name, or the host name is " "``'localhost'``." msgstr "" -#: ../../library/urllib.request.rst:1087 +#: ../../library/urllib.request.rst:1098 msgid "" "This method is applicable only for local hostnames. When a remote hostname " "is given, an :exc:`~urllib.error.URLError` is raised." msgstr "" -#: ../../library/urllib.request.rst:1095 +#: ../../library/urllib.request.rst:1106 msgid "DataHandler Objects" msgstr "DataHandler 物件" -#: ../../library/urllib.request.rst:1099 +#: ../../library/urllib.request.rst:1110 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " @@ -1379,51 +1398,51 @@ msgid "" "implementation will raise an :exc:`ValueError` in that case." msgstr "" -#: ../../library/urllib.request.rst:1110 +#: ../../library/urllib.request.rst:1121 msgid "FTPHandler Objects" msgstr "FTPHandler 物件" -#: ../../library/urllib.request.rst:1115 +#: ../../library/urllib.request.rst:1126 msgid "" "Open the FTP file indicated by *req*. The login is always done with empty " "username and password." msgstr "" -#: ../../library/urllib.request.rst:1122 +#: ../../library/urllib.request.rst:1133 msgid "CacheFTPHandler Objects" msgstr "CacheFTPHandler 物件" -#: ../../library/urllib.request.rst:1124 +#: ../../library/urllib.request.rst:1135 msgid "" ":class:`CacheFTPHandler` objects are :class:`FTPHandler` objects with the " "following additional methods:" msgstr "" -#: ../../library/urllib.request.rst:1130 +#: ../../library/urllib.request.rst:1141 msgid "Set timeout of connections to *t* seconds." msgstr "" -#: ../../library/urllib.request.rst:1135 +#: ../../library/urllib.request.rst:1146 msgid "Set maximum number of cached connections to *m*." msgstr "" -#: ../../library/urllib.request.rst:1141 +#: ../../library/urllib.request.rst:1152 msgid "UnknownHandler Objects" msgstr "UnknownHandler 物件" -#: ../../library/urllib.request.rst:1146 +#: ../../library/urllib.request.rst:1157 msgid "Raise a :exc:`~urllib.error.URLError` exception." msgstr "" -#: ../../library/urllib.request.rst:1152 +#: ../../library/urllib.request.rst:1163 msgid "HTTPErrorProcessor Objects" msgstr "HTTPErrorProcessor 物件" -#: ../../library/urllib.request.rst:1158 +#: ../../library/urllib.request.rst:1169 msgid "For 200 error codes, the response object is returned immediately." msgstr "" -#: ../../library/urllib.request.rst:1160 +#: ../../library/urllib.request.rst:1171 msgid "" "For non-200 error codes, this simply passes the job on to the :meth:" "`http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " @@ -1431,31 +1450,31 @@ msgid "" "error.HTTPError` if no other handler handles the error." msgstr "" -#: ../../library/urllib.request.rst:1168 +#: ../../library/urllib.request.rst:1179 msgid "Process HTTPS error responses." msgstr "" -#: ../../library/urllib.request.rst:1170 +#: ../../library/urllib.request.rst:1181 msgid "The behavior is same as :meth:`http_response`." msgstr "" -#: ../../library/urllib.request.rst:1176 +#: ../../library/urllib.request.rst:1187 msgid "Examples" msgstr "" -#: ../../library/urllib.request.rst:1178 +#: ../../library/urllib.request.rst:1189 msgid "" "In addition to the examples below, more examples are given in :ref:`urllib-" "howto`." msgstr "" -#: ../../library/urllib.request.rst:1181 +#: ../../library/urllib.request.rst:1192 msgid "" "This example gets the python.org main page and displays the first 300 bytes " "of it. ::" msgstr "" -#: ../../library/urllib.request.rst:1194 +#: ../../library/urllib.request.rst:1205 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1464,45 +1483,45 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1200 +#: ../../library/urllib.request.rst:1211 msgid "" "The following W3C document, https://www.w3.org/International/O-charset\\ , " "lists the various ways in which an (X)HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1204 +#: ../../library/urllib.request.rst:1215 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " "tag, we will use the same for decoding the bytes object. ::" msgstr "" -#: ../../library/urllib.request.rst:1213 +#: ../../library/urllib.request.rst:1224 msgid "" "It is also possible to achieve the same result without using the :term:" "`context manager` approach. ::" msgstr "" -#: ../../library/urllib.request.rst:1222 +#: ../../library/urllib.request.rst:1233 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1234 +#: ../../library/urllib.request.rst:1245 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1241 +#: ../../library/urllib.request.rst:1252 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1251 +#: ../../library/urllib.request.rst:1262 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1265 +#: ../../library/urllib.request.rst:1276 msgid "" ":func:`build_opener` provides many handlers by default, including a :class:" "`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " @@ -1511,71 +1530,71 @@ msgid "" "read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1271 +#: ../../library/urllib.request.rst:1282 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1283 +#: ../../library/urllib.request.rst:1294 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1285 +#: ../../library/urllib.request.rst:1296 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1294 +#: ../../library/urllib.request.rst:1305 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1302 +#: ../../library/urllib.request.rst:1313 msgid "" "Also, remember that a few standard headers (:mailheader:`Content-Length`, :" "mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" "`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1309 +#: ../../library/urllib.request.rst:1320 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1320 +#: ../../library/urllib.request.rst:1331 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1331 +#: ../../library/urllib.request.rst:1342 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1341 +#: ../../library/urllib.request.rst:1352 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1351 +#: ../../library/urllib.request.rst:1362 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1353 +#: ../../library/urllib.request.rst:1364 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1359 +#: ../../library/urllib.request.rst:1370 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " @@ -1585,7 +1604,7 @@ msgid "" "remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1366 +#: ../../library/urllib.request.rst:1377 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1597,11 +1616,11 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1375 +#: ../../library/urllib.request.rst:1386 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1382 +#: ../../library/urllib.request.rst:1393 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1610,7 +1629,7 @@ msgid "" "parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1388 +#: ../../library/urllib.request.rst:1399 msgid "" ":func:`urlretrieve` will raise :exc:`ContentTooShortError` when it detects " "that the amount of data available was less than the expected amount (which " @@ -1618,40 +1637,40 @@ msgid "" "example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1393 +#: ../../library/urllib.request.rst:1404 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1397 +#: ../../library/urllib.request.rst:1408 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1400 +#: ../../library/urllib.request.rst:1411 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1406 +#: ../../library/urllib.request.rst:1417 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1413 +#: ../../library/urllib.request.rst:1424 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " "objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" "`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1417 +#: ../../library/urllib.request.rst:1428 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1661,7 +1680,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1423 +#: ../../library/urllib.request.rst:1434 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1669,7 +1688,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1428 +#: ../../library/urllib.request.rst:1439 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1677,13 +1696,13 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1433 +#: ../../library/urllib.request.rst:1444 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1438 +#: ../../library/urllib.request.rst:1449 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " @@ -1692,15 +1711,15 @@ msgid "" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1444 +#: ../../library/urllib.request.rst:1455 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1448 +#: ../../library/urllib.request.rst:1459 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1453 +#: ../../library/urllib.request.rst:1464 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " "value is a tuple consisting of a local filename and either an :class:`email." @@ -1717,7 +1736,7 @@ msgid "" "*reporthook* is ignored for local URLs." msgstr "" -#: ../../library/urllib.request.rst:1466 +#: ../../library/urllib.request.rst:1477 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1726,7 +1745,7 @@ msgid "" "urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1475 +#: ../../library/urllib.request.rst:1486 msgid "" "Variable that specifies the user agent of the opener object. To get :mod:" "`urllib` to tell servers that it is a particular user agent, set this in a " @@ -1734,7 +1753,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/urllib.request.rst:1485 +#: ../../library/urllib.request.rst:1496 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -1745,14 +1764,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1492 +#: ../../library/urllib.request.rst:1503 msgid "" "For all other response codes, the method :meth:`http_error_default` is " "called which you can override in subclasses to handle the error " "appropriately." msgstr "" -#: ../../library/urllib.request.rst:1497 +#: ../../library/urllib.request.rst:1508 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -1761,13 +1780,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1502 +#: ../../library/urllib.request.rst:1513 msgid "" "The parameters to the constructor are the same as those for :class:" "`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1506 +#: ../../library/urllib.request.rst:1517 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -1776,59 +1795,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1511 +#: ../../library/urllib.request.rst:1522 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1516 +#: ../../library/urllib.request.rst:1527 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1520 +#: ../../library/urllib.request.rst:1531 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1526 +#: ../../library/urllib.request.rst:1537 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1532 +#: ../../library/urllib.request.rst:1543 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1535 +#: ../../library/urllib.request.rst:1546 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1537 +#: ../../library/urllib.request.rst:1548 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1540 +#: ../../library/urllib.request.rst:1551 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1542 +#: ../../library/urllib.request.rst:1553 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1546 +#: ../../library/urllib.request.rst:1557 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -1836,7 +1855,7 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1555 +#: ../../library/urllib.request.rst:1566 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " @@ -1846,7 +1865,7 @@ msgid "" "module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1564 +#: ../../library/urllib.request.rst:1575 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -1864,11 +1883,11 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1581 +#: ../../library/urllib.request.rst:1592 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1586 +#: ../../library/urllib.request.rst:1597 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " @@ -1877,30 +1896,30 @@ msgid "" "addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1595 +#: ../../library/urllib.request.rst:1606 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1599 +#: ../../library/urllib.request.rst:1610 msgid "" "Returns the headers of the response in the form of an :class:`~email.message." "EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1605 +#: ../../library/urllib.request.rst:1616 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1609 +#: ../../library/urllib.request.rst:1620 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1614 +#: ../../library/urllib.request.rst:1625 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1619 ../../library/urllib.request.rst:1624 +#: ../../library/urllib.request.rst:1630 ../../library/urllib.request.rst:1635 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" diff --git a/library/uu.po b/library/uu.po index 8b44197852..fee8b5f3f4 100644 --- a/library/uu.po +++ b/library/uu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-05-22 02:22+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr ":mod:`xdrlib` --- uuencode 檔案的編碼與解碼" msgid "**Source code:** :source:`Lib/uu.py`" msgstr "**原始碼:**\\ :source:`Lib/uu.py`" -#: ../../library/uu.rst:12 +#: ../../library/uu.rst:16 msgid "" "The :mod:`uu` module is deprecated (see :pep:`PEP 594 <594#uu-and-the-uu-" "encoding>` for details). :mod:`base64` is a modern alternative." diff --git a/library/venv.po b/library/venv.po index 4765415096..b4fbf159ce 100644 --- a/library/venv.po +++ b/library/venv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-11 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,7 +47,18 @@ msgid "" "environments/#creating-a-virtual-environment>`__" msgstr "" -#: ../../library/venv.rst:34 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/venv.rst:35 msgid "Creating virtual environments" msgstr "" @@ -270,7 +281,7 @@ msgid "" "support." msgstr "" -#: ../../library/venv.rst:41 +#: ../../library/venv.rst:42 msgid "" "A virtual environment is a Python environment such that the Python " "interpreter, libraries and scripts installed into it are isolated from those " @@ -279,13 +290,13 @@ msgid "" "your operating system." msgstr "" -#: ../../library/venv.rst:47 +#: ../../library/venv.rst:48 msgid "" "A virtual environment is a directory tree which contains Python executable " "files and other files which indicate that it is a virtual environment." msgstr "" -#: ../../library/venv.rst:50 +#: ../../library/venv.rst:51 msgid "" "Common installation tools such as setuptools_ and pip_ work as expected with " "virtual environments. In other words, when a virtual environment is active, " @@ -293,7 +304,7 @@ msgid "" "be told to do so explicitly." msgstr "" -#: ../../library/venv.rst:55 +#: ../../library/venv.rst:56 msgid "" "When a virtual environment is active (i.e., the virtual environment's Python " "interpreter is running), the attributes :attr:`sys.prefix` and :attr:`sys." @@ -306,7 +317,7 @@ msgid "" "environment Python installation)." msgstr "" -#: ../../library/venv.rst:66 +#: ../../library/venv.rst:67 msgid "" "When a virtual environment is active, any options that change the " "installation path will be ignored from all :mod:`distutils` configuration " @@ -314,7 +325,7 @@ msgid "" "virtual environment." msgstr "" -#: ../../library/venv.rst:71 +#: ../../library/venv.rst:72 msgid "" "When working in a command shell, users can make a virtual environment active " "by running an ``activate`` script in the virtual environment's executables " @@ -333,7 +344,7 @@ msgid "" "environment in ``PATH``." msgstr "" -#: ../../library/venv.rst:87 +#: ../../library/venv.rst:88 msgid "" "Because scripts installed in environments should not expect the environment " "to be activated, their shebang lines contain the absolute paths to their " @@ -349,11 +360,11 @@ msgid "" "Otherwise, software installed into the environment may not work as expected." msgstr "" -#: ../../library/venv.rst:104 +#: ../../library/venv.rst:105 msgid "API" msgstr "API" -#: ../../library/venv.rst:108 +#: ../../library/venv.rst:109 msgid "" "The high-level method described above makes use of a simple API which " "provides mechanisms for third-party virtual environment creators to " @@ -361,46 +372,46 @@ msgid "" "`EnvBuilder` class." msgstr "" -#: ../../library/venv.rst:116 +#: ../../library/venv.rst:117 msgid "" "The :class:`EnvBuilder` class accepts the following keyword arguments on " "instantiation:" msgstr "" -#: ../../library/venv.rst:119 +#: ../../library/venv.rst:120 msgid "" "``system_site_packages`` -- a Boolean value indicating that the system " "Python site-packages should be available to the environment (defaults to " "``False``)." msgstr "" -#: ../../library/venv.rst:122 +#: ../../library/venv.rst:123 msgid "" "``clear`` -- a Boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." msgstr "" -#: ../../library/venv.rst:125 +#: ../../library/venv.rst:126 msgid "" "``symlinks`` -- a Boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." msgstr "" -#: ../../library/venv.rst:128 +#: ../../library/venv.rst:129 msgid "" "``upgrade`` -- a Boolean value which, if true, will upgrade an existing " "environment with the running Python - for use when that Python has been " "upgraded in-place (defaults to ``False``)." msgstr "" -#: ../../library/venv.rst:132 +#: ../../library/venv.rst:133 msgid "" "``with_pip`` -- a Boolean value which, if true, ensures pip is installed in " "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" "pip`` option." msgstr "" -#: ../../library/venv.rst:136 +#: ../../library/venv.rst:137 msgid "" "``prompt`` -- a String to be used after virtual environment is activated " "(defaults to ``None`` which means directory name of the environment would be " @@ -408,33 +419,33 @@ msgid "" "current directory is used as the prompt." msgstr "" -#: ../../library/venv.rst:141 +#: ../../library/venv.rst:142 msgid "``upgrade_deps`` -- Update the base venv modules to the latest on PyPI" msgstr "" -#: ../../library/venv.rst:143 ../../library/venv.rst:273 +#: ../../library/venv.rst:144 ../../library/venv.rst:280 msgid "Added the ``with_pip`` parameter" msgstr "新增 ``with_pip`` 參數" -#: ../../library/venv.rst:146 ../../library/venv.rst:276 +#: ../../library/venv.rst:147 ../../library/venv.rst:283 msgid "Added the ``prompt`` parameter" msgstr "新增 ``prompt`` 參數" -#: ../../library/venv.rst:149 ../../library/venv.rst:279 +#: ../../library/venv.rst:150 ../../library/venv.rst:286 msgid "Added the ``upgrade_deps`` parameter" msgstr "新增 ``upgrade_deps`` 參數" -#: ../../library/venv.rst:152 +#: ../../library/venv.rst:153 msgid "" "Creators of third-party virtual environment tools will be free to use the " "provided :class:`EnvBuilder` class as a base class." msgstr "" -#: ../../library/venv.rst:155 +#: ../../library/venv.rst:156 msgid "The returned env-builder is an object which has a method, ``create``:" msgstr "" -#: ../../library/venv.rst:159 +#: ../../library/venv.rst:160 msgid "" "Create a virtual environment by specifying the target directory (absolute or " "relative to the current directory) which is to contain the virtual " @@ -442,33 +453,40 @@ msgid "" "the specified directory, or raise an appropriate exception." msgstr "" -#: ../../library/venv.rst:165 +#: ../../library/venv.rst:166 msgid "" "The ``create`` method of the :class:`EnvBuilder` class illustrates the hooks " "available for subclass customization::" msgstr "" -#: ../../library/venv.rst:180 +#: ../../library/venv.rst:181 msgid "" "Each of the methods :meth:`ensure_directories`, :meth:" "`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" "meth:`post_setup` can be overridden." msgstr "" -#: ../../library/venv.rst:186 +#: ../../library/venv.rst:187 msgid "" -"Creates the environment directory and all necessary directories, and returns " -"a context object. This is just a holder for attributes (such as paths), for " -"use by the other methods. The directories are allowed to exist already, as " -"long as either ``clear`` or ``upgrade`` were specified to allow operating on " -"an existing environment directory." +"Creates the environment directory and all necessary subdirectories that " +"don't already exist, and returns a context object. This context object is " +"just a holder for attributes (such as paths) for use by the other methods. " +"If the :class:`EnvBuilder` is created with the arg ``clear=True``, contents " +"of the environment directory will be cleared and then all necessary " +"subdirectories will be recreated." msgstr "" #: ../../library/venv.rst:194 +msgid "" +"The *venv* :ref:`sysconfig installation scheme ` is used " +"to construct the paths of the created directories." +msgstr "" + +#: ../../library/venv.rst:201 msgid "Creates the ``pyvenv.cfg`` configuration file in the environment." msgstr "" -#: ../../library/venv.rst:198 +#: ../../library/venv.rst:205 msgid "" "Creates a copy or symlink to the Python executable in the environment. On " "POSIX systems, if a specific executable ``python3.x`` was used, symlinks to " @@ -476,48 +494,48 @@ msgid "" "unless files with those names already exist." msgstr "" -#: ../../library/venv.rst:205 +#: ../../library/venv.rst:212 msgid "" "Installs activation scripts appropriate to the platform into the virtual " "environment." msgstr "" -#: ../../library/venv.rst:210 +#: ../../library/venv.rst:217 msgid "" "Upgrades the core venv dependency packages (currently ``pip`` and " "``setuptools``) in the environment. This is done by shelling out to the " "``pip`` executable in the environment." msgstr "" -#: ../../library/venv.rst:218 +#: ../../library/venv.rst:225 msgid "" "A placeholder method which can be overridden in third party implementations " "to pre-install packages in the virtual environment or perform other post-" "creation steps." msgstr "" -#: ../../library/venv.rst:222 +#: ../../library/venv.rst:229 msgid "" "Windows now uses redirector scripts for ``python[w].exe`` instead of copying " "the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " "running from a build in the source tree." msgstr "" -#: ../../library/venv.rst:227 +#: ../../library/venv.rst:234 msgid "" "Windows copies the redirector scripts as part of :meth:`setup_python` " "instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " "symlinks, the original executables will be linked." msgstr "" -#: ../../library/venv.rst:232 +#: ../../library/venv.rst:239 msgid "" "In addition, :class:`EnvBuilder` provides this utility method that can be " "called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to " "assist in installing custom scripts into the virtual environment." msgstr "" -#: ../../library/venv.rst:238 +#: ../../library/venv.rst:245 msgid "" "*path* is the path to a directory that should contain subdirectories \"common" "\", \"posix\", \"nt\", each containing scripts destined for the bin " @@ -526,64 +544,64 @@ msgid "" "placeholders:" msgstr "" -#: ../../library/venv.rst:244 +#: ../../library/venv.rst:251 msgid "" "``__VENV_DIR__`` is replaced with the absolute path of the environment " "directory." msgstr "" -#: ../../library/venv.rst:247 +#: ../../library/venv.rst:254 msgid "" "``__VENV_NAME__`` is replaced with the environment name (final path segment " "of environment directory)." msgstr "" -#: ../../library/venv.rst:250 +#: ../../library/venv.rst:257 msgid "" "``__VENV_PROMPT__`` is replaced with the prompt (the environment name " "surrounded by parentheses and with a following space)" msgstr "" -#: ../../library/venv.rst:253 +#: ../../library/venv.rst:260 msgid "" "``__VENV_BIN_NAME__`` is replaced with the name of the bin directory (either " "``bin`` or ``Scripts``)." msgstr "" -#: ../../library/venv.rst:256 +#: ../../library/venv.rst:263 msgid "" "``__VENV_PYTHON__`` is replaced with the absolute path of the environment's " "executable." msgstr "" -#: ../../library/venv.rst:259 +#: ../../library/venv.rst:266 msgid "" "The directories are allowed to exist (for when an existing environment is " "being upgraded)." msgstr "" -#: ../../library/venv.rst:262 +#: ../../library/venv.rst:269 msgid "There is also a module-level convenience function:" msgstr "" -#: ../../library/venv.rst:268 +#: ../../library/venv.rst:275 msgid "" "Create an :class:`EnvBuilder` with the given keyword arguments, and call " "its :meth:`~EnvBuilder.create` method with the *env_dir* argument." msgstr "" -#: ../../library/venv.rst:283 +#: ../../library/venv.rst:290 msgid "An example of extending ``EnvBuilder``" msgstr "" -#: ../../library/venv.rst:285 +#: ../../library/venv.rst:292 msgid "" "The following script shows how to extend :class:`EnvBuilder` by implementing " "a subclass which installs setuptools and pip into a created virtual " "environment::" msgstr "" -#: ../../library/venv.rst:504 +#: ../../library/venv.rst:511 msgid "" "This script is also available for download `online `_." diff --git a/library/warnings.po b/library/warnings.po index a5ec32eaa9..99f852257a 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -693,10 +693,21 @@ msgid "" "This argument exists primarily for testing the :mod:`warnings` module itself." msgstr "" -#: ../../library/warnings.rst:516 +#: ../../library/warnings.rst:514 +msgid "" +"If the *action* argument is not ``None``, the remaining arguments are passed " +"to :func:`simplefilter` as if it were called immediately on entering the " +"context." +msgstr "" + +#: ../../library/warnings.rst:520 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " "filter specifications. This means the context manager is modifying global " "state and therefore is not thread-safe." msgstr "" + +#: ../../library/warnings.rst:528 +msgid "Added the *action*, *category*, *lineno*, and *append* parameters." +msgstr "" diff --git a/library/weakref.po b/library/weakref.po index d5771159b7..a172e7dd35 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-07 00:10+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,27 +18,27 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../library/weakref.rst:2 +#: ../../library/weakref.rst:4 msgid ":mod:`weakref` --- Weak references" msgstr "" -#: ../../library/weakref.rst:12 +#: ../../library/weakref.rst:14 msgid "**Source code:** :source:`Lib/weakref.py`" msgstr "**原始碼:**\\ :source:`Lib/weakref.py`" -#: ../../library/weakref.rst:16 +#: ../../library/weakref.rst:18 msgid "" "The :mod:`weakref` module allows the Python programmer to create :dfn:`weak " "references` to objects." msgstr "" -#: ../../library/weakref.rst:22 +#: ../../library/weakref.rst:24 msgid "" "In the following, the term :dfn:`referent` means the object which is " "referred to by a weak reference." msgstr "" -#: ../../library/weakref.rst:25 +#: ../../library/weakref.rst:27 msgid "" "A weak reference to an object is not enough to keep the object alive: when " "the only remaining references to a referent are weak references, :term:" @@ -48,14 +48,14 @@ msgid "" "to it." msgstr "" -#: ../../library/weakref.rst:31 +#: ../../library/weakref.rst:33 msgid "" "A primary use for weak references is to implement caches or mappings holding " "large objects, where it's desired that a large object not be kept alive " "solely because it appears in a cache or mapping." msgstr "" -#: ../../library/weakref.rst:35 +#: ../../library/weakref.rst:37 msgid "" "For example, if you have a number of large binary image objects, you may " "wish to associate a name with each. If you used a Python dictionary to map " @@ -71,7 +71,7 @@ msgid "" "mappings are simply deleted." msgstr "" -#: ../../library/weakref.rst:48 +#: ../../library/weakref.rst:50 msgid "" ":class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak " "references in their implementation, setting up callback functions on the " @@ -81,7 +81,7 @@ msgid "" "a :class:`WeakKeyDictionary` does." msgstr "" -#: ../../library/weakref.rst:55 +#: ../../library/weakref.rst:57 msgid "" ":class:`finalize` provides a straight forward way to register a cleanup " "function to be called when an object is garbage collected. This is simpler " @@ -90,7 +90,7 @@ msgid "" "object is collected." msgstr "" -#: ../../library/weakref.rst:61 +#: ../../library/weakref.rst:63 msgid "" "Most programs should find that using one of these weak container types or :" "class:`finalize` is all they need -- it's not usually necessary to create " @@ -98,38 +98,38 @@ msgid "" "the :mod:`weakref` module for the benefit of advanced uses." msgstr "" -#: ../../library/weakref.rst:66 +#: ../../library/weakref.rst:68 msgid "" -"Not all objects can be weakly referenced; those objects which can include " -"class instances, functions written in Python (but not in C), instance " -"methods, sets, frozensets, some :term:`file objects `, :term:" -"`generators `, type objects, sockets, arrays, deques, regular " -"expression pattern objects, and code objects." +"Not all objects can be weakly referenced. Objects which support weak " +"references include class instances, functions written in Python (but not in " +"C), instance methods, sets, frozensets, some :term:`file objects `, :term:`generators `, type objects, sockets, arrays, " +"deques, regular expression pattern objects, and code objects." msgstr "" -#: ../../library/weakref.rst:72 +#: ../../library/weakref.rst:74 msgid "Added support for thread.lock, threading.Lock, and code objects." msgstr "" -#: ../../library/weakref.rst:75 +#: ../../library/weakref.rst:77 msgid "" "Several built-in types such as :class:`list` and :class:`dict` do not " "directly support weak references but can add support through subclassing::" msgstr "" -#: ../../library/weakref.rst:85 +#: ../../library/weakref.rst:87 msgid "" "Other built-in types such as :class:`tuple` and :class:`int` do not support " "weak references even when subclassed." msgstr "" -#: ../../library/weakref.rst:88 +#: ../../library/weakref.rst:90 msgid "" "Extension types can easily be made to support weak references; see :ref:" "`weakref-support`." msgstr "" -#: ../../library/weakref.rst:91 +#: ../../library/weakref.rst:93 msgid "" "When ``__slots__`` are defined for a given type, weak reference support is " "disabled unless a ``'__weakref__'`` string is also present in the sequence " @@ -137,7 +137,7 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../library/weakref.rst:98 +#: ../../library/weakref.rst:100 msgid "" "Return a weak reference to *object*. The original object can be retrieved " "by calling the reference object if the referent is still alive; if the " @@ -149,21 +149,21 @@ msgid "" "available." msgstr "" -#: ../../library/weakref.rst:106 +#: ../../library/weakref.rst:108 msgid "" "It is allowable for many weak references to be constructed for the same " "object. Callbacks registered for each weak reference will be called from the " "most recently registered callback to the oldest registered callback." msgstr "" -#: ../../library/weakref.rst:110 +#: ../../library/weakref.rst:112 msgid "" "Exceptions raised by the callback will be noted on the standard error " "output, but cannot be propagated; they are handled in exactly the same way " "as exceptions raised from an object's :meth:`__del__` method." msgstr "" -#: ../../library/weakref.rst:114 +#: ../../library/weakref.rst:116 msgid "" "Weak references are :term:`hashable` if the *object* is hashable. They will " "maintain their hash value even after the *object* was deleted. If :func:" @@ -171,7 +171,7 @@ msgid "" "call will raise :exc:`TypeError`." msgstr "" -#: ../../library/weakref.rst:119 +#: ../../library/weakref.rst:121 msgid "" "Weak references support tests for equality, but not ordering. If the " "referents are still alive, two references have the same equality " @@ -180,22 +180,22 @@ msgid "" "objects are the same object." msgstr "" -#: ../../library/weakref.rst:124 +#: ../../library/weakref.rst:126 msgid "This is a subclassable type rather than a factory function." msgstr "" -#: ../../library/weakref.rst:128 +#: ../../library/weakref.rst:130 msgid "" "This read-only attribute returns the callback currently associated to the " "weakref. If there is no callback or if the referent of the weakref is no " "longer alive then this attribute will have value ``None``." msgstr "" -#: ../../library/weakref.rst:132 +#: ../../library/weakref.rst:134 msgid "Added the :attr:`__callback__` attribute." msgstr "新增 :attr:`__callback__` 屬性。" -#: ../../library/weakref.rst:138 +#: ../../library/weakref.rst:140 msgid "" "Return a proxy to *object* which uses a weak reference. This supports use " "of the proxy in most contexts instead of requiring the explicit " @@ -208,24 +208,24 @@ msgid "" "`ref` function." msgstr "" -#: ../../library/weakref.rst:147 +#: ../../library/weakref.rst:149 msgid "" "Extended the operator support on proxy objects to include the matrix " "multiplication operators ``@`` and ``@=``." msgstr "" -#: ../../library/weakref.rst:154 +#: ../../library/weakref.rst:156 msgid "" "Return the number of weak references and proxies which refer to *object*." msgstr "" -#: ../../library/weakref.rst:159 +#: ../../library/weakref.rst:161 msgid "" "Return a list of all weak reference and proxy objects which refer to " "*object*." msgstr "" -#: ../../library/weakref.rst:164 +#: ../../library/weakref.rst:166 msgid "" "Mapping class that references keys weakly. Entries in the dictionary will " "be discarded when there is no longer a strong reference to the key. This " @@ -234,11 +234,11 @@ msgid "" "especially useful with objects that override attribute accesses." msgstr "" -#: ../../library/weakref.rst:170 +#: ../../library/weakref.rst:172 msgid "Added support for ``|`` and ``|=`` operators, specified in :pep:`584`." msgstr "新增 :pep:`584` 所述對於 ``|`` 與 ``|=`` 運算子的支援。" -#: ../../library/weakref.rst:173 +#: ../../library/weakref.rst:175 msgid "" ":class:`WeakKeyDictionary` objects have an additional method that exposes " "the internal references directly. The references are not guaranteed to be " @@ -248,39 +248,39 @@ msgid "" "longer than needed." msgstr "" -#: ../../library/weakref.rst:183 +#: ../../library/weakref.rst:185 msgid "Return an iterable of the weak references to the keys." msgstr "" -#: ../../library/weakref.rst:188 +#: ../../library/weakref.rst:190 msgid "" "Mapping class that references values weakly. Entries in the dictionary will " "be discarded when no strong reference to the value exists any more." msgstr "" -#: ../../library/weakref.rst:191 +#: ../../library/weakref.rst:193 msgid "" "Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`." msgstr "" -#: ../../library/weakref.rst:194 +#: ../../library/weakref.rst:196 msgid "" ":class:`WeakValueDictionary` objects have an additional method that has the " "same issues as the :meth:`keyrefs` method of :class:`WeakKeyDictionary` " "objects." msgstr "" -#: ../../library/weakref.rst:201 +#: ../../library/weakref.rst:203 msgid "Return an iterable of the weak references to the values." msgstr "" -#: ../../library/weakref.rst:206 +#: ../../library/weakref.rst:208 msgid "" "Set class that keeps weak references to its elements. An element will be " "discarded when no strong reference to it exists any more." msgstr "" -#: ../../library/weakref.rst:212 +#: ../../library/weakref.rst:214 msgid "" "A custom :class:`ref` subclass which simulates a weak reference to a bound " "method (i.e., a method defined on a class and looked up on an instance). " @@ -289,7 +289,7 @@ msgid "" "method until either the object or the original function dies::" msgstr "" -#: ../../library/weakref.rst:240 +#: ../../library/weakref.rst:242 msgid "" "Return a callable finalizer object which will be called when *obj* is " "garbage collected. Unlike an ordinary weak reference, a finalizer will " @@ -297,7 +297,7 @@ msgid "" "lifecycle management." msgstr "" -#: ../../library/weakref.rst:245 +#: ../../library/weakref.rst:247 msgid "" "A finalizer is considered *alive* until it is called (either explicitly or " "at garbage collection), and after that it is *dead*. Calling a live " @@ -305,7 +305,7 @@ msgid "" "calling a dead finalizer returns :const:`None`." msgstr "" -#: ../../library/weakref.rst:250 +#: ../../library/weakref.rst:252 msgid "" "Exceptions raised by finalizer callbacks during garbage collection will be " "shown on the standard error output, but cannot be propagated. They are " @@ -313,50 +313,50 @@ msgid "" "`__del__` method or a weak reference's callback." msgstr "" -#: ../../library/weakref.rst:256 +#: ../../library/weakref.rst:258 msgid "" "When the program exits, each remaining live finalizer is called unless its :" "attr:`atexit` attribute has been set to false. They are called in reverse " "order of creation." msgstr "" -#: ../../library/weakref.rst:260 +#: ../../library/weakref.rst:262 msgid "" "A finalizer will never invoke its callback during the later part of the :" "term:`interpreter shutdown` when module globals are liable to have been " "replaced by :const:`None`." msgstr "" -#: ../../library/weakref.rst:266 +#: ../../library/weakref.rst:268 msgid "" "If *self* is alive then mark it as dead and return the result of calling " "``func(*args, **kwargs)``. If *self* is dead then return :const:`None`." msgstr "" -#: ../../library/weakref.rst:272 +#: ../../library/weakref.rst:274 msgid "" "If *self* is alive then mark it as dead and return the tuple ``(obj, func, " "args, kwargs)``. If *self* is dead then return :const:`None`." msgstr "" -#: ../../library/weakref.rst:278 +#: ../../library/weakref.rst:280 msgid "" "If *self* is alive then return the tuple ``(obj, func, args, kwargs)``. If " "*self* is dead then return :const:`None`." msgstr "" -#: ../../library/weakref.rst:283 +#: ../../library/weakref.rst:285 msgid "Property which is true if the finalizer is alive, false otherwise." msgstr "" -#: ../../library/weakref.rst:287 +#: ../../library/weakref.rst:289 msgid "" "A writable boolean property which by default is true. When the program " "exits, it calls all remaining live finalizers for which :attr:`.atexit` is " "true. They are called in reverse order of creation." msgstr "" -#: ../../library/weakref.rst:294 +#: ../../library/weakref.rst:296 msgid "" "It is important to ensure that *func*, *args* and *kwargs* do not own any " "references to *obj*, either directly or indirectly, since otherwise *obj* " @@ -364,60 +364,60 @@ msgid "" "bound method of *obj*." msgstr "" -#: ../../library/weakref.rst:304 +#: ../../library/weakref.rst:306 msgid "The type object for weak references objects." msgstr "" -#: ../../library/weakref.rst:309 +#: ../../library/weakref.rst:311 msgid "The type object for proxies of objects which are not callable." msgstr "" -#: ../../library/weakref.rst:314 +#: ../../library/weakref.rst:316 msgid "The type object for proxies of callable objects." msgstr "" -#: ../../library/weakref.rst:319 +#: ../../library/weakref.rst:321 msgid "" "Sequence containing all the type objects for proxies. This can make it " "simpler to test if an object is a proxy without being dependent on naming " "both proxy types." msgstr "" -#: ../../library/weakref.rst:327 +#: ../../library/weakref.rst:329 msgid ":pep:`205` - Weak References" msgstr "" -#: ../../library/weakref.rst:327 +#: ../../library/weakref.rst:329 msgid "" "The proposal and rationale for this feature, including links to earlier " "implementations and information about similar features in other languages." msgstr "" -#: ../../library/weakref.rst:334 +#: ../../library/weakref.rst:336 msgid "Weak Reference Objects" msgstr "" -#: ../../library/weakref.rst:336 +#: ../../library/weakref.rst:338 msgid "" "Weak reference objects have no methods and no attributes besides :attr:`ref." "__callback__`. A weak reference object allows the referent to be obtained, " "if it still exists, by calling it:" msgstr "" -#: ../../library/weakref.rst:350 +#: ../../library/weakref.rst:352 msgid "" "If the referent no longer exists, calling the reference object returns :" "const:`None`:" msgstr "" -#: ../../library/weakref.rst:357 +#: ../../library/weakref.rst:359 msgid "" "Testing that a weak reference object is still live should be done using the " "expression ``ref() is not None``. Normally, application code that needs to " "use a reference object should follow this pattern::" msgstr "" -#: ../../library/weakref.rst:370 +#: ../../library/weakref.rst:372 msgid "" "Using a separate test for \"liveness\" creates race conditions in threaded " "applications; another thread can cause a weak reference to become " @@ -425,7 +425,7 @@ msgid "" "safe in threaded applications as well as single-threaded applications." msgstr "" -#: ../../library/weakref.rst:375 +#: ../../library/weakref.rst:377 msgid "" "Specialized versions of :class:`ref` objects can be created through " "subclassing. This is used in the implementation of the :class:" @@ -435,18 +435,18 @@ msgid "" "to retrieve the referent." msgstr "" -#: ../../library/weakref.rst:381 +#: ../../library/weakref.rst:383 msgid "" "This example shows how a subclass of :class:`ref` can be used to store " "additional information about an object and affect the value that's returned " "when the referent is accessed::" msgstr "" -#: ../../library/weakref.rst:408 +#: ../../library/weakref.rst:410 msgid "Example" msgstr "範例" -#: ../../library/weakref.rst:410 +#: ../../library/weakref.rst:412 msgid "" "This simple example shows how an application can use object IDs to retrieve " "objects that it has seen before. The IDs of the objects can then be used in " @@ -454,67 +454,67 @@ msgid "" "objects can still be retrieved by ID if they do." msgstr "" -#: ../../library/weakref.rst:435 +#: ../../library/weakref.rst:437 msgid "Finalizer Objects" msgstr "" -#: ../../library/weakref.rst:437 +#: ../../library/weakref.rst:439 msgid "" "The main benefit of using :class:`finalize` is that it makes it simple to " "register a callback without needing to preserve the returned finalizer " "object. For instance" msgstr "" -#: ../../library/weakref.rst:451 +#: ../../library/weakref.rst:453 msgid "" "The finalizer can be called directly as well. However the finalizer will " "invoke the callback at most once." msgstr "" -#: ../../library/weakref.rst:467 +#: ../../library/weakref.rst:469 msgid "" "You can unregister a finalizer using its :meth:`~finalize.detach` method. " "This kills the finalizer and returns the arguments passed to the constructor " "when it was created." msgstr "" -#: ../../library/weakref.rst:481 +#: ../../library/weakref.rst:483 msgid "" "Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a " "finalizer will be called when the program exits if it is still alive. For " "instance" msgstr "" -#: ../../library/weakref.rst:496 +#: ../../library/weakref.rst:498 msgid "Comparing finalizers with :meth:`__del__` methods" msgstr "" -#: ../../library/weakref.rst:498 +#: ../../library/weakref.rst:500 msgid "" "Suppose we want to create a class whose instances represent temporary " "directories. The directories should be deleted with their contents when the " "first of the following events occurs:" msgstr "" -#: ../../library/weakref.rst:502 +#: ../../library/weakref.rst:504 msgid "the object is garbage collected," msgstr "" -#: ../../library/weakref.rst:503 +#: ../../library/weakref.rst:505 msgid "the object's :meth:`remove` method is called, or" msgstr "" -#: ../../library/weakref.rst:504 +#: ../../library/weakref.rst:506 msgid "the program exits." msgstr "" -#: ../../library/weakref.rst:506 +#: ../../library/weakref.rst:508 msgid "" "We might try to implement the class using a :meth:`__del__` method as " "follows::" msgstr "" -#: ../../library/weakref.rst:525 +#: ../../library/weakref.rst:527 msgid "" "Starting with Python 3.4, :meth:`__del__` methods no longer prevent " "reference cycles from being garbage collected, and module globals are no " @@ -522,35 +522,35 @@ msgid "" "code should work without any issues on CPython." msgstr "" -#: ../../library/weakref.rst:530 +#: ../../library/weakref.rst:532 msgid "" "However, handling of :meth:`__del__` methods is notoriously implementation " "specific, since it depends on internal details of the interpreter's garbage " "collector implementation." msgstr "" -#: ../../library/weakref.rst:534 +#: ../../library/weakref.rst:536 msgid "" "A more robust alternative can be to define a finalizer which only references " "the specific functions and objects that it needs, rather than having access " "to the full state of the object::" msgstr "" -#: ../../library/weakref.rst:550 +#: ../../library/weakref.rst:552 msgid "" "Defined like this, our finalizer only receives a reference to the details it " "needs to clean up the directory appropriately. If the object never gets " "garbage collected the finalizer will still be called at exit." msgstr "" -#: ../../library/weakref.rst:554 +#: ../../library/weakref.rst:556 msgid "" "The other advantage of weakref based finalizers is that they can be used to " "register finalizers for classes where the definition is controlled by a " "third party, such as running code when a module is unloaded::" msgstr "" -#: ../../library/weakref.rst:566 +#: ../../library/weakref.rst:568 msgid "" "If you create a finalizer object in a daemonic thread just as the program " "exits then there is the possibility that the finalizer does not get called " diff --git a/library/webbrowser.po b/library/webbrowser.po index 4f91829939..12d5cc53a1 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,19 +69,30 @@ msgid "" "are, naturally, mutually exclusive. Usage example::" msgstr "" -#: ../../library/webbrowser.rst:44 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/webbrowser.rst:46 msgid "The following exception is defined:" msgstr "" -#: ../../library/webbrowser.rst:49 +#: ../../library/webbrowser.rst:51 msgid "Exception raised when a browser control error occurs." msgstr "" -#: ../../library/webbrowser.rst:51 +#: ../../library/webbrowser.rst:53 msgid "The following functions are defined:" msgstr "" -#: ../../library/webbrowser.rst:56 +#: ../../library/webbrowser.rst:58 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -91,39 +102,39 @@ msgid "" "the setting of this variable)." msgstr "" -#: ../../library/webbrowser.rst:63 +#: ../../library/webbrowser.rst:65 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " "is neither supported nor portable." msgstr "" -#: ../../library/webbrowser.rst:67 +#: ../../library/webbrowser.rst:80 msgid "" "Raises an :ref:`auditing event ` ``webbrowser.open`` with argument " "``url``." msgstr "" -#: ../../library/webbrowser.rst:72 +#: ../../library/webbrowser.rst:74 msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" -#: ../../library/webbrowser.rst:77 +#: ../../library/webbrowser.rst:79 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." msgstr "" -#: ../../library/webbrowser.rst:83 +#: ../../library/webbrowser.rst:85 msgid "" "Return a controller object for the browser type *using*. If *using* is " "``None``, return a controller for a default browser appropriate to the " "caller's environment." msgstr "" -#: ../../library/webbrowser.rst:90 +#: ../../library/webbrowser.rst:92 msgid "" "Register the browser type *name*. Once a browser type is registered, the :" "func:`get` function can return a controller for that browser type. If " @@ -132,7 +143,7 @@ msgid "" "provided, *constructor* will never be called, and may be ``None``." msgstr "" -#: ../../library/webbrowser.rst:96 +#: ../../library/webbrowser.rst:98 msgid "" "Setting *preferred* to ``True`` makes this browser a preferred result for a :" "func:`get` call with no argument. Otherwise, this entry point is only " @@ -141,220 +152,220 @@ msgid "" "declare." msgstr "" -#: ../../library/webbrowser.rst:102 +#: ../../library/webbrowser.rst:104 msgid "*preferred* keyword-only parameter was added." msgstr "" -#: ../../library/webbrowser.rst:105 +#: ../../library/webbrowser.rst:107 msgid "" "A number of browser types are predefined. This table gives the type names " "that may be passed to the :func:`get` function and the corresponding " "instantiations for the controller classes, all defined in this module." msgstr "" -#: ../../library/webbrowser.rst:110 +#: ../../library/webbrowser.rst:112 msgid "Type Name" msgstr "" -#: ../../library/webbrowser.rst:110 +#: ../../library/webbrowser.rst:112 msgid "Class Name" msgstr "" -#: ../../library/webbrowser.rst:110 +#: ../../library/webbrowser.rst:112 msgid "Notes" msgstr "註解" -#: ../../library/webbrowser.rst:112 +#: ../../library/webbrowser.rst:114 msgid "``'mozilla'``" msgstr "``'mozilla'``" -#: ../../library/webbrowser.rst:112 ../../library/webbrowser.rst:114 +#: ../../library/webbrowser.rst:114 ../../library/webbrowser.rst:116 msgid ":class:`Mozilla('mozilla')`" msgstr ":class:`Mozilla('mozilla')`" -#: ../../library/webbrowser.rst:114 +#: ../../library/webbrowser.rst:116 msgid "``'firefox'``" msgstr "``'firefox'``" -#: ../../library/webbrowser.rst:116 +#: ../../library/webbrowser.rst:118 msgid "``'netscape'``" msgstr "``'netscape'``" -#: ../../library/webbrowser.rst:116 +#: ../../library/webbrowser.rst:118 msgid ":class:`Mozilla('netscape')`" msgstr ":class:`Mozilla('netscape')`" -#: ../../library/webbrowser.rst:118 +#: ../../library/webbrowser.rst:120 msgid "``'galeon'``" msgstr "``'galeon'``" -#: ../../library/webbrowser.rst:118 +#: ../../library/webbrowser.rst:120 msgid ":class:`Galeon('galeon')`" msgstr ":class:`Galeon('galeon')`" -#: ../../library/webbrowser.rst:120 +#: ../../library/webbrowser.rst:122 msgid "``'epiphany'``" msgstr "``'epiphany'``" -#: ../../library/webbrowser.rst:120 +#: ../../library/webbrowser.rst:122 msgid ":class:`Galeon('epiphany')`" msgstr ":class:`Galeon('epiphany')`" -#: ../../library/webbrowser.rst:122 +#: ../../library/webbrowser.rst:124 msgid "``'skipstone'``" msgstr "``'skipstone'``" -#: ../../library/webbrowser.rst:122 +#: ../../library/webbrowser.rst:124 msgid ":class:`BackgroundBrowser('skipstone')`" msgstr ":class:`BackgroundBrowser('skipstone')`" -#: ../../library/webbrowser.rst:124 +#: ../../library/webbrowser.rst:126 msgid "``'kfmclient'``" msgstr "``'kfmclient'``" -#: ../../library/webbrowser.rst:124 ../../library/webbrowser.rst:126 -#: ../../library/webbrowser.rst:128 +#: ../../library/webbrowser.rst:126 ../../library/webbrowser.rst:128 +#: ../../library/webbrowser.rst:130 msgid ":class:`Konqueror()`" msgstr ":class:`Konqueror()`" -#: ../../library/webbrowser.rst:124 ../../library/webbrowser.rst:126 -#: ../../library/webbrowser.rst:128 +#: ../../library/webbrowser.rst:126 ../../library/webbrowser.rst:128 +#: ../../library/webbrowser.rst:130 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/webbrowser.rst:126 +#: ../../library/webbrowser.rst:128 msgid "``'konqueror'``" msgstr "``'konqueror'``" -#: ../../library/webbrowser.rst:128 +#: ../../library/webbrowser.rst:130 msgid "``'kfm'``" msgstr "``'kfm'``" -#: ../../library/webbrowser.rst:130 +#: ../../library/webbrowser.rst:132 msgid "``'mosaic'``" msgstr "``'mosaic'``" -#: ../../library/webbrowser.rst:130 +#: ../../library/webbrowser.rst:132 msgid ":class:`BackgroundBrowser('mosaic')`" msgstr ":class:`BackgroundBrowser('mosaic')`" -#: ../../library/webbrowser.rst:132 +#: ../../library/webbrowser.rst:134 msgid "``'opera'``" msgstr "``'opera'``" -#: ../../library/webbrowser.rst:132 +#: ../../library/webbrowser.rst:134 msgid ":class:`Opera()`" msgstr ":class:`Opera()`" -#: ../../library/webbrowser.rst:134 +#: ../../library/webbrowser.rst:136 msgid "``'grail'``" msgstr "``'grail'``" -#: ../../library/webbrowser.rst:134 +#: ../../library/webbrowser.rst:136 msgid ":class:`Grail()`" msgstr ":class:`Grail()`" -#: ../../library/webbrowser.rst:136 +#: ../../library/webbrowser.rst:138 msgid "``'links'``" msgstr "``'links'``" -#: ../../library/webbrowser.rst:136 +#: ../../library/webbrowser.rst:138 msgid ":class:`GenericBrowser('links')`" msgstr ":class:`GenericBrowser('links')`" -#: ../../library/webbrowser.rst:138 +#: ../../library/webbrowser.rst:140 msgid "``'elinks'``" msgstr "``'elinks'``" -#: ../../library/webbrowser.rst:138 +#: ../../library/webbrowser.rst:140 msgid ":class:`Elinks('elinks')`" msgstr ":class:`Elinks('elinks')`" -#: ../../library/webbrowser.rst:140 +#: ../../library/webbrowser.rst:142 msgid "``'lynx'``" msgstr "``'lynx'``" -#: ../../library/webbrowser.rst:140 +#: ../../library/webbrowser.rst:142 msgid ":class:`GenericBrowser('lynx')`" msgstr ":class:`GenericBrowser('lynx')`" -#: ../../library/webbrowser.rst:142 +#: ../../library/webbrowser.rst:144 msgid "``'w3m'``" msgstr "``'w3m'``" -#: ../../library/webbrowser.rst:142 +#: ../../library/webbrowser.rst:144 msgid ":class:`GenericBrowser('w3m')`" msgstr ":class:`GenericBrowser('w3m')`" -#: ../../library/webbrowser.rst:144 +#: ../../library/webbrowser.rst:146 msgid "``'windows-default'``" msgstr "``'windows-default'``" -#: ../../library/webbrowser.rst:144 +#: ../../library/webbrowser.rst:146 msgid ":class:`WindowsDefault`" msgstr ":class:`WindowsDefault`" -#: ../../library/webbrowser.rst:144 +#: ../../library/webbrowser.rst:146 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/webbrowser.rst:146 +#: ../../library/webbrowser.rst:148 msgid "``'macosx'``" msgstr "``'macosx'``" -#: ../../library/webbrowser.rst:146 +#: ../../library/webbrowser.rst:148 msgid ":class:`MacOSXOSAScript('default')`" msgstr ":class:`MacOSXOSAScript('default')`" -#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:148 ../../library/webbrowser.rst:150 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "``'safari'``" msgstr "``'safari'``" -#: ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid ":class:`MacOSXOSAScript('safari')`" msgstr ":class:`MacOSXOSAScript('safari')`" -#: ../../library/webbrowser.rst:150 +#: ../../library/webbrowser.rst:152 msgid "``'google-chrome'``" msgstr "``'google-chrome'``" -#: ../../library/webbrowser.rst:150 +#: ../../library/webbrowser.rst:152 msgid ":class:`Chrome('google-chrome')`" msgstr ":class:`Chrome('google-chrome')`" -#: ../../library/webbrowser.rst:152 +#: ../../library/webbrowser.rst:154 msgid "``'chrome'``" msgstr "``'chrome'``" -#: ../../library/webbrowser.rst:152 +#: ../../library/webbrowser.rst:154 msgid ":class:`Chrome('chrome')`" msgstr ":class:`Chrome('chrome')`" -#: ../../library/webbrowser.rst:154 +#: ../../library/webbrowser.rst:156 msgid "``'chromium'``" msgstr "``'chromium'``" -#: ../../library/webbrowser.rst:154 +#: ../../library/webbrowser.rst:156 msgid ":class:`Chromium('chromium')`" msgstr ":class:`Chromium('chromium')`" -#: ../../library/webbrowser.rst:156 +#: ../../library/webbrowser.rst:158 msgid "``'chromium-browser'``" msgstr "``'chromium-browser'``" -#: ../../library/webbrowser.rst:156 +#: ../../library/webbrowser.rst:158 msgid ":class:`Chromium('chromium-browser')`" msgstr ":class:`Chromium('chromium-browser')`" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:161 msgid "Notes:" msgstr "註解:" -#: ../../library/webbrowser.rst:162 +#: ../../library/webbrowser.rst:164 msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " @@ -364,60 +375,68 @@ msgid "" "best strategy for running Konqueror." msgstr "" -#: ../../library/webbrowser.rst:169 +#: ../../library/webbrowser.rst:171 msgid "Only on Windows platforms." msgstr "" -#: ../../library/webbrowser.rst:172 +#: ../../library/webbrowser.rst:174 msgid "Only on macOS platform." msgstr "" -#: ../../library/webbrowser.rst:174 +#: ../../library/webbrowser.rst:176 msgid "Support for Chrome/Chromium has been added." msgstr "" -#: ../../library/webbrowser.rst:177 +#: ../../library/webbrowser.rst:181 +msgid ":class:`MacOSX` is deprecated, use :class:`MacOSXOSAScript` instead." +msgstr "" + +#: ../../library/webbrowser.rst:182 msgid "Here are some simple examples::" msgstr "" "以下是一些簡單範例:\n" "\n" "::" -#: ../../library/webbrowser.rst:191 +#: ../../library/webbrowser.rst:196 msgid "Browser Controller Objects" msgstr "" -#: ../../library/webbrowser.rst:193 +#: ../../library/webbrowser.rst:198 msgid "" "Browser controllers provide these methods which parallel three of the module-" "level convenience functions:" msgstr "" -#: ../../library/webbrowser.rst:199 +#: ../../library/webbrowser.rst:204 +msgid "System-dependent name for the browser." +msgstr "" + +#: ../../library/webbrowser.rst:209 msgid "" "Display *url* using the browser handled by this controller. If *new* is 1, a " "new browser window is opened if possible. If *new* is 2, a new browser page " "(\"tab\") is opened if possible." msgstr "" -#: ../../library/webbrowser.rst:206 +#: ../../library/webbrowser.rst:216 msgid "" "Open *url* in a new window of the browser handled by this controller, if " "possible, otherwise, open *url* in the only browser window. Alias :func:" "`open_new`." msgstr "" -#: ../../library/webbrowser.rst:213 +#: ../../library/webbrowser.rst:223 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." msgstr "" -#: ../../library/webbrowser.rst:218 +#: ../../library/webbrowser.rst:228 msgid "Footnotes" msgstr "註解" -#: ../../library/webbrowser.rst:219 +#: ../../library/webbrowser.rst:229 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." diff --git a/library/wsgiref.po b/library/wsgiref.po index 3288cec3ef..510b13027a 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,37 +44,39 @@ msgid "" "can be used to add WSGI support to a web server or framework. It provides " "utilities for manipulating WSGI environment variables and response headers, " "base classes for implementing WSGI servers, a demo HTTP server that serves " -"WSGI applications, and a validation tool that checks WSGI servers and " -"applications for conformance to the WSGI specification (:pep:`3333`)." +"WSGI applications, types for static type checking, and a validation tool " +"that checks WSGI servers and applications for conformance to the WSGI " +"specification (:pep:`3333`)." msgstr "" -#: ../../library/wsgiref.rst:29 +#: ../../library/wsgiref.rst:30 msgid "" "See `wsgi.readthedocs.io `_ for more " "information about WSGI, and links to tutorials and other resources." msgstr "" -#: ../../library/wsgiref.rst:36 +#: ../../library/wsgiref.rst:37 msgid ":mod:`wsgiref.util` -- WSGI environment utilities" msgstr "" -#: ../../library/wsgiref.rst:42 +#: ../../library/wsgiref.rst:43 msgid "" "This module provides a variety of utility functions for working with WSGI " "environments. A WSGI environment is a dictionary containing HTTP request " "variables as described in :pep:`3333`. All of the functions taking an " "*environ* parameter expect a WSGI-compliant dictionary to be supplied; " -"please see :pep:`3333` for a detailed specification." +"please see :pep:`3333` for a detailed specification and :data:`~wsgiref." +"types.WSGIEnvironment` for a type alias that can be used in type annotations." msgstr "" -#: ../../library/wsgiref.rst:51 +#: ../../library/wsgiref.rst:54 msgid "" "Return a guess for whether ``wsgi.url_scheme`` should be \"http\" or \"https" "\", by checking for a ``HTTPS`` environment variable in the *environ* " "dictionary. The return value is a string." msgstr "" -#: ../../library/wsgiref.rst:55 +#: ../../library/wsgiref.rst:58 msgid "" "This function is useful when creating a gateway that wraps CGI or a CGI-like " "protocol such as FastCGI. Typically, servers providing such protocols will " @@ -83,7 +85,7 @@ msgid "" "a value is found, and \"http\" otherwise." msgstr "" -#: ../../library/wsgiref.rst:64 +#: ../../library/wsgiref.rst:67 msgid "" "Return the full request URI, optionally including the query string, using " "the algorithm found in the \"URL Reconstruction\" section of :pep:`3333`. " @@ -91,27 +93,27 @@ msgid "" "resulting URI." msgstr "" -#: ../../library/wsgiref.rst:71 +#: ../../library/wsgiref.rst:74 msgid "" "Similar to :func:`request_uri`, except that the ``PATH_INFO`` and " "``QUERY_STRING`` variables are ignored. The result is the base URI of the " "application object addressed by the request." msgstr "" -#: ../../library/wsgiref.rst:78 +#: ../../library/wsgiref.rst:81 msgid "" "Shift a single name from ``PATH_INFO`` to ``SCRIPT_NAME`` and return the " "name. The *environ* dictionary is *modified* in-place; use a copy if you " "need to keep the original ``PATH_INFO`` or ``SCRIPT_NAME`` intact." msgstr "" -#: ../../library/wsgiref.rst:82 +#: ../../library/wsgiref.rst:85 msgid "" "If there are no remaining path segments in ``PATH_INFO``, ``None`` is " "returned." msgstr "" -#: ../../library/wsgiref.rst:84 +#: ../../library/wsgiref.rst:87 msgid "" "Typically, this routine is used to process each portion of a request URI " "path, for example to treat the path as a series of dictionary keys. This " @@ -125,7 +127,7 @@ msgid "" "and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." msgstr "" -#: ../../library/wsgiref.rst:95 +#: ../../library/wsgiref.rst:98 msgid "" "When ``PATH_INFO`` is just a \"/\", this routine returns an empty string and " "appends a trailing slash to ``SCRIPT_NAME``, even though empty path segments " @@ -135,11 +137,11 @@ msgid "" "using this routine to do object traversal." msgstr "" -#: ../../library/wsgiref.rst:105 +#: ../../library/wsgiref.rst:108 msgid "Update *environ* with trivial defaults for testing purposes." msgstr "" -#: ../../library/wsgiref.rst:107 +#: ../../library/wsgiref.rst:110 msgid "" "This routine adds various parameters required for WSGI, including " "``HTTP_HOST``, ``SERVER_NAME``, ``SERVER_PORT``, ``REQUEST_METHOD``, " @@ -148,73 +150,72 @@ msgid "" "existing settings for these variables." msgstr "" -#: ../../library/wsgiref.rst:113 +#: ../../library/wsgiref.rst:116 msgid "" "This routine is intended to make it easier for unit tests of WSGI servers " "and applications to set up dummy environments. It should NOT be used by " "actual WSGI servers or applications, since the data is fake!" msgstr "" -#: ../../library/wsgiref.rst:117 ../../library/wsgiref.rst:164 -#: ../../library/wsgiref.rst:286 ../../library/wsgiref.rst:418 +#: ../../library/wsgiref.rst:120 ../../library/wsgiref.rst:168 +#: ../../library/wsgiref.rst:290 ../../library/wsgiref.rst:423 msgid "Example usage::" msgstr "" "用法範例:\n" "\n" "::" -#: ../../library/wsgiref.rst:141 +#: ../../library/wsgiref.rst:144 msgid "" "In addition to the environment functions above, the :mod:`wsgiref.util` " "module also provides these miscellaneous utilities:" msgstr "" -#: ../../library/wsgiref.rst:147 +#: ../../library/wsgiref.rst:150 msgid "" "Return ``True`` if 'header_name' is an HTTP/1.1 \"Hop-by-Hop\" header, as " "defined by :rfc:`2616`." msgstr "" -#: ../../library/wsgiref.rst:153 +#: ../../library/wsgiref.rst:156 msgid "" -"A wrapper to convert a file-like object to an :term:`iterator`. The " -"resulting objects support both :meth:`__getitem__` and :meth:`__iter__` " -"iteration styles, for compatibility with Python 2.1 and Jython. As the " -"object is iterated over, the optional *blksize* parameter will be repeatedly " -"passed to the *filelike* object's :meth:`read` method to obtain bytestrings " -"to yield. When :meth:`read` returns an empty bytestring, iteration is ended " -"and is not resumable." +"A concrete implementation of the :class:`wsgiref.types.FileWrapper` protocol " +"used to convert a file-like object to an :term:`iterator`. The resulting " +"objects are :term:`iterable`\\ s. As the object is iterated over, the " +"optional *blksize* parameter will be repeatedly passed to the *filelike* " +"object's :meth:`read` method to obtain bytestrings to yield. When :meth:" +"`read` returns an empty bytestring, iteration is ended and is not resumable." msgstr "" -#: ../../library/wsgiref.rst:160 +#: ../../library/wsgiref.rst:164 msgid "" "If *filelike* has a :meth:`close` method, the returned object will also have " "a :meth:`close` method, and it will invoke the *filelike* object's :meth:" "`close` method when called." msgstr "" -#: ../../library/wsgiref.rst:176 -msgid "Support for :meth:`sequence protocol <__getitem__>` is deprecated." +#: ../../library/wsgiref.rst:180 +msgid "Support for :meth:`__getitem__` method has been removed." msgstr "" -#: ../../library/wsgiref.rst:181 +#: ../../library/wsgiref.rst:185 msgid ":mod:`wsgiref.headers` -- WSGI response header tools" msgstr "" -#: ../../library/wsgiref.rst:187 +#: ../../library/wsgiref.rst:191 msgid "" "This module provides a single class, :class:`Headers`, for convenient " "manipulation of WSGI response headers using a mapping-like interface." msgstr "" -#: ../../library/wsgiref.rst:193 +#: ../../library/wsgiref.rst:197 msgid "" "Create a mapping-like object wrapping *headers*, which must be a list of " "header name/value tuples as described in :pep:`3333`. The default value of " "*headers* is an empty list." msgstr "" -#: ../../library/wsgiref.rst:197 +#: ../../library/wsgiref.rst:201 msgid "" ":class:`Headers` objects support typical mapping operations including :meth:" "`__getitem__`, :meth:`get`, :meth:`__setitem__`, :meth:`setdefault`, :meth:" @@ -226,7 +227,7 @@ msgid "" "new headers added to the end of the wrapped list." msgstr "" -#: ../../library/wsgiref.rst:206 +#: ../../library/wsgiref.rst:210 msgid "" "Unlike a dictionary, :class:`Headers` objects do not raise an error when you " "try to get or delete a key that isn't in the wrapped header list. Getting a " @@ -234,7 +235,7 @@ msgid "" "does nothing." msgstr "" -#: ../../library/wsgiref.rst:211 +#: ../../library/wsgiref.rst:215 msgid "" ":class:`Headers` objects also support :meth:`keys`, :meth:`values`, and :" "meth:`items` methods. The lists returned by :meth:`keys` and :meth:`items` " @@ -245,7 +246,7 @@ msgid "" "list." msgstr "" -#: ../../library/wsgiref.rst:218 +#: ../../library/wsgiref.rst:222 msgid "" "Calling ``bytes()`` on a :class:`Headers` object returns a formatted " "bytestring suitable for transmission as HTTP response headers. Each header " @@ -254,18 +255,18 @@ msgid "" "terminated with a blank line." msgstr "" -#: ../../library/wsgiref.rst:224 +#: ../../library/wsgiref.rst:228 msgid "" "In addition to their mapping interface and formatting features, :class:" "`Headers` objects also have the following methods for querying and adding " "multi-valued headers, and for adding headers with MIME parameters:" msgstr "" -#: ../../library/wsgiref.rst:231 +#: ../../library/wsgiref.rst:235 msgid "Return a list of all the values for the named header." msgstr "" -#: ../../library/wsgiref.rst:233 +#: ../../library/wsgiref.rst:237 msgid "" "The returned list will be sorted in the order they appeared in the original " "header list or were added to this instance, and may contain duplicates. Any " @@ -273,13 +274,13 @@ msgid "" "no fields exist with the given name, returns an empty list." msgstr "" -#: ../../library/wsgiref.rst:241 +#: ../../library/wsgiref.rst:245 msgid "" "Add a (possibly multi-valued) header, with optional MIME parameters " "specified via keyword arguments." msgstr "" -#: ../../library/wsgiref.rst:244 +#: ../../library/wsgiref.rst:248 msgid "" "*name* is the header field to add. Keyword arguments can be used to set " "MIME parameters for the header field. Each parameter must be a string or " @@ -291,19 +292,19 @@ msgid "" "a value.) Example usage::" msgstr "" -#: ../../library/wsgiref.rst:254 +#: ../../library/wsgiref.rst:258 msgid "The above will add a header that looks like this::" msgstr "" -#: ../../library/wsgiref.rst:259 +#: ../../library/wsgiref.rst:263 msgid "*headers* parameter is optional." msgstr "" -#: ../../library/wsgiref.rst:264 +#: ../../library/wsgiref.rst:268 msgid ":mod:`wsgiref.simple_server` -- a simple WSGI HTTP server" msgstr "" -#: ../../library/wsgiref.rst:270 +#: ../../library/wsgiref.rst:274 msgid "" "This module implements a simple HTTP server (based on :mod:`http.server`) " "that serves WSGI applications. Each server instance serves a single WSGI " @@ -314,7 +315,7 @@ msgid "" "`wsgiref.util`.)" msgstr "" -#: ../../library/wsgiref.rst:281 +#: ../../library/wsgiref.rst:285 msgid "" "Create a new WSGI server listening on *host* and *port*, accepting " "connections for *app*. The return value is an instance of the supplied " @@ -323,7 +324,7 @@ msgid "" "pep:`3333`." msgstr "" -#: ../../library/wsgiref.rst:302 +#: ../../library/wsgiref.rst:306 msgid "" "This function is a small but complete WSGI application that returns a text " "page containing the message \"Hello world!\" and a list of the key/value " @@ -332,51 +333,51 @@ msgid "" "WSGI application correctly." msgstr "" -#: ../../library/wsgiref.rst:311 +#: ../../library/wsgiref.rst:315 msgid "" "Create a :class:`WSGIServer` instance. *server_address* should be a ``(host," "port)`` tuple, and *RequestHandlerClass* should be the subclass of :class:" "`http.server.BaseHTTPRequestHandler` that will be used to process requests." msgstr "" -#: ../../library/wsgiref.rst:316 +#: ../../library/wsgiref.rst:320 msgid "" "You do not normally need to call this constructor, as the :func:" "`make_server` function can handle all the details for you." msgstr "" -#: ../../library/wsgiref.rst:319 +#: ../../library/wsgiref.rst:323 msgid "" ":class:`WSGIServer` is a subclass of :class:`http.server.HTTPServer`, so all " "of its methods (such as :meth:`serve_forever` and :meth:`handle_request`) " "are available. :class:`WSGIServer` also provides these WSGI-specific methods:" msgstr "" -#: ../../library/wsgiref.rst:326 +#: ../../library/wsgiref.rst:330 msgid "" "Sets the callable *application* as the WSGI application that will receive " "requests." msgstr "" -#: ../../library/wsgiref.rst:332 +#: ../../library/wsgiref.rst:336 msgid "Returns the currently set application callable." msgstr "" -#: ../../library/wsgiref.rst:334 +#: ../../library/wsgiref.rst:338 msgid "" "Normally, however, you do not need to use these additional methods, as :meth:" "`set_app` is normally called by :func:`make_server`, and the :meth:`get_app` " "exists mainly for the benefit of request handler instances." msgstr "" -#: ../../library/wsgiref.rst:341 +#: ../../library/wsgiref.rst:345 msgid "" "Create an HTTP handler for the given *request* (i.e. a socket), " "*client_address* (a ``(host,port)`` tuple), and *server* (:class:" "`WSGIServer` instance)." msgstr "" -#: ../../library/wsgiref.rst:344 +#: ../../library/wsgiref.rst:348 msgid "" "You do not need to create instances of this class directly; they are " "automatically created as needed by :class:`WSGIServer` objects. You can, " @@ -385,34 +386,34 @@ msgid "" "subclasses:" msgstr "" -#: ../../library/wsgiref.rst:353 +#: ../../library/wsgiref.rst:357 msgid "" -"Returns a dictionary containing the WSGI environment for a request. The " -"default implementation copies the contents of the :class:`WSGIServer` " +"Return a :data:`~wsgiref.types.WSGIEnvironment` dictionary for a request. " +"The default implementation copies the contents of the :class:`WSGIServer` " "object's :attr:`base_environ` dictionary attribute and then adds various " "headers derived from the HTTP request. Each call to this method should " "return a new dictionary containing all of the relevant CGI environment " "variables as specified in :pep:`3333`." msgstr "" -#: ../../library/wsgiref.rst:363 +#: ../../library/wsgiref.rst:368 msgid "" "Return the object that should be used as the ``wsgi.errors`` stream. The " "default implementation just returns ``sys.stderr``." msgstr "" -#: ../../library/wsgiref.rst:369 +#: ../../library/wsgiref.rst:374 msgid "" "Process the HTTP request. The default implementation creates a handler " "instance using a :mod:`wsgiref.handlers` class to implement the actual WSGI " "application interface." msgstr "" -#: ../../library/wsgiref.rst:375 +#: ../../library/wsgiref.rst:380 msgid ":mod:`wsgiref.validate` --- WSGI conformance checker" msgstr "" -#: ../../library/wsgiref.rst:381 +#: ../../library/wsgiref.rst:386 msgid "" "When creating new WSGI application objects, frameworks, servers, or " "middleware, it can be useful to validate the new code's conformance using :" @@ -422,7 +423,7 @@ msgid "" "conformance." msgstr "" -#: ../../library/wsgiref.rst:388 +#: ../../library/wsgiref.rst:393 msgid "" "Note that this utility does not guarantee complete :pep:`3333` compliance; " "an absence of errors from this module does not necessarily mean that errors " @@ -431,13 +432,13 @@ msgid "" "compliant." msgstr "" -#: ../../library/wsgiref.rst:393 +#: ../../library/wsgiref.rst:398 msgid "" "This module is based on the :mod:`paste.lint` module from Ian Bicking's " "\"Python Paste\" library." msgstr "" -#: ../../library/wsgiref.rst:399 +#: ../../library/wsgiref.rst:404 msgid "" "Wrap *application* and return a new WSGI application object. The returned " "application will forward all requests to the original *application*, and " @@ -445,7 +446,7 @@ msgid "" "conforming to the WSGI specification and to :rfc:`2616`." msgstr "" -#: ../../library/wsgiref.rst:404 +#: ../../library/wsgiref.rst:409 msgid "" "Any detected nonconformance results in an :exc:`AssertionError` being " "raised; note, however, that how these errors are handled is server-" @@ -456,7 +457,7 @@ msgid "" "stream." msgstr "" -#: ../../library/wsgiref.rst:411 +#: ../../library/wsgiref.rst:416 msgid "" "This wrapper may also generate output using the :mod:`warnings` module to " "indicate behaviors that are questionable but which may not actually be " @@ -466,11 +467,11 @@ msgid "" "object)." msgstr "" -#: ../../library/wsgiref.rst:443 +#: ../../library/wsgiref.rst:448 msgid ":mod:`wsgiref.handlers` -- server/gateway base classes" msgstr "" -#: ../../library/wsgiref.rst:449 +#: ../../library/wsgiref.rst:454 msgid "" "This module provides base handler classes for implementing WSGI servers and " "gateways. These base classes handle most of the work of communicating with " @@ -478,7 +479,7 @@ msgid "" "with input, output, and error streams." msgstr "" -#: ../../library/wsgiref.rst:457 +#: ../../library/wsgiref.rst:462 msgid "" "CGI-based invocation via ``sys.stdin``, ``sys.stdout``, ``sys.stderr`` and " "``os.environ``. This is useful when you have a WSGI application and want to " @@ -486,7 +487,7 @@ msgid "" "``app`` is the WSGI application object you wish to invoke." msgstr "" -#: ../../library/wsgiref.rst:462 +#: ../../library/wsgiref.rst:467 msgid "" "This class is a subclass of :class:`BaseCGIHandler` that sets ``wsgi." "run_once`` to true, ``wsgi.multithread`` to false, and ``wsgi.multiprocess`` " @@ -494,21 +495,21 @@ msgid "" "CGI streams and environment." msgstr "" -#: ../../library/wsgiref.rst:470 +#: ../../library/wsgiref.rst:475 msgid "" "A specialized alternative to :class:`CGIHandler`, for use when deploying on " "Microsoft's IIS web server, without having set the config allowPathInfo " "option (IIS>=7) or metabase allowPathInfoForScriptMappings (IIS<7)." msgstr "" -#: ../../library/wsgiref.rst:474 +#: ../../library/wsgiref.rst:479 msgid "" "By default, IIS gives a ``PATH_INFO`` that duplicates the ``SCRIPT_NAME`` at " "the front, causing problems for WSGI applications that wish to implement " "routing. This handler strips any such duplicated path." msgstr "" -#: ../../library/wsgiref.rst:478 +#: ../../library/wsgiref.rst:483 msgid "" "IIS can be configured to pass the correct ``PATH_INFO``, but this causes " "another bug where ``PATH_TRANSLATED`` is wrong. Luckily this variable is " @@ -519,7 +520,7 @@ msgid "" "because there is still no UI for it.)." msgstr "" -#: ../../library/wsgiref.rst:486 +#: ../../library/wsgiref.rst:491 msgid "" "There is no way for CGI code to tell whether the option was set, so a " "separate handler class is provided. It is used in the same way as :class:" @@ -527,7 +528,7 @@ msgid "" "is the WSGI application object you wish to invoke." msgstr "" -#: ../../library/wsgiref.rst:496 +#: ../../library/wsgiref.rst:501 msgid "" "Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and :mod:" "`os` modules, the CGI environment and I/O streams are specified explicitly. " @@ -536,7 +537,7 @@ msgid "" "the handler instance." msgstr "" -#: ../../library/wsgiref.rst:502 +#: ../../library/wsgiref.rst:507 msgid "" "This class is a subclass of :class:`SimpleHandler` intended for use with " "software other than HTTP \"origin servers\". If you are writing a gateway " @@ -545,14 +546,14 @@ msgid "" "this instead of :class:`SimpleHandler`." msgstr "" -#: ../../library/wsgiref.rst:511 +#: ../../library/wsgiref.rst:516 msgid "" "Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin " "servers. If you are writing an HTTP server implementation, you will " "probably want to subclass this instead of :class:`BaseCGIHandler`." msgstr "" -#: ../../library/wsgiref.rst:515 +#: ../../library/wsgiref.rst:520 msgid "" "This class is a subclass of :class:`BaseHandler`. It overrides the :meth:" "`__init__`, :meth:`get_stdin`, :meth:`get_stderr`, :meth:`add_cgi_vars`, :" @@ -562,41 +563,41 @@ msgid "" "and :attr:`environ` attributes." msgstr "" -#: ../../library/wsgiref.rst:522 +#: ../../library/wsgiref.rst:527 msgid "" "The :meth:`~io.BufferedIOBase.write` method of *stdout* should write each " "chunk in full, like :class:`io.BufferedIOBase`." msgstr "" -#: ../../library/wsgiref.rst:528 +#: ../../library/wsgiref.rst:533 msgid "" "This is an abstract base class for running WSGI applications. Each instance " "will handle a single HTTP request, although in principle you could create a " "subclass that was reusable for multiple requests." msgstr "" -#: ../../library/wsgiref.rst:532 +#: ../../library/wsgiref.rst:537 msgid "" ":class:`BaseHandler` instances have only one method intended for external " "use:" msgstr "" -#: ../../library/wsgiref.rst:537 +#: ../../library/wsgiref.rst:542 msgid "Run the specified WSGI application, *app*." msgstr "" -#: ../../library/wsgiref.rst:539 +#: ../../library/wsgiref.rst:544 msgid "" "All of the other :class:`BaseHandler` methods are invoked by this method in " "the process of running the application, and thus exist primarily to allow " "customizing the process." msgstr "" -#: ../../library/wsgiref.rst:543 +#: ../../library/wsgiref.rst:548 msgid "The following methods MUST be overridden in a subclass:" msgstr "" -#: ../../library/wsgiref.rst:548 +#: ../../library/wsgiref.rst:553 msgid "" "Buffer the bytes *data* for transmission to the client. It's okay if this " "method actually transmits the data; :class:`BaseHandler` just separates " @@ -604,31 +605,33 @@ msgid "" "actually has such a distinction." msgstr "" -#: ../../library/wsgiref.rst:556 +#: ../../library/wsgiref.rst:561 msgid "" "Force buffered data to be transmitted to the client. It's okay if this " "method is a no-op (i.e., if :meth:`_write` actually sends the data)." msgstr "" -#: ../../library/wsgiref.rst:562 +#: ../../library/wsgiref.rst:567 msgid "" -"Return an input stream object suitable for use as the ``wsgi.input`` of the " -"request currently being processed." +"Return an object compatible with :class:`~wsgiref.types.InputStream` " +"suitable for use as the ``wsgi.input`` of the request currently being " +"processed." msgstr "" -#: ../../library/wsgiref.rst:568 +#: ../../library/wsgiref.rst:574 msgid "" -"Return an output stream object suitable for use as the ``wsgi.errors`` of " -"the request currently being processed." +"Return an object compatible with :class:`~wsgiref.types.ErrorStream` " +"suitable for use as the ``wsgi.errors`` of the request currently being " +"processed." msgstr "" -#: ../../library/wsgiref.rst:574 +#: ../../library/wsgiref.rst:581 msgid "" "Insert CGI variables for the current request into the :attr:`environ` " "attribute." msgstr "" -#: ../../library/wsgiref.rst:576 +#: ../../library/wsgiref.rst:583 msgid "" "Here are some other methods and attributes you may wish to override. This " "list is only a summary, however, and does not include every method that can " @@ -637,32 +640,32 @@ msgid "" "`BaseHandler` subclass." msgstr "" -#: ../../library/wsgiref.rst:582 +#: ../../library/wsgiref.rst:589 msgid "Attributes and methods for customizing the WSGI environment:" msgstr "" -#: ../../library/wsgiref.rst:587 +#: ../../library/wsgiref.rst:594 msgid "" "The value to be used for the ``wsgi.multithread`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " "(or be set by the constructor) in the other subclasses." msgstr "" -#: ../../library/wsgiref.rst:594 +#: ../../library/wsgiref.rst:601 msgid "" "The value to be used for the ``wsgi.multiprocess`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " "(or be set by the constructor) in the other subclasses." msgstr "" -#: ../../library/wsgiref.rst:601 +#: ../../library/wsgiref.rst:608 msgid "" "The value to be used for the ``wsgi.run_once`` environment variable. It " "defaults to false in :class:`BaseHandler`, but :class:`CGIHandler` sets it " "to true by default." msgstr "" -#: ../../library/wsgiref.rst:608 +#: ../../library/wsgiref.rst:615 msgid "" "The default environment variables to be included in every request's WSGI " "environment. By default, this is a copy of ``os.environ`` at the time that :" @@ -672,7 +675,7 @@ msgid "" "classes and instances." msgstr "" -#: ../../library/wsgiref.rst:618 +#: ../../library/wsgiref.rst:625 msgid "" "If the :attr:`origin_server` attribute is set, this attribute's value is " "used to set the default ``SERVER_SOFTWARE`` WSGI environment variable, and " @@ -681,13 +684,13 @@ msgid "" "are not HTTP origin servers." msgstr "" -#: ../../library/wsgiref.rst:624 +#: ../../library/wsgiref.rst:631 msgid "" "The term \"Python\" is replaced with implementation specific term like " "\"CPython\", \"Jython\" etc." msgstr "" -#: ../../library/wsgiref.rst:630 +#: ../../library/wsgiref.rst:637 msgid "" "Return the URL scheme being used for the current request. The default " "implementation uses the :func:`guess_scheme` function from :mod:`wsgiref." @@ -695,7 +698,7 @@ msgid "" "the current request's :attr:`environ` variables." msgstr "" -#: ../../library/wsgiref.rst:638 +#: ../../library/wsgiref.rst:645 msgid "" "Set the :attr:`environ` attribute to a fully populated WSGI environment. " "The default implementation uses all of the above methods and attributes, " @@ -705,11 +708,11 @@ msgid "" "attribute is a true value and the :attr:`server_software` attribute is set." msgstr "" -#: ../../library/wsgiref.rst:645 +#: ../../library/wsgiref.rst:652 msgid "Methods and attributes for customizing exception handling:" msgstr "" -#: ../../library/wsgiref.rst:650 +#: ../../library/wsgiref.rst:657 msgid "" "Log the *exc_info* tuple in the server log. *exc_info* is a ``(type, value, " "traceback)`` tuple. The default implementation simply writes the traceback " @@ -719,33 +722,33 @@ msgid "" "suitable." msgstr "" -#: ../../library/wsgiref.rst:659 +#: ../../library/wsgiref.rst:666 msgid "" "The maximum number of frames to include in tracebacks output by the default :" "meth:`log_exception` method. If ``None``, all frames are included." msgstr "" -#: ../../library/wsgiref.rst:665 +#: ../../library/wsgiref.rst:672 msgid "" "This method is a WSGI application to generate an error page for the user. " "It is only invoked if an error occurs before headers are sent to the client." msgstr "" -#: ../../library/wsgiref.rst:668 +#: ../../library/wsgiref.rst:675 msgid "" "This method can access the current error information using ``sys." "exc_info()``, and should pass that information to *start_response* when " "calling it (as described in the \"Error Handling\" section of :pep:`3333`)." msgstr "" -#: ../../library/wsgiref.rst:672 +#: ../../library/wsgiref.rst:679 msgid "" "The default implementation just uses the :attr:`error_status`, :attr:" "`error_headers`, and :attr:`error_body` attributes to generate an output " "page. Subclasses can override this to produce more dynamic error output." msgstr "" -#: ../../library/wsgiref.rst:676 +#: ../../library/wsgiref.rst:683 msgid "" "Note, however, that it's not recommended from a security perspective to spit " "out diagnostics to any old user; ideally, you should have to do something " @@ -753,39 +756,40 @@ msgid "" "doesn't include any." msgstr "" -#: ../../library/wsgiref.rst:684 +#: ../../library/wsgiref.rst:691 msgid "" "The HTTP status used for error responses. This should be a status string as " "defined in :pep:`3333`; it defaults to a 500 code and message." msgstr "" -#: ../../library/wsgiref.rst:690 +#: ../../library/wsgiref.rst:697 msgid "" "The HTTP headers used for error responses. This should be a list of WSGI " "response headers (``(name, value)`` tuples), as described in :pep:`3333`. " "The default list just sets the content type to ``text/plain``." msgstr "" -#: ../../library/wsgiref.rst:697 +#: ../../library/wsgiref.rst:704 msgid "" "The error response body. This should be an HTTP response body bytestring. " "It defaults to the plain text, \"A server error occurred. Please contact " "the administrator.\"" msgstr "" -#: ../../library/wsgiref.rst:701 +#: ../../library/wsgiref.rst:708 msgid "" "Methods and attributes for :pep:`3333`'s \"Optional Platform-Specific File " "Handling\" feature:" msgstr "" -#: ../../library/wsgiref.rst:707 +#: ../../library/wsgiref.rst:714 msgid "" -"A ``wsgi.file_wrapper`` factory, or ``None``. The default value of this " -"attribute is the :class:`wsgiref.util.FileWrapper` class." +"A ``wsgi.file_wrapper`` factory, compatible with :class:`wsgiref.types." +"FileWrapper`, or ``None``. The default value of this attribute is the :" +"class:`wsgiref.util.FileWrapper` class." msgstr "" -#: ../../library/wsgiref.rst:713 +#: ../../library/wsgiref.rst:721 msgid "" "Override to implement platform-specific file transmission. This method is " "called only if the application's return value is an instance of the class " @@ -795,11 +799,11 @@ msgid "" "of this method just returns a false value." msgstr "" -#: ../../library/wsgiref.rst:720 +#: ../../library/wsgiref.rst:728 msgid "Miscellaneous methods and attributes:" msgstr "" -#: ../../library/wsgiref.rst:725 +#: ../../library/wsgiref.rst:733 msgid "" "This attribute should be set to a true value if the handler's :meth:`_write` " "and :meth:`_flush` are being used to communicate directly to the client, " @@ -807,19 +811,19 @@ msgid "" "special ``Status:`` header." msgstr "" -#: ../../library/wsgiref.rst:730 +#: ../../library/wsgiref.rst:738 msgid "" "This attribute's default value is true in :class:`BaseHandler`, but false " "in :class:`BaseCGIHandler` and :class:`CGIHandler`." msgstr "" -#: ../../library/wsgiref.rst:736 +#: ../../library/wsgiref.rst:744 msgid "" "If :attr:`origin_server` is true, this string attribute is used to set the " "HTTP version of the response set to the client. It defaults to ``\"1.0\"``." msgstr "" -#: ../../library/wsgiref.rst:742 +#: ../../library/wsgiref.rst:750 msgid "" "Transcode CGI variables from ``os.environ`` to :pep:`3333` \"bytes in unicode" "\" strings, returning a new dictionary. This function is used by :class:" @@ -831,23 +835,66 @@ msgid "" "than ISO-8859-1 (e.g. Unix systems using UTF-8)." msgstr "" -#: ../../library/wsgiref.rst:751 +#: ../../library/wsgiref.rst:759 msgid "" "If you are implementing a CGI-based handler of your own, you probably want " "to use this routine instead of just copying values out of ``os.environ`` " "directly." msgstr "" -#: ../../library/wsgiref.rst:759 +#: ../../library/wsgiref.rst:767 +msgid ":mod:`wsgiref.types` -- WSGI types for static type checking" +msgstr "" + +#: ../../library/wsgiref.rst:773 +msgid "" +"This module provides various types for static type checking as described in :" +"pep:`3333`." +msgstr "" + +#: ../../library/wsgiref.rst:781 +msgid "" +"A :class:`typing.Protocol` describing `start_response() `_ callables (:pep:`3333`)." +msgstr "" + +#: ../../library/wsgiref.rst:787 +msgid "A type alias describing a WSGI environment dictionary." +msgstr "" + +#: ../../library/wsgiref.rst:791 +msgid "A type alias describing a WSGI application callable." +msgstr "" + +#: ../../library/wsgiref.rst:795 +msgid "" +"A :class:`typing.Protocol` describing a `WSGI Input Stream `_." +msgstr "" + +#: ../../library/wsgiref.rst:800 +msgid "" +"A :class:`typing.Protocol` describing a `WSGI Error Stream `_." +msgstr "" + +#: ../../library/wsgiref.rst:805 +msgid "" +"A :class:`typing.Protocol` describing a `file wrapper `_. See :class:" +"`wsgiref.util.FileWrapper` for a concrete implementation of this protocol." +msgstr "" + +#: ../../library/wsgiref.rst:812 msgid "Examples" msgstr "範例" -#: ../../library/wsgiref.rst:761 +#: ../../library/wsgiref.rst:814 msgid "This is a working \"Hello World\" WSGI application::" msgstr "" -#: ../../library/wsgiref.rst:786 +#: ../../library/wsgiref.rst:843 msgid "" "Example of a WSGI application serving the current directory, accept optional " -"directory and port number (default: 8000) on the command line:" +"directory and port number (default: 8000) on the command line::" msgstr "" diff --git a/library/xdrlib.po b/library/xdrlib.po index 0e47cc331c..319f16afd0 100644 --- a/library/xdrlib.po +++ b/library/xdrlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2016-01-31 07:33+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,12 +26,13 @@ msgstr ":mod:`xdrlib` --- XDR 資料的編碼與解碼" msgid "**Source code:** :source:`Lib/xdrlib.py`" msgstr "**原始碼:**\\ :source:`Lib/xdrlib.py`" -#: ../../library/xdrlib.rst:14 +#: ../../library/xdrlib.rst:17 msgid "" "The :mod:`xdrlib` module is deprecated (see :pep:`PEP 594 <594#xdrlib>` for " "details)." msgstr "" -":mod:`xdrlib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#xdrlib>`\\ )。" +":mod:`xdrlib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#xdrlib>`" +"\\ )。" #: ../../library/xdrlib.rst:20 msgid "" diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index fd8d9792f7..ac23b039a4 100644 --- a/library/xml.dom.pulldom.po +++ b/library/xml.dom.pulldom.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -153,7 +153,7 @@ msgid "DOMEventStream Objects" msgstr "DOMEventStream 物件" #: ../../library/xml.dom.pulldom.rst:117 -msgid "Support for :meth:`sequence protocol <__getitem__>` is deprecated." +msgid "Support for :meth:`__getitem__` method has been removed." msgstr "" #: ../../library/xml.dom.pulldom.rst:122 diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index fdbb22c0bd..a9e05eacc7 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,7 +48,18 @@ msgid "" "certificate and hostname checks by default." msgstr "" -#: ../../library/xmlrpc.client.rst:39 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/xmlrpc.client.rst:41 msgid "" "A :class:`ServerProxy` instance is an object that manages communication with " "a remote XML-RPC server. The required first argument is a URI (Uniform " @@ -60,7 +71,7 @@ msgid "" "flag." msgstr "" -#: ../../library/xmlrpc.client.rst:47 +#: ../../library/xmlrpc.client.rst:49 msgid "" "The following parameters govern the use of the returned proxy instance. If " "*allow_none* is true, the Python constant ``None`` will be translated into " @@ -80,15 +91,15 @@ msgid "" "date/time values." msgstr "" -#: ../../library/xmlrpc.client.rst:65 ../../library/xmlrpc.client.rst:546 +#: ../../library/xmlrpc.client.rst:67 ../../library/xmlrpc.client.rst:548 msgid "The *use_builtin_types* flag was added." msgstr "" -#: ../../library/xmlrpc.client.rst:68 +#: ../../library/xmlrpc.client.rst:70 msgid "The *headers* parameter was added." msgstr "新增 *headers* 參數。" -#: ../../library/xmlrpc.client.rst:71 +#: ../../library/xmlrpc.client.rst:73 msgid "" "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP " "Basic Authentication: ``http://user:pass@host:port/path``. The ``user:" @@ -100,7 +111,7 @@ msgid "" "the underlying HTTPS connection." msgstr "" -#: ../../library/xmlrpc.client.rst:80 +#: ../../library/xmlrpc.client.rst:82 msgid "" "The returned instance is a proxy object with methods that can be used to " "invoke corresponding RPC calls on the remote server. If the remote server " @@ -109,116 +120,116 @@ msgid "" "other server-associated metadata." msgstr "" -#: ../../library/xmlrpc.client.rst:86 +#: ../../library/xmlrpc.client.rst:88 msgid "" "Types that are conformable (e.g. that can be marshalled through XML), " "include the following (and except where noted, they are unmarshalled as the " "same Python type):" msgstr "" -#: ../../library/xmlrpc.client.rst:93 +#: ../../library/xmlrpc.client.rst:95 msgid "XML-RPC type" msgstr "" -#: ../../library/xmlrpc.client.rst:93 +#: ../../library/xmlrpc.client.rst:95 msgid "Python type" msgstr "" -#: ../../library/xmlrpc.client.rst:95 +#: ../../library/xmlrpc.client.rst:97 msgid "``boolean``" msgstr "``boolean``" -#: ../../library/xmlrpc.client.rst:95 +#: ../../library/xmlrpc.client.rst:97 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../library/xmlrpc.client.rst:97 +#: ../../library/xmlrpc.client.rst:99 msgid "``int``, ``i1``, ``i2``, ``i4``, ``i8`` or ``biginteger``" msgstr "" "``int``\\ 、\\ ``i1``\\ 、\\ ``i2``\\ 、\\ ``i4``\\ 、\\ ``i8`` 或 " "``biginteger``" -#: ../../library/xmlrpc.client.rst:97 +#: ../../library/xmlrpc.client.rst:99 msgid "" ":class:`int` in range from -2147483648 to 2147483647. Values get the " "```` tag." msgstr "" -#: ../../library/xmlrpc.client.rst:102 +#: ../../library/xmlrpc.client.rst:104 msgid "``double`` or ``float``" msgstr "``double`` 或 ``float``" -#: ../../library/xmlrpc.client.rst:102 +#: ../../library/xmlrpc.client.rst:104 msgid ":class:`float`. Values get the ```` tag." msgstr "" -#: ../../library/xmlrpc.client.rst:105 +#: ../../library/xmlrpc.client.rst:107 msgid "``string``" msgstr "``string``" -#: ../../library/xmlrpc.client.rst:105 +#: ../../library/xmlrpc.client.rst:107 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/xmlrpc.client.rst:107 +#: ../../library/xmlrpc.client.rst:109 msgid "``array``" msgstr "``array``" -#: ../../library/xmlrpc.client.rst:107 +#: ../../library/xmlrpc.client.rst:109 msgid "" ":class:`list` or :class:`tuple` containing conformable elements. Arrays are " "returned as :class:`lists `." msgstr "" -#: ../../library/xmlrpc.client.rst:111 +#: ../../library/xmlrpc.client.rst:113 msgid "``struct``" msgstr "``struct``" -#: ../../library/xmlrpc.client.rst:111 +#: ../../library/xmlrpc.client.rst:113 msgid "" ":class:`dict`. Keys must be strings, values may be any conformable type. " "Objects of user-defined classes can be passed in; only their :attr:`~object." "__dict__` attribute is transmitted." msgstr "" -#: ../../library/xmlrpc.client.rst:116 +#: ../../library/xmlrpc.client.rst:118 msgid "``dateTime.iso8601``" msgstr "``dateTime.iso8601``" -#: ../../library/xmlrpc.client.rst:116 +#: ../../library/xmlrpc.client.rst:118 msgid "" ":class:`DateTime` or :class:`datetime.datetime`. Returned type depends on " "values of *use_builtin_types* and *use_datetime* flags." msgstr "" -#: ../../library/xmlrpc.client.rst:120 +#: ../../library/xmlrpc.client.rst:122 msgid "``base64``" msgstr "``base64``" -#: ../../library/xmlrpc.client.rst:120 +#: ../../library/xmlrpc.client.rst:122 msgid "" ":class:`Binary`, :class:`bytes` or :class:`bytearray`. Returned type " "depends on the value of the *use_builtin_types* flag." msgstr "" -#: ../../library/xmlrpc.client.rst:124 +#: ../../library/xmlrpc.client.rst:126 msgid "``nil``" msgstr "``nil``" -#: ../../library/xmlrpc.client.rst:124 +#: ../../library/xmlrpc.client.rst:126 msgid "" "The ``None`` constant. Passing is allowed only if *allow_none* is true." msgstr "" -#: ../../library/xmlrpc.client.rst:127 +#: ../../library/xmlrpc.client.rst:129 msgid "``bigdecimal``" msgstr "``bigdecimal``" -#: ../../library/xmlrpc.client.rst:127 +#: ../../library/xmlrpc.client.rst:129 msgid ":class:`decimal.Decimal`. Returned type only." msgstr "" -#: ../../library/xmlrpc.client.rst:130 +#: ../../library/xmlrpc.client.rst:132 msgid "" "This is the full set of data types supported by XML-RPC. Method calls may " "also raise a special :exc:`Fault` instance, used to signal XML-RPC server " @@ -228,7 +239,7 @@ msgid "" "currently does not marshal instances of subclasses of built-in types." msgstr "" -#: ../../library/xmlrpc.client.rst:137 +#: ../../library/xmlrpc.client.rst:139 msgid "" "When passing strings, characters special to XML such as ``<``, ``>``, and " "``&`` will be automatically escaped. However, it's the caller's " @@ -240,17 +251,17 @@ msgid "" "`bytearray` classes or the :class:`Binary` wrapper class described below." msgstr "" -#: ../../library/xmlrpc.client.rst:146 +#: ../../library/xmlrpc.client.rst:148 msgid "" ":class:`Server` is retained as an alias for :class:`ServerProxy` for " "backwards compatibility. New code should use :class:`ServerProxy`." msgstr "" -#: ../../library/xmlrpc.client.rst:149 +#: ../../library/xmlrpc.client.rst:151 msgid "Added the *context* argument." msgstr "加入 *context* 引數。" -#: ../../library/xmlrpc.client.rst:152 +#: ../../library/xmlrpc.client.rst:154 msgid "" "Added support of type tags with prefixes (e.g. ``ex:nil``). Added support of " "unmarshalling additional types used by Apache XML-RPC implementation for " @@ -259,40 +270,40 @@ msgid "" "description." msgstr "" -#: ../../library/xmlrpc.client.rst:164 +#: ../../library/xmlrpc.client.rst:166 msgid "`XML-RPC HOWTO `_" msgstr "" -#: ../../library/xmlrpc.client.rst:163 +#: ../../library/xmlrpc.client.rst:165 msgid "" "A good description of XML-RPC operation and client software in several " "languages. Contains pretty much everything an XML-RPC client developer needs " "to know." msgstr "" -#: ../../library/xmlrpc.client.rst:167 +#: ../../library/xmlrpc.client.rst:169 msgid "" "`XML-RPC Introspection `_" msgstr "" -#: ../../library/xmlrpc.client.rst:167 +#: ../../library/xmlrpc.client.rst:169 msgid "Describes the XML-RPC protocol extension for introspection." msgstr "" -#: ../../library/xmlrpc.client.rst:169 +#: ../../library/xmlrpc.client.rst:171 msgid "`XML-RPC Specification `_" msgstr "" -#: ../../library/xmlrpc.client.rst:170 +#: ../../library/xmlrpc.client.rst:172 msgid "The official specification." msgstr "" -#: ../../library/xmlrpc.client.rst:175 +#: ../../library/xmlrpc.client.rst:177 msgid "ServerProxy Objects" msgstr "ServerProxy 物件" -#: ../../library/xmlrpc.client.rst:177 +#: ../../library/xmlrpc.client.rst:179 msgid "" "A :class:`ServerProxy` instance has a method corresponding to each remote " "procedure call accepted by the XML-RPC server. Calling the method performs " @@ -302,19 +313,19 @@ msgid "" "or a :class:`Fault` or :class:`ProtocolError` object indicating an error." msgstr "" -#: ../../library/xmlrpc.client.rst:184 +#: ../../library/xmlrpc.client.rst:186 msgid "" "Servers that support the XML introspection API support some common methods " "grouped under the reserved :attr:`~ServerProxy.system` attribute:" msgstr "" -#: ../../library/xmlrpc.client.rst:190 +#: ../../library/xmlrpc.client.rst:192 msgid "" "This method returns a list of strings, one for each (non-system) method " "supported by the XML-RPC server." msgstr "" -#: ../../library/xmlrpc.client.rst:196 +#: ../../library/xmlrpc.client.rst:198 msgid "" "This method takes one parameter, the name of a method implemented by the XML-" "RPC server. It returns an array of possible signatures for this method. A " @@ -322,13 +333,13 @@ msgid "" "of the method, the rest are parameters." msgstr "" -#: ../../library/xmlrpc.client.rst:201 +#: ../../library/xmlrpc.client.rst:203 msgid "" "Because multiple signatures (ie. overloading) is permitted, this method " "returns a list of signatures rather than a singleton." msgstr "" -#: ../../library/xmlrpc.client.rst:204 +#: ../../library/xmlrpc.client.rst:206 msgid "" "Signatures themselves are restricted to the top level parameters expected by " "a method. For instance if a method expects one array of structs as a " @@ -337,14 +348,14 @@ msgid "" "\"string, int, int, int\"." msgstr "" -#: ../../library/xmlrpc.client.rst:209 +#: ../../library/xmlrpc.client.rst:211 msgid "" "If no signature is defined for the method, a non-array value is returned. In " "Python this means that the type of the returned value will be something " "other than list." msgstr "" -#: ../../library/xmlrpc.client.rst:216 +#: ../../library/xmlrpc.client.rst:218 msgid "" "This method takes one parameter, the name of a method implemented by the XML-" "RPC server. It returns a documentation string describing the use of that " @@ -352,26 +363,26 @@ msgid "" "documentation string may contain HTML markup." msgstr "" -#: ../../library/xmlrpc.client.rst:223 +#: ../../library/xmlrpc.client.rst:225 msgid "" "Instances of :class:`ServerProxy` support the :term:`context manager` " "protocol for closing the underlying transport." msgstr "" -#: ../../library/xmlrpc.client.rst:227 ../../library/xmlrpc.client.rst:273 +#: ../../library/xmlrpc.client.rst:229 ../../library/xmlrpc.client.rst:275 msgid "A working example follows. The server code::" msgstr "" -#: ../../library/xmlrpc.client.rst:239 ../../library/xmlrpc.client.rst:288 -#: ../../library/xmlrpc.client.rst:398 ../../library/xmlrpc.client.rst:504 +#: ../../library/xmlrpc.client.rst:241 ../../library/xmlrpc.client.rst:290 +#: ../../library/xmlrpc.client.rst:400 ../../library/xmlrpc.client.rst:506 msgid "The client code for the preceding server::" msgstr "" -#: ../../library/xmlrpc.client.rst:250 +#: ../../library/xmlrpc.client.rst:252 msgid "DateTime Objects" msgstr "日期時間物件" -#: ../../library/xmlrpc.client.rst:254 +#: ../../library/xmlrpc.client.rst:256 msgid "" "This class may be initialized with seconds since the epoch, a time tuple, an " "ISO 8601 time/date string, or a :class:`datetime.datetime` instance. It has " @@ -379,150 +390,150 @@ msgid "" "unmarshalling code:" msgstr "" -#: ../../library/xmlrpc.client.rst:262 +#: ../../library/xmlrpc.client.rst:264 msgid "Accept a string as the instance's new time value." msgstr "" -#: ../../library/xmlrpc.client.rst:267 +#: ../../library/xmlrpc.client.rst:269 msgid "" "Write the XML-RPC encoding of this :class:`DateTime` item to the *out* " "stream object." msgstr "" -#: ../../library/xmlrpc.client.rst:270 +#: ../../library/xmlrpc.client.rst:272 msgid "" "It also supports certain of Python's built-in operators through rich " "comparison and :meth:`__repr__` methods." msgstr "" -#: ../../library/xmlrpc.client.rst:303 +#: ../../library/xmlrpc.client.rst:305 msgid "Binary Objects" msgstr "" -#: ../../library/xmlrpc.client.rst:307 +#: ../../library/xmlrpc.client.rst:309 msgid "" "This class may be initialized from bytes data (which may include NULs). The " "primary access to the content of a :class:`Binary` object is provided by an " "attribute:" msgstr "" -#: ../../library/xmlrpc.client.rst:314 +#: ../../library/xmlrpc.client.rst:316 msgid "" "The binary data encapsulated by the :class:`Binary` instance. The data is " "provided as a :class:`bytes` object." msgstr "" -#: ../../library/xmlrpc.client.rst:317 +#: ../../library/xmlrpc.client.rst:319 msgid "" ":class:`Binary` objects have the following methods, supported mainly for " "internal use by the marshalling/unmarshalling code:" msgstr "" -#: ../../library/xmlrpc.client.rst:323 +#: ../../library/xmlrpc.client.rst:325 msgid "" "Accept a base64 :class:`bytes` object and decode it as the instance's new " "data." msgstr "" -#: ../../library/xmlrpc.client.rst:328 +#: ../../library/xmlrpc.client.rst:330 msgid "" "Write the XML-RPC base 64 encoding of this binary item to the *out* stream " "object." msgstr "" -#: ../../library/xmlrpc.client.rst:330 +#: ../../library/xmlrpc.client.rst:332 msgid "" "The encoded data will have newlines every 76 characters as per :rfc:`RFC " "2045 section 6.8 <2045#section-6.8>`, which was the de facto standard base64 " "specification when the XML-RPC spec was written." msgstr "" -#: ../../library/xmlrpc.client.rst:335 +#: ../../library/xmlrpc.client.rst:337 msgid "" "It also supports certain of Python's built-in operators through :meth:" "`__eq__` and :meth:`__ne__` methods." msgstr "" -#: ../../library/xmlrpc.client.rst:338 +#: ../../library/xmlrpc.client.rst:340 msgid "" "Example usage of the binary objects. We're going to transfer an image over " "XMLRPC::" msgstr "" -#: ../../library/xmlrpc.client.rst:354 +#: ../../library/xmlrpc.client.rst:356 msgid "The client gets the image and saves it to a file::" msgstr "" -#: ../../library/xmlrpc.client.rst:365 +#: ../../library/xmlrpc.client.rst:367 msgid "Fault Objects" msgstr "" -#: ../../library/xmlrpc.client.rst:369 +#: ../../library/xmlrpc.client.rst:371 msgid "" "A :class:`Fault` object encapsulates the content of an XML-RPC fault tag. " "Fault objects have the following attributes:" msgstr "" -#: ../../library/xmlrpc.client.rst:375 +#: ../../library/xmlrpc.client.rst:377 msgid "An int indicating the fault type." msgstr "" -#: ../../library/xmlrpc.client.rst:380 +#: ../../library/xmlrpc.client.rst:382 msgid "A string containing a diagnostic message associated with the fault." msgstr "" -#: ../../library/xmlrpc.client.rst:382 +#: ../../library/xmlrpc.client.rst:384 msgid "" "In the following example we're going to intentionally cause a :exc:`Fault` " "by returning a complex type object. The server code::" msgstr "" -#: ../../library/xmlrpc.client.rst:415 +#: ../../library/xmlrpc.client.rst:417 msgid "ProtocolError Objects" msgstr "ProtocolError 物件" -#: ../../library/xmlrpc.client.rst:419 +#: ../../library/xmlrpc.client.rst:421 msgid "" "A :class:`ProtocolError` object describes a protocol error in the underlying " "transport layer (such as a 404 'not found' error if the server named by the " "URI does not exist). It has the following attributes:" msgstr "" -#: ../../library/xmlrpc.client.rst:426 +#: ../../library/xmlrpc.client.rst:428 msgid "The URI or URL that triggered the error." msgstr "" -#: ../../library/xmlrpc.client.rst:431 +#: ../../library/xmlrpc.client.rst:433 msgid "The error code." msgstr "" -#: ../../library/xmlrpc.client.rst:436 +#: ../../library/xmlrpc.client.rst:438 msgid "The error message or diagnostic string." msgstr "" -#: ../../library/xmlrpc.client.rst:441 +#: ../../library/xmlrpc.client.rst:443 msgid "" "A dict containing the headers of the HTTP/HTTPS request that triggered the " "error." msgstr "" -#: ../../library/xmlrpc.client.rst:444 +#: ../../library/xmlrpc.client.rst:446 msgid "" "In the following example we're going to intentionally cause a :exc:" "`ProtocolError` by providing an invalid URI::" msgstr "" -#: ../../library/xmlrpc.client.rst:462 +#: ../../library/xmlrpc.client.rst:464 msgid "MultiCall Objects" msgstr "MultiCall 物件" -#: ../../library/xmlrpc.client.rst:464 +#: ../../library/xmlrpc.client.rst:466 msgid "" "The :class:`MultiCall` object provides a way to encapsulate multiple calls " "to a remote server into a single request [#]_." msgstr "" -#: ../../library/xmlrpc.client.rst:470 +#: ../../library/xmlrpc.client.rst:472 msgid "" "Create an object used to boxcar method calls. *server* is the eventual " "target of the call. Calls can be made to the result object, but they will " @@ -533,15 +544,15 @@ msgid "" "the individual results." msgstr "" -#: ../../library/xmlrpc.client.rst:478 +#: ../../library/xmlrpc.client.rst:480 msgid "A usage example of this class follows. The server code::" msgstr "" -#: ../../library/xmlrpc.client.rst:520 +#: ../../library/xmlrpc.client.rst:522 msgid "Convenience Functions" msgstr "" -#: ../../library/xmlrpc.client.rst:524 +#: ../../library/xmlrpc.client.rst:526 msgid "" "Convert *params* into an XML-RPC request. or into a response if " "*methodresponse* is true. *params* can be either a tuple of arguments or an " @@ -553,7 +564,7 @@ msgid "" "*allow_none*." msgstr "" -#: ../../library/xmlrpc.client.rst:535 +#: ../../library/xmlrpc.client.rst:537 msgid "" "Convert an XML-RPC request or response into Python objects, a ``(params, " "methodname)``. *params* is a tuple of argument; *methodname* is a string, " @@ -564,35 +575,35 @@ msgid "" "to be presented as :class:`bytes` objects; this flag is false by default." msgstr "" -#: ../../library/xmlrpc.client.rst:543 +#: ../../library/xmlrpc.client.rst:545 msgid "" "The obsolete *use_datetime* flag is similar to *use_builtin_types* but it " "applies only to date/time values." msgstr "" -#: ../../library/xmlrpc.client.rst:553 +#: ../../library/xmlrpc.client.rst:555 msgid "Example of Client Usage" msgstr "" -#: ../../library/xmlrpc.client.rst:570 +#: ../../library/xmlrpc.client.rst:572 msgid "" "To access an XML-RPC server through a HTTP proxy, you need to define a " "custom transport. The following example shows how::" msgstr "" -#: ../../library/xmlrpc.client.rst:595 +#: ../../library/xmlrpc.client.rst:597 msgid "Example of Client and Server Usage" msgstr "" -#: ../../library/xmlrpc.client.rst:597 +#: ../../library/xmlrpc.client.rst:599 msgid "See :ref:`simplexmlrpcserver-example`." msgstr "" -#: ../../library/xmlrpc.client.rst:601 +#: ../../library/xmlrpc.client.rst:603 msgid "Footnotes" msgstr "註解" -#: ../../library/xmlrpc.client.rst:602 +#: ../../library/xmlrpc.client.rst:604 msgid "" "This approach has been first presented in `a discussion on xmlrpc.com " "\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,7 +41,18 @@ msgid "" "see :ref:`xml-vulnerabilities`." msgstr "" -#: ../../library/xmlrpc.server.rst:31 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/xmlrpc.server.rst:32 msgid "" "Create a new server instance. This class provides methods for registration " "of functions that can be called by the XML-RPC protocol. The " @@ -61,12 +72,12 @@ msgid "" "binary data are received; it defaults to false." msgstr "" -#: ../../library/xmlrpc.server.rst:47 ../../library/xmlrpc.server.rst:61 -#: ../../library/xmlrpc.server.rst:373 +#: ../../library/xmlrpc.server.rst:48 ../../library/xmlrpc.server.rst:62 +#: ../../library/xmlrpc.server.rst:374 msgid "The *use_builtin_types* flag was added." msgstr "" -#: ../../library/xmlrpc.server.rst:54 +#: ../../library/xmlrpc.server.rst:55 msgid "" "Create a new instance to handle XML-RPC requests in a CGI environment. The " "*allow_none* and *encoding* parameters are passed on to :mod:`xmlrpc.client` " @@ -76,25 +87,25 @@ msgid "" "binary data are received; it defaults to false." msgstr "" -#: ../../library/xmlrpc.server.rst:67 +#: ../../library/xmlrpc.server.rst:68 msgid "" "Create a new request handler instance. This request handler supports " "``POST`` requests and modifies logging so that the *logRequests* parameter " "to the :class:`SimpleXMLRPCServer` constructor parameter is honored." msgstr "" -#: ../../library/xmlrpc.server.rst:75 +#: ../../library/xmlrpc.server.rst:76 msgid "SimpleXMLRPCServer Objects" msgstr "SimpleXMLRPCServer 物件" -#: ../../library/xmlrpc.server.rst:77 +#: ../../library/xmlrpc.server.rst:78 msgid "" "The :class:`SimpleXMLRPCServer` class is based on :class:`socketserver." "TCPServer` and provides a means of creating simple, stand alone XML-RPC " "servers." msgstr "" -#: ../../library/xmlrpc.server.rst:84 ../../library/xmlrpc.server.rst:298 +#: ../../library/xmlrpc.server.rst:85 ../../library/xmlrpc.server.rst:299 msgid "" "Register a function that can respond to XML-RPC requests. If *name* is " "given, it will be the method name associated with *function*, otherwise " @@ -102,18 +113,18 @@ msgid "" "characters not legal in Python identifiers, including the period character." msgstr "" -#: ../../library/xmlrpc.server.rst:89 ../../library/xmlrpc.server.rst:303 +#: ../../library/xmlrpc.server.rst:90 ../../library/xmlrpc.server.rst:304 msgid "" "This method can also be used as a decorator. When used as a decorator, " "*name* can only be given as a keyword argument to register *function* under " "*name*. If no *name* is given, ``function.__name__`` will be used." msgstr "" -#: ../../library/xmlrpc.server.rst:93 ../../library/xmlrpc.server.rst:307 +#: ../../library/xmlrpc.server.rst:94 ../../library/xmlrpc.server.rst:308 msgid ":meth:`register_function` can be used as a decorator." msgstr ":meth:`register_function` 也可被當作裝飾器使用。" -#: ../../library/xmlrpc.server.rst:99 +#: ../../library/xmlrpc.server.rst:100 msgid "" "Register an object which is used to expose method names which have not been " "registered using :meth:`register_function`. If *instance* contains a :meth:" @@ -127,7 +138,7 @@ msgid "" "attribute matching the name of the requested method." msgstr "" -#: ../../library/xmlrpc.server.rst:110 +#: ../../library/xmlrpc.server.rst:111 msgid "" "If the optional *allow_dotted_names* argument is true and the instance does " "not have a :meth:`_dispatch` method, then if the requested method name " @@ -138,24 +149,24 @@ msgid "" "client." msgstr "" -#: ../../library/xmlrpc.server.rst:119 +#: ../../library/xmlrpc.server.rst:120 msgid "" "Enabling the *allow_dotted_names* option allows intruders to access your " "module's global variables and may allow intruders to execute arbitrary code " "on your machine. Only use this option on a secure, closed network." msgstr "" -#: ../../library/xmlrpc.server.rst:126 +#: ../../library/xmlrpc.server.rst:127 msgid "" "Registers the XML-RPC introspection functions ``system.listMethods``, " "``system.methodHelp`` and ``system.methodSignature``." msgstr "" -#: ../../library/xmlrpc.server.rst:132 +#: ../../library/xmlrpc.server.rst:133 msgid "Registers the XML-RPC multicall function system.multicall." msgstr "" -#: ../../library/xmlrpc.server.rst:137 +#: ../../library/xmlrpc.server.rst:138 msgid "" "An attribute value that must be a tuple listing valid path portions of the " "URL for receiving XML-RPC requests. Requests posted to other paths will " @@ -163,65 +174,65 @@ msgid "" "paths will be considered valid. The default value is ``('/', '/RPC2')``." msgstr "" -#: ../../library/xmlrpc.server.rst:146 +#: ../../library/xmlrpc.server.rst:147 msgid "SimpleXMLRPCServer Example" msgstr "SimpleXMLRPCServer 範例" -#: ../../library/xmlrpc.server.rst:147 +#: ../../library/xmlrpc.server.rst:148 msgid "Server code::" msgstr "" -#: ../../library/xmlrpc.server.rst:181 +#: ../../library/xmlrpc.server.rst:182 msgid "" "The following client code will call the methods made available by the " "preceding server::" msgstr "" -#: ../../library/xmlrpc.server.rst:194 +#: ../../library/xmlrpc.server.rst:195 msgid "" ":meth:`register_function` can also be used as a decorator. The previous " "server example can register functions in a decorator way::" msgstr "" -#: ../../library/xmlrpc.server.rst:225 +#: ../../library/xmlrpc.server.rst:226 msgid "" "The following example included in the :file:`Lib/xmlrpc/server.py` module " "shows a server allowing dotted names and registering a multicall function." msgstr "" -#: ../../library/xmlrpc.server.rst:230 +#: ../../library/xmlrpc.server.rst:231 msgid "" "Enabling the *allow_dotted_names* option allows intruders to access your " "module's global variables and may allow intruders to execute arbitrary code " "on your machine. Only use this example only within a secure, closed network." msgstr "" -#: ../../library/xmlrpc.server.rst:259 +#: ../../library/xmlrpc.server.rst:260 msgid "This ExampleService demo can be invoked from the command line::" msgstr "" -#: ../../library/xmlrpc.server.rst:264 +#: ../../library/xmlrpc.server.rst:265 msgid "" "The client that interacts with the above server is included in `Lib/xmlrpc/" "client.py`::" msgstr "" -#: ../../library/xmlrpc.server.rst:284 +#: ../../library/xmlrpc.server.rst:285 msgid "" "This client which interacts with the demo XMLRPC server can be invoked as::" msgstr "" -#: ../../library/xmlrpc.server.rst:290 +#: ../../library/xmlrpc.server.rst:291 msgid "CGIXMLRPCRequestHandler" msgstr "CGIXMLRPCRequestHandler" -#: ../../library/xmlrpc.server.rst:292 +#: ../../library/xmlrpc.server.rst:293 msgid "" "The :class:`CGIXMLRPCRequestHandler` class can be used to handle XML-RPC " "requests sent to Python CGI scripts." msgstr "" -#: ../../library/xmlrpc.server.rst:313 +#: ../../library/xmlrpc.server.rst:314 msgid "" "Register an object which is used to expose method names which have not been " "registered using :meth:`register_function`. If instance contains a :meth:" @@ -236,35 +247,35 @@ msgid "" "the client." msgstr "" -#: ../../library/xmlrpc.server.rst:327 +#: ../../library/xmlrpc.server.rst:328 msgid "" "Register the XML-RPC introspection functions ``system.listMethods``, " "``system.methodHelp`` and ``system.methodSignature``." msgstr "" -#: ../../library/xmlrpc.server.rst:333 +#: ../../library/xmlrpc.server.rst:334 msgid "Register the XML-RPC multicall function ``system.multicall``." msgstr "" -#: ../../library/xmlrpc.server.rst:338 +#: ../../library/xmlrpc.server.rst:339 msgid "" "Handle an XML-RPC request. If *request_text* is given, it should be the POST " "data provided by the HTTP server, otherwise the contents of stdin will be " "used." msgstr "" -#: ../../library/xmlrpc.server.rst:341 +#: ../../library/xmlrpc.server.rst:342 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/xmlrpc.server.rst:357 +#: ../../library/xmlrpc.server.rst:358 msgid "Documenting XMLRPC server" msgstr "" -#: ../../library/xmlrpc.server.rst:359 +#: ../../library/xmlrpc.server.rst:360 msgid "" "These classes extend the above classes to serve HTML documentation in " "response to HTTP GET requests. Servers can either be free standing, using :" @@ -272,18 +283,18 @@ msgid "" "`DocCGIXMLRPCRequestHandler`." msgstr "" -#: ../../library/xmlrpc.server.rst:369 +#: ../../library/xmlrpc.server.rst:370 msgid "" "Create a new server instance. All parameters have the same meaning as for :" "class:`SimpleXMLRPCServer`; *requestHandler* defaults to :class:" "`DocXMLRPCRequestHandler`." msgstr "" -#: ../../library/xmlrpc.server.rst:379 +#: ../../library/xmlrpc.server.rst:380 msgid "Create a new instance to handle XML-RPC requests in a CGI environment." msgstr "" -#: ../../library/xmlrpc.server.rst:384 +#: ../../library/xmlrpc.server.rst:385 msgid "" "Create a new request handler instance. This request handler supports XML-RPC " "POST requests, documentation GET requests, and modifies logging so that the " @@ -291,11 +302,11 @@ msgid "" "parameter is honored." msgstr "" -#: ../../library/xmlrpc.server.rst:393 +#: ../../library/xmlrpc.server.rst:394 msgid "DocXMLRPCServer Objects" msgstr "DocXMLRPCServer 物件" -#: ../../library/xmlrpc.server.rst:395 +#: ../../library/xmlrpc.server.rst:396 msgid "" "The :class:`DocXMLRPCServer` class is derived from :class:" "`SimpleXMLRPCServer` and provides a means of creating self-documenting, " @@ -305,30 +316,30 @@ msgid "" "documentation." msgstr "" -#: ../../library/xmlrpc.server.rst:404 ../../library/xmlrpc.server.rst:432 +#: ../../library/xmlrpc.server.rst:405 ../../library/xmlrpc.server.rst:433 msgid "" "Set the title used in the generated HTML documentation. This title will be " "used inside the HTML \"title\" element." msgstr "" -#: ../../library/xmlrpc.server.rst:410 ../../library/xmlrpc.server.rst:438 +#: ../../library/xmlrpc.server.rst:411 ../../library/xmlrpc.server.rst:439 msgid "" "Set the name used in the generated HTML documentation. This name will appear " "at the top of the generated documentation inside a \"h1\" element." msgstr "" -#: ../../library/xmlrpc.server.rst:416 ../../library/xmlrpc.server.rst:444 +#: ../../library/xmlrpc.server.rst:417 ../../library/xmlrpc.server.rst:445 msgid "" "Set the description used in the generated HTML documentation. This " "description will appear as a paragraph, below the server name, in the " "documentation." msgstr "" -#: ../../library/xmlrpc.server.rst:421 +#: ../../library/xmlrpc.server.rst:422 msgid "DocCGIXMLRPCRequestHandler" msgstr "DocCGIXMLRPCRequestHandler" -#: ../../library/xmlrpc.server.rst:423 +#: ../../library/xmlrpc.server.rst:424 msgid "" "The :class:`DocCGIXMLRPCRequestHandler` class is derived from :class:" "`CGIXMLRPCRequestHandler` and provides a means of creating self-documenting, " diff --git a/library/zipfile.po b/library/zipfile.po index db8d792a7d..ac415ca9a3 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-21 17:35+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -156,13 +156,13 @@ msgstr "" msgid "ZipFile Objects" msgstr "ZipFile 物件" -#: ../../library/zipfile.rst:144 +#: ../../library/zipfile.rst:145 msgid "" "Open a ZIP file, where *file* can be a path to a file (a string), a file-" "like object or a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:147 +#: ../../library/zipfile.rst:148 msgid "" "The *mode* parameter should be ``'r'`` to read an existing file, ``'w'`` to " "truncate and write a new file, ``'a'`` to append to an existing file, or " @@ -176,7 +176,7 @@ msgid "" "``'r'`` or ``'a'``, the file should be seekable." msgstr "" -#: ../../library/zipfile.rst:159 +#: ../../library/zipfile.rst:160 msgid "" "*compression* is the ZIP compression method to use when writing the archive, " "and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` " @@ -187,7 +187,7 @@ msgid "" "is raised. The default is :const:`ZIP_STORED`." msgstr "" -#: ../../library/zipfile.rst:167 +#: ../../library/zipfile.rst:168 msgid "" "If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that " "use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is " @@ -195,7 +195,7 @@ msgid "" "require ZIP64 extensions." msgstr "" -#: ../../library/zipfile.rst:172 +#: ../../library/zipfile.rst:173 msgid "" "The *compresslevel* parameter controls the compression level to use when " "writing files to the archive. When using :const:`ZIP_STORED` or :const:" @@ -205,7 +205,7 @@ msgid "" "accepted (see :class:`bz2 ` for more information)." msgstr "" -#: ../../library/zipfile.rst:180 ../../library/zipfile.rst:653 +#: ../../library/zipfile.rst:181 ../../library/zipfile.rst:720 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -213,81 +213,110 @@ msgid "" "also set to the limit." msgstr "" -#: ../../library/zipfile.rst:186 +#: ../../library/zipfile.rst:187 +msgid "" +"When mode is ``'r'``, *metadata_encoding* may be set to the name of a codec, " +"which will be used to decode metadata such as the names of members and ZIP " +"comments." +msgstr "" + +#: ../../library/zipfile.rst:191 msgid "" "If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then :meth:" "`closed ` without adding any files to the archive, the appropriate " "ZIP structures for an empty archive will be written to the file." msgstr "" -#: ../../library/zipfile.rst:190 +#: ../../library/zipfile.rst:195 msgid "" "ZipFile is also a context manager and therefore supports the :keyword:`with` " "statement. In the example, *myzip* is closed after the :keyword:`!with` " "statement's suite is finished---even if an exception occurs::" msgstr "" -#: ../../library/zipfile.rst:197 +#: ../../library/zipfile.rst:204 +msgid "" +"*metadata_encoding* is an instance-wide setting for the ZipFile. It is not " +"currently possible to set this on a per-member basis." +msgstr "" + +#: ../../library/zipfile.rst:207 +msgid "" +"This attribute is a workaround for legacy implementations which produce " +"archives with names in the current locale encoding or code page (mostly on " +"Windows). According to the .ZIP standard, the encoding of metadata may be " +"specified to be either IBM code page (default) or UTF-8 by a flag in the " +"archive header. That flag takes precedence over *metadata_encoding*, which " +"is a Python-specific extension." +msgstr "" + +#: ../../library/zipfile.rst:215 msgid "Added the ability to use :class:`ZipFile` as a context manager." msgstr "" -#: ../../library/zipfile.rst:200 +#: ../../library/zipfile.rst:218 msgid "Added support for :mod:`bzip2 ` and :mod:`lzma` compression." msgstr "" -#: ../../library/zipfile.rst:203 ../../library/zipfile.rst:567 +#: ../../library/zipfile.rst:221 ../../library/zipfile.rst:634 msgid "ZIP64 extensions are enabled by default." msgstr "" -#: ../../library/zipfile.rst:206 +#: ../../library/zipfile.rst:224 msgid "" "Added support for writing to unseekable streams. Added support for the " "``'x'`` mode." msgstr "" -#: ../../library/zipfile.rst:210 +#: ../../library/zipfile.rst:228 msgid "" "Previously, a plain :exc:`RuntimeError` was raised for unrecognized " "compression values." msgstr "" -#: ../../library/zipfile.rst:214 +#: ../../library/zipfile.rst:232 msgid "The *file* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:217 +#: ../../library/zipfile.rst:235 msgid "Add the *compresslevel* parameter." msgstr "" -#: ../../library/zipfile.rst:220 ../../library/zipfile.rst:664 +#: ../../library/zipfile.rst:238 ../../library/zipfile.rst:731 msgid "The *strict_timestamps* keyword-only argument" msgstr "" -#: ../../library/zipfile.rst:226 +#: ../../library/zipfile.rst:241 +msgid "" +"Added support for specifying member name encoding for reading metadata in " +"the zipfile's directory and file headers." +msgstr "" + +#: ../../library/zipfile.rst:248 msgid "" "Close the archive file. You must call :meth:`close` before exiting your " "program or essential records will not be written." msgstr "" -#: ../../library/zipfile.rst:232 +#: ../../library/zipfile.rst:254 msgid "" "Return a :class:`ZipInfo` object with information about the archive member " "*name*. Calling :meth:`getinfo` for a name not currently contained in the " "archive will raise a :exc:`KeyError`." msgstr "" -#: ../../library/zipfile.rst:239 +#: ../../library/zipfile.rst:261 msgid "" "Return a list containing a :class:`ZipInfo` object for each member of the " "archive. The objects are in the same order as their entries in the actual " "ZIP file on disk if an existing archive was opened." msgstr "" -#: ../../library/zipfile.rst:246 +#: ../../library/zipfile.rst:268 msgid "Return a list of archive members by name." msgstr "" -#: ../../library/zipfile.rst:251 +#: ../../library/zipfile.rst:273 msgid "" "Access a member of the archive as a binary file-like object. *name* can be " "either the name of a file within the archive or a :class:`ZipInfo` object. " @@ -295,13 +324,13 @@ msgid "" "``'w'``. *pwd* is the password used to decrypt encrypted ZIP files." msgstr "" -#: ../../library/zipfile.rst:256 +#: ../../library/zipfile.rst:278 msgid "" ":meth:`~ZipFile.open` is also a context manager and therefore supports the :" "keyword:`with` statement::" msgstr "" -#: ../../library/zipfile.rst:263 +#: ../../library/zipfile.rst:285 msgid "" "With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and " "provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io." @@ -310,7 +339,7 @@ msgid "" "objects can operate independently of the ZipFile." msgstr "" -#: ../../library/zipfile.rst:270 +#: ../../library/zipfile.rst:292 msgid "" "With ``mode='w'``, a writable file handle is returned, which supports the :" "meth:`~io.BufferedIOBase.write` method. While a writable file handle is " @@ -318,7 +347,7 @@ msgid "" "exc:`ValueError`." msgstr "" -#: ../../library/zipfile.rst:275 +#: ../../library/zipfile.rst:297 msgid "" "When writing a file, if the file size is not known in advance but may exceed " "2 GiB, pass ``force_zip64=True`` to ensure that the header format is capable " @@ -327,32 +356,32 @@ msgid "" "as the *name* parameter." msgstr "" -#: ../../library/zipfile.rst:283 +#: ../../library/zipfile.rst:305 msgid "" "The :meth:`.open`, :meth:`read` and :meth:`extract` methods can take a " "filename or a :class:`ZipInfo` object. You will appreciate this when trying " "to read a ZIP file that contains members with duplicate names." msgstr "" -#: ../../library/zipfile.rst:287 +#: ../../library/zipfile.rst:309 msgid "" "Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading " "compressed text files in :term:`universal newlines` mode." msgstr "" -#: ../../library/zipfile.rst:291 +#: ../../library/zipfile.rst:313 msgid "" ":meth:`ZipFile.open` can now be used to write files into the archive with " "the ``mode='w'`` option." msgstr "" -#: ../../library/zipfile.rst:295 +#: ../../library/zipfile.rst:317 msgid "" "Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:302 +#: ../../library/zipfile.rst:324 msgid "" "Extract a member from the archive to the current working directory; *member* " "must be its full name or a :class:`ZipInfo` object. Its file information is " @@ -361,11 +390,11 @@ msgid "" "*pwd* is the password used for encrypted files." msgstr "" -#: ../../library/zipfile.rst:308 +#: ../../library/zipfile.rst:330 msgid "Returns the normalized path created (a directory or new file)." msgstr "" -#: ../../library/zipfile.rst:312 +#: ../../library/zipfile.rst:334 msgid "" "If a member filename is an absolute path, a drive/UNC sharepoint and leading " "(back)slashes will be stripped, e.g.: ``///foo/bar`` becomes ``foo/bar`` on " @@ -376,17 +405,17 @@ msgid "" "(``_``)." msgstr "" -#: ../../library/zipfile.rst:320 +#: ../../library/zipfile.rst:342 msgid "" "Calling :meth:`extract` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:324 ../../library/zipfile.rst:347 +#: ../../library/zipfile.rst:346 ../../library/zipfile.rst:369 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:330 +#: ../../library/zipfile.rst:352 msgid "" "Extract all members from the archive to the current working directory. " "*path* specifies a different directory to extract to. *members* is optional " @@ -394,7 +423,7 @@ msgid "" "password used for encrypted files." msgstr "" -#: ../../library/zipfile.rst:337 +#: ../../library/zipfile.rst:359 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -402,21 +431,21 @@ msgid "" "\"``. This module attempts to prevent that. See :meth:`extract` note." msgstr "" -#: ../../library/zipfile.rst:343 +#: ../../library/zipfile.rst:365 msgid "" "Calling :meth:`extractall` on a closed ZipFile will raise a :exc:" "`ValueError`. Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:353 +#: ../../library/zipfile.rst:375 msgid "Print a table of contents for the archive to ``sys.stdout``." msgstr "" -#: ../../library/zipfile.rst:358 +#: ../../library/zipfile.rst:380 msgid "Set *pwd* as default password to extract encrypted files." msgstr "" -#: ../../library/zipfile.rst:363 +#: ../../library/zipfile.rst:385 msgid "" "Return the bytes of the file *name* in the archive. *name* is the name of " "the file in the archive, or a :class:`ZipInfo` object. The archive must be " @@ -429,25 +458,25 @@ msgid "" "available." msgstr "" -#: ../../library/zipfile.rst:372 +#: ../../library/zipfile.rst:394 msgid "" "Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:379 +#: ../../library/zipfile.rst:401 msgid "" "Read all the files in the archive and check their CRC's and file headers. " "Return the name of the first bad file, or else return ``None``." msgstr "" -#: ../../library/zipfile.rst:382 +#: ../../library/zipfile.rst:404 msgid "" "Calling :meth:`testzip` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:390 +#: ../../library/zipfile.rst:412 msgid "" "Write the file named *filename* to the archive, giving it the archive name " "*arcname* (by default, this will be the same as *filename*, but without a " @@ -458,33 +487,43 @@ msgid "" "``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:400 +#: ../../library/zipfile.rst:422 +msgid "" +"The ZIP file standard historically did not specify a metadata encoding, but " +"strongly recommended CP437 (the original IBM PC encoding) for " +"interoperability. Recent versions allow use of UTF-8 (only). In this " +"module, UTF-8 will automatically be used to write the member names if they " +"contain any non-ASCII characters. It is not possible to write member names " +"in any encoding other than ASCII or UTF-8." +msgstr "" + +#: ../../library/zipfile.rst:431 msgid "" "Archive names should be relative to the archive root, that is, they should " "not start with a path separator." msgstr "" -#: ../../library/zipfile.rst:405 +#: ../../library/zipfile.rst:436 msgid "" "If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a " "null byte, the name of the file in the archive will be truncated at the null " "byte." msgstr "" -#: ../../library/zipfile.rst:410 +#: ../../library/zipfile.rst:441 msgid "" "A leading slash in the filename may lead to the archive being impossible to " "open in some zip programs on Windows systems." msgstr "" -#: ../../library/zipfile.rst:413 +#: ../../library/zipfile.rst:444 msgid "" "Calling :meth:`write` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: ../../library/zipfile.rst:422 +#: ../../library/zipfile.rst:453 msgid "" "Write a file into the archive. The contents is *data*, which may be either " "a :class:`str` or a :class:`bytes` instance; if it is a :class:`str`, it is " @@ -495,7 +534,7 @@ msgid "" "must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:430 +#: ../../library/zipfile.rst:461 msgid "" "If given, *compress_type* overrides the value given for the *compression* " "parameter to the constructor for the new entry, or in the *zinfo_or_arcname* " @@ -503,7 +542,7 @@ msgid "" "override the constructor if given." msgstr "" -#: ../../library/zipfile.rst:437 +#: ../../library/zipfile.rst:468 msgid "" "When passing a :class:`ZipInfo` instance as the *zinfo_or_arcname* " "parameter, the compression method used will be that specified in the " @@ -511,33 +550,45 @@ msgid "" "the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`." msgstr "" -#: ../../library/zipfile.rst:442 +#: ../../library/zipfile.rst:473 msgid "The *compress_type* argument." msgstr "*compress_type* 引數。" -#: ../../library/zipfile.rst:445 +#: ../../library/zipfile.rst:476 msgid "" "Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: ../../library/zipfile.rst:451 +#: ../../library/zipfile.rst:483 +msgid "" +"Create a directory inside the archive. If *zinfo_or_directory* is a string, " +"a directory is created inside the archive with the mode that is specified in " +"the *mode* argument. If, however, *zinfo_or_directory* is a :class:`ZipInfo` " +"instance then the *mode* argument is ignored." +msgstr "" + +#: ../../library/zipfile.rst:488 +msgid "The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``." +msgstr "" + +#: ../../library/zipfile.rst:493 msgid "The following data attributes are also available:" msgstr "" -#: ../../library/zipfile.rst:455 +#: ../../library/zipfile.rst:497 msgid "Name of the ZIP file." msgstr "" -#: ../../library/zipfile.rst:459 +#: ../../library/zipfile.rst:501 msgid "" "The level of debug output to use. This may be set from ``0`` (the default, " "no output) to ``3`` (the most output). Debugging information is written to " "``sys.stdout``." msgstr "" -#: ../../library/zipfile.rst:465 +#: ../../library/zipfile.rst:507 msgid "" "The comment associated with the ZIP file as a :class:`bytes` object. If " "assigning a comment to a :class:`ZipFile` instance created with mode " @@ -545,37 +596,37 @@ msgid "" "Comments longer than this will be truncated." msgstr "" -#: ../../library/zipfile.rst:475 +#: ../../library/zipfile.rst:517 msgid "Path Objects" msgstr "" -#: ../../library/zipfile.rst:479 +#: ../../library/zipfile.rst:521 msgid "" "Construct a Path object from a ``root`` zipfile (which may be a :class:" "`ZipFile` instance or ``file`` suitable for passing to the :class:`ZipFile` " "constructor)." msgstr "" -#: ../../library/zipfile.rst:483 +#: ../../library/zipfile.rst:525 msgid "" "``at`` specifies the location of this Path within the zipfile, e.g. 'dir/" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: ../../library/zipfile.rst:487 +#: ../../library/zipfile.rst:529 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: ../../library/zipfile.rst:490 +#: ../../library/zipfile.rst:532 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: ../../library/zipfile.rst:494 +#: ../../library/zipfile.rst:536 msgid "The final path component." msgstr "" -#: ../../library/zipfile.rst:498 +#: ../../library/zipfile.rst:540 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -584,91 +635,122 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:507 +#: ../../library/zipfile.rst:549 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: ../../library/zipfile.rst:513 +#: ../../library/zipfile.rst:555 msgid "Enumerate the children of the current directory." msgstr "" -#: ../../library/zipfile.rst:517 +#: ../../library/zipfile.rst:559 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: ../../library/zipfile.rst:521 +#: ../../library/zipfile.rst:563 msgid "Return ``True`` if the current context references a file." msgstr "" -#: ../../library/zipfile.rst:525 +#: ../../library/zipfile.rst:567 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: ../../library/zipfile.rst:530 +#: ../../library/zipfile.rst:572 +msgid "The file extension of the final component." +msgstr "" + +#: ../../library/zipfile.rst:574 +msgid "Added :data:`Path.suffix` property." +msgstr "" + +#: ../../library/zipfile.rst:579 +msgid "The final path component, without its suffix." +msgstr "" + +#: ../../library/zipfile.rst:581 +msgid "Added :data:`Path.stem` property." +msgstr "" + +#: ../../library/zipfile.rst:586 +msgid "A list of the path’s file extensions." +msgstr "" + +#: ../../library/zipfile.rst:588 +msgid "Added :data:`Path.suffixes` property." +msgstr "" + +#: ../../library/zipfile.rst:593 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: ../../library/zipfile.rst:537 +#: ../../library/zipfile.rst:600 msgid "Read the current file as bytes." msgstr "" -#: ../../library/zipfile.rst:541 +#: ../../library/zipfile.rst:604 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: ../../library/zipfile.rst:548 +#: ../../library/zipfile.rst:611 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: ../../library/zipfile.rst:556 +#: ../../library/zipfile.rst:615 +msgid "" +"The `zipp `_ project provides backports of " +"the latest path object functionality to older Pythons. Use ``zipp.Path`` in " +"place of ``zipfile.Path`` for early access to changes." +msgstr "" + +#: ../../library/zipfile.rst:623 msgid "PyZipFile Objects" msgstr "PyZipFile 物件" -#: ../../library/zipfile.rst:558 +#: ../../library/zipfile.rst:625 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: ../../library/zipfile.rst:564 +#: ../../library/zipfile.rst:631 msgid "The *optimize* parameter." msgstr "*optimize* 參數。" -#: ../../library/zipfile.rst:570 +#: ../../library/zipfile.rst:637 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: ../../library/zipfile.rst:574 +#: ../../library/zipfile.rst:641 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: ../../library/zipfile.rst:577 +#: ../../library/zipfile.rst:644 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:580 +#: ../../library/zipfile.rst:647 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:584 +#: ../../library/zipfile.rst:651 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -681,11 +763,11 @@ msgid "" "in sorted order." msgstr "" -#: ../../library/zipfile.rst:594 +#: ../../library/zipfile.rst:661 msgid "*basename* is intended for internal use only." msgstr "" -#: ../../library/zipfile.rst:596 +#: ../../library/zipfile.rst:663 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -696,280 +778,286 @@ msgid "" "exclude them::" msgstr "" -#: ../../library/zipfile.rst:610 +#: ../../library/zipfile.rst:677 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: ../../library/zipfile.rst:619 +#: ../../library/zipfile.rst:686 msgid "The *filterfunc* parameter." msgstr "*filterfunc* 參數。" -#: ../../library/zipfile.rst:622 +#: ../../library/zipfile.rst:689 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:625 +#: ../../library/zipfile.rst:692 msgid "Recursion sorts directory entries." msgstr "" -#: ../../library/zipfile.rst:632 +#: ../../library/zipfile.rst:699 msgid "ZipInfo Objects" msgstr "ZipInfo 物件" -#: ../../library/zipfile.rst:634 +#: ../../library/zipfile.rst:701 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: ../../library/zipfile.rst:638 +#: ../../library/zipfile.rst:705 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: ../../library/zipfile.rst:644 +#: ../../library/zipfile.rst:711 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: ../../library/zipfile.rst:647 +#: ../../library/zipfile.rst:714 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: ../../library/zipfile.rst:649 +#: ../../library/zipfile.rst:716 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: ../../library/zipfile.rst:661 +#: ../../library/zipfile.rst:728 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:668 +#: ../../library/zipfile.rst:735 msgid "Instances have the following methods and attributes:" msgstr "" -#: ../../library/zipfile.rst:672 +#: ../../library/zipfile.rst:739 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: ../../library/zipfile.rst:674 +#: ../../library/zipfile.rst:741 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: ../../library/zipfile.rst:681 +#: ../../library/zipfile.rst:748 msgid "Name of the file in the archive." msgstr "" -#: ../../library/zipfile.rst:686 +#: ../../library/zipfile.rst:753 msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -#: ../../library/zipfile.rst:690 +#: ../../library/zipfile.rst:757 msgid "Index" msgstr "" -#: ../../library/zipfile.rst:690 +#: ../../library/zipfile.rst:757 msgid "Value" msgstr "" -#: ../../library/zipfile.rst:692 +#: ../../library/zipfile.rst:759 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:692 +#: ../../library/zipfile.rst:759 msgid "Year (>= 1980)" msgstr "" -#: ../../library/zipfile.rst:694 +#: ../../library/zipfile.rst:761 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:694 +#: ../../library/zipfile.rst:761 msgid "Month (one-based)" msgstr "" -#: ../../library/zipfile.rst:696 +#: ../../library/zipfile.rst:763 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:696 +#: ../../library/zipfile.rst:763 msgid "Day of month (one-based)" msgstr "" -#: ../../library/zipfile.rst:698 +#: ../../library/zipfile.rst:765 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:698 +#: ../../library/zipfile.rst:765 msgid "Hours (zero-based)" msgstr "" -#: ../../library/zipfile.rst:700 +#: ../../library/zipfile.rst:767 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:700 +#: ../../library/zipfile.rst:767 msgid "Minutes (zero-based)" msgstr "" -#: ../../library/zipfile.rst:702 +#: ../../library/zipfile.rst:769 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:702 +#: ../../library/zipfile.rst:769 msgid "Seconds (zero-based)" msgstr "" -#: ../../library/zipfile.rst:707 +#: ../../library/zipfile.rst:774 msgid "The ZIP file format does not support timestamps before 1980." msgstr "" -#: ../../library/zipfile.rst:712 +#: ../../library/zipfile.rst:779 msgid "Type of compression for the archive member." msgstr "" -#: ../../library/zipfile.rst:717 +#: ../../library/zipfile.rst:784 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:722 +#: ../../library/zipfile.rst:789 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: ../../library/zipfile.rst:729 +#: ../../library/zipfile.rst:796 msgid "System which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:734 +#: ../../library/zipfile.rst:801 msgid "PKZIP version which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:739 +#: ../../library/zipfile.rst:806 msgid "PKZIP version needed to extract archive." msgstr "" -#: ../../library/zipfile.rst:744 +#: ../../library/zipfile.rst:811 msgid "Must be zero." msgstr "" -#: ../../library/zipfile.rst:749 +#: ../../library/zipfile.rst:816 msgid "ZIP flag bits." msgstr "" -#: ../../library/zipfile.rst:754 +#: ../../library/zipfile.rst:821 msgid "Volume number of file header." msgstr "" -#: ../../library/zipfile.rst:759 +#: ../../library/zipfile.rst:826 msgid "Internal attributes." msgstr "" -#: ../../library/zipfile.rst:764 +#: ../../library/zipfile.rst:831 msgid "External file attributes." msgstr "" -#: ../../library/zipfile.rst:769 +#: ../../library/zipfile.rst:836 msgid "Byte offset to the file header." msgstr "" -#: ../../library/zipfile.rst:774 +#: ../../library/zipfile.rst:841 msgid "CRC-32 of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:779 +#: ../../library/zipfile.rst:846 msgid "Size of the compressed data." msgstr "" -#: ../../library/zipfile.rst:784 +#: ../../library/zipfile.rst:851 msgid "Size of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:791 +#: ../../library/zipfile.rst:858 msgid "Command-Line Interface" msgstr "" -#: ../../library/zipfile.rst:793 +#: ../../library/zipfile.rst:860 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: ../../library/zipfile.rst:796 +#: ../../library/zipfile.rst:863 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:870 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:876 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/zipfile.rst:816 +#: ../../library/zipfile.rst:883 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: ../../library/zipfile.rst:824 +#: ../../library/zipfile.rst:891 msgid "Command-line options" msgstr "" -#: ../../library/zipfile.rst:829 +#: ../../library/zipfile.rst:896 msgid "List files in a zipfile." msgstr "" -#: ../../library/zipfile.rst:834 +#: ../../library/zipfile.rst:901 msgid "Create zipfile from source files." msgstr "" -#: ../../library/zipfile.rst:839 +#: ../../library/zipfile.rst:906 msgid "Extract zipfile into target directory." msgstr "" -#: ../../library/zipfile.rst:844 +#: ../../library/zipfile.rst:911 msgid "Test whether the zipfile is valid or not." msgstr "" -#: ../../library/zipfile.rst:847 +#: ../../library/zipfile.rst:915 +msgid "" +"Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" +"`-t`." +msgstr "" + +#: ../../library/zipfile.rst:922 msgid "Decompression pitfalls" msgstr "" -#: ../../library/zipfile.rst:849 +#: ../../library/zipfile.rst:924 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: ../../library/zipfile.rst:852 +#: ../../library/zipfile.rst:927 msgid "From file itself" msgstr "" -#: ../../library/zipfile.rst:854 +#: ../../library/zipfile.rst:929 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: ../../library/zipfile.rst:858 +#: ../../library/zipfile.rst:933 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:860 +#: ../../library/zipfile.rst:935 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -977,33 +1065,33 @@ msgid "" "files, etc." msgstr "" -#: ../../library/zipfile.rst:867 +#: ../../library/zipfile.rst:942 msgid "Resources limitations" msgstr "" -#: ../../library/zipfile.rst:869 +#: ../../library/zipfile.rst:944 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: ../../library/zipfile.rst:874 +#: ../../library/zipfile.rst:949 msgid "Interruption" msgstr "" -#: ../../library/zipfile.rst:876 +#: ../../library/zipfile.rst:951 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: ../../library/zipfile.rst:880 +#: ../../library/zipfile.rst:955 msgid "Default behaviors of extraction" msgstr "" -#: ../../library/zipfile.rst:882 +#: ../../library/zipfile.rst:957 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/library/zlib.po b/library/zlib.po index 86322e475a..edb167bbce 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -65,13 +65,11 @@ msgid "" "suitable for use as a general hash algorithm." msgstr "" -#: ../../library/zlib.rst:44 -msgid "" -"The result is always unsigned. To generate the same numeric value when using " -"Python 2 or earlier, use ``adler32(data) & 0xffffffff``." +#: ../../library/zlib.rst:44 ../../library/zlib.rst:136 +msgid "The result is always unsigned." msgstr "" -#: ../../library/zlib.rst:51 +#: ../../library/zlib.rst:49 msgid "" "Compresses the bytes in *data*, returning a bytes object containing " "compressed data. *level* is an integer from ``0`` to ``9`` or ``-1`` " @@ -80,37 +78,10 @@ msgid "" "produces the most. ``0`` (Z_NO_COMPRESSION) is no compression. The default " "value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a " "default compromise between speed and compression (currently equivalent to " -"level 6). Raises the :exc:`error` exception if any error occurs." -msgstr "" - -#: ../../library/zlib.rst:59 -msgid "*level* can now be used as a keyword parameter." -msgstr "" - -#: ../../library/zlib.rst:65 -msgid "" -"Returns a compression object, to be used for compressing data streams that " -"won't fit into memory at once." -msgstr "" - -#: ../../library/zlib.rst:68 -msgid "" -"*level* is the compression level -- an integer from ``0`` to ``9`` or " -"``-1``. A value of ``1`` (Z_BEST_SPEED) is fastest and produces the least " -"compression, while a value of ``9`` (Z_BEST_COMPRESSION) is slowest and " -"produces the most. ``0`` (Z_NO_COMPRESSION) is no compression. The default " -"value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a " -"default compromise between speed and compression (currently equivalent to " "level 6)." msgstr "" -#: ../../library/zlib.rst:75 -msgid "" -"*method* is the compression algorithm. Currently, the only supported value " -"is :const:`DEFLATED`." -msgstr "" - -#: ../../library/zlib.rst:78 +#: ../../library/zlib.rst:58 msgid "" "The *wbits* argument controls the size of the history buffer (or the " "\"window size\") used when compressing data, and whether a header and " @@ -118,7 +89,7 @@ msgid "" "defaulting to ``15`` (MAX_WBITS):" msgstr "" -#: ../../library/zlib.rst:83 +#: ../../library/zlib.rst:63 msgid "" "+9 to +15: The base-two logarithm of the window size, which therefore ranges " "between 512 and 32768. Larger values produce better compression at the " @@ -126,34 +97,78 @@ msgid "" "specific header and trailer." msgstr "" -#: ../../library/zlib.rst:88 +#: ../../library/zlib.rst:68 msgid "" "−9 to −15: Uses the absolute value of *wbits* as the window size logarithm, " "while producing a raw output stream with no header or trailing checksum." msgstr "" -#: ../../library/zlib.rst:92 +#: ../../library/zlib.rst:72 msgid "" "+25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the window " "size logarithm, while including a basic :program:`gzip` header and trailing " "checksum in the output." msgstr "" -#: ../../library/zlib.rst:96 +#: ../../library/zlib.rst:76 +msgid "Raises the :exc:`error` exception if any error occurs." +msgstr "" + +#: ../../library/zlib.rst:78 +msgid "*level* can now be used as a keyword parameter." +msgstr "" + +#: ../../library/zlib.rst:81 +msgid "" +"The *wbits* parameter is now available to set window bits and compression " +"type." +msgstr "" + +#: ../../library/zlib.rst:87 +msgid "" +"Returns a compression object, to be used for compressing data streams that " +"won't fit into memory at once." +msgstr "" + +#: ../../library/zlib.rst:90 +msgid "" +"*level* is the compression level -- an integer from ``0`` to ``9`` or " +"``-1``. A value of ``1`` (Z_BEST_SPEED) is fastest and produces the least " +"compression, while a value of ``9`` (Z_BEST_COMPRESSION) is slowest and " +"produces the most. ``0`` (Z_NO_COMPRESSION) is no compression. The default " +"value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a " +"default compromise between speed and compression (currently equivalent to " +"level 6)." +msgstr "" + +#: ../../library/zlib.rst:97 +msgid "" +"*method* is the compression algorithm. Currently, the only supported value " +"is :const:`DEFLATED`." +msgstr "" + +#: ../../library/zlib.rst:100 +msgid "" +"The *wbits* parameter controls the size of the history buffer (or the " +"\"window size\"), and what header and trailer format will be used. It has " +"the same meaning as `described for compress() <#compress-wbits>`__." +msgstr "" + +#: ../../library/zlib.rst:104 msgid "" "The *memLevel* argument controls the amount of memory used for the internal " "compression state. Valid values range from ``1`` to ``9``. Higher values use " "more memory, but are faster and produce smaller output." msgstr "" -#: ../../library/zlib.rst:100 +#: ../../library/zlib.rst:108 msgid "" "*strategy* is used to tune the compression algorithm. Possible values are :" "const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, :" "const:`Z_RLE` (zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2)." msgstr "" -#: ../../library/zlib.rst:104 +#: ../../library/zlib.rst:112 msgid "" "*zdict* is a predefined compression dictionary. This is a sequence of bytes " "(such as a :class:`bytes` object) containing subsequences that are expected " @@ -161,11 +176,11 @@ msgid "" "that are expected to be most common should come at the end of the dictionary." msgstr "" -#: ../../library/zlib.rst:109 +#: ../../library/zlib.rst:117 msgid "Added the *zdict* parameter and keyword argument support." msgstr "新增 *zdict* 參數與支援關鍵字引數" -#: ../../library/zlib.rst:119 +#: ../../library/zlib.rst:127 msgid "" "Computes a CRC (Cyclic Redundancy Check) checksum of *data*. The result is " "an unsigned 32-bit integer. If *value* is present, it is used as the " @@ -177,13 +192,7 @@ msgid "" "suitable for use as a general hash algorithm." msgstr "" -#: ../../library/zlib.rst:128 -msgid "" -"The result is always unsigned. To generate the same numeric value when using " -"Python 2 or earlier, use ``crc32(data) & 0xffffffff``." -msgstr "" - -#: ../../library/zlib.rst:135 +#: ../../library/zlib.rst:141 msgid "" "Decompresses the bytes in *data*, returning a bytes object containing the " "uncompressed data. The *wbits* parameter depends on the format of *data*, " @@ -192,44 +201,44 @@ msgid "" "error occurs." msgstr "" -#: ../../library/zlib.rst:143 +#: ../../library/zlib.rst:149 msgid "" "The *wbits* parameter controls the size of the history buffer (or \"window " "size\"), and what header and trailer format is expected. It is similar to " "the parameter for :func:`compressobj`, but accepts more ranges of values:" msgstr "" -#: ../../library/zlib.rst:148 +#: ../../library/zlib.rst:154 msgid "" "+8 to +15: The base-two logarithm of the window size. The input must " "include a zlib header and trailer." msgstr "" -#: ../../library/zlib.rst:151 +#: ../../library/zlib.rst:157 msgid "" "0: Automatically determine the window size from the zlib header. Only " "supported since zlib 1.2.3.5." msgstr "" -#: ../../library/zlib.rst:154 +#: ../../library/zlib.rst:160 msgid "" "−8 to −15: Uses the absolute value of *wbits* as the window size logarithm. " "The input must be a raw stream with no header or trailer." msgstr "" -#: ../../library/zlib.rst:157 +#: ../../library/zlib.rst:163 msgid "" "+24 to +31 = 16 + (8 to 15): Uses the low 4 bits of the value as the window " "size logarithm. The input must include a gzip header and trailer." msgstr "" -#: ../../library/zlib.rst:161 +#: ../../library/zlib.rst:167 msgid "" "+40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value as the window " "size logarithm, and automatically accepts either the zlib or gzip format." msgstr "" -#: ../../library/zlib.rst:165 +#: ../../library/zlib.rst:171 msgid "" "When decompressing a stream, the window size must not be smaller than the " "size originally used to compress the stream; using a too-small value may " @@ -238,7 +247,7 @@ msgid "" "included." msgstr "" -#: ../../library/zlib.rst:171 +#: ../../library/zlib.rst:177 msgid "" "*bufsize* is the initial size of the buffer used to hold decompressed data. " "If more space is required, the buffer size will be increased as needed, so " @@ -246,46 +255,46 @@ msgid "" "few calls to :c:func:`malloc`." msgstr "" -#: ../../library/zlib.rst:176 +#: ../../library/zlib.rst:182 msgid "*wbits* and *bufsize* can be used as keyword arguments." msgstr "" -#: ../../library/zlib.rst:181 +#: ../../library/zlib.rst:187 msgid "" "Returns a decompression object, to be used for decompressing data streams " "that won't fit into memory at once." msgstr "" -#: ../../library/zlib.rst:184 +#: ../../library/zlib.rst:190 msgid "" "The *wbits* parameter controls the size of the history buffer (or the " "\"window size\"), and what header and trailer format is expected. It has " "the same meaning as `described for decompress() <#decompress-wbits>`__." msgstr "" -#: ../../library/zlib.rst:188 +#: ../../library/zlib.rst:194 msgid "" "The *zdict* parameter specifies a predefined compression dictionary. If " "provided, this must be the same dictionary as was used by the compressor " "that produced the data that is to be decompressed." msgstr "" -#: ../../library/zlib.rst:194 +#: ../../library/zlib.rst:200 msgid "" "If *zdict* is a mutable object (such as a :class:`bytearray`), you must not " "modify its contents between the call to :func:`decompressobj` and the first " "call to the decompressor's ``decompress()`` method." msgstr "" -#: ../../library/zlib.rst:198 +#: ../../library/zlib.rst:204 msgid "Added the *zdict* parameter." msgstr "新增 *zdict* 參數。" -#: ../../library/zlib.rst:202 +#: ../../library/zlib.rst:208 msgid "Compression objects support the following methods:" msgstr "" -#: ../../library/zlib.rst:207 +#: ../../library/zlib.rst:213 msgid "" "Compress *data*, returning a bytes object containing compressed data for at " "least part of the data in *data*. This data should be concatenated to the " @@ -293,7 +302,7 @@ msgid "" "input may be kept in internal buffers for later processing." msgstr "" -#: ../../library/zlib.rst:215 +#: ../../library/zlib.rst:221 msgid "" "All pending input is processed, and a bytes object containing the remaining " "compressed output is returned. *mode* can be selected from the constants :" @@ -307,23 +316,23 @@ msgid "" "delete the object." msgstr "" -#: ../../library/zlib.rst:228 +#: ../../library/zlib.rst:234 msgid "" "Returns a copy of the compression object. This can be used to efficiently " "compress a set of data that share a common initial prefix." msgstr "" -#: ../../library/zlib.rst:232 +#: ../../library/zlib.rst:238 msgid "" "Added :func:`copy.copy` and :func:`copy.deepcopy` support to compression " "objects." msgstr "" -#: ../../library/zlib.rst:237 +#: ../../library/zlib.rst:243 msgid "Decompression objects support the following methods and attributes:" msgstr "" -#: ../../library/zlib.rst:242 +#: ../../library/zlib.rst:248 msgid "" "A bytes object which contains any bytes past the end of the compressed data. " "That is, this remains ``b\"\"`` until the last byte that contains " @@ -331,7 +340,7 @@ msgid "" "contain compressed data, this is ``b\"\"``, an empty bytes object." msgstr "" -#: ../../library/zlib.rst:250 +#: ../../library/zlib.rst:256 msgid "" "A bytes object that contains any data that was not consumed by the last :" "meth:`decompress` call because it exceeded the limit for the uncompressed " @@ -340,19 +349,19 @@ msgid "" "subsequent :meth:`decompress` method call in order to get correct output." msgstr "" -#: ../../library/zlib.rst:259 +#: ../../library/zlib.rst:265 msgid "" "A boolean indicating whether the end of the compressed data stream has been " "reached." msgstr "" -#: ../../library/zlib.rst:262 +#: ../../library/zlib.rst:268 msgid "" "This makes it possible to distinguish between a properly formed compressed " "stream, and an incomplete or truncated one." msgstr "" -#: ../../library/zlib.rst:270 +#: ../../library/zlib.rst:276 msgid "" "Decompress *data*, returning a bytes object containing the uncompressed data " "corresponding to at least part of the data in *string*. This data should be " @@ -361,7 +370,7 @@ msgid "" "buffers for later processing." msgstr "" -#: ../../library/zlib.rst:276 +#: ../../library/zlib.rst:282 msgid "" "If the optional parameter *max_length* is non-zero then the return value " "will be no longer than *max_length*. This may mean that not all of the " @@ -372,11 +381,11 @@ msgid "" "`unconsumed_tail` is empty." msgstr "" -#: ../../library/zlib.rst:283 +#: ../../library/zlib.rst:289 msgid "*max_length* can be used as a keyword argument." msgstr "" -#: ../../library/zlib.rst:289 +#: ../../library/zlib.rst:295 msgid "" "All pending input is processed, and a bytes object containing the remaining " "uncompressed output is returned. After calling :meth:`flush`, the :meth:" @@ -384,63 +393,63 @@ msgid "" "delete the object." msgstr "" -#: ../../library/zlib.rst:294 +#: ../../library/zlib.rst:300 msgid "" "The optional parameter *length* sets the initial size of the output buffer." msgstr "" -#: ../../library/zlib.rst:299 +#: ../../library/zlib.rst:305 msgid "" "Returns a copy of the decompression object. This can be used to save the " "state of the decompressor midway through the data stream in order to speed " "up random seeks into the stream at a future point." msgstr "" -#: ../../library/zlib.rst:304 +#: ../../library/zlib.rst:310 msgid "" "Added :func:`copy.copy` and :func:`copy.deepcopy` support to decompression " "objects." msgstr "" -#: ../../library/zlib.rst:309 +#: ../../library/zlib.rst:315 msgid "" "Information about the version of the zlib library in use is available " "through the following constants:" msgstr "" -#: ../../library/zlib.rst:315 +#: ../../library/zlib.rst:321 msgid "" "The version string of the zlib library that was used for building the " "module. This may be different from the zlib library actually used at " "runtime, which is available as :const:`ZLIB_RUNTIME_VERSION`." msgstr "" -#: ../../library/zlib.rst:322 +#: ../../library/zlib.rst:328 msgid "" "The version string of the zlib library actually loaded by the interpreter." msgstr "" -#: ../../library/zlib.rst:330 +#: ../../library/zlib.rst:336 msgid "Module :mod:`gzip`" msgstr ":mod:`gzip` 模組" -#: ../../library/zlib.rst:330 +#: ../../library/zlib.rst:336 msgid "Reading and writing :program:`gzip`\\ -format files." msgstr "" -#: ../../library/zlib.rst:333 +#: ../../library/zlib.rst:339 msgid "http://www.zlib.net" msgstr "http://www.zlib.net" -#: ../../library/zlib.rst:333 +#: ../../library/zlib.rst:339 msgid "The zlib library home page." msgstr "" -#: ../../library/zlib.rst:336 +#: ../../library/zlib.rst:342 msgid "http://www.zlib.net/manual.html" msgstr "http://www.zlib.net/manual.html" -#: ../../library/zlib.rst:336 +#: ../../library/zlib.rst:342 msgid "" "The zlib manual explains the semantics and usage of the library's many " "functions." diff --git a/library/zoneinfo.po b/library/zoneinfo.po index ec046f8798..7de7f2f74f 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -50,11 +50,22 @@ msgid "" "zone data via PyPI." msgstr "" -#: ../../library/zoneinfo.rst:32 +#: ../../includes/wasm-notavail.rst:-1 +msgid ":ref:`Availability `: not Emscripten, not WASI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms " +"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " +"more information." +msgstr "" + +#: ../../library/zoneinfo.rst:33 msgid "Using ``ZoneInfo``" msgstr "" -#: ../../library/zoneinfo.rst:34 +#: ../../library/zoneinfo.rst:35 msgid "" ":class:`ZoneInfo` is a concrete implementation of the :class:`datetime." "tzinfo` abstract base class, and is intended to be attached to ``tzinfo``, " @@ -63,13 +74,13 @@ msgid "" "astimezone>`::" msgstr "" -#: ../../library/zoneinfo.rst:49 +#: ../../library/zoneinfo.rst:50 msgid "" "Datetimes constructed in this way are compatible with datetime arithmetic " "and handle daylight saving time transitions with no further intervention::" msgstr "" -#: ../../library/zoneinfo.rst:60 +#: ../../library/zoneinfo.rst:61 msgid "" "These time zones also support the :attr:`~datetime.datetime.fold` attribute " "introduced in :pep:`495`. During offset transitions which induce ambiguous " @@ -78,17 +89,17 @@ msgid "" "*after* the transition is used when ``fold=1``, for example::" msgstr "" -#: ../../library/zoneinfo.rst:73 +#: ../../library/zoneinfo.rst:74 msgid "" "When converting from another time zone, the fold will be set to the correct " "value::" msgstr "" -#: ../../library/zoneinfo.rst:89 +#: ../../library/zoneinfo.rst:90 msgid "Data sources" msgstr "" -#: ../../library/zoneinfo.rst:91 +#: ../../library/zoneinfo.rst:92 msgid "" "The ``zoneinfo`` module does not directly provide time zone data, and " "instead pulls time zone information from the system time zone database or " @@ -100,11 +111,11 @@ msgid "" "raise :exc:`ZoneInfoNotFoundError`." msgstr "" -#: ../../library/zoneinfo.rst:103 +#: ../../library/zoneinfo.rst:104 msgid "Configuring the data sources" msgstr "" -#: ../../library/zoneinfo.rst:105 +#: ../../library/zoneinfo.rst:106 msgid "" "When ``ZoneInfo(key)`` is called, the constructor first searches the " "directories specified in :data:`TZPATH` for a file matching ``key``, and on " @@ -112,29 +123,29 @@ msgid "" "configured in three ways:" msgstr "" -#: ../../library/zoneinfo.rst:110 +#: ../../library/zoneinfo.rst:111 msgid "" "The default :data:`TZPATH` when not otherwise specified can be configured " "at :ref:`compile time `." msgstr "" -#: ../../library/zoneinfo.rst:112 +#: ../../library/zoneinfo.rst:113 msgid "" ":data:`TZPATH` can be configured using :ref:`an environment variable " "`." msgstr "" -#: ../../library/zoneinfo.rst:114 +#: ../../library/zoneinfo.rst:115 msgid "" "At :ref:`runtime `, the search path can be " "manipulated using the :func:`reset_tzpath` function." msgstr "" -#: ../../library/zoneinfo.rst:120 +#: ../../library/zoneinfo.rst:121 msgid "Compile-time configuration" msgstr "" -#: ../../library/zoneinfo.rst:122 +#: ../../library/zoneinfo.rst:123 msgid "" "The default :data:`TZPATH` includes several common deployment locations for " "the time zone database (except on Windows, where there are no \"well-known\" " @@ -146,17 +157,17 @@ msgid "" "pathsep`." msgstr "" -#: ../../library/zoneinfo.rst:131 +#: ../../library/zoneinfo.rst:132 msgid "" "On all platforms, the configured value is available as the ``TZPATH`` key " "in :func:`sysconfig.get_config_var`." msgstr "" -#: ../../library/zoneinfo.rst:137 +#: ../../library/zoneinfo.rst:138 msgid "Environment configuration" msgstr "" -#: ../../library/zoneinfo.rst:139 +#: ../../library/zoneinfo.rst:140 msgid "" "When initializing :data:`TZPATH` (either at import time or whenever :func:" "`reset_tzpath` is called with no arguments), the ``zoneinfo`` module will " @@ -164,7 +175,7 @@ msgid "" "search path." msgstr "" -#: ../../library/zoneinfo.rst:146 +#: ../../library/zoneinfo.rst:147 msgid "" "This is an :data:`os.pathsep`-separated string containing the time zone " "search path to use. It must consist of only absolute rather than relative " @@ -175,17 +186,17 @@ msgid "" "raise an exception." msgstr "" -#: ../../library/zoneinfo.rst:154 +#: ../../library/zoneinfo.rst:155 msgid "" "To set the system to ignore the system data and use the tzdata package " "instead, set ``PYTHONTZPATH=\"\"``." msgstr "" -#: ../../library/zoneinfo.rst:160 +#: ../../library/zoneinfo.rst:161 msgid "Runtime configuration" msgstr "" -#: ../../library/zoneinfo.rst:162 +#: ../../library/zoneinfo.rst:163 msgid "" "The TZ search path can also be configured at runtime using the :func:" "`reset_tzpath` function. This is generally not an advisable operation, " @@ -194,11 +205,11 @@ msgid "" "zones)." msgstr "" -#: ../../library/zoneinfo.rst:169 +#: ../../library/zoneinfo.rst:170 msgid "The ``ZoneInfo`` class" msgstr "" -#: ../../library/zoneinfo.rst:173 +#: ../../library/zoneinfo.rst:174 msgid "" "A concrete :class:`datetime.tzinfo` subclass that represents an IANA time " "zone specified by the string ``key``. Calls to the primary constructor will " @@ -207,42 +218,42 @@ msgid "" "``key``, the following assertion will always be true:" msgstr "" -#: ../../library/zoneinfo.rst:185 +#: ../../library/zoneinfo.rst:186 msgid "" "``key`` must be in the form of a relative, normalized POSIX path, with no up-" "level references. The constructor will raise :exc:`ValueError` if a non-" "conforming key is passed." msgstr "" -#: ../../library/zoneinfo.rst:189 +#: ../../library/zoneinfo.rst:190 msgid "" "If no file matching ``key`` is found, the constructor will raise :exc:" "`ZoneInfoNotFoundError`." msgstr "" -#: ../../library/zoneinfo.rst:193 +#: ../../library/zoneinfo.rst:194 msgid "The ``ZoneInfo`` class has two alternate constructors:" msgstr "" -#: ../../library/zoneinfo.rst:197 +#: ../../library/zoneinfo.rst:198 msgid "" "Constructs a ``ZoneInfo`` object from a file-like object returning bytes (e." "g. a file opened in binary mode or an :class:`io.BytesIO` object). Unlike " "the primary constructor, this always constructs a new object." msgstr "" -#: ../../library/zoneinfo.rst:201 +#: ../../library/zoneinfo.rst:202 msgid "" "The ``key`` parameter sets the name of the zone for the purposes of :py:meth:" "`~object.__str__` and :py:meth:`~object.__repr__`." msgstr "" -#: ../../library/zoneinfo.rst:204 +#: ../../library/zoneinfo.rst:205 msgid "" "Objects created via this constructor cannot be pickled (see `pickling`_)." msgstr "" -#: ../../library/zoneinfo.rst:208 +#: ../../library/zoneinfo.rst:209 msgid "" "An alternate constructor that bypasses the constructor's cache. It is " "identical to the primary constructor, but returns a new object on each call. " @@ -251,48 +262,48 @@ msgid "" "strategy." msgstr "" -#: ../../library/zoneinfo.rst:214 +#: ../../library/zoneinfo.rst:215 msgid "" "Objects created via this constructor will also bypass the cache of a " "deserializing process when unpickled." msgstr "" -#: ../../library/zoneinfo.rst:221 +#: ../../library/zoneinfo.rst:222 msgid "" "Using this constructor may change the semantics of your datetimes in " "surprising ways, only use it if you know that you need to." msgstr "" -#: ../../library/zoneinfo.rst:224 +#: ../../library/zoneinfo.rst:225 msgid "The following class methods are also available:" msgstr "" -#: ../../library/zoneinfo.rst:228 +#: ../../library/zoneinfo.rst:229 msgid "" "A method for invalidating the cache on the ``ZoneInfo`` class. If no " "arguments are passed, all caches are invalidated and the next call to the " "primary constructor for each key will return a new instance." msgstr "" -#: ../../library/zoneinfo.rst:232 +#: ../../library/zoneinfo.rst:233 msgid "" "If an iterable of key names is passed to the ``only_keys`` parameter, only " "the specified keys will be removed from the cache. Keys passed to " "``only_keys`` but not found in the cache are ignored." msgstr "" -#: ../../library/zoneinfo.rst:240 +#: ../../library/zoneinfo.rst:241 msgid "" "Invoking this function may change the semantics of datetimes using " "``ZoneInfo`` in surprising ways; this modifies process-wide global state and " "thus may have wide-ranging effects. Only use it if you know that you need to." msgstr "" -#: ../../library/zoneinfo.rst:245 +#: ../../library/zoneinfo.rst:246 msgid "The class has one attribute:" msgstr "" -#: ../../library/zoneinfo.rst:249 +#: ../../library/zoneinfo.rst:250 msgid "" "This is a read-only :term:`attribute` that returns the value of ``key`` " "passed to the constructor, which should be a lookup key in the IANA time " @@ -300,13 +311,13 @@ msgid "" "Tokyo``)." msgstr "" -#: ../../library/zoneinfo.rst:254 +#: ../../library/zoneinfo.rst:255 msgid "" "For zones constructed from file without specifying a ``key`` parameter, this " "will be set to ``None``." msgstr "" -#: ../../library/zoneinfo.rst:259 +#: ../../library/zoneinfo.rst:260 msgid "" "Although it is a somewhat common practice to expose these to end users, " "these values are designed to be primary keys for representing the relevant " @@ -315,18 +326,18 @@ msgid "" "strings from these keys." msgstr "" -#: ../../library/zoneinfo.rst:266 +#: ../../library/zoneinfo.rst:267 msgid "String representations" msgstr "" -#: ../../library/zoneinfo.rst:268 +#: ../../library/zoneinfo.rst:269 msgid "" "The string representation returned when calling :py:class:`str` on a :class:" "`ZoneInfo` object defaults to using the :attr:`ZoneInfo.key` attribute (see " "the note on usage in the attribute documentation)::" msgstr "" -#: ../../library/zoneinfo.rst:280 +#: ../../library/zoneinfo.rst:281 msgid "" "For objects constructed from a file without specifying a ``key`` parameter, " "``str`` falls back to calling :func:`repr`. ``ZoneInfo``'s ``repr`` is " @@ -334,22 +345,22 @@ msgid "" "is guaranteed not to be a valid ``ZoneInfo`` key." msgstr "" -#: ../../library/zoneinfo.rst:288 +#: ../../library/zoneinfo.rst:289 msgid "Pickle serialization" msgstr "" -#: ../../library/zoneinfo.rst:290 +#: ../../library/zoneinfo.rst:291 msgid "" "Rather than serializing all transition data, ``ZoneInfo`` objects are " "serialized by key, and ``ZoneInfo`` objects constructed from files (even " "those with a value for ``key`` specified) cannot be pickled." msgstr "" -#: ../../library/zoneinfo.rst:294 +#: ../../library/zoneinfo.rst:295 msgid "The behavior of a ``ZoneInfo`` file depends on how it was constructed:" msgstr "" -#: ../../library/zoneinfo.rst:296 +#: ../../library/zoneinfo.rst:297 msgid "" "``ZoneInfo(key)``: When constructed with the primary constructor, a " "``ZoneInfo`` object is serialized by key, and when deserialized, the " @@ -360,7 +371,7 @@ msgid "" "following behavior:" msgstr "" -#: ../../library/zoneinfo.rst:311 +#: ../../library/zoneinfo.rst:312 msgid "" "``ZoneInfo.no_cache(key)``: When constructed from the cache-bypassing " "constructor, the ``ZoneInfo`` object is also serialized by key, but when " @@ -370,7 +381,7 @@ msgid "" "the following behavior:" msgstr "" -#: ../../library/zoneinfo.rst:325 +#: ../../library/zoneinfo.rst:326 msgid "" "``ZoneInfo.from_file(fobj, /, key=None)``: When constructed from a file, the " "``ZoneInfo`` object raises an exception on pickling. If an end user wants to " @@ -379,7 +390,7 @@ msgid "" "key or storing the contents of the file object and serializing that." msgstr "" -#: ../../library/zoneinfo.rst:331 +#: ../../library/zoneinfo.rst:332 msgid "" "This method of serialization requires that the time zone data for the " "required key be available on both the serializing and deserializing side, " @@ -390,32 +401,32 @@ msgid "" "time zone data." msgstr "" -#: ../../library/zoneinfo.rst:339 +#: ../../library/zoneinfo.rst:340 msgid "Functions" msgstr "函式" -#: ../../library/zoneinfo.rst:343 +#: ../../library/zoneinfo.rst:344 msgid "" "Get a set containing all the valid keys for IANA time zones available " "anywhere on the time zone path. This is recalculated on every call to the " "function." msgstr "" -#: ../../library/zoneinfo.rst:347 +#: ../../library/zoneinfo.rst:348 msgid "" "This function only includes canonical zone names and does not include " "\"special\" zones such as those under the ``posix/`` and ``right/`` " "directories, or the ``posixrules`` zone." msgstr "" -#: ../../library/zoneinfo.rst:353 +#: ../../library/zoneinfo.rst:354 msgid "" "This function may open a large number of files, as the best way to determine " "if a file on the time zone path is a valid time zone is to read the \"magic " "string\" at the beginning." msgstr "" -#: ../../library/zoneinfo.rst:359 +#: ../../library/zoneinfo.rst:360 msgid "" "These values are not designed to be exposed to end-users; for user facing " "elements, applications should use something like CLDR (the Unicode Common " @@ -423,20 +434,20 @@ msgid "" "cautionary note on :attr:`ZoneInfo.key`." msgstr "" -#: ../../library/zoneinfo.rst:366 +#: ../../library/zoneinfo.rst:367 msgid "" "Sets or resets the time zone search path (:data:`TZPATH`) for the module. " "When called with no arguments, :data:`TZPATH` is set to the default value." msgstr "" -#: ../../library/zoneinfo.rst:369 +#: ../../library/zoneinfo.rst:370 msgid "" "Calling ``reset_tzpath`` will not invalidate the :class:`ZoneInfo` cache, " "and so calls to the primary ``ZoneInfo`` constructor will only use the new " "``TZPATH`` in the case of a cache miss." msgstr "" -#: ../../library/zoneinfo.rst:373 +#: ../../library/zoneinfo.rst:374 msgid "" "The ``to`` parameter must be a :term:`sequence` of strings or :class:`os." "PathLike` and not a string, all of which must be absolute paths. :exc:" @@ -444,24 +455,24 @@ msgid "" "passed." msgstr "" -#: ../../library/zoneinfo.rst:379 +#: ../../library/zoneinfo.rst:380 msgid "Globals" msgstr "" -#: ../../library/zoneinfo.rst:383 +#: ../../library/zoneinfo.rst:384 msgid "" "A read-only sequence representing the time zone search path -- when " "constructing a ``ZoneInfo`` from a key, the key is joined to each entry in " "the ``TZPATH``, and the first file found is used." msgstr "" -#: ../../library/zoneinfo.rst:387 +#: ../../library/zoneinfo.rst:388 msgid "" "``TZPATH`` may contain only absolute paths, never relative paths, regardless " "of how it is configured." msgstr "" -#: ../../library/zoneinfo.rst:390 +#: ../../library/zoneinfo.rst:391 msgid "" "The object that ``zoneinfo.TZPATH`` points to may change in response to a " "call to :func:`reset_tzpath`, so it is recommended to use ``zoneinfo." @@ -469,24 +480,24 @@ msgid "" "long-lived variable to ``zoneinfo.TZPATH``." msgstr "" -#: ../../library/zoneinfo.rst:395 +#: ../../library/zoneinfo.rst:396 msgid "" "For more information on configuring the time zone search path, see :ref:" "`zoneinfo_data_configuration`." msgstr "" -#: ../../library/zoneinfo.rst:399 +#: ../../library/zoneinfo.rst:400 msgid "Exceptions and warnings" msgstr "" -#: ../../library/zoneinfo.rst:403 +#: ../../library/zoneinfo.rst:404 msgid "" "Raised when construction of a :class:`ZoneInfo` object fails because the " "specified key could not be found on the system. This is a subclass of :exc:" "`KeyError`." msgstr "" -#: ../../library/zoneinfo.rst:409 +#: ../../library/zoneinfo.rst:410 msgid "" "Raised when :envvar:`PYTHONTZPATH` contains an invalid component that will " "be filtered out, such as a relative path." diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 1b785dec6b..0b954b788f 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-29 10:12+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -137,15 +137,13 @@ msgstr "" #: ../../reference/compound_stmts.rst:160 msgid "" -"The expression list is evaluated once; it should yield an iterable object. " -"An iterator is created for the result of the ``expression_list``. The suite " -"is then executed once for each item provided by the iterator, in the order " -"returned by the iterator. Each item in turn is assigned to the target list " -"using the standard rules for assignments (see :ref:`assignment`), and then " -"the suite is executed. When the items are exhausted (which is immediately " -"when the sequence is empty or an iterator raises a :exc:`StopIteration` " -"exception), the suite in the :keyword:`!else` clause, if present, is " -"executed, and the loop terminates." +"The ``starred_list`` expression is evaluated once; it should yield an :term:" +"`iterable` object. An :term:`iterator` is created for that iterable. The " +"first item provided by the iterator is then assigned to the target list " +"using the standard rules for assignments (see :ref:`assignment`), and the " +"suite is executed. This repeats for each item provided by the iterator. " +"When the iterator is exhausted, the suite in the :keyword:`!else` clause, if " +"present, is executed, and the loop terminates." msgstr "" #: ../../reference/compound_stmts.rst:173 @@ -173,90 +171,145 @@ msgid "" "e.g., ``list(range(3))`` returns the list ``[0, 1, 2]``." msgstr "" -#: ../../reference/compound_stmts.rst:205 +#: ../../reference/compound_stmts.rst:199 +msgid "Starred elements are now allowed in the expression list." +msgstr "" + +#: ../../reference/compound_stmts.rst:206 msgid "The :keyword:`!try` statement" msgstr "" -#: ../../reference/compound_stmts.rst:215 +#: ../../reference/compound_stmts.rst:216 msgid "" -"The :keyword:`try` statement specifies exception handlers and/or cleanup " +"The :keyword:`!try` statement specifies exception handlers and/or cleanup " "code for a group of statements:" msgstr "" -#: ../../reference/compound_stmts.rst:228 +#: ../../reference/compound_stmts.rst:232 +msgid "" +"Additional information on exceptions can be found in section :ref:" +"`exceptions`, and information on using the :keyword:`raise` statement to " +"generate exceptions may be found in section :ref:`raise`." +msgstr "" + +#: ../../reference/compound_stmts.rst:240 +msgid ":keyword:`!except` clause" +msgstr "" + +#: ../../reference/compound_stmts.rst:242 msgid "" -"The :keyword:`except` clause(s) specify one or more exception handlers. When " -"no exception occurs in the :keyword:`try` clause, no exception handler is " -"executed. When an exception occurs in the :keyword:`!try` suite, a search " -"for an exception handler is started. This search inspects the except " -"clauses in turn until one is found that matches the exception. An " -"expression-less except clause, if present, must be last; it matches any " -"exception. For an except clause with an expression, that expression is " -"evaluated, and the clause matches the exception if the resulting object is " -"\"compatible\" with the exception. An object is compatible with an " -"exception if the object is the class or a :term:`non-virtual base class " -"` of the exception object, or a tuple containing an " -"item that is the class or a non-virtual base class of the exception object." +"The :keyword:`!except` clause(s) specify one or more exception handlers. " +"When no exception occurs in the :keyword:`try` clause, no exception handler " +"is executed. When an exception occurs in the :keyword:`!try` suite, a search " +"for an exception handler is started. This search inspects the :keyword:`!" +"except` clauses in turn until one is found that matches the exception. An " +"expression-less :keyword:`!except` clause, if present, must be last; it " +"matches any exception. For an :keyword:`!except` clause with an expression, " +"that expression is evaluated, and the clause matches the exception if the " +"resulting object is \"compatible\" with the exception. An object is " +"compatible with an exception if the object is the class or a :term:`non-" +"virtual base class ` of the exception object, or a " +"tuple containing an item that is the class or a non-virtual base class of " +"the exception object." msgstr "" -#: ../../reference/compound_stmts.rst:241 +#: ../../reference/compound_stmts.rst:257 msgid "" -"If no except clause matches the exception, the search for an exception " -"handler continues in the surrounding code and on the invocation stack. [#]_" +"If no :keyword:`!except` clause matches the exception, the search for an " +"exception handler continues in the surrounding code and on the invocation " +"stack. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:244 +#: ../../reference/compound_stmts.rst:261 msgid "" -"If the evaluation of an expression in the header of an except clause raises " -"an exception, the original search for a handler is canceled and a search " -"starts for the new exception in the surrounding code and on the call stack " -"(it is treated as if the entire :keyword:`try` statement raised the " -"exception)." +"If the evaluation of an expression in the header of an :keyword:`!except` " +"clause raises an exception, the original search for a handler is canceled " +"and a search starts for the new exception in the surrounding code and on the " +"call stack (it is treated as if the entire :keyword:`try` statement raised " +"the exception)." msgstr "" -#: ../../reference/compound_stmts.rst:251 +#: ../../reference/compound_stmts.rst:269 msgid "" -"When a matching except clause is found, the exception is assigned to the " -"target specified after the :keyword:`!as` keyword in that except clause, if " -"present, and the except clause's suite is executed. All except clauses must " -"have an executable block. When the end of this block is reached, execution " -"continues normally after the entire try statement. (This means that if two " -"nested handlers exist for the same exception, and the exception occurs in " -"the try clause of the inner handler, the outer handler will not handle the " -"exception.)" +"When a matching :keyword:`!except` clause is found, the exception is " +"assigned to the target specified after the :keyword:`!as` keyword in that :" +"keyword:`!except` clause, if present, and the :keyword:`!except` clause's " +"suite is executed. All :keyword:`!except` clauses must have an executable " +"block. When the end of this block is reached, execution continues normally " +"after the entire :keyword:`try` statement. (This means that if two nested " +"handlers exist for the same exception, and the exception occurs in the :" +"keyword:`!try` clause of the inner handler, the outer handler will not " +"handle the exception.)" msgstr "" -#: ../../reference/compound_stmts.rst:259 +#: ../../reference/compound_stmts.rst:280 msgid "" "When an exception has been assigned using ``as target``, it is cleared at " -"the end of the except clause. This is as if ::" +"the end of the :keyword:`!except` clause. This is as if ::" msgstr "" -#: ../../reference/compound_stmts.rst:265 +#: ../../reference/compound_stmts.rst:286 msgid "was translated to ::" msgstr "" -#: ../../reference/compound_stmts.rst:273 +#: ../../reference/compound_stmts.rst:294 msgid "" "This means the exception must be assigned to a different name to be able to " -"refer to it after the except clause. Exceptions are cleared because with " -"the traceback attached to them, they form a reference cycle with the stack " -"frame, keeping all locals in that frame alive until the next garbage " -"collection occurs." +"refer to it after the :keyword:`!except` clause. Exceptions are cleared " +"because with the traceback attached to them, they form a reference cycle " +"with the stack frame, keeping all locals in that frame alive until the next " +"garbage collection occurs." msgstr "" -#: ../../reference/compound_stmts.rst:282 +#: ../../reference/compound_stmts.rst:304 msgid "" -"Before an except clause's suite is executed, details about the exception are " -"stored in the :mod:`sys` module and can be accessed via :func:`sys." -"exc_info`. :func:`sys.exc_info` returns a 3-tuple consisting of the " +"Before an :keyword:`!except` clause's suite is executed, details about the " +"exception are stored in the :mod:`sys` module and can be accessed via :func:" +"`sys.exc_info`. :func:`sys.exc_info` returns a 3-tuple consisting of the " "exception class, the exception instance and a traceback object (see section :" "ref:`types`) identifying the point in the program where the exception " "occurred. The details about the exception accessed via :func:`sys.exc_info` " "are restored to their previous values when leaving an exception handler::" msgstr "" -#: ../../reference/compound_stmts.rst:314 +#: ../../reference/compound_stmts.rst:338 +msgid ":keyword:`!except*` clause" +msgstr "" + +#: ../../reference/compound_stmts.rst:340 +msgid "" +"The :keyword:`!except*` clause(s) are used for handling :exc:`ExceptionGroup`" +"\\s. The exception type for matching is interpreted as in the case of :" +"keyword:`except`, but in the case of exception groups we can have partial " +"matches when the type matches some of the exceptions in the group. This " +"means that multiple :keyword:`!except*` clauses can execute, each handling " +"part of the exception group. Each clause executes once and handles an " +"exception group of all matching exceptions. Each exception in the group is " +"handled by at most one :keyword:`!except*` clause, the first that matches " +"it. ::" +msgstr "" + +#: ../../reference/compound_stmts.rst:367 +msgid "" +"Any remaining exceptions that were not handled by any :keyword:`!except*` " +"clause are re-raised at the end, combined into an exception group along with " +"all exceptions that were raised from within :keyword:`!except*` clauses." +msgstr "" + +#: ../../reference/compound_stmts.rst:371 +msgid "" +"An :keyword:`!except*` clause must have a matching type, and this type " +"cannot be a subclass of :exc:`BaseExceptionGroup`. It is not possible to " +"mix :keyword:`except` and :keyword:`!except*` in the same :keyword:`try`. :" +"keyword:`break`, :keyword:`continue` and :keyword:`return` cannot appear in " +"an :keyword:`!except*` clause." +msgstr "" + +#: ../../reference/compound_stmts.rst:388 +msgid ":keyword:`!else` clause" +msgstr "" + +#: ../../reference/compound_stmts.rst:390 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " "the :keyword:`try` suite, no exception was raised, and no :keyword:" @@ -265,12 +318,16 @@ msgid "" "keyword:`except` clauses." msgstr "" -#: ../../reference/compound_stmts.rst:322 +#: ../../reference/compound_stmts.rst:402 +msgid ":keyword:`!finally` clause" +msgstr "" + +#: ../../reference/compound_stmts.rst:404 msgid "" -"If :keyword:`finally` is present, it specifies a 'cleanup' handler. The :" +"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" "keyword:`try` clause is executed, including any :keyword:`except` and :" -"keyword:`!else` clauses. If an exception occurs in any of the clauses and " -"is not handled, the exception is temporarily saved. The :keyword:`!finally` " +"keyword:`else` clauses. If an exception occurs in any of the clauses and is " +"not handled, the exception is temporarily saved. The :keyword:`!finally` " "clause is executed. If there is a saved exception it is re-raised at the " "end of the :keyword:`!finally` clause. If the :keyword:`!finally` clause " "raises another exception, the saved exception is set as the context of the " @@ -279,46 +336,39 @@ msgid "" "exception is discarded::" msgstr "" -#: ../../reference/compound_stmts.rst:341 +#: ../../reference/compound_stmts.rst:423 msgid "" "The exception information is not available to the program during execution " -"of the :keyword:`finally` clause." +"of the :keyword:`!finally` clause." msgstr "" -#: ../../reference/compound_stmts.rst:349 +#: ../../reference/compound_stmts.rst:431 msgid "" "When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement " "is executed in the :keyword:`try` suite of a :keyword:`!try`...\\ :keyword:`!" -"finally` statement, the :keyword:`finally` clause is also executed 'on the " +"finally` statement, the :keyword:`!finally` clause is also executed 'on the " "way out.'" msgstr "" -#: ../../reference/compound_stmts.rst:353 +#: ../../reference/compound_stmts.rst:435 msgid "" "The return value of a function is determined by the last :keyword:`return` " -"statement executed. Since the :keyword:`finally` clause always executes, a :" -"keyword:`!return` statement executed in the :keyword:`!finally` clause will " -"always be the last one executed::" +"statement executed. Since the :keyword:`!finally` clause always executes, " +"a :keyword:`!return` statement executed in the :keyword:`!finally` clause " +"will always be the last one executed::" msgstr "" -#: ../../reference/compound_stmts.rst:367 -msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information on using the :keyword:`raise` statement to " -"generate exceptions may be found in section :ref:`raise`." -msgstr "" - -#: ../../reference/compound_stmts.rst:371 +#: ../../reference/compound_stmts.rst:449 msgid "" "Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" -"keyword:`finally` clause due to a problem with the implementation." +"keyword:`!finally` clause due to a problem with the implementation." msgstr "" -#: ../../reference/compound_stmts.rst:380 +#: ../../reference/compound_stmts.rst:458 msgid "The :keyword:`!with` statement" msgstr "" -#: ../../reference/compound_stmts.rst:389 +#: ../../reference/compound_stmts.rst:467 msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " @@ -326,37 +376,37 @@ msgid "" "`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" -#: ../../reference/compound_stmts.rst:399 +#: ../../reference/compound_stmts.rst:477 msgid "" "The execution of the :keyword:`with` statement with one \"item\" proceeds as " "follows:" msgstr "" -#: ../../reference/compound_stmts.rst:401 +#: ../../reference/compound_stmts.rst:479 msgid "" "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:404 +#: ../../reference/compound_stmts.rst:482 msgid "The context manager's :meth:`__enter__` is loaded for later use." msgstr "" -#: ../../reference/compound_stmts.rst:406 +#: ../../reference/compound_stmts.rst:484 msgid "The context manager's :meth:`__exit__` is loaded for later use." msgstr "" -#: ../../reference/compound_stmts.rst:408 +#: ../../reference/compound_stmts.rst:486 msgid "The context manager's :meth:`__enter__` method is invoked." msgstr "" -#: ../../reference/compound_stmts.rst:410 +#: ../../reference/compound_stmts.rst:488 msgid "" "If a target was included in the :keyword:`with` statement, the return value " "from :meth:`__enter__` is assigned to it." msgstr "" -#: ../../reference/compound_stmts.rst:415 +#: ../../reference/compound_stmts.rst:493 msgid "" "The :keyword:`with` statement guarantees that if the :meth:`__enter__` " "method returns without an error, then :meth:`__exit__` will always be " @@ -365,11 +415,11 @@ msgid "" "See step 6 below." msgstr "" -#: ../../reference/compound_stmts.rst:421 +#: ../../reference/compound_stmts.rst:499 msgid "The suite is executed." msgstr "" -#: ../../reference/compound_stmts.rst:423 +#: ../../reference/compound_stmts.rst:501 msgid "" "The context manager's :meth:`__exit__` method is invoked. If an exception " "caused the suite to be exited, its type, value, and traceback are passed as " @@ -377,7 +427,7 @@ msgid "" "supplied." msgstr "" -#: ../../reference/compound_stmts.rst:428 +#: ../../reference/compound_stmts.rst:506 msgid "" "If the suite was exited due to an exception, and the return value from the :" "meth:`__exit__` method was false, the exception is reraised. If the return " @@ -385,119 +435,119 @@ msgid "" "the statement following the :keyword:`with` statement." msgstr "" -#: ../../reference/compound_stmts.rst:433 +#: ../../reference/compound_stmts.rst:511 msgid "" "If the suite was exited for any reason other than an exception, the return " "value from :meth:`__exit__` is ignored, and execution proceeds at the normal " "location for the kind of exit that was taken." msgstr "" -#: ../../reference/compound_stmts.rst:437 -#: ../../reference/compound_stmts.rst:1427 -#: ../../reference/compound_stmts.rst:1468 +#: ../../reference/compound_stmts.rst:515 +#: ../../reference/compound_stmts.rst:1505 +#: ../../reference/compound_stmts.rst:1546 msgid "The following code::" msgstr "" -#: ../../reference/compound_stmts.rst:442 -#: ../../reference/compound_stmts.rst:467 -#: ../../reference/compound_stmts.rst:1473 +#: ../../reference/compound_stmts.rst:520 +#: ../../reference/compound_stmts.rst:545 +#: ../../reference/compound_stmts.rst:1551 msgid "is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:461 +#: ../../reference/compound_stmts.rst:539 msgid "" "With more than one item, the context managers are processed as if multiple :" "keyword:`with` statements were nested::" msgstr "" -#: ../../reference/compound_stmts.rst:473 +#: ../../reference/compound_stmts.rst:551 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: ../../reference/compound_stmts.rst:482 +#: ../../reference/compound_stmts.rst:560 msgid "Support for multiple context expressions." msgstr "" -#: ../../reference/compound_stmts.rst:485 +#: ../../reference/compound_stmts.rst:563 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: ../../reference/compound_stmts.rst:491 +#: ../../reference/compound_stmts.rst:569 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/compound_stmts.rst:491 +#: ../../reference/compound_stmts.rst:569 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/compound_stmts.rst:497 +#: ../../reference/compound_stmts.rst:575 msgid "The :keyword:`!match` statement" msgstr "" -#: ../../reference/compound_stmts.rst:510 +#: ../../reference/compound_stmts.rst:588 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:519 +#: ../../reference/compound_stmts.rst:597 msgid "" "This section uses single quotes to denote :ref:`soft keywords `." msgstr "" -#: ../../reference/compound_stmts.rst:522 +#: ../../reference/compound_stmts.rst:600 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: ../../reference/compound_stmts.rst:526 +#: ../../reference/compound_stmts.rst:604 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: ../../reference/compound_stmts.rst:528 +#: ../../reference/compound_stmts.rst:606 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: ../../reference/compound_stmts.rst:531 +#: ../../reference/compound_stmts.rst:609 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords `." msgstr "" -#: ../../reference/compound_stmts.rst:535 -#: ../../reference/compound_stmts.rst:1090 +#: ../../reference/compound_stmts.rst:613 +#: ../../reference/compound_stmts.rst:1168 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../reference/compound_stmts.rst:536 -#: ../../reference/compound_stmts.rst:1091 +#: ../../reference/compound_stmts.rst:614 +#: ../../reference/compound_stmts.rst:1169 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: ../../reference/compound_stmts.rst:540 +#: ../../reference/compound_stmts.rst:618 msgid "Overview" msgstr "" -#: ../../reference/compound_stmts.rst:542 +#: ../../reference/compound_stmts.rst:620 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: ../../reference/compound_stmts.rst:545 +#: ../../reference/compound_stmts.rst:623 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules `." msgstr "" -#: ../../reference/compound_stmts.rst:549 +#: ../../reference/compound_stmts.rst:627 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -507,7 +557,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: ../../reference/compound_stmts.rst:558 +#: ../../reference/compound_stmts.rst:636 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -516,87 +566,87 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: ../../reference/compound_stmts.rst:565 +#: ../../reference/compound_stmts.rst:643 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: ../../reference/compound_stmts.rst:568 +#: ../../reference/compound_stmts.rst:646 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: ../../reference/compound_stmts.rst:571 +#: ../../reference/compound_stmts.rst:649 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: ../../reference/compound_stmts.rst:573 +#: ../../reference/compound_stmts.rst:651 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: ../../reference/compound_stmts.rst:577 +#: ../../reference/compound_stmts.rst:655 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: ../../reference/compound_stmts.rst:581 +#: ../../reference/compound_stmts.rst:659 msgid "A sample match statement::" msgstr "" -#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:675 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: ../../reference/compound_stmts.rst:600 +#: ../../reference/compound_stmts.rst:678 msgid "Guards" msgstr "" -#: ../../reference/compound_stmts.rst:607 +#: ../../reference/compound_stmts.rst:685 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: ../../reference/compound_stmts.rst:612 +#: ../../reference/compound_stmts.rst:690 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: ../../reference/compound_stmts.rst:614 +#: ../../reference/compound_stmts.rst:692 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: ../../reference/compound_stmts.rst:618 +#: ../../reference/compound_stmts.rst:696 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: ../../reference/compound_stmts.rst:620 +#: ../../reference/compound_stmts.rst:698 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:623 +#: ../../reference/compound_stmts.rst:701 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: ../../reference/compound_stmts.rst:626 +#: ../../reference/compound_stmts.rst:704 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:629 +#: ../../reference/compound_stmts.rst:707 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -605,17 +655,17 @@ msgid "" "block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:639 +#: ../../reference/compound_stmts.rst:717 msgid "Irrefutable Case Blocks" msgstr "" -#: ../../reference/compound_stmts.rst:643 +#: ../../reference/compound_stmts.rst:721 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: ../../reference/compound_stmts.rst:646 +#: ../../reference/compound_stmts.rst:724 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -623,47 +673,47 @@ msgid "" "irrefutable:" msgstr "" -#: ../../reference/compound_stmts.rst:651 +#: ../../reference/compound_stmts.rst:729 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: ../../reference/compound_stmts.rst:653 +#: ../../reference/compound_stmts.rst:731 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: ../../reference/compound_stmts.rst:655 +#: ../../reference/compound_stmts.rst:733 msgid ":ref:`capture-patterns`" msgstr ":ref:`capture-patterns`" -#: ../../reference/compound_stmts.rst:657 +#: ../../reference/compound_stmts.rst:735 msgid ":ref:`wildcard-patterns`" msgstr ":ref:`wildcard-patterns`" -#: ../../reference/compound_stmts.rst:659 +#: ../../reference/compound_stmts.rst:737 msgid "parenthesized irrefutable patterns" msgstr "" -#: ../../reference/compound_stmts.rst:663 +#: ../../reference/compound_stmts.rst:741 msgid "Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:670 +#: ../../reference/compound_stmts.rst:748 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: ../../reference/compound_stmts.rst:672 +#: ../../reference/compound_stmts.rst:750 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: ../../reference/compound_stmts.rst:674 +#: ../../reference/compound_stmts.rst:752 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: ../../reference/compound_stmts.rst:677 +#: ../../reference/compound_stmts.rst:755 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: ../../reference/compound_stmts.rst:691 +#: ../../reference/compound_stmts.rst:769 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -673,70 +723,70 @@ msgid "" "forms." msgstr "" -#: ../../reference/compound_stmts.rst:701 +#: ../../reference/compound_stmts.rst:779 msgid "OR Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:703 +#: ../../reference/compound_stmts.rst:781 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:709 +#: ../../reference/compound_stmts.rst:787 msgid "" "Only the final subpattern may be :ref:`irrefutable `, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: ../../reference/compound_stmts.rst:712 +#: ../../reference/compound_stmts.rst:790 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:716 +#: ../../reference/compound_stmts.rst:794 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: ../../reference/compound_stmts.rst:722 +#: ../../reference/compound_stmts.rst:800 msgid "AS Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:724 +#: ../../reference/compound_stmts.rst:802 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:730 +#: ../../reference/compound_stmts.rst:808 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a a ``_``." msgstr "" -#: ../../reference/compound_stmts.rst:734 +#: ../../reference/compound_stmts.rst:812 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = ``." msgstr "" -#: ../../reference/compound_stmts.rst:741 +#: ../../reference/compound_stmts.rst:819 msgid "Literal Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:743 +#: ../../reference/compound_stmts.rst:821 msgid "" "A literal pattern corresponds to most :ref:`literals ` in Python. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:756 +#: ../../reference/compound_stmts.rst:834 msgid "" "The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" "`standard Python grammar <./grammar>`. Triple-quoted strings are " @@ -744,42 +794,42 @@ msgid "" "are not supported." msgstr "" -#: ../../reference/compound_stmts.rst:761 +#: ../../reference/compound_stmts.rst:839 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers `; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: ../../reference/compound_stmts.rst:765 +#: ../../reference/compound_stmts.rst:843 msgid "" "In simple terms, ``LITERAL`` will succeed only if `` == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: ../../reference/compound_stmts.rst:771 +#: ../../reference/compound_stmts.rst:849 msgid "Capture Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:773 +#: ../../reference/compound_stmts.rst:851 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:779 +#: ../../reference/compound_stmts.rst:857 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " "expresses). It is instead treated as a :token:`~python-grammar:" "wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:783 +#: ../../reference/compound_stmts.rst:861 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:786 +#: ../../reference/compound_stmts.rst:864 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -787,55 +837,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:791 +#: ../../reference/compound_stmts.rst:869 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "``." msgstr "" -#: ../../reference/compound_stmts.rst:796 +#: ../../reference/compound_stmts.rst:874 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:798 +#: ../../reference/compound_stmts.rst:876 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:804 +#: ../../reference/compound_stmts.rst:882 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:808 +#: ../../reference/compound_stmts.rst:886 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:813 +#: ../../reference/compound_stmts.rst:891 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:815 +#: ../../reference/compound_stmts.rst:893 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:823 +#: ../../reference/compound_stmts.rst:901 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:828 +#: ../../reference/compound_stmts.rst:906 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if `` == NAME1." "NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:832 +#: ../../reference/compound_stmts.rst:910 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 " @@ -843,44 +893,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:840 +#: ../../reference/compound_stmts.rst:918 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:842 +#: ../../reference/compound_stmts.rst:920 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:849 +#: ../../reference/compound_stmts.rst:927 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:854 +#: ../../reference/compound_stmts.rst:932 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:856 +#: ../../reference/compound_stmts.rst:934 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:867 +#: ../../reference/compound_stmts.rst:945 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:871 +#: ../../reference/compound_stmts.rst:949 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:876 +#: ../../reference/compound_stmts.rst:954 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 " @@ -888,40 +938,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:881 +#: ../../reference/compound_stmts.rst:959 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:884 +#: ../../reference/compound_stmts.rst:962 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:887 +#: ../../reference/compound_stmts.rst:965 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:890 +#: ../../reference/compound_stmts.rst:968 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:893 +#: ../../reference/compound_stmts.rst:971 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:895 +#: ../../reference/compound_stmts.rst:973 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:898 +#: ../../reference/compound_stmts.rst:976 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 " @@ -929,118 +979,118 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:903 +#: ../../reference/compound_stmts.rst:981 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:905 +#: ../../reference/compound_stmts.rst:983 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:908 +#: ../../reference/compound_stmts.rst:986 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:911 +#: ../../reference/compound_stmts.rst:989 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:915 +#: ../../reference/compound_stmts.rst:993 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:918 +#: ../../reference/compound_stmts.rst:996 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:924 +#: ../../reference/compound_stmts.rst:1002 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:927 +#: ../../reference/compound_stmts.rst:1005 msgid "check ```` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:928 +#: ../../reference/compound_stmts.rst:1006 msgid "``len(subject) == ``" msgstr "``len(subject) == ``" -#: ../../reference/compound_stmts.rst:929 +#: ../../reference/compound_stmts.rst:1007 msgid "" "``P1`` matches ``[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:930 +#: ../../reference/compound_stmts.rst:1008 msgid "" "``P2`` matches ``[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:931 +#: ../../reference/compound_stmts.rst:1009 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:936 +#: ../../reference/compound_stmts.rst:1014 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:938 +#: ../../reference/compound_stmts.rst:1016 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:949 +#: ../../reference/compound_stmts.rst:1027 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:952 +#: ../../reference/compound_stmts.rst:1030 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:956 +#: ../../reference/compound_stmts.rst:1034 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:959 +#: ../../reference/compound_stmts.rst:1037 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:961 +#: ../../reference/compound_stmts.rst:1039 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:965 +#: ../../reference/compound_stmts.rst:1043 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:969 +#: ../../reference/compound_stmts.rst:1047 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 " @@ -1048,256 +1098,256 @@ msgid "" "`__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:974 +#: ../../reference/compound_stmts.rst:1052 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:977 +#: ../../reference/compound_stmts.rst:1055 msgid "check ```` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:978 +#: ../../reference/compound_stmts.rst:1056 msgid "``KEY1 in ``" msgstr "``KEY1 in ``" -#: ../../reference/compound_stmts.rst:979 +#: ../../reference/compound_stmts.rst:1057 msgid "``P1`` matches ``[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:980 +#: ../../reference/compound_stmts.rst:1058 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:986 +#: ../../reference/compound_stmts.rst:1064 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:988 +#: ../../reference/compound_stmts.rst:1066 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:999 +#: ../../reference/compound_stmts.rst:1077 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1001 +#: ../../reference/compound_stmts.rst:1079 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1004 +#: ../../reference/compound_stmts.rst:1082 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1007 +#: ../../reference/compound_stmts.rst:1085 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:1010 +#: ../../reference/compound_stmts.rst:1088 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:1014 +#: ../../reference/compound_stmts.rst:1092 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:1018 +#: ../../reference/compound_stmts.rst:1096 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1021 +#: ../../reference/compound_stmts.rst:1099 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1023 +#: ../../reference/compound_stmts.rst:1101 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1026 +#: ../../reference/compound_stmts.rst:1104 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1028 +#: ../../reference/compound_stmts.rst:1106 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:1033 +#: ../../reference/compound_stmts.rst:1111 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1035 +#: ../../reference/compound_stmts.rst:1113 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:1039 +#: ../../reference/compound_stmts.rst:1117 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1041 +#: ../../reference/compound_stmts.rst:1119 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1043 +#: ../../reference/compound_stmts.rst:1121 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1046 +#: ../../reference/compound_stmts.rst:1124 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1049 +#: ../../reference/compound_stmts.rst:1127 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:1053 +#: ../../reference/compound_stmts.rst:1131 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1055 +#: ../../reference/compound_stmts.rst:1133 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1058 +#: ../../reference/compound_stmts.rst:1136 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1058 +#: ../../reference/compound_stmts.rst:1136 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1060 +#: ../../reference/compound_stmts.rst:1138 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1063 +#: ../../reference/compound_stmts.rst:1141 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1064 +#: ../../reference/compound_stmts.rst:1142 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1065 +#: ../../reference/compound_stmts.rst:1143 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1066 +#: ../../reference/compound_stmts.rst:1144 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1067 +#: ../../reference/compound_stmts.rst:1145 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1068 +#: ../../reference/compound_stmts.rst:1146 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1069 +#: ../../reference/compound_stmts.rst:1147 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1070 -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1148 +#: ../../reference/compound_stmts.rst:1599 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1071 +#: ../../reference/compound_stmts.rst:1149 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1072 +#: ../../reference/compound_stmts.rst:1150 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1073 -#: ../../reference/compound_stmts.rst:1524 +#: ../../reference/compound_stmts.rst:1151 +#: ../../reference/compound_stmts.rst:1602 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1075 +#: ../../reference/compound_stmts.rst:1153 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: ../../reference/compound_stmts.rst:1079 +#: ../../reference/compound_stmts.rst:1157 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1081 +#: ../../reference/compound_stmts.rst:1159 msgid "``isinstance(, CLS)``" msgstr "``isinstance(, CLS)``" -#: ../../reference/compound_stmts.rst:1082 +#: ../../reference/compound_stmts.rst:1160 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1084 +#: ../../reference/compound_stmts.rst:1162 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1084 +#: ../../reference/compound_stmts.rst:1162 msgid "``hasattr(, \"attr\")``" msgstr "``hasattr(, \"attr\")``" -#: ../../reference/compound_stmts.rst:1085 +#: ../../reference/compound_stmts.rst:1163 msgid "``P2`` matches ``.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1086 +#: ../../reference/compound_stmts.rst:1164 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1101 +#: ../../reference/compound_stmts.rst:1179 msgid "Function definitions" msgstr "函式定義" -#: ../../reference/compound_stmts.rst:1116 +#: ../../reference/compound_stmts.rst:1194 msgid "" "A function definition defines a user-defined function object (see section :" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1135 +#: ../../reference/compound_stmts.rst:1213 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 " @@ -1306,13 +1356,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1141 +#: ../../reference/compound_stmts.rst:1219 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1147 +#: ../../reference/compound_stmts.rst:1225 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1323,28 +1373,28 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1158 -#: ../../reference/compound_stmts.rst:1335 +#: ../../reference/compound_stmts.rst:1236 +#: ../../reference/compound_stmts.rst:1413 msgid "is roughly equivalent to ::" msgstr "" "大致等價於:\n" "\n" "::" -#: ../../reference/compound_stmts.rst:1163 +#: ../../reference/compound_stmts.rst:1241 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1165 +#: ../../reference/compound_stmts.rst:1243 msgid "" "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:1175 +#: ../../reference/compound_stmts.rst:1253 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1355,7 +1405,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1183 +#: ../../reference/compound_stmts.rst:1261 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1368,7 +1418,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1282 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1384,13 +1434,13 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1216 +#: ../../reference/compound_stmts.rst:1294 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1225 +#: ../../reference/compound_stmts.rst:1303 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1407,7 +1457,7 @@ msgid "" "different order than they appear in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1240 +#: ../../reference/compound_stmts.rst:1318 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1419,7 +1469,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1248 +#: ../../reference/compound_stmts.rst:1326 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1428,51 +1478,51 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1257 +#: ../../reference/compound_stmts.rst:1335 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1257 +#: ../../reference/compound_stmts.rst:1335 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1260 +#: ../../reference/compound_stmts.rst:1338 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1260 +#: ../../reference/compound_stmts.rst:1338 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1264 +#: ../../reference/compound_stmts.rst:1342 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1263 +#: ../../reference/compound_stmts.rst:1341 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables" msgstr "" -#: ../../reference/compound_stmts.rst:1267 +#: ../../reference/compound_stmts.rst:1345 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1267 +#: ../../reference/compound_stmts.rst:1345 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:1274 +#: ../../reference/compound_stmts.rst:1352 msgid "Class definitions" msgstr "" -#: ../../reference/compound_stmts.rst:1289 +#: ../../reference/compound_stmts.rst:1367 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1296 +#: ../../reference/compound_stmts.rst:1374 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1481,11 +1531,11 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1305 +#: ../../reference/compound_stmts.rst:1383 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1310 +#: ../../reference/compound_stmts.rst:1388 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 " @@ -1497,7 +1547,7 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1319 +#: ../../reference/compound_stmts.rst:1397 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 " @@ -1505,30 +1555,30 @@ msgid "" "definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1324 +#: ../../reference/compound_stmts.rst:1402 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: ../../reference/compound_stmts.rst:1329 +#: ../../reference/compound_stmts.rst:1407 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1418 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:1343 +#: ../../reference/compound_stmts.rst:1421 msgid "" "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:1348 +#: ../../reference/compound_stmts.rst:1426 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1541,35 +1591,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1363 +#: ../../reference/compound_stmts.rst:1441 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1439 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:1366 +#: ../../reference/compound_stmts.rst:1444 msgid ":pep:`3129` - Class Decorators" msgstr "" -#: ../../reference/compound_stmts.rst:1366 +#: ../../reference/compound_stmts.rst:1444 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1373 +#: ../../reference/compound_stmts.rst:1451 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1459 msgid "Coroutine function definition" msgstr "" -#: ../../reference/compound_stmts.rst:1391 +#: ../../reference/compound_stmts.rst:1469 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1577,189 +1627,189 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1395 +#: ../../reference/compound_stmts.rst:1473 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:1398 +#: ../../reference/compound_stmts.rst:1476 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1401 +#: ../../reference/compound_stmts.rst:1479 msgid "An example of a coroutine function::" msgstr "" "一個協程韓式函式範例:\n" "\n" "::" -#: ../../reference/compound_stmts.rst:1407 +#: ../../reference/compound_stmts.rst:1485 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:1415 +#: ../../reference/compound_stmts.rst:1493 msgid "The :keyword:`!async for` statement" msgstr "" -#: ../../reference/compound_stmts.rst:1420 +#: ../../reference/compound_stmts.rst:1498 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:1424 +#: ../../reference/compound_stmts.rst:1502 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1512 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1450 +#: ../../reference/compound_stmts.rst:1528 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "" "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`\\ 。" -#: ../../reference/compound_stmts.rst:1452 +#: ../../reference/compound_stmts.rst:1530 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1460 +#: ../../reference/compound_stmts.rst:1538 msgid "The :keyword:`!async with` statement" msgstr "" -#: ../../reference/compound_stmts.rst:1465 +#: ../../reference/compound_stmts.rst:1543 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:1492 +#: ../../reference/compound_stmts.rst:1570 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "" "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`\\ 。" -#: ../../reference/compound_stmts.rst:1494 +#: ../../reference/compound_stmts.rst:1572 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1500 +#: ../../reference/compound_stmts.rst:1578 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1500 +#: ../../reference/compound_stmts.rst:1578 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1505 +#: ../../reference/compound_stmts.rst:1583 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1506 +#: ../../reference/compound_stmts.rst:1584 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:1510 +#: ../../reference/compound_stmts.rst:1588 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1512 +#: ../../reference/compound_stmts.rst:1590 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1513 +#: ../../reference/compound_stmts.rst:1591 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1514 +#: ../../reference/compound_stmts.rst:1592 msgid "" "a builtin class that has its (CPython) :data:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1515 -#: ../../reference/compound_stmts.rst:1534 +#: ../../reference/compound_stmts.rst:1593 +#: ../../reference/compound_stmts.rst:1612 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1517 +#: ../../reference/compound_stmts.rst:1595 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1519 +#: ../../reference/compound_stmts.rst:1597 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1520 +#: ../../reference/compound_stmts.rst:1598 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1522 +#: ../../reference/compound_stmts.rst:1600 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1523 +#: ../../reference/compound_stmts.rst:1601 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1526 +#: ../../reference/compound_stmts.rst:1604 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1529 +#: ../../reference/compound_stmts.rst:1607 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1609 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1532 +#: ../../reference/compound_stmts.rst:1610 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1533 +#: ../../reference/compound_stmts.rst:1611 msgid "" "a builtin class that has its (CPython) :data:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1536 +#: ../../reference/compound_stmts.rst:1614 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1539 +#: ../../reference/compound_stmts.rst:1617 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:1543 +#: ../../reference/compound_stmts.rst:1621 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 1acf3a2d26..fdc90f9ae6 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -1156,7 +1156,7 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1184 +#: ../../reference/datamodel.rst:1219 msgid "Internal types" msgstr "" @@ -1167,7 +1167,7 @@ msgid "" "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1015 +#: ../../reference/datamodel.rst:1050 msgid "Code objects" msgstr "" @@ -1183,31 +1183,32 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:974 +#: ../../reference/datamodel.rst:975 msgid "" "Special read-only attributes: :attr:`co_name` gives the function name; :attr:" -"`co_argcount` is the total number of positional arguments (including " -"positional-only arguments and arguments with default values); :attr:" -"`co_posonlyargcount` is the number of positional-only arguments (including " -"arguments with default values); :attr:`co_kwonlyargcount` is the number of " -"keyword-only arguments (including arguments with default values); :attr:" -"`co_nlocals` is the number of local variables used by the function " -"(including arguments); :attr:`co_varnames` is a tuple containing the names " -"of the local variables (starting with the argument names); :attr:" -"`co_cellvars` is a tuple containing the names of local variables that are " -"referenced by nested functions; :attr:`co_freevars` is a tuple containing " -"the names of free variables; :attr:`co_code` is a string representing the " -"sequence of bytecode instructions; :attr:`co_consts` is a tuple containing " -"the literals used by the bytecode; :attr:`co_names` is a tuple containing " -"the names used by the bytecode; :attr:`co_filename` is the filename from " -"which the code was compiled; :attr:`co_firstlineno` is the first line number " -"of the function; :attr:`co_lnotab` is a string encoding the mapping from " -"bytecode offsets to line numbers (for details see the source code of the " -"interpreter); :attr:`co_stacksize` is the required stack size; :attr:" -"`co_flags` is an integer encoding a number of flags for the interpreter." -msgstr "" - -#: ../../reference/datamodel.rst:998 +"`co_qualname` gives the fully qualified function name; :attr:`co_argcount` " +"is the total number of positional arguments (including positional-only " +"arguments and arguments with default values); :attr:`co_posonlyargcount` is " +"the number of positional-only arguments (including arguments with default " +"values); :attr:`co_kwonlyargcount` is the number of keyword-only arguments " +"(including arguments with default values); :attr:`co_nlocals` is the number " +"of local variables used by the function (including arguments); :attr:" +"`co_varnames` is a tuple containing the names of the local variables " +"(starting with the argument names); :attr:`co_cellvars` is a tuple " +"containing the names of local variables that are referenced by nested " +"functions; :attr:`co_freevars` is a tuple containing the names of free " +"variables; :attr:`co_code` is a string representing the sequence of bytecode " +"instructions; :attr:`co_consts` is a tuple containing the literals used by " +"the bytecode; :attr:`co_names` is a tuple containing the names used by the " +"bytecode; :attr:`co_filename` is the filename from which the code was " +"compiled; :attr:`co_firstlineno` is the first line number of the function; :" +"attr:`co_lnotab` is a string encoding the mapping from bytecode offsets to " +"line numbers (for details see the source code of the interpreter); :attr:" +"`co_stacksize` is the required stack size; :attr:`co_flags` is an integer " +"encoding a number of flags for the interpreter." +msgstr "" + +#: ../../reference/datamodel.rst:1000 msgid "" "The following flag bits are defined for :attr:`co_flags`: bit ``0x04`` is " "set if the function uses the ``*arguments`` syntax to accept an arbitrary " @@ -1216,7 +1217,7 @@ msgid "" "set if the function is a generator." msgstr "" -#: ../../reference/datamodel.rst:1004 +#: ../../reference/datamodel.rst:1006 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`co_flags` to indicate whether a code object was compiled with " @@ -1225,27 +1226,81 @@ msgid "" "used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1010 +#: ../../reference/datamodel.rst:1012 msgid "Other bits in :attr:`co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1014 +#: ../../reference/datamodel.rst:1016 msgid "" "If a code object represents a function, the first item in :attr:`co_consts` " "is the documentation string of the function, or ``None`` if undefined." msgstr "" -#: ../../reference/datamodel.rst:1077 +#: ../../reference/datamodel.rst:1021 +msgid "" +"Returns an iterable over the source code positions of each bytecode " +"instruction in the code object." +msgstr "" + +#: ../../reference/datamodel.rst:1024 +msgid "" +"The iterator returns tuples containing the ``(start_line, end_line, " +"start_column, end_column)``. The *i-th* tuple corresponds to the position of " +"the source code that compiled to the *i-th* instruction. Column information " +"is 0-indexed utf-8 byte offsets on the given source line." +msgstr "" + +#: ../../reference/datamodel.rst:1030 +msgid "" +"This positional information can be missing. A non-exhaustive lists of cases " +"where this may happen:" +msgstr "" + +#: ../../reference/datamodel.rst:1033 +msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." +msgstr "" + +#: ../../reference/datamodel.rst:1034 +msgid "" +"Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." +msgstr "" + +#: ../../reference/datamodel.rst:1035 +msgid "Position tuples corresponding to artificial instructions." +msgstr "" + +#: ../../reference/datamodel.rst:1036 +msgid "" +"Line and column numbers that can't be represented due to implementation " +"specific limitations." +msgstr "" + +#: ../../reference/datamodel.rst:1039 +msgid "" +"When this occurs, some or all of the tuple elements can be :const:`None`." +msgstr "" + +#: ../../reference/datamodel.rst:1045 +msgid "" +"This feature requires storing column positions in code objects which may " +"result in a small increase of disk usage of compiled Python files or " +"interpreter memory usage. To avoid storing the extra information and/or " +"deactivate printing the extra traceback information, the :option:`-X` " +"``no_debug_ranges`` command line flag or the :envvar:`PYTHONNODEBUGRANGES` " +"environment variable can be used." +msgstr "" + +#: ../../reference/datamodel.rst:1112 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1022 +#: ../../reference/datamodel.rst:1057 msgid "" "Frame objects represent execution frames. They may occur in traceback " "objects (see below), and are also passed to registered trace functions." msgstr "" -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:1068 msgid "" "Special read-only attributes: :attr:`f_back` is to the previous stack frame " "(towards the caller), or ``None`` if this is the bottom stack frame; :attr:" @@ -1256,13 +1311,13 @@ msgid "" "the bytecode string of the code object)." msgstr "" -#: ../../reference/datamodel.rst:1041 +#: ../../reference/datamodel.rst:1076 msgid "" "Accessing ``f_code`` raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1085 msgid "" "Special writable attributes: :attr:`f_trace`, if not ``None``, is a function " "called for various events during code execution (this is used by the " @@ -1270,7 +1325,7 @@ msgid "" "can be disabled by setting :attr:`f_trace_lines` to :const:`False`." msgstr "" -#: ../../reference/datamodel.rst:1055 +#: ../../reference/datamodel.rst:1090 msgid "" "Implementations *may* allow per-opcode events to be requested by setting :" "attr:`f_trace_opcodes` to :const:`True`. Note that this may lead to " @@ -1278,7 +1333,7 @@ msgid "" "escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1060 +#: ../../reference/datamodel.rst:1095 msgid "" ":attr:`f_lineno` is the current line number of the frame --- writing to this " "from within a trace function jumps to the given line (only for the bottom-" @@ -1286,11 +1341,11 @@ msgid "" "Statement) by writing to f_lineno." msgstr "" -#: ../../reference/datamodel.rst:1065 +#: ../../reference/datamodel.rst:1100 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1069 +#: ../../reference/datamodel.rst:1104 msgid "" "This method clears all references to local variables held by the frame. " "Also, if the frame belonged to a generator, the generator is finalized. " @@ -1298,22 +1353,22 @@ msgid "" "catching an exception and storing its traceback for later use)." msgstr "" -#: ../../reference/datamodel.rst:1075 +#: ../../reference/datamodel.rst:1110 msgid ":exc:`RuntimeError` is raised if the frame is currently executing." msgstr "" -#: ../../reference/datamodel.rst:1140 +#: ../../reference/datamodel.rst:1175 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1092 +#: ../../reference/datamodel.rst:1127 msgid "" "Traceback objects represent a stack trace of an exception. A traceback " "object is implicitly created when an exception occurs, and may also be " "explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1096 +#: ../../reference/datamodel.rst:1131 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1323,21 +1378,21 @@ msgid "" "exc_info()``, and as the ``__traceback__`` attribute of the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1139 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " "interactive, it is also made available to the user as ``sys.last_traceback``." msgstr "" -#: ../../reference/datamodel.rst:1109 +#: ../../reference/datamodel.rst:1144 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the ``tb_next`` attributes should be linked to form a full " "stack trace." msgstr "" -#: ../../reference/datamodel.rst:1119 +#: ../../reference/datamodel.rst:1154 msgid "" "Special read-only attributes: :attr:`tb_frame` points to the execution frame " "of the current level; :attr:`tb_lineno` gives the line number where the " @@ -1347,47 +1402,47 @@ msgid "" "statement with no matching except clause or with a finally clause." msgstr "" -#: ../../reference/datamodel.rst:1128 +#: ../../reference/datamodel.rst:1163 msgid "" "Accessing ``tb_frame`` raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" -#: ../../reference/datamodel.rst:1134 +#: ../../reference/datamodel.rst:1169 msgid "" "Special writable attribute: :attr:`tb_next` is the next level in the stack " "trace (towards the frame where the exception occurred), or ``None`` if there " "is no next level." msgstr "" -#: ../../reference/datamodel.rst:1138 +#: ../../reference/datamodel.rst:1173 msgid "" "Traceback objects can now be explicitly instantiated from Python code, and " "the ``tb_next`` attribute of existing instances can be updated." msgstr "" -#: ../../reference/datamodel.rst:1167 +#: ../../reference/datamodel.rst:1202 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1145 +#: ../../reference/datamodel.rst:1180 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1154 +#: ../../reference/datamodel.rst:1189 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1158 +#: ../../reference/datamodel.rst:1193 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1162 +#: ../../reference/datamodel.rst:1197 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1397,11 +1452,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1176 +#: ../../reference/datamodel.rst:1211 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1170 +#: ../../reference/datamodel.rst:1205 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1412,11 +1467,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1184 +#: ../../reference/datamodel.rst:1219 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1214 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1425,11 +1480,11 @@ msgid "" "objects are created by the built-in :func:`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1189 +#: ../../reference/datamodel.rst:1224 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1195 +#: ../../reference/datamodel.rst:1230 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1443,7 +1498,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:1241 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1452,7 +1507,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1212 +#: ../../reference/datamodel.rst:1247 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1462,11 +1517,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1223 +#: ../../reference/datamodel.rst:1258 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1229 +#: ../../reference/datamodel.rst:1264 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1476,7 +1531,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1236 +#: ../../reference/datamodel.rst:1271 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1484,7 +1539,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1241 +#: ../../reference/datamodel.rst:1276 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1493,13 +1548,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1246 +#: ../../reference/datamodel.rst:1281 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1249 +#: ../../reference/datamodel.rst:1284 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1507,7 +1562,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1258 +#: ../../reference/datamodel.rst:1293 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1517,7 +1572,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1300 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1525,7 +1580,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1278 +#: ../../reference/datamodel.rst:1313 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1534,7 +1589,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1284 +#: ../../reference/datamodel.rst:1319 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1544,20 +1599,20 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1291 +#: ../../reference/datamodel.rst:1326 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits." msgstr "" -#: ../../reference/datamodel.rst:1296 +#: ../../reference/datamodel.rst:1331 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1301 +#: ../../reference/datamodel.rst:1336 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1568,18 +1623,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1311 +#: ../../reference/datamodel.rst:1346 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1315 +#: ../../reference/datamodel.rst:1350 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1319 +#: ../../reference/datamodel.rst:1354 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1588,7 +1643,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1325 +#: ../../reference/datamodel.rst:1360 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -1599,7 +1654,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1340 +#: ../../reference/datamodel.rst:1375 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -1611,13 +1666,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1384 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1360 +#: ../../reference/datamodel.rst:1395 msgid "" "Called by :func:`str(object) ` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -1625,26 +1680,26 @@ msgid "" "` object." msgstr "" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1400 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1369 +#: ../../reference/datamodel.rst:1404 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1379 +#: ../../reference/datamodel.rst:1414 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1390 +#: ../../reference/datamodel.rst:1425 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -1656,28 +1711,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1400 +#: ../../reference/datamodel.rst:1435 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1402 +#: ../../reference/datamodel.rst:1437 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1439 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1408 +#: ../../reference/datamodel.rst:1443 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1424 +#: ../../reference/datamodel.rst:1459 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1513 +#: ../../reference/datamodel.rst:1548 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -1796,7 +1851,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1522 +#: ../../reference/datamodel.rst:1557 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are \"salted" "\" with an unpredictable random value. Although they remain constant within " @@ -1804,7 +1859,7 @@ msgid "" "invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1527 +#: ../../reference/datamodel.rst:1562 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -1812,22 +1867,22 @@ msgid "" "ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1532 +#: ../../reference/datamodel.rst:1567 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1536 +#: ../../reference/datamodel.rst:1571 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`\\ 。" -#: ../../reference/datamodel.rst:1538 +#: ../../reference/datamodel.rst:1573 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1546 +#: ../../reference/datamodel.rst:1581 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -1836,18 +1891,18 @@ msgid "" "`__len__` nor :meth:`__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1557 +#: ../../reference/datamodel.rst:1592 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1559 +#: ../../reference/datamodel.rst:1594 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1567 +#: ../../reference/datamodel.rst:1602 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -1857,7 +1912,7 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1574 +#: ../../reference/datamodel.rst:1609 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -1870,7 +1925,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1622 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -1882,82 +1937,82 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1598 +#: ../../reference/datamodel.rst:1633 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or built-in functions. " "See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1602 +#: ../../reference/datamodel.rst:1637 msgid "" "Raises an :ref:`auditing event ` ``object.__getattr__`` with " "arguments ``obj``, ``name``." msgstr "" -#: ../../reference/datamodel.rst:1604 +#: ../../reference/datamodel.rst:1639 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1611 +#: ../../reference/datamodel.rst:1646 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1615 +#: ../../reference/datamodel.rst:1650 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1619 +#: ../../reference/datamodel.rst:1654 msgid "" "Raises an :ref:`auditing event ` ``object.__setattr__`` with " "arguments ``obj``, ``name``, ``value``." msgstr "" -#: ../../reference/datamodel.rst:1621 +#: ../../reference/datamodel.rst:1656 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:1628 +#: ../../reference/datamodel.rst:1663 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1666 msgid "" "Raises an :ref:`auditing event ` ``object.__delattr__`` with " "arguments ``obj``, ``name``." msgstr "" -#: ../../reference/datamodel.rst:1633 +#: ../../reference/datamodel.rst:1668 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1640 +#: ../../reference/datamodel.rst:1675 msgid "" "Called when :func:`dir` is called on the object. A sequence must be " "returned. :func:`dir` converts the returned sequence to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:1645 +#: ../../reference/datamodel.rst:1680 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:1652 +#: ../../reference/datamodel.rst:1687 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -1969,21 +2024,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:1661 +#: ../../reference/datamodel.rst:1696 msgid "" "The ``__dir__`` function should accept no arguments, and return a sequence " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:1665 +#: ../../reference/datamodel.rst:1700 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:1683 +#: ../../reference/datamodel.rst:1718 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -1991,27 +2046,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:1688 +#: ../../reference/datamodel.rst:1723 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1726 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:1696 +#: ../../reference/datamodel.rst:1731 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:1697 +#: ../../reference/datamodel.rst:1732 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:1703 +#: ../../reference/datamodel.rst:1738 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:1705 +#: ../../reference/datamodel.rst:1740 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2021,7 +2076,7 @@ msgid "" "owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:1715 +#: ../../reference/datamodel.rst:1750 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2030,13 +2085,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:1721 +#: ../../reference/datamodel.rst:1756 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1724 +#: ../../reference/datamodel.rst:1759 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2046,25 +2101,25 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:1733 +#: ../../reference/datamodel.rst:1768 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:1736 +#: ../../reference/datamodel.rst:1771 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1777 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:1745 +#: ../../reference/datamodel.rst:1780 msgid "" "The attribute :attr:`__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2075,11 +2130,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:1756 +#: ../../reference/datamodel.rst:1791 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:1758 +#: ../../reference/datamodel.rst:1793 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2088,7 +2143,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:1764 +#: ../../reference/datamodel.rst:1799 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2096,7 +2151,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:1769 +#: ../../reference/datamodel.rst:1804 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2104,55 +2159,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:1774 +#: ../../reference/datamodel.rst:1809 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:1779 +#: ../../reference/datamodel.rst:1814 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:1778 +#: ../../reference/datamodel.rst:1813 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:1783 +#: ../../reference/datamodel.rst:1818 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:1782 +#: ../../reference/datamodel.rst:1817 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:1787 +#: ../../reference/datamodel.rst:1822 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1821 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:1793 +#: ../../reference/datamodel.rst:1828 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:1790 +#: ../../reference/datamodel.rst:1825 msgid "" -"If ``a`` is an instance of :class:`super`, then the binding ``super(B, obj)." -"m()`` searches ``obj.__class__.__mro__`` for the base class ``A`` " -"immediately following ``B`` and then invokes the descriptor with the call: " -"``A.__dict__['m'].__get__(obj, obj.__class__)``." +"A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " +"for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." +"__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:1795 +#: ../../reference/datamodel.rst:1862 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2169,7 +2223,7 @@ msgid "" "can be overridden by instances." msgstr "" -#: ../../reference/datamodel.rst:1809 +#: ../../reference/datamodel.rst:1876 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2178,30 +2232,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:1815 +#: ../../reference/datamodel.rst:1882 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:1822 +#: ../../reference/datamodel.rst:1889 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:1824 +#: ../../reference/datamodel.rst:1891 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1895 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:1833 +#: ../../reference/datamodel.rst:1900 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2209,18 +2263,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:1841 +#: ../../reference/datamodel.rst:1908 msgid "Notes on using *__slots__*" msgstr "" -#: ../../reference/datamodel.rst:1843 +#: ../../reference/datamodel.rst:1910 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:1847 +#: ../../reference/datamodel.rst:1914 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2229,7 +2283,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:1854 +#: ../../reference/datamodel.rst:1921 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2237,7 +2291,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:1860 +#: ../../reference/datamodel.rst:1927 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2245,7 +2299,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:1866 +#: ../../reference/datamodel.rst:1933 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2254,7 +2308,7 @@ msgid "" "names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:1872 +#: ../../reference/datamodel.rst:1939 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2263,17 +2317,17 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:1877 +#: ../../reference/datamodel.rst:1944 msgid "" "Nonempty *__slots__* does not work for classes derived from \"variable-length" "\" built-in types such as :class:`int`, :class:`bytes` and :class:`tuple`." msgstr "" -#: ../../reference/datamodel.rst:1880 +#: ../../reference/datamodel.rst:1947 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:1882 +#: ../../reference/datamodel.rst:1949 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2281,13 +2335,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:1887 +#: ../../reference/datamodel.rst:1954 msgid "" ":attr:`~instance.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:1890 +#: ../../reference/datamodel.rst:1957 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2295,18 +2349,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:1896 +#: ../../reference/datamodel.rst:1963 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:1904 +#: ../../reference/datamodel.rst:1971 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:1906 +#: ../../reference/datamodel.rst:1973 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2316,14 +2370,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:1915 +#: ../../reference/datamodel.rst:1982 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:1919 +#: ../../reference/datamodel.rst:1986 msgid "" "Keyword arguments which are given to a new class are passed to the parent's " "class ``__init_subclass__``. For compatibility with other classes using " @@ -2331,13 +2385,13 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:1933 +#: ../../reference/datamodel.rst:2000 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:1938 +#: ../../reference/datamodel.rst:2005 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2345,41 +2399,41 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:1946 +#: ../../reference/datamodel.rst:2013 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:1951 +#: ../../reference/datamodel.rst:2018 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:1957 +#: ../../reference/datamodel.rst:2024 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:1968 +#: ../../reference/datamodel.rst:2035 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`\\ 。" -#: ../../reference/datamodel.rst:1976 +#: ../../reference/datamodel.rst:2043 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:1983 +#: ../../reference/datamodel.rst:2050 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:1987 +#: ../../reference/datamodel.rst:2054 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2387,41 +2441,41 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2001 +#: ../../reference/datamodel.rst:2068 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2004 +#: ../../reference/datamodel.rst:2071 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2006 +#: ../../reference/datamodel.rst:2073 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2007 +#: ../../reference/datamodel.rst:2074 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2075 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2009 +#: ../../reference/datamodel.rst:2076 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2010 +#: ../../reference/datamodel.rst:2077 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2014 +#: ../../reference/datamodel.rst:2081 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2016 +#: ../../reference/datamodel.rst:2083 msgid "" "If a base that appears in class definition is not an instance of :class:" "`type`, then an ``__mro_entries__`` method is searched on it. If found, it " @@ -2430,37 +2484,37 @@ msgid "" "such case the original base is ignored." msgstr "" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2091 msgid ":pep:`560` - Core support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2028 +#: ../../reference/datamodel.rst:2095 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2032 +#: ../../reference/datamodel.rst:2099 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2034 +#: ../../reference/datamodel.rst:2101 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2035 +#: ../../reference/datamodel.rst:2102 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2037 +#: ../../reference/datamodel.rst:2104 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2040 +#: ../../reference/datamodel.rst:2107 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2469,11 +2523,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2050 +#: ../../reference/datamodel.rst:2117 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2055 +#: ../../reference/datamodel.rst:2122 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -2485,25 +2539,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2064 +#: ../../reference/datamodel.rst:2131 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2069 +#: ../../reference/datamodel.rst:2136 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2070 +#: ../../reference/datamodel.rst:2137 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2074 +#: ../../reference/datamodel.rst:2141 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2079 +#: ../../reference/datamodel.rst:2146 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -2512,7 +2566,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2085 +#: ../../reference/datamodel.rst:2152 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -2521,11 +2575,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2094 +#: ../../reference/datamodel.rst:2161 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2101 +#: ../../reference/datamodel.rst:2168 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -2533,7 +2587,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2106 +#: ../../reference/datamodel.rst:2173 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -2544,7 +2598,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2183 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -2553,39 +2607,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2122 +#: ../../reference/datamodel.rst:2189 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2126 +#: ../../reference/datamodel.rst:2193 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2128 +#: ../../reference/datamodel.rst:2195 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2130 +#: ../../reference/datamodel.rst:2197 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2133 +#: ../../reference/datamodel.rst:2200 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2137 +#: ../../reference/datamodel.rst:2204 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -2593,19 +2647,19 @@ msgid "" "becomes the :attr:`~object.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2144 +#: ../../reference/datamodel.rst:2211 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2145 +#: ../../reference/datamodel.rst:2212 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2149 +#: ../../reference/datamodel.rst:2216 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2151 +#: ../../reference/datamodel.rst:2218 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -2613,17 +2667,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2158 +#: ../../reference/datamodel.rst:2225 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2160 +#: ../../reference/datamodel.rst:2227 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2163 +#: ../../reference/datamodel.rst:2230 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -2631,21 +2685,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2170 +#: ../../reference/datamodel.rst:2237 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2177 +#: ../../reference/datamodel.rst:2244 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2182 +#: ../../reference/datamodel.rst:2249 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -2653,11 +2707,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2193 +#: ../../reference/datamodel.rst:2260 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2190 +#: ../../reference/datamodel.rst:2257 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" @@ -2666,11 +2720,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2198 +#: ../../reference/datamodel.rst:2265 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2200 +#: ../../reference/datamodel.rst:2267 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -2678,65 +2732,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2275 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2275 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2211 +#: ../../reference/datamodel.rst:2278 msgid ":ref:`Generic Alias Types`" msgstr "" -#: ../../reference/datamodel.rst:2211 +#: ../../reference/datamodel.rst:2278 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2214 +#: ../../reference/datamodel.rst:2281 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2214 +#: ../../reference/datamodel.rst:2281 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2217 +#: ../../reference/datamodel.rst:2284 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2222 +#: ../../reference/datamodel.rst:2289 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2225 +#: ../../reference/datamodel.rst:2292 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:2231 +#: ../../reference/datamodel.rst:2298 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2233 +#: ../../reference/datamodel.rst:2300 msgid "" "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:2237 +#: ../../reference/datamodel.rst:2304 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -2745,7 +2799,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2243 +#: ../../reference/datamodel.rst:2310 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -2753,11 +2807,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2253 +#: ../../reference/datamodel.rst:2320 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2255 +#: ../../reference/datamodel.rst:2322 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -2767,14 +2821,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2262 +#: ../../reference/datamodel.rst:2329 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:2290 +#: ../../reference/datamodel.rst:2357 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 " @@ -2784,40 +2838,40 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2309 +#: ../../reference/datamodel.rst:2376 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:2334 +#: ../../reference/datamodel.rst:2401 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2333 +#: ../../reference/datamodel.rst:2400 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:2341 +#: ../../reference/datamodel.rst:2408 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2348 +#: ../../reference/datamodel.rst:2415 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:2355 +#: ../../reference/datamodel.rst:2422 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2357 +#: ../../reference/datamodel.rst:2424 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences ` (such as :class:`lists " @@ -2853,7 +2907,7 @@ msgid "" "the values." msgstr "" -#: ../../reference/datamodel.rst:2397 +#: ../../reference/datamodel.rst:2464 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 " @@ -2861,7 +2915,7 @@ msgid "" "zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2471 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:" @@ -2870,7 +2924,7 @@ msgid "" "`__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2413 +#: ../../reference/datamodel.rst:2480 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). " @@ -2880,20 +2934,20 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2427 +#: ../../reference/datamodel.rst:2494 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2431 +#: ../../reference/datamodel.rst:2498 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2435 +#: ../../reference/datamodel.rst:2502 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2440 +#: ../../reference/datamodel.rst:2507 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers and slice objects. Note that the " @@ -2906,20 +2960,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2452 +#: ../../reference/datamodel.rst:2519 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:2457 +#: ../../reference/datamodel.rst:2524 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:2465 +#: ../../reference/datamodel.rst:2532 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -2928,7 +2982,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2474 +#: ../../reference/datamodel.rst:2541 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -2937,13 +2991,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2483 +#: ../../reference/datamodel.rst:2550 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:2489 +#: ../../reference/datamodel.rst:2556 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -2951,14 +3005,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2497 +#: ../../reference/datamodel.rst:2564 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:2501 +#: ../../reference/datamodel.rst:2568 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 :" @@ -2967,7 +3021,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2508 +#: ../../reference/datamodel.rst:2575 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -2975,14 +3029,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2515 +#: ../../reference/datamodel.rst:2582 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:2519 +#: ../../reference/datamodel.rst:2586 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -2990,11 +3044,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:2528 +#: ../../reference/datamodel.rst:2595 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2530 +#: ../../reference/datamodel.rst:2597 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3002,26 +3056,27 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2556 +#: ../../reference/datamodel.rst:2623 msgid "" "These methods are called to implement the binary arithmetic operations (``" "+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:`pow`, " "``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For instance, to evaluate the " "expression ``x + y``, where *x* is an instance of a class that has an :meth:" -"`__add__` method, ``x.__add__(y)`` is called. The :meth:`__divmod__` method " -"should be the equivalent to using :meth:`__floordiv__` and :meth:`__mod__`; " -"it should not be related to :meth:`__truediv__`. Note that :meth:`__pow__` " -"should be defined to accept an optional third argument if the ternary " -"version of the built-in :func:`pow` function is to be supported." +"`__add__` method, ``type(x).__add__(x, y)`` is called. The :meth:" +"`__divmod__` method should be the equivalent to using :meth:`__floordiv__` " +"and :meth:`__mod__`; it should not be related to :meth:`__truediv__`. Note " +"that :meth:`__pow__` should be defined to accept an optional third argument " +"if the ternary version of the built-in :func:`pow` function is to be " +"supported." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2634 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return ``NotImplemented``." msgstr "" -#: ../../reference/datamodel.rst:2590 +#: ../../reference/datamodel.rst:2657 msgid "" "These methods are called to implement the binary arithmetic operations (``" "+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:`pow`, " @@ -3029,17 +3084,18 @@ msgid "" "operands. These functions are only called if the left operand does not " "support the corresponding operation [#]_ and the operands are of different " "types. [#]_ For instance, to evaluate the expression ``x - y``, where *y* is " -"an instance of a class that has an :meth:`__rsub__` method, ``y." -"__rsub__(x)`` is called if ``x.__sub__(y)`` returns *NotImplemented*." +"an instance of a class that has an :meth:`__rsub__` method, ``type(y)." +"__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns " +"*NotImplemented*." msgstr "" -#: ../../reference/datamodel.rst:2601 +#: ../../reference/datamodel.rst:2669 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:2606 +#: ../../reference/datamodel.rst:2674 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 " @@ -3048,7 +3104,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:2627 +#: ../../reference/datamodel.rst:2695 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3064,19 +3120,19 @@ msgid "" "fact part of the data model." msgstr "" -#: ../../reference/datamodel.rst:2648 +#: ../../reference/datamodel.rst:2716 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2729 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:2668 +#: ../../reference/datamodel.rst:2736 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3085,14 +3141,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:2674 +#: ../../reference/datamodel.rst:2742 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:2686 +#: ../../reference/datamodel.rst:2754 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3101,17 +3157,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:2692 +#: ../../reference/datamodel.rst:2760 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:2699 +#: ../../reference/datamodel.rst:2763 +msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." +msgstr "" + +#: ../../reference/datamodel.rst:2770 msgid "With Statement Context Managers" msgstr "" -#: ../../reference/datamodel.rst:2701 +#: ../../reference/datamodel.rst:2772 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 " @@ -3121,32 +3181,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:2712 +#: ../../reference/datamodel.rst:2783 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:2715 +#: ../../reference/datamodel.rst:2786 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2791 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:2727 +#: ../../reference/datamodel.rst:2798 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:2731 +#: ../../reference/datamodel.rst:2802 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. " @@ -3154,27 +3214,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:2735 +#: ../../reference/datamodel.rst:2806 msgid "" "Note that :meth:`__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2813 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2813 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:2749 +#: ../../reference/datamodel.rst:2820 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:2751 +#: ../../reference/datamodel.rst:2822 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 " @@ -3182,7 +3242,7 @@ msgid "" "patterns, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:2758 +#: ../../reference/datamodel.rst:2829 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 " @@ -3191,7 +3251,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:2764 +#: ../../reference/datamodel.rst:2835 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3201,19 +3261,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2774 +#: ../../reference/datamodel.rst:2845 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:2775 +#: ../../reference/datamodel.rst:2846 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:2781 +#: ../../reference/datamodel.rst:2852 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:2783 +#: ../../reference/datamodel.rst:2854 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 " @@ -3221,7 +3281,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:2798 +#: ../../reference/datamodel.rst:2869 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3230,21 +3290,21 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:2812 +#: ../../reference/datamodel.rst:2883 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:2821 +#: ../../reference/datamodel.rst:2892 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:2847 +#: ../../reference/datamodel.rst:2918 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3253,44 +3313,44 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:2858 +#: ../../reference/datamodel.rst:2929 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:2862 +#: ../../reference/datamodel.rst:2933 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:2864 +#: ../../reference/datamodel.rst:2935 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:2870 +#: ../../reference/datamodel.rst:2941 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:`~object.__await__`." +"with :func:`types.coroutine` are also awaitable, but they do not implement :" +"meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:2876 +#: ../../reference/datamodel.rst:2947 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:2882 +#: ../../reference/datamodel.rst:2953 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:2888 +#: ../../reference/datamodel.rst:2959 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:2890 +#: ../../reference/datamodel.rst:2961 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -3301,18 +3361,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:2898 +#: ../../reference/datamodel.rst:2969 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:2902 +#: ../../reference/datamodel.rst:2973 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:2908 +#: ../../reference/datamodel.rst:2979 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -3323,7 +3383,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:2919 +#: ../../reference/datamodel.rst:2990 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -3334,7 +3394,7 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:2930 +#: ../../reference/datamodel.rst:3001 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3344,99 +3404,99 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:2938 +#: ../../reference/datamodel.rst:3009 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:2944 +#: ../../reference/datamodel.rst:3015 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:2946 +#: ../../reference/datamodel.rst:3017 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:2949 +#: ../../reference/datamodel.rst:3020 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:2953 +#: ../../reference/datamodel.rst:3024 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:2957 +#: ../../reference/datamodel.rst:3028 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:2960 +#: ../../reference/datamodel.rst:3031 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:2977 +#: ../../reference/datamodel.rst:3048 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:2982 +#: ../../reference/datamodel.rst:3053 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:2990 +#: ../../reference/datamodel.rst:3061 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:2992 +#: ../../reference/datamodel.rst:3063 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:2995 +#: ../../reference/datamodel.rst:3066 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:2999 +#: ../../reference/datamodel.rst:3070 msgid "" "Semantically similar to :meth:`__enter__`, the only difference being that it " "must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3004 +#: ../../reference/datamodel.rst:3075 msgid "" "Semantically similar to :meth:`__exit__`, the only difference being that it " "must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3007 +#: ../../reference/datamodel.rst:3078 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3020 +#: ../../reference/datamodel.rst:3091 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3021 +#: ../../reference/datamodel.rst:3092 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:3025 +#: ../../reference/datamodel.rst:3096 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, and :meth:`~object.__contains__` methods have special " @@ -3444,7 +3504,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3031 +#: ../../reference/datamodel.rst:3102 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 " @@ -3452,7 +3512,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3037 +#: ../../reference/datamodel.rst:3108 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " diff --git a/reference/executionmodel.po b/reference/executionmodel.po index fc57d148cc..6ed873d0ef 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -94,7 +94,8 @@ msgstr "" #: ../../reference/executionmodel.rst:69 msgid "" "after :keyword:`!as` in a :keyword:`with` statement, :keyword:`except` " -"clause or in the as-pattern in structural pattern matching," +"clause, :keyword:`except* ` clause, or in the as-pattern in " +"structural pattern matching," msgstr "" #: ../../reference/executionmodel.rst:71 diff --git a/reference/expressions.po b/reference/expressions.po index 74e240ec12..aaca985495 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-09 00:22+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -242,30 +242,36 @@ msgid "" "expression, may contain additional :keyword:`!for` or :keyword:`!async for` " "clauses, and may also use :keyword:`await` expressions. If a comprehension " "contains either :keyword:`!async for` clauses or :keyword:`!await` " -"expressions it is called an :dfn:`asynchronous comprehension`. An " -"asynchronous comprehension may suspend the execution of the coroutine " -"function in which it appears. See also :pep:`530`." +"expressions or other asynchronous comprehensions it is called an :dfn:" +"`asynchronous comprehension`. An asynchronous comprehension may suspend the " +"execution of the coroutine function in which it appears. See also :pep:`530`." msgstr "" #: ../../reference/expressions.rst:227 msgid "Asynchronous comprehensions were introduced." msgstr "" -#: ../../reference/expressions.rst:230 ../../reference/expressions.rst:403 +#: ../../reference/expressions.rst:230 ../../reference/expressions.rst:408 msgid "``yield`` and ``yield from`` prohibited in the implicitly nested scope." msgstr "" -#: ../../reference/expressions.rst:237 +#: ../../reference/expressions.rst:233 +msgid "" +"Asynchronous comprehensions are now allowed inside comprehensions in " +"asynchronous functions. Outer comprehensions implicitly become asynchronous." +msgstr "" + +#: ../../reference/expressions.rst:242 msgid "List displays" msgstr "" -#: ../../reference/expressions.rst:247 +#: ../../reference/expressions.rst:252 msgid "" "A list display is a possibly empty series of expressions enclosed in square " "brackets:" msgstr "" -#: ../../reference/expressions.rst:253 +#: ../../reference/expressions.rst:258 msgid "" "A list display yields a new list object, the contents being specified by " "either a list of expressions or a comprehension. When a comma-separated " @@ -275,17 +281,17 @@ msgid "" "comprehension." msgstr "" -#: ../../reference/expressions.rst:263 +#: ../../reference/expressions.rst:268 msgid "Set displays" msgstr "" -#: ../../reference/expressions.rst:272 +#: ../../reference/expressions.rst:277 msgid "" "A set display is denoted by curly braces and distinguishable from dictionary " "displays by the lack of colons separating keys and values:" msgstr "" -#: ../../reference/expressions.rst:278 +#: ../../reference/expressions.rst:283 msgid "" "A set display yields a new mutable set object, the contents being specified " "by either a sequence of expressions or a comprehension. When a comma-" @@ -295,27 +301,27 @@ msgid "" "comprehension." msgstr "" -#: ../../reference/expressions.rst:284 +#: ../../reference/expressions.rst:289 msgid "" "An empty set cannot be constructed with ``{}``; this literal constructs an " "empty dictionary." msgstr "" -#: ../../reference/expressions.rst:291 +#: ../../reference/expressions.rst:296 msgid "Dictionary displays" msgstr "" -#: ../../reference/expressions.rst:302 +#: ../../reference/expressions.rst:307 msgid "" "A dictionary display is a possibly empty series of key/datum pairs enclosed " "in curly braces:" msgstr "" -#: ../../reference/expressions.rst:311 +#: ../../reference/expressions.rst:316 msgid "A dictionary display yields a new dictionary object." msgstr "" -#: ../../reference/expressions.rst:313 +#: ../../reference/expressions.rst:318 msgid "" "If a comma-separated sequence of key/datum pairs is given, they are " "evaluated from left to right to define the entries of the dictionary: each " @@ -325,7 +331,7 @@ msgid "" "last one given." msgstr "" -#: ../../reference/expressions.rst:323 +#: ../../reference/expressions.rst:328 msgid "" "A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. Its operand " "must be a :term:`mapping`. Each mapping item is added to the new " @@ -333,11 +339,11 @@ msgid "" "pairs and earlier dictionary unpackings." msgstr "" -#: ../../reference/expressions.rst:328 +#: ../../reference/expressions.rst:333 msgid "Unpacking into dictionary displays, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:331 +#: ../../reference/expressions.rst:336 msgid "" "A dict comprehension, in contrast to list and set comprehensions, needs two " "expressions separated with a colon followed by the usual \"for\" and \"if\" " @@ -345,7 +351,7 @@ msgid "" "are inserted in the new dictionary in the order they are produced." msgstr "" -#: ../../reference/expressions.rst:339 +#: ../../reference/expressions.rst:344 msgid "" "Restrictions on the types of the key values are listed earlier in section :" "ref:`types`. (To summarize, the key type should be :term:`hashable`, which " @@ -354,7 +360,7 @@ msgid "" "given key value prevails." msgstr "" -#: ../../reference/expressions.rst:345 +#: ../../reference/expressions.rst:350 msgid "" "Prior to Python 3.8, in dict comprehensions, the evaluation order of key and " "value was not well-defined. In CPython, the value was evaluated before the " @@ -362,22 +368,22 @@ msgid "" "by :pep:`572`." msgstr "" -#: ../../reference/expressions.rst:355 +#: ../../reference/expressions.rst:360 msgid "Generator expressions" msgstr "" -#: ../../reference/expressions.rst:362 +#: ../../reference/expressions.rst:367 msgid "A generator expression is a compact generator notation in parentheses:" msgstr "" -#: ../../reference/expressions.rst:367 +#: ../../reference/expressions.rst:372 msgid "" "A generator expression yields a new generator object. Its syntax is the " "same as for comprehensions, except that it is enclosed in parentheses " "instead of brackets or curly braces." msgstr "" -#: ../../reference/expressions.rst:371 +#: ../../reference/expressions.rst:376 msgid "" "Variables used in the generator expression are evaluated lazily when the :" "meth:`~generator.__next__` method is called for the generator object (in the " @@ -391,20 +397,20 @@ msgid "" "``(x*y for x in range(10) for y in range(x, x+10))``." msgstr "" -#: ../../reference/expressions.rst:382 +#: ../../reference/expressions.rst:387 msgid "" "The parentheses can be omitted on calls with only one argument. See " "section :ref:`calls` for details." msgstr "" -#: ../../reference/expressions.rst:385 +#: ../../reference/expressions.rst:390 msgid "" "To avoid interfering with the expected operation of the generator expression " "itself, ``yield`` and ``yield from`` expressions are prohibited in the " "implicitly defined generator." msgstr "" -#: ../../reference/expressions.rst:389 +#: ../../reference/expressions.rst:394 msgid "" "If a generator expression contains either :keyword:`!async for` clauses or :" "keyword:`await` expressions it is called an :dfn:`asynchronous generator " @@ -413,22 +419,22 @@ msgid "" "`async-iterators`)." msgstr "" -#: ../../reference/expressions.rst:395 +#: ../../reference/expressions.rst:400 msgid "Asynchronous generator expressions were introduced." msgstr "" -#: ../../reference/expressions.rst:398 +#: ../../reference/expressions.rst:403 msgid "" "Prior to Python 3.7, asynchronous generator expressions could only appear " "in :keyword:`async def` coroutines. Starting with 3.7, any function can use " "asynchronous generator expressions." msgstr "" -#: ../../reference/expressions.rst:410 +#: ../../reference/expressions.rst:415 msgid "Yield expressions" msgstr "" -#: ../../reference/expressions.rst:422 +#: ../../reference/expressions.rst:427 msgid "" "The yield expression is used when defining a :term:`generator` function or " "an :term:`asynchronous generator` function and thus can only be used in the " @@ -438,27 +444,27 @@ msgid "" "asynchronous generator function. For example::" msgstr "" -#: ../../reference/expressions.rst:435 +#: ../../reference/expressions.rst:440 msgid "" "Due to their side effects on the containing scope, ``yield`` expressions are " "not permitted as part of the implicitly defined scopes used to implement " "comprehensions and generator expressions." msgstr "" -#: ../../reference/expressions.rst:439 +#: ../../reference/expressions.rst:444 msgid "" "Yield expressions prohibited in the implicitly nested scopes used to " "implement comprehensions and generator expressions." msgstr "" -#: ../../reference/expressions.rst:443 +#: ../../reference/expressions.rst:448 msgid "" "Generator functions are described below, while asynchronous generator " "functions are described separately in section :ref:`asynchronous-generator-" "functions`." msgstr "" -#: ../../reference/expressions.rst:447 +#: ../../reference/expressions.rst:452 msgid "" "When a generator function is called, it returns an iterator known as a " "generator. That generator then controls the execution of the generator " @@ -478,7 +484,7 @@ msgid "" "be the value passed in to that method." msgstr "" -#: ../../reference/expressions.rst:465 +#: ../../reference/expressions.rst:470 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 +493,7 @@ msgid "" "the control is always transferred to the generator's caller." msgstr "" -#: ../../reference/expressions.rst:471 +#: ../../reference/expressions.rst:476 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 +502,7 @@ msgid "" "`finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:480 +#: ../../reference/expressions.rst:485 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 +514,7 @@ msgid "" "will just raise the passed in exception immediately." msgstr "" -#: ../../reference/expressions.rst:489 +#: ../../reference/expressions.rst:494 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " @@ -517,73 +523,73 @@ msgid "" "returning a value from the subgenerator)." msgstr "" -#: ../../reference/expressions.rst:495 +#: ../../reference/expressions.rst:500 msgid "Added ``yield from `` to delegate control flow to a subiterator." msgstr "" -#: ../../reference/expressions.rst:498 +#: ../../reference/expressions.rst:503 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:504 +#: ../../reference/expressions.rst:509 msgid ":pep:`255` - Simple Generators" msgstr "" -#: ../../reference/expressions.rst:504 +#: ../../reference/expressions.rst:509 msgid "" "The proposal for adding generators and the :keyword:`yield` statement to " "Python." msgstr "" -#: ../../reference/expressions.rst:508 +#: ../../reference/expressions.rst:513 msgid ":pep:`342` - Coroutines via Enhanced Generators" msgstr "" -#: ../../reference/expressions.rst:507 +#: ../../reference/expressions.rst:512 msgid "" "The proposal to enhance the API and syntax of generators, making them usable " "as simple coroutines." msgstr "" -#: ../../reference/expressions.rst:512 +#: ../../reference/expressions.rst:517 msgid ":pep:`380` - Syntax for Delegating to a Subgenerator" msgstr "" -#: ../../reference/expressions.rst:511 +#: ../../reference/expressions.rst:516 msgid "" "The proposal to introduce the :token:`~python-grammar:yield_from` syntax, " "making delegation to subgenerators easy." msgstr "" -#: ../../reference/expressions.rst:515 +#: ../../reference/expressions.rst:520 msgid ":pep:`525` - Asynchronous Generators" msgstr "" -#: ../../reference/expressions.rst:515 +#: ../../reference/expressions.rst:520 msgid "" "The proposal that expanded on :pep:`492` by adding generator capabilities to " "coroutine functions." msgstr "" -#: ../../reference/expressions.rst:522 +#: ../../reference/expressions.rst:527 msgid "Generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:524 +#: ../../reference/expressions.rst:529 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:527 +#: ../../reference/expressions.rst:532 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:535 +#: ../../reference/expressions.rst:540 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 :" @@ -595,13 +601,13 @@ msgid "" "`StopIteration` exception is raised." msgstr "" -#: ../../reference/expressions.rst:544 +#: ../../reference/expressions.rst:549 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:550 +#: ../../reference/expressions.rst:555 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 +618,7 @@ msgid "" "expression that could receive the value." msgstr "" -#: ../../reference/expressions.rst:562 +#: ../../reference/expressions.rst:567 msgid "" "Raises an exception at the point where the generator was paused, and returns " "the next value yielded by the generator function. If the generator exits " @@ -621,13 +627,13 @@ msgid "" "a different exception, then that exception propagates to the caller." msgstr "" -#: ../../reference/expressions.rst:568 +#: ../../reference/expressions.rst:573 msgid "" "In typical use, this is called with a single exception instance similar to " "the way the :keyword:`raise` keyword is used." msgstr "" -#: ../../reference/expressions.rst:571 +#: ../../reference/expressions.rst:576 msgid "" "For backwards compatibility, however, the second signature is supported, " "following a convention from older versions of Python. The *type* argument " @@ -638,7 +644,7 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:585 +#: ../../reference/expressions.rst:590 msgid "" "Raises a :exc:`GeneratorExit` at the point where the generator function was " "paused. If the generator function then exits gracefully, is already closed, " @@ -649,34 +655,34 @@ msgid "" "has already exited due to an exception or normal exit." msgstr "" -#: ../../reference/expressions.rst:596 +#: ../../reference/expressions.rst:601 msgid "Examples" msgstr "模組" -#: ../../reference/expressions.rst:598 +#: ../../reference/expressions.rst:603 msgid "" "Here is a simple example that demonstrates the behavior of generators and " "generator functions::" msgstr "" -#: ../../reference/expressions.rst:625 +#: ../../reference/expressions.rst:630 msgid "" "For examples using ``yield from``, see :ref:`pep-380` in \"What's New in " "Python.\"" msgstr "" -#: ../../reference/expressions.rst:631 +#: ../../reference/expressions.rst:636 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/expressions.rst:633 +#: ../../reference/expressions.rst:638 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:637 +#: ../../reference/expressions.rst:642 msgid "" "When an asynchronous generator function is called, it returns an " "asynchronous iterator known as an asynchronous generator object. That object " @@ -686,7 +692,7 @@ msgid "" "keyword:`for` statement." msgstr "" -#: ../../reference/expressions.rst:644 +#: ../../reference/expressions.rst:649 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " @@ -705,7 +711,7 @@ msgid "" "method." msgstr "" -#: ../../reference/expressions.rst:659 +#: ../../reference/expressions.rst:664 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -717,7 +723,7 @@ msgid "" "generator and ultimately detach it from the event loop." msgstr "" -#: ../../reference/expressions.rst:669 +#: ../../reference/expressions.rst:674 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -731,7 +737,7 @@ msgid "" "finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:680 +#: ../../reference/expressions.rst:685 msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" @@ -744,23 +750,23 @@ msgid "" "asyncio/base_events.py`." msgstr "" -#: ../../reference/expressions.rst:689 +#: ../../reference/expressions.rst:694 msgid "" "The expression ``yield from `` is a syntax error when used in an " "asynchronous generator function." msgstr "" -#: ../../reference/expressions.rst:696 +#: ../../reference/expressions.rst:701 msgid "Asynchronous generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:698 +#: ../../reference/expressions.rst:703 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:706 +#: ../../reference/expressions.rst:711 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -775,12 +781,12 @@ msgid "" "has completed." msgstr "" -#: ../../reference/expressions.rst:718 +#: ../../reference/expressions.rst:723 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:723 +#: ../../reference/expressions.rst:728 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send()` method for a " @@ -795,7 +801,7 @@ msgid "" "receive the value." msgstr "" -#: ../../reference/expressions.rst:738 +#: ../../reference/expressions.rst:743 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 " @@ -807,7 +813,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:753 +#: ../../reference/expressions.rst:758 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 " @@ -823,25 +829,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:769 +#: ../../reference/expressions.rst:774 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:773 +#: ../../reference/expressions.rst:778 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:783 +#: ../../reference/expressions.rst:788 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:789 +#: ../../reference/expressions.rst:794 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:799 +#: ../../reference/expressions.rst:804 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 " @@ -852,11 +858,11 @@ msgid "" "evaluations of the same attribute reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:811 +#: ../../reference/expressions.rst:816 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:826 +#: ../../reference/expressions.rst:831 msgid "" "The subscription of an instance of a :ref:`container class ` " "will generally select an element from the container. The subscription of a :" @@ -864,13 +870,13 @@ msgid "" "`GenericAlias ` object." msgstr "" -#: ../../reference/expressions.rst:834 +#: ../../reference/expressions.rst:839 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:837 +#: ../../reference/expressions.rst:842 msgid "" "The primary must evaluate to an object that supports subscription. An object " "may support subscription through defining one or both of :meth:`~object." @@ -880,20 +886,20 @@ msgid "" "called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:849 msgid "" "If the expression list contains at least one comma, it will evaluate to a :" "class:`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:848 +#: ../../reference/expressions.rst:853 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:856 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -901,7 +907,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:860 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -909,7 +915,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:860 +#: ../../reference/expressions.rst:865 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences `. However, built-in sequences all provide a :meth:" @@ -923,25 +929,25 @@ msgid "" "support." msgstr "" -#: ../../reference/expressions.rst:874 +#: ../../reference/expressions.rst:879 msgid "" "A :class:`string ` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:882 +#: ../../reference/expressions.rst:887 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:896 +#: ../../reference/expressions.rst:901 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:909 +#: ../../reference/expressions.rst:914 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 " @@ -951,7 +957,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:921 +#: ../../reference/expressions.rst:926 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 " @@ -966,23 +972,23 @@ msgid "" "expressions." msgstr "" -#: ../../reference/expressions.rst:945 +#: ../../reference/expressions.rst:950 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:947 +#: ../../reference/expressions.rst:952 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: ../../reference/expressions.rst:964 +#: ../../reference/expressions.rst:969 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:970 +#: ../../reference/expressions.rst:975 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -992,7 +998,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:978 +#: ../../reference/expressions.rst:983 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 " @@ -1001,20 +1007,19 @@ msgid "" "to determine the corresponding slot (if the identifier is the same as the " "first formal parameter name, the first slot is used, and so on). If the " "slot is already filled, a :exc:`TypeError` exception is raised. Otherwise, " -"the value of the argument is placed in the slot, filling it (even if the " -"expression is ``None``, it fills the slot). When all arguments have been " -"processed, the slots that are still unfilled are filled with the " -"corresponding default value from the function definition. (Default values " -"are calculated, once, when the function is defined; thus, a mutable object " -"such as a list or dictionary used as default value will be shared by all " -"calls that don't specify an argument value for the corresponding slot; this " -"should usually be avoided.) If there are any unfilled slots for which no " -"default value is specified, a :exc:`TypeError` exception is raised. " -"Otherwise, the list of filled slots is used as the argument list for the " -"call." +"the argument is placed in the slot, filling it (even if the expression is " +"``None``, it fills the slot). When all arguments have been processed, the " +"slots that are still unfilled are filled with the corresponding default " +"value from the function definition. (Default values are calculated, once, " +"when the function is defined; thus, a mutable object such as a list or " +"dictionary used as default value will be shared by all calls that don't " +"specify an argument value for the corresponding slot; this should usually be " +"avoided.) If there are any unfilled slots for which no default value is " +"specified, a :exc:`TypeError` exception is raised. Otherwise, the list of " +"filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:998 +#: ../../reference/expressions.rst:1003 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1023,7 +1028,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1004 +#: ../../reference/expressions.rst:1009 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1032,7 +1037,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1010 +#: ../../reference/expressions.rst:1015 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 " @@ -1042,7 +1047,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1021 +#: ../../reference/expressions.rst:1026 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1052,20 +1057,20 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1028 +#: ../../reference/expressions.rst:1033 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:1044 +#: ../../reference/expressions.rst:1049 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." +"be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1050 +#: ../../reference/expressions.rst:1055 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1074,7 +1079,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1056 +#: ../../reference/expressions.rst:1061 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1086,35 +1091,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1066 +#: ../../reference/expressions.rst:1071 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:1069 +#: ../../reference/expressions.rst:1074 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:1075 +#: ../../reference/expressions.rst:1080 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:1079 +#: ../../reference/expressions.rst:1084 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1092 +#: ../../reference/expressions.rst:1097 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1093 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 " @@ -1123,73 +1128,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1106 +#: ../../reference/expressions.rst:1111 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1105 +#: ../../reference/expressions.rst:1110 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:1113 +#: ../../reference/expressions.rst:1118 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1113 +#: ../../reference/expressions.rst:1118 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1123 +#: ../../reference/expressions.rst:1128 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1121 +#: ../../reference/expressions.rst:1126 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:1132 +#: ../../reference/expressions.rst:1137 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1130 +#: ../../reference/expressions.rst:1135 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:1138 ../../reference/expressions.rst:1917 +#: ../../reference/expressions.rst:1143 ../../reference/expressions.rst:1924 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1140 +#: ../../reference/expressions.rst:1145 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:1152 +#: ../../reference/expressions.rst:1157 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1163 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:1164 +#: ../../reference/expressions.rst:1169 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:1168 +#: ../../reference/expressions.rst:1173 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 " @@ -1197,7 +1202,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1173 +#: ../../reference/expressions.rst:1178 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 " @@ -1205,40 +1210,40 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1178 +#: ../../reference/expressions.rst:1183 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:1182 +#: ../../reference/expressions.rst:1187 msgid "" "This operation can be customized using the special :meth:`__pow__` method." msgstr "" -#: ../../reference/expressions.rst:1187 +#: ../../reference/expressions.rst:1192 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1198 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1204 +#: ../../reference/expressions.rst:1209 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:1212 +#: ../../reference/expressions.rst:1217 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:1219 +#: ../../reference/expressions.rst:1224 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1246,17 +1251,17 @@ msgid "" "meth:`__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1228 +#: ../../reference/expressions.rst:1233 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1235 +#: ../../reference/expressions.rst:1240 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1239 +#: ../../reference/expressions.rst:1244 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1264,7 +1269,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1254 +#: ../../reference/expressions.rst:1259 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1274,19 +1279,19 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1260 +#: ../../reference/expressions.rst:1265 msgid "" "This operation can be customized using the special :meth:`__mul__` and :meth:" "`__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1272 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1278 +#: ../../reference/expressions.rst:1283 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1296,13 +1301,13 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1285 +#: ../../reference/expressions.rst:1290 msgid "" "This operation can be customized using the special :meth:`__truediv__` and :" "meth:`__floordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1292 +#: ../../reference/expressions.rst:1297 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1314,7 +1319,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1301 +#: ../../reference/expressions.rst:1306 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 " @@ -1322,7 +1327,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1306 +#: ../../reference/expressions.rst:1311 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1331,20 +1336,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1311 +#: ../../reference/expressions.rst:1316 msgid "" "The *modulo* operation can be customized using the special :meth:`__mod__` " "method." msgstr "" -#: ../../reference/expressions.rst:1313 +#: ../../reference/expressions.rst:1318 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:1322 +#: ../../reference/expressions.rst:1327 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1352,84 +1357,84 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1332 msgid "" "This operation can be customized using the special :meth:`__add__` and :meth:" "`__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1335 +#: ../../reference/expressions.rst:1340 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1343 msgid "" "This operation can be customized using the special :meth:`__sub__` method." msgstr "" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1349 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1351 +#: ../../reference/expressions.rst:1356 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1356 +#: ../../reference/expressions.rst:1361 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:1359 +#: ../../reference/expressions.rst:1364 msgid "" "This operation can be customized using the special :meth:`__lshift__` and :" "meth:`__rshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1364 +#: ../../reference/expressions.rst:1369 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:1371 +#: ../../reference/expressions.rst:1376 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1375 +#: ../../reference/expressions.rst:1380 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1386 +#: ../../reference/expressions.rst:1391 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:1395 +#: ../../reference/expressions.rst:1400 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:1404 +#: ../../reference/expressions.rst:1409 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:1412 +#: ../../reference/expressions.rst:1417 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1424 +#: ../../reference/expressions.rst:1429 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 " @@ -1437,14 +1442,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1434 +#: ../../reference/expressions.rst:1439 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:1440 +#: ../../reference/expressions.rst:1445 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 " @@ -1452,7 +1457,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1444 +#: ../../reference/expressions.rst:1449 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 " @@ -1460,24 +1465,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1449 +#: ../../reference/expressions.rst:1454 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:1454 +#: ../../reference/expressions.rst:1461 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1463 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1466 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 " @@ -1489,7 +1494,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1475 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1497,7 +1502,7 @@ msgid "" "methods` like :meth:`__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1474 +#: ../../reference/expressions.rst:1481 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1507,14 +1512,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1488 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:1485 +#: ../../reference/expressions.rst:1492 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1523,13 +1528,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1498 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1494 +#: ../../reference/expressions.rst:1501 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1539,7 +1544,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1501 +#: ../../reference/expressions.rst:1508 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 " @@ -1549,32 +1554,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1508 +#: ../../reference/expressions.rst:1515 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:1512 +#: ../../reference/expressions.rst:1519 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:1516 +#: ../../reference/expressions.rst:1523 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:1520 +#: ../../reference/expressions.rst:1527 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1529 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1583,7 +1588,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1528 +#: ../../reference/expressions.rst:1535 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1591,19 +1596,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1533 +#: ../../reference/expressions.rst:1540 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1535 +#: ../../reference/expressions.rst:1542 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:1540 +#: ../../reference/expressions.rst:1547 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 " @@ -1612,25 +1617,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1546 +#: ../../reference/expressions.rst:1553 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:1550 +#: ../../reference/expressions.rst:1557 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1552 +#: ../../reference/expressions.rst:1559 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1555 +#: ../../reference/expressions.rst:1562 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1641,110 +1646,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1563 +#: ../../reference/expressions.rst:1570 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1565 +#: ../../reference/expressions.rst:1572 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1568 +#: ../../reference/expressions.rst:1575 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1571 +#: ../../reference/expressions.rst:1578 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1574 +#: ../../reference/expressions.rst:1581 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1583 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1579 +#: ../../reference/expressions.rst:1586 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1581 +#: ../../reference/expressions.rst:1588 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1583 +#: ../../reference/expressions.rst:1590 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1585 +#: ../../reference/expressions.rst:1592 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1587 +#: ../../reference/expressions.rst:1594 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1590 +#: ../../reference/expressions.rst:1597 msgid "``x > y and y > z`` implies ``x > z``" msgstr "" -#: ../../reference/expressions.rst:1592 +#: ../../reference/expressions.rst:1599 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "" -#: ../../reference/expressions.rst:1594 +#: ../../reference/expressions.rst:1601 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1597 +#: ../../reference/expressions.rst:1604 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1599 +#: ../../reference/expressions.rst:1606 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1601 +#: ../../reference/expressions.rst:1608 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1603 +#: ../../reference/expressions.rst:1610 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:1607 +#: ../../reference/expressions.rst:1614 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:1611 +#: ../../reference/expressions.rst:1618 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:1620 +#: ../../reference/expressions.rst:1627 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1622 +#: ../../reference/expressions.rst:1629 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`` " @@ -1755,7 +1760,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1637 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 " @@ -1763,14 +1768,14 @@ msgid "" "\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1635 +#: ../../reference/expressions.rst:1642 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:1639 +#: ../../reference/expressions.rst:1646 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 " @@ -1779,7 +1784,7 @@ msgid "" "as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1645 +#: ../../reference/expressions.rst:1652 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 " @@ -1788,17 +1793,17 @@ msgid "" "raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1657 +#: ../../reference/expressions.rst:1664 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1670 +#: ../../reference/expressions.rst:1677 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1679 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 " @@ -1806,11 +1811,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1684 +#: ../../reference/expressions.rst:1691 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1695 +#: ../../reference/expressions.rst:1702 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1821,25 +1826,25 @@ msgid "" "method." msgstr "" -#: ../../reference/expressions.rst:1704 +#: ../../reference/expressions.rst:1711 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1709 +#: ../../reference/expressions.rst:1716 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:1714 +#: ../../reference/expressions.rst:1721 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:1717 +#: ../../reference/expressions.rst:1724 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 " @@ -1850,11 +1855,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1733 +#: ../../reference/expressions.rst:1740 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1738 +#: ../../reference/expressions.rst:1745 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -1862,15 +1867,15 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1743 +#: ../../reference/expressions.rst:1750 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1750 +#: ../../reference/expressions.rst:1757 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1757 +#: ../../reference/expressions.rst:1764 msgid "" "Assignment expressions must be surrounded by parentheses when used as sub-" "expressions in slicing, conditional, lambda, keyword-argument, and " @@ -1879,36 +1884,36 @@ msgid "" "including in ``if`` and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1764 +#: ../../reference/expressions.rst:1771 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1771 +#: ../../reference/expressions.rst:1778 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1783 +#: ../../reference/expressions.rst:1790 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1786 +#: ../../reference/expressions.rst:1793 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:1790 +#: ../../reference/expressions.rst:1797 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1797 +#: ../../reference/expressions.rst:1804 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1808 +#: ../../reference/expressions.rst:1815 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -1916,25 +1921,25 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1817 +#: ../../reference/expressions.rst:1824 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:1825 +#: ../../reference/expressions.rst:1832 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1839 +#: ../../reference/expressions.rst:1846 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:1848 +#: ../../reference/expressions.rst:1855 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -1942,12 +1947,12 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1853 +#: ../../reference/expressions.rst:1860 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1858 +#: ../../reference/expressions.rst:1865 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 " @@ -1956,206 +1961,207 @@ msgid "" "parentheses: ``()``.)" msgstr "" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1875 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:1879 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:1875 +#: ../../reference/expressions.rst:1882 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1889 +#: ../../reference/expressions.rst:1896 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1894 +#: ../../reference/expressions.rst:1901 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " "Operators in the same box have the same precedence. Unless the syntax is " "explicitly given, operators are binary. Operators in the same box group " -"left to right (except for exponentiation, which groups from right to left)." +"left to right (except for exponentiation and conditional expressions, which " +"group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1900 +#: ../../reference/expressions.rst:1907 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:1906 +#: ../../reference/expressions.rst:1913 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:1913 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1915 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1910 +#: ../../reference/expressions.rst:1917 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1915 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1914 +#: ../../reference/expressions.rst:1921 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:1914 +#: ../../reference/expressions.rst:1921 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1917 +#: ../../reference/expressions.rst:1924 msgid ":keyword:`await x `" msgstr ":keyword:`await x `" -#: ../../reference/expressions.rst:1919 +#: ../../reference/expressions.rst:1926 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1919 +#: ../../reference/expressions.rst:1926 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1921 +#: ../../reference/expressions.rst:1928 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1921 +#: ../../reference/expressions.rst:1928 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:1930 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:1930 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1934 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1934 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1936 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1936 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:1938 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:1938 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:1933 +#: ../../reference/expressions.rst:1940 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:1933 +#: ../../reference/expressions.rst:1940 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:1935 +#: ../../reference/expressions.rst:1942 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:1935 +#: ../../reference/expressions.rst:1942 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:1937 +#: ../../reference/expressions.rst:1944 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:1937 +#: ../../reference/expressions.rst:1944 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:1941 +#: ../../reference/expressions.rst:1948 msgid ":keyword:`not x `" msgstr ":keyword:`not x `" -#: ../../reference/expressions.rst:1941 +#: ../../reference/expressions.rst:1948 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:1943 +#: ../../reference/expressions.rst:1950 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:1943 +#: ../../reference/expressions.rst:1950 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1952 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1952 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1954 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1954 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:1949 +#: ../../reference/expressions.rst:1956 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:1949 +#: ../../reference/expressions.rst:1956 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:1951 +#: ../../reference/expressions.rst:1958 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:1951 +#: ../../reference/expressions.rst:1958 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:1956 +#: ../../reference/expressions.rst:1963 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:1957 +#: ../../reference/expressions.rst:1964 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 " @@ -2167,7 +2173,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:1966 +#: ../../reference/expressions.rst:1973 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, " @@ -2175,7 +2181,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:1971 +#: ../../reference/expressions.rst:1978 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 " @@ -2189,7 +2195,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:1982 +#: ../../reference/expressions.rst:1989 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2197,13 +2203,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1994 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:1990 +#: ../../reference/expressions.rst:1997 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2211,13 +2217,13 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:1995 +#: ../../reference/expressions.rst:2002 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:1998 +#: ../../reference/expressions.rst:2005 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." diff --git a/reference/import.po b/reference/import.po index 37bc8cdc8c..86b725c03d 100644 --- a/reference/import.po +++ b/reference/import.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-07 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -751,39 +751,43 @@ msgstr "" #: ../../reference/import.rst:604 msgid "" -"``__file__`` is optional. If set, this attribute's value must be a string. " -"The import system may opt to leave ``__file__`` unset if it has no semantic " -"meaning (e.g. a module loaded from a database)." +"``__file__`` is optional (if set, value must be a string). It indicates the " +"pathname of the file from which the module was loaded (if loaded from a " +"file), or the pathname of the shared library file for extension modules " +"loaded dynamically from a shared library. It might be missing for certain " +"types of modules, such as C modules that are statically linked into the " +"interpreter, and the import system may opt to leave it unset if it has no " +"semantic meaning (e.g. a module loaded from a database)." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:613 msgid "" -"If ``__file__`` is set, it may also be appropriate to set the ``__cached__`` " -"attribute which is the path to any compiled version of the code (e.g. byte-" -"compiled file). The file does not need to exist to set this attribute; the " -"path can simply point to where the compiled file would exist (see :pep:" -"`3147`)." +"If ``__file__`` is set then the ``__cached__`` attribute might also be set, " +"which is the path to any compiled version of the code (e.g. byte-compiled " +"file). The file does not need to exist to set this attribute; the path can " +"simply point to where the compiled file would exist (see :pep:`3147`)." msgstr "" -#: ../../reference/import.rst:614 +#: ../../reference/import.rst:619 msgid "" -"It is also appropriate to set ``__cached__`` when ``__file__`` is not set. " +"Note that ``__cached__`` may be set even if ``__file__`` is not set. " "However, that scenario is quite atypical. Ultimately, the loader is what " -"makes use of ``__file__`` and/or ``__cached__``. So if a loader can load " -"from a cached module but otherwise does not load from a file, that atypical " -"scenario may be appropriate." +"makes use of the module spec provided by the finder (from which ``__file__`` " +"and ``__cached__`` are derived). So if a loader can load from a cached " +"module but otherwise does not load from a file, that atypical scenario may " +"be appropriate." msgstr "" -#: ../../reference/import.rst:623 +#: ../../reference/import.rst:629 msgid "module.__path__" msgstr "module.__path__" -#: ../../reference/import.rst:625 +#: ../../reference/import.rst:631 msgid "" "By definition, if a module has a ``__path__`` attribute, it is a package." msgstr "" -#: ../../reference/import.rst:627 +#: ../../reference/import.rst:633 msgid "" "A package's ``__path__`` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -792,7 +796,7 @@ msgid "" "than :data:`sys.path`." msgstr "" -#: ../../reference/import.rst:633 +#: ../../reference/import.rst:639 msgid "" "``__path__`` must be an iterable of strings, but it may be empty. The same " "rules used for :data:`sys.path` also apply to a package's ``__path__``, and :" @@ -800,7 +804,7 @@ msgid "" "package's ``__path__``." msgstr "" -#: ../../reference/import.rst:638 +#: ../../reference/import.rst:644 msgid "" "A package's ``__init__.py`` file may set or alter the package's ``__path__`` " "attribute, and this was typically the way namespace packages were " @@ -810,18 +814,18 @@ msgid "" "``__path__`` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:646 +#: ../../reference/import.rst:652 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:648 +#: ../../reference/import.rst:654 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:652 +#: ../../reference/import.rst:658 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -831,41 +835,41 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:659 +#: ../../reference/import.rst:665 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:661 +#: ../../reference/import.rst:667 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:665 +#: ../../reference/import.rst:671 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:668 +#: ../../reference/import.rst:674 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:671 +#: ../../reference/import.rst:677 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:673 +#: ../../reference/import.rst:679 msgid "" "Use of :meth:`loader.module_repr() ` has " "been deprecated and the module spec is now used by the import machinery to " "generate a module repr." msgstr "" -#: ../../reference/import.rst:678 +#: ../../reference/import.rst:684 msgid "" "For backward compatibility with Python 3.3, the module repr will be " "generated by calling the loader's :meth:`~importlib.abc.Loader.module_repr` " @@ -873,7 +877,7 @@ msgid "" "the method is deprecated." msgstr "" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:691 msgid "" "Calling :meth:`~importlib.abc.Loader.module_repr` now occurs after trying to " "use a module's ``__spec__`` attribute but before falling back on " @@ -881,11 +885,11 @@ msgid "" "stop in Python 3.12." msgstr "" -#: ../../reference/import.rst:693 +#: ../../reference/import.rst:699 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:695 +#: ../../reference/import.rst:701 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -895,7 +899,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:702 +#: ../../reference/import.rst:708 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -909,17 +913,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:713 +#: ../../reference/import.rst:719 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:719 +#: ../../reference/import.rst:725 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:724 +#: ../../reference/import.rst:730 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -928,14 +932,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:730 +#: ../../reference/import.rst:736 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:734 +#: ../../reference/import.rst:740 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -946,14 +950,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:741 +#: ../../reference/import.rst:747 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:745 +#: ../../reference/import.rst:751 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -964,7 +968,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:753 +#: ../../reference/import.rst:759 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -975,7 +979,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:761 +#: ../../reference/import.rst:767 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -983,11 +987,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:768 +#: ../../reference/import.rst:774 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:776 +#: ../../reference/import.rst:782 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -995,7 +999,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:781 +#: ../../reference/import.rst:787 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1003,7 +1007,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:786 +#: ../../reference/import.rst:792 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1011,7 +1015,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:791 +#: ../../reference/import.rst:797 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :data:`PYTHONPATH` " @@ -1019,12 +1023,11 @@ msgid "" "specific defaults. Entries in :data:`sys.path` can name directories on the " "file system, zip files, and potentially other \"locations\" (see the :mod:" "`site` module) that should be searched for modules, such as URLs, or " -"database queries. Only strings and bytes should be present on :data:`sys." -"path`; all other data types are ignored. The encoding of bytes entries is " -"determined by the individual :term:`path entry finders `." +"database queries. Only strings should be present on :data:`sys.path`; all " +"other data types are ignored." msgstr "" -#: ../../reference/import.rst:802 +#: ../../reference/import.rst:806 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1036,7 +1039,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:811 +#: ../../reference/import.rst:815 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1052,7 +1055,7 @@ msgid "" "finder to perform the path entry search again [#fnpic]_." msgstr "" -#: ../../reference/import.rst:824 +#: ../../reference/import.rst:828 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1068,7 +1071,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:838 +#: ../../reference/import.rst:842 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1078,7 +1081,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:845 +#: ../../reference/import.rst:849 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1086,7 +1089,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:850 +#: ../../reference/import.rst:854 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1098,18 +1101,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:860 +#: ../../reference/import.rst:864 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:862 +#: ../../reference/import.rst:866 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:866 +#: ../../reference/import.rst:870 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1117,14 +1120,14 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:871 +#: ../../reference/import.rst:875 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets \"submodule_search_locations\" to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:875 +#: ../../reference/import.rst:879 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`~importlib." "abc.PathEntryFinder.find_loader` and :meth:`~importlib.abc.PathEntryFinder." @@ -1132,7 +1135,7 @@ msgid "" "``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:881 +#: ../../reference/import.rst:885 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1140,7 +1143,7 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:886 +#: ../../reference/import.rst:890 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_loader` takes one argument, the " "fully qualified name of the module being imported. ``find_loader()`` " @@ -1148,7 +1151,7 @@ msgid "" "a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:891 +#: ../../reference/import.rst:895 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1158,7 +1161,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:898 +#: ../../reference/import.rst:902 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1167,25 +1170,25 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:904 +#: ../../reference/import.rst:908 msgid "" "Calls to :meth:`~importlib.abc.PathEntryFinder.find_module` and :meth:" "`~importlib.abc.PathEntryFinder.find_loader` by the import system will " "raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:911 +#: ../../reference/import.rst:915 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:917 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:917 +#: ../../reference/import.rst:921 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1194,7 +1197,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:923 +#: ../../reference/import.rst:927 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1204,11 +1207,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:933 +#: ../../reference/import.rst:937 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:935 +#: ../../reference/import.rst:939 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1216,30 +1219,30 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:951 +#: ../../reference/import.rst:955 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:961 +#: ../../reference/import.rst:965 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:967 +#: ../../reference/import.rst:971 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:974 +#: ../../reference/import.rst:978 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:976 +#: ../../reference/import.rst:980 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere `, the ``__main__`` module is " @@ -1250,17 +1253,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:987 +#: ../../reference/import.rst:991 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:989 +#: ../../reference/import.rst:993 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:992 +#: ../../reference/import.rst:996 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1268,30 +1271,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:997 +#: ../../reference/import.rst:1001 msgid "" "In :ref:`the remaining cases ` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:1001 +#: ../../reference/import.rst:1005 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:1002 +#: ../../reference/import.rst:1006 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:1003 +#: ../../reference/import.rst:1007 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:1004 +#: ../../reference/import.rst:1008 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:1006 +#: ../../reference/import.rst:1010 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1299,7 +1302,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:1011 +#: ../../reference/import.rst:1015 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1308,11 +1311,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:1019 +#: ../../reference/import.rst:1023 msgid "References" msgstr "" -#: ../../reference/import.rst:1021 +#: ../../reference/import.rst:1025 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages ` for " "Python 3.3. :pep:`420` also introduced the :meth:`find_loader` protocol as " "an alternative to :meth:`find_module`." msgstr "" -#: ../../reference/import.rst:1033 +#: ../../reference/import.rst:1037 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:1036 +#: ../../reference/import.rst:1040 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:1040 +#: ../../reference/import.rst:1044 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:1042 +#: ../../reference/import.rst:1046 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1359,15 +1362,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:1049 +#: ../../reference/import.rst:1053 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:1050 +#: ../../reference/import.rst:1054 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`\\ 。" -#: ../../reference/import.rst:1052 +#: ../../reference/import.rst:1056 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1376,7 +1379,7 @@ msgid "" "behavior that is not guaranteed to work in other Python implementations." msgstr "" -#: ../../reference/import.rst:1059 +#: ../../reference/import.rst:1063 msgid "" "In legacy code, it is possible to find instances of :class:`imp." "NullImporter` in the :data:`sys.path_importer_cache`. It is recommended " diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 824dda5312..dd239246a1 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-29 00:18+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -378,7 +378,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:317 msgid "" "*Other_ID_Start* - explicit list of characters in `PropList.txt `_ to support backwards " +"unicode.org/Public/14.0.0/ucd/PropList.txt>`_ to support backwards " "compatibility" msgstr "" @@ -395,7 +395,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:325 msgid "" "A non-normative HTML file listing all valid identifier characters for " -"Unicode 4.1 can be found at https://www.unicode.org/Public/13.0.0/ucd/" +"Unicode 14.0.0 can be found at https://www.unicode.org/Public/14.0.0/ucd/" "DerivedCoreProperties.txt" msgstr "" @@ -541,15 +541,12 @@ msgid "" "In plain English: Both types of literals can be enclosed in matching single " "quotes (``'``) or double quotes (``\"``). They can also be enclosed in " "matching groups of three single or double quotes (these are generally " -"referred to as *triple-quoted strings*). The backslash (``\\``) character is " -"used to give special meaning to otherwise ordinary characters like ``n``, " -"which means 'newline' when escaped (``\\n``). It can also be used to escape " -"characters that otherwise have a special meaning, such as newline, backslash " -"itself, or the quote character. See :ref:`escape sequences ` below for examples." +"referred to as *triple-quoted strings*). The backslash (``\\``) character " +"is used to escape characters that otherwise have a special meaning, such as " +"newline, backslash itself, or the quote character." msgstr "" -#: ../../reference/lexical_analysis.rst:493 +#: ../../reference/lexical_analysis.rst:491 msgid "" "Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an " "instance of the :class:`bytes` type instead of the :class:`str` type. They " @@ -557,7 +554,7 @@ msgid "" "greater must be expressed with escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:502 +#: ../../reference/lexical_analysis.rst:500 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "``'r'`` or ``'R'``; such strings are called :dfn:`raw strings` and treat " @@ -567,20 +564,20 @@ msgid "" "3.x's the ``'ur'`` syntax is not supported." msgstr "" -#: ../../reference/lexical_analysis.rst:509 +#: ../../reference/lexical_analysis.rst:507 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:513 +#: ../../reference/lexical_analysis.rst:511 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " "simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" "`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:522 +#: ../../reference/lexical_analysis.rst:520 msgid "" "A string literal with ``'f'`` or ``'F'`` in its prefix is a :dfn:`formatted " "string literal`; see :ref:`f-strings`. The ``'f'`` may be combined with " @@ -588,7 +585,7 @@ msgid "" "are possible, but formatted bytes literals are not." msgstr "" -#: ../../reference/lexical_analysis.rst:527 +#: ../../reference/lexical_analysis.rst:525 msgid "" "In triple-quoted literals, unescaped newlines and quotes are allowed (and " "are retained), except that three unescaped quotes in a row terminate the " @@ -596,229 +593,236 @@ msgid "" "either ``'`` or ``\"``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:548 +#: ../../reference/lexical_analysis.rst:544 msgid "" "Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:553 -#: ../../reference/lexical_analysis.rst:586 +#: ../../reference/lexical_analysis.rst:549 +#: ../../reference/lexical_analysis.rst:582 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:553 -#: ../../reference/lexical_analysis.rst:586 +#: ../../reference/lexical_analysis.rst:549 +#: ../../reference/lexical_analysis.rst:582 msgid "Meaning" msgstr "" -#: ../../reference/lexical_analysis.rst:553 -#: ../../reference/lexical_analysis.rst:586 +#: ../../reference/lexical_analysis.rst:549 +#: ../../reference/lexical_analysis.rst:582 msgid "Notes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:555 +#: ../../reference/lexical_analysis.rst:551 msgid "``\\``\\ " msgstr "``\\``\\ " -#: ../../reference/lexical_analysis.rst:555 +#: ../../reference/lexical_analysis.rst:551 msgid "Backslash and newline ignored" msgstr "" -#: ../../reference/lexical_analysis.rst:555 +#: ../../reference/lexical_analysis.rst:551 msgid "\\(1)" msgstr "\\(1)" -#: ../../reference/lexical_analysis.rst:557 +#: ../../reference/lexical_analysis.rst:553 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:557 +#: ../../reference/lexical_analysis.rst:553 msgid "Backslash (``\\``)" msgstr "" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:555 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:555 msgid "Single quote (``'``)" msgstr "" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:557 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:557 msgid "Double quote (``\"``)" msgstr "" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:559 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:559 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:561 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:561 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:563 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:563 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:565 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:565 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:567 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:567 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:569 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:569 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:571 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:571 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:573 msgid "``\\ooo``" msgstr "``\\ooo``" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:573 msgid "Character with octal value *ooo*" msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:573 msgid "(2,4)" msgstr "(2,4)" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:576 msgid "``\\xhh``" msgstr "``\\xhh``" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:576 msgid "Character with hex value *hh*" msgstr "" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:576 msgid "(3,4)" msgstr "(3,4)" -#: ../../reference/lexical_analysis.rst:583 +#: ../../reference/lexical_analysis.rst:579 msgid "Escape sequences only recognized in string literals are:" msgstr "" -#: ../../reference/lexical_analysis.rst:588 +#: ../../reference/lexical_analysis.rst:584 msgid "``\\N{name}``" msgstr "``\\N{name}``" -#: ../../reference/lexical_analysis.rst:588 +#: ../../reference/lexical_analysis.rst:584 msgid "Character named *name* in the Unicode database" msgstr "" -#: ../../reference/lexical_analysis.rst:588 +#: ../../reference/lexical_analysis.rst:584 msgid "\\(5)" msgstr "\\(5)" -#: ../../reference/lexical_analysis.rst:591 +#: ../../reference/lexical_analysis.rst:587 msgid "``\\uxxxx``" msgstr "``\\uxxxx``" -#: ../../reference/lexical_analysis.rst:591 +#: ../../reference/lexical_analysis.rst:587 msgid "Character with 16-bit hex value *xxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:591 +#: ../../reference/lexical_analysis.rst:587 msgid "\\(6)" msgstr "\\(6)" -#: ../../reference/lexical_analysis.rst:594 +#: ../../reference/lexical_analysis.rst:590 msgid "``\\Uxxxxxxxx``" msgstr "``\\Uxxxxxxxx``" -#: ../../reference/lexical_analysis.rst:594 +#: ../../reference/lexical_analysis.rst:590 msgid "Character with 32-bit hex value *xxxxxxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:594 +#: ../../reference/lexical_analysis.rst:590 msgid "\\(7)" msgstr "\\(7)" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:594 msgid "Notes:" msgstr "註解:" -#: ../../reference/lexical_analysis.rst:601 +#: ../../reference/lexical_analysis.rst:597 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:607 +#: ../../reference/lexical_analysis.rst:603 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "`, or parentheses and :ref:`string literal concatenation `." msgstr "" -#: ../../reference/lexical_analysis.rst:611 +#: ../../reference/lexical_analysis.rst:608 msgid "As in Standard C, up to three octal digits are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:614 +#: ../../reference/lexical_analysis.rst:610 +msgid "" +"Octal escapes with value larger than ``0o377`` produce a :exc:" +"`DeprecationWarning`. In a future Python version they will be a :exc:" +"`SyntaxWarning` and eventually a :exc:`SyntaxError`." +msgstr "" + +#: ../../reference/lexical_analysis.rst:616 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:617 +#: ../../reference/lexical_analysis.rst:619 msgid "" "In a bytes literal, hexadecimal and octal escapes denote the byte with the " "given value. In a string literal, these escapes denote a Unicode character " "with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:622 +#: ../../reference/lexical_analysis.rst:624 msgid "Support for name aliases [#]_ has been added." msgstr "" -#: ../../reference/lexical_analysis.rst:626 +#: ../../reference/lexical_analysis.rst:628 msgid "Exactly four hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:629 +#: ../../reference/lexical_analysis.rst:631 msgid "" "Any Unicode character can be encoded this way. Exactly eight hex digits are " "required." msgstr "" -#: ../../reference/lexical_analysis.rst:635 +#: ../../reference/lexical_analysis.rst:637 msgid "" "Unlike Standard C, all unrecognized escape sequences are left in the string " "unchanged, i.e., *the backslash is left in the result*. (This behavior is " @@ -828,14 +832,14 @@ msgid "" "category of unrecognized escapes for bytes literals." msgstr "" -#: ../../reference/lexical_analysis.rst:642 +#: ../../reference/lexical_analysis.rst:644 msgid "" "Unrecognized escape sequences produce a :exc:`DeprecationWarning`. In a " "future Python version they will be a :exc:`SyntaxWarning` and eventually a :" "exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:647 +#: ../../reference/lexical_analysis.rst:649 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -848,11 +852,11 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:660 +#: ../../reference/lexical_analysis.rst:662 msgid "String literal concatenation" msgstr "" -#: ../../reference/lexical_analysis.rst:662 +#: ../../reference/lexical_analysis.rst:664 msgid "" "Multiple adjacent string or bytes literals (delimited by whitespace), " "possibly using different quoting conventions, are allowed, and their meaning " @@ -862,7 +866,7 @@ msgid "" "lines, or even to add comments to parts of strings, for example::" msgstr "" -#: ../../reference/lexical_analysis.rst:673 +#: ../../reference/lexical_analysis.rst:675 msgid "" "Note that this feature is defined at the syntactical level, but implemented " "at compile time. The '+' operator must be used to concatenate string " @@ -872,11 +876,11 @@ msgid "" "with plain string literals." msgstr "" -#: ../../reference/lexical_analysis.rst:694 +#: ../../reference/lexical_analysis.rst:696 msgid "Formatted string literals" msgstr "" -#: ../../reference/lexical_analysis.rst:698 +#: ../../reference/lexical_analysis.rst:700 msgid "" "A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " "that is prefixed with ``'f'`` or ``'F'``. These strings may contain " @@ -885,14 +889,14 @@ msgid "" "are really expressions evaluated at run time." msgstr "" -#: ../../reference/lexical_analysis.rst:704 +#: ../../reference/lexical_analysis.rst:706 msgid "" "Escape sequences are decoded like in ordinary string literals (except when a " "literal is also marked as a raw string). After decoding, the grammar for " "the contents of the string is:" msgstr "" -#: ../../reference/lexical_analysis.rst:718 +#: ../../reference/lexical_analysis.rst:720 msgid "" "The parts of the string outside curly braces are treated literally, except " "that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " @@ -905,7 +909,7 @@ msgid "" "replacement field ends with a closing curly bracket ``'}'``." msgstr "" -#: ../../reference/lexical_analysis.rst:728 +#: ../../reference/lexical_analysis.rst:730 msgid "" "Expressions in formatted string literals are treated like regular Python " "expressions surrounded by parentheses, with a few exceptions. An empty " @@ -916,14 +920,14 @@ msgid "" "where the formatted string literal appears, in order from left to right." msgstr "" -#: ../../reference/lexical_analysis.rst:737 +#: ../../reference/lexical_analysis.rst:739 msgid "" "Prior to Python 3.7, an :keyword:`await` expression and comprehensions " "containing an :keyword:`async for` clause were illegal in the expressions in " "formatted string literals due to a problem with the implementation." msgstr "" -#: ../../reference/lexical_analysis.rst:742 +#: ../../reference/lexical_analysis.rst:744 msgid "" "When the equal sign ``'='`` is provided, the output will have the expression " "text, the ``'='`` and the evaluated value. Spaces after the opening brace " @@ -934,18 +938,18 @@ msgid "" "r'`` is declared." msgstr "" -#: ../../reference/lexical_analysis.rst:750 +#: ../../reference/lexical_analysis.rst:752 msgid "The equal sign ``'='``." msgstr "" -#: ../../reference/lexical_analysis.rst:753 +#: ../../reference/lexical_analysis.rst:755 msgid "" "If a conversion is specified, the result of evaluating the expression is " "converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " "result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." msgstr "" -#: ../../reference/lexical_analysis.rst:757 +#: ../../reference/lexical_analysis.rst:759 msgid "" "The result is then formatted using the :func:`format` protocol. The format " "specifier is passed to the :meth:`__format__` method of the expression or " @@ -954,7 +958,7 @@ msgid "" "whole string." msgstr "" -#: ../../reference/lexical_analysis.rst:763 +#: ../../reference/lexical_analysis.rst:765 msgid "" "Top-level format specifiers may include nested replacement fields. These " "nested fields may include their own conversion fields and :ref:`format " @@ -963,111 +967,111 @@ msgid "" "as that used by the :meth:`str.format` method." msgstr "" -#: ../../reference/lexical_analysis.rst:769 +#: ../../reference/lexical_analysis.rst:771 msgid "" "Formatted string literals may be concatenated, but replacement fields cannot " "be split across literals." msgstr "" -#: ../../reference/lexical_analysis.rst:772 +#: ../../reference/lexical_analysis.rst:774 msgid "Some examples of formatted string literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:804 +#: ../../reference/lexical_analysis.rst:806 msgid "" "A consequence of sharing the same syntax as regular string literals is that " "characters in the replacement fields must not conflict with the quoting used " "in the outer formatted string literal::" msgstr "" -#: ../../reference/lexical_analysis.rst:811 +#: ../../reference/lexical_analysis.rst:813 msgid "" "Backslashes are not allowed in format expressions and will raise an error::" msgstr "" -#: ../../reference/lexical_analysis.rst:816 +#: ../../reference/lexical_analysis.rst:818 msgid "" "To include a value in which a backslash escape is required, create a " "temporary variable." msgstr "" -#: ../../reference/lexical_analysis.rst:823 +#: ../../reference/lexical_analysis.rst:825 msgid "" "Formatted string literals cannot be used as docstrings, even if they do not " "include expressions." msgstr "" -#: ../../reference/lexical_analysis.rst:834 +#: ../../reference/lexical_analysis.rst:836 msgid "" "See also :pep:`498` for the proposal that added formatted string literals, " "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" -#: ../../reference/lexical_analysis.rst:841 +#: ../../reference/lexical_analysis.rst:843 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:847 +#: ../../reference/lexical_analysis.rst:849 msgid "" "There are three types of numeric literals: integers, floating point numbers, " "and imaginary numbers. There are no complex literals (complex numbers can " "be formed by adding a real number and an imaginary number)." msgstr "" -#: ../../reference/lexical_analysis.rst:851 +#: ../../reference/lexical_analysis.rst:853 msgid "" "Note that numeric literals do not include a sign; a phrase like ``-1`` is " "actually an expression composed of the unary operator '``-``' and the " "literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:865 +#: ../../reference/lexical_analysis.rst:867 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:867 +#: ../../reference/lexical_analysis.rst:869 msgid "Integer literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:881 +#: ../../reference/lexical_analysis.rst:883 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory." msgstr "" -#: ../../reference/lexical_analysis.rst:884 +#: ../../reference/lexical_analysis.rst:886 msgid "" "Underscores are ignored for determining the numeric value of the literal. " "They can be used to group digits for enhanced readability. One underscore " "can occur between digits, and after base specifiers like ``0x``." msgstr "" -#: ../../reference/lexical_analysis.rst:888 +#: ../../reference/lexical_analysis.rst:890 msgid "" "Note that leading zeros in a non-zero decimal number are not allowed. This " "is for disambiguation with C-style octal literals, which Python used before " "version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:894 msgid "Some examples of integer literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:898 -#: ../../reference/lexical_analysis.rst:930 +#: ../../reference/lexical_analysis.rst:900 +#: ../../reference/lexical_analysis.rst:932 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:909 +#: ../../reference/lexical_analysis.rst:911 msgid "Floating point literals" msgstr "" -#: ../../reference/lexical_analysis.rst:911 +#: ../../reference/lexical_analysis.rst:913 msgid "" "Floating point literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:921 +#: ../../reference/lexical_analysis.rst:923 msgid "" "Note that the integer and exponent parts are always interpreted using radix " "10. For example, ``077e010`` is legal, and denotes the same number as " @@ -1076,19 +1080,19 @@ msgid "" "grouping." msgstr "" -#: ../../reference/lexical_analysis.rst:926 +#: ../../reference/lexical_analysis.rst:928 msgid "Some examples of floating point literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:941 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:941 +#: ../../reference/lexical_analysis.rst:943 msgid "Imaginary literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:946 +#: ../../reference/lexical_analysis.rst:948 msgid "" "An imaginary literal yields a complex number with a real part of 0.0. " "Complex numbers are represented as a pair of floating point numbers and have " @@ -1097,23 +1101,23 @@ msgid "" "Some examples of imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:958 +#: ../../reference/lexical_analysis.rst:960 msgid "Operators" msgstr "" -#: ../../reference/lexical_analysis.rst:962 +#: ../../reference/lexical_analysis.rst:964 msgid "The following tokens are operators:" msgstr "" -#: ../../reference/lexical_analysis.rst:975 +#: ../../reference/lexical_analysis.rst:977 msgid "Delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:979 +#: ../../reference/lexical_analysis.rst:981 msgid "The following tokens serve as delimiters in the grammar:" msgstr "" -#: ../../reference/lexical_analysis.rst:988 +#: ../../reference/lexical_analysis.rst:990 msgid "" "The period can also occur in floating-point and imaginary literals. A " "sequence of three periods has a special meaning as an ellipsis literal. The " @@ -1121,22 +1125,22 @@ msgid "" "as delimiters, but also perform an operation." msgstr "" -#: ../../reference/lexical_analysis.rst:993 +#: ../../reference/lexical_analysis.rst:995 msgid "" "The following printing ASCII characters have special meaning as part of " "other tokens or are otherwise significant to the lexical analyzer:" msgstr "" -#: ../../reference/lexical_analysis.rst:1000 +#: ../../reference/lexical_analysis.rst:1002 msgid "" "The following printing ASCII characters are not used in Python. Their " "occurrence outside string literals and comments is an unconditional error:" msgstr "" -#: ../../reference/lexical_analysis.rst:1009 +#: ../../reference/lexical_analysis.rst:1011 msgid "Footnotes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:1010 +#: ../../reference/lexical_analysis.rst:1012 msgid "https://www.unicode.org/Public/11.0.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/11.0.0/ucd/NameAliases.txt" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 36bd549426..37dc14af9d 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-04 00:13+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -632,41 +632,49 @@ msgid "" "exception context." msgstr "" -#: ../../reference/simple_stmts.rst:661 +#: ../../reference/simple_stmts.rst:658 +msgid "" +"If the traceback of the active exception is modified in an :keyword:`except` " +"clause, a subsequent ``raise`` statement re-raises the exception with the " +"modified traceback. Previously, the exception was re-raised with the " +"traceback it had when it was caught." +msgstr "" + +#: ../../reference/simple_stmts.rst:667 msgid "The :keyword:`!break` statement" msgstr "" -#: ../../reference/simple_stmts.rst:672 +#: ../../reference/simple_stmts.rst:678 msgid "" ":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" "keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" -#: ../../reference/simple_stmts.rst:679 +#: ../../reference/simple_stmts.rst:685 msgid "" "It terminates the nearest enclosing loop, skipping the optional :keyword:`!" "else` clause if the loop has one." msgstr "" -#: ../../reference/simple_stmts.rst:682 +#: ../../reference/simple_stmts.rst:688 msgid "" "If a :keyword:`for` loop is terminated by :keyword:`break`, the loop control " "target keeps its current value." msgstr "" -#: ../../reference/simple_stmts.rst:687 +#: ../../reference/simple_stmts.rst:693 msgid "" "When :keyword:`break` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the loop." msgstr "" -#: ../../reference/simple_stmts.rst:695 +#: ../../reference/simple_stmts.rst:701 msgid "The :keyword:`!continue` statement" msgstr "" -#: ../../reference/simple_stmts.rst:707 +#: ../../reference/simple_stmts.rst:713 msgid "" ":keyword:`continue` may only occur syntactically nested in a :keyword:`for` " "or :keyword:`while` loop, but not nested in a function or class definition " @@ -674,41 +682,41 @@ msgid "" "loop." msgstr "" -#: ../../reference/simple_stmts.rst:711 +#: ../../reference/simple_stmts.rst:717 msgid "" "When :keyword:`continue` passes control out of a :keyword:`try` statement " "with a :keyword:`finally` clause, that :keyword:`!finally` clause is " "executed before really starting the next loop cycle." msgstr "" -#: ../../reference/simple_stmts.rst:720 +#: ../../reference/simple_stmts.rst:726 msgid "The :keyword:`!import` statement" msgstr "" -#: ../../reference/simple_stmts.rst:741 +#: ../../reference/simple_stmts.rst:747 msgid "" "The basic import statement (no :keyword:`from` clause) is executed in two " "steps:" msgstr "" -#: ../../reference/simple_stmts.rst:744 +#: ../../reference/simple_stmts.rst:750 msgid "find a module, loading and initializing it if necessary" msgstr "" -#: ../../reference/simple_stmts.rst:745 +#: ../../reference/simple_stmts.rst:751 msgid "" "define a name or names in the local namespace for the scope where the :" "keyword:`import` statement occurs." msgstr "" -#: ../../reference/simple_stmts.rst:748 +#: ../../reference/simple_stmts.rst:754 msgid "" "When the statement contains multiple clauses (separated by commas) the two " "steps are carried out separately for each clause, just as though the clauses " "had been separated out into individual import statements." msgstr "" -#: ../../reference/simple_stmts.rst:753 +#: ../../reference/simple_stmts.rst:759 msgid "" "The details of the first step, finding and loading modules are described in " "greater detail in the section on the :ref:`import system `, " @@ -719,26 +727,26 @@ msgid "" "module, which includes execution of the module's code." msgstr "" -#: ../../reference/simple_stmts.rst:761 +#: ../../reference/simple_stmts.rst:767 msgid "" "If the requested module is retrieved successfully, it will be made available " "in the local namespace in one of three ways:" msgstr "" -#: ../../reference/simple_stmts.rst:766 +#: ../../reference/simple_stmts.rst:772 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." msgstr "" -#: ../../reference/simple_stmts.rst:768 +#: ../../reference/simple_stmts.rst:774 msgid "" "If no other name is specified, and the module being imported is a top level " "module, the module's name is bound in the local namespace as a reference to " "the imported module" msgstr "" -#: ../../reference/simple_stmts.rst:771 +#: ../../reference/simple_stmts.rst:777 msgid "" "If the module being imported is *not* a top level module, then the name of " "the top level package that contains the module is bound in the local " @@ -746,56 +754,56 @@ msgid "" "be accessed using its full qualified name rather than directly" msgstr "" -#: ../../reference/simple_stmts.rst:781 +#: ../../reference/simple_stmts.rst:787 msgid "The :keyword:`from` form uses a slightly more complex process:" msgstr "" -#: ../../reference/simple_stmts.rst:783 +#: ../../reference/simple_stmts.rst:789 msgid "" "find the module specified in the :keyword:`from` clause, loading and " "initializing it if necessary;" msgstr "" -#: ../../reference/simple_stmts.rst:785 +#: ../../reference/simple_stmts.rst:791 msgid "for each of the identifiers specified in the :keyword:`import` clauses:" msgstr "" -#: ../../reference/simple_stmts.rst:787 +#: ../../reference/simple_stmts.rst:793 msgid "check if the imported module has an attribute by that name" msgstr "" -#: ../../reference/simple_stmts.rst:788 +#: ../../reference/simple_stmts.rst:794 msgid "" "if not, attempt to import a submodule with that name and then check the " "imported module again for that attribute" msgstr "" -#: ../../reference/simple_stmts.rst:790 +#: ../../reference/simple_stmts.rst:796 msgid "if the attribute is not found, :exc:`ImportError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:791 +#: ../../reference/simple_stmts.rst:797 msgid "" "otherwise, a reference to that value is stored in the local namespace, using " "the name in the :keyword:`!as` clause if it is present, otherwise using the " "attribute name" msgstr "" -#: ../../reference/simple_stmts.rst:795 +#: ../../reference/simple_stmts.rst:801 msgid "Examples::" msgstr "" "範例:\n" "\n" "::" -#: ../../reference/simple_stmts.rst:805 +#: ../../reference/simple_stmts.rst:811 msgid "" "If the list of identifiers is replaced by a star (``'*'``), all public names " "defined in the module are bound in the local namespace for the scope where " "the :keyword:`import` statement occurs." msgstr "" -#: ../../reference/simple_stmts.rst:811 +#: ../../reference/simple_stmts.rst:817 msgid "" "The *public names* defined by a module are determined by checking the " "module's namespace for a variable named ``__all__``; if defined, it must be " @@ -808,14 +816,14 @@ msgid "" "API (such as library modules which were imported and used within the module)." msgstr "" -#: ../../reference/simple_stmts.rst:821 +#: ../../reference/simple_stmts.rst:827 msgid "" "The wild card form of import --- ``from module import *`` --- is only " "allowed at the module level. Attempting to use it in class or function " "definitions will raise a :exc:`SyntaxError`." msgstr "" -#: ../../reference/simple_stmts.rst:828 +#: ../../reference/simple_stmts.rst:834 msgid "" "When specifying what module to import you do not have to specify the " "absolute name of the module. When a module or package is contained within " @@ -832,31 +840,31 @@ msgid "" "the :ref:`relativeimports` section." msgstr "" -#: ../../reference/simple_stmts.rst:842 +#: ../../reference/simple_stmts.rst:848 msgid "" ":func:`importlib.import_module` is provided to support applications that " "determine dynamically the modules to be loaded." msgstr "" -#: ../../reference/simple_stmts.rst:845 +#: ../../reference/simple_stmts.rst:851 msgid "" "Raises an :ref:`auditing event ` ``import`` with arguments " "``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." "path_hooks``." msgstr "" -#: ../../reference/simple_stmts.rst:850 +#: ../../reference/simple_stmts.rst:856 msgid "Future statements" msgstr "" -#: ../../reference/simple_stmts.rst:856 +#: ../../reference/simple_stmts.rst:862 msgid "" "A :dfn:`future statement` is a directive to the compiler that a particular " "module should be compiled using syntax or semantics that will be available " "in a specified future release of Python where the feature becomes standard." msgstr "" -#: ../../reference/simple_stmts.rst:860 +#: ../../reference/simple_stmts.rst:866 msgid "" "The future statement is intended to ease migration to future versions of " "Python that introduce incompatible changes to the language. It allows use " @@ -864,35 +872,35 @@ msgid "" "feature becomes standard." msgstr "" -#: ../../reference/simple_stmts.rst:872 +#: ../../reference/simple_stmts.rst:878 msgid "" "A future statement must appear near the top of the module. The only lines " "that can appear before a future statement are:" msgstr "" -#: ../../reference/simple_stmts.rst:875 +#: ../../reference/simple_stmts.rst:881 msgid "the module docstring (if any)," msgstr "" -#: ../../reference/simple_stmts.rst:876 +#: ../../reference/simple_stmts.rst:882 msgid "comments," msgstr "" -#: ../../reference/simple_stmts.rst:877 +#: ../../reference/simple_stmts.rst:883 msgid "blank lines, and" msgstr "" -#: ../../reference/simple_stmts.rst:878 +#: ../../reference/simple_stmts.rst:884 msgid "other future statements." msgstr "" -#: ../../reference/simple_stmts.rst:880 +#: ../../reference/simple_stmts.rst:886 msgid "" "The only feature that requires using the future statement is ``annotations`` " "(see :pep:`563`)." msgstr "" -#: ../../reference/simple_stmts.rst:883 +#: ../../reference/simple_stmts.rst:889 msgid "" "All historical features enabled by the future statement are still recognized " "by Python 3. The list includes ``absolute_import``, ``division``, " @@ -902,7 +910,7 @@ msgid "" "compatibility." msgstr "" -#: ../../reference/simple_stmts.rst:890 +#: ../../reference/simple_stmts.rst:896 msgid "" "A future statement is recognized and treated specially at compile time: " "Changes to the semantics of core constructs are often implemented by " @@ -912,37 +920,37 @@ msgid "" "cannot be pushed off until runtime." msgstr "" -#: ../../reference/simple_stmts.rst:897 +#: ../../reference/simple_stmts.rst:903 msgid "" "For any given release, the compiler knows which feature names have been " "defined, and raises a compile-time error if a future statement contains a " "feature not known to it." msgstr "" -#: ../../reference/simple_stmts.rst:901 +#: ../../reference/simple_stmts.rst:907 msgid "" "The direct runtime semantics are the same as for any import statement: there " "is a standard module :mod:`__future__`, described later, and it will be " "imported in the usual way at the time the future statement is executed." msgstr "" -#: ../../reference/simple_stmts.rst:905 +#: ../../reference/simple_stmts.rst:911 msgid "" "The interesting runtime semantics depend on the specific feature enabled by " "the future statement." msgstr "" -#: ../../reference/simple_stmts.rst:908 +#: ../../reference/simple_stmts.rst:914 msgid "Note that there is nothing special about the statement::" msgstr "" -#: ../../reference/simple_stmts.rst:912 +#: ../../reference/simple_stmts.rst:918 msgid "" "That is not a future statement; it's an ordinary import statement with no " "special semantics or syntax restrictions." msgstr "" -#: ../../reference/simple_stmts.rst:915 +#: ../../reference/simple_stmts.rst:921 msgid "" "Code compiled by calls to the built-in functions :func:`exec` and :func:" "`compile` that occur in a module :mod:`M` containing a future statement " @@ -951,7 +959,7 @@ msgid "" "--- see the documentation of that function for details." msgstr "" -#: ../../reference/simple_stmts.rst:921 +#: ../../reference/simple_stmts.rst:927 msgid "" "A future statement typed at an interactive interpreter prompt will take " "effect for the rest of the interpreter session. If an interpreter is " @@ -960,19 +968,19 @@ msgid "" "interactive session started after the script is executed." msgstr "" -#: ../../reference/simple_stmts.rst:929 +#: ../../reference/simple_stmts.rst:935 msgid ":pep:`236` - Back to the __future__" msgstr "" -#: ../../reference/simple_stmts.rst:930 +#: ../../reference/simple_stmts.rst:936 msgid "The original proposal for the __future__ mechanism." msgstr "" -#: ../../reference/simple_stmts.rst:936 +#: ../../reference/simple_stmts.rst:942 msgid "The :keyword:`!global` statement" msgstr "" -#: ../../reference/simple_stmts.rst:946 +#: ../../reference/simple_stmts.rst:952 msgid "" "The :keyword:`global` statement is a declaration which holds for the entire " "current code block. It means that the listed identifiers are to be " @@ -981,13 +989,13 @@ msgid "" "globals without being declared global." msgstr "" -#: ../../reference/simple_stmts.rst:952 +#: ../../reference/simple_stmts.rst:958 msgid "" "Names listed in a :keyword:`global` statement must not be used in the same " "code block textually preceding that :keyword:`!global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:955 +#: ../../reference/simple_stmts.rst:961 msgid "" "Names listed in a :keyword:`global` statement must not be defined as formal " "parameters, or as targets in :keyword:`with` statements or :keyword:`except` " @@ -995,14 +1003,14 @@ msgid "" "function definition, :keyword:`import` statement, or variable annotation." msgstr "" -#: ../../reference/simple_stmts.rst:962 +#: ../../reference/simple_stmts.rst:968 msgid "" "The current implementation does not enforce some of these restrictions, but " "programs should not abuse this freedom, as future implementations may " "enforce them or silently change the meaning of the program." msgstr "" -#: ../../reference/simple_stmts.rst:971 +#: ../../reference/simple_stmts.rst:977 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1014,11 +1022,11 @@ msgid "" "func:`compile` functions." msgstr "" -#: ../../reference/simple_stmts.rst:983 +#: ../../reference/simple_stmts.rst:989 msgid "The :keyword:`!nonlocal` statement" msgstr "" -#: ../../reference/simple_stmts.rst:995 +#: ../../reference/simple_stmts.rst:1001 msgid "" "The :keyword:`nonlocal` statement causes the listed identifiers to refer to " "previously bound variables in the nearest enclosing scope excluding globals. " @@ -1027,7 +1035,7 @@ msgid "" "variables outside of the local scope besides the global (module) scope." msgstr "" -#: ../../reference/simple_stmts.rst:1005 +#: ../../reference/simple_stmts.rst:1011 msgid "" "Names listed in a :keyword:`nonlocal` statement, unlike those listed in a :" "keyword:`global` statement, must refer to pre-existing bindings in an " @@ -1035,16 +1043,16 @@ msgid "" "be determined unambiguously)." msgstr "" -#: ../../reference/simple_stmts.rst:1010 +#: ../../reference/simple_stmts.rst:1016 msgid "" "Names listed in a :keyword:`nonlocal` statement must not collide with pre-" "existing bindings in the local scope." msgstr "" -#: ../../reference/simple_stmts.rst:1015 +#: ../../reference/simple_stmts.rst:1021 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: ../../reference/simple_stmts.rst:1016 +#: ../../reference/simple_stmts.rst:1022 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index d532cb7c0a..8c86617d7d 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-11 00:10+0000\n" -"PO-Revision-Date: 2021-05-27 15:39+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 05:53+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -24,7 +24,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 2.4.3\n" +"X-Generator: Poedit 3.1.1\n" #: ../../tutorial/datastructures.rst:5 msgid "Data Structures" @@ -333,11 +333,11 @@ msgstr "" #: ../../tutorial/datastructures.rst:306 msgid "" -"As we saw in the previous section, the nested listcomp is evaluated in the " -"context of the :keyword:`for` that follows it, so this example is equivalent " -"to::" +"As we saw in the previous section, the inner list comprehension is evaluated " +"in the context of the :keyword:`for` that follows it, so this example is " +"equivalent to::" msgstr "" -"如同我們在上一節看到的,此巢狀的 list comprehension 會依據後面的 :keyword:" +"如同我們在上一節看到的,內部的 list comprehension 會依據後面的 :keyword:" "`for` 環境被求值,所以這個例子就等於:\n" "\n" "::" diff --git a/tutorial/errors.po b/tutorial/errors.po index 1c36d9581d..b471efd743 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" -"PO-Revision-Date: 2022-01-04 12:58+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 05:53+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -20,7 +20,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 3.1.1\n" #: ../../tutorial/errors.rst:5 msgid "Errors and Exceptions" @@ -227,27 +227,61 @@ msgstr "" #: ../../tutorial/errors.rst:150 msgid "" -"All exceptions inherit from :exc:`BaseException`, and so it can be used to " -"serve as a wildcard. Use this with extreme caution, since it is easy to mask " -"a real programming error in this way! It can also be used to print an error " -"message and then re-raise the exception (allowing a caller to handle the " -"exception as well)::" +"When an exception occurs, it may have associated values, also known as the " +"exception's *arguments*. The presence and types of the arguments depend on " +"the exception type." msgstr "" -"所有例外繼承自 :exc:`BaseException`\\ ,以統一處理所有其他例外,但使用上要極" -"其小心,因為這種方式容易遮蔽真正的程式設計錯誤!它也可用於印出錯誤訊息,然後" -"重新引發例外(也讓呼叫者可以處理該例外):\n" +"當例外發生時,它可能有相關聯的值,也就是例外的\\ *引數*\\ 。引數的存在與否及" +"它的類型,是取決於例外的類型。" + +#: ../../tutorial/errors.rst:154 +msgid "" +"The *except clause* may specify a variable after the exception name. The " +"variable is bound to the exception instance which typically has an ``args`` " +"attribute that stores the arguments. For convenience, builtin exception " +"types define :meth:`__str__` to print all the arguments without explicitly " +"accessing ``.args``. ::" +msgstr "" +"*except 子句*\\ 可以在例外名稱後面指定一個變數。這個變數被綁定到一個例外實例 " +"(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義了 :" +"meth:`__str__` 以印出所有引數而不需顯式地取用 ``.args``\\ :\n" "\n" "::" -#: ../../tutorial/errors.rst:169 +#: ../../tutorial/errors.rst:177 msgid "" -"Alternatively the last except clause may omit the exception name(s), however " -"the exception value must then be retrieved from ``sys.exc_info()[1]``." +"The exception's :meth:`__str__` output is printed as the last part " +"('detail') of the message for unhandled exceptions." msgstr "" -"或者讓最後一個 except 子句可以省略例外名稱,但之後例外的值必須是從 ``sys." -"exc_info()[1]`` 得到的。" +"例外的 :meth:`__str__` 輸出會被印在未處理例外訊息的最後一部分(「細節」)。" -#: ../../tutorial/errors.rst:172 +#: ../../tutorial/errors.rst:180 +msgid "" +":exc:`BaseException` is the common base class of all exceptions. One of its " +"subclasses, :exc:`Exception`, is the base class of all the non-fatal " +"exceptions. Exceptions which are not subclasses of :exc:`Exception` are not " +"typically handled, because they are used to indicate that the program should " +"terminate. They include :exc:`SystemExit` which is raised by :meth:`sys." +"exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to " +"interrupt the program." +msgstr "" + +#: ../../tutorial/errors.rst:188 +msgid "" +":exc:`Exception` can be used as a wildcard that catches (almost) everything. " +"However, it is good practice to be as specific as possible with the types of " +"exceptions that we intend to handle, and to allow any unexpected exceptions " +"to propagate on." +msgstr "" + +#: ../../tutorial/errors.rst:193 +msgid "" +"The most common pattern for handling :exc:`Exception` is to print or log the " +"exception and then re-raise it (allowing a caller to handle the exception as " +"well)::" +msgstr "" + +#: ../../tutorial/errors.rst:211 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -260,7 +294,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:186 +#: ../../tutorial/errors.rst:225 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -271,42 +305,10 @@ msgstr "" "這可以避免意外地捕獲不是由 :keyword:`!try` ... :keyword:`!except` 陳述式保護" "的程式碼所引發的例外。" -#: ../../tutorial/errors.rst:191 -msgid "" -"When an exception occurs, it may have an associated value, also known as the " -"exception's *argument*. The presence and type of the argument depend on the " -"exception type." -msgstr "" -"當例外發生時,它可能有一個相關的值,也就是例外的\\ *引數*\\ 。此引數的存在與" -"否及它的類型,是取決於例外的類型。" - -#: ../../tutorial/errors.rst:195 +#: ../../tutorial/errors.rst:230 msgid "" -"The *except clause* may specify a variable after the exception name. The " -"variable is bound to an exception instance with the arguments stored in " -"``instance.args``. For convenience, the exception instance defines :meth:" -"`__str__` so the arguments can be printed directly without having to " -"reference ``.args``. One may also instantiate an exception first before " -"raising it and add any attributes to it as desired. ::" -msgstr "" -"*except 子句*\\ 可以在例外名稱後面指定一個變數。這個變數被綁定到一個例外實例 " -"(instance),其引數儲存在 ``instance.args`` 中。為了方便,例外實例會定義 :" -"meth:`__str__`\\ ,因此引數可以直接被印出而無須引用 ``.args``。你也可以在引發" -"例外前就先建立一個例外實例,並隨心所欲地為它加入任何屬性。\n" -"\n" -"::" - -#: ../../tutorial/errors.rst:219 -msgid "" -"If an exception has arguments, they are printed as the last part ('detail') " -"of the message for unhandled exceptions." -msgstr "" -"如果一個例外有引數,則它們會被印在未處理例外的訊息的最後一部分(「細節」)。" - -#: ../../tutorial/errors.rst:222 -msgid "" -"Exception handlers don't just handle exceptions if they occur immediately in " -"the *try clause*, but also if they occur inside functions that are called " +"Exception handlers do not handle only exceptions that occur immediately in " +"the *try clause*, but also those that occur inside functions that are called " "(even indirectly) in the *try clause*. For example::" msgstr "" "例外的處理者不僅處理 *try 子句*\\ 內立即發生的例外,還處理 *try 子句*\\ 內" @@ -314,11 +316,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:240 +#: ../../tutorial/errors.rst:248 msgid "Raising Exceptions" msgstr "引發例外" -#: ../../tutorial/errors.rst:242 +#: ../../tutorial/errors.rst:250 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" @@ -327,22 +329,22 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:250 +#: ../../tutorial/errors.rst:258 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " -"that derives from :class:`Exception`). If an exception class is passed, it " -"will be implicitly instantiated by calling its constructor with no " -"arguments::" +"that derives from :class:`BaseException`, such as :exc:`Exception` or one of " +"its subclasses). If an exception class is passed, it will be implicitly " +"instantiated by calling its constructor with no arguments::" msgstr "" ":keyword:`raise` 唯一的引數就是要引發的例外。該引數必須是一個例外實例或例外 " -"class(衍生自 :class:`Exception` 的 class)。如果一個例外 class 被傳遞,它會" -"不含引數地呼叫它的建構函式 (constructor) ,使它被自動建立實例 (implicitly " -"instantiated):\n" +"class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與他" +"的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " +"(constructor) ,使它被自動建立實例 (implicitly instantiated):\n" "\n" "::" -#: ../../tutorial/errors.rst:257 +#: ../../tutorial/errors.rst:266 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" @@ -353,46 +355,46 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:276 +#: ../../tutorial/errors.rst:285 msgid "Exception Chaining" msgstr "例外鏈接 (Exception Chaining)" -#: ../../tutorial/errors.rst:278 +#: ../../tutorial/errors.rst:287 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " "error message::" msgstr "" -#: ../../tutorial/errors.rst:297 +#: ../../tutorial/errors.rst:306 msgid "" "To indicate that an exception is a direct consequence of another, the :" "keyword:`raise` statement allows an optional :keyword:`from` clause::" msgstr "" -#: ../../tutorial/errors.rst:303 +#: ../../tutorial/errors.rst:312 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "" "要變換例外時,這種方式很有用。例如:\n" "\n" "::" -#: ../../tutorial/errors.rst:324 +#: ../../tutorial/errors.rst:333 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" msgstr "" -#: ../../tutorial/errors.rst:336 +#: ../../tutorial/errors.rst:345 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "更多關於鏈接機制的資訊,詳見\\ :ref:`bltin-exceptions`\\ 。" -#: ../../tutorial/errors.rst:342 +#: ../../tutorial/errors.rst:351 msgid "User-defined Exceptions" msgstr "使用者自定的例外" -#: ../../tutorial/errors.rst:344 +#: ../../tutorial/errors.rst:353 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -403,7 +405,7 @@ msgstr "" "\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該從 :exc:" "`Exception` class 衍生出來。" -#: ../../tutorial/errors.rst:348 +#: ../../tutorial/errors.rst:357 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -413,26 +415,23 @@ msgstr "" "例外 class 可被定義來做任何其他 class 能夠做的事,但通常會讓它維持簡單,只提" "供一些屬性,讓關於錯誤的資訊可被例外的處理者抽取出來。" -#: ../../tutorial/errors.rst:352 +#: ../../tutorial/errors.rst:361 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." msgstr "大多數的例外定義,都會以「Error」作為名稱結尾,類似於標準例外的命名。" -#: ../../tutorial/errors.rst:355 +#: ../../tutorial/errors.rst:364 msgid "" "Many standard modules define their own exceptions to report errors that may " -"occur in functions they define. More information on classes is presented in " -"chapter :ref:`tut-classes`." -msgstr "" -"許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。更多有關 " -"class 的資訊,詳見\\ :ref:`tut-classes`\\ 章節。" +"occur in functions they define." +msgstr "許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。" -#: ../../tutorial/errors.rst:363 +#: ../../tutorial/errors.rst:371 msgid "Defining Clean-up Actions" msgstr "定義清理動作" -#: ../../tutorial/errors.rst:365 +#: ../../tutorial/errors.rst:373 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -443,7 +442,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:379 +#: ../../tutorial/errors.rst:387 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -456,7 +455,7 @@ msgstr "" "外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比較複雜的情" "況:" -#: ../../tutorial/errors.rst:385 +#: ../../tutorial/errors.rst:393 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " @@ -467,7 +466,7 @@ msgstr "" "`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理,它會在 :" "keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:391 +#: ../../tutorial/errors.rst:399 msgid "" "An exception could occur during execution of an :keyword:`!except` or :" "keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" @@ -476,7 +475,7 @@ msgstr "" "一個例外可能發生於 :keyword:`!except` 或 :keyword:`!else` 子句的執行過程。同" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:395 +#: ../../tutorial/errors.rst:403 msgid "" "If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, exceptions are not re-raised." @@ -484,7 +483,7 @@ msgstr "" "如果 :keyword:`!finally` 子句執行 :keyword:`break`\\ 、\\ :keyword:" "`continue` 或 :keyword:`return` 陳述式,則例外不會被重新引發。" -#: ../../tutorial/errors.rst:399 +#: ../../tutorial/errors.rst:407 msgid "" "If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " @@ -495,7 +494,7 @@ msgstr "" "或 :keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" "break`\\ 、\\ :keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" -#: ../../tutorial/errors.rst:405 +#: ../../tutorial/errors.rst:413 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` clause's :" @@ -506,21 +505,21 @@ msgstr "" "自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來自 :" "keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" -#: ../../tutorial/errors.rst:411 +#: ../../tutorial/errors.rst:419 msgid "For example::" msgstr "" "例如:\n" "\n" "::" -#: ../../tutorial/errors.rst:422 +#: ../../tutorial/errors.rst:430 msgid "A more complicated example::" msgstr "" "另一個比較複雜的範例:\n" "\n" "::" -#: ../../tutorial/errors.rst:447 +#: ../../tutorial/errors.rst:455 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " "The :exc:`TypeError` raised by dividing two strings is not handled by the :" @@ -531,7 +530,7 @@ msgstr "" "發的 :exc:`TypeError` 沒有被 :keyword:`except` 子句處理,因此會在 :keyword:`!" "finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:452 +#: ../../tutorial/errors.rst:460 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -540,11 +539,11 @@ msgstr "" "在真實應用程式中,\\ :keyword:`finally` 子句對於釋放外部資源(例如檔案或網路" "連線)很有用,無論該資源的使用是否成功。" -#: ../../tutorial/errors.rst:460 +#: ../../tutorial/errors.rst:468 msgid "Predefined Clean-up Actions" msgstr "預定義的清理動作" -#: ../../tutorial/errors.rst:462 +#: ../../tutorial/errors.rst:470 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -556,7 +555,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:470 +#: ../../tutorial/errors.rst:478 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -572,7 +571,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:480 +#: ../../tutorial/errors.rst:488 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -582,6 +581,86 @@ msgstr "" "陳述式執行完畢後,就算是在處理內容時遇到問題,檔案 *f* 總是會被關閉。和檔案一" "樣,提供預定義清理動作的物件會在說明文件中表明這一點。" +#: ../../tutorial/errors.rst:496 +msgid "Raising and Handling Multiple Unrelated Exceptions" +msgstr "" + +#: ../../tutorial/errors.rst:498 +msgid "" +"There are situations where it is necessary to report several exceptions that " +"have occurred. This it often the case in concurrency frameworks, when " +"several tasks may have failed in parallel, but there are also other use " +"cases where it is desirable to continue execution and collect multiple " +"errors rather than raise the first exception." +msgstr "" + +#: ../../tutorial/errors.rst:504 +msgid "" +"The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " +"that they can be raised together. It is an exception itself, so it can be " +"caught like any other exception. ::" +msgstr "" + +#: ../../tutorial/errors.rst:530 +msgid "" +"By using ``except*`` instead of ``except``, we can selectively handle only " +"the exceptions in the group that match a certain type. In the following " +"example, which shows a nested exception group, each ``except*`` clause " +"extracts from the group exceptions of a certain type while letting all other " +"exceptions propagate to other clauses and eventually to be reraised. ::" +msgstr "" + +#: ../../tutorial/errors.rst:564 +msgid "" +"Note that the exceptions nested in an exception group must be instances, not " +"types. This is because in practice the exceptions would typically be ones " +"that have already been raised and caught by the program, along the following " +"pattern::" +msgstr "" + +#: ../../tutorial/errors.rst:582 +msgid "Enriching Exceptions with Notes" +msgstr "" + +#: ../../tutorial/errors.rst:584 +msgid "" +"When an exception is created in order to be raised, it is usually " +"initialized with information that describes the error that has occurred. " +"There are cases where it is useful to add information after the exception " +"was caught. For this purpose, exceptions have a method ``add_note(note)`` " +"that accepts a string and adds it to the exception's notes list. The " +"standard traceback rendering includes all notes, in the order they were " +"added, after the exception. ::" +msgstr "" + +#: ../../tutorial/errors.rst:605 +msgid "" +"For example, when collecting exceptions into an exception group, we may want " +"to add context information for the individual errors. In the following each " +"exception in the group has a note indicating when this error has occurred. ::" +msgstr "" + +#~ msgid "" +#~ "All exceptions inherit from :exc:`BaseException`, and so it can be used " +#~ "to serve as a wildcard. Use this with extreme caution, since it is easy " +#~ "to mask a real programming error in this way! It can also be used to " +#~ "print an error message and then re-raise the exception (allowing a caller " +#~ "to handle the exception as well)::" +#~ msgstr "" +#~ "所有例外繼承自 :exc:`BaseException`\\ ,以統一處理所有其他例外,但使用上要" +#~ "極其小心,因為這種方式容易遮蔽真正的程式設計錯誤!它也可用於印出錯誤訊息," +#~ "然後重新引發例外(也讓呼叫者可以處理該例外):\n" +#~ "\n" +#~ "::" + +#~ msgid "" +#~ "Alternatively the last except clause may omit the exception name(s), " +#~ "however the exception value must then be retrieved from ``sys.exc_info()" +#~ "[1]``." +#~ msgstr "" +#~ "或者讓最後一個 except 子句可以省略例外名稱,但之後例外的值必須是從 ``sys." +#~ "exc_info()[1]`` 得到的。" + #~ msgid "" #~ "The :keyword:`raise` statement allows an optional :keyword:`from` " #~ "which enables chaining exceptions. For example::" diff --git a/tutorial/floatingpoint.po b/tutorial/floatingpoint.po index 8a8362fa0f..782d403e5d 100644 --- a/tutorial/floatingpoint.po +++ b/tutorial/floatingpoint.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-03 00:09+0000\n" -"PO-Revision-Date: 2021-12-05 21:12+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 05:40+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -21,7 +21,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0\n" +"X-Generator: Poedit 3.1.1\n" #: ../../tutorial/floatingpoint.rst:9 msgid "Floating Point Arithmetic: Issues and Limitations" @@ -30,31 +30,19 @@ msgstr "浮點數運算:問題與限制" #: ../../tutorial/floatingpoint.rst:14 msgid "" "Floating-point numbers are represented in computer hardware as base 2 " -"(binary) fractions. For example, the decimal fraction ::" +"(binary) fractions. For example, the **decimal** fraction ``0.125`` has " +"value 1/10 + 2/100 + 5/1000, and in the same way the **binary** fraction " +"``0.001`` has value 0/2 + 0/4 + 1/8. These two fractions have identical " +"values, the only real difference being that the first is written in base 10 " +"fractional notation, and the second in base 2." msgstr "" "在計算機架構中,浮點數 (floating-point number) 是以基數為 2(二進位)的小數表" -"示。例如說,在十進位小數中:\n" -"\n" -"::" - -#: ../../tutorial/floatingpoint.rst:19 -msgid "" -"has value 1/10 + 2/100 + 5/1000, and in the same way the binary fraction ::" -msgstr "" -"可被分為 1/10 + 2/100 + 5/1000,同樣的道理,二進位小數:\n" -"\n" -"::" - -#: ../../tutorial/floatingpoint.rst:23 -msgid "" -"has value 0/2 + 0/4 + 1/8. These two fractions have identical values, the " -"only real difference being that the first is written in base 10 fractional " -"notation, and the second in base 2." -msgstr "" -"可被分為 0/2 + 0/4 + 1/8。這兩個小數有相同的數值,而唯一真正的不同在於前者以" -"十進位表示,後者以二進位表示。" +"示。例如說,在\\ **十進位**\\ 小數中 ``0.125`` 可被分為 1/10 + 2/100 + " +"5/1000,同樣的道理,\\ **二進位**\\ 小數 ``0.001`` 可被分為 0/2 + 0/4 + 1/8。" +"這兩個小數有相同的數值,而唯一真正的不同在於前者以十進位表示,後者以二進位表" +"示。" -#: ../../tutorial/floatingpoint.rst:27 +#: ../../tutorial/floatingpoint.rst:21 msgid "" "Unfortunately, most decimal fractions cannot be represented exactly as " "binary fractions. A consequence is that, in general, the decimal floating-" @@ -64,7 +52,7 @@ msgstr "" "不幸的是,大多數十進位小數無法精準地以二進位小數表示。一般的結果為,你輸入的" "十進位浮點數只能由實際儲存在計算機中的二進位浮點數近似。" -#: ../../tutorial/floatingpoint.rst:32 +#: ../../tutorial/floatingpoint.rst:26 msgid "" "The problem is easier to understand at first in base 10. Consider the " "fraction 1/3. You can approximate that as a base 10 fraction::" @@ -74,14 +62,14 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:37 ../../tutorial/floatingpoint.rst:41 +#: ../../tutorial/floatingpoint.rst:31 ../../tutorial/floatingpoint.rst:35 msgid "or, better, ::" msgstr "" "或者,更好的近似:\n" "\n" "::" -#: ../../tutorial/floatingpoint.rst:45 +#: ../../tutorial/floatingpoint.rst:39 msgid "" "and so on. No matter how many digits you're willing to write down, the " "result will never be exactly 1/3, but will be an increasingly better " @@ -90,7 +78,7 @@ msgstr "" "依此類推,不論你使用多少位數表示小數,最後的結果都無法精準地表示 1/3,但你還" "是能越來越精準地表示 1/3。" -#: ../../tutorial/floatingpoint.rst:49 +#: ../../tutorial/floatingpoint.rst:43 msgid "" "In the same way, no matter how many base 2 digits you're willing to use, the " "decimal value 0.1 cannot be represented exactly as a base 2 fraction. In " @@ -101,7 +89,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:55 +#: ../../tutorial/floatingpoint.rst:49 msgid "" "Stop at any finite number of bits, and you get an approximation. On most " "machines today, floats are approximated using a binary fraction with the " @@ -115,7 +103,7 @@ msgstr "" "則是以二為底的指數。在 1/10 的例子中,二進位分數為 ``3602879701896397 / 2 ** " "55``,而這樣的表示十分地接近,但不完全等同於 1/10 的真正數值。" -#: ../../tutorial/floatingpoint.rst:62 +#: ../../tutorial/floatingpoint.rst:56 msgid "" "Many users are not aware of the approximation because of the way values are " "displayed. Python only prints a decimal approximation to the true decimal " @@ -130,7 +118,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:71 +#: ../../tutorial/floatingpoint.rst:65 msgid "" "That is more digits than most people find useful, so Python keeps the number " "of digits manageable by displaying a rounded value instead ::" @@ -140,7 +128,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:77 +#: ../../tutorial/floatingpoint.rst:71 msgid "" "Just remember, even though the printed result looks like the exact value of " "1/10, the actual stored value is the nearest representable binary fraction." @@ -148,7 +136,7 @@ msgstr "" "一定要記住,雖然印出的數字看起來是精準的 1/10,但真正儲存的數值是能表示的二進" "位分數中,最接近精準數值的數。" -#: ../../tutorial/floatingpoint.rst:80 +#: ../../tutorial/floatingpoint.rst:74 msgid "" "Interestingly, there are many different decimal numbers that share the same " "nearest approximate binary fraction. For example, the numbers ``0.1`` and " @@ -164,7 +152,7 @@ msgstr "" "``3602879701896397 / 2 ** 55`` 近似。由於這三個十進位數值共用同一個近似值,任" "何一個數值都可以被顯示,同時保持 ``eval(repr(x)) == x``。" -#: ../../tutorial/floatingpoint.rst:88 +#: ../../tutorial/floatingpoint.rst:82 msgid "" "Historically, the Python prompt and built-in :func:`repr` function would " "choose the one with 17 significant digits, ``0.10000000000000001``. " @@ -175,7 +163,7 @@ msgstr "" "有 17 個有效位元的數:``0.10000000000000001``。從 Python 3.1 版開始," "Python(在大部分的系統上)現在能選擇其中最短的數並簡單地顯示為 ``0.1``。" -#: ../../tutorial/floatingpoint.rst:93 +#: ../../tutorial/floatingpoint.rst:87 msgid "" "Note that this is in the very nature of binary floating-point: this is not a " "bug in Python, and it is not a bug in your code either. You'll see the same " @@ -188,7 +176,7 @@ msgstr "" "中(雖然有些程式語言預設不會\\ *顯示*\\ 該差異,有些甚至是在所有的輸出模式中" "都不會顯示。)" -#: ../../tutorial/floatingpoint.rst:99 +#: ../../tutorial/floatingpoint.rst:93 msgid "" "For more pleasant output, you may wish to use string formatting to produce a " "limited number of significant digits::" @@ -198,7 +186,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:111 +#: ../../tutorial/floatingpoint.rst:105 msgid "" "It's important to realize that this is, in a real sense, an illusion: you're " "simply rounding the *display* of the true machine value." @@ -206,7 +194,7 @@ msgstr "" "要了解一件很重要的事,在真正意義上,浮點數的表示是一種幻覺:你基本上在捨入真" "正機器數值所\\ *展示的值*\\ 。" -#: ../../tutorial/floatingpoint.rst:114 +#: ../../tutorial/floatingpoint.rst:108 msgid "" "One illusion may beget another. For example, since 0.1 is not exactly 1/10, " "summing three values of 0.1 may not yield exactly 0.3, either::" @@ -216,7 +204,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:120 +#: ../../tutorial/floatingpoint.rst:114 msgid "" "Also, since the 0.1 cannot get any closer to the exact value of 1/10 and 0.3 " "cannot get any closer to the exact value of 3/10, then pre-rounding with :" @@ -227,7 +215,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:127 +#: ../../tutorial/floatingpoint.rst:121 msgid "" "Though the numbers cannot be made closer to their intended exact values, " "the :func:`round` function can be useful for post-rounding so that results " @@ -238,7 +226,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:134 +#: ../../tutorial/floatingpoint.rst:128 msgid "" "Binary floating-point arithmetic holds many surprises like this. The " "problem with \"0.1\" is explained in precise detail below, in the " @@ -250,7 +238,7 @@ msgstr "" "「0.1」的問題。如果想要其他常見驚喜的更完整描述,可以參考 `The Perils of " "Floating Point(浮點數的風險) `_。" -#: ../../tutorial/floatingpoint.rst:139 +#: ../../tutorial/floatingpoint.rst:133 msgid "" "As that says near the end, \"there are no easy answers.\" Still, don't be " "unduly wary of floating-point! The errors in Python float operations are " @@ -266,7 +254,7 @@ msgstr "" "經相當足夠,但你需要記住,它並非十進位運算,且每一次 float 運算都可能會承受新" "的捨入誤差。" -#: ../../tutorial/floatingpoint.rst:146 +#: ../../tutorial/floatingpoint.rst:140 msgid "" "While pathological cases do exist, for most casual use of floating-point " "arithmetic you'll see the result you expect in the end if you simply round " @@ -279,7 +267,7 @@ msgstr "" "能滿足要求,而若想要更細緻的控制,可參閱\\ :ref:`formatstrings`\\ 中關於 :" "meth:`str.format` method(方法)的格式規範。" -#: ../../tutorial/floatingpoint.rst:152 +#: ../../tutorial/floatingpoint.rst:146 msgid "" "For use cases which require exact decimal representation, try using the :mod:" "`decimal` module which implements decimal arithmetic suitable for accounting " @@ -288,7 +276,7 @@ msgstr "" "對於需要精準十進位表示法的用例,可以試著用 :mod:`decimal` 模組,它可實作適用" "於會計應用程式與高精確度應用程式的十進位運算。" -#: ../../tutorial/floatingpoint.rst:156 +#: ../../tutorial/floatingpoint.rst:150 msgid "" "Another form of exact arithmetic is supported by the :mod:`fractions` module " "which implements arithmetic based on rational numbers (so the numbers like " @@ -297,7 +285,7 @@ msgstr "" "另一種支援精準運算的格式為 :mod:`fractions` 模組,該模組基於有理數來實作運算" "(因此可以精確表示像 1/3 這樣的數字)。" -#: ../../tutorial/floatingpoint.rst:160 +#: ../../tutorial/floatingpoint.rst:154 msgid "" "If you are a heavy user of floating point operations you should take a look " "at the NumPy package and many other packages for mathematical and " @@ -307,7 +295,7 @@ msgstr "" "如果你是浮點運算的重度使用者,你應該看一下 NumPy 套件,以及由 SciPy 專案提供" "的許多用於數學和統計學運算的其他套件。請參閱 。" -#: ../../tutorial/floatingpoint.rst:164 +#: ../../tutorial/floatingpoint.rst:158 msgid "" "Python provides tools that may help on those rare occasions when you really " "*do* want to know the exact value of a float. The :meth:`float." @@ -319,7 +307,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:173 +#: ../../tutorial/floatingpoint.rst:167 msgid "" "Since the ratio is exact, it can be used to losslessly recreate the original " "value::" @@ -328,7 +316,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:179 +#: ../../tutorial/floatingpoint.rst:173 msgid "" "The :meth:`float.hex` method expresses a float in hexadecimal (base 16), " "again giving the exact value stored by your computer::" @@ -338,7 +326,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:185 +#: ../../tutorial/floatingpoint.rst:179 msgid "" "This precise hexadecimal representation can be used to reconstruct the float " "value exactly::" @@ -347,7 +335,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:191 +#: ../../tutorial/floatingpoint.rst:185 msgid "" "Since the representation is exact, it is useful for reliably porting values " "across different versions of Python (platform independence) and exchanging " @@ -357,7 +345,7 @@ msgstr "" "由於該表示法是精準的,因此適用於在不同版本的 Python 之間可靠地傳送數值(獨立" "於系統平台),並與支援相同格式的其他語言(如 JAVA 和 C99)交換資料。" -#: ../../tutorial/floatingpoint.rst:195 +#: ../../tutorial/floatingpoint.rst:189 msgid "" "Another helpful tool is the :func:`math.fsum` function which helps mitigate " "loss-of-precision during summation. It tracks \"lost digits\" as values are " @@ -370,11 +358,11 @@ msgstr "" "以明顯改善總體準確度 (overall accuracy),使得誤差不至於累積到影響最終總計值的" "程度:" -#: ../../tutorial/floatingpoint.rst:209 +#: ../../tutorial/floatingpoint.rst:203 msgid "Representation Error" msgstr "表示法誤差 (Representation Error)" -#: ../../tutorial/floatingpoint.rst:211 +#: ../../tutorial/floatingpoint.rst:205 msgid "" "This section explains the \"0.1\" example in detail, and shows how you can " "perform an exact analysis of cases like this yourself. Basic familiarity " @@ -383,7 +371,7 @@ msgstr "" "本節將會詳細解釋「0.1」的例子,並說明你自己要如何對類似案例執行精準的分析。 " "以下假設你對二進位浮點表示法已有基本程度的熟悉。" -#: ../../tutorial/floatingpoint.rst:215 +#: ../../tutorial/floatingpoint.rst:209 msgid "" ":dfn:`Representation error` refers to the fact that some (most, actually) " "decimal fractions cannot be represented exactly as binary (base 2) " @@ -396,7 +384,7 @@ msgstr "" "Perl、C、C++、JAVA、Fortran 和其他許多)通常不會顯示你期望的精準十進位數字的" "主要原因。" -#: ../../tutorial/floatingpoint.rst:220 +#: ../../tutorial/floatingpoint.rst:214 msgid "" "Why is that? 1/10 is not exactly representable as a binary fraction. Almost " "all machines today (November 2000) use IEEE-754 floating point arithmetic, " @@ -414,14 +402,14 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:229 +#: ../../tutorial/floatingpoint.rst:223 msgid "as ::" msgstr "" "重寫為:\n" "\n" "::" -#: ../../tutorial/floatingpoint.rst:233 +#: ../../tutorial/floatingpoint.rst:227 msgid "" "and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< " "2**53``), the best value for *N* is 56::" @@ -431,7 +419,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:239 +#: ../../tutorial/floatingpoint.rst:233 msgid "" "That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. " "The best possible value for *J* is then that quotient rounded::" @@ -441,7 +429,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:246 +#: ../../tutorial/floatingpoint.rst:240 msgid "" "Since the remainder is more than half of 10, the best approximation is " "obtained by rounding up::" @@ -450,7 +438,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:252 +#: ../../tutorial/floatingpoint.rst:246 msgid "" "Therefore the best possible approximation to 1/10 in 754 double precision " "is::" @@ -459,7 +447,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:256 +#: ../../tutorial/floatingpoint.rst:250 msgid "" "Dividing both the numerator and denominator by two reduces the fraction to::" msgstr "" @@ -467,7 +455,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:260 +#: ../../tutorial/floatingpoint.rst:254 msgid "" "Note that since we rounded up, this is actually a little bit larger than " "1/10; if we had not rounded up, the quotient would have been a little bit " @@ -476,7 +464,7 @@ msgstr "" "請注意,由於我們有進位,所以這實際上比 1/10 大了一點;如果我們沒有進位,商數" "將會有點小於 1/10。但在任何情況下都不可能是\\ *精準的* 1/10!" -#: ../../tutorial/floatingpoint.rst:264 +#: ../../tutorial/floatingpoint.rst:258 msgid "" "So the computer never \"sees\" 1/10: what it sees is the exact fraction " "given above, the best 754 double approximation it can get::" @@ -486,7 +474,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:270 +#: ../../tutorial/floatingpoint.rst:264 msgid "" "If we multiply that fraction by 10\\*\\*55, we can see the value out to 55 " "decimal digits::" @@ -495,7 +483,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:276 +#: ../../tutorial/floatingpoint.rst:270 msgid "" "meaning that the exact number stored in the computer is equal to the decimal " "value 0.1000000000000000055511151231257827021181583404541015625. Instead of " @@ -508,7 +496,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/floatingpoint.rst:284 +#: ../../tutorial/floatingpoint.rst:278 msgid "" "The :mod:`fractions` and :mod:`decimal` modules make these calculations " "easy::" @@ -516,3 +504,20 @@ msgstr "" ":mod:`fractions` 與 :mod:`decimal` 模組能使這些計算變得容易:\n" "\n" "::" + +#~ msgid "" +#~ "Floating-point numbers are represented in computer hardware as base 2 " +#~ "(binary) fractions. For example, the decimal fraction ::" +#~ msgstr "" +#~ "在計算機架構中,浮點數 (floating-point number) 是以基數為 2(二進位)的小" +#~ "數表示。例如說,在十進位小數中:\n" +#~ "\n" +#~ "::" + +#~ msgid "" +#~ "has value 1/10 + 2/100 + 5/1000, and in the same way the binary " +#~ "fraction ::" +#~ msgstr "" +#~ "可被分為 1/10 + 2/100 + 5/1000,同樣的道理,二進位小數:\n" +#~ "\n" +#~ "::" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 9df0a8a31e..6b8f1551e8 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-13 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2021-05-18 16:28+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,11 +31,11 @@ msgstr "啟動直譯器" #: ../../tutorial/interpreter.rst:13 msgid "" "The Python interpreter is usually installed as :file:`/usr/local/bin/" -"python3.10` on those machines where it is available; putting :file:`/usr/" +"python3.11` on those machines where it is available; putting :file:`/usr/" "local/bin` in your Unix shell's search path makes it possible to start it by " "typing the command:" msgstr "" -"Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.10` 路徑下;將 :file:`/" +"Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.11` 路徑下;將 :file:`/" "usr/local/bin` 加入Unix shell 的搜索路徑,輸入以下指令就可以啟動 Python:" #: ../../tutorial/interpreter.rst:21 @@ -52,13 +52,13 @@ msgstr "" #: ../../tutorial/interpreter.rst:26 msgid "" "On Windows machines where you have installed Python from the :ref:`Microsoft " -"Store `, the :file:`python3.10` command will be available. If " +"Store `, the :file:`python3.11` command will be available. If " "you have the :ref:`py.exe launcher ` installed, you can use the :" "file:`py` command. See :ref:`setting-envvars` for other ways to launch " "Python." msgstr "" "Windows 系統中,從 :ref:`Microsoft Store ` 安裝 Python 後,就" -"可以使用 :file:`python3.10` 命令了。如果安裝了 :ref:`py.exe launcher " +"可以使用 :file:`python3.11` 命令了。如果安裝了 :ref:`py.exe launcher " "` ,則可以使用 :file:`py` 命令。請參閱附錄:\\ :ref:`setting-" "envvars`\\ ,了解其他啟動 Python 的方式。" diff --git a/tutorial/modules.po b/tutorial/modules.po index 730eebfb96..e56943a8bb 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-29 00:14+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-07-07 00:38+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -313,7 +313,11 @@ msgstr "" "與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是由 :mod:" "`site` 模組所處理)。" -#: ../../tutorial/modules.rst:200 +#: ../../tutorial/modules.rst:199 +msgid "More details are at :ref:`sys-path-init`." +msgstr "" + +#: ../../tutorial/modules.rst:202 msgid "" "On file systems which support symlinks, the directory containing the input " "script is calculated after the symlink is followed. In other words the " @@ -323,7 +327,7 @@ msgstr "" "後才被計算的。換言之,包含符號連結的資料夾\\ **並沒有**\\ 增加到模組的搜尋路" "徑中。" -#: ../../tutorial/modules.rst:204 +#: ../../tutorial/modules.rst:206 msgid "" "After initialization, Python programs can modify :data:`sys.path`. The " "directory containing the script being run is placed at the beginning of the " @@ -337,11 +341,11 @@ msgstr "" "而不是函式庫資料夾中相同名稱的模組。除非是有意要做這樣的替換,否則這是一個錯" "誤。 請參見\\ :ref:`tut-standardmodules`\\ 以瞭解更多資訊。" -#: ../../tutorial/modules.rst:215 +#: ../../tutorial/modules.rst:219 msgid "\"Compiled\" Python files" msgstr "「編譯」Python 檔案" -#: ../../tutorial/modules.rst:217 +#: ../../tutorial/modules.rst:221 msgid "" "To speed up loading modules, Python caches the compiled version of each " "module in the ``__pycache__`` directory under the name :file:`module." @@ -357,7 +361,7 @@ msgstr "" "spam.py 的編譯版本將被暫存為 ``__pycache__/spam.cpython-33.pyc``\\ 。此命名準" "則可以讓來自不同版本的編譯模組和 Python 的不同版本同時共存。" -#: ../../tutorial/modules.rst:225 +#: ../../tutorial/modules.rst:229 msgid "" "Python checks the modification date of the source against the compiled " "version to see if it's out of date and needs to be recompiled. This is a " @@ -369,7 +373,7 @@ msgstr "" "完全自動的過程。另外,編譯後的模組獨立於平台,因此不同架構的作業系統之間可以" "共用同一函式庫。" -#: ../../tutorial/modules.rst:230 +#: ../../tutorial/modules.rst:234 msgid "" "Python does not check the cache in two circumstances. First, it always " "recompiles and does not store the result for the module that's loaded " @@ -382,11 +386,11 @@ msgstr "" "列載入的模組的結果。第二,如果沒有源模組,則不會檢查快取。要支援非源模組(僅" "編譯)的發布,編譯後的模組必須位於原始資料夾中,並且不能有源模組。" -#: ../../tutorial/modules.rst:237 +#: ../../tutorial/modules.rst:241 msgid "Some tips for experts:" msgstr "一些給專家的秘訣:" -#: ../../tutorial/modules.rst:239 +#: ../../tutorial/modules.rst:243 msgid "" "You can use the :option:`-O` or :option:`-OO` switches on the Python command " "to reduce the size of a compiled module. The ``-O`` switch removes assert " @@ -402,7 +406,7 @@ msgstr "" "只有在您知道自己在做什麼時,才應使用此參數。「已優化」模組有 ``opt-`` 標記," "且通常較小。未來的版本可能會改變優化的效果。" -#: ../../tutorial/modules.rst:247 +#: ../../tutorial/modules.rst:251 msgid "" "A program doesn't run any faster when it is read from a ``.pyc`` file than " "when it is read from a ``.py`` file; the only thing that's faster about ``." @@ -411,23 +415,23 @@ msgstr "" "讀取 ``.pyc`` 檔案時,程式的執行速度並不會比讀取 ``.py`` 檔案快。唯一比較快的" "地方是載入的速度。" -#: ../../tutorial/modules.rst:251 +#: ../../tutorial/modules.rst:255 msgid "" "The module :mod:`compileall` can create .pyc files for all modules in a " "directory." msgstr "模組 :mod:`compileall` 可以為資料夾中的所有模組創建 .pyc 檔。" -#: ../../tutorial/modules.rst:254 +#: ../../tutorial/modules.rst:258 msgid "" "There is more detail on this process, including a flow chart of the " "decisions, in :pep:`3147`." msgstr "更多的細節,包括決策流程圖,請參考\\ :pep:`3147`\\ 。" -#: ../../tutorial/modules.rst:261 +#: ../../tutorial/modules.rst:265 msgid "Standard Modules" msgstr "標準模組" -#: ../../tutorial/modules.rst:265 +#: ../../tutorial/modules.rst:269 msgid "" "Python comes with a library of standard modules, described in a separate " "document, the Python Library Reference (\"Library Reference\" hereafter). " @@ -451,13 +455,13 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:288 +#: ../../tutorial/modules.rst:292 msgid "" "These two variables are only defined if the interpreter is in interactive " "mode." msgstr "只有直譯器在互動模式時,才需要定義這兩個變數。" -#: ../../tutorial/modules.rst:290 +#: ../../tutorial/modules.rst:294 msgid "" "The variable ``sys.path`` is a list of strings that determines the " "interpreter's search path for modules. It is initialized to a default path " @@ -471,11 +475,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:303 +#: ../../tutorial/modules.rst:307 msgid "The :func:`dir` Function" msgstr ":func:`dir` 函式" -#: ../../tutorial/modules.rst:305 +#: ../../tutorial/modules.rst:309 msgid "" "The built-in function :func:`dir` is used to find out which names a module " "defines. It returns a sorted list of strings::" @@ -485,7 +489,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:334 +#: ../../tutorial/modules.rst:338 msgid "" "Without arguments, :func:`dir` lists the names you have defined currently::" msgstr "" @@ -493,12 +497,12 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:342 +#: ../../tutorial/modules.rst:346 msgid "" "Note that it lists all types of names: variables, modules, functions, etc." msgstr "請注意,它列出所有類型的名稱:變數、模組、函式等。" -#: ../../tutorial/modules.rst:346 +#: ../../tutorial/modules.rst:350 msgid "" ":func:`dir` does not list the names of built-in functions and variables. If " "you want a list of those, they are defined in the standard module :mod:" @@ -509,11 +513,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:385 +#: ../../tutorial/modules.rst:389 msgid "Packages" msgstr "套件 (Package)" -#: ../../tutorial/modules.rst:387 +#: ../../tutorial/modules.rst:391 msgid "" "Packages are a way of structuring Python's module namespace by using " "\"dotted module names\". For example, the module name :mod:`A.B` designates " @@ -528,7 +532,7 @@ msgstr "" "的作者不需擔心與其他模組的全域變數名稱重複,點分隔模組名稱的使用,也讓多模組" "套件(像 NumPy 或 Pillow)的作者們不須擔心其他套件的模組名稱。" -#: ../../tutorial/modules.rst:395 +#: ../../tutorial/modules.rst:399 msgid "" "Suppose you want to design a collection of modules (a \"package\") for the " "uniform handling of sound files and sound data. There are many different " @@ -550,13 +554,13 @@ msgstr "" "一系列無止盡的模組來執行這些作業。以下是你的套件可能的架構(以階層式檔案系統" "的方式表示):" -#: ../../tutorial/modules.rst:432 +#: ../../tutorial/modules.rst:436 msgid "" "When importing the package, Python searches through the directories on ``sys." "path`` looking for the package subdirectory." msgstr "Import 套件時,Python 會搜尋 ``sys.path`` 裡的目錄,尋找套件的子目錄。" -#: ../../tutorial/modules.rst:435 +#: ../../tutorial/modules.rst:439 msgid "" "The :file:`__init__.py` files are required to make Python treat directories " "containing the file as packages. This prevents directories with a common " @@ -570,7 +574,7 @@ msgstr "" "尋路徑中的有效模組。在最簡單的情況,\\ :file:`__init__.py` 可以只是一個空白檔" "案;但它也可以執行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" -#: ../../tutorial/modules.rst:442 +#: ../../tutorial/modules.rst:446 msgid "" "Users of the package can import individual modules from the package, for " "example::" @@ -579,7 +583,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:447 +#: ../../tutorial/modules.rst:451 msgid "" "This loads the submodule :mod:`sound.effects.echo`. It must be referenced " "with its full name. ::" @@ -588,14 +592,14 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:452 +#: ../../tutorial/modules.rst:456 msgid "An alternative way of importing the submodule is::" msgstr "" "另一種 import 子模組的方法是:\n" "\n" "::" -#: ../../tutorial/modules.rst:456 +#: ../../tutorial/modules.rst:460 msgid "" "This also loads the submodule :mod:`echo`, and makes it available without " "its package prefix, so it can be used as follows::" @@ -605,7 +609,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:461 +#: ../../tutorial/modules.rst:465 msgid "" "Yet another variation is to import the desired function or variable " "directly::" @@ -614,7 +618,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:465 +#: ../../tutorial/modules.rst:469 msgid "" "Again, this loads the submodule :mod:`echo`, but this makes its function :" "func:`echofilter` directly available::" @@ -624,7 +628,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:470 +#: ../../tutorial/modules.rst:474 msgid "" "Note that when using ``from package import item``, the item can be either a " "submodule (or subpackage) of the package, or some other name defined in the " @@ -638,7 +642,7 @@ msgstr "" "陳述式首先測試套件中有沒有定義該 item;如果沒有,則會假設它是模組,並嘗試載" "入。如果還是找不到 item,則會引發 :exc:`ImportError` 例外。" -#: ../../tutorial/modules.rst:477 +#: ../../tutorial/modules.rst:481 msgid "" "Contrarily, when using syntax like ``import item.subitem.subsubitem``, each " "item except for the last must be a package; the last item can be a module or " @@ -649,11 +653,11 @@ msgstr "" "一項都必須是套件;最後一項可以是模組或套件,但不能是前一項中定義的 class、函" "式或變數。" -#: ../../tutorial/modules.rst:486 +#: ../../tutorial/modules.rst:490 msgid "Importing \\* From a Package" msgstr "從套件中 import \\*" -#: ../../tutorial/modules.rst:490 +#: ../../tutorial/modules.rst:494 msgid "" "Now what happens when the user writes ``from sound.effects import *``? " "Ideally, one would hope that this somehow goes out to the filesystem, finds " @@ -666,7 +670,7 @@ msgstr "" "會花費較長的時間,且 import 子模組的過程可能會有不必要的副作用,這些副作用只" "有在明確地 import 子模組時才會發生。" -#: ../../tutorial/modules.rst:496 +#: ../../tutorial/modules.rst:500 msgid "" "The only solution is for the package author to provide an explicit index of " "the package. The :keyword:`import` statement uses the following convention: " @@ -687,7 +691,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:508 +#: ../../tutorial/modules.rst:512 msgid "" "This would mean that ``from sound.effects import *`` would import the three " "named submodules of the :mod:`sound.effects` package." @@ -695,7 +699,7 @@ msgstr "" "意思是,\\ ``from sound.effects import *`` 將會 import :mod:`sound.effects` " "套件中,這三個被提名的子模組。" -#: ../../tutorial/modules.rst:511 +#: ../../tutorial/modules.rst:515 msgid "" "If ``__all__`` is not defined, the statement ``from sound.effects import *`` " "does *not* import all submodules from the package :mod:`sound.effects` into " @@ -716,7 +720,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:524 +#: ../../tutorial/modules.rst:528 msgid "" "In this example, the :mod:`echo` and :mod:`surround` modules are imported in " "the current namespace because they are defined in the :mod:`sound.effects` " @@ -727,7 +731,7 @@ msgstr "" "`surround` 模組被 import 進當前的命名空間,因為它們是在 :mod:`sound.effects` " "套件裡定義的。(當 ``__all__`` 有被定義時,這規則也有效。)" -#: ../../tutorial/modules.rst:529 +#: ../../tutorial/modules.rst:533 msgid "" "Although certain modules are designed to export only names that follow " "certain patterns when you use ``import *``, it is still considered bad " @@ -736,7 +740,7 @@ msgstr "" "雖然,有些特定模組的設計,讓你使用 ``import *`` 時,該模組只會輸出遵循特定樣" "式的名稱,但在正式環境 (production) 的程式碼中這仍然被視為是不良習慣。" -#: ../../tutorial/modules.rst:533 +#: ../../tutorial/modules.rst:537 msgid "" "Remember, there is nothing wrong with using ``from package import " "specific_submodule``! In fact, this is the recommended notation unless the " @@ -746,11 +750,11 @@ msgstr "" "記住,使用 ``from package import specific_submodule`` 不會有任何問題!實際" "上,這是推薦用法,除非 import 的模組需要用到的子模組和其他套件的子模組同名。" -#: ../../tutorial/modules.rst:542 +#: ../../tutorial/modules.rst:546 msgid "Intra-package References" msgstr "套件內引用" -#: ../../tutorial/modules.rst:544 +#: ../../tutorial/modules.rst:548 msgid "" "When packages are structured into subpackages (as with the :mod:`sound` " "package in the example), you can use absolute imports to refer to submodules " @@ -763,7 +767,7 @@ msgstr "" "filters.vocoder` 模組中使用 :mod:`sound.effects` 中的 :mod:`echo` 模組時,可" "以用 ``from sound.effects import echo``\\ 。" -#: ../../tutorial/modules.rst:550 +#: ../../tutorial/modules.rst:554 msgid "" "You can also write relative imports, with the ``from module import name`` " "form of import statement. These imports use leading dots to indicate the " @@ -776,7 +780,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/modules.rst:559 +#: ../../tutorial/modules.rst:563 msgid "" "Note that relative imports are based on the name of the current module. " "Since the name of the main module is always ``\"__main__\"``, modules " @@ -787,11 +791,11 @@ msgstr "" "\"__main__\"``\\ ,所以如果一個模組預期被用作 Python 應用程式的主模組,那它必" "須永遠使用絕對 import。" -#: ../../tutorial/modules.rst:565 +#: ../../tutorial/modules.rst:569 msgid "Packages in Multiple Directories" msgstr "多目錄中的套件" -#: ../../tutorial/modules.rst:567 +#: ../../tutorial/modules.rst:571 msgid "" "Packages support one more special attribute, :attr:`__path__`. This is " "initialized to be a list containing the name of the directory holding the " @@ -804,17 +808,17 @@ msgstr "" "執行之前。這個變數可以被修改,但這樣做會影響將來對套件內的模組和子套件的搜" "尋。" -#: ../../tutorial/modules.rst:573 +#: ../../tutorial/modules.rst:577 msgid "" "While this feature is not often needed, it can be used to extend the set of " "modules found in a package." msgstr "雖然這個特色不太常被需要,但它可用於擴充套件中的模組集合。" -#: ../../tutorial/modules.rst:578 +#: ../../tutorial/modules.rst:582 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/modules.rst:579 +#: ../../tutorial/modules.rst:583 msgid "" "In fact function definitions are also 'statements' that are 'executed'; the " "execution of a module-level function definition adds the function name to " diff --git a/tutorial/venv.po b/tutorial/venv.po index d05fab48b7..1fcd3b296f 100644 --- a/tutorial/venv.po +++ b/tutorial/venv.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" -"PO-Revision-Date: 2021-06-27 20:20+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 05:35+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 2.4.3\n" +"X-Generator: Poedit 3.1.1\n" #: ../../tutorial/venv.rst:6 msgid "Virtual Environments and Packages" @@ -160,11 +160,22 @@ msgstr "" "啟動虛擬環境會改變你的 shell 提示字元來顯示你正在使用的虛擬環境,並且修改環境" "以讓你在執行 ``python`` 的時候可以得到特定的 Python 版本,例如:" -#: ../../tutorial/venv.rst:93 +#: ../../tutorial/venv.rst:91 +msgid "To deactivate a virtual environment, type::" +msgstr "" +"要停用虛擬環境,輸入:\n" +"\n" +"::" + +#: ../../tutorial/venv.rst:95 +msgid "into the terminal." +msgstr "於終端機中。" + +#: ../../tutorial/venv.rst:98 msgid "Managing Packages with pip" msgstr "用 pip 管理套件" -#: ../../tutorial/venv.rst:95 +#: ../../tutorial/venv.rst:100 msgid "" "You can install, upgrade, and remove packages using a program called :" "program:`pip`. By default ``pip`` will install packages from the Python " @@ -175,7 +186,7 @@ msgstr "" "會從 Python Package Index 安裝套件。你可以透過你的網頁瀏覽" "器瀏覽 Python Package Index。" -#: ../../tutorial/venv.rst:100 +#: ../../tutorial/venv.rst:105 msgid "" "``pip`` has a number of subcommands: \"install\", \"uninstall\", \"freeze\", " "etc. (Consult the :ref:`installing-index` guide for complete documentation " @@ -184,56 +195,60 @@ msgstr "" "``pip`` 有好幾個子指令:\"install\"、\"uninstall\"、\"freeze\" 等等。(可以參" "考\\ :ref:`installing-index`\\ 指南,來取得 ``pip`` 的完整說明文件。)" -#: ../../tutorial/venv.rst:104 +#: ../../tutorial/venv.rst:109 msgid "" "You can install the latest version of a package by specifying a package's " "name:" msgstr "你可以透過指定套件名字來安裝最新版本的套件:" -#: ../../tutorial/venv.rst:115 +#: ../../tutorial/venv.rst:120 msgid "" "You can also install a specific version of a package by giving the package " "name followed by ``==`` and the version number:" msgstr "你也可以透過在套件名稱之後接上 ``==`` 和版號來指定特定版本:" -#: ../../tutorial/venv.rst:126 +#: ../../tutorial/venv.rst:131 msgid "" "If you re-run this command, ``pip`` will notice that the requested version " "is already installed and do nothing. You can supply a different version " -"number to get that version, or you can run ``pip install --upgrade`` to " -"upgrade the package to the latest version:" +"number to get that version, or you can run ``python -m pip install --" +"upgrade`` to upgrade the package to the latest version:" msgstr "" "要是你重新執行此指令,``pip`` 會知道該版本已經安裝過,然後什麼也不做。你可以" -"提供不同的版本號碼來取得該版本,或是可以執行 ``pip install --upgrade`` 來把套" -"件升級到最新的版本:" +"提供不同的版本號碼來取得該版本,或是可以執行 ``python -m pip install --" +"upgrade`` 來把套件升級到最新的版本:" -#: ../../tutorial/venv.rst:141 +#: ../../tutorial/venv.rst:146 msgid "" -"``pip uninstall`` followed by one or more package names will remove the " -"packages from the virtual environment." -msgstr "``pip uninstall`` 後面接一個或是多個套件名稱可以從虛擬環境中移除套件。" +"``python -m pip uninstall`` followed by one or more package names will " +"remove the packages from the virtual environment." +msgstr "" +"``python -m pip uninstall`` 後面接一個或是多個套件名稱可以從虛擬環境中移除套" +"件。" -#: ../../tutorial/venv.rst:144 -msgid "``pip show`` will display information about a particular package:" -msgstr "``pip show`` 可以顯示一個特定套件的資訊:" +#: ../../tutorial/venv.rst:149 +msgid "" +"``python -m pip show`` will display information about a particular package:" +msgstr "``python -m pip show`` 可以顯示一個特定套件的資訊:" -#: ../../tutorial/venv.rst:161 +#: ../../tutorial/venv.rst:166 msgid "" -"``pip list`` will display all of the packages installed in the virtual " -"environment:" -msgstr "``pip list`` 會顯示虛擬環境中所有已經安裝的套件:" +"``python -m pip list`` will display all of the packages installed in the " +"virtual environment:" +msgstr "``python -m pip list`` 會顯示虛擬環境中所有已經安裝的套件:" -#: ../../tutorial/venv.rst:173 +#: ../../tutorial/venv.rst:178 msgid "" -"``pip freeze`` will produce a similar list of the installed packages, but " -"the output uses the format that ``pip install`` expects. A common convention " -"is to put this list in a ``requirements.txt`` file:" +"``python -m pip freeze`` will produce a similar list of the installed " +"packages, but the output uses the format that ``python -m pip install`` " +"expects. A common convention is to put this list in a ``requirements.txt`` " +"file:" msgstr "" -"``pip freeze`` 可以複製一整個已經安裝的套件清單,但是輸出使用 ``pip " -"install`` 可以讀懂的格式。一個常見的慣例是放這整個清單到一個叫做 " -"``requirements.txt`` 的檔案:" +"``python -m pip freeze`` 可以複製一整個已經安裝的套件清單,但是輸出使用 " +"``python -m pip install`` 可以讀懂的格式。一個常見的慣例是放這整個清單到一個" +"叫做 ``requirements.txt`` 的檔案:" -#: ../../tutorial/venv.rst:185 +#: ../../tutorial/venv.rst:190 msgid "" "The ``requirements.txt`` can then be committed to version control and " "shipped as part of an application. Users can then install all the necessary " @@ -242,7 +257,7 @@ msgstr "" "``requirements.txt`` 可以提交到版本控制,並且作為釋出應用程式的一部分。使用者" "可以透過 ``install -r`` 安裝對應的的套件:" -#: ../../tutorial/venv.rst:202 +#: ../../tutorial/venv.rst:207 msgid "" "``pip`` has many more options. Consult the :ref:`installing-index` guide " "for complete documentation for ``pip``. When you've written a package and " diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index b1cd6e1785..f46cc853e0 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-24 00:17+0000\n" -"PO-Revision-Date: 2021-07-05 21:37+0800\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: 2022-10-16 05:37+0800\n" "Last-Translator: meowmeowcat \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -19,7 +19,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 2.4.3\n" +"X-Generator: Poedit 3.1.1\n" #: ../../tutorial/whatnow.rst:5 msgid "What Now?" @@ -50,15 +50,14 @@ msgid "" "reference material about types, functions, and the modules in the standard " "library. The standard Python distribution includes a *lot* of additional " "code. There are modules to read Unix mailboxes, retrieve documents via HTTP, " -"generate random numbers, parse command-line options, write CGI programs, " -"compress data, and many other tasks. Skimming through the Library Reference " -"will give you an idea of what's available." +"generate random numbers, parse command-line options, compress data, and many " +"other tasks. Skimming through the Library Reference will give you an idea of " +"what's available." msgstr "" "你該好好的瀏覽這份手冊,它提供了完整(但簡潔)的參考素材像是型別、函式與標準" "函式庫裡的模組。標準的 Python 發行版本會包含\\ *大量*\\ 的附加程式碼。有些模" -"組可以讀取 Unix 信箱、通過 HTTP 來檢索文件、產生亂數、分析命令列選項、編寫 " -"CGI 程式、壓縮資料、及許多其他任務。瀏覽函式庫參考手冊可以讓你了解有哪些模組" -"可以用。" +"組可以讀取 Unix 信箱、通過 HTTP 來檢索文件、產生亂數、分析命令列選項、壓縮資" +"料、及許多其他任務。瀏覽函式庫參考手冊可以讓你了解有哪些模組可以用。" #: ../../tutorial/whatnow.rst:24 msgid "" @@ -120,8 +119,7 @@ msgid "" "https://pyvideo.org collects links to Python-related videos from conferences " "and user-group meetings." msgstr "" -"https://pyvideo.org 從研討會與使用者群組聚會裡收集與 Python 相關的影片連" -"結。" +"https://pyvideo.org 從研討會與使用者群組聚會裡收集與 Python 相關的影片連結。" #: ../../tutorial/whatnow.rst:51 msgid "" diff --git a/using/cmdline.po b/using/cmdline.po index 9772fb2416..f7d9bedc90 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-03 00:15+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -285,48 +285,64 @@ msgstr ":ref:`tut-invoking`" msgid "Automatic enabling of tab-completion and history editing." msgstr "" -#: ../../using/cmdline.rst:187 +#: ../../using/cmdline.rst:189 msgid "Generic options" msgstr "" -#: ../../using/cmdline.rst:193 -msgid "Print a short description of all command line options." +#: ../../using/cmdline.rst:195 +msgid "" +"Print a short description of all command line options and corresponding " +"environment variables and exit." +msgstr "" + +#: ../../using/cmdline.rst:200 +msgid "" +"Print a short description of Python-specific environment variables and exit." +msgstr "" + +#: ../../using/cmdline.rst:207 +msgid "" +"Print a description of implementation-specific :option:`-X` options and exit." +msgstr "" + +#: ../../using/cmdline.rst:214 +msgid "Print complete usage information and exit." msgstr "" -#: ../../using/cmdline.rst:199 +#: ../../using/cmdline.rst:221 msgid "Print the Python version number and exit. Example output could be:" msgstr "" -#: ../../using/cmdline.rst:205 +#: ../../using/cmdline.rst:227 msgid "When given twice, print more information about the build, like:" msgstr "" -#: ../../using/cmdline.rst:212 +#: ../../using/cmdline.rst:234 msgid "The ``-VV`` option." msgstr "" -#: ../../using/cmdline.rst:218 +#: ../../using/cmdline.rst:241 msgid "Miscellaneous options" msgstr "" -#: ../../using/cmdline.rst:222 +#: ../../using/cmdline.rst:245 msgid "" "Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" "class:`str` or :class:`bytes` with :class:`int`. Issue an error when the " "option is given twice (:option:`!-bb`)." msgstr "" -#: ../../using/cmdline.rst:226 +#: ../../using/cmdline.rst:249 msgid "Affects comparisons of :class:`bytes` with :class:`int`." msgstr "" -#: ../../using/cmdline.rst:231 +#: ../../using/cmdline.rst:254 msgid "" "If given, Python won't try to write ``.pyc`` files on the import of source " "modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`." msgstr "" -#: ../../using/cmdline.rst:237 +#: ../../using/cmdline.rst:260 msgid "" "Control the validation behavior of hash-based ``.pyc`` files. See :ref:`pyc-" "invalidation`. When set to ``default``, checked and unchecked hash-based " @@ -337,25 +353,29 @@ msgid "" "corresponding source files." msgstr "" -#: ../../using/cmdline.rst:245 +#: ../../using/cmdline.rst:268 msgid "" "The semantics of timestamp-based ``.pyc`` files are unaffected by this " "option." msgstr "" -#: ../../using/cmdline.rst:251 +#: ../../using/cmdline.rst:274 msgid "" "Turn on parser debugging output (for expert only, depending on compilation " "options). See also :envvar:`PYTHONDEBUG`." msgstr "" -#: ../../using/cmdline.rst:257 +#: ../../using/cmdline.rst:280 msgid "" "Ignore all :envvar:`PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" -#: ../../using/cmdline.rst:263 +#: ../../using/cmdline.rst:283 +msgid "See also the :option:`-P` and :option:`-I` (isolated) options." +msgstr "" + +#: ../../using/cmdline.rst:288 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " @@ -363,22 +383,27 @@ msgid "" "`PYTHONSTARTUP` file is not read." msgstr "" -#: ../../using/cmdline.rst:268 +#: ../../using/cmdline.rst:293 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: ../../using/cmdline.rst:274 +#: ../../using/cmdline.rst:299 msgid "" -"Run Python in isolated mode. This also implies -E and -s. In isolated mode :" -"data:`sys.path` contains neither the script's directory nor the user's site-" -"packages directory. All :envvar:`PYTHON*` environment variables are ignored, " -"too. Further restrictions may be imposed to prevent the user from injecting " -"malicious code." +"Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " +"and :option:`-s` options." +msgstr "" + +#: ../../using/cmdline.rst:302 +msgid "" +"In isolated mode :data:`sys.path` contains neither the script's directory " +"nor the user's site-packages directory. All :envvar:`PYTHON*` environment " +"variables are ignored, too. Further restrictions may be imposed to prevent " +"the user from injecting malicious code." msgstr "" -#: ../../using/cmdline.rst:285 +#: ../../using/cmdline.rst:312 msgid "" "Remove assert statements and any code conditional on the value of :const:" "`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " @@ -386,30 +411,58 @@ msgid "" "envvar:`PYTHONOPTIMIZE`." msgstr "" -#: ../../using/cmdline.rst:290 ../../using/cmdline.rst:300 +#: ../../using/cmdline.rst:317 ../../using/cmdline.rst:327 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "" -#: ../../using/cmdline.rst:296 +#: ../../using/cmdline.rst:323 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: ../../using/cmdline.rst:306 +#: ../../using/cmdline.rst:333 +msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" +msgstr "" + +#: ../../using/cmdline.rst:335 +msgid "" +"``python -m module`` command line: Don't prepend the current working " +"directory." +msgstr "" + +#: ../../using/cmdline.rst:337 +msgid "" +"``python script.py`` command line: Don't prepend the script's directory. If " +"it's a symbolic link, resolve symbolic links." +msgstr "" + +#: ../../using/cmdline.rst:339 +msgid "" +"``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " +"empty string, which means the current working directory." +msgstr "" + +#: ../../using/cmdline.rst:342 +msgid "" +"See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " +"and :option:`-I` (isolated) options." +msgstr "" + +#: ../../using/cmdline.rst:350 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../using/cmdline.rst:313 +#: ../../using/cmdline.rst:357 msgid "" "Turn on hash randomization. This option only has an effect if the :envvar:" "`PYTHONHASHSEED` environment variable is set to ``0``, since hash " "randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:317 +#: ../../using/cmdline.rst:361 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`__hash__` values of str and bytes objects are \"salted\" " @@ -418,7 +471,7 @@ msgid "" "invocations of Python." msgstr "" -#: ../../using/cmdline.rst:323 +#: ../../using/cmdline.rst:367 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -426,28 +479,28 @@ msgid "" "www.ocert.org/advisories/ocert-2011-003.html for details." msgstr "" -#: ../../using/cmdline.rst:328 +#: ../../using/cmdline.rst:372 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: ../../using/cmdline.rst:331 +#: ../../using/cmdline.rst:375 msgid "The option is no longer ignored." msgstr "" -#: ../../using/cmdline.rst:339 +#: ../../using/cmdline.rst:383 msgid "" "Don't add the :data:`user site-packages directory ` to :data:" "`sys.path`." msgstr "" -#: ../../using/cmdline.rst:344 ../../using/cmdline.rst:717 -#: ../../using/cmdline.rst:729 +#: ../../using/cmdline.rst:388 ../../using/cmdline.rst:790 +#: ../../using/cmdline.rst:802 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../using/cmdline.rst:349 +#: ../../using/cmdline.rst:393 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -455,21 +508,21 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../using/cmdline.rst:357 +#: ../../using/cmdline.rst:401 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: ../../using/cmdline.rst:360 +#: ../../using/cmdline.rst:404 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "另請參閱 :envvar:`PYTHONUNBUFFERED`\\ 。" -#: ../../using/cmdline.rst:362 +#: ../../using/cmdline.rst:406 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: ../../using/cmdline.rst:368 +#: ../../using/cmdline.rst:412 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. When given twice (:" @@ -477,60 +530,60 @@ msgid "" "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../using/cmdline.rst:373 +#: ../../using/cmdline.rst:417 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: ../../using/cmdline.rst:377 +#: ../../using/cmdline.rst:421 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "另請參閱 :envvar:`PYTHONVERBOSE`\\ 。" -#: ../../using/cmdline.rst:383 +#: ../../using/cmdline.rst:427 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:386 ../../using/cmdline.rst:745 +#: ../../using/cmdline.rst:430 ../../using/cmdline.rst:818 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:397 +#: ../../using/cmdline.rst:441 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:401 +#: ../../using/cmdline.rst:445 msgid "The full form of argument is::" msgstr "" -#: ../../using/cmdline.rst:405 +#: ../../using/cmdline.rst:449 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:409 +#: ../../using/cmdline.rst:453 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:412 +#: ../../using/cmdline.rst:456 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:415 +#: ../../using/cmdline.rst:459 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -538,19 +591,19 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:420 +#: ../../using/cmdline.rst:464 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:423 +#: ../../using/cmdline.rst:467 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:426 +#: ../../using/cmdline.rst:470 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" @@ -558,7 +611,7 @@ msgid "" "invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:431 +#: ../../using/cmdline.rst:475 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" @@ -566,29 +619,29 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:756 +#: ../../using/cmdline.rst:480 ../../using/cmdline.rst:829 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:441 +#: ../../using/cmdline.rst:486 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:447 +#: ../../using/cmdline.rst:492 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:450 +#: ../../using/cmdline.rst:495 msgid "``-X faulthandler`` to enable :mod:`faulthandler`;" msgstr "" -#: ../../using/cmdline.rst:451 +#: ../../using/cmdline.rst:496 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -596,7 +649,7 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:455 +#: ../../using/cmdline.rst:500 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -605,14 +658,14 @@ msgid "" "more information." msgstr "" -#: ../../using/cmdline.rst:460 +#: ../../using/cmdline.rst:505 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation `. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:463 +#: ../../using/cmdline.rst:508 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -621,100 +674,129 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:468 +#: ../../using/cmdline.rst:513 msgid "" "``-X dev``: enable :ref:`Python Development Mode `, introducing " "additional runtime checks that are too expensive to be enabled by default." msgstr "" -#: ../../using/cmdline.rst:471 +#: ../../using/cmdline.rst:516 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode `. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode ` (even when it would " "otherwise activate automatically)." msgstr "" -#: ../../using/cmdline.rst:474 +#: ../../using/cmdline.rst:519 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:477 +#: ../../using/cmdline.rst:522 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:481 +#: ../../using/cmdline.rst:525 +msgid "" +"``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " +"location information (end line, start column offset and end column offset) " +"to every instruction in code objects. This is useful when smaller code " +"objects and pyc files are desired as well as suppressing the extra visual " +"location indicators when the interpreter displays tracebacks. See also :" +"envvar:`PYTHONNODEBUGRANGES`." +msgstr "" + +#: ../../using/cmdline.rst:531 +msgid "" +"``-X frozen_modules`` determines whether or not frozen modules are ignored " +"by the import machinery. A value of \"on\" means they get imported and \"off" +"\" means they are ignored. The default is \"on\" if this is an installed " +"Python (the normal case). If it's under development (running from the " +"source tree) then the default is \"off\". Note that the \"importlib_bootstrap" +"\" and \"importlib_bootstrap_external\" frozen modules are always used, even " +"if this flag is set to \"off\"." +msgstr "" + +#: ../../using/cmdline.rst:539 msgid "" "It also allows passing arbitrary values and retrieving them through the :" "data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:484 +#: ../../using/cmdline.rst:542 msgid "The :option:`-X` option was added." msgstr "" -#: ../../using/cmdline.rst:487 +#: ../../using/cmdline.rst:545 msgid "The ``-X faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:490 +#: ../../using/cmdline.rst:548 msgid "The ``-X showrefcount`` and ``-X tracemalloc`` options." msgstr "" -#: ../../using/cmdline.rst:493 +#: ../../using/cmdline.rst:551 msgid "The ``-X showalloccount`` option." msgstr "" -#: ../../using/cmdline.rst:496 +#: ../../using/cmdline.rst:554 msgid "The ``-X importtime``, ``-X dev`` and ``-X utf8`` options." msgstr "" -#: ../../using/cmdline.rst:499 +#: ../../using/cmdline.rst:557 msgid "" "The ``-X pycache_prefix`` option. The ``-X dev`` option now logs ``close()`` " "exceptions in :class:`io.IOBase` destructor." msgstr "" -#: ../../using/cmdline.rst:503 +#: ../../using/cmdline.rst:561 msgid "" "Using ``-X dev`` option, check *encoding* and *errors* arguments on string " "encoding and decoding operations." msgstr "" -#: ../../using/cmdline.rst:507 +#: ../../using/cmdline.rst:565 msgid "The ``-X showalloccount`` option has been removed." msgstr "" -#: ../../using/cmdline.rst:509 +#: ../../using/cmdline.rst:567 msgid "The ``-X warn_default_encoding`` option." msgstr "" -#: ../../using/cmdline.rst:512 -msgid "The ``-X int_max_str_digits`` option." +#: ../../using/cmdline.rst:572 +msgid "The ``-X oldparser`` option." msgstr "" -#: ../../using/cmdline.rst:516 -msgid "The ``-X oldparser`` option." +#: ../../using/cmdline.rst:573 +msgid "The ``-X no_debug_ranges`` option." +msgstr "" + +#: ../../using/cmdline.rst:576 +msgid "The ``-X frozen_modules`` option." msgstr "" -#: ../../using/cmdline.rst:520 +#: ../../using/cmdline.rst:579 +msgid "The ``-X int_max_str_digits`` option." +msgstr "" + +#: ../../using/cmdline.rst:584 msgid "Options you shouldn't use" msgstr "" -#: ../../using/cmdline.rst:524 +#: ../../using/cmdline.rst:588 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:531 +#: ../../using/cmdline.rst:596 msgid "Environment variables" msgstr "" -#: ../../using/cmdline.rst:533 +#: ../../using/cmdline.rst:598 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -722,7 +804,7 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:540 +#: ../../using/cmdline.rst:605 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -731,14 +813,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:546 +#: ../../using/cmdline.rst:611 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:553 +#: ../../using/cmdline.rst:618 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -746,21 +828,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:558 +#: ../../using/cmdline.rst:623 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:562 +#: ../../using/cmdline.rst:627 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:566 +#: ../../using/cmdline.rst:631 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -768,13 +850,19 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:574 +#: ../../using/cmdline.rst:639 +msgid "" +"If this is set to a non-empty string, don't prepend a potentially unsafe " +"path to :data:`sys.path`: see the :option:`-P` option for details." +msgstr "" + +#: ../../using/cmdline.rst:647 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:582 +#: ../../using/cmdline.rst:655 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -785,26 +873,26 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:589 +#: ../../using/cmdline.rst:662 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with " "argument ``filename``." msgstr "" -#: ../../using/cmdline.rst:591 +#: ../../using/cmdline.rst:664 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with the " "filename as the argument when called on startup." msgstr "" -#: ../../using/cmdline.rst:597 +#: ../../using/cmdline.rst:670 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:604 +#: ../../using/cmdline.rst:677 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -815,52 +903,52 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:616 +#: ../../using/cmdline.rst:689 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:623 +#: ../../using/cmdline.rst:696 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:626 +#: ../../using/cmdline.rst:699 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:632 +#: ../../using/cmdline.rst:705 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:638 +#: ../../using/cmdline.rst:711 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:645 +#: ../../using/cmdline.rst:718 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:651 +#: ../../using/cmdline.rst:724 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:658 +#: ../../using/cmdline.rst:731 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -868,40 +956,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:668 +#: ../../using/cmdline.rst:741 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:671 +#: ../../using/cmdline.rst:744 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:675 +#: ../../using/cmdline.rst:748 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:679 +#: ../../using/cmdline.rst:752 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:686 +#: ../../using/cmdline.rst:759 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "`." msgstr "" -#: ../../using/cmdline.rst:694 +#: ../../using/cmdline.rst:767 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -909,17 +997,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:699 +#: ../../using/cmdline.rst:772 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:702 +#: ../../using/cmdline.rst:775 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:705 +#: ../../using/cmdline.rst:778 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -927,13 +1015,13 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:712 +#: ../../using/cmdline.rst:785 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:722 +#: ../../using/cmdline.rst:795 msgid "" "Defines the :data:`user base directory `, which is used to " "compute the path of the :data:`user site-packages directory ` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:801 +#: ../../using/cmdline.rst:874 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:803 +#: ../../using/cmdline.rst:876 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:805 +#: ../../using/cmdline.rst:878 msgid "" "``default``: use the :ref:`default memory allocators `." msgstr "" -#: ../../using/cmdline.rst:807 +#: ../../using/cmdline.rst:880 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:data:`PYMEM_DOMAIN_RAW`, :c:data:`PYMEM_DOMAIN_MEM`, :c:data:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:810 +#: ../../using/cmdline.rst:883 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator ` for :c:data:" "`PYMEM_DOMAIN_MEM` and :c:data:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:data:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:814 +#: ../../using/cmdline.rst:887 msgid "Install :ref:`debug hooks `:" msgstr "" -#: ../../using/cmdline.rst:816 +#: ../../using/cmdline.rst:889 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "`." msgstr "" -#: ../../using/cmdline.rst:818 +#: ../../using/cmdline.rst:891 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:819 +#: ../../using/cmdline.rst:892 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:894 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:829 +#: ../../using/cmdline.rst:902 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator ` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:833 +#: ../../using/cmdline.rst:906 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:837 +#: ../../using/cmdline.rst:910 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:844 +#: ../../using/cmdline.rst:917 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1063,41 +1151,41 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:849 +#: ../../using/cmdline.rst:922 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding()`." msgstr "" -#: ../../using/cmdline.rst:853 ../../using/cmdline.rst:867 +#: ../../using/cmdline.rst:926 ../../using/cmdline.rst:940 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../using/cmdline.rst:854 +#: ../../using/cmdline.rst:927 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`\\ 。" -#: ../../using/cmdline.rst:859 +#: ../../using/cmdline.rst:932 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:863 +#: ../../using/cmdline.rst:936 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:873 +#: ../../using/cmdline.rst:946 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:877 +#: ../../using/cmdline.rst:950 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1108,19 +1196,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:885 +#: ../../using/cmdline.rst:958 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:886 +#: ../../using/cmdline.rst:959 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:887 +#: ../../using/cmdline.rst:960 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:889 +#: ../../using/cmdline.rst:962 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1133,7 +1221,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:899 +#: ../../using/cmdline.rst:972 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1143,7 +1231,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: ../../using/cmdline.rst:906 +#: ../../using/cmdline.rst:979 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1151,7 +1239,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:911 +#: ../../using/cmdline.rst:984 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1160,64 +1248,79 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:918 -msgid ":ref:`Availability `: \\*nix." -msgstr ":ref:`適用 `:\\*nix。" +#: ../../using/cmdline.rst:991 +msgid ":ref:`Availability `: Unix." +msgstr ":ref:`適用 `:Unix。" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:992 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`\\ 。" -#: ../../using/cmdline.rst:925 +#: ../../using/cmdline.rst:998 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode `, introducing additional runtime checks " "that are too expensive to be enabled by default." msgstr "" -#: ../../using/cmdline.rst:933 +#: ../../using/cmdline.rst:1006 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../using/cmdline.rst:935 +#: ../../using/cmdline.rst:1008 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../using/cmdline.rst:937 +#: ../../using/cmdline.rst:1010 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:944 +#: ../../using/cmdline.rst:1017 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:947 +#: ../../using/cmdline.rst:1020 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`\\ 。" -#: ../../using/cmdline.rst:953 +#: ../../using/cmdline.rst:1026 +msgid "" +"If this variable is set, it disables the inclusion of the tables mapping " +"extra location information (end line, start column offset and end column " +"offset) to every instruction in code objects. This is useful when smaller " +"code objects and pyc files are desired as well as suppressing the extra " +"visual location indicators when the interpreter displays tracebacks." +msgstr "" + +#: ../../using/cmdline.rst:1037 msgid "Debug-mode variables" msgstr "" -#: ../../using/cmdline.rst:957 +#: ../../using/cmdline.rst:1041 msgid "If set, Python will print threading debug info into stdout." msgstr "" -#: ../../using/cmdline.rst:959 +#: ../../using/cmdline.rst:1043 msgid "Need a :ref:`debug build of Python `." msgstr "" -#: ../../using/cmdline.rst:966 +#: ../../using/cmdline.rst:1050 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:969 +#: ../../using/cmdline.rst:1053 ../../using/cmdline.rst:1060 msgid "" "Need Python configured with the :option:`--with-trace-refs` build option." msgstr "" + +#: ../../using/cmdline.rst:1057 +msgid "" +"If set, Python will dump objects and reference counts still alive after " +"shutting down the interpreter into a file called *FILENAME*." +msgstr "" diff --git a/using/configure.po b/using/configure.po index 4abbc1d47e..92a36e4550 100644 --- a/using/configure.po +++ b/using/configure.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-21 00:15+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -63,114 +63,120 @@ msgid "Define the size in bits of Python :class:`int` digits: 15 or 30 bits." msgstr "" #: ../../using/configure.rst:38 -msgid "" -"By default, the number of bits is selected depending on ``sizeof(void*)``: " -"30 bits if ``void*`` size is 64-bit or larger, 15 bits otherwise." +msgid "By default, the digit size is 30." msgstr "" -#: ../../using/configure.rst:41 +#: ../../using/configure.rst:40 msgid "Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``." msgstr "將 ``PYLONG_BITS_IN_DIGIT`` 定義為 ``15`` 或 ``30``\\ 。" -#: ../../using/configure.rst:43 +#: ../../using/configure.rst:42 msgid "See :data:`sys.int_info.bits_per_digit `." msgstr "參閱 :data:`sys.int_info.bits_per_digit `\\ 。" -#: ../../using/configure.rst:48 +#: ../../using/configure.rst:47 msgid "" "Compile the Python ``main()`` function and link Python executable with C++ " "compiler: ``$CXX``, or *COMPILER* if specified." msgstr "" -#: ../../using/configure.rst:53 +#: ../../using/configure.rst:52 msgid "Set the Python executable suffix to *SUFFIX*." msgstr "" -#: ../../using/configure.rst:55 +#: ../../using/configure.rst:54 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " -"executable), and an empty string on other platforms (``python`` executable)." +"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." +"wasm`` on WASI, and an empty string on other platforms (``python`` " +"executable)." +msgstr "" + +#: ../../using/configure.rst:59 +msgid "" +"The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." +"wasm``." msgstr "" -#: ../../using/configure.rst:60 +#: ../../using/configure.rst:65 msgid "" "Select the default time zone search path for :data:`zoneinfo.TZPATH`. See " "the :ref:`Compile-time configuration ` of " "the :mod:`zoneinfo` module." msgstr "" -#: ../../using/configure.rst:64 +#: ../../using/configure.rst:69 msgid "" "Default: ``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/" "etc/zoneinfo``." msgstr "" -#: ../../using/configure.rst:66 +#: ../../using/configure.rst:71 msgid "See :data:`os.pathsep` path separator." msgstr "" -#: ../../using/configure.rst:72 +#: ../../using/configure.rst:77 msgid "" "Build the ``_decimal`` extension module using a thread-local context rather " "than a coroutine-local context (default), see the :mod:`decimal` module." msgstr "" -#: ../../using/configure.rst:75 +#: ../../using/configure.rst:80 msgid "See :data:`decimal.HAVE_CONTEXTVAR` and the :mod:`contextvars` module." msgstr "" -#: ../../using/configure.rst:81 +#: ../../using/configure.rst:86 msgid "Override order to check db backends for the :mod:`dbm` module" msgstr "" -#: ../../using/configure.rst:83 +#: ../../using/configure.rst:88 msgid "" "A valid value is a colon (``:``) separated string with the backend names:" msgstr "" -#: ../../using/configure.rst:85 +#: ../../using/configure.rst:90 msgid "``ndbm``;" msgstr "" -#: ../../using/configure.rst:86 +#: ../../using/configure.rst:91 msgid "``gdbm``;" msgstr "" -#: ../../using/configure.rst:87 +#: ../../using/configure.rst:92 msgid "``bdb``." msgstr "" -#: ../../using/configure.rst:91 +#: ../../using/configure.rst:96 msgid "Disable C locale coercion to a UTF-8 based locale (enabled by default)." msgstr "" -#: ../../using/configure.rst:93 +#: ../../using/configure.rst:98 msgid "Don't define the ``PY_COERCE_C_LOCALE`` macro." msgstr "" -#: ../../using/configure.rst:95 +#: ../../using/configure.rst:100 msgid "See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`." msgstr "請見 :envvar:`PYTHONCOERCECLOCALE` 與 :pep:`538`。" -#: ../../using/configure.rst:99 +#: ../../using/configure.rst:104 msgid "Python library directory name (default is ``lib``)." msgstr "" -#: ../../using/configure.rst:101 +#: ../../using/configure.rst:106 msgid "Fedora and SuSE use ``lib64`` on 64-bit platforms." msgstr "" -#: ../../using/configure.rst:103 +#: ../../using/configure.rst:108 msgid "See :data:`sys.platlibdir`." msgstr "參閱 :data:`sys.platlibdir`\\ 。" -#: ../../using/configure.rst:109 +#: ../../using/configure.rst:114 msgid "" "Directory of wheel packages used by the :mod:`ensurepip` module (none by " "default)." msgstr "" -#: ../../using/configure.rst:112 +#: ../../using/configure.rst:117 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" @@ -178,216 +184,286 @@ msgid "" "_bundled` package." msgstr "" -#: ../../using/configure.rst:121 +#: ../../using/configure.rst:126 +msgid "" +"Whether configure should use :program:`pkg-config` to detect build " +"dependencies." +msgstr "" + +#: ../../using/configure.rst:129 +msgid "``check`` (default): :program:`pkg-config` is optional" +msgstr "" + +#: ../../using/configure.rst:130 +msgid "``yes``: :program:`pkg-config` is mandatory" +msgstr "" + +#: ../../using/configure.rst:131 +msgid "``no``: configure does not use :program:`pkg-config` even when present" +msgstr "" + +#: ../../using/configure.rst:137 +msgid "Turn on internal statistics gathering." +msgstr "" + +#: ../../using/configure.rst:139 +msgid "" +"The statistics will be dumped to a arbitrary (probably unique) file in ``/" +"tmp/py_stats/``, or ``C:\\temp\\py_stats\\`` on Windows." +msgstr "" + +#: ../../using/configure.rst:142 +msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." +msgstr "" + +#: ../../using/configure.rst:147 +msgid "WebAssembly Options" +msgstr "" + +#: ../../using/configure.rst:151 +msgid "Set build flavor for ``wasm32-emscripten``." +msgstr "" + +#: ../../using/configure.rst:153 +msgid "``browser`` (default): preload minimal stdlib, default MEMFS." +msgstr "" + +#: ../../using/configure.rst:154 +msgid "``node``: NODERAWFS and pthread support." +msgstr "" + +#: ../../using/configure.rst:160 +msgid "Turn on dynamic linking support for WASM." +msgstr "" + +#: ../../using/configure.rst:162 +msgid "" +"Dynamic linking enables ``dlopen``. File size of the executable increases " +"due to limited dead code elimination and additional features." +msgstr "" + +#: ../../using/configure.rst:169 +msgid "Turn on pthreads support for WASM." +msgstr "" + +#: ../../using/configure.rst:175 msgid "Install Options" msgstr "" -#: ../../using/configure.rst:125 +#: ../../using/configure.rst:179 msgid "" "Don't build nor install test modules, like the :mod:`test` package or the :" "mod:`_testcapi` extension module (built and installed by default)." msgstr "" -#: ../../using/configure.rst:132 +#: ../../using/configure.rst:186 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "" -#: ../../using/configure.rst:134 +#: ../../using/configure.rst:188 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." msgstr "" -#: ../../using/configure.rst:136 +#: ../../using/configure.rst:190 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "" -#: ../../using/configure.rst:137 +#: ../../using/configure.rst:191 msgid "``no``: don't run ensurepip;" msgstr "" -#: ../../using/configure.rst:143 +#: ../../using/configure.rst:197 msgid "Performance options" msgstr "" -#: ../../using/configure.rst:145 +#: ../../using/configure.rst:199 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance." msgstr "" -#: ../../using/configure.rst:150 +#: ../../using/configure.rst:204 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: ../../using/configure.rst:153 +#: ../../using/configure.rst:207 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: ../../using/configure.rst:156 +#: ../../using/configure.rst:210 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: ../../using/configure.rst:162 +#: ../../using/configure.rst:216 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "" -#: ../../using/configure.rst:167 +#: ../../using/configure.rst:221 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: ../../using/configure.rst:170 +#: ../../using/configure.rst:224 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "" -#: ../../using/configure.rst:176 +#: ../../using/configure.rst:230 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: ../../using/configure.rst:178 +#: ../../using/configure.rst:232 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: ../../using/configure.rst:185 +#: ../../using/configure.rst:237 +msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." +msgstr "" + +#: ../../using/configure.rst:242 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: ../../using/configure.rst:190 +#: ../../using/configure.rst:247 msgid "" "Disable the specialized Python memory allocator :ref:`pymalloc ` " "(enabled by default)." msgstr "" -#: ../../using/configure.rst:193 +#: ../../using/configure.rst:250 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "另請參閱 :envvar:`PYTHONMALLOC` 環境變數。" -#: ../../using/configure.rst:197 +#: ../../using/configure.rst:254 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: ../../using/configure.rst:200 +#: ../../using/configure.rst:257 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "" -#: ../../using/configure.rst:202 +#: ../../using/configure.rst:259 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "" -#: ../../using/configure.rst:206 +#: ../../using/configure.rst:263 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: ../../using/configure.rst:212 +#: ../../using/configure.rst:269 msgid "Python Debug Build" msgstr "" -#: ../../using/configure.rst:214 +#: ../../using/configure.rst:271 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: ../../using/configure.rst:217 +#: ../../using/configure.rst:274 msgid "Effects of a debug build:" msgstr "" -#: ../../using/configure.rst:219 +#: ../../using/configure.rst:276 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: ../../using/configure.rst:221 +#: ../../using/configure.rst:278 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "" -#: ../../using/configure.rst:222 +#: ../../using/configure.rst:279 msgid "Add :func:`sys.gettotalrefcount` function." msgstr "" -#: ../../using/configure.rst:223 +#: ../../using/configure.rst:280 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "" -#: ../../using/configure.rst:224 +#: ../../using/configure.rst:281 msgid "Add :envvar:`PYTHONTHREADDEBUG` environment variable." msgstr "" -#: ../../using/configure.rst:225 +#: ../../using/configure.rst:282 msgid "" -"Add support for the ``__ltrace__`` variable: enable low-level tracing in the " -"bytecode evaluation loop if the variable is defined." +"Add support for the ``__lltrace__`` variable: enable low-level tracing in " +"the bytecode evaluation loop if the variable is defined." msgstr "" -#: ../../using/configure.rst:227 +#: ../../using/configure.rst:284 msgid "" "Install :ref:`debug hooks on memory allocators ` " "to detect buffer overflow and other memory errors." msgstr "" -#: ../../using/configure.rst:229 +#: ../../using/configure.rst:286 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "" -#: ../../using/configure.rst:230 +#: ../../using/configure.rst:287 msgid "" -"Add runtime checks: code surroundeded by ``#ifdef Py_DEBUG`` and ``#endif``. " +"Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " "the ``NDEBUG`` macro (see also the :option:`--with-assertions` configure " "option). Main runtime checks:" msgstr "" -#: ../../using/configure.rst:235 +#: ../../using/configure.rst:292 msgid "Add sanity checks on the function arguments." msgstr "" -#: ../../using/configure.rst:236 +#: ../../using/configure.rst:293 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: ../../using/configure.rst:238 +#: ../../using/configure.rst:295 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: ../../using/configure.rst:240 +#: ../../using/configure.rst:297 +msgid "Check that deallocator functions don't change the current exception." +msgstr "" + +#: ../../using/configure.rst:298 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: ../../using/configure.rst:242 +#: ../../using/configure.rst:300 msgid "" "The :c:macro:`Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: ../../using/configure.rst:245 +#: ../../using/configure.rst:303 msgid "" "See also the :ref:`Python Development Mode ` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: ../../using/configure.rst:248 +#: ../../using/configure.rst:306 msgid "" "Release builds and debug builds are now ABI compatible: defining the " "``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" @@ -395,391 +471,428 @@ msgid "" "incompatibility." msgstr "" -#: ../../using/configure.rst:256 +#: ../../using/configure.rst:314 msgid "Debug options" msgstr "" -#: ../../using/configure.rst:260 +#: ../../using/configure.rst:318 msgid "" ":ref:`Build Python in debug mode `: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" -#: ../../using/configure.rst:265 +#: ../../using/configure.rst:323 msgid "Enable tracing references for debugging purpose (disabled by default)." msgstr "" -#: ../../using/configure.rst:267 +#: ../../using/configure.rst:325 msgid "Effects:" msgstr "" -#: ../../using/configure.rst:269 +#: ../../using/configure.rst:327 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "" -#: ../../using/configure.rst:270 +#: ../../using/configure.rst:328 msgid "Add :func:`sys.getobjects` function." msgstr "" -#: ../../using/configure.rst:271 +#: ../../using/configure.rst:329 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: ../../using/configure.rst:273 +#: ../../using/configure.rst:331 msgid "" "This build is not ABI compatible with release build (default build) or debug " "build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros)." msgstr "" -#: ../../using/configure.rst:280 +#: ../../using/configure.rst:338 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" -#: ../../using/configure.rst:283 +#: ../../using/configure.rst:341 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" -#: ../../using/configure.rst:286 +#: ../../using/configure.rst:344 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build `) which also enables assertions." msgstr "" -#: ../../using/configure.rst:293 +#: ../../using/configure.rst:351 msgid "Enable Valgrind support (default is no)." msgstr "" -#: ../../using/configure.rst:297 +#: ../../using/configure.rst:355 msgid "Enable DTrace support (default is no)." msgstr "" -#: ../../using/configure.rst:299 +#: ../../using/configure.rst:357 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap `." msgstr "" -#: ../../using/configure.rst:306 +#: ../../using/configure.rst:364 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." msgstr "" -#: ../../using/configure.rst:312 +#: ../../using/configure.rst:370 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" -#: ../../using/configure.rst:318 +#: ../../using/configure.rst:376 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" -#: ../../using/configure.rst:325 +#: ../../using/configure.rst:383 msgid "Linker options" msgstr "" -#: ../../using/configure.rst:329 +#: ../../using/configure.rst:387 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" -#: ../../using/configure.rst:333 +#: ../../using/configure.rst:391 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" -#: ../../using/configure.rst:340 +#: ../../using/configure.rst:398 msgid "Libraries options" msgstr "" -#: ../../using/configure.rst:344 +#: ../../using/configure.rst:402 msgid "Link against additional libraries (default is no)." msgstr "" -#: ../../using/configure.rst:348 +#: ../../using/configure.rst:406 msgid "" "Build the :mod:`pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" -#: ../../using/configure.rst:353 +#: ../../using/configure.rst:411 msgid "" "Build the :mod:`_ctypes` extension module using an installed ``ffi`` " "library, see the :mod:`ctypes` module (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:358 +#: ../../using/configure.rst:416 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdec`` " "library, see the :mod:`decimal` module (default is no)." msgstr "" -#: ../../using/configure.rst:365 +#: ../../using/configure.rst:423 msgid "Use ``editline`` library for backend of the :mod:`readline` module." msgstr "" -#: ../../using/configure.rst:367 +#: ../../using/configure.rst:425 msgid "Define the ``WITH_EDITLINE`` macro." msgstr "" -#: ../../using/configure.rst:373 +#: ../../using/configure.rst:431 msgid "Don't build the :mod:`readline` module (built by default)." msgstr "" -#: ../../using/configure.rst:375 +#: ../../using/configure.rst:433 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "" -#: ../../using/configure.rst:381 -msgid "Override search for Tcl and Tk include files." -msgstr "" - -#: ../../using/configure.rst:385 -msgid "Override search for Tcl and Tk libraries." -msgstr "" - -#: ../../using/configure.rst:389 +#: ../../using/configure.rst:439 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:393 +#: ../../using/configure.rst:443 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:397 +#: ../../using/configure.rst:447 msgid "Root of the OpenSSL directory." msgstr "" -#: ../../using/configure.rst:403 +#: ../../using/configure.rst:453 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: ../../using/configure.rst:405 +#: ../../using/configure.rst:455 msgid "``no`` (default): don't set rpath;" msgstr "" -#: ../../using/configure.rst:406 +#: ../../using/configure.rst:456 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: ../../using/configure.rst:408 +#: ../../using/configure.rst:458 msgid "*DIR*: set an explicit rpath." msgstr "" -#: ../../using/configure.rst:414 +#: ../../using/configure.rst:464 msgid "Security Options" msgstr "" -#: ../../using/configure.rst:418 +#: ../../using/configure.rst:468 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: ../../using/configure.rst:420 -msgid "``siphash24`` (default)." +#: ../../using/configure.rst:470 +msgid "``siphash13`` (default);" +msgstr "" + +#: ../../using/configure.rst:471 +msgid "``siphash24``;" +msgstr "" + +#: ../../using/configure.rst:472 +msgid "``fnv``." msgstr "" -#: ../../using/configure.rst:421 -msgid "``fnv``;" +#: ../../using/configure.rst:476 +msgid "``siphash13`` is added and it is the new default." msgstr "" -#: ../../using/configure.rst:427 +#: ../../using/configure.rst:481 msgid "Built-in hash modules:" msgstr "" -#: ../../using/configure.rst:429 +#: ../../using/configure.rst:483 msgid "``md5``;" msgstr "" -#: ../../using/configure.rst:430 +#: ../../using/configure.rst:484 msgid "``sha1``;" msgstr "" -#: ../../using/configure.rst:431 +#: ../../using/configure.rst:485 msgid "``sha256``;" msgstr "" -#: ../../using/configure.rst:432 +#: ../../using/configure.rst:486 msgid "``sha512``;" msgstr "" -#: ../../using/configure.rst:433 +#: ../../using/configure.rst:487 msgid "``sha3`` (with shake);" msgstr "" -#: ../../using/configure.rst:434 +#: ../../using/configure.rst:488 msgid "``blake2``." msgstr "" -#: ../../using/configure.rst:440 +#: ../../using/configure.rst:494 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: ../../using/configure.rst:442 +#: ../../using/configure.rst:496 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: ../../using/configure.rst:443 +#: ../../using/configure.rst:497 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: ../../using/configure.rst:444 +#: ../../using/configure.rst:498 msgid "*STRING*: use a custom string" msgstr "" -#: ../../using/configure.rst:446 +#: ../../using/configure.rst:500 msgid "See the :mod:`ssl` module." msgstr "" -#: ../../using/configure.rst:452 +#: ../../using/configure.rst:506 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: ../../using/configure.rst:456 +#: ../../using/configure.rst:510 msgid "macOS Options" msgstr "" -#: ../../using/configure.rst:458 +#: ../../using/configure.rst:512 msgid "See ``Mac/README.rst``." msgstr "參閱 ``Mac/README.rst``\\ 。" -#: ../../using/configure.rst:463 +#: ../../using/configure.rst:517 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: ../../using/configure.rst:469 +#: ../../using/configure.rst:523 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: ../../using/configure.rst:474 +#: ../../using/configure.rst:528 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: ../../using/configure.rst:477 +#: ../../using/configure.rst:531 msgid "Options:" msgstr "" -#: ../../using/configure.rst:479 +#: ../../using/configure.rst:533 msgid "``universal2``;" msgstr "" -#: ../../using/configure.rst:480 +#: ../../using/configure.rst:534 msgid "``32-bit``;" msgstr "" -#: ../../using/configure.rst:481 +#: ../../using/configure.rst:535 msgid "``64-bit``;" msgstr "" -#: ../../using/configure.rst:482 +#: ../../using/configure.rst:536 msgid "``3-way``;" msgstr "" -#: ../../using/configure.rst:483 +#: ../../using/configure.rst:537 msgid "``intel``;" msgstr "" -#: ../../using/configure.rst:484 +#: ../../using/configure.rst:538 msgid "``intel-32``;" msgstr "" -#: ../../using/configure.rst:485 +#: ../../using/configure.rst:539 msgid "``intel-64``;" msgstr "" -#: ../../using/configure.rst:486 +#: ../../using/configure.rst:540 msgid "``all``." msgstr "" -#: ../../using/configure.rst:490 +#: ../../using/configure.rst:544 msgid "" "Specify the name for the python framework on macOS only valid when :option:" "`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:495 +#: ../../using/configure.rst:549 +msgid "Cross Compiling Options" +msgstr "" + +#: ../../using/configure.rst:551 +msgid "" +"Cross compiling, also known as cross building, can be used to build Python " +"for another CPU architecture or platform. Cross compiling requires a Python " +"interpreter for the build platform. The version of the build Python must " +"match the version of the cross compiled host Python." +msgstr "" + +#: ../../using/configure.rst:558 +msgid "" +"configure for building on BUILD, usually guessed by :program:`config.guess`." +msgstr "" + +#: ../../using/configure.rst:562 +msgid "cross-compile to build programs to run on HOST (target platform)" +msgstr "" + +#: ../../using/configure.rst:566 +msgid "path to build ``python`` binary for cross compiling" +msgstr "" + +#: ../../using/configure.rst:572 +msgid "An environment variable that points to a file with configure overrides." +msgstr "" + +#: ../../using/configure.rst:574 +msgid "Example *config.site* file::" +msgstr "" + +#: ../../using/configure.rst:582 +msgid "Cross compiling example::" +msgstr "" + +#: ../../using/configure.rst:591 msgid "Python Build System" msgstr "" -#: ../../using/configure.rst:498 +#: ../../using/configure.rst:594 msgid "Main files of the build system" msgstr "" -#: ../../using/configure.rst:500 +#: ../../using/configure.rst:596 msgid ":file:`configure.ac` => :file:`configure`;" msgstr ":file:`configure.ac` => :file:`configure`\\ ;" -#: ../../using/configure.rst:501 +#: ../../using/configure.rst:597 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" -#: ../../using/configure.rst:502 +#: ../../using/configure.rst:598 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr ":file:`pyconfig.h` (created by :file:`configure`)\\ ;" -#: ../../using/configure.rst:503 +#: ../../using/configure.rst:599 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile using :file:" "`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:505 +#: ../../using/configure.rst:601 msgid ":file:`setup.py`: C extensions built using the :mod:`distutils` module." msgstr "" -#: ../../using/configure.rst:508 +#: ../../using/configure.rst:604 msgid "Main build steps" msgstr "" -#: ../../using/configure.rst:510 +#: ../../using/configure.rst:606 msgid "C files (``.c``) are built as object files (``.o``)." msgstr "" -#: ../../using/configure.rst:511 +#: ../../using/configure.rst:607 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:512 +#: ../../using/configure.rst:608 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:514 +#: ../../using/configure.rst:610 msgid "" "C extensions are built by the Makefile (see :file:`Modules/Setup`) and " "``python setup.py build``." msgstr "" -#: ../../using/configure.rst:518 +#: ../../using/configure.rst:614 msgid "Main Makefile targets" msgstr "" -#: ../../using/configure.rst:520 +#: ../../using/configure.rst:616 msgid "``make``: Build Python with the standard library." msgstr "" -#: ../../using/configure.rst:521 +#: ../../using/configure.rst:617 msgid "" "``make platform:``: build the ``python`` program, but don't build the " "standard library extension modules." msgstr "" -#: ../../using/configure.rst:523 +#: ../../using/configure.rst:619 msgid "" "``make profile-opt``: build Python using Profile Guided Optimization (PGO). " "You can use the configure :option:`--enable-optimizations` option to make " @@ -787,53 +900,53 @@ msgid "" "``make``)." msgstr "" -#: ../../using/configure.rst:527 +#: ../../using/configure.rst:623 msgid "" "``make buildbottest``: Build Python and run the Python test suite, the same " "way than buildbots test Python. Set ``TESTTIMEOUT`` variable (in seconds) to " "change the test timeout (1200 by default: 20 minutes)." msgstr "" -#: ../../using/configure.rst:530 +#: ../../using/configure.rst:626 msgid "``make install``: Build and install Python." msgstr "" -#: ../../using/configure.rst:531 +#: ../../using/configure.rst:627 msgid "" "``make regen-all``: Regenerate (almost) all generated files; ``make regen-" "stdlib-module-names`` and ``autoconf`` must be run separately for the " "remaining generated files." msgstr "" -#: ../../using/configure.rst:534 +#: ../../using/configure.rst:630 msgid "``make clean``: Remove built files." msgstr "" -#: ../../using/configure.rst:535 +#: ../../using/configure.rst:631 msgid "" "``make distclean``: Same than ``make clean``, but remove also files created " "by the configure script." msgstr "" -#: ../../using/configure.rst:539 +#: ../../using/configure.rst:635 msgid "C extensions" msgstr "" -#: ../../using/configure.rst:541 +#: ../../using/configure.rst:637 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute::" msgstr "" -#: ../../using/configure.rst:553 +#: ../../using/configure.rst:649 msgid "" -"Other C extensins are built as dynamic libraries, like the ``_asyncio`` " +"Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64::" msgstr "" -#: ../../using/configure.rst:563 +#: ../../using/configure.rst:659 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -841,322 +954,322 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:567 +#: ../../using/configure.rst:663 msgid "" "The :file:`setup.py` script only builds C extensions as shared libraries " "using the :mod:`distutils` module." msgstr "" -#: ../../using/configure.rst:570 +#: ../../using/configure.rst:666 msgid "" "The :c:macro:`PyAPI_FUNC()`, :c:macro:`PyAPI_API()` and :c:macro:" "`PyMODINIT_FUNC()` macros of :file:`Include/pyport.h` are defined " "differently depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" msgstr "" -#: ../../using/configure.rst:574 +#: ../../using/configure.rst:670 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "" -#: ../../using/configure.rst:575 +#: ../../using/configure.rst:671 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "" -#: ../../using/configure.rst:577 +#: ../../using/configure.rst:673 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its ``PyInit_xxx()`` function is not exported, " "causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:583 +#: ../../using/configure.rst:679 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:585 +#: ../../using/configure.rst:681 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:589 +#: ../../using/configure.rst:685 msgid "Preprocessor flags" msgstr "" -#: ../../using/configure.rst:593 +#: ../../using/configure.rst:689 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:599 +#: ../../using/configure.rst:695 msgid "" "(Objective) C/C++ preprocessor flags, e.g. ``-I`` if you have " "headers in a nonstandard directory ````." msgstr "" -#: ../../using/configure.rst:602 ../../using/configure.rst:797 +#: ../../using/configure.rst:698 ../../using/configure.rst:893 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value for setup.py to be able to build extension modules using the " "directories specified in the environment variables." msgstr "" -#: ../../using/configure.rst:612 +#: ../../using/configure.rst:708 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:614 +#: ../../using/configure.rst:710 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " "$(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:619 +#: ../../using/configure.rst:715 msgid "Compiler flags" msgstr "" -#: ../../using/configure.rst:623 +#: ../../using/configure.rst:719 msgid "C compiler command." msgstr "" -#: ../../using/configure.rst:625 +#: ../../using/configure.rst:721 msgid "Example: ``gcc -pthread``." msgstr "" -#: ../../using/configure.rst:629 +#: ../../using/configure.rst:725 msgid "" "C compiler command used to build the ``main()`` function of programs like " "``python``." msgstr "" -#: ../../using/configure.rst:632 +#: ../../using/configure.rst:728 msgid "" "Variable set by the :option:`--with-cxx-main` option of the configure script." msgstr "" -#: ../../using/configure.rst:635 +#: ../../using/configure.rst:731 msgid "Default: ``$(CC)``." msgstr "" -#: ../../using/configure.rst:639 +#: ../../using/configure.rst:735 msgid "C++ compiler command." msgstr "" -#: ../../using/configure.rst:641 +#: ../../using/configure.rst:737 msgid "Used if the :option:`--with-cxx-main` option is used." msgstr "" -#: ../../using/configure.rst:643 +#: ../../using/configure.rst:739 msgid "Example: ``g++ -pthread``." msgstr "" -#: ../../using/configure.rst:647 +#: ../../using/configure.rst:743 msgid "C compiler flags." msgstr "" -#: ../../using/configure.rst:651 +#: ../../using/configure.rst:747 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part of the " "distutils :envvar:`CFLAGS` once Python is installed (:issue:`21121`)." msgstr "" -#: ../../using/configure.rst:655 +#: ../../using/configure.rst:751 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:657 +#: ../../using/configure.rst:753 msgid "" "the compiler flag `-I` (for setting the search path for include files). The " "`-I` flags are processed from left to right, and any flags in :envvar:" "`CFLAGS` would take precedence over user- and package-supplied `-I` flags." msgstr "" -#: ../../using/configure.rst:662 +#: ../../using/configure.rst:758 msgid "" "hardening flags such as `-Werror` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:670 +#: ../../using/configure.rst:766 msgid "Extra C compiler flags." msgstr "" -#: ../../using/configure.rst:674 +#: ../../using/configure.rst:770 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:681 +#: ../../using/configure.rst:777 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:688 +#: ../../using/configure.rst:784 msgid "Base compiler flags." msgstr "" -#: ../../using/configure.rst:692 +#: ../../using/configure.rst:788 msgid "Optimization flags." msgstr "" -#: ../../using/configure.rst:696 +#: ../../using/configure.rst:792 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:702 +#: ../../using/configure.rst:798 msgid "Compiler flags used to build a shared library." msgstr "" -#: ../../using/configure.rst:704 +#: ../../using/configure.rst:800 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:708 +#: ../../using/configure.rst:804 msgid "Extra C flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:710 +#: ../../using/configure.rst:806 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" -#: ../../using/configure.rst:715 +#: ../../using/configure.rst:811 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " "$(EXTRA_CFLAGS)``." msgstr "" -#: ../../using/configure.rst:719 +#: ../../using/configure.rst:815 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" -#: ../../using/configure.rst:725 +#: ../../using/configure.rst:821 msgid "C flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:727 +#: ../../using/configure.rst:823 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " "$(CFLAGSFORSHARED)``." msgstr "" -#: ../../using/configure.rst:733 +#: ../../using/configure.rst:829 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." msgstr "" -#: ../../using/configure.rst:739 +#: ../../using/configure.rst:835 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:742 +#: ../../using/configure.rst:838 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." msgstr "" -#: ../../using/configure.rst:748 +#: ../../using/configure.rst:844 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:750 +#: ../../using/configure.rst:846 msgid "Default: empty string (not used)." msgstr "" -#: ../../using/configure.rst:754 +#: ../../using/configure.rst:850 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:758 +#: ../../using/configure.rst:854 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:760 +#: ../../using/configure.rst:856 msgid "Default: ``$(PURIFY) $(MAINCC)``." msgstr "" -#: ../../using/configure.rst:764 +#: ../../using/configure.rst:860 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:766 +#: ../../using/configure.rst:862 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:774 +#: ../../using/configure.rst:870 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" "`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of the " "distutils :envvar:`LDFLAGS` once Python is installed (:issue:`35257`)." msgstr "" -#: ../../using/configure.rst:778 +#: ../../using/configure.rst:874 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:780 +#: ../../using/configure.rst:876 msgid "" "the compiler flag `-L` (for setting the search path for libraries). The `-L` " "flags are processed from left to right, and any flags in :envvar:`LDFLAGS` " "would take precedence over user- and package-supplied `-L` flags." msgstr "" -#: ../../using/configure.rst:787 +#: ../../using/configure.rst:883 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:794 +#: ../../using/configure.rst:890 msgid "" "Linker flags, e.g. ``-L`` if you have libraries in a nonstandard " "directory ````." msgstr "" -#: ../../using/configure.rst:803 +#: ../../using/configure.rst:899 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:806 +#: ../../using/configure.rst:902 msgid "Example: ``-lrt``." msgstr "" -#: ../../using/configure.rst:810 +#: ../../using/configure.rst:906 msgid "Command to build a shared library." msgstr "" -#: ../../using/configure.rst:812 +#: ../../using/configure.rst:908 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "" -#: ../../using/configure.rst:816 +#: ../../using/configure.rst:912 msgid "Command to build ``libpython`` shared library." msgstr "" -#: ../../using/configure.rst:818 +#: ../../using/configure.rst:914 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "" -#: ../../using/configure.rst:822 +#: ../../using/configure.rst:918 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "" -#: ../../using/configure.rst:826 +#: ../../using/configure.rst:922 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "" -#: ../../using/configure.rst:832 +#: ../../using/configure.rst:928 msgid "Linker flags used for building the interpreter object files." msgstr "" diff --git a/using/windows.po b/using/windows.po index c734088697..516b06736e 100644 --- a/using/windows.po +++ b/using/windows.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-05 00:24+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -245,11 +245,11 @@ msgid "" "list of available options is shown below." msgstr "" -#: ../../using/windows.rst:140 +#: ../../using/windows.rst:140 ../../using/windows.rst:1022 msgid "Name" msgstr "" -#: ../../using/windows.rst:140 +#: ../../using/windows.rst:140 ../../using/windows.rst:1022 msgid "Description" msgstr "描述" @@ -266,9 +266,9 @@ msgid "Perform a system-wide installation." msgstr "" #: ../../using/windows.rst:142 ../../using/windows.rst:168 -#: ../../using/windows.rst:171 ../../using/windows.rst:180 -#: ../../using/windows.rst:202 ../../using/windows.rst:210 -#: ../../using/windows.rst:213 +#: ../../using/windows.rst:171 ../../using/windows.rst:175 +#: ../../using/windows.rst:184 ../../using/windows.rst:206 +#: ../../using/windows.rst:214 ../../using/windows.rst:217 msgid "0" msgstr "0" @@ -321,7 +321,7 @@ msgstr "DefaultCustomTargetDir" msgid "The default custom install directory displayed in the UI" msgstr "" -#: ../../using/windows.rst:162 ../../using/windows.rst:215 +#: ../../using/windows.rst:162 ../../using/windows.rst:219 msgid "(empty)" msgstr "" @@ -333,12 +333,12 @@ msgstr "AssociateFiles" msgid "Create file associations if the launcher is also installed." msgstr "當執行程序也被安裝時創造檔案關聯" -#: ../../using/windows.rst:165 ../../using/windows.rst:175 -#: ../../using/windows.rst:178 ../../using/windows.rst:182 -#: ../../using/windows.rst:186 ../../using/windows.rst:190 -#: ../../using/windows.rst:192 ../../using/windows.rst:196 -#: ../../using/windows.rst:200 ../../using/windows.rst:204 -#: ../../using/windows.rst:206 ../../using/windows.rst:208 +#: ../../using/windows.rst:165 ../../using/windows.rst:179 +#: ../../using/windows.rst:182 ../../using/windows.rst:186 +#: ../../using/windows.rst:190 ../../using/windows.rst:194 +#: ../../using/windows.rst:196 ../../using/windows.rst:200 +#: ../../using/windows.rst:204 ../../using/windows.rst:208 +#: ../../using/windows.rst:210 ../../using/windows.rst:212 msgid "1" msgstr "1" @@ -356,168 +356,178 @@ msgstr "PrependPath" #: ../../using/windows.rst:171 msgid "" -"Add install and Scripts directories to :envvar:`PATH` and ``.PY`` to :envvar:" -"`PATHEXT`" +"Prepend install and Scripts directories to :envvar:`PATH` and add ``.PY`` " +"to :envvar:`PATHEXT`" msgstr "" #: ../../using/windows.rst:175 +msgid "AppendPath" +msgstr "AppendPath" + +#: ../../using/windows.rst:175 +msgid "" +"Append install and Scripts directories to :envvar:`PATH` and add ``.PY`` " +"to :envvar:`PATHEXT`" +msgstr "" + +#: ../../using/windows.rst:179 msgid "Shortcuts" msgstr "Shortcuts" -#: ../../using/windows.rst:175 +#: ../../using/windows.rst:179 msgid "" "Create shortcuts for the interpreter, documentation and IDLE if installed." msgstr "" -#: ../../using/windows.rst:178 +#: ../../using/windows.rst:182 msgid "Include_doc" msgstr "" -#: ../../using/windows.rst:178 +#: ../../using/windows.rst:182 msgid "Install Python manual" msgstr "安裝Python文件" -#: ../../using/windows.rst:180 +#: ../../using/windows.rst:184 msgid "Include_debug" msgstr "Include_debug" -#: ../../using/windows.rst:180 +#: ../../using/windows.rst:184 msgid "Install debug binaries" msgstr "" -#: ../../using/windows.rst:182 +#: ../../using/windows.rst:186 msgid "Include_dev" msgstr "Include_dev" -#: ../../using/windows.rst:182 +#: ../../using/windows.rst:186 msgid "" "Install developer headers and libraries. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:186 +#: ../../using/windows.rst:190 msgid "Include_exe" msgstr "Include_exe" -#: ../../using/windows.rst:186 +#: ../../using/windows.rst:190 msgid "" "Install :file:`python.exe` and related files. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:190 +#: ../../using/windows.rst:194 msgid "Include_launcher" msgstr "Include_launcher" -#: ../../using/windows.rst:190 +#: ../../using/windows.rst:194 msgid "Install :ref:`launcher`." msgstr "" -#: ../../using/windows.rst:192 +#: ../../using/windows.rst:196 msgid "InstallLauncherAllUsers" msgstr "InstallLauncherAllUsers" -#: ../../using/windows.rst:192 +#: ../../using/windows.rst:196 msgid "" "Installs the launcher for all users. Also requires ``Include_launcher`` to " "be set to 1" msgstr "" -#: ../../using/windows.rst:196 +#: ../../using/windows.rst:200 msgid "Include_lib" msgstr "Include_lib" -#: ../../using/windows.rst:196 +#: ../../using/windows.rst:200 msgid "" "Install standard library and extension modules. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:200 +#: ../../using/windows.rst:204 msgid "Include_pip" msgstr "Include_pip" -#: ../../using/windows.rst:200 +#: ../../using/windows.rst:204 msgid "Install bundled pip and setuptools" msgstr "" -#: ../../using/windows.rst:202 +#: ../../using/windows.rst:206 msgid "Include_symbols" msgstr "Include_symbols" -#: ../../using/windows.rst:202 +#: ../../using/windows.rst:206 msgid "Install debugging symbols (`*`.pdb)" msgstr "" -#: ../../using/windows.rst:204 +#: ../../using/windows.rst:208 msgid "Include_tcltk" msgstr "Include_tcltk" -#: ../../using/windows.rst:204 +#: ../../using/windows.rst:208 msgid "Install Tcl/Tk support and IDLE" msgstr "" -#: ../../using/windows.rst:206 +#: ../../using/windows.rst:210 msgid "Include_test" msgstr "Include_test" -#: ../../using/windows.rst:206 +#: ../../using/windows.rst:210 msgid "Install standard library test suite" msgstr "" -#: ../../using/windows.rst:208 +#: ../../using/windows.rst:212 msgid "Include_tools" msgstr "Include_tools" -#: ../../using/windows.rst:208 +#: ../../using/windows.rst:212 msgid "Install utility scripts" msgstr "" -#: ../../using/windows.rst:210 +#: ../../using/windows.rst:214 msgid "LauncherOnly" msgstr "LauncherOnly" -#: ../../using/windows.rst:210 +#: ../../using/windows.rst:214 msgid "Only installs the launcher. This will override most other options." msgstr "" -#: ../../using/windows.rst:213 +#: ../../using/windows.rst:217 msgid "SimpleInstall" msgstr "SimpleInstall" -#: ../../using/windows.rst:213 +#: ../../using/windows.rst:217 msgid "Disable most install UI" msgstr "" -#: ../../using/windows.rst:215 +#: ../../using/windows.rst:219 msgid "SimpleInstallDescription" msgstr "SimpleInstallDescription" -#: ../../using/windows.rst:215 +#: ../../using/windows.rst:219 msgid "A custom message to display when the simplified install UI is used." msgstr "" -#: ../../using/windows.rst:219 +#: ../../using/windows.rst:223 msgid "" "For example, to silently install a default, system-wide Python installation, " "you could use the following command (from an elevated command prompt)::" msgstr "" -#: ../../using/windows.rst:224 +#: ../../using/windows.rst:228 msgid "" "To allow users to easily install a personal copy of Python without the test " "suite, you could provide a shortcut with the following command. This will " "display a simplified initial page and disallow customization::" msgstr "" -#: ../../using/windows.rst:231 +#: ../../using/windows.rst:235 msgid "" "(Note that omitting the launcher also omits file associations, and is only " "recommended for per-user installs when there is also a system-wide " "installation that included the launcher.)" msgstr "" -#: ../../using/windows.rst:235 +#: ../../using/windows.rst:239 msgid "" "The options listed above can also be provided in a file named ``unattend." "xml`` alongside the executable. This file specifies a list of options and " @@ -526,11 +536,11 @@ msgid "" "strings. This example file sets the same options as the previous example:" msgstr "" -#: ../../using/windows.rst:254 +#: ../../using/windows.rst:258 msgid "Installing Without Downloading" msgstr "當安裝時不下載" -#: ../../using/windows.rst:256 +#: ../../using/windows.rst:260 msgid "" "As some features of Python are not included in the initial installer " "download, selecting those features may require an internet connection. To " @@ -541,7 +551,7 @@ msgid "" "to be performed it is very useful to have a locally cached copy." msgstr "" -#: ../../using/windows.rst:264 +#: ../../using/windows.rst:268 msgid "" "Execute the following command from Command Prompt to download all possible " "required files. Remember to substitute ``python-3.9.0.exe`` for the actual " @@ -549,23 +559,23 @@ msgid "" "avoid collisions between files with the same name." msgstr "" -#: ../../using/windows.rst:273 +#: ../../using/windows.rst:277 msgid "" "You may also specify the ``/quiet`` option to hide the progress display." msgstr "" -#: ../../using/windows.rst:276 +#: ../../using/windows.rst:280 msgid "Modifying an install" msgstr "" -#: ../../using/windows.rst:278 +#: ../../using/windows.rst:282 msgid "" "Once Python has been installed, you can add or remove features through the " "Programs and Features tool that is part of Windows. Select the Python entry " "and choose \"Uninstall/Change\" to open the installer in maintenance mode." msgstr "" -#: ../../using/windows.rst:282 +#: ../../using/windows.rst:286 msgid "" "\"Modify\" allows you to add or remove features by modifying the checkboxes " "- unchanged checkboxes will not install or remove anything. Some options " @@ -573,42 +583,42 @@ msgid "" "these, you will need to remove and then reinstall Python completely." msgstr "" -#: ../../using/windows.rst:287 +#: ../../using/windows.rst:291 msgid "" "\"Repair\" will verify all the files that should be installed using the " "current settings and replace any that have been removed or modified." msgstr "" -#: ../../using/windows.rst:290 +#: ../../using/windows.rst:294 msgid "" "\"Uninstall\" will remove Python entirely, with the exception of the :ref:" "`launcher`, which has its own entry in Programs and Features." msgstr "" -#: ../../using/windows.rst:297 +#: ../../using/windows.rst:301 msgid "The Microsoft Store package" msgstr "" -#: ../../using/windows.rst:301 +#: ../../using/windows.rst:305 msgid "" "The Microsoft Store package is an easily installable Python interpreter that " "is intended mainly for interactive use, for example, by students." msgstr "" -#: ../../using/windows.rst:304 +#: ../../using/windows.rst:308 msgid "" "To install the package, ensure you have the latest Windows 10 updates and " "search the Microsoft Store app for \"Python |version|\". Ensure that the app " "you select is published by the Python Software Foundation, and install it." msgstr "" -#: ../../using/windows.rst:309 +#: ../../using/windows.rst:313 msgid "" "Python will always be available for free on the Microsoft Store. If you are " "asked to pay for it, you have not selected the correct package." msgstr "" -#: ../../using/windows.rst:312 +#: ../../using/windows.rst:316 msgid "" "After installation, Python may be launched by finding it in Start. " "Alternatively, it will be available from any Command Prompt or PowerShell " @@ -616,7 +626,7 @@ msgid "" "``pip`` or ``idle``. IDLE can also be found in Start." msgstr "" -#: ../../using/windows.rst:317 +#: ../../using/windows.rst:321 msgid "" "All three commands are also available with version number suffixes, for " "example, as ``python3.exe`` and ``python3.x.exe`` as well as ``python.exe`` " @@ -627,13 +637,13 @@ msgid "" "of ``python`` is selected." msgstr "" -#: ../../using/windows.rst:325 +#: ../../using/windows.rst:329 msgid "" "Virtual environments can be created with ``python -m venv`` and activated " "and used as normal." msgstr "" -#: ../../using/windows.rst:328 +#: ../../using/windows.rst:332 msgid "" "If you have installed another version of Python and added it to your " "``PATH`` variable, it will be available as ``python.exe`` rather than the " @@ -641,13 +651,13 @@ msgid "" "exe`` or ``python3.x.exe``." msgstr "" -#: ../../using/windows.rst:333 +#: ../../using/windows.rst:337 msgid "" "The ``py.exe`` launcher will detect this Python installation, but will " "prefer installations from the traditional installer." msgstr "" -#: ../../using/windows.rst:336 +#: ../../using/windows.rst:340 msgid "" "To remove Python, open Settings and use Apps and Features, or else find " "Python in Start and right-click to select Uninstall. Uninstalling will " @@ -655,15 +665,15 @@ msgid "" "but will not remove any virtual environments" msgstr "" -#: ../../using/windows.rst:342 +#: ../../using/windows.rst:346 msgid "Known issues" msgstr "" -#: ../../using/windows.rst:345 +#: ../../using/windows.rst:349 msgid "Redirection of local data, registry, and temporary paths" msgstr "" -#: ../../using/windows.rst:347 +#: ../../using/windows.rst:351 msgid "" "Because of restrictions on Microsoft Store apps, Python scripts may not have " "full write access to shared locations such as :envvar:`TEMP` and the " @@ -671,7 +681,7 @@ msgid "" "modify the shared locations, you will need to install the full installer." msgstr "" -#: ../../using/windows.rst:352 +#: ../../using/windows.rst:356 msgid "" "At runtime, Python will use a private copy of well-known Windows folders and " "the registry. For example, if the environment variable :envvar:`%APPDATA%` " @@ -681,7 +691,7 @@ msgid "" "Python.3.8_qbz5n2kfra8p0\\\\LocalCache\\\\Local\\\\`." msgstr "" -#: ../../using/windows.rst:357 +#: ../../using/windows.rst:361 msgid "" "When reading files, Windows will return the file from the private folder, or " "if that does not exist, the real Windows directory. For example reading :" @@ -690,36 +700,36 @@ msgid "" "\\\\package_name\\\\VFS\\\\SystemX86`." msgstr "" -#: ../../using/windows.rst:361 +#: ../../using/windows.rst:365 msgid "" "You can find the real path of any existing file using :func:`os.path." "realpath`:" msgstr "" -#: ../../using/windows.rst:370 +#: ../../using/windows.rst:374 msgid "When writing to the Windows Registry, the following behaviors exist:" msgstr "" -#: ../../using/windows.rst:372 +#: ../../using/windows.rst:376 msgid "" "Reading from ``HKLM\\\\Software`` is allowed and results are merged with " "the :file:`registry.dat` file in the package." msgstr "" -#: ../../using/windows.rst:373 +#: ../../using/windows.rst:377 msgid "" "Writing to ``HKLM\\\\Software`` is not allowed if the corresponding key/" "value exists, i.e. modifying existing keys." msgstr "" -#: ../../using/windows.rst:374 +#: ../../using/windows.rst:378 msgid "" "Writing to ``HKLM\\\\Software`` is allowed as long as a corresponding key/" "value does not exist in the package and the user has the correct access " "permissions." msgstr "" -#: ../../using/windows.rst:377 +#: ../../using/windows.rst:381 msgid "" "For more detail on the technical basis for these limitations, please consult " "Microsoft's documentation on packaged full-trust apps, currently available " @@ -728,11 +738,11 @@ msgid "" "behind-the-scenes>`_" msgstr "" -#: ../../using/windows.rst:386 +#: ../../using/windows.rst:390 msgid "The nuget.org packages" msgstr "" -#: ../../using/windows.rst:390 +#: ../../using/windows.rst:394 msgid "" "The nuget.org package is a reduced size Python environment intended for use " "on continuous integration and build systems that do not have a system-wide " @@ -740,14 +750,14 @@ msgid "" "works perfectly fine for packages containing build-time tools." msgstr "" -#: ../../using/windows.rst:395 +#: ../../using/windows.rst:399 msgid "" "Visit `nuget.org `_ for the most up-to-date " "information on using nuget. What follows is a summary that is sufficient for " "Python developers." msgstr "" -#: ../../using/windows.rst:399 +#: ../../using/windows.rst:403 msgid "" "The ``nuget.exe`` command line tool may be downloaded directly from " "``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " @@ -755,7 +765,7 @@ msgid "" "installed using::" msgstr "" -#: ../../using/windows.rst:407 +#: ../../using/windows.rst:411 msgid "" "To select a particular version, add a ``-Version 3.x.y``. The output " "directory may be changed from ``.``, and the package will be installed into " @@ -765,7 +775,7 @@ msgid "" "directory that contains the Python installation:" msgstr "" -#: ../../using/windows.rst:424 +#: ../../using/windows.rst:428 msgid "" "In general, nuget packages are not upgradeable, and newer versions should be " "installed side-by-side and referenced using the full path. Alternatively, " @@ -773,7 +783,7 @@ msgid "" "will do this automatically if they do not preserve files between builds." msgstr "" -#: ../../using/windows.rst:429 +#: ../../using/windows.rst:433 msgid "" "Alongside the ``tools`` directory is a ``build\\native`` directory. This " "contains a MSBuild properties file ``python.props`` that can be used in a C+" @@ -781,7 +791,7 @@ msgid "" "automatically use the headers and import libraries in your build." msgstr "" -#: ../../using/windows.rst:434 +#: ../../using/windows.rst:438 msgid "" "The package information pages on nuget.org are `www.nuget.org/packages/" "python `_ for the 64-bit version and " @@ -789,18 +799,18 @@ msgid "" "pythonx86>`_ for the 32-bit version." msgstr "" -#: ../../using/windows.rst:443 +#: ../../using/windows.rst:447 msgid "The embeddable package" msgstr "" -#: ../../using/windows.rst:447 +#: ../../using/windows.rst:451 msgid "" "The embedded distribution is a ZIP file containing a minimal Python " "environment. It is intended for acting as part of another application, " "rather than being directly accessed by end-users." msgstr "" -#: ../../using/windows.rst:451 +#: ../../using/windows.rst:455 msgid "" "When extracted, the embedded distribution is (almost) fully isolated from " "the user's system, including environment variables, system registry " @@ -811,7 +821,7 @@ msgid "" "documentation are not included." msgstr "" -#: ../../using/windows.rst:460 +#: ../../using/windows.rst:464 msgid "" "The embedded distribution does not include the `Microsoft C Runtime `_" msgstr "`ActivePython `_" -#: ../../using/windows.rst:528 +#: ../../using/windows.rst:532 msgid "Installer with multi-platform compatibility, documentation, PyWin32" msgstr "" -#: ../../using/windows.rst:532 +#: ../../using/windows.rst:536 msgid "`Anaconda `_" msgstr "`Anaconda `_" -#: ../../using/windows.rst:531 +#: ../../using/windows.rst:535 msgid "" "Popular scientific modules (such as numpy, scipy and pandas) and the " "``conda`` package manager." msgstr "" -#: ../../using/windows.rst:538 +#: ../../using/windows.rst:542 msgid "`Enthought Deployment Manager `_" msgstr "`Enthought Deployment Manager `_" -#: ../../using/windows.rst:535 +#: ../../using/windows.rst:539 msgid "\"The Next Generation Python Environment and Package Manager\"." msgstr "" -#: ../../using/windows.rst:537 +#: ../../using/windows.rst:541 msgid "" "Previously Enthought provided Canopy, but it `reached end of life in 2016 " "`_." msgstr "" -#: ../../using/windows.rst:542 +#: ../../using/windows.rst:546 msgid "`WinPython `_" msgstr "`WinPython `_" -#: ../../using/windows.rst:541 +#: ../../using/windows.rst:545 msgid "" "Windows-specific distribution with prebuilt scientific packages and tools " "for building packages." msgstr "" -#: ../../using/windows.rst:544 +#: ../../using/windows.rst:548 msgid "" "Note that these packages may not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" -#: ../../using/windows.rst:550 +#: ../../using/windows.rst:554 msgid "Configuring Python" msgstr "設定 Python" -#: ../../using/windows.rst:552 +#: ../../using/windows.rst:556 msgid "" "To run Python conveniently from a command prompt, you might consider " "changing some default environment variables in Windows. While the installer " @@ -976,29 +986,29 @@ msgid "" "use multiple versions of Python, consider using the :ref:`launcher`." msgstr "" -#: ../../using/windows.rst:562 +#: ../../using/windows.rst:566 msgid "Excursus: Setting environment variables" msgstr "" -#: ../../using/windows.rst:564 +#: ../../using/windows.rst:568 msgid "" "Windows allows environment variables to be configured permanently at both " "the User level and the System level, or temporarily in a command prompt." msgstr "" -#: ../../using/windows.rst:567 +#: ../../using/windows.rst:571 msgid "" "To temporarily set environment variables, open Command Prompt and use the :" "command:`set` command:" msgstr "" -#: ../../using/windows.rst:576 +#: ../../using/windows.rst:580 msgid "" "These changes will apply to any further commands executed in that console, " "and will be inherited by any applications started from the console." msgstr "" -#: ../../using/windows.rst:579 +#: ../../using/windows.rst:583 msgid "" "Including the variable name within percent signs will expand to the existing " "value, allowing you to add your new value at either the start or the end. " @@ -1007,7 +1017,7 @@ msgid "" "launched." msgstr "" -#: ../../using/windows.rst:585 +#: ../../using/windows.rst:589 msgid "" "To permanently modify the default environment variables, click Start and " "search for 'edit environment variables', or open System properties, :" @@ -1017,20 +1027,20 @@ msgid "" "your machine (i.e. Administrator rights)." msgstr "" -#: ../../using/windows.rst:594 +#: ../../using/windows.rst:598 msgid "" "Windows will concatenate User variables *after* System variables, which may " "cause unexpected results when modifying :envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:597 +#: ../../using/windows.rst:601 msgid "" "The :envvar:`PYTHONPATH` variable is used by all versions of Python, so you " "should not permanently configure it unless the listed paths only include " "code that is compatible with all of your installed Python versions." msgstr "" -#: ../../using/windows.rst:605 +#: ../../using/windows.rst:609 msgid "" "https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" "variables" @@ -1038,11 +1048,11 @@ msgstr "" "https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" "variables" -#: ../../using/windows.rst:605 +#: ../../using/windows.rst:609 msgid "Overview of environment variables on Windows" msgstr "Windows 上的環境變數概要" -#: ../../using/windows.rst:608 +#: ../../using/windows.rst:612 msgid "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/set_1" @@ -1050,11 +1060,11 @@ msgstr "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/set_1" -#: ../../using/windows.rst:608 +#: ../../using/windows.rst:612 msgid "The ``set`` command, for temporarily modifying environment variables" msgstr "" -#: ../../using/windows.rst:610 +#: ../../using/windows.rst:614 msgid "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/setx" @@ -1062,22 +1072,22 @@ msgstr "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/setx" -#: ../../using/windows.rst:611 +#: ../../using/windows.rst:615 msgid "The ``setx`` command, for permanently modifying environment variables" msgstr "" -#: ../../using/windows.rst:617 +#: ../../using/windows.rst:621 msgid "Finding the Python executable" msgstr "" -#: ../../using/windows.rst:621 +#: ../../using/windows.rst:625 msgid "" "Besides using the automatically created start menu entry for the Python " "interpreter, you might want to start Python in the command prompt. The " "installer has an option to set that up for you." msgstr "" -#: ../../using/windows.rst:625 +#: ../../using/windows.rst:629 msgid "" "On the first page of the installer, an option labelled \"Add Python to PATH" "\" may be selected to have the installer add the install location into the :" @@ -1088,7 +1098,7 @@ msgid "" "documentation." msgstr "" -#: ../../using/windows.rst:632 +#: ../../using/windows.rst:636 msgid "" "If you don't enable this option at install time, you can always re-run the " "installer, select Modify, and enable it. Alternatively, you can manually " @@ -1099,24 +1109,24 @@ msgid "" "entries already existed)::" msgstr "" -#: ../../using/windows.rst:645 +#: ../../using/windows.rst:649 msgid "UTF-8 mode" msgstr "" -#: ../../using/windows.rst:649 +#: ../../using/windows.rst:653 msgid "" "Windows still uses legacy encodings for the system encoding (the ANSI Code " "Page). Python uses it for the default encoding of text files (e.g. :func:" -"`locale.getpreferredencoding`)." +"`locale.getencoding`)." msgstr "" -#: ../../using/windows.rst:653 +#: ../../using/windows.rst:657 msgid "" "This may cause issues because UTF-8 is widely used on the internet and most " "Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" -#: ../../using/windows.rst:656 +#: ../../using/windows.rst:660 msgid "" "You can use the :ref:`Python UTF-8 Mode ` to change the default " "text encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode ` is enabled, you can still use " "the system encoding (the ANSI Code Page) via the \"mbcs\" codec." msgstr "" -#: ../../using/windows.rst:665 +#: ../../using/windows.rst:669 msgid "" "Note that adding ``PYTHONUTF8=1`` to the default environment variables will " "affect all Python 3.7+ applications on your system. If you have any Python " @@ -1140,27 +1150,27 @@ msgid "" "utf8`` command line option." msgstr "" -#: ../../using/windows.rst:672 +#: ../../using/windows.rst:676 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" -#: ../../using/windows.rst:675 +#: ../../using/windows.rst:679 msgid "Console I/O including standard I/O (see :pep:`528` for details)." msgstr "" -#: ../../using/windows.rst:676 +#: ../../using/windows.rst:680 msgid "" "The :term:`filesystem encoding ` " "(see :pep:`529` for details)." msgstr "" -#: ../../using/windows.rst:683 +#: ../../using/windows.rst:687 msgid "Python Launcher for Windows" msgstr "" -#: ../../using/windows.rst:687 +#: ../../using/windows.rst:691 msgid "" "The Python launcher for Windows is a utility which aids in locating and " "executing of different Python versions. It allows scripts (or the command-" @@ -1168,7 +1178,7 @@ msgid "" "locate and execute that version." msgstr "" -#: ../../using/windows.rst:692 +#: ../../using/windows.rst:696 msgid "" "Unlike the :envvar:`PATH` variable, the launcher will correctly select the " "most appropriate version of Python. It will prefer per-user installations " @@ -1176,19 +1186,19 @@ msgid "" "most recently installed version." msgstr "" -#: ../../using/windows.rst:697 +#: ../../using/windows.rst:701 msgid "The launcher was originally specified in :pep:`397`." msgstr "" -#: ../../using/windows.rst:700 +#: ../../using/windows.rst:704 msgid "Getting started" msgstr "開始" -#: ../../using/windows.rst:703 +#: ../../using/windows.rst:707 msgid "From the command-line" msgstr "" -#: ../../using/windows.rst:707 +#: ../../using/windows.rst:711 msgid "" "System-wide installations of Python 3.3 and later will put the launcher on " "your :envvar:`PATH`. The launcher is compatible with all available versions " @@ -1196,54 +1206,54 @@ msgid "" "the launcher is available, execute the following command in Command Prompt::" msgstr "" -#: ../../using/windows.rst:714 +#: ../../using/windows.rst:718 msgid "" "You should find that the latest version of Python you have installed is " "started - it can be exited as normal, and any additional command-line " "arguments specified will be sent directly to Python." msgstr "" -#: ../../using/windows.rst:718 +#: ../../using/windows.rst:722 msgid "" "If you have multiple versions of Python installed (e.g., 3.7 and |version|) " "you will have noticed that Python |version| was started - to launch Python " "3.7, try the command::" msgstr "" -#: ../../using/windows.rst:724 +#: ../../using/windows.rst:728 msgid "" "If you want the latest version of Python 2 you have installed, try the " "command::" msgstr "" -#: ../../using/windows.rst:729 +#: ../../using/windows.rst:733 msgid "You should find the latest version of Python 3.x starts." msgstr "" -#: ../../using/windows.rst:731 +#: ../../using/windows.rst:735 msgid "" "If you see the following error, you do not have the launcher installed::" msgstr "" -#: ../../using/windows.rst:736 +#: ../../using/windows.rst:740 msgid "" "Per-user installations of Python do not add the launcher to :envvar:`PATH` " "unless the option was selected on installation." msgstr "" -#: ../../using/windows.rst:739 +#: ../../using/windows.rst:743 msgid "The command::" msgstr "" -#: ../../using/windows.rst:743 +#: ../../using/windows.rst:747 msgid "displays the currently installed version(s) of Python." msgstr "" -#: ../../using/windows.rst:746 +#: ../../using/windows.rst:750 msgid "Virtual environments" msgstr "虛擬環境(Virtual environment)" -#: ../../using/windows.rst:750 +#: ../../using/windows.rst:754 msgid "" "If the launcher is run with no explicit Python version specification, and a " "virtual environment (created with the standard library :mod:`venv` module or " @@ -1253,27 +1263,27 @@ msgid "" "specify the global Python version." msgstr "" -#: ../../using/windows.rst:758 +#: ../../using/windows.rst:762 msgid "From a script" msgstr "" -#: ../../using/windows.rst:760 +#: ../../using/windows.rst:764 msgid "" "Let's create a test Python script - create a file called ``hello.py`` with " "the following contents" msgstr "" -#: ../../using/windows.rst:769 +#: ../../using/windows.rst:773 msgid "From the directory in which hello.py lives, execute the command::" msgstr "" -#: ../../using/windows.rst:773 +#: ../../using/windows.rst:777 msgid "" "You should notice the version number of your latest Python 2.x installation " "is printed. Now try changing the first line to be:" msgstr "" -#: ../../using/windows.rst:780 +#: ../../using/windows.rst:784 msgid "" "Re-executing the command should now print the latest Python 3.x information. " "As with the above command-line examples, you can specify a more explicit " @@ -1282,7 +1292,7 @@ msgid "" "information printed." msgstr "" -#: ../../using/windows.rst:786 +#: ../../using/windows.rst:790 msgid "" "Note that unlike interactive use, a bare \"python\" will use the latest " "version of Python 2.x that you have installed. This is for backward " @@ -1290,11 +1300,11 @@ msgid "" "typically refers to Python 2." msgstr "" -#: ../../using/windows.rst:792 +#: ../../using/windows.rst:796 msgid "From file associations" msgstr "從檔案關聯" -#: ../../using/windows.rst:794 +#: ../../using/windows.rst:798 msgid "" "The launcher should have been associated with Python files (i.e. ``.py``, ``." "pyw``, ``.pyc`` files) when it was installed. This means that when you " @@ -1303,17 +1313,17 @@ msgid "" "have the script specify the version which should be used." msgstr "" -#: ../../using/windows.rst:800 +#: ../../using/windows.rst:804 msgid "" "The key benefit of this is that a single launcher can support multiple " "Python versions at the same time depending on the contents of the first line." msgstr "" -#: ../../using/windows.rst:804 +#: ../../using/windows.rst:808 msgid "Shebang Lines" msgstr "" -#: ../../using/windows.rst:806 +#: ../../using/windows.rst:810 msgid "" "If the first line of a script file starts with ``#!``, it is known as a " "\"shebang\" line. Linux and other Unix like operating systems have native " @@ -1323,34 +1333,34 @@ msgid "" "demonstrate their use." msgstr "" -#: ../../using/windows.rst:813 +#: ../../using/windows.rst:817 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, this launcher supports a number of 'virtual' commands to specify " "which interpreter to use. The supported virtual commands are:" msgstr "" -#: ../../using/windows.rst:817 +#: ../../using/windows.rst:821 msgid "``/usr/bin/env python``" msgstr "``/usr/bin/env python``" -#: ../../using/windows.rst:818 +#: ../../using/windows.rst:822 msgid "``/usr/bin/python``" msgstr "``/usr/bin/python``" -#: ../../using/windows.rst:819 +#: ../../using/windows.rst:823 msgid "``/usr/local/bin/python``" msgstr "``/usr/local/bin/python``" -#: ../../using/windows.rst:820 +#: ../../using/windows.rst:824 msgid "``python``" msgstr "``python``" -#: ../../using/windows.rst:822 +#: ../../using/windows.rst:826 msgid "For example, if the first line of your script starts with" msgstr "" -#: ../../using/windows.rst:828 +#: ../../using/windows.rst:832 msgid "" "The default Python will be located and used. As many Python scripts written " "to work on Unix will already have this line, you should find these scripts " @@ -1359,7 +1369,7 @@ msgid "" "of the shebang lines starting with ``/usr``." msgstr "" -#: ../../using/windows.rst:834 +#: ../../using/windows.rst:838 msgid "" "Any of the above virtual commands can be suffixed with an explicit version " "(either just the major version, or the major and minor version). Furthermore " @@ -1368,45 +1378,55 @@ msgid "" "python 3.7." msgstr "" -#: ../../using/windows.rst:842 +#: ../../using/windows.rst:846 msgid "" "Beginning with python launcher 3.7 it is possible to request 64-bit version " "by the \"-64\" suffix. Furthermore it is possible to specify a major and " "architecture without minor (i.e. ``/usr/bin/python3-64``)." msgstr "" -#: ../../using/windows.rst:846 +#: ../../using/windows.rst:852 +msgid "" +"The \"-64\" suffix is deprecated, and now implies \"any architecture that is " +"not provably i386/32-bit\". To request a specific environment, use the new " +"``-V:`` argument with the complete tag." +msgstr "" + +#: ../../using/windows.rst:857 msgid "" "The ``/usr/bin/env`` form of shebang line has one further special property. " "Before looking for installed Python interpreters, this form will search the " "executable :envvar:`PATH` for a Python executable. This corresponds to the " "behaviour of the Unix ``env`` program, which performs a :envvar:`PATH` " -"search." +"search. If an executable matching the first argument after the ``env`` " +"command cannot be found, it will be handled as described below. " +"Additionally, the environment variable :envvar:`PYLAUNCHER_NO_SEARCH_PATH` " +"may be set (to any value) to skip this additional search." msgstr "" -#: ../../using/windows.rst:852 +#: ../../using/windows.rst:868 msgid "Arguments in shebang lines" msgstr "" -#: ../../using/windows.rst:854 +#: ../../using/windows.rst:870 msgid "" "The shebang lines can also specify additional options to be passed to the " "Python interpreter. For example, if you have a shebang line:" msgstr "" -#: ../../using/windows.rst:861 +#: ../../using/windows.rst:877 msgid "Then Python will be started with the ``-v`` option" msgstr "" -#: ../../using/windows.rst:864 +#: ../../using/windows.rst:880 msgid "Customization" msgstr "" -#: ../../using/windows.rst:867 +#: ../../using/windows.rst:883 msgid "Customization via INI files" msgstr "" -#: ../../using/windows.rst:869 +#: ../../using/windows.rst:885 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " "user's \"application data\" directory (i.e. the directory returned by " @@ -1416,7 +1436,7 @@ msgid "" "launcher (i.e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" -#: ../../using/windows.rst:876 +#: ../../using/windows.rst:892 msgid "" "Customization specified in the \"application directory\" will have " "precedence over the one next to the executable, so a user, who may not have " @@ -1424,11 +1444,11 @@ msgid "" "that global .ini file." msgstr "" -#: ../../using/windows.rst:881 +#: ../../using/windows.rst:897 msgid "Customizing default Python versions" msgstr "" -#: ../../using/windows.rst:883 +#: ../../using/windows.rst:899 msgid "" "In some cases, a version qualifier can be included in a command to dictate " "which version of Python will be used by the command. A version qualifier " @@ -1438,13 +1458,13 @@ msgid "" "\"-32\" or \"-64\"." msgstr "" -#: ../../using/windows.rst:889 +#: ../../using/windows.rst:905 msgid "" "For example, a shebang line of ``#!python`` has no version qualifier, while " "``#!python3`` has a version qualifier which specifies only a major version." msgstr "" -#: ../../using/windows.rst:892 +#: ../../using/windows.rst:908 msgid "" "If no version qualifiers are found in a command, the environment variable :" "envvar:`PY_PYTHON` can be set to specify the default version qualifier. If " @@ -1454,7 +1474,7 @@ msgid "" "launcher included with Python 3.7 or newer.)" msgstr "" -#: ../../using/windows.rst:899 +#: ../../using/windows.rst:915 msgid "" "If no minor version qualifiers are found, the environment variable " "``PY_PYTHON{major}`` (where ``{major}`` is the current major version " @@ -1465,7 +1485,7 @@ msgid "" "version in that family." msgstr "" -#: ../../using/windows.rst:907 +#: ../../using/windows.rst:923 msgid "" "On 64-bit Windows with both 32-bit and 64-bit implementations of the same " "(major.minor) Python version installed, the 64-bit version will always be " @@ -1479,30 +1499,30 @@ msgid "" "suffix can be used on a version specifier to change this behaviour." msgstr "" -#: ../../using/windows.rst:918 +#: ../../using/windows.rst:934 msgid "Examples:" msgstr "範例:" -#: ../../using/windows.rst:920 +#: ../../using/windows.rst:936 msgid "" "If no relevant options are set, the commands ``python`` and ``python2`` will " "use the latest Python 2.x version installed and the command ``python3`` will " "use the latest Python 3.x installed." msgstr "" -#: ../../using/windows.rst:924 +#: ../../using/windows.rst:940 msgid "" "The command ``python3.7`` will not consult any options at all as the " "versions are fully specified." msgstr "" -#: ../../using/windows.rst:927 +#: ../../using/windows.rst:943 msgid "" "If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " "the latest installed Python 3 version." msgstr "" -#: ../../using/windows.rst:930 +#: ../../using/windows.rst:946 msgid "" "If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " "implementation of 3.7 whereas the command ``python3`` will use the latest " @@ -1510,13 +1530,13 @@ msgid "" "specified.)" msgstr "" -#: ../../using/windows.rst:935 +#: ../../using/windows.rst:951 msgid "" "If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " "``python3`` will both use specifically 3.7" msgstr "" -#: ../../using/windows.rst:938 +#: ../../using/windows.rst:954 msgid "" "In addition to environment variables, the same settings can be configured in " "the .INI file used by the launcher. The section in the INI file is called " @@ -1526,85 +1546,200 @@ msgid "" "will override things specified in the INI file." msgstr "" -#: ../../using/windows.rst:945 +#: ../../using/windows.rst:961 msgid "For example:" msgstr "" -#: ../../using/windows.rst:947 +#: ../../using/windows.rst:963 msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" -#: ../../using/windows.rst:954 +#: ../../using/windows.rst:970 msgid "" "Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " "containing:" msgstr "" -#: ../../using/windows.rst:964 +#: ../../using/windows.rst:980 msgid "Diagnostics" msgstr "" -#: ../../using/windows.rst:966 +#: ../../using/windows.rst:982 msgid "" -"If an environment variable ``PYLAUNCH_DEBUG`` is set (to any value), the " -"launcher will print diagnostic information to stderr (i.e. to the console). " -"While this information manages to be simultaneously verbose *and* terse, it " -"should allow you to see what versions of Python were located, why a " -"particular version was chosen and the exact command-line used to execute the " -"target Python." +"If an environment variable :envvar:`PYLAUNCHER_DEBUG` is set (to any value), " +"the launcher will print diagnostic information to stderr (i.e. to the " +"console). While this information manages to be simultaneously verbose *and* " +"terse, it should allow you to see what versions of Python were located, why " +"a particular version was chosen and the exact command-line used to execute " +"the target Python. It is primarily intended for testing and debugging." msgstr "" -#: ../../using/windows.rst:978 -msgid "Finding modules" +#: ../../using/windows.rst:990 +msgid "Dry Run" msgstr "" -#: ../../using/windows.rst:980 +#: ../../using/windows.rst:992 msgid "" -"Python usually stores its library (and thereby your site-packages folder) in " -"the installation directory. So, if you had installed Python to :file:`C:\\" -"\\Python\\\\`, the default library would reside in :file:`C:\\\\Python\\\\Lib" -"\\\\` and third-party modules should be stored in :file:`C:\\\\Python\\\\Lib" -"\\\\site-packages\\\\`." +"If an environment variable :envvar:`PYLAUNCHER_DRYRUN` is set (to any " +"value), the launcher will output the command it would have run, but will not " +"actually launch Python. This may be useful for tools that want to use the " +"launcher to detect and then launch Python directly. Note that the command " +"written to standard output is always encoded using UTF-8, and may not render " +"correctly in the console." msgstr "" -#: ../../using/windows.rst:986 +#: ../../using/windows.rst:1000 +msgid "Install on demand" +msgstr "安裝隨選" + +#: ../../using/windows.rst:1002 msgid "" -"To completely override :data:`sys.path`, create a ``._pth`` file with the " -"same name as the DLL (``python37._pth``) or the executable (``python._pth``) " -"and specify one line for each path to add to :data:`sys.path`. The file " -"based on the DLL name overrides the one based on the executable, which " -"allows paths to be restricted for any program loading the runtime if desired." +"If an environment variable :envvar:`PYLAUNCHER_ALLOW_INSTALL` is set (to any " +"value), and the requested Python version is not installed but is available " +"on the Microsoft Store, the launcher will attempt to install it. This may " +"require user interaction to complete, and you may need to run the command " +"again." msgstr "" -#: ../../using/windows.rst:992 +#: ../../using/windows.rst:1007 msgid "" -"When the file exists, all registry and environment variables are ignored, " -"isolated mode is enabled, and :mod:`site` is not imported unless one line in " -"the file specifies ``import site``. Blank paths and lines starting with " -"``#`` are ignored. Each path may be absolute or relative to the location of " -"the file. Import statements other than to ``site`` are not permitted, and " -"arbitrary code cannot be specified." +"An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the " +"launcher to always try to install Python, even if it is detected. This is " +"mainly intended for testing (and should be used with :envvar:" +"`PYLAUNCHER_DRYRUN`)." +msgstr "" + +#: ../../using/windows.rst:1012 +msgid "Return codes" msgstr "" -#: ../../using/windows.rst:999 +#: ../../using/windows.rst:1014 msgid "" -"Note that ``.pth`` files (without leading underscore) will be processed " -"normally by the :mod:`site` module when ``import site`` has been specified." +"The following exit codes may be returned by the Python launcher. " +"Unfortunately, there is no way to distinguish these from the exit code of " +"Python itself." msgstr "" -#: ../../using/windows.rst:1002 +#: ../../using/windows.rst:1017 +msgid "" +"The names of codes are as used in the sources, and are only for reference. " +"There is no way to access or resolve them apart from reading this page. " +"Entries are listed in alphabetical order of names." +msgstr "" + +#: ../../using/windows.rst:1022 +msgid "Value" +msgstr "" + +#: ../../using/windows.rst:1024 +msgid "RC_BAD_VENV_CFG" +msgstr "" + +#: ../../using/windows.rst:1024 +msgid "107" +msgstr "" + +#: ../../using/windows.rst:1024 +msgid "A :file:`pyvenv.cfg` was found but is corrupt." +msgstr "" + +#: ../../using/windows.rst:1026 +msgid "RC_CREATE_PROCESS" +msgstr "" + +#: ../../using/windows.rst:1026 +msgid "101" +msgstr "" + +#: ../../using/windows.rst:1026 +msgid "Failed to launch Python." +msgstr "" + +#: ../../using/windows.rst:1028 +msgid "RC_INSTALLING" +msgstr "" + +#: ../../using/windows.rst:1028 +msgid "111" +msgstr "" + +#: ../../using/windows.rst:1028 +msgid "" +"An install was started, but the command will need to be re-run after it " +"completes." +msgstr "" + +#: ../../using/windows.rst:1031 +msgid "RC_INTERNAL_ERROR" +msgstr "" + +#: ../../using/windows.rst:1031 +msgid "109" +msgstr "" + +#: ../../using/windows.rst:1031 +msgid "Unexpected error. Please report a bug." +msgstr "" + +#: ../../using/windows.rst:1033 +msgid "RC_NO_COMMANDLINE" +msgstr "" + +#: ../../using/windows.rst:1033 +msgid "108" +msgstr "" + +#: ../../using/windows.rst:1033 +msgid "Unable to obtain command line from the operating system." +msgstr "" + +#: ../../using/windows.rst:1036 +msgid "RC_NO_PYTHON" +msgstr "" + +#: ../../using/windows.rst:1036 +msgid "103" +msgstr "" + +#: ../../using/windows.rst:1036 +msgid "Unable to locate the requested version." +msgstr "" + +#: ../../using/windows.rst:1038 +msgid "RC_NO_VENV_CFG" +msgstr "" + +#: ../../using/windows.rst:1038 +msgid "106" +msgstr "" + +#: ../../using/windows.rst:1038 +msgid "A :file:`pyvenv.cfg` was required but not found." +msgstr "" + +#: ../../using/windows.rst:1046 +msgid "Finding modules" +msgstr "" + +#: ../../using/windows.rst:1048 +msgid "" +"These notes supplement the description at :ref:`sys-path-init` with detailed " +"Windows notes." +msgstr "" + +#: ../../using/windows.rst:1051 msgid "" "When no ``._pth`` file is found, this is how :data:`sys.path` is populated " "on Windows:" msgstr "" -#: ../../using/windows.rst:1005 +#: ../../using/windows.rst:1054 msgid "" "An empty entry is added at the start, which corresponds to the current " "directory." msgstr "" -#: ../../using/windows.rst:1008 +#: ../../using/windows.rst:1057 msgid "" "If the environment variable :envvar:`PYTHONPATH` exists, as described in :" "ref:`using-on-envvars`, its entries are added next. Note that on Windows, " @@ -1612,7 +1747,7 @@ msgid "" "from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" -#: ../../using/windows.rst:1013 +#: ../../using/windows.rst:1062 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -1622,7 +1757,7 @@ msgid "" "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -#: ../../using/windows.rst:1020 +#: ../../using/windows.rst:1069 msgid "" "If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " "\"Python Home\". Otherwise, the path of the main Python executable is used " @@ -1633,31 +1768,31 @@ msgid "" "PythonPath stored in the registry." msgstr "" -#: ../../using/windows.rst:1028 +#: ../../using/windows.rst:1077 msgid "" "If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " "in the environment, and no registry entries can be found, a default path " "with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" -#: ../../using/windows.rst:1032 +#: ../../using/windows.rst:1081 msgid "" "If a ``pyvenv.cfg`` file is found alongside the main executable or in the " "directory one level above the executable, the following variations apply:" msgstr "" -#: ../../using/windows.rst:1035 +#: ../../using/windows.rst:1084 msgid "" "If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " "path is used instead of the path to the main executable when deducing the " "home location." msgstr "" -#: ../../using/windows.rst:1039 +#: ../../using/windows.rst:1088 msgid "The end result of all this is:" msgstr "最終這所有的結果為:" -#: ../../using/windows.rst:1041 +#: ../../using/windows.rst:1090 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " @@ -1665,7 +1800,7 @@ msgid "" "ignored. Other \"application paths\" in the registry are always read." msgstr "" -#: ../../using/windows.rst:1046 +#: ../../using/windows.rst:1095 msgid "" "When Python is hosted in another .exe (different directory, embedded via " "COM, etc), the \"Python Home\" will not be deduced, so the core path from " @@ -1673,20 +1808,20 @@ msgid "" "always read." msgstr "" -#: ../../using/windows.rst:1050 +#: ../../using/windows.rst:1099 msgid "" "If Python can't find its home and there are no registry value (frozen .exe, " "some very strange installation setup) you get a path with some default, but " "relative, paths." msgstr "" -#: ../../using/windows.rst:1054 +#: ../../using/windows.rst:1103 msgid "" "For those who want to bundle Python into their application or distribution, " "the following advice will prevent conflicts with other installations:" msgstr "" -#: ../../using/windows.rst:1057 +#: ../../using/windows.rst:1106 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " @@ -1694,20 +1829,20 @@ msgid "" "listed." msgstr "" -#: ../../using/windows.rst:1062 +#: ../../using/windows.rst:1111 msgid "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " "executable, explicitly call :c:func:`Py_SetPath` or (at least) :c:func:" "`Py_SetProgramName` before :c:func:`Py_Initialize`." msgstr "" -#: ../../using/windows.rst:1066 +#: ../../using/windows.rst:1115 msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -#: ../../using/windows.rst:1069 +#: ../../using/windows.rst:1118 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -1716,7 +1851,7 @@ msgid "" "correctly named ZIP file will be detected instead.)" msgstr "" -#: ../../using/windows.rst:1075 +#: ../../using/windows.rst:1124 msgid "" "These will ensure that the files in a system-wide installation will not take " "precedence over the copy of the standard library bundled with your " @@ -1726,19 +1861,19 @@ msgid "" "packages." msgstr "" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1133 msgid "" "Adds ``._pth`` file support and removes ``applocal`` option from ``pyvenv." "cfg``." msgstr "" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1135 msgid "" "Adds ``pythonXX.zip`` as a potential landmark when directly adjacent to the " "executable." msgstr "" -#: ../../using/windows.rst:1092 +#: ../../using/windows.rst:1141 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " @@ -1746,88 +1881,88 @@ msgid "" "explicitly added to :attr:`sys.meta_path` in the future." msgstr "" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1147 msgid "Additional modules" msgstr "" -#: ../../using/windows.rst:1100 +#: ../../using/windows.rst:1149 msgid "" "Even though Python aims to be portable among all platforms, there are " "features that are unique to Windows. A couple of modules, both in the " "standard library and external, and snippets exist to use these features." msgstr "" -#: ../../using/windows.rst:1104 +#: ../../using/windows.rst:1153 msgid "" "The Windows-specific standard modules are documented in :ref:`mswin-specific-" "services`." msgstr "" -#: ../../using/windows.rst:1108 +#: ../../using/windows.rst:1157 msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1110 +#: ../../using/windows.rst:1159 msgid "" "The `PyWin32 `_ module by Mark Hammond is " "a collection of modules for advanced Windows-specific support. This " "includes utilities for:" msgstr "" -#: ../../using/windows.rst:1114 +#: ../../using/windows.rst:1163 msgid "" "`Component Object Model `_ (COM)" msgstr "" -#: ../../using/windows.rst:1117 +#: ../../using/windows.rst:1166 msgid "Win32 API calls" msgstr "" -#: ../../using/windows.rst:1118 +#: ../../using/windows.rst:1167 msgid "Registry" msgstr "登錄檔(Registry)" -#: ../../using/windows.rst:1119 +#: ../../using/windows.rst:1168 msgid "Event log" msgstr "事件日誌(Event log)" -#: ../../using/windows.rst:1120 +#: ../../using/windows.rst:1169 msgid "" "`Microsoft Foundation Classes `_ (MFC) user interfaces" msgstr "" -#: ../../using/windows.rst:1124 +#: ../../using/windows.rst:1173 msgid "" "`PythonWin `_ is a sample MFC application shipped with PyWin32. " "It is an embeddable IDE with a built-in debugger." msgstr "" -#: ../../using/windows.rst:1131 +#: ../../using/windows.rst:1180 msgid "" "`Win32 How Do I...? `_" msgstr "" "`Win32 How Do I...? `_" -#: ../../using/windows.rst:1131 +#: ../../using/windows.rst:1180 msgid "by Tim Golden" msgstr "由 Tim Golden 所著" -#: ../../using/windows.rst:1133 +#: ../../using/windows.rst:1182 msgid "`Python and COM `_" msgstr "`Python and COM `_" -#: ../../using/windows.rst:1134 +#: ../../using/windows.rst:1183 msgid "by David and Paul Boddie" msgstr "由 David 與 Paul Boddie 所著" -#: ../../using/windows.rst:1138 +#: ../../using/windows.rst:1187 msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1140 +#: ../../using/windows.rst:1189 msgid "" "`cx_Freeze `_ is a :mod:" "`distutils` extension (see :ref:`extending-distutils`) which wraps Python " @@ -1836,11 +1971,11 @@ msgid "" "users to install Python." msgstr "" -#: ../../using/windows.rst:1148 +#: ../../using/windows.rst:1197 msgid "Compiling Python on Windows" msgstr "編譯 Python 在 Windows" -#: ../../using/windows.rst:1150 +#: ../../using/windows.rst:1199 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source `_. You can download " @@ -1848,48 +1983,48 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_." msgstr "" -#: ../../using/windows.rst:1155 +#: ../../using/windows.rst:1204 msgid "" "The source tree contains a build solution and project files for Microsoft " "Visual Studio, which is the compiler used to build the official Python " "releases. These files are in the :file:`PCbuild` directory." msgstr "" -#: ../../using/windows.rst:1159 +#: ../../using/windows.rst:1208 msgid "" "Check :file:`PCbuild/readme.txt` for general information on the build " "process." msgstr "" -#: ../../using/windows.rst:1161 +#: ../../using/windows.rst:1210 msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" -#: ../../using/windows.rst:1165 +#: ../../using/windows.rst:1214 msgid "Other Platforms" msgstr "其他平台" -#: ../../using/windows.rst:1167 +#: ../../using/windows.rst:1216 msgid "" "With ongoing development of Python, some platforms that used to be supported " "earlier are no longer supported (due to the lack of users or developers). " "Check :pep:`11` for details on all unsupported platforms." msgstr "" -#: ../../using/windows.rst:1171 +#: ../../using/windows.rst:1220 msgid "" "`Windows CE `_ is `no longer supported " "`__ since Python 3 (if it " "ever was)." msgstr "" -#: ../../using/windows.rst:1174 +#: ../../using/windows.rst:1223 msgid "" "The `Cygwin `_ installer offers to install the `Python " "interpreter `__ as well" msgstr "" -#: ../../using/windows.rst:1178 +#: ../../using/windows.rst:1227 msgid "" "See `Python for Windows `_ for " "detailed information about platforms with pre-compiled installers." diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index d768050307..842bd199a6 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -182,9 +182,9 @@ msgid "" "Read the rest of :pep:`1` for the details of the PEP editorial process, " "style, and format. PEPs are kept in the Python CVS tree on SourceForge, " "though they're not part of the Python 2.0 distribution, and are also " -"available in HTML form from https://www.python.org/dev/peps/. As of " -"September 2000, there are 25 PEPS, ranging from :pep:`201`, \"Lockstep " -"Iteration\", to PEP 225, \"Elementwise/Objectwise Operators\"." +"available in HTML form from https://peps.python.org/. As of September 2000, " +"there are 25 PEPS, ranging from :pep:`201`, \"Lockstep Iteration\", to PEP " +"225, \"Elementwise/Objectwise Operators\"." msgstr "" #: ../../whatsnew/2.0.rst:141 diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index aaddfcd1bc..b03dcc18bd 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-21 00:21+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -136,7 +136,7 @@ msgstr "" msgid ":pep:`597`, Add optional EncodingWarning" msgstr "" -#: ../../whatsnew/3.10.rst:93 ../../whatsnew/3.10.rst:2051 +#: ../../whatsnew/3.10.rst:93 ../../whatsnew/3.10.rst:2055 msgid "New Features" msgstr "" @@ -1195,8 +1195,8 @@ msgstr "" msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.10.rst:1076 ../../whatsnew/3.10.rst:1200 -#: ../../whatsnew/3.10.rst:1227 ../../whatsnew/3.10.rst:1326 +#: ../../whatsnew/3.10.rst:1076 ../../whatsnew/3.10.rst:1211 +#: ../../whatsnew/3.10.rst:1238 ../../whatsnew/3.10.rst:1337 msgid "" "When a module does not define ``__loader__``, fall back to ``__spec__." "loader``. (Contributed by Brett Cannon in :issue:`42133`.)" @@ -1213,99 +1213,117 @@ msgid "" msgstr "" #: ../../whatsnew/3.10.rst:1086 +msgid "enum" +msgstr "" + +#: ../../whatsnew/3.10.rst:1088 +msgid "" +":class:`Enum` :func:`__repr__` now returns ``enum_name.member_name`` and :" +"func:`__str__` now returns ``member_name``. Stdlib enums available as " +"module constants have a :func:`repr` of ``module_name.member_name``. " +"(Contributed by Ethan Furman in :issue:`40066`.)" +msgstr "" + +#: ../../whatsnew/3.10.rst:1093 +msgid "" +"Add :class:`enum.StrEnum` for enums where all members are strings. " +"(Contributed by Ethan Furman in :issue:`41816`.)" +msgstr "" + +#: ../../whatsnew/3.10.rst:1097 msgid "fileinput" msgstr "fileinput" -#: ../../whatsnew/3.10.rst:1088 +#: ../../whatsnew/3.10.rst:1099 msgid "" "Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" "`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1092 +#: ../../whatsnew/3.10.rst:1103 msgid "" ":func:`fileinput.hook_compressed` now returns :class:`TextIOWrapper` object " "when *mode* is \"r\" and file is compressed, like uncompressed files. " "(Contributed by Inada Naoki in :issue:`5758`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1097 +#: ../../whatsnew/3.10.rst:1108 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.10.rst:1099 +#: ../../whatsnew/3.10.rst:1110 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " "garbage collector collection. (Contributed by Victor Stinner in :issue:" "`44466`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1104 +#: ../../whatsnew/3.10.rst:1115 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.10.rst:1106 +#: ../../whatsnew/3.10.rst:1117 msgid "" "Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" "func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1110 +#: ../../whatsnew/3.10.rst:1121 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.10.rst:1112 +#: ../../whatsnew/3.10.rst:1123 msgid "" "Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" "`~glob.iglob` which allow to specify the root directory for searching. " "(Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1117 +#: ../../whatsnew/3.10.rst:1128 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.10.rst:1119 +#: ../../whatsnew/3.10.rst:1130 msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1122 +#: ../../whatsnew/3.10.rst:1133 msgid "" "The hashlib module has preliminary support for OpenSSL 3.0.0. (Contributed " "by Christian Heimes in :issue:`38820` and other issues.)" msgstr "" -#: ../../whatsnew/3.10.rst:1125 +#: ../../whatsnew/3.10.rst:1136 msgid "" "The pure-Python fallback of :func:`~hashlib.pbkdf2_hmac` is deprecated. In " "the future PBKDF2-HMAC will only be available when Python has been built " "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1131 +#: ../../whatsnew/3.10.rst:1142 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.10.rst:1133 +#: ../../whatsnew/3.10.rst:1144 msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1137 +#: ../../whatsnew/3.10.rst:1148 msgid "IDLE and idlelib" msgstr "" -#: ../../whatsnew/3.10.rst:1139 +#: ../../whatsnew/3.10.rst:1150 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " "hooks were previously ignored. (Contributed by Ken Hilton in :issue:" "`43008`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1143 +#: ../../whatsnew/3.10.rst:1154 msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " @@ -1316,11 +1334,11 @@ msgid "" "`33962`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1151 +#: ../../whatsnew/3.10.rst:1162 msgid "The changes above were backported to a 3.9 maintenance release." msgstr "" -#: ../../whatsnew/3.10.rst:1153 +#: ../../whatsnew/3.10.rst:1164 msgid "" "Add a Shell sidebar. Move the primary prompt ('>>>') to the sidebar. Add " "secondary prompts ('...') to the sidebar. Left click and optional drag " @@ -1331,7 +1349,7 @@ msgid "" "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1162 +#: ../../whatsnew/3.10.rst:1173 msgid "" "Use spaces instead of tabs to indent interactive code. This makes " "interactive code entries 'look right'. Making this feasible was a major " @@ -1339,7 +1357,7 @@ msgid "" "in :issue:`37892`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1167 +#: ../../whatsnew/3.10.rst:1178 msgid "" "Highlight the new :ref:`soft keywords ` :keyword:`match`, :" "keyword:`case `, and :keyword:`_ ` in pattern-" @@ -1348,33 +1366,33 @@ msgid "" "(Contributed by Tal Einat in :issue:`44010`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1173 +#: ../../whatsnew/3.10.rst:1184 msgid "New in 3.10 maintenance releases." msgstr "" -#: ../../whatsnew/3.10.rst:1175 +#: ../../whatsnew/3.10.rst:1186 msgid "" "Apply syntax highlighting to `.pyi` files. (Contributed by Alex Waygood and " "Terry Jan Reedy in :issue:`45447`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1178 +#: ../../whatsnew/3.10.rst:1189 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1182 +#: ../../whatsnew/3.10.rst:1193 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.10.rst:1184 +#: ../../whatsnew/3.10.rst:1195 msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history `_)." msgstr "" -#: ../../whatsnew/3.10.rst:1187 +#: ../../whatsnew/3.10.rst:1198 msgid "" ":ref:`importlib.metadata entry points ` now provide a nicer " "experience for selecting entry points by group and name through a new :class:" @@ -1382,18 +1400,18 @@ msgid "" "docs for more info on the deprecation and usage." msgstr "" -#: ../../whatsnew/3.10.rst:1193 +#: ../../whatsnew/3.10.rst:1204 msgid "" "Added :func:`importlib.metadata.packages_distributions` for resolving top-" "level Python modules and packages to their :class:`importlib.metadata." "Distribution`." msgstr "" -#: ../../whatsnew/3.10.rst:1198 +#: ../../whatsnew/3.10.rst:1209 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.10.rst:1203 +#: ../../whatsnew/3.10.rst:1214 msgid "" "Add :func:`inspect.get_annotations`, which safely computes the annotations " "defined on an object. It works around the quirks of accessing the " @@ -1411,38 +1429,38 @@ msgid "" "`43817`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1219 +#: ../../whatsnew/3.10.rst:1230 msgid "itertools" msgstr "" -#: ../../whatsnew/3.10.rst:1221 +#: ../../whatsnew/3.10.rst:1232 msgid "" "Add :func:`itertools.pairwise()`. (Contributed by Raymond Hettinger in :" "issue:`38200`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1225 +#: ../../whatsnew/3.10.rst:1236 msgid "linecache" msgstr "linecache" -#: ../../whatsnew/3.10.rst:1231 +#: ../../whatsnew/3.10.rst:1242 msgid "os" msgstr "os" -#: ../../whatsnew/3.10.rst:1233 +#: ../../whatsnew/3.10.rst:1244 msgid "" "Add :func:`os.cpu_count()` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1236 +#: ../../whatsnew/3.10.rst:1247 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " "``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" "`41001`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1240 +#: ../../whatsnew/3.10.rst:1251 msgid "" "Add :func:`os.splice()` that allows to move data between two file " "descriptors without copying between kernel address space and user address " @@ -1450,41 +1468,41 @@ msgid "" "by Pablo Galindo in :issue:`41625`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1245 +#: ../../whatsnew/3.10.rst:1256 msgid "" "Add :data:`~os.O_EVTONLY`, :data:`~os.O_FSYNC`, :data:`~os.O_SYMLINK` and :" "data:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Dong-hee Na in :issue:" "`43106`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1250 +#: ../../whatsnew/3.10.rst:1261 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.10.rst:1252 +#: ../../whatsnew/3.10.rst:1263 msgid "" ":func:`os.path.realpath` now accepts a *strict* keyword-only argument. When " "set to ``True``, :exc:`OSError` is raised if a path doesn't exist or a " "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1258 +#: ../../whatsnew/3.10.rst:1269 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.10.rst:1260 +#: ../../whatsnew/3.10.rst:1271 msgid "" "Add slice support to :attr:`PurePath.parents `. " "(Contributed by Joshua Cannon in :issue:`35498`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1263 +#: ../../whatsnew/3.10.rst:1274 msgid "" "Add negative indexing support to :attr:`PurePath.parents `. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1267 +#: ../../whatsnew/3.10.rst:1278 msgid "" "Add :meth:`Path.hardlink_to ` method that " "supersedes :meth:`~pathlib.Path.link_to`. The new method has the same " @@ -1492,7 +1510,7 @@ msgid "" "Gale in :issue:`39950`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1272 +#: ../../whatsnew/3.10.rst:1283 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " @@ -1500,11 +1518,11 @@ msgid "" "`39906`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1278 +#: ../../whatsnew/3.10.rst:1289 msgid "platform" msgstr "platform" -#: ../../whatsnew/3.10.rst:1280 +#: ../../whatsnew/3.10.rst:1291 msgid "" "Add :func:`platform.freedesktop_os_release()` to retrieve operation system " "identification from `freedesktop.org os-release ` section for " "more information." msgstr "" -#: ../../whatsnew/3.10.rst:1625 +#: ../../whatsnew/3.10.rst:1629 msgid "" "Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" "`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " "Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1629 +#: ../../whatsnew/3.10.rst:1633 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " "documented as deprecated since Python 3.6, but will now also trigger a :exc:" @@ -2030,21 +2038,21 @@ msgid "" "(Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1635 +#: ../../whatsnew/3.10.rst:1639 msgid "" ":meth:`zimport.zipimporter.load_module` has been deprecated in preference " "for :meth:`~zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " "in :issue:`26131`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1639 +#: ../../whatsnew/3.10.rst:1643 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " "now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." "exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1644 +#: ../../whatsnew/3.10.rst:1648 msgid "" "The use of :meth:`importlib.abc.MetaPathFinder.find_module` and :meth:" "`importlib.abc.PathEntryFinder.find_module` by the import system now trigger " @@ -2054,7 +2062,7 @@ msgid "" "porting. (Contributed by Brett Cannon in :issue:`42134`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1653 +#: ../../whatsnew/3.10.rst:1657 msgid "" "The use of :meth:`importlib.abc.PathEntryFinder.find_loader` by the import " "system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." @@ -2063,7 +2071,7 @@ msgid "" "`43672`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1659 +#: ../../whatsnew/3.10.rst:1663 msgid "" "The various implementations of :meth:`importlib.abc.MetaPathFinder." "find_module` ( :meth:`importlib.machinery.BuiltinImporter.find_module`, :" @@ -2078,7 +2086,7 @@ msgid "" "Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1674 +#: ../../whatsnew/3.10.rst:1678 msgid "" ":class:`importlib.abc.Finder` is deprecated (including its sole method, :" "meth:`~importlib.abc.Finder.find_module`). Both :class:`importlib.abc." @@ -2087,7 +2095,7 @@ msgid "" "appropriate instead. (Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1681 +#: ../../whatsnew/3.10.rst:1685 msgid "" "The deprecations of :mod:`imp`, :func:`importlib.find_loader`, :func:" "`importlib.util.set_package_wrapper`, :func:`importlib.util." @@ -2098,7 +2106,7 @@ msgid "" "Brett Cannon in :issue:`43720`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1691 +#: ../../whatsnew/3.10.rst:1695 msgid "" "The import system now uses the ``__spec__`` attribute on modules before " "falling back on :meth:`~importlib.abc.Loader.module_repr` for a module's " @@ -2106,7 +2114,7 @@ msgid "" "for Python 3.12. (Contributed by Brett Cannon in :issue:`42137`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1697 +#: ../../whatsnew/3.10.rst:1701 msgid "" ":meth:`importlib.abc.Loader.module_repr`, :meth:`importlib.machinery." "FrozenLoader.module_repr`, and :meth:`importlib.machinery.BuiltinLoader." @@ -2114,7 +2122,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1703 +#: ../../whatsnew/3.10.rst:1707 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " @@ -2122,7 +2130,7 @@ msgid "" "issue:`42264`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1708 +#: ../../whatsnew/3.10.rst:1712 msgid "" ":func:`asyncio.get_event_loop` now emits a deprecation warning if there is " "no running event loop. In the future it will be an alias of :func:`~asyncio." @@ -2136,7 +2144,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`39529`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1721 +#: ../../whatsnew/3.10.rst:1725 msgid "" "The undocumented built-in function ``sqlite3.enable_shared_cache`` is now " "deprecated, scheduled for removal in Python 3.12. Its use is strongly " @@ -2146,68 +2154,68 @@ msgid "" "query parameter. (Contributed by Erlend E. Aasland in :issue:`24464`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1729 +#: ../../whatsnew/3.10.rst:1733 msgid "The following ``threading`` methods are now deprecated:" msgstr "" -#: ../../whatsnew/3.10.rst:1731 +#: ../../whatsnew/3.10.rst:1735 msgid "``threading.currentThread`` => :func:`threading.current_thread`" msgstr "``threading.currentThread`` => :func:`threading.current_thread`" -#: ../../whatsnew/3.10.rst:1733 +#: ../../whatsnew/3.10.rst:1737 msgid "``threading.activeCount`` => :func:`threading.active_count`" msgstr "``threading.activeCount`` => :func:`threading.active_count`" -#: ../../whatsnew/3.10.rst:1735 +#: ../../whatsnew/3.10.rst:1739 msgid "" "``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" msgstr "" "``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" -#: ../../whatsnew/3.10.rst:1738 +#: ../../whatsnew/3.10.rst:1742 msgid "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" msgstr "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" -#: ../../whatsnew/3.10.rst:1740 +#: ../../whatsnew/3.10.rst:1744 msgid "``threading.Thread.setName`` => :attr:`threading.Thread.name`" msgstr "``threading.Thread.setName`` => :attr:`threading.Thread.name`" -#: ../../whatsnew/3.10.rst:1742 +#: ../../whatsnew/3.10.rst:1746 msgid "``threading.thread.getName`` => :attr:`threading.Thread.name`" msgstr "``threading.thread.getName`` => :attr:`threading.Thread.name`" -#: ../../whatsnew/3.10.rst:1744 +#: ../../whatsnew/3.10.rst:1748 msgid "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" msgstr "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" -#: ../../whatsnew/3.10.rst:1746 +#: ../../whatsnew/3.10.rst:1750 msgid "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" msgstr "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" -#: ../../whatsnew/3.10.rst:1748 +#: ../../whatsnew/3.10.rst:1752 msgid "(Contributed by Jelle Zijlstra in :gh:`87889`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1750 +#: ../../whatsnew/3.10.rst:1754 msgid "" ":meth:`pathlib.Path.link_to` is deprecated and slated for removal in Python " "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1754 +#: ../../whatsnew/3.10.rst:1758 msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1757 +#: ../../whatsnew/3.10.rst:1761 msgid "" "The following :mod:`ssl` features have been deprecated since Python 3.6, " "Python 3.7, or OpenSSL 1.1.0 and will be removed in 3.11:" msgstr "" -#: ../../whatsnew/3.10.rst:1760 +#: ../../whatsnew/3.10.rst:1764 msgid "" ":data:`~ssl.OP_NO_SSLv2`, :data:`~ssl.OP_NO_SSLv3`, :data:`~ssl." "OP_NO_TLSv1`, :data:`~ssl.OP_NO_TLSv1_1`, :data:`~ssl.OP_NO_TLSv1_2`, and :" @@ -2215,7 +2223,7 @@ msgid "" "minimum_version` and :attr:`sslSSLContext.maximum_version`." msgstr "" -#: ../../whatsnew/3.10.rst:1766 +#: ../../whatsnew/3.10.rst:1770 msgid "" ":data:`~ssl.PROTOCOL_SSLv2`, :data:`~ssl.PROTOCOL_SSLv3`, :data:`~ssl." "PROTOCOL_SSLv23`, :data:`~ssl.PROTOCOL_TLSv1`, :data:`~ssl." @@ -2224,26 +2232,26 @@ msgid "" "and :data:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" -#: ../../whatsnew/3.10.rst:1772 +#: ../../whatsnew/3.10.rst:1776 msgid "" ":func:`~ssl.wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" msgstr "" -#: ../../whatsnew/3.10.rst:1774 +#: ../../whatsnew/3.10.rst:1778 msgid ":func:`~ssl.match_hostname`" msgstr ":func:`~ssl.match_hostname`" -#: ../../whatsnew/3.10.rst:1776 +#: ../../whatsnew/3.10.rst:1780 msgid ":func:`~ssl.RAND_pseudo_bytes`, :func:`~ssl.RAND_egd`" msgstr ":func:`~ssl.RAND_pseudo_bytes`, :func:`~ssl.RAND_egd`" -#: ../../whatsnew/3.10.rst:1778 +#: ../../whatsnew/3.10.rst:1782 msgid "" "NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." "SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" -#: ../../whatsnew/3.10.rst:1781 +#: ../../whatsnew/3.10.rst:1785 msgid "" "The threading debug (:envvar:`PYTHONTHREADDEBUG` environment variable) is " "deprecated in Python 3.10 and will be removed in Python 3.12. This feature " @@ -2251,7 +2259,7 @@ msgid "" "Victor Stinner in :issue:`44584`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1786 +#: ../../whatsnew/3.10.rst:1790 msgid "" "Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" "exc:`DeprecationWarning`. These submodules will be removed in a future " @@ -2260,11 +2268,11 @@ msgid "" "Rittau in :issue:`38291`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1795 ../../whatsnew/3.10.rst:2220 +#: ../../whatsnew/3.10.rst:1799 ../../whatsnew/3.10.rst:2224 msgid "Removed" msgstr "" -#: ../../whatsnew/3.10.rst:1797 +#: ../../whatsnew/3.10.rst:1801 msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " @@ -2272,7 +2280,7 @@ msgid "" "`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1803 +#: ../../whatsnew/3.10.rst:1807 msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " @@ -2281,7 +2289,7 @@ msgid "" "`31844`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1809 +#: ../../whatsnew/3.10.rst:1813 msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " @@ -2289,7 +2297,7 @@ msgid "" "`42157`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1814 +#: ../../whatsnew/3.10.rst:1818 msgid "" "Removed the ``parser`` module, which was deprecated in 3.9 due to the switch " "to the new PEG parser, as well as all the C source and header files that " @@ -2297,7 +2305,7 @@ msgid "" "``graminit.h`` and ``grammar.h``." msgstr "" -#: ../../whatsnew/3.10.rst:1819 +#: ../../whatsnew/3.10.rst:1823 msgid "" "Removed the Public C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -2305,7 +2313,7 @@ msgid "" "deprecated in 3.9 due to the switch to the new PEG parser." msgstr "" -#: ../../whatsnew/3.10.rst:1824 +#: ../../whatsnew/3.10.rst:1828 msgid "" "Removed the ``formatter`` module, which was deprecated in Python 3.4. It is " "somewhat obsolete, little used, and not tested. It was originally scheduled " @@ -2315,71 +2323,71 @@ msgid "" "`42299`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1831 +#: ../../whatsnew/3.10.rst:1835 msgid "" "Removed the :c:func:`PyModule_GetWarningsModule` function that was useless " "now due to the _warnings module was converted to a builtin module in 2.6. " "(Contributed by Hai Shi in :issue:`42599`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1835 +#: ../../whatsnew/3.10.rst:1839 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " "the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" "`37324`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1839 +#: ../../whatsnew/3.10.rst:1843 msgid "" "The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" "doc:`high-level API <../library/asyncio-api-index>` following deprecation in " "Python 3.8. The motivation behind this change is multifold:" msgstr "" -#: ../../whatsnew/3.10.rst:1843 +#: ../../whatsnew/3.10.rst:1847 msgid "This simplifies the high-level API." msgstr "" -#: ../../whatsnew/3.10.rst:1844 +#: ../../whatsnew/3.10.rst:1848 msgid "" "The functions in the high-level API have been implicitly getting the current " "thread's running event loop since Python 3.7. There isn't a need to pass " "the event loop to the API in most normal use cases." msgstr "" -#: ../../whatsnew/3.10.rst:1847 +#: ../../whatsnew/3.10.rst:1851 msgid "" "Event loop passing is error-prone especially when dealing with loops running " "in different threads." msgstr "" -#: ../../whatsnew/3.10.rst:1850 +#: ../../whatsnew/3.10.rst:1854 msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" -#: ../../whatsnew/3.10.rst:1853 ../../whatsnew/3.10.rst:1925 +#: ../../whatsnew/3.10.rst:1857 ../../whatsnew/3.10.rst:1929 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1858 ../../whatsnew/3.10.rst:2145 +#: ../../whatsnew/3.10.rst:1862 ../../whatsnew/3.10.rst:2149 msgid "Porting to Python 3.10" msgstr "" -#: ../../whatsnew/3.10.rst:1860 +#: ../../whatsnew/3.10.rst:1864 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.10.rst:1865 +#: ../../whatsnew/3.10.rst:1869 msgid "Changes in the Python syntax" msgstr "" -#: ../../whatsnew/3.10.rst:1867 +#: ../../whatsnew/3.10.rst:1871 msgid "" "Deprecation warning is now emitted when compiling previously valid syntax if " "the numeric literal is immediately followed by a keyword (like in ``0in " @@ -2389,11 +2397,11 @@ msgid "" "following keyword. (Contributed by Serhiy Storchaka in :issue:`43833`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1878 +#: ../../whatsnew/3.10.rst:1882 msgid "Changes in the Python API" msgstr "" -#: ../../whatsnew/3.10.rst:1880 +#: ../../whatsnew/3.10.rst:1884 msgid "" "The *etype* parameters of the :func:`~traceback.format_exception`, :func:" "`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " @@ -2401,7 +2409,7 @@ msgid "" "(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1886 +#: ../../whatsnew/3.10.rst:1890 msgid "" ":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." "register` fails, its exception is now logged. Previously, only some " @@ -2409,7 +2417,7 @@ msgid "" "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1892 +#: ../../whatsnew/3.10.rst:1896 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2422,7 +2430,7 @@ msgid "" "`42195`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1902 +#: ../../whatsnew/3.10.rst:1906 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " @@ -2430,29 +2438,29 @@ msgid "" "`42393`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1907 +#: ../../whatsnew/3.10.rst:1911 msgid "" "The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" "doc:`high-level API <../library/asyncio-api-index>` following deprecation in " "Python 3.8." msgstr "" -#: ../../whatsnew/3.10.rst:1911 +#: ../../whatsnew/3.10.rst:1915 msgid "A coroutine that currently looks like this::" msgstr "" -#: ../../whatsnew/3.10.rst:1916 +#: ../../whatsnew/3.10.rst:1920 msgid "Should be replaced with this::" msgstr "" -#: ../../whatsnew/3.10.rst:1921 +#: ../../whatsnew/3.10.rst:1925 msgid "" "If ``foo()`` was specifically designed *not* to run in the current thread's " "running event loop (e.g. running in another thread's event loop), consider " "using :func:`asyncio.run_coroutine_threadsafe` instead." msgstr "" -#: ../../whatsnew/3.10.rst:1928 +#: ../../whatsnew/3.10.rst:1932 msgid "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " @@ -2463,11 +2471,11 @@ msgid "" "`42990`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1937 +#: ../../whatsnew/3.10.rst:1941 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.10.rst:1939 +#: ../../whatsnew/3.10.rst:1943 msgid "" "The C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -2476,31 +2484,31 @@ msgid "" "PEG parser." msgstr "" -#: ../../whatsnew/3.10.rst:1945 +#: ../../whatsnew/3.10.rst:1949 msgid "" "Source should be now be compiled directly to a code object using, for " "example, :c:func:`Py_CompileString`. The resulting code object can then be " "evaluated using, for example, :c:func:`PyEval_EvalCode`." msgstr "" -#: ../../whatsnew/3.10.rst:1949 +#: ../../whatsnew/3.10.rst:1953 msgid "Specifically:" msgstr "" -#: ../../whatsnew/3.10.rst:1951 +#: ../../whatsnew/3.10.rst:1955 msgid "" "A call to ``PyParser_SimpleParseStringFlags`` followed by ``PyNode_Compile`` " "can be replaced by calling :c:func:`Py_CompileString`." msgstr "" -#: ../../whatsnew/3.10.rst:1954 +#: ../../whatsnew/3.10.rst:1958 msgid "" "There is no direct replacement for ``PyParser_SimpleParseFileFlags``. To " "compile code from a ``FILE *`` argument, you will need to read the file in C " "and pass the resulting buffer to :c:func:`Py_CompileString`." msgstr "" -#: ../../whatsnew/3.10.rst:1958 +#: ../../whatsnew/3.10.rst:1962 msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " @@ -2509,7 +2517,7 @@ msgid "" "(Declarations and error handling are omitted.) ::" msgstr "" -#: ../../whatsnew/3.10.rst:1971 +#: ../../whatsnew/3.10.rst:1975 msgid "" "For ``FrameObject`` objects, the ``f_lasti`` member now represents a " "wordcode offset instead of a simple offset into the bytecode string. This " @@ -2519,53 +2527,53 @@ msgid "" "considered stable: please use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -#: ../../whatsnew/3.10.rst:1979 +#: ../../whatsnew/3.10.rst:1983 msgid "CPython bytecode changes" msgstr "" -#: ../../whatsnew/3.10.rst:1981 +#: ../../whatsnew/3.10.rst:1985 msgid "" "The ``MAKE_FUNCTION`` instruction now accepts either a dict or a tuple of " "strings as the function's annotations. (Contributed by Yurii Karabas and " "Inada Naoki in :issue:`42202`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1986 +#: ../../whatsnew/3.10.rst:1990 msgid "Build Changes" msgstr "" -#: ../../whatsnew/3.10.rst:1988 +#: ../../whatsnew/3.10.rst:1992 msgid "" ":pep:`644`: Python now requires OpenSSL 1.1.1 or newer. OpenSSL 1.0.2 is no " "longer supported. (Contributed by Christian Heimes in :issue:`43669`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1992 +#: ../../whatsnew/3.10.rst:1996 msgid "" "The C99 functions :c:func:`snprintf` and :c:func:`vsnprintf` are now " "required to build Python. (Contributed by Victor Stinner in :issue:`36020`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1996 +#: ../../whatsnew/3.10.rst:2000 msgid "" ":mod:`sqlite3` requires SQLite 3.7.15 or higher. (Contributed by Sergey " "Fedoseev and Erlend E. Aasland in :issue:`40744` and :issue:`40810`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1999 +#: ../../whatsnew/3.10.rst:2003 msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2002 +#: ../../whatsnew/3.10.rst:2006 msgid "" "Add :option:`--disable-test-modules` option to the ``configure`` script: " "don't build nor install test modules. (Contributed by Xavier de Gaye, Thomas " "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2006 +#: ../../whatsnew/3.10.rst:2010 msgid "" "Add :option:`--with-wheel-pkg-dir=PATH option <--with-wheel-pkg-dir>` to the " "``./configure`` script. If specified, the :mod:`ensurepip` module looks for " @@ -2574,7 +2582,7 @@ msgid "" "packages." msgstr "" -#: ../../whatsnew/3.10.rst:2012 +#: ../../whatsnew/3.10.rst:2016 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" @@ -2582,31 +2590,31 @@ msgid "" "_bundled`` package." msgstr "" -#: ../../whatsnew/3.10.rst:2017 +#: ../../whatsnew/3.10.rst:2021 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2019 +#: ../../whatsnew/3.10.rst:2023 msgid "" "Add a new :option:`configure --without-static-libpython option <--without-" "static-libpython>` to not build the ``libpythonMAJOR.MINOR.a`` static " "library and not install the ``python.o`` object file." msgstr "" -#: ../../whatsnew/3.10.rst:2023 +#: ../../whatsnew/3.10.rst:2027 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2025 +#: ../../whatsnew/3.10.rst:2029 msgid "" "The ``configure`` script now uses the ``pkg-config`` utility, if available, " "to detect the location of Tcl/Tk headers and libraries. As before, those " -"locations can be explicitly specified with the :option:`--with-tcltk-" -"includes` and :option:`--with-tcltk-libs` configuration options. " -"(Contributed by Manolis Stamatogiannakis in :issue:`42603`.)" +"locations can be explicitly specified with the ``--with-tcltk-includes`` and " +"``--with-tcltk-libs`` configuration options. (Contributed by Manolis " +"Stamatogiannakis in :issue:`42603`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2031 +#: ../../whatsnew/3.10.rst:2035 msgid "" "Add :option:`--with-openssl-rpath` option to ``configure`` script. The " "option simplifies building Python with a custom OpenSSL installation, e.g. " @@ -2614,15 +2622,15 @@ msgid "" "(Contributed by Christian Heimes in :issue:`43466`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2038 +#: ../../whatsnew/3.10.rst:2042 msgid "C API Changes" msgstr "" -#: ../../whatsnew/3.10.rst:2041 +#: ../../whatsnew/3.10.rst:2045 msgid "PEP 652: Maintaining the Stable ABI" msgstr "" -#: ../../whatsnew/3.10.rst:2043 +#: ../../whatsnew/3.10.rst:2047 msgid "" "The Stable ABI (Application Binary Interface) for extension modules or " "embedding Python is now explicitly defined. :ref:`stable` describes C API " @@ -2630,25 +2638,25 @@ msgid "" "ABI." msgstr "" -#: ../../whatsnew/3.10.rst:2048 +#: ../../whatsnew/3.10.rst:2052 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2053 +#: ../../whatsnew/3.10.rst:2057 msgid "" "The result of :c:func:`PyNumber_Index` now always has exact type :class:" "`int`. Previously, the result could have been an instance of a subclass of " "``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2057 +#: ../../whatsnew/3.10.rst:2061 msgid "" "Add a new :c:member:`~PyConfig.orig_argv` member to the :c:type:`PyConfig` " "structure: the list of the original command line arguments passed to the " "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2062 +#: ../../whatsnew/3.10.rst:2066 msgid "" "The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" "`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " @@ -2656,72 +2664,72 @@ msgid "" "time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2068 +#: ../../whatsnew/3.10.rst:2072 msgid "" "Add a :c:func:`PyCodec_Unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2072 +#: ../../whatsnew/3.10.rst:2076 msgid "" "The :c:func:`PyIter_Send` function was added to allow sending value into " "iterator without raising ``StopIteration`` exception. (Contributed by " "Vladimir Matveev in :issue:`41756`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2076 +#: ../../whatsnew/3.10.rst:2080 msgid "" "Add :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API. (Contributed by " "Alex Gaynor in :issue:`41784`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2079 +#: ../../whatsnew/3.10.rst:2083 msgid "" "Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" "`PyModule_AddObject` but don't steal a reference to the value on success. " "(Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2084 +#: ../../whatsnew/3.10.rst:2088 msgid "" "Add :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the " "reference count of an object and return the object. (Contributed by Victor " "Stinner in :issue:`42262`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2088 +#: ../../whatsnew/3.10.rst:2092 msgid "" "The :c:func:`PyType_FromSpecWithBases` and :c:func:" "`PyType_FromModuleAndSpec` functions now accept a single class as the " "*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2092 +#: ../../whatsnew/3.10.rst:2096 msgid "" "The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` " "slot. (Contributed by Hai Shi in :issue:`41832`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2096 +#: ../../whatsnew/3.10.rst:2100 msgid "" "The :c:func:`PyType_GetSlot` function can accept :ref:`static types `. (Contributed by Hai Shi and Petr Viktorin in :issue:`41073`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2100 +#: ../../whatsnew/3.10.rst:2104 msgid "" "Add a new :c:func:`PySet_CheckExact` function to the C-API to check if an " "object is an instance of :class:`set` but not an instance of a subtype. " "(Contributed by Pablo Galindo in :issue:`43277`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2104 +#: ../../whatsnew/3.10.rst:2108 msgid "" "Add :c:func:`PyErr_SetInterruptEx` which allows passing a signal number to " "simulate. (Contributed by Antoine Pitrou in :issue:`43356`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2108 +#: ../../whatsnew/3.10.rst:2112 msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " @@ -2734,14 +2742,14 @@ msgid "" "`36465`)." msgstr "" -#: ../../whatsnew/3.10.rst:2118 +#: ../../whatsnew/3.10.rst:2122 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " "special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" "issue:`43688`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2122 +#: ../../whatsnew/3.10.rst:2126 msgid "" "Add the :c:func:`Py_Is(x, y) ` function to test if the *x* object is " "the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" @@ -2751,7 +2759,7 @@ msgid "" "`43753`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2129 +#: ../../whatsnew/3.10.rst:2133 msgid "" "Add new functions to control the garbage collector from C code: :c:func:" "`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " @@ -2759,20 +2767,20 @@ msgid "" "collector from C code without having to import the :mod:`gc` module." msgstr "" -#: ../../whatsnew/3.10.rst:2136 +#: ../../whatsnew/3.10.rst:2140 msgid "" "Add a new :c:data:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow " "creating type instances. (Contributed by Victor Stinner in :issue:`43916`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2140 +#: ../../whatsnew/3.10.rst:2144 msgid "" "Add a new :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating " "immutable type objects: type attributes cannot be set nor deleted. " "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2147 +#: ../../whatsnew/3.10.rst:2151 msgid "" "The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" "`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " @@ -2781,7 +2789,7 @@ msgid "" "`353`. (Contributed by Victor Stinner in :issue:`40943`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2154 +#: ../../whatsnew/3.10.rst:2158 msgid "" "Since :c:func:`Py_REFCNT()` is changed to the inline static function, " "``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, " @@ -2789,18 +2797,18 @@ msgid "" "For backward compatibility, this macro can be used::" msgstr "" -#: ../../whatsnew/3.10.rst:2163 +#: ../../whatsnew/3.10.rst:2167 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2165 +#: ../../whatsnew/3.10.rst:2169 msgid "" "Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed " "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2169 +#: ../../whatsnew/3.10.rst:2173 msgid "" "``PyUnicode_FromUnicode(NULL, size)`` and " "``PyUnicode_FromStringAndSize(NULL, size)`` raise ``DeprecationWarning`` " @@ -2808,14 +2816,14 @@ msgid "" "data. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2174 +#: ../../whatsnew/3.10.rst:2178 msgid "" "The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API " "``unicodedata.ucnhash_CAPI`` has been moved to the internal C API. " "(Contributed by Victor Stinner in :issue:`42157`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2178 +#: ../../whatsnew/3.10.rst:2182 msgid "" ":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" "func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" @@ -2826,7 +2834,7 @@ msgid "" "issue:`42260`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2186 +#: ../../whatsnew/3.10.rst:2190 msgid "" ":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" "`PyCell_SET` macros can no longer be used as l-value or r-value. For " @@ -2836,7 +2844,7 @@ msgid "" "and Victor Stinner in :issue:`30459`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2193 +#: ../../whatsnew/3.10.rst:2197 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " "``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." @@ -2847,7 +2855,7 @@ msgid "" "Nicholas Sim in :issue:`35134`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2201 +#: ../../whatsnew/3.10.rst:2205 msgid "" "Use the :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:data:`Py_TPFLAGS_HEAPTYPE` to decide if a " @@ -2856,85 +2864,85 @@ msgid "" "issue:`43908`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2207 +#: ../../whatsnew/3.10.rst:2211 msgid "" "The undocumented function ``Py_FrozenMain`` has been removed from the " "limited API. The function is mainly useful for custom builds of Python. " "(Contributed by Petr Viktorin in :issue:`26241`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2214 +#: ../../whatsnew/3.10.rst:2218 msgid "" "The ``PyUnicode_InternImmortal()`` function is now deprecated and will be " "removed in Python 3.12: use :c:func:`PyUnicode_InternInPlace` instead. " "(Contributed by Victor Stinner in :issue:`41692`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2222 +#: ../../whatsnew/3.10.rst:2226 msgid "" "Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings. " "(Contributed by Inada Naoki in :issue:`41123`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2225 +#: ../../whatsnew/3.10.rst:2229 msgid "" "``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" "`PyUnicode_GET_LENGTH`" msgstr "" -#: ../../whatsnew/3.10.rst:2227 +#: ../../whatsnew/3.10.rst:2231 msgid "" "``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" "`PyUnicode_FromFormat`" msgstr "" -#: ../../whatsnew/3.10.rst:2229 +#: ../../whatsnew/3.10.rst:2233 msgid "" "``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" "`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -#: ../../whatsnew/3.10.rst:2231 +#: ../../whatsnew/3.10.rst:2235 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" msgstr "" -#: ../../whatsnew/3.10.rst:2232 +#: ../../whatsnew/3.10.rst:2236 msgid "``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`" msgstr "" -#: ../../whatsnew/3.10.rst:2233 +#: ../../whatsnew/3.10.rst:2237 msgid "" "``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" "`PyUnicode_FindChar`" msgstr "" -#: ../../whatsnew/3.10.rst:2236 +#: ../../whatsnew/3.10.rst:2240 msgid "" "Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs. " "(Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2239 +#: ../../whatsnew/3.10.rst:2243 msgid "" "Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" "`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2242 +#: ../../whatsnew/3.10.rst:2246 msgid "" "Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" "`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " "by Inada Naoki in :issue:`41103`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2246 +#: ../../whatsnew/3.10.rst:2250 msgid "" "Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by " "``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure. " "(Contributed by Victor Stinner in :issue:`41834`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2250 +#: ../../whatsnew/3.10.rst:2254 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " "``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" @@ -2942,14 +2950,14 @@ msgid "" "issue:`41936`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2255 +#: ../../whatsnew/3.10.rst:2259 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " "Python already implicitly installs signal handlers: see :c:member:`PyConfig." "install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2260 +#: ../../whatsnew/3.10.rst:2264 msgid "" "Remove the ``PyAST_Validate()`` function. It is no longer possible to build " "a AST object (``mod_ty`` type) with the public C API. The function was " @@ -2957,48 +2965,48 @@ msgid "" "Stinner in :issue:`43244`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2265 +#: ../../whatsnew/3.10.rst:2269 msgid "Remove the ``symtable.h`` header file and the undocumented functions:" msgstr "" -#: ../../whatsnew/3.10.rst:2267 +#: ../../whatsnew/3.10.rst:2271 msgid "``PyST_GetScope()``" msgstr "``PyST_GetScope()``" -#: ../../whatsnew/3.10.rst:2268 +#: ../../whatsnew/3.10.rst:2272 msgid "``PySymtable_Build()``" msgstr "``PySymtable_Build()``" -#: ../../whatsnew/3.10.rst:2269 +#: ../../whatsnew/3.10.rst:2273 msgid "``PySymtable_BuildObject()``" msgstr "``PySymtable_BuildObject()``" -#: ../../whatsnew/3.10.rst:2270 +#: ../../whatsnew/3.10.rst:2274 msgid "``PySymtable_Free()``" msgstr "``PySymtable_Free()``" -#: ../../whatsnew/3.10.rst:2271 +#: ../../whatsnew/3.10.rst:2275 msgid "``Py_SymtableString()``" msgstr "``Py_SymtableString()``" -#: ../../whatsnew/3.10.rst:2272 +#: ../../whatsnew/3.10.rst:2276 msgid "``Py_SymtableStringObject()``" msgstr "``Py_SymtableStringObject()``" -#: ../../whatsnew/3.10.rst:2274 +#: ../../whatsnew/3.10.rst:2278 msgid "" "The ``Py_SymtableString()`` function was part the stable ABI by mistake but " "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" -#: ../../whatsnew/3.10.rst:2278 +#: ../../whatsnew/3.10.rst:2282 msgid "" "Use Python :mod:`symtable` module instead. (Contributed by Victor Stinner " "in :issue:`43244`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2281 +#: ../../whatsnew/3.10.rst:2285 msgid "" "Remove :c:func:`PyOS_ReadlineFunctionPointer` from the limited C API headers " "and from ``python3.dll``, the library that provides the stable ABI on " @@ -3006,7 +3014,7 @@ msgid "" "cannot be guaranteed. (Contributed by Petr Viktorin in :issue:`43868`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2287 +#: ../../whatsnew/3.10.rst:2291 msgid "" "Remove ``ast.h``, ``asdl.h``, and ``Python-ast.h`` header files. These " "functions were undocumented and excluded from the limited C API. Most names " @@ -3017,118 +3025,87 @@ msgid "" "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2295 +#: ../../whatsnew/3.10.rst:2299 msgid "" "Remove the compiler and parser functions using ``struct _mod`` type, because " "the public AST C API was removed:" msgstr "" -#: ../../whatsnew/3.10.rst:2298 +#: ../../whatsnew/3.10.rst:2302 msgid "``PyAST_Compile()``" msgstr "``PyAST_Compile()``" -#: ../../whatsnew/3.10.rst:2299 +#: ../../whatsnew/3.10.rst:2303 msgid "``PyAST_CompileEx()``" msgstr "``PyAST_CompileEx()``" -#: ../../whatsnew/3.10.rst:2300 +#: ../../whatsnew/3.10.rst:2304 msgid "``PyAST_CompileObject()``" msgstr "``PyAST_CompileObject()``" -#: ../../whatsnew/3.10.rst:2301 +#: ../../whatsnew/3.10.rst:2305 msgid "``PyFuture_FromAST()``" msgstr "``PyFuture_FromAST()``" -#: ../../whatsnew/3.10.rst:2302 +#: ../../whatsnew/3.10.rst:2306 msgid "``PyFuture_FromASTObject()``" msgstr "``PyFuture_FromASTObject()``" -#: ../../whatsnew/3.10.rst:2303 +#: ../../whatsnew/3.10.rst:2307 msgid "``PyParser_ASTFromFile()``" msgstr "``PyParser_ASTFromFile()``" -#: ../../whatsnew/3.10.rst:2304 +#: ../../whatsnew/3.10.rst:2308 msgid "``PyParser_ASTFromFileObject()``" msgstr "``PyParser_ASTFromFileObject()``" -#: ../../whatsnew/3.10.rst:2305 +#: ../../whatsnew/3.10.rst:2309 msgid "``PyParser_ASTFromFilename()``" msgstr "``PyParser_ASTFromFilename()``" -#: ../../whatsnew/3.10.rst:2306 +#: ../../whatsnew/3.10.rst:2310 msgid "``PyParser_ASTFromString()``" msgstr "``PyParser_ASTFromString()``" -#: ../../whatsnew/3.10.rst:2307 +#: ../../whatsnew/3.10.rst:2311 msgid "``PyParser_ASTFromStringObject()``" msgstr "``PyParser_ASTFromStringObject()``" -#: ../../whatsnew/3.10.rst:2309 +#: ../../whatsnew/3.10.rst:2313 msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2312 +#: ../../whatsnew/3.10.rst:2316 msgid "Remove the ``pyarena.h`` header file with functions:" msgstr "" -#: ../../whatsnew/3.10.rst:2314 +#: ../../whatsnew/3.10.rst:2318 msgid "``PyArena_New()``" msgstr "``PyArena_New()``" -#: ../../whatsnew/3.10.rst:2315 +#: ../../whatsnew/3.10.rst:2319 msgid "``PyArena_Free()``" msgstr "``PyArena_Free()``" -#: ../../whatsnew/3.10.rst:2316 +#: ../../whatsnew/3.10.rst:2320 msgid "``PyArena_Malloc()``" msgstr "``PyArena_Malloc()``" -#: ../../whatsnew/3.10.rst:2317 +#: ../../whatsnew/3.10.rst:2321 msgid "``PyArena_AddPyObject()``" msgstr "``PyArena_AddPyObject()``" -#: ../../whatsnew/3.10.rst:2319 +#: ../../whatsnew/3.10.rst:2323 msgid "" "These functions were undocumented, excluded from the limited C API, and were " "only used internally by the compiler. (Contributed by Victor Stinner in :" "issue:`43244`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2323 +#: ../../whatsnew/3.10.rst:2327 msgid "" "The ``PyThreadState.use_tracing`` member has been removed to optimize " "Python. (Contributed by Mark Shannon in :issue:`43760`.)" msgstr "" - -#: ../../whatsnew/3.10.rst:2328 -msgid "Notable security feature in 3.10.7" -msgstr "" - -#: ../../whatsnew/3.10.rst:2330 -msgid "" -"Converting between :class:`int` and :class:`str` in bases other than 2 " -"(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " -"now raises a :exc:`ValueError` if the number of digits in string form is " -"above a limit to avoid potential denial of service attacks due to the " -"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " -"configured or disabled by environment variable, command line flag, or :mod:" -"`sys` APIs. See the :ref:`integer string conversion length limitation " -"` documentation. The default limit is 4300 digits in " -"string form." -msgstr "" - -#: ../../whatsnew/3.10.rst:2342 -msgid "Notable security feature in 3.10.8" -msgstr "" - -#: ../../whatsnew/3.10.rst:2344 -msgid "" -"The deprecated :mod:`mailcap` module now refuses to inject unsafe text " -"(filenames, MIME types, parameters) into shell commands. Instead of using " -"such text, it will warn and act as if a match was not found (or for test " -"commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" -"`98966`.)" -msgstr "" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po new file mode 100644 index 0000000000..7585a42a97 --- /dev/null +++ b/whatsnew/3.11.po @@ -0,0 +1,3640 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2022, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../whatsnew/3.11.rst:3 +msgid "What's New In Python 3.11" +msgstr "Python 3.11 有什麼新功能" + +#: ../../whatsnew/3.11.rst:0 +msgid "Release" +msgstr "發行版本" + +#: ../../whatsnew/3.11.rst:5 +msgid "|release|" +msgstr "|release|" + +#: ../../whatsnew/3.11.rst:0 +msgid "Date" +msgstr "日期" + +#: ../../whatsnew/3.11.rst:6 +msgid "|today|" +msgstr "|today|" + +#: ../../whatsnew/3.11.rst:48 +msgid "" +"This article explains the new features in Python 3.11, compared to 3.10." +msgstr "" + +#: ../../whatsnew/3.11.rst:50 +msgid "For full details, see the :ref:`changelog `." +msgstr "" + +#: ../../whatsnew/3.11.rst:56 +msgid "Summary -- Release highlights" +msgstr "" + +#: ../../whatsnew/3.11.rst:61 +msgid "" +"Python 3.11 is between 10-60% faster than Python 3.10. On average, we " +"measured a 1.25x speedup on the standard benchmark suite. See `Faster " +"CPython`_ for details." +msgstr "" + +#: ../../whatsnew/3.11.rst:66 +msgid "New syntax features:" +msgstr "" + +#: ../../whatsnew/3.11.rst:68 +msgid ":pep:`654`: Exception Groups and ``except*``." +msgstr "" + +#: ../../whatsnew/3.11.rst:70 +msgid "New built-in features:" +msgstr "" + +#: ../../whatsnew/3.11.rst:72 +msgid ":pep:`678`: Enriching Exceptions with Notes." +msgstr "" + +#: ../../whatsnew/3.11.rst:74 +msgid "New standard library modules:" +msgstr "" + +#: ../../whatsnew/3.11.rst:76 +msgid "" +":pep:`680`: ``tomllib`` — Support for Parsing TOML in the Standard Library." +msgstr "" + +#: ../../whatsnew/3.11.rst:78 +msgid "Interpreter improvements:" +msgstr "" + +#: ../../whatsnew/3.11.rst:80 +msgid ":pep:`657`: Include Fine Grained Error Locations in Tracebacks." +msgstr "" + +#: ../../whatsnew/3.11.rst:81 +msgid "" +"New :option:`-P` command line option and :envvar:`PYTHONSAFEPATH` " +"environment variable to disable automatically prepending a potentially " +"unsafe path (the working dir or script directory, depending on invocation) " +"to :data:`sys.path`." +msgstr "" + +#: ../../whatsnew/3.11.rst:86 +msgid "New typing features:" +msgstr "" + +#: ../../whatsnew/3.11.rst:88 +msgid ":pep:`646`: Variadic generics." +msgstr "" + +#: ../../whatsnew/3.11.rst:89 +msgid "" +":pep:`655`: Marking individual TypedDict items as required or potentially " +"missing." +msgstr "" + +#: ../../whatsnew/3.11.rst:90 +msgid ":pep:`673`: ``Self`` type." +msgstr "" + +#: ../../whatsnew/3.11.rst:91 +msgid ":pep:`675`: Arbitrary literal string type." +msgstr "" + +#: ../../whatsnew/3.11.rst:92 +msgid ":pep:`681`: Data Class Transforms." +msgstr "" + +#: ../../whatsnew/3.11.rst:94 +msgid "Important deprecations, removals or restrictions:" +msgstr "" + +#: ../../whatsnew/3.11.rst:96 +msgid ":pep:`594`: Removing dead batteries from the standard library." +msgstr "" + +#: ../../whatsnew/3.11.rst:97 +msgid ":pep:`624`: Remove ``Py_UNICODE`` encoder APIs." +msgstr "" + +#: ../../whatsnew/3.11.rst:98 +msgid ":pep:`670`: Convert macros to functions in the Python C API." +msgstr "" + +#: ../../whatsnew/3.11.rst:104 ../../whatsnew/3.11.rst:1837 +msgid "New Features" +msgstr "" + +#: ../../whatsnew/3.11.rst:109 +msgid "PEP 657: Enhanced error locations in tracebacks" +msgstr "" + +#: ../../whatsnew/3.11.rst:111 +msgid "" +"When printing tracebacks, the interpreter will now point to the exact " +"expression that caused the error, instead of just the line. For example:" +msgstr "" + +#: ../../whatsnew/3.11.rst:125 +msgid "" +"Previous versions of the interpreter would point to just the line, making it " +"ambiguous which object was ``None``. These enhanced errors can also be " +"helpful when dealing with deeply nested :class:`dict` objects and multiple " +"function calls:" +msgstr "" + +#: ../../whatsnew/3.11.rst:145 +msgid "As well as complex arithmetic expressions:" +msgstr "" + +#: ../../whatsnew/3.11.rst:155 +msgid "" +"Additionally, the information used by the enhanced traceback feature is made " +"available via a general API, that can be used to correlate :term:`bytecode` :" +"ref:`instructions ` with source code location. This information " +"can be retrieved using:" +msgstr "" + +#: ../../whatsnew/3.11.rst:160 +msgid "The :meth:`codeobject.co_positions` method in Python." +msgstr "" + +#: ../../whatsnew/3.11.rst:161 +msgid "The :c:func:`PyCode_Addr2Location` function in the C API." +msgstr "" + +#: ../../whatsnew/3.11.rst:163 +msgid "" +"See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan " +"Taskaya and Ammar Askar in :issue:`43950`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:167 +msgid "" +"This feature requires storing column positions in :ref:`codeobjects`, which " +"may result in a small increase in interpreter memory usage and disk usage " +"for compiled Python files. To avoid storing the extra information and " +"deactivate printing the extra traceback information, use the :option:`-X " +"no_debug_ranges <-X>` command line option or the :envvar:" +"`PYTHONNODEBUGRANGES` environment variable." +msgstr "" + +#: ../../whatsnew/3.11.rst:179 +msgid "PEP 654: Exception Groups and ``except*``" +msgstr "" + +#: ../../whatsnew/3.11.rst:181 +msgid "" +":pep:`654` introduces language features that enable a program to raise and " +"handle multiple unrelated exceptions simultaneously. The builtin types :exc:" +"`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible to group " +"exceptions and raise them together, and the new :keyword:`except* " +"` syntax generalizes :keyword:`except` to match subgroups of " +"exception groups." +msgstr "" + +#: ../../whatsnew/3.11.rst:188 +msgid "See :pep:`654` for more details." +msgstr "詳情請見 :pep:`654`。" + +#: ../../whatsnew/3.11.rst:190 +msgid "" +"(Contributed by Irit Katriel in :issue:`45292`. PEP written by Irit Katriel, " +"Yury Selivanov and Guido van Rossum.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:197 +msgid "PEP 678: Exceptions can be enriched with notes" +msgstr "" + +#: ../../whatsnew/3.11.rst:199 +msgid "" +"The :meth:`~BaseException.add_note` method is added to :exc:`BaseException`. " +"It can be used to enrich exceptions with context information that is not " +"available at the time when the exception is raised. The added notes appear " +"in the default traceback." +msgstr "" + +#: ../../whatsnew/3.11.rst:204 +msgid "See :pep:`678` for more details." +msgstr "詳情請見 :pep:`678`。" + +#: ../../whatsnew/3.11.rst:206 +msgid "" +"(Contributed by Irit Katriel in :issue:`45607`. PEP written by Zac Hatfield-" +"Dodds.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:213 +msgid "Windows ``py.exe`` launcher improvements" +msgstr "" + +#: ../../whatsnew/3.11.rst:215 +msgid "" +"The copy of the :ref:`launcher` included with Python 3.11 has been " +"significantly updated. It now supports company/tag syntax as defined in :pep:" +"`514` using the ``-V:/`` argument instead of the limited ``-" +".``. This allows launching distributions other than " +"``PythonCore``, the one hosted on `python.org `_." +msgstr "" + +#: ../../whatsnew/3.11.rst:221 +msgid "" +"When using ``-V:`` selectors, either company or tag can be omitted, but all " +"installs will be searched. For example, ``-V:OtherPython/`` will select the " +"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-" +"V:/3.11`` will select the \"best\" distribution with tag ``3.11``." +msgstr "" + +#: ../../whatsnew/3.11.rst:226 +msgid "" +"When using the legacy ``-``, ``-.``, ``--" +"`` or ``-.-`` arguments, all existing " +"behaviour should be preserved from past versions, and only releases from " +"``PythonCore`` will be selected. However, the ``-64`` suffix now implies " +"\"not 32-bit\" (not necessarily x86-64), as there are multiple supported 64-" +"bit platforms. 32-bit runtimes are detected by checking the runtime's tag " +"for a ``-32`` suffix. All releases of Python since 3.5 have included this in " +"their 32-bit builds." +msgstr "" + +#: ../../whatsnew/3.11.rst:240 +msgid "New Features Related to Type Hints" +msgstr "" + +#: ../../whatsnew/3.11.rst:242 +msgid "" +"This section covers major changes affecting :pep:`484` type hints and the :" +"mod:`typing` module." +msgstr "" + +#: ../../whatsnew/3.11.rst:249 +msgid "PEP 646: Variadic generics" +msgstr "" + +#: ../../whatsnew/3.11.rst:251 +msgid "" +":pep:`484` previously introduced :data:`~typing.TypeVar`, enabling creation " +"of generics parameterised with a single type. :pep:`646` adds :data:`~typing." +"TypeVarTuple`, enabling parameterisation with an *arbitrary* number of " +"types. In other words, a :data:`~typing.TypeVarTuple` is a *variadic* type " +"variable, enabling *variadic* generics." +msgstr "" + +#: ../../whatsnew/3.11.rst:258 +msgid "" +"This enables a wide variety of use cases. In particular, it allows the type " +"of array-like structures in numerical computing libraries such as NumPy and " +"TensorFlow to be parameterised with the array *shape*. Static type checkers " +"will now be able to catch shape-related bugs in code that uses these " +"libraries." +msgstr "" + +#: ../../whatsnew/3.11.rst:264 +msgid "See :pep:`646` for more details." +msgstr "詳情請見 :pep:`646`。" + +#: ../../whatsnew/3.11.rst:266 +msgid "" +"(Contributed by Matthew Rahtz in :issue:`43224`, with contributions by " +"Serhiy Storchaka and Jelle Zijlstra. PEP written by Mark Mendoza, Matthew " +"Rahtz, Pradeep Kumar Srinivasan, and Vincent Siles.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:274 +msgid "" +"PEP 655: Marking individual ``TypedDict`` items as required or not-required" +msgstr "" + +#: ../../whatsnew/3.11.rst:276 +msgid "" +":data:`~typing.Required` and :data:`~typing.NotRequired` provide a " +"straightforward way to mark whether individual items in a :class:`~typing." +"TypedDict` must be present. Previously, this was only possible using " +"inheritance." +msgstr "" + +#: ../../whatsnew/3.11.rst:281 +msgid "" +"All fields are still required by default, unless the *total* parameter is " +"set to ``False``, in which case all fields are still not-required by " +"default. For example, the following specifies a :class:`!TypedDict` with one " +"required and one not-required key::" +msgstr "" + +#: ../../whatsnew/3.11.rst:295 +msgid "The following definition is equivalent::" +msgstr "" + +#: ../../whatsnew/3.11.rst:301 +msgid "See :pep:`655` for more details." +msgstr "詳情請見 :pep:`655`。" + +#: ../../whatsnew/3.11.rst:303 +msgid "" +"(Contributed by David Foster and Jelle Zijlstra in :issue:`47087`. PEP " +"written by David Foster.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:310 +msgid "PEP 673: ``Self`` type" +msgstr "" + +#: ../../whatsnew/3.11.rst:312 +msgid "" +"The new :data:`~typing.Self` annotation provides a simple and intuitive way " +"to annotate methods that return an instance of their class. This behaves the " +"same as the :class:`~typing.TypeVar`-based approach :pep:`specified in PEP " +"484 <484#annotating-instance-and-class-methods>`, but is more concise and " +"easier to follow." +msgstr "" + +#: ../../whatsnew/3.11.rst:318 +msgid "" +"Common use cases include alternative constructors provided as :func:" +"`classmethod `\\s, and :meth:`~object.__enter__` methods that " +"return ``self``::" +msgstr "" + +#: ../../whatsnew/3.11.rst:336 +msgid "" +":data:`~typing.Self` can also be used to annotate method parameters or " +"attributes of the same type as their enclosing class." +msgstr "" + +#: ../../whatsnew/3.11.rst:339 +msgid "See :pep:`673` for more details." +msgstr "詳情請見 :pep:`673`。" + +#: ../../whatsnew/3.11.rst:341 +msgid "" +"(Contributed by James Hilton-Balfe in :issue:`46534`. PEP written by Pradeep " +"Kumar Srinivasan and James Hilton-Balfe.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:348 +msgid "PEP 675: Arbitrary literal string type" +msgstr "" + +#: ../../whatsnew/3.11.rst:350 +msgid "" +"The new :data:`~typing.LiteralString` annotation may be used to indicate " +"that a function parameter can be of any literal string type. This allows a " +"function to accept arbitrary literal string types, as well as strings " +"created from other literal strings. Type checkers can then enforce that " +"sensitive functions, such as those that execute SQL statements or shell " +"commands, are called only with static arguments, providing protection " +"against injection attacks." +msgstr "" + +#: ../../whatsnew/3.11.rst:358 +msgid "For example, a SQL query function could be annotated as follows::" +msgstr "" + +#: ../../whatsnew/3.11.rst:376 +msgid "See :pep:`675` for more details." +msgstr "詳情請見 :pep:`675`。" + +#: ../../whatsnew/3.11.rst:378 +msgid "" +"(Contributed by Jelle Zijlstra in :issue:`47088`. PEP written by Pradeep " +"Kumar Srinivasan and Graham Bleaney.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:385 +msgid "PEP 681: Data Class Transforms" +msgstr "" + +#: ../../whatsnew/3.11.rst:387 +msgid "" +":data:`~typing.dataclass_transform` may be used to decorate a class, " +"metaclass, or a function that is itself a decorator. The presence of " +"``@dataclass_transform()`` tells a static type checker that the decorated " +"object performs runtime \"magic\" that transforms a class, giving it :func:" +"`dataclass `-like behaviors." +msgstr "" + +#: ../../whatsnew/3.11.rst:393 +msgid "For example::" +msgstr "" +"舉例來說:\n" +"\n" +"::" + +#: ../../whatsnew/3.11.rst:411 +msgid "See :pep:`681` for more details." +msgstr "詳情請見 :pep:`681`。" + +#: ../../whatsnew/3.11.rst:413 +msgid "" +"(Contributed by Jelle Zijlstra in :gh:`91860`. PEP written by Erik De Bonte " +"and Eric Traut.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:420 +msgid "PEP 563 may not be the future" +msgstr "" + +#: ../../whatsnew/3.11.rst:422 +msgid "" +":pep:`563` Postponed Evaluation of Annotations (the ``from __future__ import " +"annotations`` :ref:`future statement `) that was originally planned " +"for release in Python 3.10 has been put on hold indefinitely. See `this " +"message from the Steering Council `__ for more " +"information." +msgstr "" + +#: ../../whatsnew/3.11.rst:433 +msgid "Other Language Changes" +msgstr "" + +#: ../../whatsnew/3.11.rst:435 +msgid "" +"Starred unpacking expressions can now be used in :keyword:`for` statements. " +"(See :issue:`46725` for more details.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:438 +msgid "" +"Asynchronous :ref:`comprehensions ` are now allowed inside " +"comprehensions in :ref:`asynchronous functions `. Outer " +"comprehensions implicitly become asynchronous in this case. (Contributed by " +"Serhiy Storchaka in :issue:`33346`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:443 +msgid "" +"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in :" +"keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` for " +"objects that do not support the :term:`context manager` protocol, and in :" +"keyword:`async with` statements and :meth:`contextlib.AsyncExitStack." +"enter_async_context` for objects not supporting the :term:`asynchronous " +"context manager` protocol. (Contributed by Serhiy Storchaka in :issue:" +"`12022` and :issue:`44471`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:451 +msgid "" +"Added :meth:`object.__getstate__`, which provides the default implementation " +"of the :meth:`!__getstate__` method. :mod:`copy`\\ing and :mod:`pickle`\\ing " +"instances of subclasses of builtin types :class:`bytearray`, :class:`set`, :" +"class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections." +"deque`, :class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies " +"and pickles instance attributes implemented as :term:`slots <__slots__>`. " +"(Contributed by Serhiy Storchaka in :issue:`26579`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:460 +msgid "" +"Added a :option:`-P` command line option and a :envvar:`PYTHONSAFEPATH` " +"environment variable, which disable the automatic prepending to :data:`sys." +"path` of the script's directory when running a script, or the current " +"directory when using :option:`-c` and :option:`-m`. This ensures only stdlib " +"and installed modules are picked up by :keyword:`import`, and avoids " +"unintentionally or maliciously shadowing modules with those in a local (and " +"typically user-writable) directory. (Contributed by Victor Stinner in :gh:" +"`57684`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:471 +msgid "" +"A ``\"z\"`` option was added to the :ref:`formatspec` that coerces negative " +"to positive zero after rounding to the format precision. See :pep:`682` for " +"more details. (Contributed by John Belmonte in :gh:`90153`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:476 +msgid "" +"Bytes are no longer accepted on :data:`sys.path`. Support broke sometime " +"between Python 3.2 and 3.6, with no one noticing until after Python 3.10.0 " +"was released. In addition, bringing back support would be problematic due to " +"interactions between :option:`-b` and :data:`sys.path_importer_cache` when " +"there is a mixture of :class:`str` and :class:`bytes` keys. (Contributed by " +"Thomas Grainger in :gh:`91181`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:487 +msgid "Other CPython Implementation Changes" +msgstr "" + +#: ../../whatsnew/3.11.rst:489 +msgid "" +"The special methods :meth:`~object.__complex__` for :class:`complex` and :" +"meth:`~object.__bytes__` for :class:`bytes` are implemented to support the :" +"class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` protocols. " +"(Contributed by Mark Dickinson and Dong-hee Na in :issue:`24234`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:494 +msgid "" +"``siphash13`` is added as a new internal hashing algorithm. It has similar " +"security properties as ``siphash24``, but it is slightly faster for long " +"inputs. :class:`str`, :class:`bytes`, and some other types now use it as the " +"default algorithm for :func:`hash`. :pep:`552` :ref:`hash-based .pyc files " +"` now use ``siphash13`` too. (Contributed by Inada Naoki " +"in :issue:`29410`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:503 +msgid "" +"When an active exception is re-raised by a :keyword:`raise` statement with " +"no parameters, the traceback attached to this exception is now always ``sys." +"exc_info()[1].__traceback__``. This means that changes made to the traceback " +"in the current :keyword:`except` clause are reflected in the re-raised " +"exception. (Contributed by Irit Katriel in :issue:`45711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:509 +msgid "" +"The interpreter state's representation of handled exceptions (aka " +"``exc_info`` or ``_PyErr_StackItem``) now only has the ``exc_value`` field; " +"``exc_type`` and ``exc_traceback`` have been removed, as they can be derived " +"from ``exc_value``. (Contributed by Irit Katriel in :issue:`45711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:515 +msgid "" +"A new :ref:`command line option `, ``AppendPath``, has " +"been added for the Windows installer. It behaves similarly to " +"``PrependPath``, but appends the install and scripts directories instead of " +"prepending them. (Contributed by Bastian Neuburger in :issue:`44934`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:521 +msgid "" +"The :c:member:`PyConfig.module_search_paths_set` field must now be set to " +"``1`` for initialization to use :c:member:`PyConfig.module_search_paths` to " +"initialize :data:`sys.path`. Otherwise, initialization will recalculate the " +"path and replace any values added to ``module_search_paths``." +msgstr "" + +#: ../../whatsnew/3.11.rst:526 +msgid "" +"The output of the :option:`--help` option now fits in 50 lines/80 columns. " +"Information about :ref:`Python environment variables ` " +"and :option:`-X` options is now available using the respective :option:`--" +"help-env` and :option:`--help-xoptions` flags, and with the new :option:`--" +"help-all`. (Contributed by Éric Araujo in :issue:`46142`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:533 +msgid "" +"Converting between :class:`int` and :class:`str` in bases other than 2 " +"(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " +"now raises a :exc:`ValueError` if the number of digits in string form is " +"above a limit to avoid potential denial of service attacks due to the " +"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " +"configured or disabled by environment variable, command line flag, or :mod:" +"`sys` APIs. See the :ref:`integer string conversion length limitation " +"` documentation. The default limit is 4300 digits in " +"string form." +msgstr "" + +#: ../../whatsnew/3.11.rst:548 +msgid "New Modules" +msgstr "" + +#: ../../whatsnew/3.11.rst:550 +msgid "" +":mod:`tomllib`: For parsing `TOML `_. See :pep:`680` for " +"more details. (Contributed by Taneli Hukkinen in :issue:`40059`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:554 +msgid "" +":mod:`wsgiref.types`: :pep:`WSGI <3333>`-specific types for static type " +"checking. (Contributed by Sebastian Rittau in :issue:`42012`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:560 +msgid "Improved Modules" +msgstr "" + +#: ../../whatsnew/3.11.rst:565 +msgid "asyncio" +msgstr "asyncio" + +#: ../../whatsnew/3.11.rst:567 +msgid "" +"Added the :class:`~asyncio.TaskGroup` class, an :ref:`asynchronous context " +"manager ` holding a group of tasks that will wait " +"for all of them upon exit. For new code this is recommended over using :func:" +"`~asyncio.create_task` and :func:`~asyncio.gather` directly. (Contributed by " +"Yury Selivanov and others in :gh:`90908`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:574 +msgid "" +"Added :func:`~asyncio.timeout`, an asynchronous context manager for setting " +"a timeout on asynchronous operations. For new code this is recommended over " +"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov in :" +"gh:`90927`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:579 +msgid "" +"Added the :class:`~asyncio.Runner` class, which exposes the machinery used " +"by :func:`~asyncio.run`. (Contributed by Andrew Svetlov in :gh:`91218`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:583 +msgid "" +"Added the :class:`~asyncio.Barrier` class to the synchronization primitives " +"in the asyncio library, and the related :exc:`~asyncio.BrokenBarrierError` " +"exception. (Contributed by Yves Duprat and Andrew Svetlov in :gh:`87518`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:588 +msgid "" +"Added keyword argument *all_errors* to :meth:`asyncio.loop." +"create_connection` so that multiple connection errors can be raised as an :" +"exc:`ExceptionGroup`." +msgstr "" + +#: ../../whatsnew/3.11.rst:591 +msgid "" +"Added the :meth:`asyncio.StreamWriter.start_tls` method for upgrading " +"existing stream-based connections to TLS. (Contributed by Ian Good in :issue:" +"`34975`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:595 +msgid "" +"Added raw datagram socket functions to the event loop: :meth:`~asyncio.loop." +"sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` and :meth:`~asyncio.loop." +"sock_recvfrom_into`. These have implementations in :class:`~asyncio." +"SelectorEventLoop` and :class:`~asyncio.ProactorEventLoop`. (Contributed by " +"Alex Grönholm in :issue:`46805`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:603 +msgid "" +"Added :meth:`~asyncio.Task.cancelling` and :meth:`~asyncio.Task.uncancel` " +"methods to :class:`~asyncio.Task`. These are primarily intended for internal " +"use, notably by :class:`~asyncio.TaskGroup`." +msgstr "" + +#: ../../whatsnew/3.11.rst:609 +msgid "contextlib" +msgstr "contextlib" + +#: ../../whatsnew/3.11.rst:611 +msgid "" +"Added non parallel-safe :func:`~contextlib.chdir` context manager to change " +"the current working directory and then restore it on exit. Simple wrapper " +"around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" +msgstr "" + +#: ../../whatsnew/3.11.rst:616 +msgid "dataclasses" +msgstr "dataclasses" + +#: ../../whatsnew/3.11.rst:618 +msgid "" +"Change field default mutability check, allowing only defaults which are :" +"term:`hashable` instead of any object which is not an instance of :class:" +"`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. Smith in :" +"issue:`44674`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:624 +msgid "datetime" +msgstr "datetime" + +#: ../../whatsnew/3.11.rst:626 +msgid "" +"Add :attr:`datetime.UTC`, a convenience alias for :attr:`datetime.timezone." +"utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:628 +msgid "" +":meth:`datetime.date.fromisoformat`, :meth:`datetime.time.fromisoformat` " +"and :meth:`datetime.datetime.fromisoformat` can now be used to parse most " +"ISO 8601 formats (barring only those that support fractional hours and " +"minutes). (Contributed by Paul Ganssle in :gh:`80010`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:634 +msgid "enum" +msgstr "enum" + +#: ../../whatsnew/3.11.rst:636 +msgid "``EnumMeta`` renamed to ``EnumType`` (``EnumMeta`` kept as alias)." +msgstr "" + +#: ../../whatsnew/3.11.rst:638 +msgid "``StrEnum`` added -- enum members are and must be strings." +msgstr "" + +#: ../../whatsnew/3.11.rst:640 +msgid "" +"``ReprEnum`` added -- causes only the ``__repr__`` to be modified, not the " +"``__str__`` nor the ``__format__``." +msgstr "" + +#: ../../whatsnew/3.11.rst:643 +msgid "" +"``FlagBoundary`` added -- controls behavior when invalid values are given to " +"a flag." +msgstr "" + +#: ../../whatsnew/3.11.rst:646 +msgid "" +"``EnumCheck`` added -- used by ``verify`` to ensure various constraints." +msgstr "" + +#: ../../whatsnew/3.11.rst:648 +msgid "``verify`` added -- function to ensure given ``EnumCheck`` constraints." +msgstr "" + +#: ../../whatsnew/3.11.rst:650 +msgid "" +"``member`` added -- decorator to ensure given object is converted to an enum " +"member." +msgstr "" + +#: ../../whatsnew/3.11.rst:653 +msgid "" +"``nonmember`` added -- decorator to ensure given object is not converted to " +"an enum member." +msgstr "" + +#: ../../whatsnew/3.11.rst:656 +msgid "``property`` added -- use instead of ``types.DynamicClassAttribute``." +msgstr "" + +#: ../../whatsnew/3.11.rst:658 +msgid "" +"``global_enum`` added -- enum decorator to adjust ``__repr__`` and " +"``__str__`` to show members in the global context -- see ``re.RegexFlag`` " +"for an example." +msgstr "" + +#: ../../whatsnew/3.11.rst:661 +msgid "" +"``Flag`` enhancements: members support length, iteration, and containment " +"checks." +msgstr "" + +#: ../../whatsnew/3.11.rst:664 +msgid "" +"``Enum``/``Flag`` fixes: members are now defined before " +"``__init_subclass__`` is called; ``dir()`` now includes methods, etc., from " +"mixed-in data types." +msgstr "" + +#: ../../whatsnew/3.11.rst:667 +msgid "" +"``Flag`` fixes: only primary values (power of two) are considered canonical " +"while composite values (3, 6, 10, etc.) are considered aliases; inverted " +"flags are coerced to their positive equivalent." +msgstr "" + +#: ../../whatsnew/3.11.rst:671 +msgid "" +"``IntEnum`` / ``IntFlag`` / ``StrEnum`` fixes: these now inherit from " +"``ReprEnum`` so the ``str()`` output now matches ``format()`` output, which " +"is the data types' (so both ``str(AnIntEnum.ONE)`` and ``format(AnIntEnum." +"ONE)`` is equal to ``'1'``)." +msgstr "" + +#: ../../whatsnew/3.11.rst:677 +msgid "fractions" +msgstr "fractions" + +#: ../../whatsnew/3.11.rst:679 +msgid "" +"Support :PEP:`515`-style initialization of :class:`~fractions.Fraction` from " +"string. (Contributed by Sergey B Kirpichev in :issue:`44258`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:682 +msgid "" +":class:`~fractions.Fraction` now implements an ``__int__`` method, so that " +"an ``isinstance(some_fraction, typing.SupportsInt)`` check passes. " +"(Contributed by Mark Dickinson in :issue:`44547`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:687 +msgid "functools" +msgstr "functools" + +#: ../../whatsnew/3.11.rst:689 +msgid "" +":func:`functools.singledispatch` now supports :data:`types.UnionType` and :" +"data:`typing.Union` as annotations to the dispatch argument.::" +msgstr "" + +#: ../../whatsnew/3.11.rst:714 +msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:717 +msgid "hashlib" +msgstr "hashlib" + +#: ../../whatsnew/3.11.rst:719 +msgid "" +":func:`hashlib.blake2b` and :func:`hashlib.blake2s` now prefer `libb2`_ over " +"Python's vendored copy. (Contributed by Christian Heimes in :issue:`47095`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:723 +msgid "" +"The internal ``_sha3`` module with SHA3 and SHAKE algorithms now uses " +"*tiny_sha3* instead of the *Keccak Code Package* to reduce code and binary " +"size. The :mod:`hashlib` module prefers optimized SHA3 and SHAKE " +"implementations from OpenSSL. The change affects only installations without " +"OpenSSL support. (Contributed by Christian Heimes in :issue:`47098`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:730 +msgid "" +"Add :func:`hashlib.file_digest`, a helper function for efficient hashing of " +"files or file-like objects. (Contributed by Christian Heimes in :gh:`89313`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:735 +msgid "IDLE and idlelib" +msgstr "" + +#: ../../whatsnew/3.11.rst:737 +msgid "" +"Apply syntax highlighting to `.pyi` files. (Contributed by Alex Waygood and " +"Terry Jan Reedy in :issue:`45447`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:740 +msgid "" +"Include prompts when saving Shell with inputs and outputs. (Contributed by " +"Terry Jan Reedy in :gh:`95191`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:744 +msgid "inspect" +msgstr "inspect" + +#: ../../whatsnew/3.11.rst:745 +msgid "" +"Add :func:`inspect.getmembers_static`: return all members without triggering " +"dynamic lookup via the descriptor protocol. (Contributed by Weipeng Hong in :" +"issue:`30533`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:749 +msgid "" +"Add :func:`inspect.ismethodwrapper` for checking if the type of an object is " +"a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :issue:" +"`29418`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:752 +msgid "" +"Change the frame-related functions in the :mod:`inspect` module to return a " +"regular object (that is backwards compatible with the old tuple-like " +"interface) that include the extended :pep:`657` position information (end " +"line number, column and end column). The affected functions are: :func:" +"`inspect.getframeinfo`, :func:`inspect.getouterframes`, :func:`inspect." +"getinnerframes`, :func:`inspect.stack` and :func:`inspect.trace`. " +"(Contributed by Pablo Galindo in :gh:`88116`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:761 +msgid "locale" +msgstr "locale" + +#: ../../whatsnew/3.11.rst:763 +msgid "" +"Add :func:`locale.getencoding` to get the current locale encoding. It is " +"similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" +"`Python UTF-8 Mode `." +msgstr "" + +#: ../../whatsnew/3.11.rst:768 +msgid "math" +msgstr "math" + +#: ../../whatsnew/3.11.rst:770 +msgid "" +"Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " +"Gideon Mitchell in :issue:`45917`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:773 +msgid "" +"Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " +"Ramachandran in :issue:`44357`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:776 +msgid "" +"The behaviour of two :func:`math.pow` corner cases was changed, for " +"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" +"math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. Previously " +"they raised :exc:`ValueError`. (Contributed by Mark Dickinson in :issue:" +"`44339`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:782 +msgid "" +"The :data:`math.nan` value is now always available. (Contributed by Victor " +"Stinner in :issue:`46917`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:787 +msgid "operator" +msgstr "operator" + +#: ../../whatsnew/3.11.rst:789 +msgid "" +"A new function ``operator.call`` has been added, such that ``operator." +"call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " +"Lee in :issue:`44019`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:795 +msgid "os" +msgstr "os" + +#: ../../whatsnew/3.11.rst:797 +msgid "" +"On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " +"``CryptGenRandom()`` which is deprecated. (Contributed by Dong-hee Na in :" +"issue:`44611`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:803 +msgid "pathlib" +msgstr "pathlib" + +#: ../../whatsnew/3.11.rst:805 +msgid "" +":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " +"directories if *pattern* ends with a pathname components separator: :data:" +"`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke Kawasima in :issue:" +"`22276` and :issue:`33392`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:811 +msgid "re" +msgstr "re" + +#: ../../whatsnew/3.11.rst:813 +msgid "" +"Atomic grouping (``(?>...)``) and possessive quantifiers (``*+``, ``++``, ``?" +"+``, ``{m,n}+``) are now supported in regular expressions. (Contributed by " +"Jeffrey C. Jacobs and Serhiy Storchaka in :issue:`433030`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:818 +msgid "shutil" +msgstr "shutil" + +#: ../../whatsnew/3.11.rst:820 +msgid "" +"Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " +"Serhiy Storchaka in :issue:`46245`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:825 +msgid "socket" +msgstr "socket" + +#: ../../whatsnew/3.11.rst:827 +msgid "" +"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" +"`30512`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:830 +msgid "" +":meth:`~socket.create_connection` has an option to raise, in case of failure " +"to connect, an :exc:`ExceptionGroup` containing all errors instead of only " +"raising the last error. (Contributed by Irit Katriel in :issue:`29980`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:836 +msgid "sqlite3" +msgstr "sqlite3" + +#: ../../whatsnew/3.11.rst:838 +msgid "" +"You can now disable the authorizer by passing :const:`None` to :meth:" +"`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" +"issue:`44491`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:842 +msgid "" +"Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " +"any Unicode character. Collation names with invalid characters now raise :" +"exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " +"(Contributed by Erlend E. Aasland in :issue:`44688`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:847 +msgid "" +":mod:`sqlite3` exceptions now include the SQLite extended error code as :" +"attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" +"`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, Daniel " +"Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:853 +msgid "" +"Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." +"getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " +"limits by connection basis. (Contributed by Erlend E. Aasland in :issue:" +"`45243`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:858 +msgid "" +":mod:`sqlite3` now sets :attr:`sqlite3.threadsafety` based on the default " +"threading mode the underlying SQLite library has been compiled with. " +"(Contributed by Erlend E. Aasland in :issue:`45613`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:862 +msgid "" +":mod:`sqlite3` C callbacks now use unraisable exceptions if callback " +"tracebacks are enabled. Users can now register an :func:`unraisable hook " +"handler ` to improve their debug experience. " +"(Contributed by Erlend E. Aasland in :issue:`45828`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:868 +msgid "" +"Fetch across rollback no longer raises :exc:`~sqlite3.InterfaceError`. " +"Instead we leave it to the SQLite library to handle these cases. " +"(Contributed by Erlend E. Aasland in :issue:`44092`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:872 +msgid "" +"Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." +"deserialize` to :class:`sqlite3.Connection` for serializing and " +"deserializing databases. (Contributed by Erlend E. Aasland in :issue:" +"`41930`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:877 +msgid "" +"Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." +"Connection` for creating aggregate window functions. (Contributed by Erlend " +"E. Aasland in :issue:`34916`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:881 +msgid "" +"Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" +"class:`sqlite3.Blob` allows incremental I/O operations on blobs. " +"(Contributed by Aviv Palivoda and Erlend E. Aasland in :issue:`24905`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:887 +msgid "sys" +msgstr "sys" + +#: ../../whatsnew/3.11.rst:889 +msgid "" +":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " +"the ``value`` (the exception instance), so when an exception is modified " +"while it is being handled, the changes are reflected in the results of " +"subsequent calls to :func:`exc_info`. (Contributed by Irit Katriel in :issue:" +"`45711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:895 +msgid "" +"Add :func:`sys.exception` which returns the active exception instance " +"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" +"issue:`46328`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:899 +msgid "" +"Add the :data:`sys.flags.safe_path ` flag. (Contributed by Victor " +"Stinner in :gh:`57684`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:904 +msgid "sysconfig" +msgstr "sysconfig" + +#: ../../whatsnew/3.11.rst:906 +msgid "" +"Three new :ref:`installation schemes ` (*posix_venv*, " +"*nt_venv* and *venv*) were added and are used when Python creates new " +"virtual environments or when it is running from a virtual environment. The " +"first two schemes (*posix_venv* and *nt_venv*) are OS-specific for non-" +"Windows and Windows, the *venv* is essentially an alias to one of them " +"according to the OS Python runs on. This is useful for downstream " +"distributors who modify :func:`sysconfig.get_preferred_scheme`. Third party " +"code that creates new virtual environments should use the new *venv* " +"installation scheme to determine the paths, as does :mod:`venv`. " +"(Contributed by Miro Hrončok in :issue:`45413`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:921 +msgid "threading" +msgstr "threading" + +#: ../../whatsnew/3.11.rst:923 +msgid "" +"On Unix, if the ``sem_clockwait()`` function is available in the C library " +"(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " +"the monotonic clock (:data:`time.CLOCK_MONOTONIC`) for the timeout, rather " +"than using the system clock (:data:`time.CLOCK_REALTIME`), to not be " +"affected by system clock changes. (Contributed by Victor Stinner in :issue:" +"`41710`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:932 +msgid "time" +msgstr "time" + +#: ../../whatsnew/3.11.rst:934 +msgid "" +"On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` or " +"``nanosleep()`` function, if available, which has a resolution of 1 " +"nanosecond (10\\ :sup:`-9` seconds), rather than using ``select()`` which " +"has a resolution of 1 microsecond (10\\ :sup:`-6` seconds). (Contributed by " +"Benjamin Szőke and Victor Stinner in :issue:`21302`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:940 +msgid "" +"On Windows 8.1 and newer, :func:`time.sleep` now uses a waitable timer based " +"on `high-resolution timers `_ which has a resolution of " +"100 nanoseconds (10\\ :sup:`-7` seconds). Previously, it had a resolution of " +"1 millisecond (10\\ :sup:`-3` seconds). (Contributed by Benjamin Szőke, Dong-" +"hee Na, Eryk Sun and Victor Stinner in :issue:`21302` and :issue:`45429`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:949 +msgid "traceback" +msgstr "traceback" + +#: ../../whatsnew/3.11.rst:951 +msgid "" +"Add :func:`traceback.StackSummary.format_frame_summary` to allow users to " +"override which frames appear in the traceback, and how they are formatted. " +"(Contributed by Ammar Askar in :issue:`44569`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:956 +msgid "" +"Add :func:`traceback.TracebackException.print`, which prints the formatted :" +"exc:`~traceback.TracebackException` instance to a file. (Contributed by Irit " +"Katriel in :issue:`33809`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:962 +msgid "typing" +msgstr "typing" + +#: ../../whatsnew/3.11.rst:964 +msgid "For major changes, see :ref:`new-feat-related-type-hints-311`." +msgstr "" + +#: ../../whatsnew/3.11.rst:966 +msgid "" +"Add :func:`typing.assert_never` and :class:`typing.Never`. :func:`typing." +"assert_never` is useful for asking a type checker to confirm that a line of " +"code is not reachable. At runtime, it raises an :exc:`AssertionError`. " +"(Contributed by Jelle Zijlstra in :gh:`90633`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:972 +msgid "" +"Add :func:`typing.reveal_type`. This is useful for asking a type checker " +"what type it has inferred for a given expression. At runtime it prints the " +"type of the received value. (Contributed by Jelle Zijlstra in :gh:`90572`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:977 +msgid "" +"Add :func:`typing.assert_type`. This is useful for asking a type checker to " +"confirm that the type it has inferred for a given expression matches the " +"given type. At runtime it simply returns the received value. (Contributed by " +"Jelle Zijlstra in :gh:`90638`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:982 +msgid "" +":data:`typing.TypedDict` types can now be generic. (Contributed by Samodya " +"Abeysiriwardane in :gh:`89026`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:985 +msgid "" +":class:`~typing.NamedTuple` types can now be generic. (Contributed by Serhiy " +"Storchaka in :issue:`43923`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:988 +msgid "" +"Allow subclassing of :class:`typing.Any`. This is useful for avoiding type " +"checker errors related to highly dynamic class, such as mocks. (Contributed " +"by Shantanu Jain in :gh:`91154`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:992 +msgid "" +"The :func:`typing.final` decorator now sets the ``__final__`` attributed on " +"the decorated object. (Contributed by Jelle Zijlstra in :gh:`90500`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:996 +msgid "" +"The :func:`typing.get_overloads` function can be used for introspecting the " +"overloads of a function. :func:`typing.clear_overloads` can be used to clear " +"all registered overloads of a function. (Contributed by Jelle Zijlstra in :" +"gh:`89263`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1001 +msgid "" +"The :meth:`__init__` method of :class:`~typing.Protocol` subclasses is now " +"preserved. (Contributed by Adrian Garcia Badarasco in :gh:`88970`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1004 +msgid "" +"The representation of empty tuple types (``Tuple[()]``) is simplified. This " +"affects introspection, e.g. ``get_args(Tuple[()])`` now evaluates to ``()`` " +"instead of ``((),)``. (Contributed by Serhiy Storchaka in :gh:`91137`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1009 +msgid "" +"Loosen runtime requirements for type annotations by removing the callable " +"check in the private ``typing._type_check`` function. (Contributed by " +"Gregory Beauregard in :gh:`90802`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1013 +msgid "" +":func:`typing.get_type_hints` now supports evaluating strings as forward " +"references in :ref:`PEP 585 generic aliases `. " +"(Contributed by Niklas Rosenstein in :gh:`85542`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1017 +msgid "" +":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " +"parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" +"`90353`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1021 +msgid "" +":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" +"`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" +"`90711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1025 +msgid "" +":func:`typing.no_type_check` no longer modifies external classes and " +"functions. It also now correctly marks classmethods as not to be type " +"checked. (Contributed by Nikita Sobolev in :gh:`90729`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1031 +msgid "tkinter" +msgstr "tkinter" + +#: ../../whatsnew/3.11.rst:1033 +msgid "" +"Added method ``info_patchlevel()`` which returns the exact version of the " +"Tcl library as a named tuple similar to :data:`sys.version_info`. " +"(Contributed by Serhiy Storchaka in :gh:`91827`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1039 +msgid "unicodedata" +msgstr "unicodedata" + +#: ../../whatsnew/3.11.rst:1041 +msgid "" +"The Unicode database has been updated to version 14.0.0. (Contributed by " +"Benjamin Peterson in :issue:`45190`)." +msgstr "" + +#: ../../whatsnew/3.11.rst:1045 +msgid "unittest" +msgstr "unittest" + +#: ../../whatsnew/3.11.rst:1047 +msgid "" +"Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." +"TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" +"meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of class :class:" +"`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest." +"enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1057 +msgid "venv" +msgstr "venv" + +#: ../../whatsnew/3.11.rst:1059 +msgid "" +"When new Python virtual environments are created, the *venv* :ref:`sysconfig " +"installation scheme ` is used to determine the paths " +"inside the environment. When Python runs in a virtual environment, the same " +"installation scheme is the default. That means that downstream distributors " +"can change the default sysconfig install scheme without changing behavior of " +"virtual environments. Third party code that also creates new virtual " +"environments should do the same. (Contributed by Miro Hrončok in :issue:" +"`45413`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1070 +msgid "warnings" +msgstr "warnings" + +#: ../../whatsnew/3.11.rst:1072 +msgid "" +":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." +"simplefilter`, providing a more concise way to locally ignore warnings or " +"convert them to errors. (Contributed by Zac Hatfield-Dodds in :issue:" +"`47074`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1077 +msgid "zipfile" +msgstr "zipfile" + +#: ../../whatsnew/3.11.rst:1079 +msgid "" +"Added support for specifying member name encoding for reading metadata in " +"the zipfile's directory and file headers. (Contributed by Stephen J. " +"Turnbull and Serhiy Storchaka in :issue:`28080`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1084 +msgid "fcntl" +msgstr "fcntl" + +#: ../../whatsnew/3.11.rst:1086 +msgid "" +"On FreeBSD, the :attr:`F_DUP2FD` and :attr:`F_DUP2FD_CLOEXEC` flags " +"respectively are supported, the former equals to ``dup2`` usage while the " +"latter set the ``FD_CLOEXEC`` flag in addition." +msgstr "" + +#: ../../whatsnew/3.11.rst:1092 +msgid "Optimizations" +msgstr "" + +#: ../../whatsnew/3.11.rst:1094 +msgid "" +"Compiler now optimizes simple C-style formatting with literal format " +"containing only format codes ``%s``, ``%r`` and ``%a`` and makes it as fast " +"as corresponding f-string expression. (Contributed by Serhiy Storchaka in :" +"issue:`28307`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1099 +msgid "" +"\"Zero-cost\" exceptions are implemented. The cost of ``try`` statements is " +"almost eliminated when no exception is raised. (Contributed by Mark Shannon " +"in :issue:`40222`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1103 +msgid "" +"Pure ASCII strings are now normalized in constant time by :func:`unicodedata." +"normalize`. (Contributed by Dong-hee Na in :issue:`44987`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1106 +msgid "" +":mod:`math` functions :func:`~math.comb` and :func:`~math.perm` are now up " +"to 10 times or more faster for large arguments (the speed up is larger for " +"larger *k*). (Contributed by Serhiy Storchaka in :issue:`37295`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1111 +msgid "" +"Dict don't store hash value when all inserted keys are Unicode objects. This " +"reduces dict size. For example, ``sys.getsizeof(dict.fromkeys(\"abcdefg" +"\"))`` becomes 272 bytes from 352 bytes on 64bit platform. (Contributed by " +"Inada Naoki in :issue:`46845`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1116 +msgid "" +":mod:`re`'s regular expression matching engine has been partially " +"refactored, and now uses computed gotos (or \"threaded code\") on supported " +"platforms. As a result, Python 3.11 executes the `pyperformance regular " +"expression benchmarks `_ up to 10% faster than Python 3.10." +msgstr "" + +#: ../../whatsnew/3.11.rst:1124 +msgid "Faster CPython" +msgstr "" + +#: ../../whatsnew/3.11.rst:1126 +msgid "" +"CPython 3.11 is on average `25% faster `_ than CPython 3.10 when measured with the " +"`pyperformance `_ benchmark suite, " +"and compiled with GCC on Ubuntu Linux. Depending on your workload, the " +"speedup could be up to 10-60% faster." +msgstr "" + +#: ../../whatsnew/3.11.rst:1132 +msgid "" +"This project focuses on two major areas in Python: faster startup and faster " +"runtime. Other optimizations not under this project are listed in " +"`Optimizations`_." +msgstr "" + +#: ../../whatsnew/3.11.rst:1136 +msgid "Faster Startup" +msgstr "" + +#: ../../whatsnew/3.11.rst:1139 +msgid "Frozen imports / Static code objects" +msgstr "" + +#: ../../whatsnew/3.11.rst:1141 +msgid "" +"Python caches bytecode in the :ref:`__pycache__` directory to " +"speed up module loading." +msgstr "" + +#: ../../whatsnew/3.11.rst:1144 +msgid "Previously in 3.10, Python module execution looked like this:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1150 +msgid "" +"In Python 3.11, the core modules essential for Python startup are \"frozen" +"\". This means that their code objects (and bytecode) are statically " +"allocated by the interpreter. This reduces the steps in module execution " +"process to this:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1158 +msgid "" +"Interpreter startup is now 10-15% faster in Python 3.11. This has a big " +"impact for short-running programs using Python." +msgstr "" + +#: ../../whatsnew/3.11.rst:1161 +msgid "" +"(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in numerous " +"issues.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1165 +msgid "Faster Runtime" +msgstr "" + +#: ../../whatsnew/3.11.rst:1168 +msgid "Cheaper, lazy Python frames" +msgstr "" + +#: ../../whatsnew/3.11.rst:1169 +msgid "" +"Python frames are created whenever Python calls a Python function. This " +"frame holds execution information. The following are new frame optimizations:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1172 +msgid "Streamlined the frame creation process." +msgstr "" + +#: ../../whatsnew/3.11.rst:1173 +msgid "" +"Avoided memory allocation by generously re-using frame space on the C stack." +msgstr "" + +#: ../../whatsnew/3.11.rst:1174 +msgid "" +"Streamlined the internal frame struct to contain only essential information. " +"Frames previously held extra debugging and memory management information." +msgstr "" + +#: ../../whatsnew/3.11.rst:1177 +msgid "" +"Old-style frame objects are now created only when requested by debuggers or " +"by Python introspection functions such as ``sys._getframe`` or ``inspect." +"currentframe``. For most user code, no frame objects are created at all. As " +"a result, nearly all Python functions calls have sped up significantly. We " +"measured a 3-7% speedup in pyperformance." +msgstr "" + +#: ../../whatsnew/3.11.rst:1183 +msgid "(Contributed by Mark Shannon in :issue:`44590`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1188 +msgid "Inlined Python function calls" +msgstr "" + +#: ../../whatsnew/3.11.rst:1189 +msgid "" +"During a Python function call, Python will call an evaluating C function to " +"interpret that function's code. This effectively limits pure Python " +"recursion to what's safe for the C stack." +msgstr "" + +#: ../../whatsnew/3.11.rst:1193 +msgid "" +"In 3.11, when CPython detects Python code calling another Python function, " +"it sets up a new frame, and \"jumps\" to the new code inside the new frame. " +"This avoids calling the C interpreting function altogether." +msgstr "" + +#: ../../whatsnew/3.11.rst:1197 +msgid "" +"Most Python function calls now consume no C stack space. This speeds up most " +"of such calls. In simple recursive functions like fibonacci or factorial, a " +"1.7x speedup was observed. This also means recursive functions can recurse " +"significantly deeper (if the user increases the recursion limit). We " +"measured a 1-3% improvement in pyperformance." +msgstr "" + +#: ../../whatsnew/3.11.rst:1203 +msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1206 +msgid "PEP 659: Specializing Adaptive Interpreter" +msgstr "" + +#: ../../whatsnew/3.11.rst:1207 +msgid "" +":pep:`659` is one of the key parts of the faster CPython project. The " +"general idea is that while Python is a dynamic language, most code has " +"regions where objects and types rarely change. This concept is known as " +"*type stability*." +msgstr "" + +#: ../../whatsnew/3.11.rst:1211 +msgid "" +"At runtime, Python will try to look for common patterns and type stability " +"in the executing code. Python will then replace the current operation with a " +"more specialized one. This specialized operation uses fast paths available " +"only to those use cases/types, which generally outperform their generic " +"counterparts. This also brings in another concept called *inline caching*, " +"where Python caches the results of expensive operations directly in the " +"bytecode." +msgstr "" + +#: ../../whatsnew/3.11.rst:1218 +msgid "" +"The specializer will also combine certain common instruction pairs into one " +"superinstruction. This reduces the overhead during execution." +msgstr "" + +#: ../../whatsnew/3.11.rst:1221 +msgid "" +"Python will only specialize when it sees code that is \"hot\" (executed " +"multiple times). This prevents Python from wasting time for run-once code. " +"Python can also de-specialize when code is too dynamic or when the use " +"changes. Specialization is attempted periodically, and specialization " +"attempts are not too expensive. This allows specialization to adapt to new " +"circumstances." +msgstr "" + +#: ../../whatsnew/3.11.rst:1228 +msgid "" +"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" +"pep:`659` for more information. Implementation by Mark Shannon and Brandt " +"Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1236 +msgid "Operation" +msgstr "" + +#: ../../whatsnew/3.11.rst:1236 +msgid "Form" +msgstr "" + +#: ../../whatsnew/3.11.rst:1236 +msgid "Specialization" +msgstr "" + +#: ../../whatsnew/3.11.rst:1236 +msgid "Operation speedup (up to)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1236 +msgid "Contributor(s)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1239 +msgid "Binary operations" +msgstr "" + +#: ../../whatsnew/3.11.rst:1239 +msgid "``x+x; x*x; x-x;``" +msgstr "``x+x; x*x; x-x;``" + +#: ../../whatsnew/3.11.rst:1239 +msgid "" +"Binary add, multiply and subtract for common types such as ``int``, " +"``float``, and ``str`` take custom fast paths for their underlying types." +msgstr "" + +#: ../../whatsnew/3.11.rst:1239 +msgid "10%" +msgstr "10%" + +#: ../../whatsnew/3.11.rst:1239 +msgid "Mark Shannon, Dong-hee Na, Brandt Bucher, Dennis Sweeney" +msgstr "" + +#: ../../whatsnew/3.11.rst:1244 +msgid "Subscript" +msgstr "" + +#: ../../whatsnew/3.11.rst:1244 +msgid "``a[i]``" +msgstr "``a[i]``" + +#: ../../whatsnew/3.11.rst:1244 +msgid "" +"Subscripting container types such as ``list``, ``tuple`` and ``dict`` " +"directly index the underlying data structures." +msgstr "" + +#: ../../whatsnew/3.11.rst:1248 +msgid "" +"Subscripting custom ``__getitem__`` is also inlined similar to :ref:`inline-" +"calls`." +msgstr "" + +#: ../../whatsnew/3.11.rst:1244 ../../whatsnew/3.11.rst:1251 +msgid "10-25%" +msgstr "10-25%" + +#: ../../whatsnew/3.11.rst:1244 +msgid "Irit Katriel, Mark Shannon" +msgstr "Irit Katriel, Mark Shannon" + +#: ../../whatsnew/3.11.rst:1251 +msgid "Store subscript" +msgstr "" + +#: ../../whatsnew/3.11.rst:1251 +msgid "``a[i] = z``" +msgstr "``a[i] = z``" + +#: ../../whatsnew/3.11.rst:1251 +msgid "Similar to subscripting specialization above." +msgstr "" + +#: ../../whatsnew/3.11.rst:1251 +msgid "Dennis Sweeney" +msgstr "Dennis Sweeney" + +#: ../../whatsnew/3.11.rst:1254 +msgid "Calls" +msgstr "" + +#: ../../whatsnew/3.11.rst:1254 +msgid "``f(arg)`` ``C(arg)``" +msgstr "``f(arg)`` ``C(arg)``" + +#: ../../whatsnew/3.11.rst:1254 +msgid "" +"Calls to common builtin (C) functions and types such as ``len`` and ``str`` " +"directly call their underlying C version. This avoids going through the " +"internal calling convention." +msgstr "" + +#: ../../whatsnew/3.11.rst:1254 +msgid "20%" +msgstr "20%" + +#: ../../whatsnew/3.11.rst:1254 +msgid "Mark Shannon, Ken Jin" +msgstr "Mark Shannon, Ken Jin" + +#: ../../whatsnew/3.11.rst:1260 +msgid "Load global variable" +msgstr "" + +#: ../../whatsnew/3.11.rst:1260 +msgid "``print`` ``len``" +msgstr "``print`` ``len``" + +#: ../../whatsnew/3.11.rst:1260 +msgid "" +"The object's index in the globals/builtins namespace is cached. Loading " +"globals and builtins require zero namespace lookups." +msgstr "" + +#: ../../whatsnew/3.11.rst:1260 +msgid "[1]_" +msgstr "[1]_" + +#: ../../whatsnew/3.11.rst:1260 ../../whatsnew/3.11.rst:1264 +#: ../../whatsnew/3.11.rst:1273 +msgid "Mark Shannon" +msgstr "Mark Shannon" + +#: ../../whatsnew/3.11.rst:1264 +msgid "Load attribute" +msgstr "" + +#: ../../whatsnew/3.11.rst:1264 +msgid "``o.attr``" +msgstr "``o.attr``" + +#: ../../whatsnew/3.11.rst:1264 +msgid "" +"Similar to loading global variables. The attribute's index inside the class/" +"object's namespace is cached. In most cases, attribute loading will require " +"zero namespace lookups." +msgstr "" + +#: ../../whatsnew/3.11.rst:1264 +msgid "[2]_" +msgstr "[2]_" + +#: ../../whatsnew/3.11.rst:1269 +msgid "Load methods for call" +msgstr "" + +#: ../../whatsnew/3.11.rst:1269 +msgid "``o.meth()``" +msgstr "``o.meth()``" + +#: ../../whatsnew/3.11.rst:1269 +msgid "" +"The actual address of the method is cached. Method loading now has no " +"namespace lookups -- even for classes with long inheritance chains." +msgstr "" + +#: ../../whatsnew/3.11.rst:1269 +msgid "10-20%" +msgstr "10-20%" + +#: ../../whatsnew/3.11.rst:1269 +msgid "Ken Jin, Mark Shannon" +msgstr "Ken Jin, Mark Shannon" + +#: ../../whatsnew/3.11.rst:1273 +msgid "Store attribute" +msgstr "" + +#: ../../whatsnew/3.11.rst:1273 +msgid "``o.attr = z``" +msgstr "``o.attr = z``" + +#: ../../whatsnew/3.11.rst:1273 +msgid "Similar to load attribute optimization." +msgstr "" + +#: ../../whatsnew/3.11.rst:1273 +msgid "2% in pyperformance" +msgstr "" + +#: ../../whatsnew/3.11.rst:1276 +msgid "Unpack Sequence" +msgstr "" + +#: ../../whatsnew/3.11.rst:1276 +msgid "``*seq``" +msgstr "``*seq``" + +#: ../../whatsnew/3.11.rst:1276 +msgid "" +"Specialized for common containers such as ``list`` and ``tuple``. Avoids " +"internal calling convention." +msgstr "" + +#: ../../whatsnew/3.11.rst:1276 +msgid "8%" +msgstr "8%" + +#: ../../whatsnew/3.11.rst:1276 +msgid "Brandt Bucher" +msgstr "" + +#: ../../whatsnew/3.11.rst:1280 +msgid "" +"A similar optimization already existed since Python 3.8. 3.11 specializes " +"for more forms and reduces some overhead." +msgstr "" + +#: ../../whatsnew/3.11.rst:1283 +msgid "" +"A similar optimization already existed since Python 3.10. 3.11 specializes " +"for more forms. Furthermore, all attribute loads should be sped up by :issue:" +"`45947`." +msgstr "" + +#: ../../whatsnew/3.11.rst:1289 +msgid "Misc" +msgstr "" + +#: ../../whatsnew/3.11.rst:1291 +msgid "" +"Objects now require less memory due to lazily created object namespaces. " +"Their namespace dictionaries now also share keys more freely. (Contributed " +"Mark Shannon in :issue:`45340` and :issue:`40116`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1295 +msgid "" +"A more concise representation of exceptions in the interpreter reduced the " +"time required for catching an exception by about 10%. (Contributed by Irit " +"Katriel in :issue:`45711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1300 +msgid "FAQ" +msgstr "" + +#: ../../whatsnew/3.11.rst:1302 +msgid "Q: How should I write my code to utilize these speedups?" +msgstr "" + +#: ../../whatsnew/3.11.rst:1306 +msgid "" +"A: You don't have to change your code. Write Pythonic code that follows " +"common best practices. The Faster CPython project optimizes for common code " +"patterns we observe." +msgstr "" + +#: ../../whatsnew/3.11.rst:1309 +msgid "Q: Will CPython 3.11 use more memory?" +msgstr "" + +#: ../../whatsnew/3.11.rst:1313 +msgid "" +"A: Maybe not. We don't expect memory use to exceed 20% more than 3.10. This " +"is offset by memory optimizations for frame objects and object dictionaries " +"as mentioned above." +msgstr "" + +#: ../../whatsnew/3.11.rst:1316 +msgid "Q: I don't see any speedups in my workload. Why?" +msgstr "" + +#: ../../whatsnew/3.11.rst:1321 +msgid "" +"A: Certain code won't have noticeable benefits. If your code spends most of " +"its time on I/O operations, or already does most of its computation in a C " +"extension library like numpy, there won't be significant speedup. This " +"project currently benefits pure-Python workloads the most." +msgstr "" + +#: ../../whatsnew/3.11.rst:1325 +msgid "" +"Furthermore, the pyperformance figures are a geometric mean. Even within the " +"pyperformance benchmarks, certain benchmarks have slowed down slightly, " +"while others have sped up by nearly 2x!" +msgstr "" + +#: ../../whatsnew/3.11.rst:1328 +msgid "Q: Is there a JIT compiler?" +msgstr "" + +#: ../../whatsnew/3.11.rst:1330 +msgid "A: No. We're still exploring other optimizations." +msgstr "" + +#: ../../whatsnew/3.11.rst:1334 +msgid "About" +msgstr "" + +#: ../../whatsnew/3.11.rst:1336 +msgid "" +"Faster CPython explores optimizations for :term:`CPython`. The main team is " +"funded by Microsoft to work on this full-time. Pablo Galindo Salgado is also " +"funded by Bloomberg LP to work on the project part-time. Finally, many " +"contributors are volunteers from the community." +msgstr "" + +#: ../../whatsnew/3.11.rst:1343 +msgid "CPython bytecode changes" +msgstr "" + +#: ../../whatsnew/3.11.rst:1345 +msgid "" +"The bytecode now contains inline cache entries, which take the form of :" +"opcode:`CACHE` instructions. Many opcodes expect to be followed by an exact " +"number of caches, and instruct the interpreter to skip over them at runtime. " +"Populated caches can look like arbitrary instructions, so great care should " +"be taken when reading or modifying raw, adaptive bytecode containing " +"quickened data." +msgstr "" + +#: ../../whatsnew/3.11.rst:1352 +msgid "" +"Replaced all numeric ``BINARY_*`` and ``INPLACE_*`` instructions with a " +"single :opcode:`BINARY_OP` implementation." +msgstr "" + +#: ../../whatsnew/3.11.rst:1355 +msgid "" +"Replaced the three call instructions: :opcode:`CALL_FUNCTION`, :opcode:" +"`CALL_FUNCTION_KW` and :opcode:`CALL_METHOD` with :opcode:`PUSH_NULL`, :" +"opcode:`PRECALL`, :opcode:`CALL`, and :opcode:`KW_NAMES`. This decouples the " +"argument shifting for methods from the handling of keyword arguments and " +"allows better specialization of calls." +msgstr "" + +#: ../../whatsnew/3.11.rst:1362 +msgid "Removed ``COPY_DICT_WITHOUT_KEYS`` and ``GEN_START``." +msgstr "" + +#: ../../whatsnew/3.11.rst:1364 +msgid "" +":opcode:`MATCH_CLASS` and :opcode:`MATCH_KEYS` no longer push an additional " +"boolean value indicating whether the match succeeded or failed. Instead, " +"they indicate failure with :const:`None` (where a tuple of extracted values " +"would otherwise be)." +msgstr "" + +#: ../../whatsnew/3.11.rst:1369 +msgid "" +"Replace several stack manipulation instructions (``DUP_TOP``, " +"``DUP_TOP_TWO``, ``ROT_TWO``, ``ROT_THREE``, ``ROT_FOUR``, and ``ROT_N``) " +"with new :opcode:`COPY` and :opcode:`SWAP` instructions." +msgstr "" + +#: ../../whatsnew/3.11.rst:1373 +msgid "" +"Replaced :opcode:`JUMP_IF_NOT_EXC_MATCH` by :opcode:`CHECK_EXC_MATCH` which " +"performs the check but does not jump." +msgstr "" + +#: ../../whatsnew/3.11.rst:1376 +msgid "" +"Replaced :opcode:`JUMP_IF_NOT_EG_MATCH` by :opcode:`CHECK_EG_MATCH` which " +"performs the check but does not jump." +msgstr "" + +#: ../../whatsnew/3.11.rst:1379 +msgid "" +"Replaced :opcode:`JUMP_ABSOLUTE` by the relative :opcode:`JUMP_BACKWARD`." +msgstr "" + +#: ../../whatsnew/3.11.rst:1381 +msgid "" +"Added :opcode:`JUMP_BACKWARD_NO_INTERRUPT`, which is used in certain loops " +"where it is undesirable to handle interrupts." +msgstr "" + +#: ../../whatsnew/3.11.rst:1384 +msgid "" +"Replaced :opcode:`POP_JUMP_IF_TRUE` and :opcode:`POP_JUMP_IF_FALSE` by the " +"relative :opcode:`POP_JUMP_FORWARD_IF_TRUE`, :opcode:" +"`POP_JUMP_BACKWARD_IF_TRUE`, :opcode:`POP_JUMP_FORWARD_IF_FALSE` and :opcode:" +"`POP_JUMP_BACKWARD_IF_FALSE`." +msgstr "" + +#: ../../whatsnew/3.11.rst:1388 +msgid "" +"Added :opcode:`POP_JUMP_FORWARD_IF_NOT_NONE`, :opcode:" +"`POP_JUMP_BACKWARD_IF_NOT_NONE`, :opcode:`POP_JUMP_FORWARD_IF_NONE` and :" +"opcode:`POP_JUMP_BACKWARD_IF_NONE` opcodes to speed up conditional jumps." +msgstr "" + +#: ../../whatsnew/3.11.rst:1392 +msgid "" +":opcode:`JUMP_IF_TRUE_OR_POP` and :opcode:`JUMP_IF_FALSE_OR_POP` are now " +"relative rather than absolute." +msgstr "" + +#: ../../whatsnew/3.11.rst:1395 +msgid "" +":opcode:`RESUME` has been added. It is a no-op. Performs internal tracing, " +"debugging and optimization checks." +msgstr "" + +#: ../../whatsnew/3.11.rst:1399 ../../whatsnew/3.11.rst:2186 +msgid "Deprecated" +msgstr "" + +#: ../../whatsnew/3.11.rst:1401 +msgid "" +"Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " +"now deprecated. It can no longer be used to wrap other descriptors such as :" +"class:`property`. The core design of this feature was flawed and caused a " +"number of downstream problems. To \"pass-through\" a :class:`classmethod`, " +"consider using the ``__wrapped__`` attribute that was added in Python 3.10. " +"(Contributed by Raymond Hettinger in :gh:`89519`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1409 +msgid "" +"Octal escapes in string and bytes literals with value larger than ``0o377`` " +"now produce :exc:`DeprecationWarning`. In a future Python version they will " +"be a :exc:`SyntaxWarning` and eventually a :exc:`SyntaxError`. (Contributed " +"by Serhiy Storchaka in :gh:`81548`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1415 +msgid "" +"The :mod:`lib2to3` package and ``2to3`` tool are now deprecated and may not " +"be able to parse Python 3.10 or newer. See the :pep:`617` (New PEG parser " +"for CPython). (Contributed by Victor Stinner in :issue:`40360`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1419 +msgid "" +"Undocumented modules ``sre_compile``, ``sre_constants`` and ``sre_parse`` " +"are now deprecated. (Contributed by Serhiy Storchaka in :issue:`47152`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1423 +msgid "" +":class:`webbrowser.MacOSX` is deprecated and will be removed in Python 3.13. " +"It is untested and undocumented and also not used by webbrowser itself. " +"(Contributed by Dong-hee Na in :issue:`42255`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1427 +msgid "" +"The behavior of returning a value from a :class:`~unittest.TestCase` and :" +"class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " +"default ``None`` value), is now deprecated." +msgstr "" + +#: ../../whatsnew/3.11.rst:1431 +msgid "" +"Deprecated the following :mod:`unittest` functions, scheduled for removal in " +"Python 3.13:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1434 +msgid ":func:`unittest.findTestCases`" +msgstr ":func:`unittest.findTestCases`" + +#: ../../whatsnew/3.11.rst:1435 +msgid ":func:`unittest.makeSuite`" +msgstr ":func:`unittest.makeSuite`" + +#: ../../whatsnew/3.11.rst:1436 +msgid ":func:`unittest.getTestCaseNames`" +msgstr ":func:`unittest.getTestCaseNames`" + +#: ../../whatsnew/3.11.rst:1438 +msgid "Use :class:`~unittest.TestLoader` method instead:" +msgstr "改用 :class:`~unittest.TestLoader`:" + +#: ../../whatsnew/3.11.rst:1440 +msgid ":meth:`unittest.TestLoader.loadTestsFromModule`" +msgstr ":meth:`unittest.TestLoader.loadTestsFromModule`" + +#: ../../whatsnew/3.11.rst:1441 +msgid ":meth:`unittest.TestLoader.loadTestsFromTestCase`" +msgstr ":meth:`unittest.TestLoader.loadTestsFromTestCase`" + +#: ../../whatsnew/3.11.rst:1442 +msgid ":meth:`unittest.TestLoader.getTestCaseNames`" +msgstr ":meth:`unittest.TestLoader.getTestCaseNames`" + +#: ../../whatsnew/3.11.rst:1444 +msgid "(Contributed by Erlend E. Aasland in :issue:`5846`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1446 +msgid "" +"The :meth:`turtle.RawTurtle.settiltangle` is deprecated since Python 3.1, it " +"now emits a deprecation warning and will be removed in Python 3.13. Use :" +"meth:`turtle.RawTurtle.tiltangle` instead (it was earlier incorrectly marked " +"as deprecated, its docstring is now corrected). (Contributed by Hugo van " +"Kemenade in :issue:`45837`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1452 +msgid "" +"The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. " +"Calling ``int(a)`` when ``type(a)`` implements :meth:`__trunc__` but not :" +"meth:`__int__` or :meth:`__index__` now raises a :exc:`DeprecationWarning`. " +"(Contributed by Zackery Spytz in :issue:`44977`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1457 +msgid "" +"The following have been deprecated in :mod:`configparser` since Python 3.2. " +"Their deprecation warnings have now been updated to note they will removed " +"in Python 3.12:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1461 +msgid "the :class:`configparser.SafeConfigParser` class" +msgstr ":class:`configparser.SafeConfigParser` class" + +#: ../../whatsnew/3.11.rst:1462 +msgid "the :attr:`configparser.ParsingError.filename` property" +msgstr ":attr:`configparser.ParsingError.filename` 特性" + +#: ../../whatsnew/3.11.rst:1463 +msgid "the :meth:`configparser.RawConfigParser.readfp` method" +msgstr ":meth:`configparser.RawConfigParser.readfp` 方法" + +#: ../../whatsnew/3.11.rst:1465 +msgid "(Contributed by Hugo van Kemenade in :issue:`45173`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1467 +msgid "" +":class:`configparser.LegacyInterpolation` has been deprecated in the " +"docstring since Python 3.2. It now emits a :exc:`DeprecationWarning` and " +"will be removed in Python 3.13. Use :class:`configparser.BasicInterpolation` " +"or :class:`configparser.ExtendedInterpolation` instead. (Contributed by Hugo " +"van Kemenade in :issue:`46607`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1473 +msgid "" +"The :func:`locale.getdefaultlocale` function is deprecated and will be " +"removed in Python 3.13. Use :func:`locale.setlocale`, :func:`locale." +"getpreferredencoding(False) ` and :func:`locale." +"getlocale` functions instead. (Contributed by Victor Stinner in :gh:`90817`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1479 +msgid "" +"The :func:`locale.resetlocale` function is deprecated and will be removed in " +"Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " +"(Contributed by Victor Stinner in :gh:`90817`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1483 +msgid "" +"The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been " +"deprecated since at least Python 3.6. Their documentation and deprecation " +"warnings have now been updated to note they will removed in Python 3.12 (:" +"pep:`594`). (Contributed by Hugo van Kemenade in :issue:`47022`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1489 +msgid "" +":pep:`594` led to the deprecations of the following modules which are slated " +"for removal in Python 3.13:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1492 +msgid ":mod:`aifc`" +msgstr ":mod:`aifc`" + +#: ../../whatsnew/3.11.rst:1493 +msgid ":mod:`audioop`" +msgstr ":mod:`audioop`" + +#: ../../whatsnew/3.11.rst:1494 +msgid ":mod:`cgi`" +msgstr ":mod:`cgi`" + +#: ../../whatsnew/3.11.rst:1495 +msgid ":mod:`cgitb`" +msgstr ":mod:`cgitb`" + +#: ../../whatsnew/3.11.rst:1496 +msgid ":mod:`chunk`" +msgstr ":mod:`chunk`" + +#: ../../whatsnew/3.11.rst:1497 +msgid ":mod:`crypt`" +msgstr ":mod:`crypt`" + +#: ../../whatsnew/3.11.rst:1498 +msgid ":mod:`imghdr`" +msgstr ":mod:`imghdr`" + +#: ../../whatsnew/3.11.rst:1499 +msgid ":mod:`mailcap`" +msgstr ":mod:`mailcap`" + +#: ../../whatsnew/3.11.rst:1500 +msgid ":mod:`msilib`" +msgstr ":mod:`msilib`" + +#: ../../whatsnew/3.11.rst:1501 +msgid ":mod:`nis`" +msgstr ":mod:`nis`" + +#: ../../whatsnew/3.11.rst:1502 +msgid ":mod:`nntplib`" +msgstr ":mod:`nntplib`" + +#: ../../whatsnew/3.11.rst:1503 +msgid ":mod:`ossaudiodev`" +msgstr ":mod:`ossaudiodev`" + +#: ../../whatsnew/3.11.rst:1504 +msgid ":mod:`pipes`" +msgstr ":mod:`pipes`" + +#: ../../whatsnew/3.11.rst:1505 +msgid ":mod:`sndhdr`" +msgstr ":mod:`sndhdr`" + +#: ../../whatsnew/3.11.rst:1506 +msgid ":mod:`spwd`" +msgstr ":mod:`spwd`" + +#: ../../whatsnew/3.11.rst:1507 +msgid ":mod:`sunau`" +msgstr ":mod:`sunau`" + +#: ../../whatsnew/3.11.rst:1508 +msgid ":mod:`telnetlib`" +msgstr ":mod:`telnetlib`" + +#: ../../whatsnew/3.11.rst:1509 +msgid ":mod:`uu`" +msgstr ":mod:`uu`" + +#: ../../whatsnew/3.11.rst:1510 +msgid ":mod:`xdrlib`" +msgstr ":mod:`xdrlib`" + +#: ../../whatsnew/3.11.rst:1512 +msgid "" +"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" +"`68966`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1515 +msgid "" +"More strict rules will be applied now applied for numerical group references " +"and group names in regular expressions in future Python versions. Only " +"sequence of ASCII digits will be now accepted as a numerical reference. The " +"group name in bytes patterns and replacement strings could only contain " +"ASCII letters and digits and underscore. For now, a deprecation warning is " +"raised for such syntax. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1523 +msgid "" +":class:`typing.Text`, which exists solely to provide compatibility support " +"between Python 2 and Python 3 code, is now deprecated. Its removal is " +"currently unplanned, but users are encouraged to use :class:`str` instead " +"wherever possible. (Contributed by Alex Waygood in :gh:`92332`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1529 +msgid "" +"The keyword argument syntax for constructing :data:`~typing.TypedDict` types " +"is now deprecated. Support will be removed in Python 3.13. (Contributed by " +"Jingchen Ye in :gh:`90224`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1533 +msgid "" +"The :func:`re.template` function and the corresponding :const:`re.TEMPLATE` " +"and :const:`re.T` flags are deprecated, as they were undocumented and lacked " +"an obvious purpose. They will be removed in Python 3.13. (Contributed by " +"Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1540 +msgid "Pending Removal in Python 3.12" +msgstr "" + +#: ../../whatsnew/3.11.rst:1542 +msgid "" +"The following APIs have been deprecated in earlier Python releases, and will " +"be removed in Python 3.12." +msgstr "" + +#: ../../whatsnew/3.11.rst:1545 +msgid "Python API:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1547 +msgid ":class:`pkgutil.ImpImporter`" +msgstr ":class:`pkgutil.ImpImporter`" + +#: ../../whatsnew/3.11.rst:1548 +msgid ":class:`pkgutil.ImpLoader`" +msgstr ":class:`pkgutil.ImpLoader`" + +#: ../../whatsnew/3.11.rst:1549 +msgid ":envvar:`PYTHONTHREADDEBUG`" +msgstr ":envvar:`PYTHONTHREADDEBUG`" + +#: ../../whatsnew/3.11.rst:1550 +msgid ":func:`importlib.find_loader`" +msgstr ":func:`importlib.find_loader`" + +#: ../../whatsnew/3.11.rst:1551 +msgid ":func:`importlib.util.module_for_loader`" +msgstr ":func:`importlib.util.module_for_loader`" + +#: ../../whatsnew/3.11.rst:1552 +msgid ":func:`importlib.util.set_loader_wrapper`" +msgstr ":func:`importlib.util.set_loader_wrapper`" + +#: ../../whatsnew/3.11.rst:1553 +msgid ":func:`importlib.util.set_package_wrapper`" +msgstr ":func:`importlib.util.set_package_wrapper`" + +#: ../../whatsnew/3.11.rst:1554 +msgid ":meth:`importlib.abc.Loader.module_repr`" +msgstr ":meth:`importlib.abc.Loader.module_repr`" + +#: ../../whatsnew/3.11.rst:1555 +msgid ":meth:`importlib.abc.Loadermodule_repr`" +msgstr ":meth:`importlib.abc.Loadermodule_repr`" + +#: ../../whatsnew/3.11.rst:1556 ../../whatsnew/3.11.rst:1557 +msgid ":meth:`importlib.abc.MetaPathFinder.find_module`" +msgstr ":meth:`importlib.abc.MetaPathFinder.find_module`" + +#: ../../whatsnew/3.11.rst:1558 +msgid ":meth:`importlib.abc.PathEntryFinder.find_loader`" +msgstr ":meth:`importlib.abc.PathEntryFinder.find_loader`" + +#: ../../whatsnew/3.11.rst:1559 +msgid ":meth:`importlib.abc.PathEntryFinder.find_module`" +msgstr ":meth:`importlib.abc.PathEntryFinder.find_module`" + +#: ../../whatsnew/3.11.rst:1560 +msgid ":meth:`importlib.machinery.BuiltinImporter.find_module`" +msgstr ":meth:`importlib.machinery.BuiltinImporter.find_module`" + +#: ../../whatsnew/3.11.rst:1561 +msgid ":meth:`importlib.machinery.BuiltinLoader.module_repr`" +msgstr ":meth:`importlib.machinery.BuiltinLoader.module_repr`" + +#: ../../whatsnew/3.11.rst:1562 +msgid ":meth:`importlib.machinery.FileFinder.find_loader`" +msgstr ":meth:`importlib.machinery.FileFinder.find_loader`" + +#: ../../whatsnew/3.11.rst:1563 +msgid ":meth:`importlib.machinery.FileFinder.find_module`" +msgstr ":meth:`importlib.machinery.FileFinder.find_module`" + +#: ../../whatsnew/3.11.rst:1564 +msgid ":meth:`importlib.machinery.FrozenImporter.find_module`" +msgstr ":meth:`importlib.machinery.FrozenImporter.find_module`" + +#: ../../whatsnew/3.11.rst:1565 +msgid ":meth:`importlib.machinery.FrozenLoader.module_repr`" +msgstr ":meth:`importlib.machinery.FrozenLoader.module_repr`" + +#: ../../whatsnew/3.11.rst:1566 +msgid ":meth:`importlib.machinery.PathFinder.find_module`" +msgstr ":meth:`importlib.machinery.PathFinder.find_module`" + +#: ../../whatsnew/3.11.rst:1567 +msgid ":meth:`importlib.machinery.WindowsRegistryFinder.find_module`" +msgstr ":meth:`importlib.machinery.WindowsRegistryFinder.find_module`" + +#: ../../whatsnew/3.11.rst:1568 +msgid ":meth:`pathlib.Path.link_to`" +msgstr ":meth:`pathlib.Path.link_to`" + +#: ../../whatsnew/3.11.rst:1569 +msgid "The entire :ref:`distutils namespace `" +msgstr "" + +#: ../../whatsnew/3.11.rst:1570 +msgid ":func:`cgi.log`" +msgstr ":func:`cgi.log`" + +#: ../../whatsnew/3.11.rst:1571 +msgid ":func:`sqlite3.OptimizedUnicode`" +msgstr ":func:`sqlite3.OptimizedUnicode`" + +#: ../../whatsnew/3.11.rst:1572 +msgid ":func:`sqlite3.enable_shared_cache`" +msgstr ":func:`sqlite3.enable_shared_cache`" + +#: ../../whatsnew/3.11.rst:1574 +msgid "C API:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1576 +msgid ":c:func:`PyUnicode_AS_DATA`" +msgstr ":c:func:`PyUnicode_AS_DATA`" + +#: ../../whatsnew/3.11.rst:1577 +msgid ":c:func:`PyUnicode_AS_UNICODE`" +msgstr ":c:func:`PyUnicode_AS_UNICODE`" + +#: ../../whatsnew/3.11.rst:1578 +msgid ":c:func:`PyUnicode_AsUnicodeAndSize`" +msgstr ":c:func:`PyUnicode_AsUnicodeAndSize`" + +#: ../../whatsnew/3.11.rst:1579 +msgid ":c:func:`PyUnicode_AsUnicode`" +msgstr ":c:func:`PyUnicode_AsUnicode`" + +#: ../../whatsnew/3.11.rst:1580 +msgid ":c:func:`PyUnicode_FromUnicode`" +msgstr ":c:func:`PyUnicode_FromUnicode`" + +#: ../../whatsnew/3.11.rst:1581 +msgid ":c:func:`PyUnicode_GET_DATA_SIZE`" +msgstr ":c:func:`PyUnicode_GET_DATA_SIZE`" + +#: ../../whatsnew/3.11.rst:1582 +msgid ":c:func:`PyUnicode_GET_SIZE`" +msgstr ":c:func:`PyUnicode_GET_SIZE`" + +#: ../../whatsnew/3.11.rst:1583 +msgid ":c:func:`PyUnicode_GetSize`" +msgstr ":c:func:`PyUnicode_GetSize`" + +#: ../../whatsnew/3.11.rst:1584 +msgid ":c:func:`PyUnicode_IS_COMPACT`" +msgstr ":c:func:`PyUnicode_IS_COMPACT`" + +#: ../../whatsnew/3.11.rst:1585 +msgid ":c:func:`PyUnicode_IS_READY`" +msgstr ":c:func:`PyUnicode_IS_READY`" + +#: ../../whatsnew/3.11.rst:1586 +msgid ":c:func:`PyUnicode_READY`" +msgstr ":c:func:`PyUnicode_READY`" + +#: ../../whatsnew/3.11.rst:1587 +msgid ":c:func:`Py_UNICODE_WSTR_LENGTH`" +msgstr ":c:func:`Py_UNICODE_WSTR_LENGTH`" + +#: ../../whatsnew/3.11.rst:1588 +msgid ":c:func:`_PyUnicode_AsUnicode`" +msgstr ":c:func:`_PyUnicode_AsUnicode`" + +#: ../../whatsnew/3.11.rst:1589 +msgid ":c:macro:`PyUnicode_WCHAR_KIND`" +msgstr ":c:macro:`PyUnicode_WCHAR_KIND`" + +#: ../../whatsnew/3.11.rst:1590 +msgid ":c:type:`PyUnicodeObject`" +msgstr ":c:type:`PyUnicodeObject`" + +#: ../../whatsnew/3.11.rst:1591 +msgid ":c:func:`PyUnicode_InternImmortal()`" +msgstr ":c:func:`PyUnicode_InternImmortal()`" + +#: ../../whatsnew/3.11.rst:1595 ../../whatsnew/3.11.rst:2211 +msgid "Removed" +msgstr "" + +#: ../../whatsnew/3.11.rst:1597 +msgid "" +":class:`smtpd.MailmanProxy` is now removed as it is unusable without an " +"external module, ``mailman``. (Contributed by Dong-hee Na in :issue:`35800`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1600 +msgid "" +"The ``binhex`` module, deprecated in Python 3.9, is now removed. The " +"following :mod:`binascii` functions, deprecated in Python 3.9, are now also " +"removed:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1604 +msgid "``a2b_hqx()``, ``b2a_hqx()``;" +msgstr "``a2b_hqx()``, ``b2a_hqx()``;" + +#: ../../whatsnew/3.11.rst:1605 +msgid "``rlecode_hqx()``, ``rledecode_hqx()``." +msgstr "``rlecode_hqx()``, ``rledecode_hqx()``." + +#: ../../whatsnew/3.11.rst:1607 +msgid "The :func:`binascii.crc_hqx` function remains available." +msgstr "" + +#: ../../whatsnew/3.11.rst:1609 +msgid "(Contributed by Victor Stinner in :issue:`45085`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1611 +msgid "" +"The distutils ``bdist_msi`` command, deprecated in Python 3.9, is now " +"removed. Use ``bdist_wheel`` (wheel packages) instead. (Contributed by Hugo " +"van Kemenade in :issue:`45124`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1615 +msgid "" +"Due to significant security concerns, the *reuse_address* parameter of :meth:" +"`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " +"entirely removed. This is because of the behavior of the socket option " +"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade in :issue:" +"`45129`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1621 +msgid "" +"Removed :meth:`__getitem__` methods of :class:`xml.dom.pulldom." +"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." +"FileInput`, deprecated since Python 3.9. (Contributed by Hugo van Kemenade " +"in :issue:`45132`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1626 +msgid "" +"The following deprecated functions and methods are removed in the :mod:" +"`gettext` module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :" +"func:`~gettext.lngettext` and :func:`~gettext.ldngettext`." +msgstr "" + +#: ../../whatsnew/3.11.rst:1630 +msgid "" +"Function :func:`~gettext.bind_textdomain_codeset`, methods :meth:`~gettext." +"NullTranslations.output_charset` and :meth:`~gettext.NullTranslations." +"set_output_charset`, and the *codeset* parameter of functions :func:" +"`~gettext.translation` and :func:`~gettext.install` are also removed, since " +"they are only used for the ``l*gettext()`` functions. (Contributed by Dong-" +"hee Na and Serhiy Storchaka in :issue:`44235`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1638 +msgid "" +"The :func:`@asyncio.coroutine ` :term:`decorator` " +"enabling legacy generator-based coroutines to be compatible with async/await " +"code. The function has been deprecated since Python 3.8 and the removal was " +"initially scheduled for Python 3.10. Use :keyword:`async def` instead. " +"(Contributed by Illia Volochii in :issue:`43216`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1644 +msgid "" +":class:`asyncio.coroutines.CoroWrapper` used for wrapping legacy generator-" +"based coroutine objects in the debug mode. (Contributed by Illia Volochii " +"in :issue:`43216`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1648 +msgid "" +"Removed the deprecated ``split()`` method of :class:`_tkinter.TkappType`. " +"(Contributed by Erlend E. Aasland in :issue:`38371`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1651 +msgid "Removed from the :mod:`inspect` module:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1653 +msgid "" +"the ``getargspec`` function, deprecated since Python 3.0; use :func:`inspect." +"signature` or :func:`inspect.getfullargspec` instead." +msgstr "" + +#: ../../whatsnew/3.11.rst:1656 +msgid "" +"the ``formatargspec`` function, deprecated since Python 3.5; use the :func:" +"`inspect.signature` function and :class:`Signature` object directly." +msgstr "" + +#: ../../whatsnew/3.11.rst:1660 +msgid "" +"the undocumented ``Signature.from_builtin`` and ``Signature.from_function`` " +"functions, deprecated since Python 3.5; use the :meth:`Signature." +"from_callable() ` method instead." +msgstr "" + +#: ../../whatsnew/3.11.rst:1665 +msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1667 +msgid "" +"Remove namespace package support from unittest discovery. It was introduced " +"in Python 3.4 but has been broken since Python 3.7. (Contributed by Inada " +"Naoki in :issue:`23882`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1671 +msgid "" +"Remove ``__class_getitem__`` method from :class:`pathlib.PurePath`, because " +"it was not used and added by mistake in previous versions. (Contributed by " +"Nikita Sobolev in :issue:`46483`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1675 +msgid "" +"Remove the undocumented private ``float.__set_format__()`` method, " +"previously known as ``float.__setformat__()`` in Python 3.7. Its docstring " +"said: \"You probably don't want to use this function. It exists mainly to be " +"used in Python's test suite.\" (Contributed by Victor Stinner in :issue:" +"`46852`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1681 +msgid "" +"The ``--experimental-isolated-subinterpreters`` configure flag (and " +"corresponding ``EXPERIMENTAL_ISOLATED_SUBINTERPRETERS``) have been removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:1685 +msgid "" +"Pynche --- The Pythonically Natural Color and Hue Editor --- has been moved " +"out of ``Tools/scripts`` and is `being developed independently `_ from the Python source tree." +msgstr "" + +#: ../../whatsnew/3.11.rst:1690 ../../whatsnew/3.11.rst:1900 +msgid "Porting to Python 3.11" +msgstr "" + +#: ../../whatsnew/3.11.rst:1692 +msgid "" +"This section lists previously described changes and other bugfixes that may " +"require changes to your code." +msgstr "" + +#: ../../whatsnew/3.11.rst:1697 +msgid "Changes in the Python API" +msgstr "" + +#: ../../whatsnew/3.11.rst:1699 +msgid "" +"Prohibited passing non-:class:`concurrent.futures.ThreadPoolExecutor` " +"executors to :meth:`loop.set_default_executor` following a deprecation in " +"Python 3.8. (Contributed by Illia Volochii in :issue:`43234`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1704 +msgid "" +":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." +"FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " +"mode. This flag was deprecated since Python 3.3. In Python 3, the " +"\"universal newline\" is used by default when a file is open in text mode. " +"The :ref:`newline parameter ` of :func:`open` " +"controls how universal newlines works. (Contributed by Victor Stinner in :" +"issue:`37330`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1712 +msgid "" +"The :mod:`pdb` module now reads the :file:`.pdbrc` configuration file with " +"the ``'utf-8'`` encoding. (Contributed by Srinivas Reddy Thatiparthy (శ్రీనివాస్ " +"రెడ్డి తాటిపర్తి) in :issue:`41137`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1716 +msgid "" +":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" +"`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " +"instead of using :func:`locale.getdefaultlocale`, if no locale is specified. " +"(Contributed by Victor Stinner in :issue:`46659`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1722 +msgid "" +"Global inline flags (e.g. ``(?i)``) can now only be used at the start of the " +"regular expressions. Using them not at the start of expression was " +"deprecated since Python 3.6. (Contributed by Serhiy Storchaka in :issue:" +"`47066`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1727 +msgid "" +":mod:`re` module: Fix a few long-standing bugs where, in rare cases, " +"capturing group could get wrong result. So the result may be different than " +"before. (Contributed by Ma Lin in :issue:`35859`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1732 +msgid "" +"The *population* parameter of :func:`random.sample` must be a sequence. " +"Automatic conversion of sets to lists is no longer supported. If the sample " +"size is larger than the population size, a :exc:`ValueError` is raised. " +"(Contributed by Raymond Hettinger in :issue:`40465`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1737 +msgid "" +":class:`ast.AST` node positions are now validated when provided to :func:" +"`compile` and other related functions. If invalid positions are detected, a :" +"exc:`ValueError` will be raised. (Contributed by Pablo Galindo in :gh:" +"`93351`)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1741 +msgid "" +":c:member:`~PyTypeObject.tp_dictoffset` should be treated as write-only. It " +"can be set to describe C extension clases to the VM, but should be regarded " +"as meaningless when read. To get the pointer to the object's dictionary " +"call :c:func:`PyObject_GenericGetDict` instead." +msgstr "" + +#: ../../whatsnew/3.11.rst:1747 +msgid "Build Changes" +msgstr "" + +#: ../../whatsnew/3.11.rst:1749 +msgid "" +"Building Python now requires a C11 compiler. Optional C11 features are not " +"required. (Contributed by Victor Stinner in :issue:`46656`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1753 +msgid "" +"Building Python now requires support of IEEE 754 floating point numbers. " +"(Contributed by Victor Stinner in :issue:`46917`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1756 +msgid "" +"CPython can now be built with the ThinLTO option via ``--with-lto=thin``. " +"(Contributed by Dong-hee Na and Brett Holman in :issue:`44340`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1759 +msgid "" +"libpython is no longer linked against libcrypt. (Contributed by Mike Gilbert " +"in :issue:`45433`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1762 +msgid "" +"Building Python now requires a C99 ```` header file providing the " +"following functions: ``copysign()``, ``hypot()``, ``isfinite()``, " +"``isinf()``, ``isnan()``, ``round()``. (Contributed by Victor Stinner in :" +"issue:`45440`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1767 +msgid "" +"Building Python now requires a C99 ```` header file providing a " +"``NAN`` constant, or the ``__builtin_nan()`` built-in function. (Contributed " +"by Victor Stinner in :issue:`46640`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1771 +msgid "" +"Building Python now requires support for floating point Not-a-Number (NaN): " +"remove the ``Py_NO_NAN`` macro. (Contributed by Victor Stinner in :issue:" +"`46656`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1775 +msgid "" +"Freelists for object structs can now be disabled. A new :program:`configure` " +"option :option:`!--without-freelists` can be used to disable all freelists " +"except empty tuple singleton. (Contributed by Christian Heimes in :issue:" +"`45522`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1780 +msgid "" +"``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " +"Extension modules can now be built through ``makesetup``. All except some " +"test modules can be linked statically into main binary or library. " +"(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`, :issue:" +"`45570`, :issue:`45571`, and :issue:`43974`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1786 +msgid "" +"Build dependencies, compiler flags, and linker flags for most stdlib " +"extension modules are now detected by :program:`configure`. libffi, libnsl, " +"libsqlite3, zlib, bzip2, liblzma, libcrypt, Tcl/Tk, and uuid flags are " +"detected by ``pkg-config`` (when available). :mod:`tkinter` now requires " +"``pkg-config`` command to detect development settings for Tcl/Tk headers and " +"libraries. (Contributed by Christian Heimes and Erlend Egeberg Aasland in :" +"issue:`45847`, :issue:`45747`, and :issue:`45763`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1796 +msgid "" +"Use the environment variables :envvar:`TCLTK_CFLAGS` and :envvar:" +"`TCLTK_LIBS` to manually specify the location of Tcl/Tk headers and " +"libraries. The :program:`configure` options ``--with-tcltk-includes`` and " +"``--with-tcltk-libs`` have been removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:1801 +msgid "" +"On RHEL 7 and CentOS 7 the development packages do not provide ``tcl.pc`` " +"and ``tk.pc``, use :envvar:`TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"`. " +"The directory ``Misc/rhel7`` contains ``.pc`` files and instructions how to " +"build Python with RHEL 7's and CentOS 7's Tcl/Tk and OpenSSL." +msgstr "" + +#: ../../whatsnew/3.11.rst:1806 +msgid "" +"CPython now has :pep:`11` tier 3 support for cross compiling to WebAssembly " +"platform ``wasm32-unknown-emscripten`` (Python in the browser). The effort " +"is inspired by previous work like `Pyodide `_. " +"Emscripten provides a limited subset of POSIX APIs. Python standard " +"libraries features and modules related to networking, processes, threading, " +"signals, mmap, and users/groups are not available or don't work. " +"(Contributed by Christian Heimes and Ethan Smith in :gh:`84461`, promoted " +"in :gh:`95085`)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1815 +msgid "" +"CPython now has :pep:`11` tier 3 support for cross compiling to WebAssembly " +"platform ``wasm32-unknown-wasi`` (WebAssembly System Interface). Like on " +"Emscripten, only a subset of Python's standard library is available on WASI. " +"(Contributed by Christian Heimes in :gh:`90473`, promoted in :gh:`95085`)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1820 +msgid "" +"CPython will now use 30-bit digits by default for the Python :class:`int` " +"implementation. Previously, the default was to use 30-bit digits on " +"platforms with ``SIZEOF_VOID_P >= 8``, and 15-bit digits otherwise. It's " +"still possible to explicitly request use of 15-bit digits via either the ``--" +"enable-big-digits`` option to the configure script or (for Windows) the " +"``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but this option may " +"be removed at some point in the future. (Contributed by Mark Dickinson in :" +"issue:`45569`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1829 +msgid "" +"The :mod:`tkinter` package now requires Tcl/Tk version 8.5.12 or newer. " +"(Contributed by Serhiy Storchaka in :issue:`46996`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1834 +msgid "C API Changes" +msgstr "" + +#: ../../whatsnew/3.11.rst:1839 +msgid "" +"Add a new :c:func:`PyType_GetName` function to get type's short name. " +"(Contributed by Hai Shi in :issue:`42035`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1842 +msgid "" +"Add a new :c:func:`PyType_GetQualName` function to get type's qualified " +"name. (Contributed by Hai Shi in :issue:`42035`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1845 +msgid "" +"Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" +"`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " +"resume tracing and profiling. (Contributed by Victor Stinner in :issue:" +"`43760`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1850 +msgid "" +"Added the :c:data:`Py_Version` constant which bears the same value as :c:" +"macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" +"`43931`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1854 +msgid "" +":c:type:`Py_buffer` and APIs are now part of the limited API and the stable " +"ABI:" +msgstr "" + +#: ../../whatsnew/3.11.rst:1857 +msgid ":c:func:`PyObject_CheckBuffer`" +msgstr ":c:func:`PyObject_CheckBuffer`" + +#: ../../whatsnew/3.11.rst:1858 +msgid ":c:func:`PyObject_GetBuffer`" +msgstr ":c:func:`PyObject_GetBuffer`" + +#: ../../whatsnew/3.11.rst:1859 +msgid ":c:func:`PyBuffer_GetPointer`" +msgstr ":c:func:`PyBuffer_GetPointer`" + +#: ../../whatsnew/3.11.rst:1860 +msgid ":c:func:`PyBuffer_SizeFromFormat`" +msgstr ":c:func:`PyBuffer_SizeFromFormat`" + +#: ../../whatsnew/3.11.rst:1861 +msgid ":c:func:`PyBuffer_ToContiguous`" +msgstr ":c:func:`PyBuffer_ToContiguous`" + +#: ../../whatsnew/3.11.rst:1862 +msgid ":c:func:`PyBuffer_FromContiguous`" +msgstr ":c:func:`PyBuffer_FromContiguous`" + +#: ../../whatsnew/3.11.rst:1863 +msgid ":c:func:`PyBuffer_CopyData`" +msgstr ":c:func:`PyBuffer_CopyData`" + +#: ../../whatsnew/3.11.rst:1864 +msgid ":c:func:`PyBuffer_IsContiguous`" +msgstr ":c:func:`PyBuffer_IsContiguous`" + +#: ../../whatsnew/3.11.rst:1865 +msgid ":c:func:`PyBuffer_FillContiguousStrides`" +msgstr ":c:func:`PyBuffer_FillContiguousStrides`" + +#: ../../whatsnew/3.11.rst:1866 +msgid ":c:func:`PyBuffer_FillInfo`" +msgstr ":c:func:`PyBuffer_FillInfo`" + +#: ../../whatsnew/3.11.rst:1867 +msgid ":c:func:`PyBuffer_Release`" +msgstr ":c:func:`PyBuffer_Release`" + +#: ../../whatsnew/3.11.rst:1868 +msgid ":c:func:`PyMemoryView_FromBuffer`" +msgstr ":c:func:`PyMemoryView_FromBuffer`" + +#: ../../whatsnew/3.11.rst:1869 +msgid "" +":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." +"bf_releasebuffer` type slots" +msgstr "" + +#: ../../whatsnew/3.11.rst:1872 +msgid "(Contributed by Christian Heimes in :issue:`45459`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1874 +msgid "" +"Added the :c:data:`PyType_GetModuleByDef` function, used to get the module " +"in which a method was defined, in cases where this information is not " +"available directly (via :c:type:`PyCMethod`). (Contributed by Petr Viktorin " +"in :issue:`46613`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1879 +msgid "" +"Add new functions to pack and unpack C double (serialize and deserialize): :" +"c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" +"func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` and :c:func:" +"`PyFloat_Unpack8`. (Contributed by Victor Stinner in :issue:`46906`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1885 +msgid "" +"Add new functions to get frame object attributes: :c:func:" +"`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" +"`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." +msgstr "" + +#: ../../whatsnew/3.11.rst:1889 +msgid "" +"Added two new functions to get and set the active exception instance: :c:" +"func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " +"These are alternatives to :c:func:`PyErr_SetExcInfo()` and :c:func:" +"`PyErr_GetExcInfo()` which work with the legacy 3-tuple representation of " +"exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1896 +msgid "" +"Added the :c:member:`PyConfig.safe_path` member. (Contributed by Victor " +"Stinner in :gh:`57684`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1902 +msgid "" +":c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` " +"arguments, the interpreter now derives those values from the exception " +"instance (the ``value`` argument). The function still steals references of " +"all three arguments. (Contributed by Irit Katriel in :issue:`45711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1908 +msgid "" +":c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback`` " +"fields of the result from the exception instance (the ``value`` field). " +"(Contributed by Irit Katriel in :issue:`45711`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1912 +msgid "" +":c:struct:`_frozen` has a new ``is_package`` field to indicate whether or " +"not the frozen module is a package. Previously, a negative value in the " +"``size`` field was the indicator. Now only non-negative values be used for " +"``size``. (Contributed by Kumar Aditya in :issue:`46608`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1918 +msgid "" +":c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*`` as its " +"second parameter, instead of ``PyFrameObject*``. See :pep:`523` for more " +"details of how to use this function pointer type." +msgstr "" + +#: ../../whatsnew/3.11.rst:1922 +msgid "" +":c:func:`PyCode_New` and :c:func:`PyCode_NewWithPosOnlyArgs` now take an " +"additional ``exception_table`` argument. Using these functions should be " +"avoided, if at all possible. To get a custom code object: create a code " +"object using the compiler, then get a modified version with the ``replace`` " +"method." +msgstr "" + +#: ../../whatsnew/3.11.rst:1928 +msgid "" +":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " +"``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" +"`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " +"and :c:func:`PyCode_GetFreevars` respectively to access them via the C API. " +"(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154` " +"and :gh:`94936`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1936 +msgid "" +"The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/" +"``Py_TRASHCAN_SAFE_END``) are now deprecated. They should be replaced by the " +"new macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." +msgstr "" + +#: ../../whatsnew/3.11.rst:1940 +msgid "A tp_dealloc function that has the old macros, such as::" +msgstr "" + +#: ../../whatsnew/3.11.rst:1951 +msgid "should migrate to the new macros as follows::" +msgstr "" + +#: ../../whatsnew/3.11.rst:1962 +msgid "" +"Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " +"deallocation function it is in." +msgstr "" + +#: ../../whatsnew/3.11.rst:1965 +msgid "" +"To support older Python versions in the same codebase, you can define the " +"following macros and use them throughout the code (credit: these were copied " +"from the ``mypy`` codebase)::" +msgstr "" + +#: ../../whatsnew/3.11.rst:1977 +msgid "" +"The :c:func:`PyType_Ready` function now raises an error if a type is defined " +"with the :const:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function (:" +"c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner in :" +"issue:`44263`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1982 +msgid "" +"Heap types with the :const:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " +"the :pep:`590` vectorcall protocol. Previously, this was only possible for :" +"ref:`static types `. (Contributed by Erlend E. Aasland in :" +"issue:`43908`)" +msgstr "" + +#: ../../whatsnew/3.11.rst:1987 +msgid "" +"Since :c:func:`Py_TYPE()` is changed to a inline static function, " +"``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, " +"new_type)``: see the :c:func:`Py_SET_TYPE()` function (available since " +"Python 3.9). For backward compatibility, this macro can be used::" +msgstr "" + +#: ../../whatsnew/3.11.rst:1999 ../../whatsnew/3.11.rst:2013 +msgid "(Contributed by Victor Stinner in :issue:`39573`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2001 +msgid "" +"Since :c:func:`Py_SIZE()` is changed to a inline static function, " +"``Py_SIZE(obj) = new_size`` must be replaced with ``Py_SET_SIZE(obj, " +"new_size)``: see the :c:func:`Py_SET_SIZE()` function (available since " +"Python 3.9). For backward compatibility, this macro can be used::" +msgstr "" + +#: ../../whatsnew/3.11.rst:2015 +msgid "" +"```` no longer includes the header files ````, ````, ```` and ```` when the ``Py_LIMITED_API`` macro is " +"set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " +"explicitly include the header files after ``#include ``. " +"(Contributed by Victor Stinner in :issue:`45434`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2021 +msgid "" +"The non-limited API files ``cellobject.h``, ``classobject.h``, ``code.h``, " +"``context.h``, ``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have " +"been moved to the ``Include/cpython`` directory. Moreover, the ``eval.h`` " +"header file was removed. These files must not be included directly, as they " +"are already included in ``Python.h``: :ref:`Include Files `. " +"If they have been included directly, consider including ``Python.h`` " +"instead. (Contributed by Victor Stinner in :issue:`35134`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2029 +msgid "" +"The :c:func:`PyUnicode_CHECK_INTERNED` macro has been excluded from the " +"limited C API. It was never usable there, because it used internal " +"structures which are not available in the limited C API. (Contributed by " +"Victor Stinner in :issue:`46007`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2034 +msgid "" +"The following frame functions and type are now directly available with " +"``#include ``, it's no longer needed to add ``#include " +"``:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2038 +msgid ":c:func:`PyFrame_Check`" +msgstr ":c:func:`PyFrame_Check`" + +#: ../../whatsnew/3.11.rst:2039 +msgid ":c:func:`PyFrame_GetBack`" +msgstr ":c:func:`PyFrame_GetBack`" + +#: ../../whatsnew/3.11.rst:2040 +msgid ":c:func:`PyFrame_GetBuiltins`" +msgstr ":c:func:`PyFrame_GetBuiltins`" + +#: ../../whatsnew/3.11.rst:2041 +msgid ":c:func:`PyFrame_GetGenerator`" +msgstr ":c:func:`PyFrame_GetGenerator`" + +#: ../../whatsnew/3.11.rst:2042 +msgid ":c:func:`PyFrame_GetGlobals`" +msgstr ":c:func:`PyFrame_GetGlobals`" + +#: ../../whatsnew/3.11.rst:2043 +msgid ":c:func:`PyFrame_GetLasti`" +msgstr ":c:func:`PyFrame_GetLasti`" + +#: ../../whatsnew/3.11.rst:2044 +msgid ":c:func:`PyFrame_GetLocals`" +msgstr ":c:func:`PyFrame_GetLocals`" + +#: ../../whatsnew/3.11.rst:2045 +msgid ":c:type:`PyFrame_Type`" +msgstr ":c:type:`PyFrame_Type`" + +#: ../../whatsnew/3.11.rst:2047 +msgid "(Contributed by Victor Stinner in :gh:`93937`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2051 +msgid "" +"The :c:type:`PyFrameObject` structure members have been removed from the " +"public C API." +msgstr "" + +#: ../../whatsnew/3.11.rst:2054 +msgid "" +"While the documentation notes that the :c:type:`PyFrameObject` fields are " +"subject to change at any time, they have been stable for a long time and " +"were used in several popular extensions." +msgstr "" + +#: ../../whatsnew/3.11.rst:2058 +msgid "" +"In Python 3.11, the frame struct was reorganized to allow performance " +"optimizations. Some fields were removed entirely, as they were details of " +"the old implementation." +msgstr "" + +#: ../../whatsnew/3.11.rst:2062 +msgid ":c:type:`PyFrameObject` fields:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2064 +msgid "``f_back``: use :c:func:`PyFrame_GetBack`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2065 +msgid "``f_blockstack``: removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:2066 +msgid "``f_builtins``: use :c:func:`PyFrame_GetBuiltins`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2067 +msgid "``f_code``: use :c:func:`PyFrame_GetCode`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2068 +msgid "``f_gen``: use :c:func:`PyFrame_GetGenerator`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2069 +msgid "``f_globals``: use :c:func:`PyFrame_GetGlobals`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2070 +msgid "``f_iblock``: removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:2071 +msgid "" +"``f_lasti``: use :c:func:`PyFrame_GetLasti`. Code using ``f_lasti`` with " +"``PyCode_Addr2Line()`` should use :c:func:`PyFrame_GetLineNumber` instead; " +"it may be faster." +msgstr "" + +#: ../../whatsnew/3.11.rst:2074 +msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" +msgstr "" + +#: ../../whatsnew/3.11.rst:2075 +msgid "``f_locals``: use :c:func:`PyFrame_GetLocals`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2076 +msgid "``f_stackdepth``: removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:2077 +msgid "``f_state``: no public API (renamed to ``f_frame.f_state``)." +msgstr "" + +#: ../../whatsnew/3.11.rst:2078 +msgid "``f_trace``: no public API." +msgstr "" + +#: ../../whatsnew/3.11.rst:2079 +msgid "" +"``f_trace_lines``: use ``PyObject_GetAttrString((PyObject*)frame, " +"\"f_trace_lines\")``." +msgstr "" + +#: ../../whatsnew/3.11.rst:2080 +msgid "" +"``f_trace_opcodes``: use ``PyObject_GetAttrString((PyObject*)frame, " +"\"f_trace_opcodes\")``." +msgstr "" + +#: ../../whatsnew/3.11.rst:2081 +msgid "``f_localsplus``: no public API (renamed to ``f_frame.localsplus``)." +msgstr "" + +#: ../../whatsnew/3.11.rst:2082 +msgid "``f_valuestack``: removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:2084 +msgid "" +"The Python frame object is now created lazily. A side effect is that the " +"``f_back`` member must not be accessed directly, since its value is now also " +"computed lazily. The :c:func:`PyFrame_GetBack` function must be called " +"instead." +msgstr "" + +#: ../../whatsnew/3.11.rst:2089 +msgid "" +"Debuggers that accessed the ``f_locals`` directly *must* call :c:func:" +"`PyFrame_GetLocals` instead. They no longer need to call :c:func:" +"`PyFrame_FastToLocalsWithError` or :c:func:`PyFrame_LocalsToFast`, in fact " +"they should not call those functions. The necessary updating of the frame is " +"now managed by the virtual machine." +msgstr "" + +#: ../../whatsnew/3.11.rst:2095 +msgid "Code defining ``PyFrame_GetCode()`` on Python 3.8 and older::" +msgstr "" + +#: ../../whatsnew/3.11.rst:2105 +msgid "Code defining ``PyFrame_GetBack()`` on Python 3.8 and older::" +msgstr "" + +#: ../../whatsnew/3.11.rst:2115 +msgid "" +"Or use the `pythoncapi_compat project `__ to get these two functions on older Python versions." +msgstr "" + +#: ../../whatsnew/3.11.rst:2119 +msgid "Changes of the :c:type:`PyThreadState` structure members:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2121 +msgid "" +"``frame``: removed, use :c:func:`PyThreadState_GetFrame` (function added to " +"Python 3.9 by :issue:`40429`). Warning: the function returns a :term:`strong " +"reference`, need to call :c:func:`Py_XDECREF`." +msgstr "" + +#: ../../whatsnew/3.11.rst:2125 +msgid "" +"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" +"`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" +"`43760`)." +msgstr "" + +#: ../../whatsnew/3.11.rst:2128 +msgid "" +"``recursion_depth``: removed, use ``(tstate->recursion_limit - tstate-" +">recursion_remaining)`` instead." +msgstr "" + +#: ../../whatsnew/3.11.rst:2130 +msgid "``stackcheck_counter``: removed." +msgstr "" + +#: ../../whatsnew/3.11.rst:2132 +msgid "Code defining ``PyThreadState_GetFrame()`` on Python 3.8 and older::" +msgstr "" + +#: ../../whatsnew/3.11.rst:2142 +msgid "" +"Code defining ``PyThreadState_EnterTracing()`` and " +"``PyThreadState_LeaveTracing()`` on Python 3.10 and older::" +msgstr "" + +#: ../../whatsnew/3.11.rst:2168 +msgid "" +"Or use `the pythoncapi_compat project `__ to get these functions on old Python functions." +msgstr "" + +#: ../../whatsnew/3.11.rst:2172 +msgid "" +"Distributors are encouraged to build Python with the optimized Blake2 " +"library `libb2`_." +msgstr "" + +#: ../../whatsnew/3.11.rst:2175 +msgid "" +"The :c:member:`PyConfig.module_search_paths_set` field must now be set to 1 " +"for initialization to use :c:member:`PyConfig.module_search_paths` to " +"initialize :data:`sys.path`. Otherwise, initialization will recalculate the " +"path and replace any values added to ``module_search_paths``." +msgstr "" + +#: ../../whatsnew/3.11.rst:2180 +msgid "" +":c:func:`PyConfig_Read` no longer calculates the initial search path, and " +"will not fill any values into :c:member:`PyConfig.module_search_paths`. To " +"calculate default paths and then modify them, finish initialization and use :" +"c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " +"object and modify it directly." +msgstr "" + +#: ../../whatsnew/3.11.rst:2188 +msgid "" +"Deprecate the following functions to configure the Python initialization:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2190 +msgid ":c:func:`PySys_AddWarnOptionUnicode`" +msgstr ":c:func:`PySys_AddWarnOptionUnicode`" + +#: ../../whatsnew/3.11.rst:2191 +msgid ":c:func:`PySys_AddWarnOption`" +msgstr ":c:func:`PySys_AddWarnOption`" + +#: ../../whatsnew/3.11.rst:2192 +msgid ":c:func:`PySys_AddXOption`" +msgstr ":c:func:`PySys_AddXOption`" + +#: ../../whatsnew/3.11.rst:2193 +msgid ":c:func:`PySys_HasWarnOptions`" +msgstr ":c:func:`PySys_HasWarnOptions`" + +#: ../../whatsnew/3.11.rst:2194 +msgid ":c:func:`PySys_SetArgvEx`" +msgstr ":c:func:`PySys_SetArgvEx`" + +#: ../../whatsnew/3.11.rst:2195 +msgid ":c:func:`PySys_SetArgv`" +msgstr ":c:func:`PySys_SetArgv`" + +#: ../../whatsnew/3.11.rst:2196 +msgid ":c:func:`PySys_SetPath`" +msgstr ":c:func:`PySys_SetPath`" + +#: ../../whatsnew/3.11.rst:2197 +msgid ":c:func:`Py_SetPath`" +msgstr ":c:func:`Py_SetPath`" + +#: ../../whatsnew/3.11.rst:2198 +msgid ":c:func:`Py_SetProgramName`" +msgstr ":c:func:`Py_SetProgramName`" + +#: ../../whatsnew/3.11.rst:2199 +msgid ":c:func:`Py_SetPythonHome`" +msgstr ":c:func:`Py_SetPythonHome`" + +#: ../../whatsnew/3.11.rst:2200 +msgid ":c:func:`Py_SetStandardStreamEncoding`" +msgstr ":c:func:`Py_SetStandardStreamEncoding`" + +#: ../../whatsnew/3.11.rst:2201 +msgid ":c:func:`_Py_SetProgramFullPath`" +msgstr ":c:func:`_Py_SetProgramFullPath`" + +#: ../../whatsnew/3.11.rst:2203 +msgid "" +"Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " +"Configuration ` instead (:pep:`587`). (Contributed by Victor " +"Stinner in :gh:`88279`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2207 +msgid "" +"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" +"func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2213 +msgid "" +":c:func:`PyFrame_BlockSetup` and :c:func:`PyFrame_BlockPop` have been " +"removed. (Contributed by Mark Shannon in :issue:`40222`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2217 +msgid "Remove the following math macros using the ``errno`` variable:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2219 +msgid "``Py_ADJUST_ERANGE1()``" +msgstr "``Py_ADJUST_ERANGE1()``" + +#: ../../whatsnew/3.11.rst:2220 +msgid "``Py_ADJUST_ERANGE2()``" +msgstr "``Py_ADJUST_ERANGE2()``" + +#: ../../whatsnew/3.11.rst:2221 +msgid "``Py_OVERFLOWED()``" +msgstr "``Py_OVERFLOWED()``" + +#: ../../whatsnew/3.11.rst:2222 +msgid "``Py_SET_ERANGE_IF_OVERFLOW()``" +msgstr "``Py_SET_ERANGE_IF_OVERFLOW()``" + +#: ../../whatsnew/3.11.rst:2223 +msgid "``Py_SET_ERRNO_ON_MATH_ERROR()``" +msgstr "``Py_SET_ERRNO_ON_MATH_ERROR()``" + +#: ../../whatsnew/3.11.rst:2225 +msgid "(Contributed by Victor Stinner in :issue:`45412`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2227 +msgid "" +"Remove ``Py_UNICODE_COPY()`` and ``Py_UNICODE_FILL()`` macros, deprecated " +"since Python 3.3. Use ``PyUnicode_CopyCharacters()`` or ``memcpy()`` " +"(``wchar_t*`` string), and ``PyUnicode_Fill()`` functions instead. " +"(Contributed by Victor Stinner in :issue:`41123`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2232 +msgid "" +"Remove the ``pystrhex.h`` header file. It only contains private functions. C " +"extensions should only include the main ```` header file. " +"(Contributed by Victor Stinner in :issue:`45434`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2236 +msgid "" +"Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " +"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" +"`45440`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2240 +msgid "" +"The following items are no longer available when :c:macro:`Py_LIMITED_API` " +"is defined:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2243 +msgid ":c:func:`PyMarshal_WriteLongToFile`" +msgstr ":c:func:`PyMarshal_WriteLongToFile`" + +#: ../../whatsnew/3.11.rst:2244 +msgid ":c:func:`PyMarshal_WriteObjectToFile`" +msgstr ":c:func:`PyMarshal_WriteObjectToFile`" + +#: ../../whatsnew/3.11.rst:2245 +msgid ":c:func:`PyMarshal_ReadObjectFromString`" +msgstr ":c:func:`PyMarshal_ReadObjectFromString`" + +#: ../../whatsnew/3.11.rst:2246 +msgid ":c:func:`PyMarshal_WriteObjectToString`" +msgstr ":c:func:`PyMarshal_WriteObjectToString`" + +#: ../../whatsnew/3.11.rst:2247 +msgid "the ``Py_MARSHAL_VERSION`` macro" +msgstr "``Py_MARSHAL_VERSION`` 巨集" + +#: ../../whatsnew/3.11.rst:2249 +msgid "These are not part of the :ref:`limited API `." +msgstr "" + +#: ../../whatsnew/3.11.rst:2251 +msgid "(Contributed by Victor Stinner in :issue:`45474`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2253 +msgid "" +"Exclude :c:func:`PyWeakref_GET_OBJECT` from the limited C API. It never " +"worked since the :c:type:`PyWeakReference` structure is opaque in the " +"limited C API. (Contributed by Victor Stinner in :issue:`35134`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2258 +msgid "" +"Remove the ``PyHeapType_GET_MEMBERS()`` macro. It was exposed in the public " +"C API by mistake, it must only be used by Python internally. Use the " +"``PyTypeObject.tp_members`` member instead. (Contributed by Victor Stinner " +"in :issue:`40170`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2263 +msgid "" +"Remove the ``HAVE_PY_SET_53BIT_PRECISION`` macro (moved to the internal C " +"API). (Contributed by Victor Stinner in :issue:`45412`.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:2267 +msgid "" +"Remove the :c:type:`Py_UNICODE` encoder APIs, as they have been deprecated " +"since Python 3.3, are little used and are inefficient relative to the " +"recommended alternatives." +msgstr "" + +#: ../../whatsnew/3.11.rst:2272 +msgid "The removed functions are:" +msgstr "" + +#: ../../whatsnew/3.11.rst:2274 +msgid ":func:`!PyUnicode_Encode`" +msgstr ":func:`!PyUnicode_Encode`" + +#: ../../whatsnew/3.11.rst:2275 +msgid ":func:`!PyUnicode_EncodeASCII`" +msgstr ":func:`!PyUnicode_EncodeASCII`" + +#: ../../whatsnew/3.11.rst:2276 +msgid ":func:`!PyUnicode_EncodeLatin1`" +msgstr ":func:`!PyUnicode_EncodeLatin1`" + +#: ../../whatsnew/3.11.rst:2277 +msgid ":func:`!PyUnicode_EncodeUTF7`" +msgstr ":func:`!PyUnicode_EncodeUTF7`" + +#: ../../whatsnew/3.11.rst:2278 +msgid ":func:`!PyUnicode_EncodeUTF8`" +msgstr ":func:`!PyUnicode_EncodeUTF8`" + +#: ../../whatsnew/3.11.rst:2279 +msgid ":func:`!PyUnicode_EncodeUTF16`" +msgstr ":func:`!PyUnicode_EncodeUTF16`" + +#: ../../whatsnew/3.11.rst:2280 +msgid ":func:`!PyUnicode_EncodeUTF32`" +msgstr ":func:`!PyUnicode_EncodeUTF32`" + +#: ../../whatsnew/3.11.rst:2281 +msgid ":func:`!PyUnicode_EncodeUnicodeEscape`" +msgstr ":func:`!PyUnicode_EncodeUnicodeEscape`" + +#: ../../whatsnew/3.11.rst:2282 +msgid ":func:`!PyUnicode_EncodeRawUnicodeEscape`" +msgstr ":func:`!PyUnicode_EncodeRawUnicodeEscape`" + +#: ../../whatsnew/3.11.rst:2283 +msgid ":func:`!PyUnicode_EncodeCharmap`" +msgstr ":func:`!PyUnicode_EncodeCharmap`" + +#: ../../whatsnew/3.11.rst:2284 +msgid ":func:`!PyUnicode_TranslateCharmap`" +msgstr ":func:`!PyUnicode_TranslateCharmap`" + +#: ../../whatsnew/3.11.rst:2285 +msgid ":func:`!PyUnicode_EncodeDecimal`" +msgstr ":func:`!PyUnicode_EncodeDecimal`" + +#: ../../whatsnew/3.11.rst:2286 +msgid ":func:`!PyUnicode_TransformDecimalToASCII`" +msgstr ":func:`!PyUnicode_TransformDecimalToASCII`" + +#: ../../whatsnew/3.11.rst:2288 +msgid "" +"See :pep:`624` for details and :pep:`migration guidance <624#alternative-" +"apis>`. (Contributed by Inada Naoki in :issue:`44029`.)" +msgstr "" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 979a6e616c..5699f73d83 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,18 +35,19 @@ msgid "" "This article explains the new features in Python 3.2 as compared to 3.1. " "Python 3.2 was released on February 20, 2011. It focuses on a few highlights " "and gives a few examples. For full details, see the `Misc/NEWS `_ file." +"github.com/python/cpython/blob/076ca6c3c8df3030307e548d9be792ce3c1c6eea/Misc/" +"NEWS>`__ file." msgstr "" -#: ../../whatsnew/3.2.rst:59 +#: ../../whatsnew/3.2.rst:60 msgid ":pep:`392` - Python 3.2 Release Schedule" msgstr "" -#: ../../whatsnew/3.2.rst:63 +#: ../../whatsnew/3.2.rst:64 msgid "PEP 384: Defining a Stable ABI" msgstr "" -#: ../../whatsnew/3.2.rst:65 +#: ../../whatsnew/3.2.rst:66 msgid "" "In the past, extension modules built for one Python version were often not " "usable with other Python versions. Particularly on Windows, every feature " @@ -55,7 +56,7 @@ msgid "" "interpreter internals that extension modules could use." msgstr "" -#: ../../whatsnew/3.2.rst:71 +#: ../../whatsnew/3.2.rst:72 msgid "" "With Python 3.2, an alternative approach becomes available: extension " "modules which restrict themselves to a limited API (by defining " @@ -67,19 +68,19 @@ msgid "" "every feature release." msgstr "" -#: ../../whatsnew/3.2.rst:82 +#: ../../whatsnew/3.2.rst:83 msgid ":pep:`384` - Defining a Stable ABI" msgstr "" -#: ../../whatsnew/3.2.rst:83 +#: ../../whatsnew/3.2.rst:84 msgid "PEP written by Martin von Löwis." msgstr "由 Martin von Löwis 撰寫 PEP。" -#: ../../whatsnew/3.2.rst:87 +#: ../../whatsnew/3.2.rst:88 msgid "PEP 389: Argparse Command Line Parsing Module" msgstr "" -#: ../../whatsnew/3.2.rst:89 +#: ../../whatsnew/3.2.rst:90 msgid "" "A new module for command line parsing, :mod:`argparse`, was introduced to " "overcome the limitations of :mod:`optparse` which did not provide support " @@ -87,7 +88,7 @@ msgid "" "and other common patterns of specifying and validating options." msgstr "" -#: ../../whatsnew/3.2.rst:94 +#: ../../whatsnew/3.2.rst:95 msgid "" "This module has already had widespread success in the community as a third-" "party module. Being more fully featured than its predecessor, the :mod:" @@ -96,46 +97,46 @@ msgid "" "amount of legacy code that depends on it." msgstr "" -#: ../../whatsnew/3.2.rst:100 +#: ../../whatsnew/3.2.rst:101 msgid "" "Here's an annotated example parser showing features like limiting results to " "a set of choices, specifying a *metavar* in the help screen, validating that " "one or more positional arguments is present, and making a required option::" msgstr "" -#: ../../whatsnew/3.2.rst:119 +#: ../../whatsnew/3.2.rst:120 msgid "Example of calling the parser on a command string::" msgstr "" -#: ../../whatsnew/3.2.rst:130 +#: ../../whatsnew/3.2.rst:131 msgid "Example of the parser's automatically generated help::" msgstr "" -#: ../../whatsnew/3.2.rst:149 +#: ../../whatsnew/3.2.rst:150 msgid "" "An especially nice :mod:`argparse` feature is the ability to define " "subparsers, each with their own argument patterns and help displays::" msgstr "" -#: ../../whatsnew/3.2.rst:175 +#: ../../whatsnew/3.2.rst:176 msgid ":pep:`389` - New Command Line Parsing Module" msgstr "" -#: ../../whatsnew/3.2.rst:175 +#: ../../whatsnew/3.2.rst:176 msgid "PEP written by Steven Bethard." msgstr "由 Steven Bethard 撰寫 PEP。" -#: ../../whatsnew/3.2.rst:177 +#: ../../whatsnew/3.2.rst:178 msgid "" ":ref:`upgrading-optparse-code` for details on the differences from :mod:" "`optparse`." msgstr "" -#: ../../whatsnew/3.2.rst:181 +#: ../../whatsnew/3.2.rst:182 msgid "PEP 391: Dictionary Based Configuration for Logging" msgstr "" -#: ../../whatsnew/3.2.rst:183 +#: ../../whatsnew/3.2.rst:184 msgid "" "The :mod:`logging` module provided two kinds of configuration, one style " "with function calls for each option or another style driven by an external " @@ -145,7 +146,7 @@ msgid "" "logger options from a command line." msgstr "" -#: ../../whatsnew/3.2.rst:190 +#: ../../whatsnew/3.2.rst:191 msgid "" "To support a more flexible style, the module now offers :func:`logging." "config.dictConfig` for specifying logging configuration with plain Python " @@ -154,25 +155,25 @@ msgid "" "dictionary::" msgstr "" -#: ../../whatsnew/3.2.rst:214 +#: ../../whatsnew/3.2.rst:215 msgid "" "If that dictionary is stored in a file called :file:`conf.json`, it can be " "loaded and called with code like this::" msgstr "" -#: ../../whatsnew/3.2.rst:229 +#: ../../whatsnew/3.2.rst:230 msgid ":pep:`391` - Dictionary Based Configuration for Logging" msgstr "" -#: ../../whatsnew/3.2.rst:230 +#: ../../whatsnew/3.2.rst:231 msgid "PEP written by Vinay Sajip." msgstr "由 Vinay Sajip 撰寫 PEP。" -#: ../../whatsnew/3.2.rst:234 +#: ../../whatsnew/3.2.rst:235 msgid "PEP 3148: The ``concurrent.futures`` module" msgstr "" -#: ../../whatsnew/3.2.rst:236 +#: ../../whatsnew/3.2.rst:237 msgid "" "Code for creating and managing concurrency is being collected in a new top-" "level namespace, *concurrent*. Its first member is a *futures* package " @@ -180,7 +181,7 @@ msgid "" "processes." msgstr "" -#: ../../whatsnew/3.2.rst:240 +#: ../../whatsnew/3.2.rst:241 msgid "" "The design for :mod:`concurrent.futures` was inspired by the *java.util." "concurrent* package. In that model, a running call and its result are " @@ -190,7 +191,7 @@ msgid "" "adding callbacks, and access to results or exceptions." msgstr "" -#: ../../whatsnew/3.2.rst:247 +#: ../../whatsnew/3.2.rst:248 msgid "" "The primary offering of the new module is a pair of executor classes for " "launching and managing calls. The goal of the executors is to make it " @@ -200,7 +201,7 @@ msgid "" "processes, or remote procedure calls." msgstr "" -#: ../../whatsnew/3.2.rst:254 +#: ../../whatsnew/3.2.rst:255 msgid "" "Ideally, each application should share a single executor across multiple " "components so that process and thread limits can be centrally managed. This " @@ -208,7 +209,7 @@ msgid "" "competing strategy for resource management." msgstr "" -#: ../../whatsnew/3.2.rst:259 +#: ../../whatsnew/3.2.rst:260 msgid "" "Both classes share a common interface with three methods: :meth:`~concurrent." "futures.Executor.submit` for scheduling a callable and returning a :class:" @@ -220,38 +221,38 @@ msgid "" "futures are done executing." msgstr "" -#: ../../whatsnew/3.2.rst:268 +#: ../../whatsnew/3.2.rst:269 msgid "" "A simple of example of :class:`~concurrent.futures.ThreadPoolExecutor` is a " "launch of four parallel threads for copying files::" msgstr "" -#: ../../whatsnew/3.2.rst:281 +#: ../../whatsnew/3.2.rst:282 msgid ":pep:`3148` - Futures -- Execute Computations Asynchronously" msgstr "" -#: ../../whatsnew/3.2.rst:281 +#: ../../whatsnew/3.2.rst:282 msgid "PEP written by Brian Quinlan." msgstr "由 Brian Quinlan 撰寫 PEP。" -#: ../../whatsnew/3.2.rst:283 +#: ../../whatsnew/3.2.rst:284 msgid "" ":ref:`Code for Threaded Parallel URL reads`, an " "example using threads to fetch multiple web pages in parallel." msgstr "" -#: ../../whatsnew/3.2.rst:286 +#: ../../whatsnew/3.2.rst:287 msgid "" ":ref:`Code for computing prime numbers in parallel`, an example demonstrating :class:`~concurrent.futures." "ProcessPoolExecutor`." msgstr "" -#: ../../whatsnew/3.2.rst:292 +#: ../../whatsnew/3.2.rst:293 msgid "PEP 3147: PYC Repository Directories" msgstr "" -#: ../../whatsnew/3.2.rst:294 +#: ../../whatsnew/3.2.rst:295 msgid "" "Python's scheme for caching bytecode in *.pyc* files did not work well in " "environments with multiple Python interpreters. If one interpreter " @@ -260,7 +261,7 @@ msgid "" "caching." msgstr "" -#: ../../whatsnew/3.2.rst:299 +#: ../../whatsnew/3.2.rst:300 msgid "" "The issue of \"pyc fights\" has become more pronounced as it has become " "commonplace for Linux distributions to ship with multiple versions of " @@ -268,7 +269,7 @@ msgid "" "Swallow." msgstr "" -#: ../../whatsnew/3.2.rst:303 +#: ../../whatsnew/3.2.rst:304 msgid "" "To solve this problem, Python's import machinery has been extended to use " "distinct filenames for each interpreter. Instead of Python 3.2 and Python " @@ -279,32 +280,32 @@ msgid "" "\"__pycache__\" directory stored under the package directory." msgstr "" -#: ../../whatsnew/3.2.rst:311 +#: ../../whatsnew/3.2.rst:312 msgid "" "Aside from the filenames and target directories, the new scheme has a few " "aspects that are visible to the programmer:" msgstr "" -#: ../../whatsnew/3.2.rst:314 +#: ../../whatsnew/3.2.rst:315 msgid "" "Imported modules now have a :attr:`__cached__` attribute which stores the " "name of the actual file that was imported:" msgstr "" -#: ../../whatsnew/3.2.rst:321 +#: ../../whatsnew/3.2.rst:322 msgid "" "The tag that is unique to each interpreter is accessible from the :mod:`imp` " "module:" msgstr "" -#: ../../whatsnew/3.2.rst:328 +#: ../../whatsnew/3.2.rst:329 msgid "" "Scripts that try to deduce source filename from the imported file now need " "to be smarter. It is no longer sufficient to simply strip the \"c\" from a " "\".pyc\" filename. Instead, use the new functions in the :mod:`imp` module:" msgstr "" -#: ../../whatsnew/3.2.rst:337 +#: ../../whatsnew/3.2.rst:338 msgid "" "The :mod:`py_compile` and :mod:`compileall` modules have been updated to " "reflect the new naming convention and target directory. The command-line " @@ -313,7 +314,7 @@ msgid "" "be written to their legacy location rather than *__pycache__*." msgstr "" -#: ../../whatsnew/3.2.rst:344 +#: ../../whatsnew/3.2.rst:345 msgid "" "The :mod:`importlib.abc` module has been updated with new :term:`abstract " "base classes ` for loading bytecode files. The " @@ -322,26 +323,26 @@ msgid "" "compatible are included with the documentation)." msgstr "" -#: ../../whatsnew/3.2.rst:352 +#: ../../whatsnew/3.2.rst:353 msgid ":pep:`3147` - PYC Repository Directories" msgstr "" -#: ../../whatsnew/3.2.rst:353 ../../whatsnew/3.2.rst:384 +#: ../../whatsnew/3.2.rst:354 ../../whatsnew/3.2.rst:385 msgid "PEP written by Barry Warsaw." msgstr "由 Barry Warsaw 撰寫 PEP。" -#: ../../whatsnew/3.2.rst:357 +#: ../../whatsnew/3.2.rst:358 msgid "PEP 3149: ABI Version Tagged .so Files" msgstr "" -#: ../../whatsnew/3.2.rst:359 +#: ../../whatsnew/3.2.rst:360 msgid "" "The PYC repository directory allows multiple bytecode cache files to be co-" "located. This PEP implements a similar mechanism for shared object files by " "giving them a common directory and distinct names for each version." msgstr "" -#: ../../whatsnew/3.2.rst:363 +#: ../../whatsnew/3.2.rst:364 msgid "" "The common directory is \"pyshared\" and the file names are made distinct by " "identifying the Python implementation (such as CPython, PyPy, Jython, etc.), " @@ -351,21 +352,21 @@ msgid "" "installed::" msgstr "" -#: ../../whatsnew/3.2.rst:372 +#: ../../whatsnew/3.2.rst:373 msgid "" "In Python itself, the tags are accessible from functions in the :mod:" "`sysconfig` module::" msgstr "" -#: ../../whatsnew/3.2.rst:383 +#: ../../whatsnew/3.2.rst:384 msgid ":pep:`3149` - ABI Version Tagged .so Files" msgstr "" -#: ../../whatsnew/3.2.rst:388 +#: ../../whatsnew/3.2.rst:389 msgid "PEP 3333: Python Web Server Gateway Interface v1.0.1" msgstr "" -#: ../../whatsnew/3.2.rst:390 +#: ../../whatsnew/3.2.rst:391 msgid "" "This informational PEP clarifies how bytes/text issues are to be handled by " "the WSGI protocol. The challenge is that string handling in Python 3 is " @@ -373,14 +374,14 @@ msgid "" "protocol is itself bytes oriented." msgstr "" -#: ../../whatsnew/3.2.rst:395 +#: ../../whatsnew/3.2.rst:396 msgid "" "The PEP differentiates so-called *native strings* that are used for request/" "response headers and metadata versus *byte strings* which are used for the " "bodies of requests and responses." msgstr "" -#: ../../whatsnew/3.2.rst:399 +#: ../../whatsnew/3.2.rst:400 msgid "" "The *native strings* are always of type :class:`str` but are restricted to " "code points between *U+0000* through *U+00FF* which are translatable to " @@ -391,18 +392,18 @@ msgid "" "use :rfc:`2047` MIME encoding." msgstr "" -#: ../../whatsnew/3.2.rst:407 +#: ../../whatsnew/3.2.rst:408 msgid "" "For developers porting WSGI applications from Python 2, here are the salient " "points:" msgstr "" -#: ../../whatsnew/3.2.rst:410 +#: ../../whatsnew/3.2.rst:411 msgid "" "If the app already used strings for headers in Python 2, no change is needed." msgstr "" -#: ../../whatsnew/3.2.rst:412 +#: ../../whatsnew/3.2.rst:413 msgid "" "If instead, the app encoded output headers or decoded input headers, then " "the headers will need to be re-encoded to Latin-1. For example, an output " @@ -410,14 +411,14 @@ msgid "" "from bytes to native strings using ``h.encode('utf-8').decode('latin-1')``." msgstr "" -#: ../../whatsnew/3.2.rst:417 +#: ../../whatsnew/3.2.rst:418 msgid "" "Values yielded by an application or sent using the :meth:`write` method must " "be byte strings. The :func:`start_response` function and environ must use " "native strings. The two cannot be mixed." msgstr "" -#: ../../whatsnew/3.2.rst:421 +#: ../../whatsnew/3.2.rst:422 msgid "" "For server implementers writing CGI-to-WSGI pathways or other CGI-style " "protocols, the users must to be able access the environment using native " @@ -428,23 +429,23 @@ msgid "" "dictionary." msgstr "" -#: ../../whatsnew/3.2.rst:430 +#: ../../whatsnew/3.2.rst:431 msgid ":pep:`3333` - Python Web Server Gateway Interface v1.0.1" msgstr "" -#: ../../whatsnew/3.2.rst:431 +#: ../../whatsnew/3.2.rst:432 msgid "PEP written by Phillip Eby." msgstr "由 Phillip Eby 撰寫 PEP。" -#: ../../whatsnew/3.2.rst:435 +#: ../../whatsnew/3.2.rst:436 msgid "Other Language Changes" msgstr "" -#: ../../whatsnew/3.2.rst:437 +#: ../../whatsnew/3.2.rst:438 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: ../../whatsnew/3.2.rst:439 +#: ../../whatsnew/3.2.rst:440 msgid "" "String formatting for :func:`format` and :meth:`str.format` gained new " "capabilities for the format character **#**. Previously, for integers in " @@ -454,12 +455,12 @@ msgid "" "digits follow it." msgstr "" -#: ../../whatsnew/3.2.rst:451 +#: ../../whatsnew/3.2.rst:452 msgid "" "(Suggested by Mark Dickinson and implemented by Eric Smith in :issue:`7094`.)" msgstr "" -#: ../../whatsnew/3.2.rst:453 +#: ../../whatsnew/3.2.rst:454 msgid "" "There is also a new :meth:`str.format_map` method that extends the " "capabilities of the existing :meth:`str.format` method by accepting " @@ -471,13 +472,13 @@ msgid "" "meth:`__missing__` method for unknown keys::" msgstr "" -#: ../../whatsnew/3.2.rst:480 +#: ../../whatsnew/3.2.rst:481 msgid "" "(Suggested by Raymond Hettinger and implemented by Eric Smith in :issue:" "`6081`.)" msgstr "" -#: ../../whatsnew/3.2.rst:483 +#: ../../whatsnew/3.2.rst:484 msgid "" "The interpreter can now be started with a quiet option, ``-q``, to prevent " "the copyright and version information from being displayed in the " @@ -485,11 +486,11 @@ msgid "" "flags` attribute:" msgstr "" -#: ../../whatsnew/3.2.rst:495 +#: ../../whatsnew/3.2.rst:496 msgid "(Contributed by Marcin Wojdyr in :issue:`1772833`)." msgstr "" -#: ../../whatsnew/3.2.rst:497 +#: ../../whatsnew/3.2.rst:498 msgid "" "The :func:`hasattr` function works by calling :func:`getattr` and detecting " "whether an exception is raised. This technique allows it to detect methods " @@ -500,12 +501,12 @@ msgid "" "exceptions pass through::" msgstr "" -#: ../../whatsnew/3.2.rst:516 +#: ../../whatsnew/3.2.rst:517 msgid "" "(Discovered by Yury Selivanov and fixed by Benjamin Peterson; :issue:`9666`.)" msgstr "" -#: ../../whatsnew/3.2.rst:518 +#: ../../whatsnew/3.2.rst:519 msgid "" "The :func:`str` of a float or complex number is now the same as its :func:" "`repr`. Previously, the :func:`str` form was shorter but that just caused " @@ -513,11 +514,11 @@ msgid "" "`repr` is displayed by default:" msgstr "" -#: ../../whatsnew/3.2.rst:529 +#: ../../whatsnew/3.2.rst:530 msgid "(Proposed and implemented by Mark Dickinson; :issue:`9337`.)" msgstr "" -#: ../../whatsnew/3.2.rst:531 +#: ../../whatsnew/3.2.rst:532 msgid "" ":class:`memoryview` objects now have a :meth:`~memoryview.release()` method " "and they also now support the context management protocol. This allows " @@ -525,28 +526,28 @@ msgid "" "from the original object." msgstr "" -#: ../../whatsnew/3.2.rst:540 +#: ../../whatsnew/3.2.rst:541 msgid "(Added by Antoine Pitrou; :issue:`9757`.)" msgstr "" -#: ../../whatsnew/3.2.rst:542 +#: ../../whatsnew/3.2.rst:543 msgid "" "Previously it was illegal to delete a name from the local namespace if it " "occurs as a free variable in a nested block::" msgstr "" -#: ../../whatsnew/3.2.rst:551 +#: ../../whatsnew/3.2.rst:552 msgid "" "This is now allowed. Remember that the target of an :keyword:`except` " "clause is cleared, so this code which used to work with Python 2.6, raised " "a :exc:`SyntaxError` with Python 3.1 and now works again::" msgstr "" -#: ../../whatsnew/3.2.rst:564 +#: ../../whatsnew/3.2.rst:565 msgid "(See :issue:`4617`.)" msgstr "(請見 :issue:`4617`\\ 。)" -#: ../../whatsnew/3.2.rst:566 +#: ../../whatsnew/3.2.rst:567 msgid "" "The internal :c:type:`structsequence` tool now creates subclasses of tuple. " "This means that C structures like those returned by :func:`os.stat`, :func:" @@ -556,25 +557,25 @@ msgid "" "as their pure Python counterparts:" msgstr "" -#: ../../whatsnew/3.2.rst:579 +#: ../../whatsnew/3.2.rst:580 msgid "" "(Suggested by Arfrever Frehtes Taifersar Arahesis and implemented by " "Benjamin Peterson in :issue:`8413`.)" msgstr "" -#: ../../whatsnew/3.2.rst:582 +#: ../../whatsnew/3.2.rst:583 msgid "" "Warnings are now easier to control using the :envvar:`PYTHONWARNINGS` " "environment variable as an alternative to using ``-W`` at the command line:" msgstr "" -#: ../../whatsnew/3.2.rst:589 +#: ../../whatsnew/3.2.rst:590 msgid "" "(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" "`7301`.)" msgstr "" -#: ../../whatsnew/3.2.rst:591 +#: ../../whatsnew/3.2.rst:592 msgid "" "A new warning category, :exc:`ResourceWarning`, has been added. It is " "emitted when potential issues with resource consumption or cleanup are " @@ -583,7 +584,7 @@ msgid "" "command line." msgstr "" -#: ../../whatsnew/3.2.rst:597 +#: ../../whatsnew/3.2.rst:598 msgid "" "A :exc:`ResourceWarning` is issued at interpreter shutdown if the :data:`gc." "garbage` list isn't empty, and if :attr:`gc.DEBUG_UNCOLLECTABLE` is set, all " @@ -591,7 +592,7 @@ msgid "" "aware that their code contains object finalization issues." msgstr "" -#: ../../whatsnew/3.2.rst:602 +#: ../../whatsnew/3.2.rst:603 msgid "" "A :exc:`ResourceWarning` is also issued when a :term:`file object` is " "destroyed without having been explicitly closed. While the deallocator for " @@ -601,13 +602,13 @@ msgid "" "enabling the warning from the command line:" msgstr "" -#: ../../whatsnew/3.2.rst:616 +#: ../../whatsnew/3.2.rst:617 msgid "" "(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" "`477863`.)" msgstr "" -#: ../../whatsnew/3.2.rst:618 +#: ../../whatsnew/3.2.rst:619 msgid "" ":class:`range` objects now support *index* and *count* methods. This is part " "of an effort to make more objects fully implement the :class:`collections." @@ -617,45 +618,45 @@ msgid "" "This makes *range* more interoperable with lists::" msgstr "" -#: ../../whatsnew/3.2.rst:634 +#: ../../whatsnew/3.2.rst:635 msgid "" "(Contributed by Daniel Stutzbach in :issue:`9213`, by Alexander Belopolsky " "in :issue:`2690`, and by Nick Coghlan in :issue:`10889`.)" msgstr "" -#: ../../whatsnew/3.2.rst:637 +#: ../../whatsnew/3.2.rst:638 msgid "" "The :func:`callable` builtin function from Py2.x was resurrected. It " "provides a concise, readable alternative to using an :term:`abstract base " "class` in an expression like ``isinstance(x, collections.Callable)``:" msgstr "" -#: ../../whatsnew/3.2.rst:646 +#: ../../whatsnew/3.2.rst:647 msgid "(See :issue:`10518`.)" msgstr "(請見 :issue:`10518`\\ 。)" -#: ../../whatsnew/3.2.rst:648 +#: ../../whatsnew/3.2.rst:649 msgid "" "Python's import mechanism can now load modules installed in directories with " "non-ASCII characters in the path name. This solved an aggravating problem " "with home directories for users with non-ASCII characters in their usernames." msgstr "" -#: ../../whatsnew/3.2.rst:652 +#: ../../whatsnew/3.2.rst:653 msgid "(Required extensive work by Victor Stinner in :issue:`9425`.)" msgstr "" -#: ../../whatsnew/3.2.rst:656 +#: ../../whatsnew/3.2.rst:657 msgid "New, Improved, and Deprecated Modules" msgstr "" -#: ../../whatsnew/3.2.rst:658 +#: ../../whatsnew/3.2.rst:659 msgid "" "Python's standard library has undergone significant maintenance efforts and " "quality improvements." msgstr "" -#: ../../whatsnew/3.2.rst:661 +#: ../../whatsnew/3.2.rst:662 msgid "" "The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" "`mailbox` module, and :mod:`nntplib` modules now work correctly with the " @@ -663,7 +664,7 @@ msgid "" "of messages with mixed encodings." msgstr "" -#: ../../whatsnew/3.2.rst:666 +#: ../../whatsnew/3.2.rst:667 msgid "" "Throughout the standard library, there has been more careful attention to " "encodings and text versus bytes issues. In particular, interactions with " @@ -671,23 +672,23 @@ msgid "" "the Windows MBCS encoding, locale-aware encodings, or UTF-8." msgstr "" -#: ../../whatsnew/3.2.rst:671 +#: ../../whatsnew/3.2.rst:672 msgid "" "Another significant win is the addition of substantially better support for " "*SSL* connections and security certificates." msgstr "" -#: ../../whatsnew/3.2.rst:674 +#: ../../whatsnew/3.2.rst:675 msgid "" "In addition, more classes now implement a :term:`context manager` to support " "convenient and reliable resource clean-up using a :keyword:`with` statement." msgstr "" -#: ../../whatsnew/3.2.rst:678 +#: ../../whatsnew/3.2.rst:679 msgid "email" msgstr "email" -#: ../../whatsnew/3.2.rst:680 +#: ../../whatsnew/3.2.rst:681 msgid "" "The usability of the :mod:`email` package in Python 3 has been mostly fixed " "by the extensive efforts of R. David Murray. The problem was that emails " @@ -697,7 +698,7 @@ msgid "" "messages in bytes format." msgstr "" -#: ../../whatsnew/3.2.rst:687 +#: ../../whatsnew/3.2.rst:688 msgid "" "New functions :func:`~email.message_from_bytes` and :func:`~email." "message_from_binary_file`, and new classes :class:`~email.parser." @@ -705,7 +706,7 @@ msgid "" "data to be parsed into model objects." msgstr "" -#: ../../whatsnew/3.2.rst:692 +#: ../../whatsnew/3.2.rst:693 msgid "" "Given bytes input to the model, :meth:`~email.message.Message.get_payload` " "will by default decode a message body that has a :mailheader:`Content-" @@ -713,20 +714,20 @@ msgid "" "and return the resulting string." msgstr "" -#: ../../whatsnew/3.2.rst:697 +#: ../../whatsnew/3.2.rst:698 msgid "" "Given bytes input to the model, :class:`~email.generator.Generator` will " "convert message bodies that have a :mailheader:`Content-Transfer-Encoding` " "of *8bit* to instead have a *7bit* :mailheader:`Content-Transfer-Encoding`." msgstr "" -#: ../../whatsnew/3.2.rst:701 +#: ../../whatsnew/3.2.rst:702 msgid "" "Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ -" "encoded using the *unknown-8bit* character set." msgstr "" -#: ../../whatsnew/3.2.rst:704 +#: ../../whatsnew/3.2.rst:705 msgid "" "A new class :class:`~email.generator.BytesGenerator` produces bytes as " "output, preserving any unchanged non-ASCII data that was present in the " @@ -734,7 +735,7 @@ msgid "" "`Content-Transfer-Encoding` of *8bit*." msgstr "" -#: ../../whatsnew/3.2.rst:709 +#: ../../whatsnew/3.2.rst:710 msgid "" "The :mod:`smtplib` :class:`~smtplib.SMTP` class now accepts a byte string " "for the *msg* argument to the :meth:`~smtplib.SMTP.sendmail` method, and a " @@ -743,126 +744,126 @@ msgid "" "*to_addrs* addresses directly from the object." msgstr "" -#: ../../whatsnew/3.2.rst:715 +#: ../../whatsnew/3.2.rst:716 msgid "" "(Proposed and implemented by R. David Murray, :issue:`4661` and :issue:" "`10321`.)" msgstr "" -#: ../../whatsnew/3.2.rst:718 +#: ../../whatsnew/3.2.rst:719 msgid "elementtree" msgstr "elementtree" -#: ../../whatsnew/3.2.rst:720 +#: ../../whatsnew/3.2.rst:721 msgid "" "The :mod:`xml.etree.ElementTree` package and its :mod:`xml.etree." "cElementTree` counterpart have been updated to version 1.3." msgstr "" -#: ../../whatsnew/3.2.rst:723 +#: ../../whatsnew/3.2.rst:724 msgid "Several new and useful functions and methods have been added:" msgstr "" -#: ../../whatsnew/3.2.rst:725 +#: ../../whatsnew/3.2.rst:726 msgid "" ":func:`xml.etree.ElementTree.fromstringlist` which builds an XML document " "from a sequence of fragments" msgstr "" -#: ../../whatsnew/3.2.rst:727 +#: ../../whatsnew/3.2.rst:728 msgid "" ":func:`xml.etree.ElementTree.register_namespace` for registering a global " "namespace prefix" msgstr "" -#: ../../whatsnew/3.2.rst:729 +#: ../../whatsnew/3.2.rst:730 msgid "" ":func:`xml.etree.ElementTree.tostringlist` for string representation " "including all sublists" msgstr "" -#: ../../whatsnew/3.2.rst:731 +#: ../../whatsnew/3.2.rst:732 msgid "" ":meth:`xml.etree.ElementTree.Element.extend` for appending a sequence of " "zero or more elements" msgstr "" -#: ../../whatsnew/3.2.rst:733 +#: ../../whatsnew/3.2.rst:734 msgid "" ":meth:`xml.etree.ElementTree.Element.iterfind` searches an element and " "subelements" msgstr "" -#: ../../whatsnew/3.2.rst:735 +#: ../../whatsnew/3.2.rst:736 msgid "" ":meth:`xml.etree.ElementTree.Element.itertext` creates a text iterator over " "an element and its subelements" msgstr "" -#: ../../whatsnew/3.2.rst:737 +#: ../../whatsnew/3.2.rst:738 msgid "" ":meth:`xml.etree.ElementTree.TreeBuilder.end` closes the current element" msgstr "" -#: ../../whatsnew/3.2.rst:738 +#: ../../whatsnew/3.2.rst:739 msgid "" ":meth:`xml.etree.ElementTree.TreeBuilder.doctype` handles a doctype " "declaration" msgstr "" -#: ../../whatsnew/3.2.rst:741 +#: ../../whatsnew/3.2.rst:742 msgid "Two methods have been deprecated:" msgstr "" -#: ../../whatsnew/3.2.rst:743 +#: ../../whatsnew/3.2.rst:744 msgid ":meth:`xml.etree.ElementTree.getchildren` use ``list(elem)`` instead." msgstr "" -#: ../../whatsnew/3.2.rst:744 +#: ../../whatsnew/3.2.rst:745 msgid ":meth:`xml.etree.ElementTree.getiterator` use ``Element.iter`` instead." msgstr "" -#: ../../whatsnew/3.2.rst:746 +#: ../../whatsnew/3.2.rst:747 msgid "" "For details of the update, see `Introducing ElementTree `_ on " "Fredrik Lundh's website." msgstr "" -#: ../../whatsnew/3.2.rst:750 +#: ../../whatsnew/3.2.rst:751 msgid "(Contributed by Florent Xicluna and Fredrik Lundh, :issue:`6472`.)" msgstr "" -#: ../../whatsnew/3.2.rst:753 +#: ../../whatsnew/3.2.rst:754 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.2.rst:755 +#: ../../whatsnew/3.2.rst:756 msgid "" "The :mod:`functools` module includes a new decorator for caching function " "calls. :func:`functools.lru_cache` can save repeated queries to an external " "resource whenever the results are expected to be the same." msgstr "" -#: ../../whatsnew/3.2.rst:759 +#: ../../whatsnew/3.2.rst:760 msgid "" "For example, adding a caching decorator to a database query function can " "save database accesses for popular searches:" msgstr "" -#: ../../whatsnew/3.2.rst:772 +#: ../../whatsnew/3.2.rst:773 msgid "" "To help with choosing an effective cache size, the wrapped function is " "instrumented for tracking cache statistics:" msgstr "" -#: ../../whatsnew/3.2.rst:778 +#: ../../whatsnew/3.2.rst:779 msgid "" "If the phonelist table gets updated, the outdated contents of the cache can " "be cleared with:" msgstr "" -#: ../../whatsnew/3.2.rst:783 +#: ../../whatsnew/3.2.rst:784 msgid "" "(Contributed by Raymond Hettinger and incorporating design ideas from Jim " "Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 `_\\, :issue:`10586`, and :issue:`10593`.)" msgstr "" -#: ../../whatsnew/3.2.rst:789 +#: ../../whatsnew/3.2.rst:790 msgid "" "The :func:`functools.wraps` decorator now adds a :attr:`__wrapped__` " "attribute pointing to the original callable function. This allows wrapped " @@ -879,84 +880,84 @@ msgid "" "attr:`__doc__` which might not be defined for the wrapped callable." msgstr "" -#: ../../whatsnew/3.2.rst:795 +#: ../../whatsnew/3.2.rst:796 msgid "" "In the above example, the cache can be removed by recovering the original " "function:" msgstr "" -#: ../../whatsnew/3.2.rst:800 +#: ../../whatsnew/3.2.rst:801 msgid "" "(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and :issue:" "`8814`.)" msgstr "" -#: ../../whatsnew/3.2.rst:803 +#: ../../whatsnew/3.2.rst:804 msgid "" "To help write classes with rich comparison methods, a new decorator :func:" "`functools.total_ordering` will use existing equality and inequality methods " "to fill in the remaining methods." msgstr "" -#: ../../whatsnew/3.2.rst:807 +#: ../../whatsnew/3.2.rst:808 msgid "" "For example, supplying *__eq__* and *__lt__* will enable :func:`~functools." "total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::" msgstr "" -#: ../../whatsnew/3.2.rst:820 +#: ../../whatsnew/3.2.rst:821 msgid "" "With the *total_ordering* decorator, the remaining comparison methods are " "filled in automatically." msgstr "" -#: ../../whatsnew/3.2.rst:823 ../../whatsnew/3.2.rst:835 -#: ../../whatsnew/3.2.rst:879 ../../whatsnew/3.2.rst:900 -#: ../../whatsnew/3.2.rst:914 ../../whatsnew/3.2.rst:1784 -#: ../../whatsnew/3.2.rst:1829 +#: ../../whatsnew/3.2.rst:824 ../../whatsnew/3.2.rst:836 +#: ../../whatsnew/3.2.rst:880 ../../whatsnew/3.2.rst:901 +#: ../../whatsnew/3.2.rst:915 ../../whatsnew/3.2.rst:1785 +#: ../../whatsnew/3.2.rst:1830 msgid "(Contributed by Raymond Hettinger.)" msgstr "" -#: ../../whatsnew/3.2.rst:825 +#: ../../whatsnew/3.2.rst:826 msgid "" "To aid in porting programs from Python 2, the :func:`functools.cmp_to_key` " "function converts an old-style comparison function to modern :term:`key " "function`:" msgstr "" -#: ../../whatsnew/3.2.rst:832 +#: ../../whatsnew/3.2.rst:833 msgid "" "For sorting examples and a brief sorting tutorial, see the `Sorting HowTo " "`_ tutorial." msgstr "" -#: ../../whatsnew/3.2.rst:838 +#: ../../whatsnew/3.2.rst:839 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.2.rst:840 +#: ../../whatsnew/3.2.rst:841 msgid "" "The :mod:`itertools` module has a new :func:`~itertools.accumulate` function " "modeled on APL's *scan* operator and Numpy's *accumulate* function:" msgstr "" -#: ../../whatsnew/3.2.rst:851 +#: ../../whatsnew/3.2.rst:852 msgid "" "For an example using :func:`~itertools.accumulate`, see the :ref:`examples " "for the random module `." msgstr "" -#: ../../whatsnew/3.2.rst:854 +#: ../../whatsnew/3.2.rst:855 msgid "" "(Contributed by Raymond Hettinger and incorporating design suggestions from " "Mark Dickinson.)" msgstr "" -#: ../../whatsnew/3.2.rst:858 +#: ../../whatsnew/3.2.rst:859 msgid "collections" msgstr "collections" -#: ../../whatsnew/3.2.rst:860 +#: ../../whatsnew/3.2.rst:861 msgid "" "The :class:`collections.Counter` class now has two forms of in-place " "subtraction, the existing *-=* operator for `saturating subtraction `_ which is defined for only two threads." msgstr "" -#: ../../whatsnew/3.2.rst:929 +#: ../../whatsnew/3.2.rst:930 msgid "" "Implemented as a two-phase cyclic barrier, :class:`~threading.Barrier` " "objects are suitable for use in loops. The separate *filling* and " @@ -1023,11 +1024,11 @@ msgid "" "resets after each cycle." msgstr "" -#: ../../whatsnew/3.2.rst:934 +#: ../../whatsnew/3.2.rst:935 msgid "Example of using barriers::" msgstr "" -#: ../../whatsnew/3.2.rst:948 +#: ../../whatsnew/3.2.rst:949 msgid "" "In this example, the barrier enforces a rule that votes cannot be counted at " "any polling site until all polls are closed. Notice how a solution with a " @@ -1036,7 +1037,7 @@ msgid "" "barrier point is crossed." msgstr "" -#: ../../whatsnew/3.2.rst:954 +#: ../../whatsnew/3.2.rst:955 msgid "" "If any of the predecessor tasks can hang or be delayed, a barrier can be " "created with an optional *timeout* parameter. Then if the timeout period " @@ -1045,14 +1046,14 @@ msgid "" "exception is raised::" msgstr "" -#: ../../whatsnew/3.2.rst:970 +#: ../../whatsnew/3.2.rst:971 msgid "" "In this example, the barrier enforces a more robust rule. If some election " "sites do not finish before midnight, the barrier times-out and the ballots " "are sealed and deposited in a queue for later handling." msgstr "" -#: ../../whatsnew/3.2.rst:974 +#: ../../whatsnew/3.2.rst:975 msgid "" "See `Barrier Synchronization Patterns `_ for more examples " @@ -1062,17 +1063,17 @@ msgid "" "*section 3.6*." msgstr "" -#: ../../whatsnew/3.2.rst:980 +#: ../../whatsnew/3.2.rst:981 msgid "" "(Contributed by Kristján Valur Jónsson with an API review by Jeffrey Yasskin " "in :issue:`8777`.)" msgstr "" -#: ../../whatsnew/3.2.rst:984 +#: ../../whatsnew/3.2.rst:985 msgid "datetime and time" msgstr "datetime 和 time" -#: ../../whatsnew/3.2.rst:986 +#: ../../whatsnew/3.2.rst:987 msgid "" "The :mod:`datetime` module has a new type :class:`~datetime.timezone` that " "implements the :class:`~datetime.tzinfo` interface by returning a fixed UTC " @@ -1080,20 +1081,20 @@ msgid "" "datetime objects::" msgstr "" -#: ../../whatsnew/3.2.rst:999 +#: ../../whatsnew/3.2.rst:1000 msgid "" "Also, :class:`~datetime.timedelta` objects can now be multiplied by :class:" "`float` and divided by :class:`float` and :class:`int` objects. And :class:" "`~datetime.timedelta` objects can now divide one another." msgstr "" -#: ../../whatsnew/3.2.rst:1003 +#: ../../whatsnew/3.2.rst:1004 msgid "" "The :meth:`datetime.date.strftime` method is no longer restricted to years " "after 1900. The new supported year range is from 1000 to 9999 inclusive." msgstr "" -#: ../../whatsnew/3.2.rst:1006 +#: ../../whatsnew/3.2.rst:1007 msgid "" "Whenever a two-digit year is used in a time tuple, the interpretation has " "been governed by :attr:`time.accept2dyear`. The default is ``True`` which " @@ -1101,7 +1102,7 @@ msgid "" "POSIX rules governing the ``%y`` strptime format." msgstr "" -#: ../../whatsnew/3.2.rst:1011 +#: ../../whatsnew/3.2.rst:1012 msgid "" "Starting with Py3.2, use of the century guessing heuristic will emit a :exc:" "`DeprecationWarning`. Instead, it is recommended that :attr:`time." @@ -1109,7 +1110,7 @@ msgid "" "without guesswork::" msgstr "" -#: ../../whatsnew/3.2.rst:1030 +#: ../../whatsnew/3.2.rst:1031 msgid "" "Several functions now have significantly expanded date ranges. When :attr:" "`time.accept2dyear` is false, the :func:`time.asctime` function will accept " @@ -1118,45 +1119,45 @@ msgid "" "corresponding operating system functions." msgstr "" -#: ../../whatsnew/3.2.rst:1036 +#: ../../whatsnew/3.2.rst:1037 msgid "" "(Contributed by Alexander Belopolsky and Victor Stinner in :issue:" "`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :" "issue:`8013`, and :issue:`10827`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1043 +#: ../../whatsnew/3.2.rst:1044 msgid "math" msgstr "math" -#: ../../whatsnew/3.2.rst:1045 +#: ../../whatsnew/3.2.rst:1046 msgid "" "The :mod:`math` module has been updated with six new functions inspired by " "the C99 standard." msgstr "" -#: ../../whatsnew/3.2.rst:1048 +#: ../../whatsnew/3.2.rst:1049 msgid "" "The :func:`~math.isfinite` function provides a reliable and fast way to " "detect special values. It returns ``True`` for regular numbers and " "``False`` for *Nan* or *Infinity*:" msgstr "" -#: ../../whatsnew/3.2.rst:1056 +#: ../../whatsnew/3.2.rst:1057 msgid "" "The :func:`~math.expm1` function computes ``e**x-1`` for small values of *x* " "without incurring the loss of precision that usually accompanies the " "subtraction of nearly equal quantities:" msgstr "" -#: ../../whatsnew/3.2.rst:1064 +#: ../../whatsnew/3.2.rst:1065 msgid "" "The :func:`~math.erf` function computes a probability integral or `Gaussian " "error function `_. The " "complementary error function, :func:`~math.erfc`, is ``1 - erf(x)``:" msgstr "" -#: ../../whatsnew/3.2.rst:1079 +#: ../../whatsnew/3.2.rst:1080 msgid "" "The :func:`~math.gamma` function is a continuous extension of the factorial " "function. See https://en.wikipedia.org/wiki/Gamma_function for details. " @@ -1165,36 +1166,36 @@ msgid "" "computing the natural logarithm of the gamma function:" msgstr "" -#: ../../whatsnew/3.2.rst:1091 +#: ../../whatsnew/3.2.rst:1092 msgid "(Contributed by Mark Dickinson.)" msgstr "" -#: ../../whatsnew/3.2.rst:1094 +#: ../../whatsnew/3.2.rst:1095 msgid "abc" msgstr "abc" -#: ../../whatsnew/3.2.rst:1096 +#: ../../whatsnew/3.2.rst:1097 msgid "" "The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and :" "func:`~abc.abstractstaticmethod`." msgstr "" -#: ../../whatsnew/3.2.rst:1099 +#: ../../whatsnew/3.2.rst:1100 msgid "" "These tools make it possible to define an :term:`abstract base class` that " "requires a particular :func:`classmethod` or :func:`staticmethod` to be " "implemented::" msgstr "" -#: ../../whatsnew/3.2.rst:1111 +#: ../../whatsnew/3.2.rst:1112 msgid "(Patch submitted by Daniel Urban; :issue:`5867`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1114 +#: ../../whatsnew/3.2.rst:1115 msgid "io" msgstr "io" -#: ../../whatsnew/3.2.rst:1116 +#: ../../whatsnew/3.2.rst:1117 msgid "" "The :class:`io.BytesIO` has a new method, :meth:`~io.BytesIO.getbuffer`, " "which provides functionality similar to :func:`memoryview`. It creates an " @@ -1202,15 +1203,15 @@ msgid "" "and support for slice notation are well-suited to in-place editing::" msgstr "" -#: ../../whatsnew/3.2.rst:1142 +#: ../../whatsnew/3.2.rst:1143 msgid "(Contributed by Antoine Pitrou in :issue:`5506`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1145 +#: ../../whatsnew/3.2.rst:1146 msgid "reprlib" msgstr "reprlib" -#: ../../whatsnew/3.2.rst:1147 +#: ../../whatsnew/3.2.rst:1148 msgid "" "When writing a :meth:`__repr__` method for a custom container, it is easy to " "forget to handle the case where a member refers back to the container " @@ -1219,28 +1220,28 @@ msgid "" "representation string." msgstr "" -#: ../../whatsnew/3.2.rst:1153 +#: ../../whatsnew/3.2.rst:1154 msgid "" "To help write such :meth:`__repr__` methods, the :mod:`reprlib` module has a " "new decorator, :func:`~reprlib.recursive_repr`, for detecting recursive " "calls to :meth:`__repr__` and substituting a placeholder string instead::" msgstr "" -#: ../../whatsnew/3.2.rst:1168 +#: ../../whatsnew/3.2.rst:1169 msgid "(Contributed by Raymond Hettinger in :issue:`9826` and :issue:`9840`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1171 +#: ../../whatsnew/3.2.rst:1172 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.2.rst:1173 +#: ../../whatsnew/3.2.rst:1174 msgid "" "In addition to dictionary-based configuration described above, the :mod:" "`logging` package has many other improvements." msgstr "" -#: ../../whatsnew/3.2.rst:1176 +#: ../../whatsnew/3.2.rst:1177 msgid "" "The logging documentation has been augmented by a :ref:`basic tutorial " "`\\, an :ref:`advanced tutorial ` for zipfiles, uncompressed tarfiles, " @@ -1665,7 +1666,7 @@ msgid "" "tarfiles or custom formats)." msgstr "" -#: ../../whatsnew/3.2.rst:1557 +#: ../../whatsnew/3.2.rst:1558 msgid "" "The principal functions are :func:`~shutil.make_archive` and :func:`~shutil." "unpack_archive`. By default, both operate on the current directory (which " @@ -1674,23 +1675,23 @@ msgid "" "non-destructive (the original files are left unchanged)." msgstr "" -#: ../../whatsnew/3.2.rst:1591 +#: ../../whatsnew/3.2.rst:1592 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.2.rst:1593 +#: ../../whatsnew/3.2.rst:1594 msgid "" "The :mod:`sqlite3` module was updated to pysqlite version 2.6.0. It has two " "new capabilities." msgstr "" -#: ../../whatsnew/3.2.rst:1595 +#: ../../whatsnew/3.2.rst:1596 msgid "" "The :attr:`sqlite3.Connection.in_transit` attribute is true if there is an " "active transaction for uncommitted changes." msgstr "" -#: ../../whatsnew/3.2.rst:1598 +#: ../../whatsnew/3.2.rst:1599 msgid "" "The :meth:`sqlite3.Connection.enable_load_extension` and :meth:`sqlite3." "Connection.load_extension` methods allows you to load SQLite extensions from " @@ -1698,30 +1699,30 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../whatsnew/3.2.rst:1603 +#: ../../whatsnew/3.2.rst:1604 msgid "(Contributed by R. David Murray and Shashwat Anand; :issue:`8845`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1606 +#: ../../whatsnew/3.2.rst:1607 msgid "html" msgstr "html" -#: ../../whatsnew/3.2.rst:1608 +#: ../../whatsnew/3.2.rst:1609 msgid "" "A new :mod:`html` module was introduced with only a single function, :func:" "`~html.escape`, which is used for escaping reserved characters from HTML " "markup:" msgstr "" -#: ../../whatsnew/3.2.rst:1617 +#: ../../whatsnew/3.2.rst:1618 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.2.rst:1619 +#: ../../whatsnew/3.2.rst:1620 msgid "The :mod:`socket` module has two new improvements." msgstr "" -#: ../../whatsnew/3.2.rst:1621 +#: ../../whatsnew/3.2.rst:1622 msgid "" "Socket objects now have a :meth:`~socket.socket.detach()` method which puts " "the socket into closed state without actually closing the underlying file " @@ -1729,24 +1730,24 @@ msgid "" "Antoine Pitrou; :issue:`8524`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1626 +#: ../../whatsnew/3.2.rst:1627 msgid "" ":func:`socket.create_connection` now supports the context management " "protocol to unconditionally consume :exc:`socket.error` exceptions and to " "close the socket when done. (Contributed by Giampaolo Rodolà; :issue:`9794`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1632 +#: ../../whatsnew/3.2.rst:1633 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.2.rst:1634 +#: ../../whatsnew/3.2.rst:1635 msgid "" "The :mod:`ssl` module added a number of features to satisfy common " "requirements for secure (encrypted, authenticated) internet connections:" msgstr "" -#: ../../whatsnew/3.2.rst:1637 +#: ../../whatsnew/3.2.rst:1638 msgid "" "A new class, :class:`~ssl.SSLContext`, serves as a container for persistent " "SSL data, such as protocol settings, certificates, private keys, and various " @@ -1754,14 +1755,14 @@ msgid "" "creating an SSL socket from an SSL context." msgstr "" -#: ../../whatsnew/3.2.rst:1642 +#: ../../whatsnew/3.2.rst:1643 msgid "" "A new function, :func:`ssl.match_hostname`, supports server identity " "verification for higher-level protocols by implementing the rules of HTTPS " "(from :rfc:`2818`) which are also suitable for other protocols." msgstr "" -#: ../../whatsnew/3.2.rst:1646 +#: ../../whatsnew/3.2.rst:1647 msgid "" "The :func:`ssl.wrap_socket` constructor function now takes a *ciphers* " "argument. The *ciphers* string lists the allowed encryption algorithms " @@ -1769,7 +1770,7 @@ msgid "" "openssl.org/docs/man1.0.2/man1/ciphers.html#CIPHER-LIST-FORMAT>`__." msgstr "" -#: ../../whatsnew/3.2.rst:1651 +#: ../../whatsnew/3.2.rst:1652 msgid "" "When linked against recent versions of OpenSSL, the :mod:`ssl` module now " "supports the Server Name Indication extension to the TLS protocol, allowing " @@ -1778,20 +1779,20 @@ msgid "" "the *server_hostname* argument to :meth:`ssl.SSLContext.wrap_socket`." msgstr "" -#: ../../whatsnew/3.2.rst:1657 +#: ../../whatsnew/3.2.rst:1658 msgid "" "Various options have been added to the :mod:`ssl` module, such as :data:" "`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 protocol." msgstr "" -#: ../../whatsnew/3.2.rst:1661 +#: ../../whatsnew/3.2.rst:1662 msgid "" "The extension now loads all the OpenSSL ciphers and digest algorithms. If " "some SSL certificates cannot be verified, they are reported as an \"unknown " "algorithm\" error." msgstr "" -#: ../../whatsnew/3.2.rst:1665 +#: ../../whatsnew/3.2.rst:1666 msgid "" "The version of OpenSSL being used is now accessible using the module " "attributes :data:`ssl.OPENSSL_VERSION` (a string), :data:`ssl." @@ -1799,17 +1800,17 @@ msgid "" "(an integer)." msgstr "" -#: ../../whatsnew/3.2.rst:1670 +#: ../../whatsnew/3.2.rst:1671 msgid "" "(Contributed by Antoine Pitrou in :issue:`8850`, :issue:`1589`, :issue:" "`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, and :issue:`8321`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1674 +#: ../../whatsnew/3.2.rst:1675 msgid "nntp" msgstr "nntp" -#: ../../whatsnew/3.2.rst:1676 +#: ../../whatsnew/3.2.rst:1677 msgid "" "The :mod:`nntplib` module has a revamped implementation with better bytes " "and text semantics as well as more practical APIs. These improvements break " @@ -1817,24 +1818,24 @@ msgid "" "dysfunctional in itself." msgstr "" -#: ../../whatsnew/3.2.rst:1681 +#: ../../whatsnew/3.2.rst:1682 msgid "" "Support for secure connections through both implicit (using :class:`nntplib." "NNTP_SSL`) and explicit (using :meth:`nntplib.NNTP.starttls`) TLS has also " "been added." msgstr "" -#: ../../whatsnew/3.2.rst:1685 +#: ../../whatsnew/3.2.rst:1686 msgid "" "(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant in :issue:" "`1926`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1688 +#: ../../whatsnew/3.2.rst:1689 msgid "certificates" msgstr "certificates" -#: ../../whatsnew/3.2.rst:1690 +#: ../../whatsnew/3.2.rst:1691 msgid "" ":class:`http.client.HTTPSConnection`, :class:`urllib.request.HTTPSHandler` " "and :func:`urllib.request.urlopen` now take optional arguments to allow for " @@ -1842,49 +1843,49 @@ msgid "" "recommended in public uses of HTTPS." msgstr "" -#: ../../whatsnew/3.2.rst:1695 +#: ../../whatsnew/3.2.rst:1696 msgid "(Added by Antoine Pitrou, :issue:`9003`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1698 +#: ../../whatsnew/3.2.rst:1699 msgid "imaplib" msgstr "imaplib" -#: ../../whatsnew/3.2.rst:1700 +#: ../../whatsnew/3.2.rst:1701 msgid "" "Support for explicit TLS on standard IMAP4 connections has been added " "through the new :mod:`imaplib.IMAP4.starttls` method." msgstr "" -#: ../../whatsnew/3.2.rst:1703 +#: ../../whatsnew/3.2.rst:1704 msgid "(Contributed by Lorenzo M. Catucci and Antoine Pitrou, :issue:`4471`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1706 +#: ../../whatsnew/3.2.rst:1707 msgid "http.client" msgstr "http.client" -#: ../../whatsnew/3.2.rst:1708 +#: ../../whatsnew/3.2.rst:1709 msgid "" "There were a number of small API improvements in the :mod:`http.client` " "module. The old-style HTTP 0.9 simple responses are no longer supported and " "the *strict* parameter is deprecated in all classes." msgstr "" -#: ../../whatsnew/3.2.rst:1712 +#: ../../whatsnew/3.2.rst:1713 msgid "" "The :class:`~http.client.HTTPConnection` and :class:`~http.client." "HTTPSConnection` classes now have a *source_address* parameter for a (host, " "port) tuple indicating where the HTTP connection is made from." msgstr "" -#: ../../whatsnew/3.2.rst:1717 +#: ../../whatsnew/3.2.rst:1718 msgid "" "Support for certificate checking and HTTPS virtual hosts were added to :" "class:`~http.client.HTTPSConnection`." msgstr "" -#: ../../whatsnew/3.2.rst:1720 +#: ../../whatsnew/3.2.rst:1721 msgid "" "The :meth:`~http.client.HTTPConnection.request` method on connection objects " "allowed an optional *body* argument so that a :term:`file object` could be " @@ -1894,14 +1895,14 @@ msgid "" "flexible than before." msgstr "" -#: ../../whatsnew/3.2.rst:1727 +#: ../../whatsnew/3.2.rst:1728 msgid "" "To establish an HTTPS connection through a proxy server, there is a new :" "meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host and " "port for HTTP Connect tunneling." msgstr "" -#: ../../whatsnew/3.2.rst:1731 +#: ../../whatsnew/3.2.rst:1732 msgid "" "To match the behavior of :mod:`http.server`, the HTTP client library now " "also encodes headers with ISO-8859-1 (Latin-1) encoding. It was already " @@ -1910,11 +1911,11 @@ msgid "" "`10980`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1737 +#: ../../whatsnew/3.2.rst:1738 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.2.rst:1739 +#: ../../whatsnew/3.2.rst:1740 msgid "" "The unittest module has a number of improvements supporting test discovery " "for packages, easier experimentation at the interactive prompt, new testcase " @@ -1922,7 +1923,7 @@ msgid "" "names." msgstr "" -#: ../../whatsnew/3.2.rst:1744 +#: ../../whatsnew/3.2.rst:1745 msgid "" "The command-line call ``python -m unittest`` can now accept file paths " "instead of module names for running specific tests (:issue:`10620`). The " @@ -1932,29 +1933,29 @@ msgid "" "and a directory to start discovery with ``-s``:" msgstr "" -#: ../../whatsnew/3.2.rst:1755 ../../whatsnew/3.2.rst:1764 -#: ../../whatsnew/3.2.rst:1920 +#: ../../whatsnew/3.2.rst:1756 ../../whatsnew/3.2.rst:1765 +#: ../../whatsnew/3.2.rst:1921 msgid "(Contributed by Michael Foord.)" msgstr "" -#: ../../whatsnew/3.2.rst:1757 +#: ../../whatsnew/3.2.rst:1758 msgid "" "Experimentation at the interactive prompt is now easier because the :class:" "`unittest.case.TestCase` class can now be instantiated without arguments:" msgstr "" -#: ../../whatsnew/3.2.rst:1766 +#: ../../whatsnew/3.2.rst:1767 msgid "" "The :mod:`unittest` module has two new methods, :meth:`~unittest.TestCase." "assertWarns` and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that " "a given warning type is triggered by the code under test::" msgstr "" -#: ../../whatsnew/3.2.rst:1774 +#: ../../whatsnew/3.2.rst:1775 msgid "(Contributed by Antoine Pitrou, :issue:`9754`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1776 +#: ../../whatsnew/3.2.rst:1777 msgid "" "Another new method, :meth:`~unittest.TestCase.assertCountEqual` is used to " "compare two iterables to determine if their element counts are equal " @@ -1962,7 +1963,7 @@ msgid "" "regardless of order)::" msgstr "" -#: ../../whatsnew/3.2.rst:1786 +#: ../../whatsnew/3.2.rst:1787 msgid "" "A principal feature of the unittest module is an effort to produce " "meaningful diagnostics when a test fails. When possible, the failure is " @@ -1972,13 +1973,13 @@ msgid "" "that sets maximum length of diffs displayed." msgstr "" -#: ../../whatsnew/3.2.rst:1793 +#: ../../whatsnew/3.2.rst:1794 msgid "" "In addition, the method names in the module have undergone a number of clean-" "ups." msgstr "" -#: ../../whatsnew/3.2.rst:1795 +#: ../../whatsnew/3.2.rst:1796 msgid "" "For example, :meth:`~unittest.TestCase.assertRegex` is the new name for :" "meth:`~unittest.TestCase.assertRegexpMatches` which was misnamed because the " @@ -1989,76 +1990,76 @@ msgid "" "has unambiguous camel-casing." msgstr "" -#: ../../whatsnew/3.2.rst:1803 +#: ../../whatsnew/3.2.rst:1804 msgid "(Contributed by Raymond Hettinger and implemented by Ezio Melotti.)" msgstr "" -#: ../../whatsnew/3.2.rst:1805 +#: ../../whatsnew/3.2.rst:1806 msgid "" "To improve consistency, some long-standing method aliases are being " "deprecated in favor of the preferred names:" msgstr "" -#: ../../whatsnew/3.2.rst:1809 +#: ../../whatsnew/3.2.rst:1810 msgid "Old Name" msgstr "" -#: ../../whatsnew/3.2.rst:1809 +#: ../../whatsnew/3.2.rst:1810 msgid "Preferred Name" msgstr "" -#: ../../whatsnew/3.2.rst:1811 +#: ../../whatsnew/3.2.rst:1812 msgid ":meth:`assert_`" msgstr ":meth:`assert_`" -#: ../../whatsnew/3.2.rst:1811 +#: ../../whatsnew/3.2.rst:1812 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.2.rst:1812 +#: ../../whatsnew/3.2.rst:1813 msgid ":meth:`assertEquals`" msgstr ":meth:`assertEquals`" -#: ../../whatsnew/3.2.rst:1812 +#: ../../whatsnew/3.2.rst:1813 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.2.rst:1813 +#: ../../whatsnew/3.2.rst:1814 msgid ":meth:`assertNotEquals`" msgstr ":meth:`assertNotEquals`" -#: ../../whatsnew/3.2.rst:1813 +#: ../../whatsnew/3.2.rst:1814 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.2.rst:1814 +#: ../../whatsnew/3.2.rst:1815 msgid ":meth:`assertAlmostEquals`" msgstr ":meth:`assertAlmostEquals`" -#: ../../whatsnew/3.2.rst:1814 +#: ../../whatsnew/3.2.rst:1815 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.2.rst:1815 +#: ../../whatsnew/3.2.rst:1816 msgid ":meth:`assertNotAlmostEquals`" msgstr ":meth:`assertNotAlmostEquals`" -#: ../../whatsnew/3.2.rst:1815 +#: ../../whatsnew/3.2.rst:1816 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.2.rst:1818 +#: ../../whatsnew/3.2.rst:1819 msgid "" "Likewise, the ``TestCase.fail*`` methods deprecated in Python 3.1 are " "expected to be removed in Python 3.3. Also see the :ref:`deprecated-" "aliases` section in the :mod:`unittest` documentation." msgstr "" -#: ../../whatsnew/3.2.rst:1822 +#: ../../whatsnew/3.2.rst:1823 msgid "(Contributed by Ezio Melotti; :issue:`9424`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1824 +#: ../../whatsnew/3.2.rst:1825 msgid "" "The :meth:`~unittest.TestCase.assertDictContainsSubset` method was " "deprecated because it was misimplemented with the arguments in the wrong " @@ -2066,11 +2067,11 @@ msgid "" "``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." msgstr "" -#: ../../whatsnew/3.2.rst:1832 +#: ../../whatsnew/3.2.rst:1833 msgid "random" msgstr "random" -#: ../../whatsnew/3.2.rst:1834 +#: ../../whatsnew/3.2.rst:1835 msgid "" "The integer methods in the :mod:`random` module now do a better job of " "producing uniform distributions. Previously, they computed selections with " @@ -2082,15 +2083,15 @@ msgid "" "func:`~random.sample`." msgstr "" -#: ../../whatsnew/3.2.rst:1843 +#: ../../whatsnew/3.2.rst:1844 msgid "(Contributed by Raymond Hettinger; :issue:`9025`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1846 +#: ../../whatsnew/3.2.rst:1847 msgid "poplib" msgstr "poplib" -#: ../../whatsnew/3.2.rst:1848 +#: ../../whatsnew/3.2.rst:1849 msgid "" ":class:`~poplib.POP3_SSL` class now accepts a *context* parameter, which is " "a :class:`ssl.SSLContext` object allowing bundling SSL configuration " @@ -2098,15 +2099,15 @@ msgid "" "lived) structure." msgstr "" -#: ../../whatsnew/3.2.rst:1853 +#: ../../whatsnew/3.2.rst:1854 msgid "(Contributed by Giampaolo Rodolà; :issue:`8807`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1856 +#: ../../whatsnew/3.2.rst:1857 msgid "asyncore" msgstr "asyncore" -#: ../../whatsnew/3.2.rst:1858 +#: ../../whatsnew/3.2.rst:1859 msgid "" ":class:`asyncore.dispatcher` now provides a :meth:`~asyncore.dispatcher." "handle_accepted()` method returning a `(sock, addr)` pair which is called " @@ -2116,41 +2117,41 @@ msgid "" "dispatcher.accept()` directly." msgstr "" -#: ../../whatsnew/3.2.rst:1865 +#: ../../whatsnew/3.2.rst:1866 msgid "(Contributed by Giampaolo Rodolà; :issue:`6706`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1868 +#: ../../whatsnew/3.2.rst:1869 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.2.rst:1870 +#: ../../whatsnew/3.2.rst:1871 msgid "" "The :mod:`tempfile` module has a new context manager, :class:`~tempfile." "TemporaryDirectory` which provides easy deterministic cleanup of temporary " "directories::" msgstr "" -#: ../../whatsnew/3.2.rst:1877 +#: ../../whatsnew/3.2.rst:1878 msgid "(Contributed by Neil Schemenauer and Nick Coghlan; :issue:`5178`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1880 +#: ../../whatsnew/3.2.rst:1881 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.2.rst:1882 +#: ../../whatsnew/3.2.rst:1883 msgid "" "The :mod:`inspect` module has a new function :func:`~inspect." "getgeneratorstate` to easily identify the current state of a generator-" "iterator::" msgstr "" -#: ../../whatsnew/3.2.rst:1900 +#: ../../whatsnew/3.2.rst:1901 msgid "(Contributed by Rodolpho Eckhardt and Nick Coghlan, :issue:`10220`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1902 +#: ../../whatsnew/3.2.rst:1903 msgid "" "To support lookups without the possibility of activating a dynamic " "attribute, the :mod:`inspect` module has a new function, :func:`~inspect." @@ -2158,26 +2159,26 @@ msgid "" "guaranteed not to change state while it is searching::" msgstr "" -#: ../../whatsnew/3.2.rst:1923 +#: ../../whatsnew/3.2.rst:1924 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.2.rst:1925 +#: ../../whatsnew/3.2.rst:1926 msgid "" "The :mod:`pydoc` module now provides a much-improved web server interface, " "as well as a new command-line option ``-b`` to automatically open a browser " "window to display that server:" msgstr "" -#: ../../whatsnew/3.2.rst:1933 +#: ../../whatsnew/3.2.rst:1934 msgid "(Contributed by Ron Adam; :issue:`2001`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1936 +#: ../../whatsnew/3.2.rst:1937 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.2.rst:1938 +#: ../../whatsnew/3.2.rst:1939 msgid "" "The :mod:`dis` module gained two new functions for inspecting code, :func:" "`~dis.code_info` and :func:`~dis.show_code`. Both provide detailed code " @@ -2185,197 +2186,197 @@ msgid "" "code object. The former returns a string and the latter prints it::" msgstr "" -#: ../../whatsnew/3.2.rst:1965 +#: ../../whatsnew/3.2.rst:1966 msgid "" "In addition, the :func:`~dis.dis` function now accepts string arguments so " "that the common idiom ``dis(compile(s, '', 'eval'))`` can be shortened to " "``dis(s)``::" msgstr "" -#: ../../whatsnew/3.2.rst:1987 +#: ../../whatsnew/3.2.rst:1988 msgid "" "Taken together, these improvements make it easier to explore how CPython is " "implemented and to see for yourself what the language syntax does under-the-" "hood." msgstr "" -#: ../../whatsnew/3.2.rst:1991 +#: ../../whatsnew/3.2.rst:1992 msgid "(Contributed by Nick Coghlan in :issue:`9147`.)" msgstr "" -#: ../../whatsnew/3.2.rst:1994 +#: ../../whatsnew/3.2.rst:1995 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.2.rst:1996 +#: ../../whatsnew/3.2.rst:1997 msgid "" "All database modules now support the :meth:`get` and :meth:`setdefault` " "methods." msgstr "" -#: ../../whatsnew/3.2.rst:1998 +#: ../../whatsnew/3.2.rst:1999 msgid "(Suggested by Ray Allen in :issue:`9523`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2001 +#: ../../whatsnew/3.2.rst:2002 msgid "ctypes" msgstr "ctypes" -#: ../../whatsnew/3.2.rst:2003 +#: ../../whatsnew/3.2.rst:2004 msgid "" "A new type, :class:`ctypes.c_ssize_t` represents the C :c:type:`ssize_t` " "datatype." msgstr "" -#: ../../whatsnew/3.2.rst:2006 +#: ../../whatsnew/3.2.rst:2007 msgid "site" msgstr "site" -#: ../../whatsnew/3.2.rst:2008 +#: ../../whatsnew/3.2.rst:2009 msgid "" "The :mod:`site` module has three new functions useful for reporting on the " "details of a given Python installation." msgstr "" -#: ../../whatsnew/3.2.rst:2011 +#: ../../whatsnew/3.2.rst:2012 msgid "" ":func:`~site.getsitepackages` lists all global site-packages directories." msgstr "" -#: ../../whatsnew/3.2.rst:2013 +#: ../../whatsnew/3.2.rst:2014 msgid "" ":func:`~site.getuserbase` reports on the user's base directory where data " "can be stored." msgstr "" -#: ../../whatsnew/3.2.rst:2016 +#: ../../whatsnew/3.2.rst:2017 msgid "" ":func:`~site.getusersitepackages` reveals the user-specific site-packages " "directory path." msgstr "" -#: ../../whatsnew/3.2.rst:2031 +#: ../../whatsnew/3.2.rst:2032 msgid "" "Conveniently, some of site's functionality is accessible directly from the " "command-line:" msgstr "" -#: ../../whatsnew/3.2.rst:2041 +#: ../../whatsnew/3.2.rst:2042 msgid "(Contributed by Tarek Ziadé in :issue:`6693`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2044 +#: ../../whatsnew/3.2.rst:2045 msgid "sysconfig" msgstr "sysconfig" -#: ../../whatsnew/3.2.rst:2046 +#: ../../whatsnew/3.2.rst:2047 msgid "" "The new :mod:`sysconfig` module makes it straightforward to discover " "installation paths and configuration variables that vary across platforms " "and installations." msgstr "" -#: ../../whatsnew/3.2.rst:2050 +#: ../../whatsnew/3.2.rst:2051 msgid "" "The module offers access simple access functions for platform and version " "information:" msgstr "" -#: ../../whatsnew/3.2.rst:2053 +#: ../../whatsnew/3.2.rst:2054 msgid "" ":func:`~sysconfig.get_platform` returning values like *linux-i586* or " "*macosx-10.6-ppc*." msgstr "" -#: ../../whatsnew/3.2.rst:2055 +#: ../../whatsnew/3.2.rst:2056 msgid "" ":func:`~sysconfig.get_python_version` returns a Python version string such " "as \"3.2\"." msgstr "" -#: ../../whatsnew/3.2.rst:2058 +#: ../../whatsnew/3.2.rst:2059 msgid "" "It also provides access to the paths and variables corresponding to one of " "seven named schemes used by :mod:`distutils`. Those include *posix_prefix*, " "*posix_home*, *posix_user*, *nt*, *nt_user*, *os2*, *os2_home*:" msgstr "" -#: ../../whatsnew/3.2.rst:2062 +#: ../../whatsnew/3.2.rst:2063 msgid "" ":func:`~sysconfig.get_paths` makes a dictionary containing installation " "paths for the current installation scheme." msgstr "" -#: ../../whatsnew/3.2.rst:2064 +#: ../../whatsnew/3.2.rst:2065 msgid "" ":func:`~sysconfig.get_config_vars` returns a dictionary of platform specific " "variables." msgstr "" -#: ../../whatsnew/3.2.rst:2067 +#: ../../whatsnew/3.2.rst:2068 msgid "There is also a convenient command-line interface:" msgstr "" -#: ../../whatsnew/3.2.rst:2106 +#: ../../whatsnew/3.2.rst:2107 msgid "(Moved out of Distutils by Tarek Ziadé.)" msgstr "" -#: ../../whatsnew/3.2.rst:2109 +#: ../../whatsnew/3.2.rst:2110 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.2.rst:2111 +#: ../../whatsnew/3.2.rst:2112 msgid "" "The :mod:`pdb` debugger module gained a number of usability improvements:" msgstr "" -#: ../../whatsnew/3.2.rst:2113 +#: ../../whatsnew/3.2.rst:2114 msgid "" ":file:`pdb.py` now has a ``-c`` option that executes commands as given in a :" "file:`.pdbrc` script file." msgstr "" -#: ../../whatsnew/3.2.rst:2115 +#: ../../whatsnew/3.2.rst:2116 msgid "" "A :file:`.pdbrc` script file can contain ``continue`` and ``next`` commands " "that continue debugging." msgstr "" -#: ../../whatsnew/3.2.rst:2117 +#: ../../whatsnew/3.2.rst:2118 msgid "The :class:`Pdb` class constructor now accepts a *nosigint* argument." msgstr "" -#: ../../whatsnew/3.2.rst:2118 +#: ../../whatsnew/3.2.rst:2119 msgid "" "New commands: ``l(list)``, ``ll(long list)`` and ``source`` for listing " "source code." msgstr "" -#: ../../whatsnew/3.2.rst:2120 +#: ../../whatsnew/3.2.rst:2121 msgid "" "New commands: ``display`` and ``undisplay`` for showing or hiding the value " "of an expression if it has changed." msgstr "" -#: ../../whatsnew/3.2.rst:2122 +#: ../../whatsnew/3.2.rst:2123 msgid "" "New command: ``interact`` for starting an interactive interpreter containing " "the global and local names found in the current scope." msgstr "" -#: ../../whatsnew/3.2.rst:2124 +#: ../../whatsnew/3.2.rst:2125 msgid "Breakpoints can be cleared by breakpoint number." msgstr "" -#: ../../whatsnew/3.2.rst:2126 +#: ../../whatsnew/3.2.rst:2127 msgid "(Contributed by Georg Brandl, Antonio Cuni and Ilya Sandler.)" msgstr "" -#: ../../whatsnew/3.2.rst:2129 +#: ../../whatsnew/3.2.rst:2130 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.2.rst:2131 +#: ../../whatsnew/3.2.rst:2132 msgid "" "The :mod:`configparser` module was modified to improve usability and " "predictability of the default parser and its supported INI syntax. The old :" @@ -2385,63 +2386,63 @@ msgid "" "option duplicates are not allowed in a single configuration source." msgstr "" -#: ../../whatsnew/3.2.rst:2138 +#: ../../whatsnew/3.2.rst:2139 msgid "Config parsers gained a new API based on the mapping protocol::" msgstr "" -#: ../../whatsnew/3.2.rst:2166 +#: ../../whatsnew/3.2.rst:2167 msgid "" "The new API is implemented on top of the classical API, so custom parser " "subclasses should be able to use it without modifications." msgstr "" -#: ../../whatsnew/3.2.rst:2169 +#: ../../whatsnew/3.2.rst:2170 msgid "" "The INI file structure accepted by config parsers can now be customized. " "Users can specify alternative option/value delimiters and comment prefixes, " "change the name of the *DEFAULT* section or switch the interpolation syntax." msgstr "" -#: ../../whatsnew/3.2.rst:2173 +#: ../../whatsnew/3.2.rst:2174 msgid "" "There is support for pluggable interpolation including an additional " "interpolation handler :class:`~configparser.ExtendedInterpolation`::" msgstr "" -#: ../../whatsnew/3.2.rst:2206 +#: ../../whatsnew/3.2.rst:2207 msgid "" "A number of smaller features were also introduced, like support for " "specifying encoding in read operations, specifying fallback values for get-" "functions, or reading directly from dictionaries and strings." msgstr "" -#: ../../whatsnew/3.2.rst:2210 +#: ../../whatsnew/3.2.rst:2211 msgid "(All changes contributed by Łukasz Langa.)" msgstr "" -#: ../../whatsnew/3.2.rst:2215 +#: ../../whatsnew/3.2.rst:2216 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.2.rst:2217 +#: ../../whatsnew/3.2.rst:2218 msgid "" "A number of usability improvements were made for the :mod:`urllib.parse` " "module." msgstr "" -#: ../../whatsnew/3.2.rst:2219 +#: ../../whatsnew/3.2.rst:2220 msgid "" "The :func:`~urllib.parse.urlparse` function now supports `IPv6 `_ addresses as described in :rfc:`2732`:" msgstr "" -#: ../../whatsnew/3.2.rst:2231 +#: ../../whatsnew/3.2.rst:2232 msgid "" "The :func:`~urllib.parse.urldefrag` function now returns a :term:`named " "tuple`::" msgstr "" -#: ../../whatsnew/3.2.rst:2241 +#: ../../whatsnew/3.2.rst:2242 msgid "" "And, the :func:`~urllib.parse.urlencode` function is now much more flexible, " "accepting either a string or bytes type for the *query* argument. If it is " @@ -2449,7 +2450,7 @@ msgid "" "func:`~urllib.parse.quote_plus` for encoding::" msgstr "" -#: ../../whatsnew/3.2.rst:2252 +#: ../../whatsnew/3.2.rst:2253 msgid "" "As detailed in :ref:`parsing-ascii-encoded-bytes`, all the :mod:`urllib." "parse` functions now accept ASCII-encoded byte strings as input, so long as " @@ -2458,17 +2459,17 @@ msgid "" "strings:" msgstr "" -#: ../../whatsnew/3.2.rst:2261 +#: ../../whatsnew/3.2.rst:2262 msgid "" "(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`, :" "issue:`5468`, and :issue:`9873`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2265 +#: ../../whatsnew/3.2.rst:2266 msgid "mailbox" msgstr "mailbox" -#: ../../whatsnew/3.2.rst:2267 +#: ../../whatsnew/3.2.rst:2268 msgid "" "Thanks to a concerted effort by R. David Murray, the :mod:`mailbox` module " "has been fixed for Python 3.2. The challenge was that mailbox had been " @@ -2477,27 +2478,27 @@ msgid "" "different encodings." msgstr "" -#: ../../whatsnew/3.2.rst:2272 +#: ../../whatsnew/3.2.rst:2273 msgid "" "The solution harnessed the :mod:`email` package's binary support for parsing " "arbitrary email messages. In addition, the solution required a number of " "API changes." msgstr "" -#: ../../whatsnew/3.2.rst:2276 +#: ../../whatsnew/3.2.rst:2277 msgid "" "As expected, the :meth:`~mailbox.Mailbox.add` method for :class:`mailbox." "Mailbox` objects now accepts binary input." msgstr "" -#: ../../whatsnew/3.2.rst:2279 +#: ../../whatsnew/3.2.rst:2280 msgid "" ":class:`~io.StringIO` and text file input are deprecated. Also, string " "input will fail early if non-ASCII characters are used. Previously it would " "fail when the email was processed in a later step." msgstr "" -#: ../../whatsnew/3.2.rst:2283 +#: ../../whatsnew/3.2.rst:2284 msgid "" "There is also support for binary output. The :meth:`~mailbox.Mailbox." "get_file` method now returns a file in the binary mode (where it used to " @@ -2506,7 +2507,7 @@ msgid "" "message corresponding to a given *key*." msgstr "" -#: ../../whatsnew/3.2.rst:2289 +#: ../../whatsnew/3.2.rst:2290 msgid "" "It is still possible to get non-binary output using the old API's :meth:" "`~mailbox.Mailbox.get_string` method, but that approach is not very useful. " @@ -2514,17 +2515,17 @@ msgid "" "object or to load them from binary input." msgstr "" -#: ../../whatsnew/3.2.rst:2294 +#: ../../whatsnew/3.2.rst:2295 msgid "" "(Contributed by R. David Murray, with efforts from Steffen Daode Nurpmeso " "and an initial patch by Victor Stinner in :issue:`9124`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2298 +#: ../../whatsnew/3.2.rst:2299 msgid "turtledemo" msgstr "turtledemo" -#: ../../whatsnew/3.2.rst:2300 +#: ../../whatsnew/3.2.rst:2301 msgid "" "The demonstration code for the :mod:`turtle` module was moved from the " "*Demo* directory to main library. It includes over a dozen sample scripts " @@ -2532,16 +2533,16 @@ msgid "" "from the command-line:" msgstr "" -#: ../../whatsnew/3.2.rst:2309 +#: ../../whatsnew/3.2.rst:2310 msgid "" "(Moved from the Demo directory by Alexander Belopolsky in :issue:`10199`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2312 +#: ../../whatsnew/3.2.rst:2313 msgid "Multi-threading" msgstr "" -#: ../../whatsnew/3.2.rst:2314 +#: ../../whatsnew/3.2.rst:2315 msgid "" "The mechanism for serializing execution of concurrently running Python " "threads (generally known as the :term:`GIL` or Global Interpreter Lock) has " @@ -2553,7 +2554,7 @@ msgid "" "setswitchinterval()`. It currently defaults to 5 milliseconds." msgstr "" -#: ../../whatsnew/3.2.rst:2323 +#: ../../whatsnew/3.2.rst:2324 msgid "" "Additional details about the implementation can be read from a `python-dev " "mailing-list message `_ used in :" "meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " @@ -2637,35 +2638,35 @@ msgid "" "saves time lost to delegating comparisons." msgstr "" -#: ../../whatsnew/3.2.rst:2378 +#: ../../whatsnew/3.2.rst:2379 msgid "(Patch by Daniel Stutzbach in :issue:`9915`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2380 +#: ../../whatsnew/3.2.rst:2381 msgid "" "JSON decoding performance is improved and memory consumption is reduced " "whenever the same string is repeated for multiple keys. Also, JSON encoding " "now uses the C speedups when the ``sort_keys`` argument is true." msgstr "" -#: ../../whatsnew/3.2.rst:2384 +#: ../../whatsnew/3.2.rst:2385 msgid "" "(Contributed by Antoine Pitrou in :issue:`7451` and by Raymond Hettinger and " "Antoine Pitrou in :issue:`10314`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2387 +#: ../../whatsnew/3.2.rst:2388 msgid "" "Recursive locks (created with the :func:`threading.RLock` API) now benefit " "from a C implementation which makes them as fast as regular locks, and " "between 10x and 15x faster than their previous pure Python implementation." msgstr "" -#: ../../whatsnew/3.2.rst:2391 +#: ../../whatsnew/3.2.rst:2392 msgid "(Contributed by Antoine Pitrou; :issue:`3001`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2393 +#: ../../whatsnew/3.2.rst:2394 msgid "" "The fast-search algorithm in stringlib is now used by the :meth:`split`, :" "meth:`rsplit`, :meth:`splitlines` and :meth:`replace` methods on :class:" @@ -2674,21 +2675,21 @@ msgid "" "meth:`rpartition`." msgstr "" -#: ../../whatsnew/3.2.rst:2399 +#: ../../whatsnew/3.2.rst:2400 msgid "(Patch by Florent Xicluna in :issue:`7622` and :issue:`7462`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2402 +#: ../../whatsnew/3.2.rst:2403 msgid "" "Integer to string conversions now work two \"digits\" at a time, reducing " "the number of division and modulo operations." msgstr "" -#: ../../whatsnew/3.2.rst:2405 +#: ../../whatsnew/3.2.rst:2406 msgid "(:issue:`6713` by Gawain Bolton, Mark Dickinson, and Victor Stinner.)" msgstr "" -#: ../../whatsnew/3.2.rst:2407 +#: ../../whatsnew/3.2.rst:2408 msgid "" "There were several other minor optimizations. Set differencing now runs " "faster when one operand is much larger than the other (patch by Andress " @@ -2700,11 +2701,11 @@ msgid "" "line arguments a bit faster (:issue:`7113` by Łukasz Langa)." msgstr "" -#: ../../whatsnew/3.2.rst:2418 +#: ../../whatsnew/3.2.rst:2419 msgid "Unicode" msgstr "" -#: ../../whatsnew/3.2.rst:2420 +#: ../../whatsnew/3.2.rst:2421 msgid "" "Python has been updated to `Unicode 6.0.0 `_. The update to the standard adds over 2,000 new characters " @@ -2712,7 +2713,7 @@ msgid "" "important for mobile phones." msgstr "" -#: ../../whatsnew/3.2.rst:2425 +#: ../../whatsnew/3.2.rst:2426 msgid "" "In addition, the updated standard has altered the character properties for " "two Kannada characters (U+0CF1, U+0CF2) and one New Tai Lue numeric " @@ -2722,15 +2723,15 @@ msgid "" "#Database_Changes>`_." msgstr "" -#: ../../whatsnew/3.2.rst:2433 +#: ../../whatsnew/3.2.rst:2434 msgid "Codecs" msgstr "" -#: ../../whatsnew/3.2.rst:2435 +#: ../../whatsnew/3.2.rst:2436 msgid "Support was added for *cp720* Arabic DOS encoding (:issue:`1616979`)." msgstr "" -#: ../../whatsnew/3.2.rst:2437 +#: ../../whatsnew/3.2.rst:2438 msgid "" "MBCS encoding no longer ignores the error handler argument. In the default " "strict mode, it raises an :exc:`UnicodeDecodeError` when it encounters an " @@ -2738,40 +2739,40 @@ msgid "" "unencodable character." msgstr "" -#: ../../whatsnew/3.2.rst:2442 +#: ../../whatsnew/3.2.rst:2443 msgid "" "The MBCS codec supports ``'strict'`` and ``'ignore'`` error handlers for " "decoding, and ``'strict'`` and ``'replace'`` for encoding." msgstr "" -#: ../../whatsnew/3.2.rst:2445 +#: ../../whatsnew/3.2.rst:2446 msgid "" "To emulate Python3.1 MBCS encoding, select the ``'ignore'`` handler for " "decoding and the ``'replace'`` handler for encoding." msgstr "" -#: ../../whatsnew/3.2.rst:2448 +#: ../../whatsnew/3.2.rst:2449 msgid "" "On Mac OS X, Python decodes command line arguments with ``'utf-8'`` rather " "than the locale encoding." msgstr "" -#: ../../whatsnew/3.2.rst:2451 +#: ../../whatsnew/3.2.rst:2452 msgid "" "By default, :mod:`tarfile` uses ``'utf-8'`` encoding on Windows (instead of " "``'mbcs'``) and the ``'surrogateescape'`` error handler on all operating " "systems." msgstr "" -#: ../../whatsnew/3.2.rst:2457 +#: ../../whatsnew/3.2.rst:2458 msgid "Documentation" msgstr "文件" -#: ../../whatsnew/3.2.rst:2459 +#: ../../whatsnew/3.2.rst:2460 msgid "The documentation continues to be improved." msgstr "" -#: ../../whatsnew/3.2.rst:2461 +#: ../../whatsnew/3.2.rst:2462 msgid "" "A table of quick links has been added to the top of lengthy sections such " "as :ref:`built-in-funcs`. In the case of :mod:`itertools`, the links are " @@ -2779,7 +2780,7 @@ msgid "" "and memory jog without having to read all of the docs." msgstr "" -#: ../../whatsnew/3.2.rst:2466 +#: ../../whatsnew/3.2.rst:2467 msgid "" "In some cases, the pure Python source code can be a helpful adjunct to the " "documentation, so now many modules now feature quick links to the latest " @@ -2787,80 +2788,80 @@ msgid "" "documentation has a quick link at the top labeled:" msgstr "" -#: ../../whatsnew/3.2.rst:2471 +#: ../../whatsnew/3.2.rst:2472 msgid "**Source code** :source:`Lib/functools.py`." msgstr "" -#: ../../whatsnew/3.2.rst:2473 +#: ../../whatsnew/3.2.rst:2474 msgid "" "(Contributed by Raymond Hettinger; see `rationale `_.)" msgstr "" -#: ../../whatsnew/3.2.rst:2476 +#: ../../whatsnew/3.2.rst:2477 msgid "" "The docs now contain more examples and recipes. In particular, :mod:`re` " "module has an extensive section, :ref:`re-examples`. Likewise, the :mod:" "`itertools` module continues to be updated with new :ref:`itertools-recipes`." msgstr "" -#: ../../whatsnew/3.2.rst:2481 +#: ../../whatsnew/3.2.rst:2482 msgid "" "The :mod:`datetime` module now has an auxiliary implementation in pure " "Python. No functionality was changed. This just provides an easier-to-read " "alternate implementation." msgstr "" -#: ../../whatsnew/3.2.rst:2485 +#: ../../whatsnew/3.2.rst:2486 msgid "(Contributed by Alexander Belopolsky in :issue:`9528`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2487 +#: ../../whatsnew/3.2.rst:2488 msgid "" "The unmaintained :file:`Demo` directory has been removed. Some demos were " "integrated into the documentation, some were moved to the :file:`Tools/demo` " "directory, and others were removed altogether." msgstr "" -#: ../../whatsnew/3.2.rst:2491 +#: ../../whatsnew/3.2.rst:2492 msgid "(Contributed by Georg Brandl in :issue:`7962`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2495 +#: ../../whatsnew/3.2.rst:2496 msgid "IDLE" msgstr "IDLE" -#: ../../whatsnew/3.2.rst:2497 +#: ../../whatsnew/3.2.rst:2498 msgid "" "The format menu now has an option to clean source files by stripping " "trailing whitespace." msgstr "" -#: ../../whatsnew/3.2.rst:2500 +#: ../../whatsnew/3.2.rst:2501 msgid "(Contributed by Raymond Hettinger; :issue:`5150`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2502 +#: ../../whatsnew/3.2.rst:2503 msgid "IDLE on Mac OS X now works with both Carbon AquaTk and Cocoa AquaTk." msgstr "" -#: ../../whatsnew/3.2.rst:2504 +#: ../../whatsnew/3.2.rst:2505 msgid "" "(Contributed by Kevin Walzer, Ned Deily, and Ronald Oussoren; :issue:`6075`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2507 +#: ../../whatsnew/3.2.rst:2508 msgid "Code Repository" msgstr "" -#: ../../whatsnew/3.2.rst:2509 +#: ../../whatsnew/3.2.rst:2510 msgid "" "In addition to the existing Subversion code repository at https://svn.python." "org there is now a `Mercurial `_ repository " "at https://hg.python.org/\\ ." msgstr "" -#: ../../whatsnew/3.2.rst:2513 +#: ../../whatsnew/3.2.rst:2514 msgid "" "After the 3.2 release, there are plans to switch to Mercurial as the primary " "repository. This distributed version control system should make it easier " @@ -2868,28 +2869,28 @@ msgid "" "pep:`385` for details." msgstr "" -#: ../../whatsnew/3.2.rst:2518 +#: ../../whatsnew/3.2.rst:2519 msgid "" "To learn to use the new version control system, see the `Quick Start " "`_ or the `Guide to Mercurial " "Workflows `_." msgstr "" -#: ../../whatsnew/3.2.rst:2524 +#: ../../whatsnew/3.2.rst:2525 msgid "Build and C API Changes" msgstr "" -#: ../../whatsnew/3.2.rst:2526 +#: ../../whatsnew/3.2.rst:2527 msgid "Changes to Python's build process and to the C API include:" msgstr "" -#: ../../whatsnew/3.2.rst:2528 +#: ../../whatsnew/3.2.rst:2529 msgid "" "The *idle*, *pydoc* and *2to3* scripts are now installed with a version-" "specific suffix on ``make altinstall`` (:issue:`10679`)." msgstr "" -#: ../../whatsnew/3.2.rst:2531 +#: ../../whatsnew/3.2.rst:2532 msgid "" "The C functions that access the Unicode Database now accept and return " "characters from the full Unicode range, even on narrow unicode builds " @@ -2899,33 +2900,33 @@ msgid "" "characters as printable." msgstr "" -#: ../../whatsnew/3.2.rst:2538 +#: ../../whatsnew/3.2.rst:2539 msgid "" "(Reported by Bupjoe Lee and fixed by Amaury Forgeot D'Arc; :issue:`5127`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2540 +#: ../../whatsnew/3.2.rst:2541 msgid "" "Computed gotos are now enabled by default on supported compilers (which are " "detected by the configure script). They can still be disabled selectively " "by specifying ``--without-computed-gotos``." msgstr "" -#: ../../whatsnew/3.2.rst:2544 +#: ../../whatsnew/3.2.rst:2545 msgid "(Contributed by Antoine Pitrou; :issue:`9203`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2546 +#: ../../whatsnew/3.2.rst:2547 msgid "" "The option ``--with-wctype-functions`` was removed. The built-in unicode " "database is now used for all functions." msgstr "" -#: ../../whatsnew/3.2.rst:2549 +#: ../../whatsnew/3.2.rst:2550 msgid "(Contributed by Amaury Forgeot D'Arc; :issue:`9210`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2551 +#: ../../whatsnew/3.2.rst:2552 msgid "" "Hash values are now values of a new type, :c:type:`Py_hash_t`, which is " "defined to be the same size as a pointer. Previously they were of type " @@ -2935,34 +2936,34 @@ msgid "" "grow to that size but their performance degraded catastrophically)." msgstr "" -#: ../../whatsnew/3.2.rst:2558 +#: ../../whatsnew/3.2.rst:2559 msgid "" "(Suggested by Raymond Hettinger and implemented by Benjamin Peterson; :issue:" "`9778`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2561 +#: ../../whatsnew/3.2.rst:2562 msgid "" "A new macro :c:macro:`Py_VA_COPY` copies the state of the variable argument " "list. It is equivalent to C99 *va_copy* but available on all Python " "platforms (:issue:`2443`)." msgstr "" -#: ../../whatsnew/3.2.rst:2565 +#: ../../whatsnew/3.2.rst:2566 msgid "" "A new C API function :c:func:`PySys_SetArgvEx` allows an embedded " "interpreter to set :attr:`sys.argv` without also modifying :attr:`sys.path` " "(:issue:`5753`)." msgstr "" -#: ../../whatsnew/3.2.rst:2569 +#: ../../whatsnew/3.2.rst:2570 msgid "" ":c:macro:`PyEval_CallObject` is now only available in macro form. The " "function declaration, which was kept for backwards compatibility reasons, is " "now removed -- the macro was introduced in 1997 (:issue:`8276`)." msgstr "" -#: ../../whatsnew/3.2.rst:2573 +#: ../../whatsnew/3.2.rst:2574 msgid "" "There is a new function :c:func:`PyLong_AsLongLongAndOverflow` which is " "analogous to :c:func:`PyLong_AsLongAndOverflow`. They both serve to convert " @@ -2970,13 +2971,13 @@ msgid "" "of cases where the conversion won't fit (:issue:`7767`)." msgstr "" -#: ../../whatsnew/3.2.rst:2578 +#: ../../whatsnew/3.2.rst:2579 msgid "" "The :c:func:`PyUnicode_CompareWithASCIIString` function now returns *not " "equal* if the Python string is *NUL* terminated." msgstr "" -#: ../../whatsnew/3.2.rst:2581 +#: ../../whatsnew/3.2.rst:2582 msgid "" "There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is like :c:" "func:`PyErr_NewException` but allows a docstring to be specified. This lets " @@ -2984,7 +2985,7 @@ msgid "" "Python counterparts (:issue:`7033`)." msgstr "" -#: ../../whatsnew/3.2.rst:2586 +#: ../../whatsnew/3.2.rst:2587 msgid "" "When compiled with the ``--with-valgrind`` option, the pymalloc allocator " "will be automatically disabled when running under Valgrind. This gives " @@ -2992,20 +2993,20 @@ msgid "" "advantage of pymalloc at other times (:issue:`2422`)." msgstr "" -#: ../../whatsnew/3.2.rst:2591 +#: ../../whatsnew/3.2.rst:2592 msgid "" "Removed the ``O?`` format from the *PyArg_Parse* functions. The format is " "no longer used and it had never been documented (:issue:`8837`)." msgstr "" -#: ../../whatsnew/3.2.rst:2594 +#: ../../whatsnew/3.2.rst:2595 msgid "" "There were a number of other small changes to the C-API. See the `Misc/NEWS " -"`_ file for a " +"`__ file for a " "complete list." msgstr "" -#: ../../whatsnew/3.2.rst:2598 +#: ../../whatsnew/3.2.rst:2599 msgid "" "Also, there were a number of updates to the Mac OS X build, see `Mac/" "BuildScript/README.txt `_.)" msgstr "" -#: ../../whatsnew/3.2.rst:2695 +#: ../../whatsnew/3.2.rst:2696 msgid "" ":func:`struct.pack` now only allows bytes for the ``s`` string pack code. " "Formerly, it would accept text arguments and implicitly encode them to bytes " @@ -3167,32 +3168,32 @@ msgid "" "writing to fixed length segment of a structure." msgstr "" -#: ../../whatsnew/3.2.rst:2701 +#: ../../whatsnew/3.2.rst:2702 msgid "" "Code such as ``struct.pack('<6sHHBBB', 'GIF87a', x, y)`` should be rewritten " "with to use bytes instead of text, ``struct.pack('<6sHHBBB', b'GIF87a', x, " "y)``." msgstr "" -#: ../../whatsnew/3.2.rst:2704 +#: ../../whatsnew/3.2.rst:2705 msgid "" "(Discovered by David Beazley and fixed by Victor Stinner; :issue:`10783`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2706 +#: ../../whatsnew/3.2.rst:2707 msgid "" "The :class:`xml.etree.ElementTree` class now raises an :exc:`xml.etree." "ElementTree.ParseError` when a parse fails. Previously it raised an :exc:" "`xml.parsers.expat.ExpatError`." msgstr "" -#: ../../whatsnew/3.2.rst:2710 +#: ../../whatsnew/3.2.rst:2711 msgid "" "The new, longer :func:`str` value on floats may break doctests which rely on " "the old output format." msgstr "" -#: ../../whatsnew/3.2.rst:2713 +#: ../../whatsnew/3.2.rst:2714 msgid "" "In :class:`subprocess.Popen`, the default value for *close_fds* is now " "``True`` under Unix; under Windows, it is ``True`` if the three standard " @@ -3201,28 +3202,28 @@ msgid "" "race conditions when open file descriptors would leak into the child process." msgstr "" -#: ../../whatsnew/3.2.rst:2720 +#: ../../whatsnew/3.2.rst:2721 msgid "" "Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` and :" "mod:`http.client`. Such support is still present on the server side (in :" "mod:`http.server`)." msgstr "" -#: ../../whatsnew/3.2.rst:2724 +#: ../../whatsnew/3.2.rst:2725 msgid "(Contributed by Antoine Pitrou, :issue:`10711`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2726 +#: ../../whatsnew/3.2.rst:2727 msgid "" "SSL sockets in timeout mode now raise :exc:`socket.timeout` when a timeout " "occurs, rather than a generic :exc:`~ssl.SSLError`." msgstr "" -#: ../../whatsnew/3.2.rst:2729 +#: ../../whatsnew/3.2.rst:2730 msgid "(Contributed by Antoine Pitrou, :issue:`10272`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2731 +#: ../../whatsnew/3.2.rst:2732 msgid "" "The misleading functions :c:func:`PyEval_AcquireLock()` and :c:func:" "`PyEval_ReleaseLock()` have been officially deprecated. The thread-state " @@ -3230,18 +3231,18 @@ msgid "" "`PyEval_RestoreThread()`) should be used instead." msgstr "" -#: ../../whatsnew/3.2.rst:2736 +#: ../../whatsnew/3.2.rst:2737 msgid "" "Due to security risks, :func:`asyncore.handle_accept` has been deprecated, " "and a new function, :func:`asyncore.handle_accepted`, was added to replace " "it." msgstr "" -#: ../../whatsnew/3.2.rst:2739 +#: ../../whatsnew/3.2.rst:2740 msgid "(Contributed by Giampaolo Rodola in :issue:`6706`.)" msgstr "" -#: ../../whatsnew/3.2.rst:2741 +#: ../../whatsnew/3.2.rst:2742 msgid "" "Due to the new :term:`GIL` implementation, :c:func:`PyEval_InitThreads()` " "cannot be called before :c:func:`Py_Initialize()` anymore." diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 3a7ed336f1..a767afbf0a 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -541,7 +541,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.4.rst:412 -msgid "Module objects are now :mod:`weakref`'able." +msgid "Module objects are now :ref:`weakly referenceable `." msgstr "" #: ../../whatsnew/3.4.rst:414 @@ -1502,8 +1502,8 @@ msgstr "mmap" #: ../../whatsnew/3.4.rst:1116 msgid "" -"mmap objects can now be :mod:`weakref`\\ ed. (Contributed by Valerie " -"Lambert in :issue:`4885`.)" +"mmap objects are now :ref:`weakly referenceable `. (Contributed " +"by Valerie Lambert in :issue:`4885`.)" msgstr "" #: ../../whatsnew/3.4.rst:1121 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index b68a71e062..0a0f2021db 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-28 00:27+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -223,14 +223,14 @@ msgstr "" msgid "" "A ``._pth`` file can be added to force isolated mode and fully specify all " "search paths to avoid registry and environment lookup. See :ref:`the " -"documentation ` for more information." +"documentation ` for more information." msgstr "" #: ../../whatsnew/3.6.rst:167 msgid "" "A ``python36.zip`` file now works as a landmark to infer :envvar:" -"`PYTHONHOME`. See :ref:`the documentation ` for more " -"information." +"`PYTHONHOME`. See :ref:`the documentation ` for " +"more information." msgstr "" #: ../../whatsnew/3.6.rst:176 @@ -1818,7 +1818,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:1424 msgid "" "New Linux constants ``TCP_USER_TIMEOUT`` and ``TCP_CONGESTION`` were added. " -"(Contributed by Omar Sandoval, issue:`26273`)." +"(Contributed by Omar Sandoval, :issue:`26273`)." msgstr "" #: ../../whatsnew/3.6.rst:1429 diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 2aadbbead5..0fcf84e000 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -504,10 +504,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:356 msgid "" -"`Measurements `_ show that on Linux and Windows the resolution of :" -"func:`time.time_ns` is approximately 3 times better than that of :func:`time." -"time`." +"`Measurements `_ show that on Linux and Windows the resolution of :func:`time." +"time_ns` is approximately 3 times better than that of :func:`time.time`." msgstr "" #: ../../whatsnew/3.7.rst:362 @@ -3484,8 +3483,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2476 msgid "" "The file used to override :data:`sys.path` is now called ``._pth`` instead of ``'sys.path'``. See :ref:`finding_modules` for " -"more information. (Contributed by Steve Dower in :issue:`28137`.)" +"executable>._pth`` instead of ``'sys.path'``. See :ref:" +"`windows_finding_modules` for more information. (Contributed by Steve Dower " +"in :issue:`28137`.)" msgstr "" #: ../../whatsnew/3.7.rst:2483 diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 737e125134..2a67c01462 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+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-" @@ -1036,8 +1036,8 @@ msgstr "time" msgid "" "On AIX, :func:`~time.thread_time` is now implemented with " "``thread_cputime()`` which has nanosecond resolution, rather than " -"``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` which has a resolution of 10 ms. " -"(Contributed by Batuhan Taskaya in :issue:`40192`)" +"``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` which has a resolution of 10 " +"milliseconds. (Contributed by Batuhan Taskaya in :issue:`40192`)" msgstr "" #: ../../whatsnew/3.9.rst:695 @@ -1799,8 +1799,8 @@ msgid "" "Frameworks``, as had been the case on older releases of macOS. If a macOS " "SDK is explicitly configured, by using :option:`--enable-universalsdk` or ``-" "isysroot``, only the SDK itself is searched. The default behavior can still " -"be overridden with :option:`--with-tcltk-includes` and :option:`--with-tcltk-" -"libs`. (Contributed by Ned Deily in :issue:`34956`.)" +"be overridden with ``--with-tcltk-includes`` and ``--with-tcltk-libs``. " +"(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" #: ../../whatsnew/3.9.rst:1255 diff --git a/whatsnew/index.po b/whatsnew/index.po index 6143d6d074..1a095c4f4d 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-07-07 11:37+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,11 +32,11 @@ msgid "" "important changes between major Python versions. They are a \"must read\" " "for anyone wishing to stay up-to-date after a new release." msgstr "" -"「Python 有什麼新功能」這系列的說明是讓使用者知道 Python 各個主要更新版本之" -"間的重大改變的地方。對於希望在新版本釋出時立即了解版本差異的使用者們來說," -"這些說明被歸類為「必讀」的等級。" +"「Python 有什麼新功能」這系列的說明是讓使用者知道 Python 各個主要更新版本之間" +"的重大改變的地方。對於希望在新版本釋出時立即了解版本差異的使用者們來說,這些" +"說明被歸類為「必讀」的等級。" -#: ../../whatsnew/index.rst:34 +#: ../../whatsnew/index.rst:35 msgid "" "The \"Changelog\" is an HTML version of the `file built `_ from the contents of the :source:`Misc/NEWS.d` directory " @@ -44,5 +44,5 @@ msgid "" "version." msgstr "" "「Changelog(更動日誌)」是從 :source:`Misc/NEWS.d` 目錄樹的內容\\ `建置 " -"`_\\ 的一個 HTML 檔案版本,其中包含了 " -"Python 目前版本中的\\ *所有*\\ 重要變更。" +"`_\\ 的一個 HTML 檔案版本,其中包含了 Python " +"目前版本中的\\ *所有*\\ 重要變更。"