From c5fb0c0ae78ca322b2adc97b6c0c8f746dc136c1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 28 Jul 2025 17:31:41 +0000 Subject: [PATCH 1/5] sync with cpython cdae923f --- library/asyncio-eventloop.po | 650 +++++++++--------- library/multiprocessing.po | 1192 +++++++++++++++++----------------- 2 files changed, 924 insertions(+), 918 deletions(-) diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 26091449c9..a337f0aedd 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-07-28 17:30+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-" @@ -295,8 +295,8 @@ msgid "" msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" #: ../../library/asyncio-eventloop.rst:177 -#: ../../library/asyncio-eventloop.rst:1320 -#: ../../library/asyncio-eventloop.rst:1769 +#: ../../library/asyncio-eventloop.rst:1326 +#: ../../library/asyncio-eventloop.rst:1775 msgid "Example::" msgstr "範例: ::" @@ -687,8 +687,8 @@ msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" #: ../../library/asyncio-eventloop.rst:437 -#: ../../library/asyncio-eventloop.rst:1230 -#: ../../library/asyncio-eventloop.rst:1247 +#: ../../library/asyncio-eventloop.rst:1236 +#: ../../library/asyncio-eventloop.rst:1253 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -827,8 +827,8 @@ msgstr "" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" #: ../../library/asyncio-eventloop.rst:507 -#: ../../library/asyncio-eventloop.rst:623 -#: ../../library/asyncio-eventloop.rst:871 +#: ../../library/asyncio-eventloop.rst:629 +#: ../../library/asyncio-eventloop.rst:877 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." @@ -848,7 +848,7 @@ msgstr "" "式類似於 *host* 和 *port*。" #: ../../library/asyncio-eventloop.rst:515 -#: ../../library/asyncio-eventloop.rst:967 +#: ../../library/asyncio-eventloop.rst:973 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. " @@ -859,9 +859,9 @@ msgstr "" "秒。" #: ../../library/asyncio-eventloop.rst:519 -#: ../../library/asyncio-eventloop.rst:778 -#: ../../library/asyncio-eventloop.rst:882 -#: ../../library/asyncio-eventloop.rst:971 +#: ../../library/asyncio-eventloop.rst:784 +#: ../../library/asyncio-eventloop.rst:888 +#: ../../library/asyncio-eventloop.rst:977 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`` " @@ -885,7 +885,7 @@ msgstr "" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" #: ../../library/asyncio-eventloop.rst:533 -#: ../../library/asyncio-eventloop.rst:790 +#: ../../library/asyncio-eventloop.rst:796 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" @@ -898,7 +898,7 @@ msgstr "" "socket 選項。" #: ../../library/asyncio-eventloop.rst:542 -#: ../../library/asyncio-eventloop.rst:892 +#: ../../library/asyncio-eventloop.rst:898 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" @@ -927,11 +927,11 @@ msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" #: ../../library/asyncio-eventloop.rst:561 -#: ../../library/asyncio-eventloop.rst:687 -#: ../../library/asyncio-eventloop.rst:804 -#: ../../library/asyncio-eventloop.rst:844 -#: ../../library/asyncio-eventloop.rst:896 -#: ../../library/asyncio-eventloop.rst:979 +#: ../../library/asyncio-eventloop.rst:693 +#: ../../library/asyncio-eventloop.rst:810 +#: ../../library/asyncio-eventloop.rst:850 +#: ../../library/asyncio-eventloop.rst:902 +#: ../../library/asyncio-eventloop.rst:985 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" @@ -967,8 +967,8 @@ msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" #: ../../library/asyncio-eventloop.rst:587 -#: ../../library/asyncio-eventloop.rst:714 -#: ../../library/asyncio-eventloop.rst:863 +#: ../../library/asyncio-eventloop.rst:720 +#: ../../library/asyncio-eventloop.rst:869 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -977,7 +977,7 @@ msgstr "" "protocol>` 實作。" #: ../../library/asyncio-eventloop.rst:590 -#: ../../library/asyncio-eventloop.rst:669 +#: ../../library/asyncio-eventloop.rst:675 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" @@ -990,7 +990,13 @@ msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:598 +#: ../../library/asyncio-eventloop.rst:600 +msgid "" +"On Windows, when using the proactor event loop with ``local_addr=None``, an :" +"exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised when running it." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:604 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* " @@ -1000,7 +1006,7 @@ msgstr "" "socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" "`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:602 +#: ../../library/asyncio-eventloop.rst:608 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -1011,7 +1017,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:607 +#: ../../library/asyncio-eventloop.rst:613 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 " @@ -1023,13 +1029,13 @@ msgstr "" "時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" "const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:613 +#: ../../library/asyncio-eventloop.rst:619 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:616 +#: ../../library/asyncio-eventloop.rst:622 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 " @@ -1040,7 +1046,7 @@ msgstr "" "供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" "`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:627 +#: ../../library/asyncio-eventloop.rst:633 msgid "" "See :ref:`UDP echo client protocol ` and :" "ref:`UDP echo server protocol ` examples." @@ -1048,7 +1054,7 @@ msgstr "" "請參閱 :ref:`UDP 回應用戶端協定 ` 和 :ref:" "`UDP 回應伺服器協定 ` 範例。" -#: ../../library/asyncio-eventloop.rst:630 +#: ../../library/asyncio-eventloop.rst:636 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1056,11 +1062,11 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:634 +#: ../../library/asyncio-eventloop.rst:640 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:637 +#: ../../library/asyncio-eventloop.rst:643 msgid "" "The *reuse_address* parameter is no longer supported, as using :ref:`socket." "SO_REUSEADDR ` poses a significant security concern " @@ -1069,7 +1075,7 @@ msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:643 +#: ../../library/asyncio-eventloop.rst:649 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1078,7 +1084,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:647 +#: ../../library/asyncio-eventloop.rst:653 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is set by default " @@ -1304,7 +1310,7 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" "ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:808 +#: ../../library/asyncio-eventloop.rst:814 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " @@ -1313,7 +1319,7 @@ msgstr "" ":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" "`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:820 +#: ../../library/asyncio-eventloop.rst:826 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." @@ -1321,7 +1327,7 @@ msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:823 +#: ../../library/asyncio-eventloop.rst:829 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`, " @@ -1331,7 +1337,7 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:828 +#: ../../library/asyncio-eventloop.rst:834 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " @@ -1340,13 +1346,13 @@ msgstr "" "如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" "除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:832 +#: ../../library/asyncio-eventloop.rst:838 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:839 +#: ../../library/asyncio-eventloop.rst:845 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1354,26 +1360,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:848 +#: ../../library/asyncio-eventloop.rst:854 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:856 +#: ../../library/asyncio-eventloop.rst:862 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協定對。" -#: ../../library/asyncio-eventloop.rst:858 +#: ../../library/asyncio-eventloop.rst:864 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:861 -#: ../../library/asyncio-eventloop.rst:953 +#: ../../library/asyncio-eventloop.rst:867 +#: ../../library/asyncio-eventloop.rst:959 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:866 +#: ../../library/asyncio-eventloop.rst:872 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1381,13 +1387,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:875 +#: ../../library/asyncio-eventloop.rst:881 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:884 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. " @@ -1396,29 +1402,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:886 +#: ../../library/asyncio-eventloop.rst:892 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:900 +#: ../../library/asyncio-eventloop.rst:906 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:906 +#: ../../library/asyncio-eventloop.rst:912 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:909 +#: ../../library/asyncio-eventloop.rst:915 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:911 +#: ../../library/asyncio-eventloop.rst:917 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:913 -#: ../../library/asyncio-eventloop.rst:1174 +#: ../../library/asyncio-eventloop.rst:919 +#: ../../library/asyncio-eventloop.rst:1180 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 " @@ -1430,7 +1436,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:920 +#: ../../library/asyncio-eventloop.rst:926 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 " @@ -1439,7 +1445,7 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:924 +#: ../../library/asyncio-eventloop.rst:930 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." @@ -1447,15 +1453,15 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:931 +#: ../../library/asyncio-eventloop.rst:937 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:939 +#: ../../library/asyncio-eventloop.rst:945 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:941 +#: ../../library/asyncio-eventloop.rst:947 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1464,7 +1470,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協定,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:945 +#: ../../library/asyncio-eventloop.rst:951 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1475,13 +1481,13 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:950 +#: ../../library/asyncio-eventloop.rst:956 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:955 +#: ../../library/asyncio-eventloop.rst:961 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." @@ -1489,11 +1495,11 @@ msgstr "" "*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" "`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:959 +#: ../../library/asyncio-eventloop.rst:965 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:961 +#: ../../library/asyncio-eventloop.rst:967 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1501,17 +1507,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:964 +#: ../../library/asyncio-eventloop.rst:970 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:984 +#: ../../library/asyncio-eventloop.rst:990 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:988 +#: ../../library/asyncio-eventloop.rst:994 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1519,14 +1525,14 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:992 -#: ../../library/asyncio-eventloop.rst:1006 +#: ../../library/asyncio-eventloop.rst:998 +#: ../../library/asyncio-eventloop.rst:1012 msgid "" "Any preexisting callback registered for *fd* is cancelled and replaced by " "*callback*." msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" -#: ../../library/asyncio-eventloop.rst:997 +#: ../../library/asyncio-eventloop.rst:1003 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1534,7 +1540,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:1002 +#: ../../library/asyncio-eventloop.rst:1008 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1542,8 +1548,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:1009 -#: ../../library/asyncio-eventloop.rst:1287 +#: ../../library/asyncio-eventloop.rst:1015 +#: ../../library/asyncio-eventloop.rst:1293 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1551,7 +1557,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:1014 +#: ../../library/asyncio-eventloop.rst:1020 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1559,7 +1565,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:1017 +#: ../../library/asyncio-eventloop.rst:1023 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1567,11 +1573,11 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:1022 +#: ../../library/asyncio-eventloop.rst:1028 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:1024 +#: ../../library/asyncio-eventloop.rst:1030 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1580,10 +1586,10 @@ msgid "" "socket` objects directly is more convenient." msgstr "" "一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` 和 :meth:" -"`loop.create_server`)的協定實作比直接使用 socket 的實作更快。然而在某些情" -"況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" +"`loop.create_server`)的協定實作比直接使用 socket 的實作更快。然而在某些情況" +"下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:1034 +#: ../../library/asyncio-eventloop.rst:1040 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." @@ -1591,23 +1597,23 @@ msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:1037 +#: ../../library/asyncio-eventloop.rst:1043 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1039 -#: ../../library/asyncio-eventloop.rst:1054 -#: ../../library/asyncio-eventloop.rst:1066 -#: ../../library/asyncio-eventloop.rst:1079 -#: ../../library/asyncio-eventloop.rst:1095 -#: ../../library/asyncio-eventloop.rst:1111 -#: ../../library/asyncio-eventloop.rst:1122 -#: ../../library/asyncio-eventloop.rst:1149 -#: ../../library/asyncio-eventloop.rst:1188 +#: ../../library/asyncio-eventloop.rst:1045 +#: ../../library/asyncio-eventloop.rst:1060 +#: ../../library/asyncio-eventloop.rst:1072 +#: ../../library/asyncio-eventloop.rst:1085 +#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:1117 +#: ../../library/asyncio-eventloop.rst:1128 +#: ../../library/asyncio-eventloop.rst:1155 +#: ../../library/asyncio-eventloop.rst:1194 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1041 +#: ../../library/asyncio-eventloop.rst:1047 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 " @@ -1616,7 +1622,7 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1049 +#: ../../library/asyncio-eventloop.rst:1055 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." @@ -1624,11 +1630,11 @@ msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:1052 +#: ../../library/asyncio-eventloop.rst:1058 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1061 +#: ../../library/asyncio-eventloop.rst:1067 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." @@ -1636,11 +1642,11 @@ msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1064 +#: ../../library/asyncio-eventloop.rst:1070 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1073 +#: ../../library/asyncio-eventloop.rst:1079 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." @@ -1648,11 +1654,11 @@ msgstr "" "從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." "recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1077 +#: ../../library/asyncio-eventloop.rst:1083 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1086 +#: ../../library/asyncio-eventloop.rst:1092 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." @@ -1660,7 +1666,7 @@ msgstr "" "將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1089 +#: ../../library/asyncio-eventloop.rst:1095 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 " @@ -1672,8 +1678,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1097 -#: ../../library/asyncio-eventloop.rst:1151 +#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1157 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 " @@ -1682,7 +1688,7 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1105 +#: ../../library/asyncio-eventloop.rst:1111 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." @@ -1690,20 +1696,20 @@ msgstr "" "從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1109 +#: ../../library/asyncio-eventloop.rst:1115 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1118 +#: ../../library/asyncio-eventloop.rst:1124 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1120 +#: ../../library/asyncio-eventloop.rst:1126 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1124 +#: ../../library/asyncio-eventloop.rst:1130 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1714,7 +1720,7 @@ msgstr "" "inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." "getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1133 +#: ../../library/asyncio-eventloop.rst:1139 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1722,7 +1728,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1140 +#: ../../library/asyncio-eventloop.rst:1146 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1730,7 +1736,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1143 +#: ../../library/asyncio-eventloop.rst:1149 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 " @@ -1741,34 +1747,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1158 +#: ../../library/asyncio-eventloop.rst:1164 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1164 +#: ../../library/asyncio-eventloop.rst:1170 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1167 +#: ../../library/asyncio-eventloop.rst:1173 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1169 +#: ../../library/asyncio-eventloop.rst:1175 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1172 +#: ../../library/asyncio-eventloop.rst:1178 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1181 +#: ../../library/asyncio-eventloop.rst:1187 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 " @@ -1777,7 +1783,7 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1185 +#: ../../library/asyncio-eventloop.rst:1191 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." @@ -1785,19 +1791,19 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1200 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1200 +#: ../../library/asyncio-eventloop.rst:1206 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1205 +#: ../../library/asyncio-eventloop.rst:1211 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1208 +#: ../../library/asyncio-eventloop.rst:1214 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1807,7 +1813,7 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1215 +#: ../../library/asyncio-eventloop.rst:1221 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1818,19 +1824,19 @@ msgstr "" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1223 +#: ../../library/asyncio-eventloop.rst:1229 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1228 +#: ../../library/asyncio-eventloop.rst:1234 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:1239 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1235 +#: ../../library/asyncio-eventloop.rst:1241 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " @@ -1839,22 +1845,22 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1239 -#: ../../library/asyncio-eventloop.rst:1256 +#: ../../library/asyncio-eventloop.rst:1245 +#: ../../library/asyncio-eventloop.rst:1262 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1245 +#: ../../library/asyncio-eventloop.rst:1251 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1250 +#: ../../library/asyncio-eventloop.rst:1256 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1252 +#: ../../library/asyncio-eventloop.rst:1258 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " @@ -1863,7 +1869,7 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1261 +#: ../../library/asyncio-eventloop.rst:1267 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." @@ -1871,20 +1877,20 @@ msgstr "" ":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" "class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1266 +#: ../../library/asyncio-eventloop.rst:1272 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1271 +#: ../../library/asyncio-eventloop.rst:1277 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1277 +#: ../../library/asyncio-eventloop.rst:1283 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1279 +#: ../../library/asyncio-eventloop.rst:1285 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1895,7 +1901,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1284 +#: ../../library/asyncio-eventloop.rst:1290 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1903,16 +1909,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1290 +#: ../../library/asyncio-eventloop.rst:1296 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中叫用。" -#: ../../library/asyncio-eventloop.rst:1295 +#: ../../library/asyncio-eventloop.rst:1301 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1297 +#: ../../library/asyncio-eventloop.rst:1303 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1920,19 +1926,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1304 +#: ../../library/asyncio-eventloop.rst:1310 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1308 +#: ../../library/asyncio-eventloop.rst:1314 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1312 +#: ../../library/asyncio-eventloop.rst:1318 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1314 +#: ../../library/asyncio-eventloop.rst:1320 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1941,7 +1947,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1322 +#: ../../library/asyncio-eventloop.rst:1328 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1984,7 +1990,7 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1362 +#: ../../library/asyncio-eventloop.rst:1368 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1996,11 +2002,11 @@ msgstr "" "== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1367 +#: ../../library/asyncio-eventloop.rst:1373 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1369 +#: ../../library/asyncio-eventloop.rst:1375 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -2008,7 +2014,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1372 +#: ../../library/asyncio-eventloop.rst:1378 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 " @@ -2019,7 +2025,7 @@ msgstr "" "``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." "ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1381 +#: ../../library/asyncio-eventloop.rst:1387 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." @@ -2028,26 +2034,26 @@ msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1391 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1391 +#: ../../library/asyncio-eventloop.rst:1397 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1393 +#: ../../library/asyncio-eventloop.rst:1399 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1397 +#: ../../library/asyncio-eventloop.rst:1403 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1405 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2060,7 +2066,7 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1407 +#: ../../library/asyncio-eventloop.rst:1413 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " @@ -2069,7 +2075,7 @@ msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1413 +#: ../../library/asyncio-eventloop.rst:1419 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2077,18 +2083,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1418 +#: ../../library/asyncio-eventloop.rst:1424 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳目前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1431 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1427 +#: ../../library/asyncio-eventloop.rst:1433 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 " @@ -2097,17 +2103,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1431 +#: ../../library/asyncio-eventloop.rst:1437 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1436 +#: ../../library/asyncio-eventloop.rst:1442 msgid "Call the current event loop exception handler." msgstr "呼叫目前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1438 +#: ../../library/asyncio-eventloop.rst:1444 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2115,55 +2121,55 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1441 +#: ../../library/asyncio-eventloop.rst:1447 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1442 +#: ../../library/asyncio-eventloop.rst:1448 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1443 +#: ../../library/asyncio-eventloop.rst:1449 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1444 +#: ../../library/asyncio-eventloop.rst:1450 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1445 +#: ../../library/asyncio-eventloop.rst:1451 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1446 +#: ../../library/asyncio-eventloop.rst:1452 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1447 +#: ../../library/asyncio-eventloop.rst:1453 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1448 +#: ../../library/asyncio-eventloop.rst:1454 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1449 +#: ../../library/asyncio-eventloop.rst:1455 msgid "'source_traceback' (optional): Traceback of the source;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1456 msgid "'handle_traceback' (optional): Traceback of the handle;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1451 +#: ../../library/asyncio-eventloop.rst:1457 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1452 +#: ../../library/asyncio-eventloop.rst:1458 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1456 +#: ../../library/asyncio-eventloop.rst:1462 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." @@ -2171,15 +2177,15 @@ msgstr "" "此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" "`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1461 +#: ../../library/asyncio-eventloop.rst:1467 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1465 +#: ../../library/asyncio-eventloop.rst:1471 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1473 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." @@ -2187,17 +2193,17 @@ msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1473 +#: ../../library/asyncio-eventloop.rst:1479 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1477 +#: ../../library/asyncio-eventloop.rst:1483 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1482 +#: ../../library/asyncio-eventloop.rst:1488 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " @@ -2206,19 +2212,19 @@ msgstr "" "此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" "後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1486 +#: ../../library/asyncio-eventloop.rst:1492 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1490 +#: ../../library/asyncio-eventloop.rst:1496 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1494 +#: ../../library/asyncio-eventloop.rst:1500 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1496 +#: ../../library/asyncio-eventloop.rst:1502 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " @@ -2228,7 +2234,7 @@ msgstr "" "func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." "create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1503 +#: ../../library/asyncio-eventloop.rst:1509 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" @@ -2238,26 +2244,26 @@ msgstr "" "`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " "`。" -#: ../../library/asyncio-eventloop.rst:1515 +#: ../../library/asyncio-eventloop.rst:1521 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1524 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1520 +#: ../../library/asyncio-eventloop.rst:1526 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1521 +#: ../../library/asyncio-eventloop.rst:1527 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1524 +#: ../../library/asyncio-eventloop.rst:1530 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2266,7 +2272,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1528 +#: ../../library/asyncio-eventloop.rst:1534 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 " @@ -2277,7 +2283,7 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1534 +#: ../../library/asyncio-eventloop.rst:1540 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." @@ -2285,67 +2291,67 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1537 +#: ../../library/asyncio-eventloop.rst:1543 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1539 +#: ../../library/asyncio-eventloop.rst:1545 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1541 -#: ../../library/asyncio-eventloop.rst:1552 -#: ../../library/asyncio-eventloop.rst:1562 +#: ../../library/asyncio-eventloop.rst:1547 +#: ../../library/asyncio-eventloop.rst:1558 +#: ../../library/asyncio-eventloop.rst:1568 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1542 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1543 -#: ../../library/asyncio-eventloop.rst:1553 -#: ../../library/asyncio-eventloop.rst:1563 +#: ../../library/asyncio-eventloop.rst:1549 +#: ../../library/asyncio-eventloop.rst:1559 +#: ../../library/asyncio-eventloop.rst:1569 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1545 -#: ../../library/asyncio-eventloop.rst:1555 -#: ../../library/asyncio-eventloop.rst:1565 +#: ../../library/asyncio-eventloop.rst:1551 +#: ../../library/asyncio-eventloop.rst:1561 +#: ../../library/asyncio-eventloop.rst:1571 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1547 -#: ../../library/asyncio-eventloop.rst:1557 -#: ../../library/asyncio-eventloop.rst:1567 +#: ../../library/asyncio-eventloop.rst:1553 +#: ../../library/asyncio-eventloop.rst:1563 +#: ../../library/asyncio-eventloop.rst:1573 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1550 +#: ../../library/asyncio-eventloop.rst:1556 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1560 +#: ../../library/asyncio-eventloop.rst:1566 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1569 +#: ../../library/asyncio-eventloop.rst:1575 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1572 +#: ../../library/asyncio-eventloop.rst:1578 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2355,7 +2361,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1577 +#: ../../library/asyncio-eventloop.rst:1583 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 " @@ -2364,7 +2370,7 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1581 +#: ../../library/asyncio-eventloop.rst:1587 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" @@ -2375,13 +2381,13 @@ msgstr "" "端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." "connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1586 +#: ../../library/asyncio-eventloop.rst:1592 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1589 +#: ../../library/asyncio-eventloop.rst:1595 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " @@ -2391,7 +2397,7 @@ msgstr "" "SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" "件。" -#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1604 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1603 +#: ../../library/asyncio-eventloop.rst:1609 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2408,7 +2414,7 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1606 +#: ../../library/asyncio-eventloop.rst:1612 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." @@ -2416,13 +2422,13 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1609 +#: ../../library/asyncio-eventloop.rst:1615 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1612 +#: ../../library/asyncio-eventloop.rst:1618 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " @@ -2432,7 +2438,7 @@ msgstr "" "`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" "的物件。" -#: ../../library/asyncio-eventloop.rst:1617 +#: ../../library/asyncio-eventloop.rst:1623 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2445,11 +2451,11 @@ msgstr "" "wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使用 :func:" "`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1626 +#: ../../library/asyncio-eventloop.rst:1632 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1630 +#: ../../library/asyncio-eventloop.rst:1636 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." @@ -2457,46 +2463,46 @@ msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1635 +#: ../../library/asyncio-eventloop.rst:1641 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1642 +#: ../../library/asyncio-eventloop.rst:1648 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1647 +#: ../../library/asyncio-eventloop.rst:1653 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1653 +#: ../../library/asyncio-eventloop.rst:1659 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1656 +#: ../../library/asyncio-eventloop.rst:1662 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1660 +#: ../../library/asyncio-eventloop.rst:1666 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1662 +#: ../../library/asyncio-eventloop.rst:1668 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1669 +#: ../../library/asyncio-eventloop.rst:1675 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1671 +#: ../../library/asyncio-eventloop.rst:1677 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " @@ -2506,11 +2512,11 @@ msgstr "" "create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" "建立。" -#: ../../library/asyncio-eventloop.rst:1675 +#: ../../library/asyncio-eventloop.rst:1681 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1679 +#: ../../library/asyncio-eventloop.rst:1685 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 " @@ -2519,7 +2525,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1684 +#: ../../library/asyncio-eventloop.rst:1690 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2535,30 +2541,30 @@ msgstr "" "\n" "# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1692 +#: ../../library/asyncio-eventloop.rst:1698 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1695 +#: ../../library/asyncio-eventloop.rst:1701 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1700 +#: ../../library/asyncio-eventloop.rst:1706 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1703 +#: ../../library/asyncio-eventloop.rst:1709 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1706 +#: ../../library/asyncio-eventloop.rst:1712 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2566,53 +2572,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1712 +#: ../../library/asyncio-eventloop.rst:1718 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入用戶端連線。" -#: ../../library/asyncio-eventloop.rst:1714 +#: ../../library/asyncio-eventloop.rst:1720 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1717 +#: ../../library/asyncio-eventloop.rst:1723 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1724 +#: ../../library/asyncio-eventloop.rst:1730 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." msgstr "立即關閉所有現有的傳入用戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1727 +#: ../../library/asyncio-eventloop.rst:1733 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1736 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1737 +#: ../../library/asyncio-eventloop.rst:1743 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1744 +#: ../../library/asyncio-eventloop.rst:1750 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1746 +#: ../../library/asyncio-eventloop.rst:1752 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1749 +#: ../../library/asyncio-eventloop.rst:1755 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 " @@ -2625,14 +2631,14 @@ msgstr "" "種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." "serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1761 +#: ../../library/asyncio-eventloop.rst:1767 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1765 +#: ../../library/asyncio-eventloop.rst:1771 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2640,7 +2646,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1771 +#: ../../library/asyncio-eventloop.rst:1777 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2666,24 +2672,24 @@ msgstr "" "\n" "asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1787 +#: ../../library/asyncio-eventloop.rst:1793 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1794 +#: ../../library/asyncio-eventloop.rst:1800 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1799 +#: ../../library/asyncio-eventloop.rst:1805 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1802 +#: ../../library/asyncio-eventloop.rst:1808 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." @@ -2691,11 +2697,11 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1812 +#: ../../library/asyncio-eventloop.rst:1818 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1814 +#: ../../library/asyncio-eventloop.rst:1820 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." @@ -2703,17 +2709,17 @@ msgstr "" "asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" "`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1817 +#: ../../library/asyncio-eventloop.rst:1823 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1822 +#: ../../library/asyncio-eventloop.rst:1828 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1825 +#: ../../library/asyncio-eventloop.rst:1831 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2722,7 +2728,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1829 +#: ../../library/asyncio-eventloop.rst:1835 msgid "" "import asyncio\n" "import selectors\n" @@ -2744,7 +2750,7 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1845 +#: ../../library/asyncio-eventloop.rst:1851 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2752,7 +2758,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1851 +#: ../../library/asyncio-eventloop.rst:1857 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2760,13 +2766,13 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1856 +#: ../../library/asyncio-eventloop.rst:1862 msgid "" "An alias to the most efficient available subclass of :class:" "`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1859 +#: ../../library/asyncio-eventloop.rst:1865 msgid "" "It is an alias to :class:`SelectorEventLoop` on Unix and :class:" "`ProactorEventLoop` on Windows." @@ -2774,11 +2780,11 @@ msgstr "" "在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" "`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1865 +#: ../../library/asyncio-eventloop.rst:1871 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1867 +#: ../../library/asyncio-eventloop.rst:1873 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2786,11 +2792,11 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1873 +#: ../../library/asyncio-eventloop.rst:1879 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1875 +#: ../../library/asyncio-eventloop.rst:1881 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." @@ -2801,11 +2807,11 @@ msgstr "" "`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" "種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1885 +#: ../../library/asyncio-eventloop.rst:1891 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1887 +#: ../../library/asyncio-eventloop.rst:1893 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::" @@ -2813,7 +2819,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1891 +#: ../../library/asyncio-eventloop.rst:1897 msgid "" "import asyncio\n" "\n" @@ -2851,18 +2857,18 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1911 +#: ../../library/asyncio-eventloop.rst:1917 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1918 +#: ../../library/asyncio-eventloop.rst:1924 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1920 +#: ../../library/asyncio-eventloop.rst:1926 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 " @@ -2871,7 +2877,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1924 +#: ../../library/asyncio-eventloop.rst:1930 msgid "" "import asyncio\n" "import datetime\n" @@ -2917,7 +2923,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1948 +#: ../../library/asyncio-eventloop.rst:1954 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2925,11 +2931,11 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1955 +#: ../../library/asyncio-eventloop.rst:1961 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1957 +#: ../../library/asyncio-eventloop.rst:1963 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" @@ -2937,7 +2943,7 @@ msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1960 +#: ../../library/asyncio-eventloop.rst:1966 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -3005,7 +3011,7 @@ msgstr "" " wsock.close()\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1995 +#: ../../library/asyncio-eventloop.rst:2001 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -3013,7 +3019,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1999 +#: ../../library/asyncio-eventloop.rst:2005 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -3021,15 +3027,15 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:2007 +#: ../../library/asyncio-eventloop.rst:2013 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:2009 +#: ../../library/asyncio-eventloop.rst:2015 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:2011 +#: ../../library/asyncio-eventloop.rst:2017 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" @@ -3037,7 +3043,7 @@ msgstr "" "使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" "data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:2014 +#: ../../library/asyncio-eventloop.rst:2020 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 9c7cbb4de5..c1a61a818f 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-28 00:20+0000\n" +"POT-Creation-Date: 2025-07-28 17:30+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-" @@ -206,11 +206,11 @@ msgid "" "start a process. These *start methods* are" msgstr "" -#: ../../library/multiprocessing.rst:114 +#: ../../library/multiprocessing.rst:116 msgid "*spawn*" msgstr "*spawn*" -#: ../../library/multiprocessing.rst:115 +#: ../../library/multiprocessing.rst:117 msgid "" "The parent process starts a fresh Python interpreter process. The child " "process will only inherit those resources necessary to run the process " @@ -220,16 +220,16 @@ msgid "" "or *forkserver*." msgstr "" -#: ../../library/multiprocessing.rst:122 +#: ../../library/multiprocessing.rst:124 msgid "" "Available on POSIX and Windows platforms. The default on Windows and macOS." msgstr "" -#: ../../library/multiprocessing.rst:124 +#: ../../library/multiprocessing.rst:128 msgid "*fork*" msgstr "*fork*" -#: ../../library/multiprocessing.rst:125 +#: ../../library/multiprocessing.rst:129 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 " @@ -237,19 +237,19 @@ msgid "" "Note that safely forking a multithreaded process is problematic." msgstr "" -#: ../../library/multiprocessing.rst:131 +#: ../../library/multiprocessing.rst:135 msgid "" "Available on POSIX systems. Currently the default on POSIX except macOS." msgstr "" -#: ../../library/multiprocessing.rst:134 +#: ../../library/multiprocessing.rst:138 msgid "" "The default start method will change away from *fork* in Python 3.14. Code " "that requires *fork* should explicitly specify that via :func:`get_context` " "or :func:`set_start_method`." msgstr "" -#: ../../library/multiprocessing.rst:138 +#: ../../library/multiprocessing.rst:142 msgid "" "If Python is able to detect that your process has multiple threads, the :" "func:`os.fork` function that this start method calls internally will raise " @@ -257,11 +257,11 @@ msgid "" "fork` documentation for further explanation." msgstr "" -#: ../../library/multiprocessing.rst:144 +#: ../../library/multiprocessing.rst:150 msgid "*forkserver*" msgstr "*forkserver*" -#: ../../library/multiprocessing.rst:145 +#: ../../library/multiprocessing.rst:151 msgid "" "When the program starts and selects the *forkserver* start method, a server " "process is spawned. From then on, whenever a new process is needed, the " @@ -271,27 +271,27 @@ msgid "" "for it to use :func:`os.fork`. No unnecessary resources are inherited." msgstr "" -#: ../../library/multiprocessing.rst:153 +#: ../../library/multiprocessing.rst:159 msgid "" "Available on POSIX platforms which support passing file descriptors over " "Unix pipes such as Linux." msgstr "" -#: ../../library/multiprocessing.rst:157 +#: ../../library/multiprocessing.rst:163 msgid "" "*spawn* added on all POSIX platforms, and *forkserver* added for some POSIX " "platforms. Child processes no longer inherit all of the parents inheritable " "handles on Windows." msgstr "" -#: ../../library/multiprocessing.rst:165 +#: ../../library/multiprocessing.rst:171 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 as macOS system libraries may start threads. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:169 +#: ../../library/multiprocessing.rst:175 msgid "" "On POSIX using the *spawn* or *forkserver* start methods will also start a " "*resource tracker* process which tracks the unlinked named system resources " @@ -306,13 +306,13 @@ msgid "" "space in the main memory.)" msgstr "" -#: ../../library/multiprocessing.rst:182 +#: ../../library/multiprocessing.rst:188 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:186 +#: ../../library/multiprocessing.rst:192 msgid "" "import multiprocessing as mp\n" "\n" @@ -340,19 +340,19 @@ msgstr "" " print(q.get())\n" " p.join()" -#: ../../library/multiprocessing.rst:199 +#: ../../library/multiprocessing.rst:205 msgid "" ":func:`set_start_method` should not be used more than once in the program." msgstr "" -#: ../../library/multiprocessing.rst:202 +#: ../../library/multiprocessing.rst:208 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:207 +#: ../../library/multiprocessing.rst:213 msgid "" "import multiprocessing as mp\n" "\n" @@ -380,7 +380,7 @@ msgstr "" " print(q.get())\n" " p.join()" -#: ../../library/multiprocessing.rst:220 +#: ../../library/multiprocessing.rst:226 msgid "" "Note that objects related to one context may not be compatible with " "processes for a different context. In particular, locks created using the " @@ -388,7 +388,7 @@ msgid "" "*forkserver* start methods." msgstr "" -#: ../../library/multiprocessing.rst:225 +#: ../../library/multiprocessing.rst:231 msgid "" "Libraries using :mod:`multiprocessing` or :class:`~concurrent.futures." "ProcessPoolExecutor` should be designed to allow their users to provide " @@ -398,7 +398,7 @@ msgid "" "start method." msgstr "" -#: ../../library/multiprocessing.rst:234 +#: ../../library/multiprocessing.rst:240 msgid "" "The ``'spawn'`` and ``'forkserver'`` start methods generally cannot be used " "with \"frozen\" executables (i.e., binaries produced by packages like " @@ -406,27 +406,27 @@ msgid "" "method may work if code does not use threads." msgstr "" -#: ../../library/multiprocessing.rst:241 +#: ../../library/multiprocessing.rst:247 msgid "Exchanging objects between processes" msgstr "" -#: ../../library/multiprocessing.rst:243 +#: ../../library/multiprocessing.rst:249 msgid "" ":mod:`multiprocessing` supports two types of communication channel between " "processes:" msgstr "" -#: ../../library/multiprocessing.rst:246 +#: ../../library/multiprocessing.rst:252 msgid "**Queues**" msgstr "" -#: ../../library/multiprocessing.rst:248 +#: ../../library/multiprocessing.rst:254 msgid "" "The :class:`Queue` class is a near clone of :class:`queue.Queue`. For " "example::" msgstr "" -#: ../../library/multiprocessing.rst:251 +#: ../../library/multiprocessing.rst:257 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -452,23 +452,23 @@ msgstr "" " print(q.get()) # 印出 \"[42, None, 'hello']\"\n" " p.join()" -#: ../../library/multiprocessing.rst:263 +#: ../../library/multiprocessing.rst:269 msgid "" "Queues are thread and process safe. Any object put into a :mod:" "`~multiprocessing` queue will be serialized." msgstr "" -#: ../../library/multiprocessing.rst:266 +#: ../../library/multiprocessing.rst:272 msgid "**Pipes**" msgstr "" -#: ../../library/multiprocessing.rst:268 +#: ../../library/multiprocessing.rst:274 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:271 +#: ../../library/multiprocessing.rst:277 msgid "" "from multiprocessing import Process, Pipe\n" "\n" @@ -496,7 +496,7 @@ msgstr "" " print(parent_conn.recv()) # 印出 \"[42, None, 'hello']\"\n" " p.join()" -#: ../../library/multiprocessing.rst:284 +#: ../../library/multiprocessing.rst:290 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:" @@ -506,24 +506,24 @@ msgid "" "corruption from processes using different ends of the pipe at the same time." msgstr "" -#: ../../library/multiprocessing.rst:292 +#: ../../library/multiprocessing.rst:298 msgid "" "The :meth:`~Connection.send` method serializes the object and :meth:" "`~Connection.recv` re-creates the object." msgstr "" -#: ../../library/multiprocessing.rst:296 +#: ../../library/multiprocessing.rst:302 msgid "Synchronization between processes" msgstr "" -#: ../../library/multiprocessing.rst:298 +#: ../../library/multiprocessing.rst:304 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:302 +#: ../../library/multiprocessing.rst:308 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -555,40 +555,40 @@ msgstr "" " for num in range(10):\n" " Process(target=f, args=(lock, num)).start()" -#: ../../library/multiprocessing.rst:317 +#: ../../library/multiprocessing.rst:323 msgid "" "Without using the lock output from the different processes is liable to get " "all mixed up." msgstr "" -#: ../../library/multiprocessing.rst:322 +#: ../../library/multiprocessing.rst:328 msgid "Sharing state between processes" msgstr "" -#: ../../library/multiprocessing.rst:324 +#: ../../library/multiprocessing.rst:330 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:328 +#: ../../library/multiprocessing.rst:334 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:331 +#: ../../library/multiprocessing.rst:337 msgid "**Shared memory**" msgstr "" -#: ../../library/multiprocessing.rst:333 +#: ../../library/multiprocessing.rst:339 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:336 +#: ../../library/multiprocessing.rst:342 msgid "" "from multiprocessing import Process, Value, Array\n" "\n" @@ -626,11 +626,11 @@ msgstr "" " print(num.value)\n" " print(arr[:])" -#: ../../library/multiprocessing.rst:354 ../../library/multiprocessing.rst:400 +#: ../../library/multiprocessing.rst:360 ../../library/multiprocessing.rst:406 msgid "will print ::" msgstr "" -#: ../../library/multiprocessing.rst:356 +#: ../../library/multiprocessing.rst:362 msgid "" "3.1415927\n" "[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]" @@ -638,7 +638,7 @@ msgstr "" "3.1415927\n" "[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]" -#: ../../library/multiprocessing.rst:359 +#: ../../library/multiprocessing.rst:365 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 " @@ -646,25 +646,25 @@ msgid "" "objects will be process and thread-safe." msgstr "" -#: ../../library/multiprocessing.rst:364 +#: ../../library/multiprocessing.rst:370 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:368 +#: ../../library/multiprocessing.rst:374 msgid "**Server process**" msgstr "" -#: ../../library/multiprocessing.rst:370 +#: ../../library/multiprocessing.rst:376 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:374 +#: ../../library/multiprocessing.rst:380 msgid "" "A manager returned by :func:`Manager` will support types :class:`list`, :" "class:`dict`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :" @@ -673,7 +673,7 @@ msgid "" "`Array`. For example, ::" msgstr "" -#: ../../library/multiprocessing.rst:380 +#: ../../library/multiprocessing.rst:386 msgid "" "from multiprocessing import Process, Manager\n" "\n" @@ -715,7 +715,7 @@ msgstr "" " print(d)\n" " print(l)" -#: ../../library/multiprocessing.rst:402 +#: ../../library/multiprocessing.rst:408 msgid "" "{0.25: None, 1: '1', '2': 2}\n" "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" @@ -723,7 +723,7 @@ msgstr "" "{0.25: None, 1: '1', '2': 2}\n" "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" -#: ../../library/multiprocessing.rst:405 +#: ../../library/multiprocessing.rst:411 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 " @@ -731,22 +731,22 @@ msgid "" "They are, however, slower than using shared memory." msgstr "" -#: ../../library/multiprocessing.rst:412 +#: ../../library/multiprocessing.rst:418 msgid "Using a pool of workers" msgstr "" -#: ../../library/multiprocessing.rst:414 +#: ../../library/multiprocessing.rst:420 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:418 +#: ../../library/multiprocessing.rst:424 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/multiprocessing.rst:420 +#: ../../library/multiprocessing.rst:426 msgid "" "from multiprocessing import Pool, TimeoutError\n" "import time\n" @@ -795,13 +795,13 @@ msgid "" " print(\"Now the pool is closed and no longer available\")" msgstr "" -#: ../../library/multiprocessing.rst:462 +#: ../../library/multiprocessing.rst:468 msgid "" "Note that the methods of a pool should only ever be used by the process " "which created it." msgstr "" -#: ../../library/multiprocessing.rst:467 +#: ../../library/multiprocessing.rst:473 msgid "" "Functionality within this package requires that the ``__main__`` module be " "importable by the children. This is covered in :ref:`multiprocessing-" @@ -810,7 +810,7 @@ msgid "" "work in the interactive interpreter. For example::" msgstr "" -#: ../../library/multiprocessing.rst:473 +#: ../../library/multiprocessing.rst:479 msgid "" ">>> from multiprocessing import Pool\n" ">>> p = Pool(5)\n" @@ -852,35 +852,35 @@ msgstr "" "AttributeError: Can't get attribute 'f' on )>" -#: ../../library/multiprocessing.rst:490 +#: ../../library/multiprocessing.rst:496 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:496 +#: ../../library/multiprocessing.rst:502 msgid "Reference" msgstr "" -#: ../../library/multiprocessing.rst:498 +#: ../../library/multiprocessing.rst:504 msgid "" "The :mod:`multiprocessing` package mostly replicates the API of the :mod:" "`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:503 +#: ../../library/multiprocessing.rst:509 msgid ":class:`Process` and exceptions" msgstr ":class:`Process` 與例外" -#: ../../library/multiprocessing.rst:508 +#: ../../library/multiprocessing.rst:514 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:512 +#: ../../library/multiprocessing.rst:518 msgid "" "The constructor should always be called with keyword arguments. *group* " "should always be ``None``; it exists solely for compatibility with :class:" @@ -894,21 +894,21 @@ msgid "" "creating process." msgstr "" -#: ../../library/multiprocessing.rst:523 +#: ../../library/multiprocessing.rst:529 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:527 +#: ../../library/multiprocessing.rst:533 msgid "" "If a subclass overrides the constructor, it must make sure it invokes the " "base class constructor (``super().__init__()``) before doing anything else " "to the process." msgstr "" -#: ../../library/multiprocessing.rst:533 +#: ../../library/multiprocessing.rst:539 msgid "" "In general, all arguments to :class:`Process` must be picklable. This is " "frequently observed when trying to create a :class:`Process` or use a :class:" @@ -916,7 +916,7 @@ msgid "" "*target* function." msgstr "" -#: ../../library/multiprocessing.rst:538 +#: ../../library/multiprocessing.rst:544 msgid "" "Passing a callable object defined in the current REPL session causes the " "child process to die via an uncaught :exc:`AttributeError` exception when " @@ -924,11 +924,11 @@ msgid "" "order to be loaded during unpickling." msgstr "" -#: ../../library/multiprocessing.rst:543 +#: ../../library/multiprocessing.rst:549 msgid "Example of this uncatchable error from the child::" msgstr "" -#: ../../library/multiprocessing.rst:545 +#: ../../library/multiprocessing.rst:551 msgid "" ">>> import multiprocessing as mp\n" ">>> def knigit():\n" @@ -958,7 +958,7 @@ msgstr "" "" -#: ../../library/multiprocessing.rst:558 +#: ../../library/multiprocessing.rst:564 msgid "" "See :ref:`multiprocessing-programming-spawn`. While this restriction is not " "true if using the ``\"fork\"`` start method, as of Python ``3.14`` that is " @@ -966,15 +966,15 @@ msgid "" "methods`. See also :gh:`132898`." msgstr "" -#: ../../library/multiprocessing.rst:564 +#: ../../library/multiprocessing.rst:570 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/multiprocessing.rst:569 +#: ../../library/multiprocessing.rst:575 msgid "Method representing the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:571 +#: ../../library/multiprocessing.rst:577 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 " @@ -982,17 +982,17 @@ msgid "" "*args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/multiprocessing.rst:576 +#: ../../library/multiprocessing.rst:582 msgid "" "Using a list or tuple as the *args* argument passed to :class:`Process` " "achieves the same effect." msgstr "" -#: ../../library/multiprocessing.rst:579 +#: ../../library/multiprocessing.rst:585 msgid "Example::" msgstr "範例: ::" -#: ../../library/multiprocessing.rst:581 +#: ../../library/multiprocessing.rst:587 msgid "" ">>> from multiprocessing import Process\n" ">>> p = Process(target=print, args=[1])\n" @@ -1010,17 +1010,17 @@ msgstr "" ">>> p.run()\n" "1" -#: ../../library/multiprocessing.rst:591 +#: ../../library/multiprocessing.rst:597 msgid "Start the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:593 +#: ../../library/multiprocessing.rst:599 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:598 +#: ../../library/multiprocessing.rst:604 msgid "" "If the optional argument *timeout* is ``None`` (the default), the method " "blocks until the process whose :meth:`join` method is called terminates. If " @@ -1030,23 +1030,23 @@ msgid "" "terminated." msgstr "" -#: ../../library/multiprocessing.rst:605 +#: ../../library/multiprocessing.rst:611 msgid "A process can be joined many times." msgstr "" -#: ../../library/multiprocessing.rst:607 +#: ../../library/multiprocessing.rst:613 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:612 +#: ../../library/multiprocessing.rst:618 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:616 +#: ../../library/multiprocessing.rst:622 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:" @@ -1054,33 +1054,33 @@ msgid "" "child of its parent." msgstr "" -#: ../../library/multiprocessing.rst:623 +#: ../../library/multiprocessing.rst:629 msgid "Return whether the process is alive." msgstr "" -#: ../../library/multiprocessing.rst:625 +#: ../../library/multiprocessing.rst:631 msgid "" "Roughly, a process object is alive from the moment the :meth:`start` method " "returns until the child process terminates." msgstr "" -#: ../../library/multiprocessing.rst:630 +#: ../../library/multiprocessing.rst:636 msgid "" "The process's daemon flag, a Boolean value. This must be set before :meth:" "`start` is called." msgstr "" -#: ../../library/multiprocessing.rst:633 +#: ../../library/multiprocessing.rst:639 msgid "The initial value is inherited from the creating process." msgstr "" -#: ../../library/multiprocessing.rst:635 +#: ../../library/multiprocessing.rst:641 msgid "" "When a process exits, it attempts to terminate all of its daemonic child " "processes." msgstr "" -#: ../../library/multiprocessing.rst:638 +#: ../../library/multiprocessing.rst:644 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 " @@ -1089,92 +1089,92 @@ msgid "" "(and not joined) if non-daemonic processes have exited." msgstr "" -#: ../../library/multiprocessing.rst:644 +#: ../../library/multiprocessing.rst:650 msgid "" "In addition to the :class:`threading.Thread` API, :class:`Process` objects " "also support the following attributes and methods:" msgstr "" -#: ../../library/multiprocessing.rst:649 +#: ../../library/multiprocessing.rst:655 msgid "" "Return the process ID. Before the process is spawned, this will be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:654 +#: ../../library/multiprocessing.rst:660 msgid "" "The child's exit code. This will be ``None`` if the process has not yet " "terminated." msgstr "" -#: ../../library/multiprocessing.rst:657 +#: ../../library/multiprocessing.rst:663 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:661 +#: ../../library/multiprocessing.rst:667 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:667 +#: ../../library/multiprocessing.rst:673 msgid "The process's authentication key (a byte string)." msgstr "" -#: ../../library/multiprocessing.rst:669 +#: ../../library/multiprocessing.rst:675 msgid "" "When :mod:`multiprocessing` is initialized the main process is assigned a " "random string using :func:`os.urandom`." msgstr "" -#: ../../library/multiprocessing.rst:672 +#: ../../library/multiprocessing.rst:678 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:676 +#: ../../library/multiprocessing.rst:682 msgid "See :ref:`multiprocessing-auth-keys`." msgstr "參閱 :ref:`multiprocessing-auth-keys`。" -#: ../../library/multiprocessing.rst:680 +#: ../../library/multiprocessing.rst:686 msgid "" "A numeric handle of a system object which will become \"ready\" when the " "process ends." msgstr "" -#: ../../library/multiprocessing.rst:683 +#: ../../library/multiprocessing.rst:689 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:687 +#: ../../library/multiprocessing.rst:693 msgid "" "On Windows, this is an OS handle usable with the ``WaitForSingleObject`` and " "``WaitForMultipleObjects`` family of API calls. On POSIX, this is a file " "descriptor usable with primitives from the :mod:`select` module." msgstr "" -#: ../../library/multiprocessing.rst:695 +#: ../../library/multiprocessing.rst:701 msgid "" "Terminate the process. On POSIX this is done using the :py:const:`~signal." "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:699 +#: ../../library/multiprocessing.rst:705 msgid "" "Note that descendant processes of the process will *not* be terminated -- " "they will simply become orphaned." msgstr "" -#: ../../library/multiprocessing.rst:704 +#: ../../library/multiprocessing.rst:710 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 " @@ -1183,11 +1183,11 @@ msgid "" "deadlock." msgstr "" -#: ../../library/multiprocessing.rst:712 +#: ../../library/multiprocessing.rst:718 msgid "Same as :meth:`terminate` but using the ``SIGKILL`` signal on POSIX." msgstr "" -#: ../../library/multiprocessing.rst:718 +#: ../../library/multiprocessing.rst:724 msgid "" "Close the :class:`Process` object, releasing all resources associated with " "it. :exc:`ValueError` is raised if the underlying process is still " @@ -1195,18 +1195,18 @@ msgid "" "attributes of the :class:`Process` object will raise :exc:`ValueError`." msgstr "" -#: ../../library/multiprocessing.rst:726 +#: ../../library/multiprocessing.rst:732 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:730 +#: ../../library/multiprocessing.rst:736 msgid "Example usage of some of the methods of :class:`Process`:" msgstr "" -#: ../../library/multiprocessing.rst:732 +#: ../../library/multiprocessing.rst:738 msgid "" ">>> import multiprocessing, time, signal\n" ">>> mp_context = multiprocessing.get_context('spawn')\n" @@ -1238,48 +1238,48 @@ msgstr "" ">>> p.exitcode == -signal.SIGTERM\n" "True" -#: ../../library/multiprocessing.rst:751 +#: ../../library/multiprocessing.rst:757 msgid "The base class of all :mod:`multiprocessing` exceptions." msgstr "" -#: ../../library/multiprocessing.rst:755 +#: ../../library/multiprocessing.rst:761 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:758 +#: ../../library/multiprocessing.rst:764 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:763 +#: ../../library/multiprocessing.rst:769 msgid "Raised when there is an authentication error." msgstr "" -#: ../../library/multiprocessing.rst:767 +#: ../../library/multiprocessing.rst:773 msgid "Raised by methods with a timeout when the timeout expires." msgstr "" -#: ../../library/multiprocessing.rst:770 +#: ../../library/multiprocessing.rst:776 msgid "Pipes and Queues" msgstr "" -#: ../../library/multiprocessing.rst:772 +#: ../../library/multiprocessing.rst:778 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:776 +#: ../../library/multiprocessing.rst:782 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:779 +#: ../../library/multiprocessing.rst:785 msgid "" "The :class:`Queue`, :class:`SimpleQueue` and :class:`JoinableQueue` types " "are multi-producer, multi-consumer :abbr:`FIFO (first-in, first-out)` queues " @@ -1289,7 +1289,7 @@ msgid "" "Queue` class." msgstr "" -#: ../../library/multiprocessing.rst:786 +#: ../../library/multiprocessing.rst:792 msgid "" "If you use :class:`JoinableQueue` then you **must** call :meth:" "`JoinableQueue.task_done` for each task removed from the queue or else the " @@ -1297,7 +1297,7 @@ msgid "" "overflow, raising an exception." msgstr "" -#: ../../library/multiprocessing.rst:791 +#: ../../library/multiprocessing.rst:797 msgid "" "One difference from other Python queue implementations, is that :mod:" "`multiprocessing` queues serializes all objects that are put into them " @@ -1305,20 +1305,20 @@ msgid "" "object that does not share memory with the original object." msgstr "" -#: ../../library/multiprocessing.rst:796 +#: ../../library/multiprocessing.rst:802 msgid "" "Note that one can also create a shared queue by using a manager object -- " "see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:801 +#: ../../library/multiprocessing.rst:807 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:808 +#: ../../library/multiprocessing.rst:814 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 " @@ -1327,14 +1327,14 @@ msgid "" "a queue created with a :ref:`manager `." msgstr "" -#: ../../library/multiprocessing.rst:815 +#: ../../library/multiprocessing.rst:821 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:820 +#: ../../library/multiprocessing.rst:826 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 " @@ -1342,7 +1342,7 @@ msgid "" "other." msgstr "" -#: ../../library/multiprocessing.rst:827 +#: ../../library/multiprocessing.rst:833 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 " @@ -1350,7 +1350,7 @@ msgid "" "exception when it tries to use the queue later on." msgstr "" -#: ../../library/multiprocessing.rst:834 +#: ../../library/multiprocessing.rst:840 msgid "" "As mentioned above, if a child process has put items on a queue (and it has " "not used :meth:`JoinableQueue.cancel_join_thread ` flag or :envvar:`PYTHON_CPU_COUNT` as this is merely a wrapper around " "the :mod:`os` cpu count APIs." msgstr "" -#: ../../library/multiprocessing.rst:1075 +#: ../../library/multiprocessing.rst:1081 msgid "" "Return the :class:`Process` object corresponding to the current process." msgstr "" -#: ../../library/multiprocessing.rst:1077 +#: ../../library/multiprocessing.rst:1083 msgid "An analogue of :func:`threading.current_thread`." msgstr "" -#: ../../library/multiprocessing.rst:1081 +#: ../../library/multiprocessing.rst:1087 msgid "" "Return the :class:`Process` object corresponding to the parent process of " "the :func:`current_process`. For the main process, ``parent_process`` will " "be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1089 +#: ../../library/multiprocessing.rst:1095 msgid "" "Add support for when a program which uses :mod:`multiprocessing` has been " "frozen to produce an executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" -#: ../../library/multiprocessing.rst:1093 +#: ../../library/multiprocessing.rst:1099 msgid "" "One needs to call this function straight after the ``if __name__ == " "'__main__'`` line of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1096 +#: ../../library/multiprocessing.rst:1102 msgid "" "from multiprocessing import Process, freeze_support\n" "\n" @@ -1710,13 +1710,13 @@ msgstr "" " freeze_support()\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:1105 +#: ../../library/multiprocessing.rst:1111 msgid "" "If the ``freeze_support()`` line is omitted then trying to run the frozen " "executable will raise :exc:`RuntimeError`." msgstr "" -#: ../../library/multiprocessing.rst:1108 +#: ../../library/multiprocessing.rst:1114 msgid "" "Calling ``freeze_support()`` has no effect when the start method is not " "*spawn*. In addition, if the module is being run normally by the Python " @@ -1724,7 +1724,7 @@ msgid "" "no effect." msgstr "" -#: ../../library/multiprocessing.rst:1115 +#: ../../library/multiprocessing.rst:1121 msgid "" "Returns a list of the supported start methods, the first of which is the " "default. The possible start methods are ``'fork'``, ``'spawn'`` and " @@ -1732,13 +1732,13 @@ msgid "" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1124 +#: ../../library/multiprocessing.rst:1130 msgid "" "Return a context object which has the same attributes as the :mod:" "`multiprocessing` module." msgstr "" -#: ../../library/multiprocessing.rst:1127 +#: ../../library/multiprocessing.rst:1133 msgid "" "If *method* is ``None`` then the default context is returned. Note that if " "the global start method has not been set, this will set it to the default " @@ -1747,11 +1747,11 @@ msgid "" "is not available. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1138 +#: ../../library/multiprocessing.rst:1144 msgid "Return the name of start method used for starting processes." msgstr "" -#: ../../library/multiprocessing.rst:1140 +#: ../../library/multiprocessing.rst:1146 msgid "" "If the global start method has not been set and *allow_none* is ``False``, " "then the start method is set to the default and the name is returned. If the " @@ -1759,43 +1759,43 @@ msgid "" "returned." msgstr "" -#: ../../library/multiprocessing.rst:1145 +#: ../../library/multiprocessing.rst:1151 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1152 +#: ../../library/multiprocessing.rst:1158 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:1158 +#: ../../library/multiprocessing.rst:1164 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do some thing like ::" msgstr "" -#: ../../library/multiprocessing.rst:1162 +#: ../../library/multiprocessing.rst:1168 msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" msgstr "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" -#: ../../library/multiprocessing.rst:1164 +#: ../../library/multiprocessing.rst:1170 msgid "before they can create child processes." msgstr "" -#: ../../library/multiprocessing.rst:1166 +#: ../../library/multiprocessing.rst:1172 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: ../../library/multiprocessing.rst:1169 +#: ../../library/multiprocessing.rst:1175 msgid "Accepts a :term:`path-like object`." msgstr "接受一個\\ :term:`類路徑物件 `。" -#: ../../library/multiprocessing.rst:1174 +#: ../../library/multiprocessing.rst:1180 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1804,19 +1804,19 @@ msgid "" "process." msgstr "" -#: ../../library/multiprocessing.rst:1180 +#: ../../library/multiprocessing.rst:1186 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: ../../library/multiprocessing.rst:1183 +#: ../../library/multiprocessing.rst:1189 msgid "" "Only meaningful when using the ``'forkserver'`` start method. See :ref:" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1190 +#: ../../library/multiprocessing.rst:1196 msgid "" "Set the method which should be used to start child processes. The *method* " "argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" @@ -1826,17 +1826,17 @@ msgid "" "then the context is set to the default context." msgstr "" -#: ../../library/multiprocessing.rst:1197 +#: ../../library/multiprocessing.rst:1203 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: ../../library/multiprocessing.rst:1201 +#: ../../library/multiprocessing.rst:1207 msgid "See :ref:`multiprocessing-start-methods`." msgstr "參閱 :ref:`multiprocessing-start-methods`。" -#: ../../library/multiprocessing.rst:1207 +#: ../../library/multiprocessing.rst:1213 msgid "" ":mod:`multiprocessing` contains no analogues of :func:`threading." "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" @@ -1844,75 +1844,75 @@ msgid "" "local`." msgstr "" -#: ../../library/multiprocessing.rst:1214 +#: ../../library/multiprocessing.rst:1220 msgid "Connection Objects" msgstr "" -#: ../../library/multiprocessing.rst:1218 +#: ../../library/multiprocessing.rst:1224 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: ../../library/multiprocessing.rst:1221 +#: ../../library/multiprocessing.rst:1227 msgid "" "Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1229 +#: ../../library/multiprocessing.rst:1235 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1232 +#: ../../library/multiprocessing.rst:1238 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:1237 +#: ../../library/multiprocessing.rst:1243 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:1244 +#: ../../library/multiprocessing.rst:1250 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1248 +#: ../../library/multiprocessing.rst:1254 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1250 +#: ../../library/multiprocessing.rst:1256 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1254 +#: ../../library/multiprocessing.rst:1260 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1256 +#: ../../library/multiprocessing.rst:1262 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:1260 +#: ../../library/multiprocessing.rst:1266 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1265 +#: ../../library/multiprocessing.rst:1271 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1267 +#: ../../library/multiprocessing.rst:1273 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 " @@ -1920,7 +1920,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1274 +#: ../../library/multiprocessing.rst:1280 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 :" @@ -1928,19 +1928,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1279 +#: ../../library/multiprocessing.rst:1285 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:1283 +#: ../../library/multiprocessing.rst:1289 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1290 +#: ../../library/multiprocessing.rst:1296 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 " @@ -1948,38 +1948,38 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1296 +#: ../../library/multiprocessing.rst:1302 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:1301 +#: ../../library/multiprocessing.rst:1307 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:1305 +#: ../../library/multiprocessing.rst:1311 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1309 +#: ../../library/multiprocessing.rst:1315 msgid "" "Connection objects also 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:1313 +#: ../../library/multiprocessing.rst:1319 msgid "For example:" msgstr "舉例來說:" -#: ../../library/multiprocessing.rst:1315 +#: ../../library/multiprocessing.rst:1321 msgid "" ">>> from multiprocessing import Pipe\n" ">>> a, b = Pipe()\n" @@ -2015,14 +2015,14 @@ msgstr "" ">>> arr2\n" "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" -#: ../../library/multiprocessing.rst:1338 +#: ../../library/multiprocessing.rst:1344 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:1342 +#: ../../library/multiprocessing.rst:1348 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -2030,73 +2030,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1349 +#: ../../library/multiprocessing.rst:1355 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:1355 +#: ../../library/multiprocessing.rst:1361 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1359 +#: ../../library/multiprocessing.rst:1365 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:1363 +#: ../../library/multiprocessing.rst:1369 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1368 +#: ../../library/multiprocessing.rst:1374 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1374 +#: ../../library/multiprocessing.rst:1380 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1377 -#: ../../library/multiprocessing.rst:1515 +#: ../../library/multiprocessing.rst:1383 +#: ../../library/multiprocessing.rst:1521 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:1381 +#: ../../library/multiprocessing.rst:1387 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1386 +#: ../../library/multiprocessing.rst:1392 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1388 +#: ../../library/multiprocessing.rst:1394 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1391 -#: ../../library/multiprocessing.rst:1929 +#: ../../library/multiprocessing.rst:1397 +#: ../../library/multiprocessing.rst:1935 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1396 +#: ../../library/multiprocessing.rst:1402 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1401 +#: ../../library/multiprocessing.rst:1407 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 " @@ -2107,25 +2107,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1409 +#: ../../library/multiprocessing.rst:1415 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:1413 +#: ../../library/multiprocessing.rst:1419 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1418 -#: ../../library/multiprocessing.rst:1469 +#: ../../library/multiprocessing.rst:1424 +#: ../../library/multiprocessing.rst:1475 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1420 +#: ../../library/multiprocessing.rst:1426 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 " @@ -2133,14 +2133,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1425 +#: ../../library/multiprocessing.rst:1431 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:1429 +#: ../../library/multiprocessing.rst:1435 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 " @@ -2154,19 +2154,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1444 +#: ../../library/multiprocessing.rst:1450 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:1447 +#: ../../library/multiprocessing.rst:1453 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:1453 +#: ../../library/multiprocessing.rst:1459 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. " @@ -2175,20 +2175,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1459 +#: ../../library/multiprocessing.rst:1465 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:1463 +#: ../../library/multiprocessing.rst:1469 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1471 +#: ../../library/multiprocessing.rst:1477 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 " @@ -2201,7 +2201,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1481 +#: ../../library/multiprocessing.rst:1487 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 " @@ -2212,14 +2212,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1489 +#: ../../library/multiprocessing.rst:1495 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:1496 +#: ../../library/multiprocessing.rst:1502 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 " @@ -2229,7 +2229,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1504 +#: ../../library/multiprocessing.rst:1510 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 " @@ -2238,17 +2238,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1513 +#: ../../library/multiprocessing.rst:1519 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1520 +#: ../../library/multiprocessing.rst:1526 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:1525 +#: ../../library/multiprocessing.rst:1531 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -2257,32 +2257,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1533 +#: ../../library/multiprocessing.rst:1539 msgid "Shared :mod:`ctypes` Objects" msgstr "共享的 :mod:`ctypes` 物件" -#: ../../library/multiprocessing.rst:1535 +#: ../../library/multiprocessing.rst:1541 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1540 +#: ../../library/multiprocessing.rst:1546 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:1544 -#: ../../library/multiprocessing.rst:1631 +#: ../../library/multiprocessing.rst:1550 +#: ../../library/multiprocessing.rst:1637 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:1548 +#: ../../library/multiprocessing.rst:1554 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` " @@ -2292,24 +2292,24 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1555 +#: ../../library/multiprocessing.rst:1561 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:1559 +#: ../../library/multiprocessing.rst:1565 msgid "counter.value += 1" msgstr "counter.value += 1" -#: ../../library/multiprocessing.rst:1561 +#: ../../library/multiprocessing.rst:1567 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1564 +#: ../../library/multiprocessing.rst:1570 msgid "" "with counter.get_lock():\n" " counter.value += 1" @@ -2317,19 +2317,19 @@ msgstr "" "with counter.get_lock():\n" " counter.value += 1" -#: ../../library/multiprocessing.rst:1567 -#: ../../library/multiprocessing.rst:1657 -#: ../../library/multiprocessing.rst:1672 +#: ../../library/multiprocessing.rst:1573 +#: ../../library/multiprocessing.rst:1663 +#: ../../library/multiprocessing.rst:1678 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1571 +#: ../../library/multiprocessing.rst:1577 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:1574 +#: ../../library/multiprocessing.rst:1580 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 " @@ -2339,7 +2339,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1581 +#: ../../library/multiprocessing.rst:1587 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:" @@ -2349,28 +2349,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1588 +#: ../../library/multiprocessing.rst:1594 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1590 +#: ../../library/multiprocessing.rst:1596 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:1595 +#: ../../library/multiprocessing.rst:1601 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr ":mod:`multiprocessing.sharedctypes` 模組" -#: ../../library/multiprocessing.rst:1600 +#: ../../library/multiprocessing.rst:1606 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:1606 +#: ../../library/multiprocessing.rst:1612 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. " @@ -2379,11 +2379,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1614 +#: ../../library/multiprocessing.rst:1620 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1616 +#: ../../library/multiprocessing.rst:1622 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 " @@ -2393,40 +2393,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1623 +#: ../../library/multiprocessing.rst:1629 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:1629 +#: ../../library/multiprocessing.rst:1635 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1635 +#: ../../library/multiprocessing.rst:1641 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:1639 +#: ../../library/multiprocessing.rst:1645 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:1645 +#: ../../library/multiprocessing.rst:1651 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:1649 -#: ../../library/multiprocessing.rst:1665 +#: ../../library/multiprocessing.rst:1655 +#: ../../library/multiprocessing.rst:1671 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." @@ -2436,113 +2436,113 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1661 +#: ../../library/multiprocessing.rst:1667 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:1676 +#: ../../library/multiprocessing.rst:1682 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1681 +#: ../../library/multiprocessing.rst:1687 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:1685 +#: ../../library/multiprocessing.rst:1691 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:1689 +#: ../../library/multiprocessing.rst:1695 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:1692 +#: ../../library/multiprocessing.rst:1698 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1696 +#: ../../library/multiprocessing.rst:1702 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:1701 +#: ../../library/multiprocessing.rst:1707 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1701 +#: ../../library/multiprocessing.rst:1707 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1701 +#: ../../library/multiprocessing.rst:1707 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1703 +#: ../../library/multiprocessing.rst:1709 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1703 +#: ../../library/multiprocessing.rst:1709 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1703 +#: ../../library/multiprocessing.rst:1709 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1704 +#: ../../library/multiprocessing.rst:1710 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1704 +#: ../../library/multiprocessing.rst:1710 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1705 +#: ../../library/multiprocessing.rst:1711 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1705 +#: ../../library/multiprocessing.rst:1711 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1705 +#: ../../library/multiprocessing.rst:1711 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1706 +#: ../../library/multiprocessing.rst:1712 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1706 +#: ../../library/multiprocessing.rst:1712 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1706 +#: ../../library/multiprocessing.rst:1712 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1710 +#: ../../library/multiprocessing.rst:1716 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1713 +#: ../../library/multiprocessing.rst:1719 msgid "" "from multiprocessing import Process, Lock\n" "from multiprocessing.sharedctypes import Value, Array\n" @@ -2608,11 +2608,11 @@ msgstr "" " print(s.value)\n" " print([(a.x, a.y) for a in A])" -#: ../../library/multiprocessing.rst:1748 +#: ../../library/multiprocessing.rst:1754 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1750 +#: ../../library/multiprocessing.rst:1756 msgid "" "49\n" "0.1111111111111111\n" @@ -2624,11 +2624,11 @@ msgstr "" "HELLO WORLD\n" "[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" -#: ../../library/multiprocessing.rst:1761 +#: ../../library/multiprocessing.rst:1767 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1763 +#: ../../library/multiprocessing.rst:1769 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -2637,7 +2637,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1772 +#: ../../library/multiprocessing.rst:1778 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -2645,31 +2645,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1780 +#: ../../library/multiprocessing.rst:1786 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:1786 +#: ../../library/multiprocessing.rst:1792 msgid "Create a BaseManager object." msgstr "建立一個 BaseManager 物件。" -#: ../../library/multiprocessing.rst:1788 +#: ../../library/multiprocessing.rst:1794 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:1791 +#: ../../library/multiprocessing.rst:1797 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:1794 +#: ../../library/multiprocessing.rst:1800 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`` " @@ -2677,19 +2677,19 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1799 +#: ../../library/multiprocessing.rst:1805 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1802 +#: ../../library/multiprocessing.rst:1808 msgid "" "*ctx* is a context object, or ``None`` (use the current context). See the :" "func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:1805 +#: ../../library/multiprocessing.rst:1811 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 " @@ -2697,24 +2697,24 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1810 +#: ../../library/multiprocessing.rst:1816 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1815 +#: ../../library/multiprocessing.rst:1821 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:1820 +#: ../../library/multiprocessing.rst:1826 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:1824 +#: ../../library/multiprocessing.rst:1830 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" @@ -2726,15 +2726,15 @@ msgstr "" ">>> server = manager.get_server()\n" ">>> server.serve_forever()" -#: ../../library/multiprocessing.rst:1829 +#: ../../library/multiprocessing.rst:1835 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1833 +#: ../../library/multiprocessing.rst:1839 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1835 +#: ../../library/multiprocessing.rst:1841 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" @@ -2744,29 +2744,29 @@ msgstr "" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" ">>> m.connect()" -#: ../../library/multiprocessing.rst:1841 +#: ../../library/multiprocessing.rst:1847 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:1844 +#: ../../library/multiprocessing.rst:1850 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1848 +#: ../../library/multiprocessing.rst:1854 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1851 +#: ../../library/multiprocessing.rst:1857 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:1854 +#: ../../library/multiprocessing.rst:1860 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2774,14 +2774,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1860 +#: ../../library/multiprocessing.rst:1866 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:1864 +#: ../../library/multiprocessing.rst:1870 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2792,7 +2792,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1873 +#: ../../library/multiprocessing.rst:1879 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 " @@ -2802,22 +2802,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1880 +#: ../../library/multiprocessing.rst:1886 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:1884 +#: ../../library/multiprocessing.rst:1890 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1888 +#: ../../library/multiprocessing.rst:1894 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1890 +#: ../../library/multiprocessing.rst:1896 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2825,121 +2825,121 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1896 +#: ../../library/multiprocessing.rst:1902 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:1901 +#: ../../library/multiprocessing.rst:1907 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:1905 +#: ../../library/multiprocessing.rst:1911 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:1911 +#: ../../library/multiprocessing.rst:1917 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1918 +#: ../../library/multiprocessing.rst:1924 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1923 +#: ../../library/multiprocessing.rst:1929 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1926 +#: ../../library/multiprocessing.rst:1932 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:1934 +#: ../../library/multiprocessing.rst:1940 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1938 +#: ../../library/multiprocessing.rst:1944 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1942 +#: ../../library/multiprocessing.rst:1948 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1946 +#: ../../library/multiprocessing.rst:1952 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1950 +#: ../../library/multiprocessing.rst:1956 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1954 +#: ../../library/multiprocessing.rst:1960 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1959 +#: ../../library/multiprocessing.rst:1965 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1963 +#: ../../library/multiprocessing.rst:1969 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1970 +#: ../../library/multiprocessing.rst:1976 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1975 +#: ../../library/multiprocessing.rst:1981 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1977 +#: ../../library/multiprocessing.rst:1983 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:1984 +#: ../../library/multiprocessing.rst:1990 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1986 +#: ../../library/multiprocessing.rst:1992 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:1989 +#: ../../library/multiprocessing.rst:1995 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:1993 +#: ../../library/multiprocessing.rst:1999 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -2951,18 +2951,18 @@ msgid "" "Namespace(x=10, y='hello')" msgstr "" -#: ../../library/multiprocessing.rst:2006 +#: ../../library/multiprocessing.rst:2012 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:2008 +#: ../../library/multiprocessing.rst:2014 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:2012 +#: ../../library/multiprocessing.rst:2018 msgid "" "from multiprocessing.managers import BaseManager\n" "\n" @@ -3002,23 +3002,23 @@ msgstr "" " print(maths.add(4, 3)) # 印出 7\n" " print(maths.mul(7, 8)) # 印出 56" -#: ../../library/multiprocessing.rst:2033 +#: ../../library/multiprocessing.rst:2039 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:2035 +#: ../../library/multiprocessing.rst:2041 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:2038 +#: ../../library/multiprocessing.rst:2044 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:2041 +#: ../../library/multiprocessing.rst:2047 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> from queue import Queue\n" @@ -3038,11 +3038,11 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2050 +#: ../../library/multiprocessing.rst:2056 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2052 +#: ../../library/multiprocessing.rst:2058 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3062,11 +3062,11 @@ msgstr "" ">>> queue = m.get_queue()\n" ">>> queue.put('hello')" -#: ../../library/multiprocessing.rst:2060 +#: ../../library/multiprocessing.rst:2066 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2062 +#: ../../library/multiprocessing.rst:2068 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3088,13 +3088,13 @@ msgstr "" ">>> queue.get()\n" "'hello'" -#: ../../library/multiprocessing.rst:2071 +#: ../../library/multiprocessing.rst:2077 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2074 +#: ../../library/multiprocessing.rst:2080 msgid "" ">>> from multiprocessing import Process, Queue\n" ">>> from multiprocessing.managers import BaseManager\n" @@ -3134,18 +3134,18 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2096 +#: ../../library/multiprocessing.rst:2102 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2098 +#: ../../library/multiprocessing.rst:2104 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:2102 +#: ../../library/multiprocessing.rst:2108 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -3153,7 +3153,7 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2106 +#: ../../library/multiprocessing.rst:2112 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3179,14 +3179,14 @@ msgstr "" ">>> l[2:5]\n" "[4, 9, 16]" -#: ../../library/multiprocessing.rst:2120 +#: ../../library/multiprocessing.rst:2126 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:2124 +#: ../../library/multiprocessing.rst:2130 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:" @@ -3194,7 +3194,7 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2129 +#: ../../library/multiprocessing.rst:2135 msgid "" ">>> a = manager.list()\n" ">>> b = manager.list()\n" @@ -3206,11 +3206,11 @@ msgid "" "['hello'] ['hello']" msgstr "" -#: ../../library/multiprocessing.rst:2140 +#: ../../library/multiprocessing.rst:2146 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2142 +#: ../../library/multiprocessing.rst:2148 msgid "" ">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" ">>> d_first_inner = l_outer[0]\n" @@ -3234,7 +3234,7 @@ msgstr "" ">>> print(l_outer[1])\n" "{'c': 3, 'z': 26}" -#: ../../library/multiprocessing.rst:2153 +#: ../../library/multiprocessing.rst:2159 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 " @@ -3245,7 +3245,7 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2161 +#: ../../library/multiprocessing.rst:2167 msgid "" "# create a list proxy and append a mutable object (a dictionary)\n" "lproxy = manager.list()\n" @@ -3259,20 +3259,20 @@ msgid "" "lproxy[0] = d" msgstr "" -#: ../../library/multiprocessing.rst:2172 +#: ../../library/multiprocessing.rst:2178 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:2178 +#: ../../library/multiprocessing.rst:2184 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2181 +#: ../../library/multiprocessing.rst:2187 msgid "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" @@ -3280,48 +3280,48 @@ msgstr "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" -#: ../../library/multiprocessing.rst:2186 +#: ../../library/multiprocessing.rst:2192 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2190 +#: ../../library/multiprocessing.rst:2196 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2194 +#: ../../library/multiprocessing.rst:2200 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2196 +#: ../../library/multiprocessing.rst:2202 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2198 +#: ../../library/multiprocessing.rst:2204 msgid "proxy._callmethod(methodname, args, kwds)" msgstr "proxy._callmethod(methodname, args, kwds)" -#: ../../library/multiprocessing.rst:2200 +#: ../../library/multiprocessing.rst:2206 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2202 +#: ../../library/multiprocessing.rst:2208 msgid "getattr(obj, methodname)(*args, **kwds)" msgstr "getattr(obj, methodname)(*args, **kwds)" -#: ../../library/multiprocessing.rst:2204 +#: ../../library/multiprocessing.rst:2210 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2206 +#: ../../library/multiprocessing.rst:2212 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:2210 +#: ../../library/multiprocessing.rst:2216 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 " @@ -3329,17 +3329,17 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2215 +#: ../../library/multiprocessing.rst:2221 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2218 +#: ../../library/multiprocessing.rst:2224 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2220 +#: ../../library/multiprocessing.rst:2226 msgid "" ">>> l = manager.list(range(10))\n" ">>> l._callmethod('__len__')\n" @@ -3361,69 +3361,69 @@ msgstr "" "...\n" "IndexError: list index out of range" -#: ../../library/multiprocessing.rst:2234 +#: ../../library/multiprocessing.rst:2240 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2236 +#: ../../library/multiprocessing.rst:2242 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2240 +#: ../../library/multiprocessing.rst:2246 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2244 +#: ../../library/multiprocessing.rst:2250 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2248 +#: ../../library/multiprocessing.rst:2254 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2250 +#: ../../library/multiprocessing.rst:2256 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:2253 +#: ../../library/multiprocessing.rst:2259 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2258 +#: ../../library/multiprocessing.rst:2264 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2263 +#: ../../library/multiprocessing.rst:2269 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:2268 +#: ../../library/multiprocessing.rst:2274 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:2272 +#: ../../library/multiprocessing.rst:2278 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2275 -#: ../../library/multiprocessing.rst:2839 +#: ../../library/multiprocessing.rst:2281 +#: ../../library/multiprocessing.rst:2845 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2278 +#: ../../library/multiprocessing.rst:2284 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 " @@ -3431,7 +3431,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2283 +#: ../../library/multiprocessing.rst:2289 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -3439,13 +3439,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2289 +#: ../../library/multiprocessing.rst:2295 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2293 +#: ../../library/multiprocessing.rst:2299 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 " @@ -3453,28 +3453,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2298 +#: ../../library/multiprocessing.rst:2304 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:2302 +#: ../../library/multiprocessing.rst:2308 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2305 +#: ../../library/multiprocessing.rst:2311 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2308 +#: ../../library/multiprocessing.rst:2314 msgid "" "*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" "`os.cpu_count`." msgstr "" -#: ../../library/multiprocessing.rst:2314 +#: ../../library/multiprocessing.rst:2320 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 " @@ -3485,7 +3485,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2324 +#: ../../library/multiprocessing.rst:2330 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 " @@ -3493,14 +3493,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2331 +#: ../../library/multiprocessing.rst:2337 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2334 -#: ../../library/multiprocessing.rst:2365 +#: ../../library/multiprocessing.rst:2340 +#: ../../library/multiprocessing.rst:2371 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, " @@ -3508,60 +3508,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2339 -#: ../../library/multiprocessing.rst:2370 +#: ../../library/multiprocessing.rst:2345 +#: ../../library/multiprocessing.rst:2376 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:2343 -#: ../../library/multiprocessing.rst:2374 +#: ../../library/multiprocessing.rst:2349 +#: ../../library/multiprocessing.rst:2380 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2348 +#: ../../library/multiprocessing.rst:2354 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:2352 +#: ../../library/multiprocessing.rst:2358 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:2356 +#: ../../library/multiprocessing.rst:2362 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:2362 +#: ../../library/multiprocessing.rst:2368 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2379 +#: ../../library/multiprocessing.rst:2385 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2381 +#: ../../library/multiprocessing.rst:2387 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:2386 +#: ../../library/multiprocessing.rst:2392 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: " @@ -3569,65 +3569,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2393 +#: ../../library/multiprocessing.rst:2399 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:2399 +#: ../../library/multiprocessing.rst:2405 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:2403 +#: ../../library/multiprocessing.rst:2409 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2410 +#: ../../library/multiprocessing.rst:2416 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:2418 +#: ../../library/multiprocessing.rst:2424 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:2423 +#: ../../library/multiprocessing.rst:2429 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:2429 +#: ../../library/multiprocessing.rst:2435 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2432 +#: ../../library/multiprocessing.rst:2438 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:2440 +#: ../../library/multiprocessing.rst:2446 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2445 +#: ../../library/multiprocessing.rst:2451 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -3635,31 +3635,31 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2452 +#: ../../library/multiprocessing.rst:2458 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2456 +#: ../../library/multiprocessing.rst:2462 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2460 +#: ../../library/multiprocessing.rst:2466 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2463 +#: ../../library/multiprocessing.rst:2469 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2467 +#: ../../library/multiprocessing.rst:2473 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2469 +#: ../../library/multiprocessing.rst:2475 msgid "" "from multiprocessing import Pool\n" "import time\n" @@ -3687,17 +3687,17 @@ msgid "" "TimeoutError" msgstr "" -#: ../../library/multiprocessing.rst:2494 +#: ../../library/multiprocessing.rst:2500 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2499 +#: ../../library/multiprocessing.rst:2505 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:2503 +#: ../../library/multiprocessing.rst:2509 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -3706,46 +3706,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2512 +#: ../../library/multiprocessing.rst:2518 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2515 +#: ../../library/multiprocessing.rst:2521 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:2521 +#: ../../library/multiprocessing.rst:2527 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:2524 +#: ../../library/multiprocessing.rst:2530 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2529 +#: ../../library/multiprocessing.rst:2535 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2532 +#: ../../library/multiprocessing.rst:2538 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:2536 -#: ../../library/multiprocessing.rst:2571 +#: ../../library/multiprocessing.rst:2542 +#: ../../library/multiprocessing.rst:2577 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 " @@ -3754,26 +3754,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2544 +#: ../../library/multiprocessing.rst:2550 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2547 +#: ../../library/multiprocessing.rst:2553 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2552 +#: ../../library/multiprocessing.rst:2558 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:2556 +#: ../../library/multiprocessing.rst:2562 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 " @@ -3787,49 +3787,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2567 +#: ../../library/multiprocessing.rst:2573 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:2579 +#: ../../library/multiprocessing.rst:2585 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:2586 +#: ../../library/multiprocessing.rst:2592 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:2590 +#: ../../library/multiprocessing.rst:2596 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2594 +#: ../../library/multiprocessing.rst:2600 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2598 +#: ../../library/multiprocessing.rst:2604 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2601 +#: ../../library/multiprocessing.rst:2607 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:2608 +#: ../../library/multiprocessing.rst:2614 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 " @@ -3838,32 +3838,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2614 +#: ../../library/multiprocessing.rst:2620 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2617 +#: ../../library/multiprocessing.rst:2623 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2618 +#: ../../library/multiprocessing.rst:2624 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2619 +#: ../../library/multiprocessing.rst:2625 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2622 +#: ../../library/multiprocessing.rst:2628 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:2625 +#: ../../library/multiprocessing.rst:2631 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -3871,7 +3871,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2631 +#: ../../library/multiprocessing.rst:2637 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 " @@ -3881,18 +3881,18 @@ msgid "" "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2641 +#: ../../library/multiprocessing.rst:2647 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2643 +#: ../../library/multiprocessing.rst:2649 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:2647 +#: ../../library/multiprocessing.rst:2653 msgid "" "from multiprocessing.connection import Listener\n" "from array import array\n" @@ -3910,13 +3910,13 @@ msgid "" " conn.send_bytes(array('i', [42, 1729]))" msgstr "" -#: ../../library/multiprocessing.rst:2662 +#: ../../library/multiprocessing.rst:2668 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2665 +#: ../../library/multiprocessing.rst:2671 msgid "" "from multiprocessing.connection import Client\n" "from array import array\n" @@ -3946,13 +3946,13 @@ msgstr "" " print(conn.recv_bytes_into(arr)) # => 8\n" " print(arr) # => array('i', [42, 1729, 0, 0, 0])" -#: ../../library/multiprocessing.rst:2679 +#: ../../library/multiprocessing.rst:2685 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2682 +#: ../../library/multiprocessing.rst:2688 msgid "" "from multiprocessing import Process, Pipe, current_process\n" "from multiprocessing.connection import wait\n" @@ -3986,23 +3986,23 @@ msgid "" " print(msg)" msgstr "" -#: ../../library/multiprocessing.rst:2717 +#: ../../library/multiprocessing.rst:2723 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2719 +#: ../../library/multiprocessing.rst:2725 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:2722 +#: ../../library/multiprocessing.rst:2728 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2725 +#: ../../library/multiprocessing.rst:2731 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -4011,17 +4011,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2730 +#: ../../library/multiprocessing.rst:2736 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:2737 +#: ../../library/multiprocessing.rst:2743 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2739 +#: ../../library/multiprocessing.rst:2745 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -4029,7 +4029,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2745 +#: ../../library/multiprocessing.rst:2751 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 " @@ -4037,7 +4037,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2751 +#: ../../library/multiprocessing.rst:2757 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -4048,17 +4048,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2759 +#: ../../library/multiprocessing.rst:2765 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2763 +#: ../../library/multiprocessing.rst:2769 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2765 +#: ../../library/multiprocessing.rst:2771 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -4066,27 +4066,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2772 +#: ../../library/multiprocessing.rst:2778 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2775 +#: ../../library/multiprocessing.rst:2781 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2779 +#: ../../library/multiprocessing.rst:2785 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:2786 +#: ../../library/multiprocessing.rst:2792 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 " @@ -4095,11 +4095,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2792 +#: ../../library/multiprocessing.rst:2798 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2794 +#: ../../library/multiprocessing.rst:2800 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4127,21 +4127,21 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2807 +#: ../../library/multiprocessing.rst:2813 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2811 +#: ../../library/multiprocessing.rst:2817 msgid "The :mod:`multiprocessing.dummy` module" msgstr ":mod:`multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2816 +#: ../../library/multiprocessing.rst:2822 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:2821 +#: ../../library/multiprocessing.rst:2827 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -4149,7 +4149,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2829 +#: ../../library/multiprocessing.rst:2835 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -4159,18 +4159,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2836 +#: ../../library/multiprocessing.rst:2842 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2842 +#: ../../library/multiprocessing.rst:2848 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2846 +#: ../../library/multiprocessing.rst:2852 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 :" @@ -4180,7 +4180,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2853 +#: ../../library/multiprocessing.rst:2859 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -4189,69 +4189,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2863 +#: ../../library/multiprocessing.rst:2869 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2865 +#: ../../library/multiprocessing.rst:2871 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2870 +#: ../../library/multiprocessing.rst:2876 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2872 +#: ../../library/multiprocessing.rst:2878 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2874 +#: ../../library/multiprocessing.rst:2880 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2876 +#: ../../library/multiprocessing.rst:2882 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2879 +#: ../../library/multiprocessing.rst:2885 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:2883 +#: ../../library/multiprocessing.rst:2889 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2885 +#: ../../library/multiprocessing.rst:2891 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2887 +#: ../../library/multiprocessing.rst:2893 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2889 +#: ../../library/multiprocessing.rst:2895 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2892 +#: ../../library/multiprocessing.rst:2898 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2894 +#: ../../library/multiprocessing.rst:2900 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2896 +#: ../../library/multiprocessing.rst:2902 msgid "" "On POSIX 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 " @@ -4262,11 +4262,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2904 +#: ../../library/multiprocessing.rst:2910 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2906 +#: ../../library/multiprocessing.rst:2912 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -4276,11 +4276,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2914 +#: ../../library/multiprocessing.rst:2920 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2916 +#: ../../library/multiprocessing.rst:2922 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4288,18 +4288,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2922 +#: ../../library/multiprocessing.rst:2928 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:2926 +#: ../../library/multiprocessing.rst:2932 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2928 +#: ../../library/multiprocessing.rst:2934 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 " @@ -4308,7 +4308,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2934 +#: ../../library/multiprocessing.rst:2940 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 " @@ -4317,11 +4317,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2940 +#: ../../library/multiprocessing.rst:2946 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2942 +#: ../../library/multiprocessing.rst:2948 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4336,17 +4336,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:2954 +#: ../../library/multiprocessing.rst:2960 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2957 +#: ../../library/multiprocessing.rst:2963 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2959 +#: ../../library/multiprocessing.rst:2965 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4354,7 +4354,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2964 +#: ../../library/multiprocessing.rst:2970 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 " @@ -4363,11 +4363,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2971 +#: ../../library/multiprocessing.rst:2977 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2973 +#: ../../library/multiprocessing.rst:2979 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4389,11 +4389,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:2983 +#: ../../library/multiprocessing.rst:2989 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2985 +#: ../../library/multiprocessing.rst:2991 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4415,25 +4415,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:2995 +#: ../../library/multiprocessing.rst:3001 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2997 +#: ../../library/multiprocessing.rst:3003 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2999 +#: ../../library/multiprocessing.rst:3005 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:3001 +#: ../../library/multiprocessing.rst:3007 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:3004 +#: ../../library/multiprocessing.rst:3010 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4441,7 +4441,7 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:3007 +#: ../../library/multiprocessing.rst:3013 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -4451,14 +4451,14 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:3014 +#: ../../library/multiprocessing.rst:3020 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:3018 +#: ../../library/multiprocessing.rst:3024 msgid "" "@property\n" "def cache(self):\n" @@ -4476,26 +4476,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:3026 +#: ../../library/multiprocessing.rst:3032 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:3029 +#: ../../library/multiprocessing.rst:3038 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:3031 +#: ../../library/multiprocessing.rst:3040 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:3034 +#: ../../library/multiprocessing.rst:3043 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:3036 +#: ../../library/multiprocessing.rst:3045 msgid "" "Ensure that all arguments to :class:`~multiprocessing.Process` are " "picklable. Also, if you subclass ``Process.__init__``, you must make sure " @@ -4503,11 +4503,11 @@ msgid "" "` method is called." msgstr "" -#: ../../library/multiprocessing.rst:3041 +#: ../../library/multiprocessing.rst:3050 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:3043 +#: ../../library/multiprocessing.rst:3052 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 " @@ -4515,30 +4515,30 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:3048 +#: ../../library/multiprocessing.rst:3057 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:3053 +#: ../../library/multiprocessing.rst:3062 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:3055 +#: ../../library/multiprocessing.rst:3064 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3059 +#: ../../library/multiprocessing.rst:3068 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3063 +#: ../../library/multiprocessing.rst:3072 msgid "" "from multiprocessing import Process\n" "\n" @@ -4556,13 +4556,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3071 +#: ../../library/multiprocessing.rst:3080 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3074 +#: ../../library/multiprocessing.rst:3083 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4586,33 +4586,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3085 +#: ../../library/multiprocessing.rst:3094 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3088 +#: ../../library/multiprocessing.rst:3097 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:3091 +#: ../../library/multiprocessing.rst:3100 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3098 +#: ../../library/multiprocessing.rst:3107 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3100 +#: ../../library/multiprocessing.rst:3109 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3102 +#: ../../library/multiprocessing.rst:3111 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4706,11 +4706,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3106 +#: ../../library/multiprocessing.rst:3115 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3108 +#: ../../library/multiprocessing.rst:3117 msgid "" "import multiprocessing\n" "import time\n" @@ -4870,13 +4870,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3112 +#: ../../library/multiprocessing.rst:3121 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3115 +#: ../../library/multiprocessing.rst:3124 msgid "" "import time\n" "import random\n" From d66eab695676d15f87140fb8373b631a16b6bb72 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 30 Jul 2025 00:19:50 +0000 Subject: [PATCH 2/5] sync with cpython d61f8b84 --- library/array.po | 142 ++++++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 70 deletions(-) diff --git a/library/array.po b/library/array.po index c9aa3ec262..746000dca2 100644 --- a/library/array.po +++ b/library/array.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-07-30 00:18+0000\n" "PO-Revision-Date: 2021-11-23 18:40+0800\n" "Last-Translator: Benson Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -123,6 +123,10 @@ msgstr "Py_UCS4" msgid "4" msgstr "4" +#: ../../library/array.rst:27 +msgid "\\(2)" +msgstr "" + #: ../../library/array.rst:29 msgid "``'h'``" msgstr "``'h'``" @@ -230,7 +234,7 @@ msgstr "" msgid "Please migrate to ``'w'`` typecode." msgstr "" -#: ../../library/array.rst:64 +#: ../../library/array.rst:67 msgid "" "The actual representation of values is determined by the machine " "architecture (strictly speaking, by the C implementation). The actual size " @@ -239,30 +243,30 @@ msgstr "" "實際上數值的表示方法是被機器的架構所決定(更精準地說,被 C 的實作方法決定)。" "實際的大小可以透過 :attr:`array.itemsize` 屬性存取。" -#: ../../library/array.rst:68 +#: ../../library/array.rst:71 msgid "The module defines the following item:" msgstr "這個模組定義了以下項目:" -#: ../../library/array.rst:73 +#: ../../library/array.rst:76 msgid "A string with all available type codes." msgstr "一個包含所有可用的 type codes 的字串。" -#: ../../library/array.rst:76 +#: ../../library/array.rst:79 msgid "The module defines the following type:" msgstr "這個模組定義了下方的型別:" -#: ../../library/array.rst:81 +#: ../../library/array.rst:84 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " -"the optional *initializer* value, which must be a :class:`bytes` " -"or :class:`bytearray` object, a Unicode string, or iterable over elements of " -"the appropriate type." +"the optional *initializer* value, which must be a :class:`bytes` or :class:" +"`bytearray` object, a Unicode string, or iterable over elements of the " +"appropriate type." msgstr "" "一個新的陣列中的元素被 *typecode* 限制,並由選用的 *initializer* 參數初始化," "*initializer* 必須是一個 :class:`bytes` 或 :class:`bytearray` 物件、一個 " "Unicode 字串或包含適當型別元素的可疊代物件 (iterable)。" -#: ../../library/array.rst:86 +#: ../../library/array.rst:89 msgid "" "If given a :class:`bytes` or :class:`bytearray` object, the initializer is " "passed to the new array's :meth:`frombytes` method; if given a Unicode " @@ -275,7 +279,7 @@ msgstr "" "方法;其他情況時, 一個 initializer 的可疊代物件將被傳入 :meth:`extend` 方法" "之中來將初始項目新增至陣列。" -#: ../../library/array.rst:93 +#: ../../library/array.rst:96 msgid "" "Array objects support the ordinary sequence operations of indexing, slicing, " "concatenation, and multiplication. When using slice assignment, the " @@ -290,7 +294,7 @@ msgstr "" "了緩衝區介面,可以在任何支援 :term:`bytes-like objects ` " "的地方使用。" -#: ../../library/array.rst:99 +#: ../../library/array.rst:102 msgid "" "Raises an :ref:`auditing event ` ``array.__new__`` with arguments " "``typecode``, ``initializer``." @@ -298,19 +302,19 @@ msgstr "" "引發\\ :ref:`稽核事件 (auditing event) ` ``array.__new__`` 並附帶引" "數 ``typecode``、``initializer``。" -#: ../../library/array.rst:104 +#: ../../library/array.rst:107 msgid "The typecode character used to create the array." msgstr "typecode 字元被用在建立陣列時。" -#: ../../library/array.rst:109 +#: ../../library/array.rst:112 msgid "The length in bytes of one array item in the internal representation." msgstr "陣列當中的一個元素在內部需要的位元組長度。" -#: ../../library/array.rst:114 +#: ../../library/array.rst:117 msgid "Append a new item with value *x* to the end of the array." msgstr "新增一個元素 *x* 到陣列的最尾端。" -#: ../../library/array.rst:119 +#: ../../library/array.rst:122 msgid "" "Return a tuple ``(address, length)`` giving the current memory address and " "the length in elements of the buffer used to hold array's contents. The " @@ -327,7 +331,7 @@ msgstr "" "用,例如 :c:func:`!ioctl` 指令。只要陣列存在且沒有使用任何更改長度的操作時," "回傳的數值就有效。" -#: ../../library/array.rst:129 +#: ../../library/array.rst:132 msgid "" "When using array objects from code written in C or C++ (the only way to " "effectively make use of this information), it makes more sense to use the " @@ -339,67 +343,66 @@ msgstr "" "適當的做法是使用陣列物件支援的緩衝區介面。這個方法維護了向後兼容性,並應該在" "新的程式碼中避免。關於緩衝區介面的文件在\\ :ref:`bufferobjects`。" -#: ../../library/array.rst:138 +#: ../../library/array.rst:141 msgid "" "\"Byteswap\" all items of the array. This is only supported for values " -"which are 1, 2, 4, or 8 bytes in size; for other types of " -"values, :exc:`RuntimeError` is raised. It is useful when reading data from " -"a file written on a machine with a different byte order." +"which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" +"`RuntimeError` is raised. It is useful when reading data from a file " +"written on a machine with a different byte order." msgstr "" "\"Byteswap\" 所有陣列中的物件。這只有支援物件長度為 1、2、4 或 8 位元組的陣" "列,其他型別的值會導致 :exc:`RuntimeError`。這在從機器讀取位元順序不同的檔案" "時很有用。" -#: ../../library/array.rst:146 +#: ../../library/array.rst:149 msgid "Return the number of occurrences of *x* in the array." msgstr "回傳 *x* 在陣列中出現了幾次。" -#: ../../library/array.rst:151 +#: ../../library/array.rst:154 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " -"another array, it must have *exactly* the same type code; if " -"not, :exc:`TypeError` will be raised. If *iterable* is not an array, it " -"must be iterable and its elements must be the right type to be appended to " -"the array." +"another array, it must have *exactly* the same type code; if not, :exc:" +"`TypeError` will be raised. If *iterable* is not an array, it must be " +"iterable and its elements must be the right type to be appended to the array." msgstr "" "從 *iterable* 中新增元素到陣列的尾端,如果 *iterable* 是另一個陣列,它必須有" "完全相同的 type code,如果不同會導致 :exc:`TypeError`。如果 *iterable* 不是一" "個陣列,它必須可以被疊代 (iterable) 且其中的元素必須是可以被加入陣列中的正確" "型別。" -#: ../../library/array.rst:159 +#: ../../library/array.rst:162 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " -"as an array of machine values (as if it had been read from a file using " -"the :meth:`fromfile` method)." +"as an array of machine values (as if it had been read from a file using the :" +"meth:`fromfile` method)." msgstr "" "從 :term:`bytes-like object` 中新增元素。讀取時會將其內容當作一個機器數值組成" "的陣列(就像從檔案中使用 :meth:`fromfile` 方法讀出的資料)。" -#: ../../library/array.rst:163 +#: ../../library/array.rst:166 msgid ":meth:`!fromstring` is renamed to :meth:`frombytes` for clarity." msgstr "將 :meth:`!fromstring` 更名為 :meth:`frombytes`,使其更加清晰易懂。" -#: ../../library/array.rst:169 +#: ../../library/array.rst:172 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " -"append them to the end of the array. If less than *n* items are " -"available, :exc:`EOFError` is raised, but the items that were available are " -"still inserted into the array." +"append them to the end of the array. If less than *n* items are available, :" +"exc:`EOFError` is raised, but the items that were available are still " +"inserted into the array." msgstr "" "從 :term:`file object` *f* 讀取 *n* 個元素(作為機器數值),接著將這些元素加" "入陣列的最尾端。如果只有少於 *n* 個有效的元素會導致 :exc:`EOFError`,但有效的" "元素仍然會被加入陣列中。" -#: ../../library/array.rst:177 +#: ../../library/array.rst:180 msgid "" -"Append items from the list. This is equivalent to ``for x in list: " -"a.append(x)`` except that if there is a type error, the array is unchanged." +"Append items from the list. This is equivalent to ``for x in list: a." +"append(x)`` except that if there is a type error, the array is unchanged." msgstr "" "從 list 中新增元素。這等價於 ``for x in list: a.append(x)``,除了有型別錯誤產" "生時,陣列會保持原狀不會被更改。" -#: ../../library/array.rst:183 +#: ../../library/array.rst:186 msgid "" "Extends this array with data from the given Unicode string. The array must " "have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " @@ -407,32 +410,32 @@ msgid "" "an array of some other type." msgstr "" "用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u`` 或 ``'w'``;" -"其他的型別會導致 :exc:`ValueError` 被引發。使用 " -"``array.frombytes(unicodestring.encode(enc))`` 來新增 Unicode 資料到一個其他" -"型別的陣列。" +"其他的型別會導致 :exc:`ValueError` 被引發。使用 ``array." +"frombytes(unicodestring.encode(enc))`` 來新增 Unicode 資料到一個其他型別的陣" +"列。" -#: ../../library/array.rst:191 +#: ../../library/array.rst:194 msgid "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " -"specified to search for *x* within a subsection of the array. " -"Raise :exc:`ValueError` if *x* is not found." +"specified to search for *x* within a subsection of the array. Raise :exc:" +"`ValueError` if *x* is not found." msgstr "" "回傳 *i* 的最小數值,使得 *i* 成為陣列之中第一次出現 *x* 的索引。選擇性的引" "數 *start* 及 *stop* 則可以被用來在指定的陣列空間中搜尋 *x*。如果 *x* 不存在" "將導致 :exc:`ValueError`。" -#: ../../library/array.rst:196 +#: ../../library/array.rst:199 msgid "Added optional *start* and *stop* parameters." msgstr "新增選擇性的參數 *start* 及 *stop*。" -#: ../../library/array.rst:202 +#: ../../library/array.rst:205 msgid "" "Insert a new item with value *x* in the array before position *i*. Negative " "values are treated as being relative to the end of the array." msgstr "在位置 *i* 之前插入一個元素 *x*。負數的索引值會從陣列尾端開始數。" -#: ../../library/array.rst:208 +#: ../../library/array.rst:211 msgid "" "Removes the item with the index *i* from the array and returns it. The " "optional argument defaults to ``-1``, so that by default the last item is " @@ -441,20 +444,20 @@ msgstr "" "移除並回傳陣列索引值 *i* 的元素。選擇性的引數 *i* 預設為 ``-1``,所以預設會刪" "除並回傳最後一個元素。" -#: ../../library/array.rst:215 +#: ../../library/array.rst:218 msgid "Remove the first occurrence of *x* from the array." msgstr "從陣列中刪除第一個出現的 *x*。" -#: ../../library/array.rst:220 +#: ../../library/array.rst:223 #, fuzzy msgid "Remove all elements from the array." msgstr "從陣列中刪除第一個出現的 *x*。" -#: ../../library/array.rst:227 +#: ../../library/array.rst:230 msgid "Reverse the order of the items in the array." msgstr "反轉陣列中元素的順序。" -#: ../../library/array.rst:232 +#: ../../library/array.rst:235 msgid "" "Convert the array to an array of machine values and return the bytes " "representation (the same sequence of bytes that would be written to a file " @@ -463,31 +466,30 @@ msgstr "" "將陣列轉為另一個機器數值組成的陣列並回傳它的位元組表示(跟用 :meth:`tofile` " "方法寫入檔案時的位元序列相同)。" -#: ../../library/array.rst:236 +#: ../../library/array.rst:239 msgid ":meth:`!tostring` is renamed to :meth:`tobytes` for clarity." msgstr "為了明確性,過去的 :meth:`!tostring` 已更名為 :meth:`tobytes`。" -#: ../../library/array.rst:242 +#: ../../library/array.rst:245 msgid "Write all items (as machine values) to the :term:`file object` *f*." msgstr "將所有元素(作為機器數值)寫入 :term:`file object` *f*。" -#: ../../library/array.rst:247 +#: ../../library/array.rst:250 msgid "Convert the array to an ordinary list with the same items." msgstr "不更改元素,將陣列轉為一般的 list。" -#: ../../library/array.rst:252 +#: ../../library/array.rst:255 #, fuzzy msgid "" "Convert the array to a Unicode string. The array must have a type ``'u'`` " -"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use " -"``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of " -"some other type." +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." +"decode(enc)`` to obtain a Unicode string from an array of some other type." msgstr "" -"將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導" -"致 :exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型" -"別的陣列轉為 Unicode 字串。" +"將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導致 :" +"exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型別的" +"陣列轉為 Unicode 字串。" -#: ../../library/array.rst:257 +#: ../../library/array.rst:260 #, fuzzy msgid "" "The string representation of array objects has the form ``array(typecode, " @@ -503,10 +505,10 @@ msgstr "" "陣列物件的字串表示形式為 ``array(typecode, initializer)``。若為空陣列則參數 " "*initializer* 被省略,若 *typecode* 是 ``'u'`` 將被表示為 Unicode 字串,其他" "情況則被表示為由數字組成的 list。只要 :class:`~array.array` class(類別)透" -"過 ``from array import array`` 的方式引入,便能確保該字串表示能透" -"過 :func:`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" +"過 ``from array import array`` 的方式引入,便能確保該字串表示能透過 :func:" +"`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" -#: ../../library/array.rst:269 +#: ../../library/array.rst:272 #, fuzzy msgid "" "array('l')\n" @@ -519,19 +521,19 @@ msgstr "" "array('l', [1, 2, 3, 4, 5])\n" "array('d', [1.0, 2.0, 3.14, -inf, nan])" -#: ../../library/array.rst:277 +#: ../../library/array.rst:280 msgid "Module :mod:`struct`" msgstr ":mod:`struct` 模組" -#: ../../library/array.rst:278 +#: ../../library/array.rst:281 msgid "Packing and unpacking of heterogeneous binary data." msgstr "將包含不同資料類型的二進位資料包裝與解開包裝。" -#: ../../library/array.rst:280 +#: ../../library/array.rst:283 msgid "`NumPy `_" msgstr "`NumPy `_" -#: ../../library/array.rst:281 +#: ../../library/array.rst:284 msgid "The NumPy package defines another array type." msgstr "NumPy 套件定義了另一個陣列型別" From f3fb9ca8b8584c230f90214e7f1c25c647b1a49c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 31 Jul 2025 00:18:12 +0000 Subject: [PATCH 3/5] sync with cpython 5c16f699 --- library/bisect.po | 74 +++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/library/bisect.po b/library/bisect.po index c423cc4f89..1f1e756f26 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-07-31 00:16+0000\n" "PO-Revision-Date: 2023-08-01 12:53+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,10 +57,20 @@ msgstr "" "叫 :meth:`~object.__lt__` 方法,並在陣列中的值回傳一個插入點。" #: ../../library/bisect.rst:29 +msgid "" +"The functions in this module are not thread-safe. If multiple threads " +"concurrently use :mod:`bisect` functions on the same sequence, this may " +"result in undefined behaviour. Likewise, if the provided sequence is mutated " +"by a different thread while a :mod:`bisect` function is operating on it, the " +"result is undefined. For example, using :py:func:`~bisect.insort_left` on " +"the same list from multiple threads may result in the list becoming unsorted." +msgstr "" + +#: ../../library/bisect.rst:39 msgid "The following functions are provided:" msgstr "此模組提供下面的函式:" -#: ../../library/bisect.rst:34 +#: ../../library/bisect.rst:44 msgid "" "Locate the insertion point for *x* in *a* to maintain sorted order. The " "parameters *lo* and *hi* may be used to specify a subset of the list which " @@ -74,7 +84,7 @@ msgstr "" "有 *x* 出現,插入的位置會在所有 *x* 的前面(左邊)。回傳值可以被當作 ``list." "insert()`` 的第一個參數,但列表 *a* 必須先排序過。" -#: ../../library/bisect.rst:41 +#: ../../library/bisect.rst:51 msgid "" "The returned insertion point *ip* partitions the array *a* into two slices " "such that ``all(elem < x for elem in a[lo : ip])`` is true for the left " @@ -85,7 +95,7 @@ msgstr "" "``all(elem < x for elem in a[lo : ip])`` 為真,對於右切片而言 ``all(elem >= " "x for elem in a[ip : hi])`` 為真。" -#: ../../library/bisect.rst:46 +#: ../../library/bisect.rst:56 msgid "" "*key* specifies a :term:`key function` of one argument that is used to " "extract a comparison key from each element in the array. To support " @@ -95,18 +105,18 @@ msgstr "" "所有元素以得到比較值來計算順位。注意此 function 只會套用在陣列中的元素,不會" "套用在 *x*。" -#: ../../library/bisect.rst:50 +#: ../../library/bisect.rst:60 msgid "" "If *key* is ``None``, the elements are compared directly and no key function " "is called." msgstr "若 *key* 為 ``None``,元素將直接進行比較,不會呼叫任何鍵函式。" -#: ../../library/bisect.rst:53 ../../library/bisect.rst:67 -#: ../../library/bisect.rst:85 ../../library/bisect.rst:105 +#: ../../library/bisect.rst:63 ../../library/bisect.rst:77 +#: ../../library/bisect.rst:95 ../../library/bisect.rst:115 msgid "Added the *key* parameter." msgstr "新增 *key* 參數。" -#: ../../library/bisect.rst:60 +#: ../../library/bisect.rst:70 msgid "" "Similar to :py:func:`~bisect.bisect_left`, but returns an insertion point " "which comes after (to the right of) any existing entries of *x* in *a*." @@ -114,7 +124,7 @@ msgstr "" "類似 :py:func:`~bisect.bisect_left`,但回傳的插入位置會在所有 *a* 當中的 *x* " "的後面(右邊)。" -#: ../../library/bisect.rst:63 +#: ../../library/bisect.rst:73 msgid "" "The returned insertion point *ip* partitions the array *a* into two slices " "such that ``all(elem <= x for elem in a[lo : ip])`` is true for the left " @@ -125,11 +135,11 @@ msgstr "" "``all(elem <= x for elem in a[lo : ip])`` 為真,對於右切片而言 ``all(elem > " "x for elem in a[ip : hi])`` 為真。" -#: ../../library/bisect.rst:73 +#: ../../library/bisect.rst:83 msgid "Insert *x* in *a* in sorted order." msgstr "將元素 *x* 插入 list *a*,並維持順序。" -#: ../../library/bisect.rst:75 +#: ../../library/bisect.rst:85 msgid "" "This function first runs :py:func:`~bisect.bisect_left` to locate an " "insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " @@ -138,13 +148,13 @@ msgstr "" "此函式先使用 :py:func:`~bisect.bisect_left` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" -#: ../../library/bisect.rst:79 ../../library/bisect.rst:99 +#: ../../library/bisect.rst:89 ../../library/bisect.rst:109 msgid "" "To support inserting records in a table, the *key* function (if any) is " "applied to *x* for the search step but not for the insertion step." msgstr "此函式只有在搜尋時會使用 *key* 函式,插入時不會。" -#: ../../library/bisect.rst:82 ../../library/bisect.rst:102 +#: ../../library/bisect.rst:92 ../../library/bisect.rst:112 msgid "" "Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ " "(*n*) insertion step." @@ -152,7 +162,7 @@ msgstr "" "注意雖然搜尋是 *O*\\ (log *n*),但插入是 *O*\\ (*n*),因此此函式整體時間複雜" "度是 *O*\\ (*n*)。" -#: ../../library/bisect.rst:92 +#: ../../library/bisect.rst:102 msgid "" "Similar to :py:func:`~bisect.insort_left`, but inserting *x* in *a* after " "any existing entries of *x*." @@ -160,7 +170,7 @@ msgstr "" "類似 :py:func:`~bisect.insort_left`,但插入的位置會在所有 *a* 當中的 *x* 的後" "面(右邊)。" -#: ../../library/bisect.rst:95 +#: ../../library/bisect.rst:105 msgid "" "This function first runs :py:func:`~bisect.bisect_right` to locate an " "insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " @@ -169,11 +179,11 @@ msgstr "" "此函式先使用 :py:func:`~bisect.bisect_right` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" -#: ../../library/bisect.rst:110 +#: ../../library/bisect.rst:120 msgid "Performance Notes" msgstr "效能考量" -#: ../../library/bisect.rst:112 +#: ../../library/bisect.rst:122 msgid "" "When writing time sensitive code using *bisect()* and *insort()*, keep these " "thoughts in mind:" @@ -181,7 +191,7 @@ msgstr "" "若在需要關注寫入時間的程式當中使用 *bisect()* 和 *insort()*,請特別注意幾個事" "項:" -#: ../../library/bisect.rst:115 +#: ../../library/bisect.rst:125 msgid "" "Bisection is effective for searching ranges of values. For locating specific " "values, dictionaries are more performant." @@ -189,7 +199,7 @@ msgstr "" "二分法在一段範圍的數值中做搜尋的效率較佳,但若是要存取特定數值,使用字典的表" "現還是比較好。" -#: ../../library/bisect.rst:118 +#: ../../library/bisect.rst:128 msgid "" "The *insort()* functions are *O*\\ (*n*) because the logarithmic search step " "is dominated by the linear time insertion step." @@ -197,7 +207,7 @@ msgstr "" "*insort()* 函式的複雜度為 *O*\\ (*n*),因為對數搜尋是以線性時間的插入步驟所主" "導 (dominate)。" -#: ../../library/bisect.rst:121 +#: ../../library/bisect.rst:131 msgid "" "The search functions are stateless and discard key function results after " "they are used. Consequently, if the search functions are used in a loop, " @@ -213,7 +223,7 @@ msgstr "" "另外,也可以透過搜尋預先計算好的鍵列表 (array of precomputed keys) 來定位插入" "點(如下方範例所示)。" -#: ../../library/bisect.rst:131 +#: ../../library/bisect.rst:141 msgid "" "`Sorted Collections `_ is a " "high performance module that uses *bisect* to managed sorted collections of " @@ -222,7 +232,7 @@ msgstr "" "`有序容器 (Sorted Collections) `_ 是一個使用 *bisect* 來管理資料之有序集合的高效能模組。" -#: ../../library/bisect.rst:135 +#: ../../library/bisect.rst:145 msgid "" "The `SortedCollection recipe `_ uses bisect to build a full-featured collection class " @@ -235,11 +245,11 @@ msgstr "" "class) 並帶有符合直覺的搜尋方法 (search methods) 與支援鍵函式。鍵會預先被計算" "好,以減少搜尋過程中多餘的鍵函式呼叫。" -#: ../../library/bisect.rst:143 +#: ../../library/bisect.rst:153 msgid "Searching Sorted Lists" msgstr "搜尋一個已排序的 list" -#: ../../library/bisect.rst:145 +#: ../../library/bisect.rst:155 msgid "" "The above `bisect functions`_ are useful for finding insertion points but " "can be tricky or awkward to use for common searching tasks. The following " @@ -249,7 +259,7 @@ msgstr "" "上面的 `bisect functions`_ 在找到數值插入點上很有用,但一般的數值搜尋任務上就" "不是那麼的方便。以下的五個函式展示了如何將其轉換成標準的有序列表查找函式: ::" -#: ../../library/bisect.rst:150 +#: ../../library/bisect.rst:160 msgid "" "def index(a, x):\n" " 'Locate the leftmost value exactly equal to x'\n" @@ -287,11 +297,11 @@ msgid "" " raise ValueError" msgstr "" -#: ../../library/bisect.rst:187 +#: ../../library/bisect.rst:197 msgid "Examples" msgstr "範例" -#: ../../library/bisect.rst:191 +#: ../../library/bisect.rst:201 msgid "" "The :py:func:`~bisect.bisect` function can be useful for numeric table " "lookups. This example uses :py:func:`~bisect.bisect` to look up a letter " @@ -302,7 +312,7 @@ msgstr "" "個範例使用 :py:func:`~bisect.bisect` 以基於一組有序的數值分界點來為一個考試成" "績找到相對應的字母等級:90 以上是 'A'、80 到 89 為 'B',依此類推: ::" -#: ../../library/bisect.rst:196 +#: ../../library/bisect.rst:206 msgid "" ">>> def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):\n" "... i = bisect(breakpoints, score)\n" @@ -318,7 +328,7 @@ msgstr "" ">>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]\n" "['F', 'A', 'C', 'C', 'B', 'A', 'A']" -#: ../../library/bisect.rst:203 +#: ../../library/bisect.rst:213 msgid "" "The :py:func:`~bisect.bisect` and :py:func:`~bisect.insort` functions also " "work with lists of tuples. The *key* argument can serve to extract the " @@ -328,7 +338,7 @@ msgstr "" "tuples(元組)的 lists,*key* 引數可被用以取出在數值表中作為排序依據的欄" "位: ::" -#: ../../library/bisect.rst:207 +#: ../../library/bisect.rst:217 msgid "" ">>> from collections import namedtuple\n" ">>> from operator import attrgetter\n" @@ -361,7 +371,7 @@ msgid "" " Movie(name='Titanic', released=1997, director='Cameron')]" msgstr "" -#: ../../library/bisect.rst:237 +#: ../../library/bisect.rst:247 msgid "" "If the key function is expensive, it is possible to avoid repeated function " "calls by searching a list of precomputed keys to find the index of a record::" @@ -369,7 +379,7 @@ msgstr "" "如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜尋該紀錄的索引" "值,以減少重複的函式呼叫: ::" -#: ../../library/bisect.rst:240 +#: ../../library/bisect.rst:250 msgid "" ">>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]\n" ">>> data.sort(key=lambda r: r[1]) # Or use operator.itemgetter(1).\n" From 51e85cf3b2f9f8ed15721a09559fdd36c1e29e56 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 3 Aug 2025 00:20:52 +0000 Subject: [PATCH 4/5] sync with cpython 3b28cb0f --- c-api/code.po | 137 +++++++++++++++++++++++++++++++----- c-api/veryhigh.po | 10 +-- library/__future__.po | 157 ++++++++++++++++++++---------------------- 3 files changed, 200 insertions(+), 104 deletions(-) diff --git a/c-api/code.po b/c-api/code.po index 3ce283f533..65d8572ff6 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-08-03 00:19+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-" @@ -252,85 +252,184 @@ msgid "" "it before returning." msgstr "" -#: ../../c-api/code.rst:215 +#: ../../c-api/code.rst:217 +#, fuzzy +msgid "Code Object Flags" +msgstr "程式碼物件" + +#: ../../c-api/code.rst:219 +msgid "" +"Code objects contain a bit-field of flags, which can be retrieved as the :" +"attr:`~codeobject.co_flags` Python attribute (for example using :c:func:" +"`PyObject_GetAttrString`), and set using a *flags* argument to :c:func:" +"`PyUnstable_Code_New` and similar functions." +msgstr "" + +#: ../../c-api/code.rst:224 +msgid "" +"Flags whose names start with ``CO_FUTURE_`` correspond to features normally " +"selectable by :ref:`future statements `. These flags can be used in :" +"c:member:`PyCompilerFlags.cf_flags`. Note that many ``CO_FUTURE_`` flags are " +"mandatory in current versions of Python, and setting them has no effect." +msgstr "" + +#: ../../c-api/code.rst:230 +msgid "" +"The following flags are available. For their meaning, see the linked " +"documentation of their Python equivalents." +msgstr "" + +#: ../../c-api/code.rst:238 +msgid "Flag" +msgstr "" + +#: ../../c-api/code.rst:239 +msgid "Meaning" +msgstr "" + +#: ../../c-api/code.rst:241 +msgid ":py:data:`inspect.CO_OPTIMIZED`" +msgstr "" + +#: ../../c-api/code.rst:243 +msgid ":py:data:`inspect.CO_NEWLOCALS`" +msgstr "" + +#: ../../c-api/code.rst:245 +msgid ":py:data:`inspect.CO_VARARGS`" +msgstr "" + +#: ../../c-api/code.rst:247 +msgid ":py:data:`inspect.CO_VARKEYWORDS`" +msgstr "" + +#: ../../c-api/code.rst:249 +msgid ":py:data:`inspect.CO_NESTED`" +msgstr "" + +#: ../../c-api/code.rst:251 +msgid ":py:data:`inspect.CO_GENERATOR`" +msgstr "" + +#: ../../c-api/code.rst:253 +msgid ":py:data:`inspect.CO_COROUTINE`" +msgstr "" + +#: ../../c-api/code.rst:255 +msgid ":py:data:`inspect.CO_ITERABLE_COROUTINE`" +msgstr "" + +#: ../../c-api/code.rst:257 +msgid ":py:data:`inspect.CO_ASYNC_GENERATOR`" +msgstr "" + +#: ../../c-api/code.rst:260 +msgid "no effect (:py:data:`__future__.division`)" +msgstr "" + +#: ../../c-api/code.rst:262 +msgid "no effect (:py:data:`__future__.absolute_import`)" +msgstr "" + +#: ../../c-api/code.rst:264 +msgid "no effect (:py:data:`__future__.with_statement`)" +msgstr "" + +#: ../../c-api/code.rst:266 +msgid "no effect (:py:data:`__future__.print_function`)" +msgstr "" + +#: ../../c-api/code.rst:268 +msgid "no effect (:py:data:`__future__.unicode_literals`)" +msgstr "" + +#: ../../c-api/code.rst:270 +msgid "no effect (:py:data:`__future__.generator_stop`)" +msgstr "" + +#: ../../c-api/code.rst:272 +msgid ":py:data:`__future__.annotations`" +msgstr "" + +#: ../../c-api/code.rst:276 msgid "Extra information" msgstr "" -#: ../../c-api/code.rst:217 +#: ../../c-api/code.rst:278 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" -#: ../../c-api/code.rst:221 +#: ../../c-api/code.rst:282 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" -#: ../../c-api/code.rst:227 +#: ../../c-api/code.rst:288 msgid "Return a new an opaque index value used to adding data to code objects." msgstr "" -#: ../../c-api/code.rst:229 +#: ../../c-api/code.rst:290 msgid "" "You generally call this function once (per interpreter) and use the result " "with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " "individual code objects." msgstr "" -#: ../../c-api/code.rst:233 +#: ../../c-api/code.rst:294 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " "called on non-``NULL`` data stored under the new index. Use :c:func:" "`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" -#: ../../c-api/code.rst:239 +#: ../../c-api/code.rst:300 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -#: ../../c-api/code.rst:243 +#: ../../c-api/code.rst:304 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:249 +#: ../../c-api/code.rst:310 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:252 +#: ../../c-api/code.rst:313 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" -#: ../../c-api/code.rst:257 +#: ../../c-api/code.rst:318 msgid "as ``_PyCode_GetExtra``" msgstr "" -#: ../../c-api/code.rst:261 +#: ../../c-api/code.rst:322 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:267 +#: ../../c-api/code.rst:328 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:272 +#: ../../c-api/code.rst:333 msgid "as ``_PyCode_SetExtra``" msgstr "" -#: ../../c-api/code.rst:276 +#: ../../c-api/code.rst:337 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." @@ -356,14 +455,14 @@ msgstr "PyCode_New(C 函式)" msgid "PyCode_NewWithPosOnlyArgs (C function)" msgstr "PyCode_NewWithPosOnlyArgs(C 函式)" -#: ../../c-api/code.rst:237 +#: ../../c-api/code.rst:298 msgid "_PyEval_RequestCodeExtraIndex (C function)" msgstr "_PyEval_RequestCodeExtraIndex(C 函式)" -#: ../../c-api/code.rst:255 +#: ../../c-api/code.rst:316 msgid "_PyCode_GetExtra (C function)" msgstr "_PyCode_GetExtra(C 函式)" -#: ../../c-api/code.rst:270 +#: ../../c-api/code.rst:331 msgid "_PyCode_SetExtra (C function)" msgstr "_PyCode_SetExtra(C 函式)" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 80cabb8b50..4901187f50 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-22 00:13+0000\n" +"POT-Creation-Date: 2025-08-03 00:19+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-" @@ -400,10 +400,12 @@ msgid "" "mod:`!ast` Python module, which exports these constants under the same names." msgstr "" -#: ../../c-api/veryhigh.rst:366 +#: ../../c-api/veryhigh.rst:364 msgid "" -"This bit can be set in *flags* to cause division operator ``/`` to be " -"interpreted as \"true division\" according to :pep:`238`." +"The \"``PyCF``\" flags above can be combined with \"``CO_FUTURE``\" flags " +"such as :c:macro:`CO_FUTURE_ANNOTATIONS` to enable features normally " +"selectable using :ref:`future statements `. See :ref:" +"`c_codeobject_flags` for a complete list." msgstr "" #: ../../c-api/veryhigh.rst:301 ../../c-api/veryhigh.rst:309 diff --git a/library/__future__.po b/library/__future__.po index a1267b3397..762845fc30 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-08-03 00:19+0000\n" "PO-Revision-Date: 2024-02-06 02:12+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,157 +88,122 @@ msgstr "" "不會從 :mod:`__future__` 中刪除任何功能描述。自從在 Python 2.1 中引入以來,以" "下功能已透過這種機制引入到該語言中:" -#: ../../library/__future__.rst:41 +#: ../../library/__future__.rst:45 msgid "feature" msgstr "功能" -#: ../../library/__future__.rst:41 +#: ../../library/__future__.rst:46 msgid "optional in" msgstr "可選的版本" -#: ../../library/__future__.rst:41 +#: ../../library/__future__.rst:47 msgid "mandatory in" msgstr "強制性的版本" -#: ../../library/__future__.rst:41 +#: ../../library/__future__.rst:48 msgid "effect" msgstr "影響" -#: ../../library/__future__.rst:43 -msgid "nested_scopes" -msgstr "nested_scopes" - -#: ../../library/__future__.rst:43 +#: ../../library/__future__.rst:50 msgid "2.1.0b1" msgstr "2.1.0b1" -#: ../../library/__future__.rst:43 +#: ../../library/__future__.rst:51 msgid "2.2" msgstr "2.2" -#: ../../library/__future__.rst:43 +#: ../../library/__future__.rst:52 msgid ":pep:`227`: *Statically Nested Scopes*" msgstr ":pep:`227`: *靜態巢狀作用域 (Statically Nested Scopes)*" -#: ../../library/__future__.rst:46 -msgid "generators" -msgstr "generators" - -#: ../../library/__future__.rst:46 +#: ../../library/__future__.rst:54 msgid "2.2.0a1" msgstr "2.2.0a1" -#: ../../library/__future__.rst:46 +#: ../../library/__future__.rst:55 msgid "2.3" msgstr "2.3" -#: ../../library/__future__.rst:46 +#: ../../library/__future__.rst:56 msgid ":pep:`255`: *Simple Generators*" msgstr ":pep:`255`: *簡單產生器 (Simple Generators)*" -#: ../../library/__future__.rst:49 -msgid "division" -msgstr "division" - -#: ../../library/__future__.rst:49 +#: ../../library/__future__.rst:58 msgid "2.2.0a2" msgstr "2.2.0a2" -#: ../../library/__future__.rst:49 ../../library/__future__.rst:52 -#: ../../library/__future__.rst:58 ../../library/__future__.rst:61 +#: ../../library/__future__.rst:59 ../../library/__future__.rst:63 +#: ../../library/__future__.rst:71 ../../library/__future__.rst:75 msgid "3.0" msgstr "3.0" -#: ../../library/__future__.rst:49 +#: ../../library/__future__.rst:60 msgid ":pep:`238`: *Changing the Division Operator*" msgstr ":pep:`238`: *更改除法運算子 (Changing the Division Operator)*" -#: ../../library/__future__.rst:52 -msgid "absolute_import" -msgstr "absolute_import" - -#: ../../library/__future__.rst:52 ../../library/__future__.rst:55 +#: ../../library/__future__.rst:62 ../../library/__future__.rst:66 msgid "2.5.0a1" msgstr "2.5.0a1" -#: ../../library/__future__.rst:52 +#: ../../library/__future__.rst:64 msgid ":pep:`328`: *Imports: Multi-Line and Absolute/Relative*" msgstr "" ":pep:`328`: *引入:多列與絕對/相對 (Imports: Multi-Line and Absolute/" "Relative)*" -#: ../../library/__future__.rst:55 -msgid "with_statement" -msgstr "with_statement" - -#: ../../library/__future__.rst:55 +#: ../../library/__future__.rst:67 msgid "2.6" msgstr "2.6" -#: ../../library/__future__.rst:55 -msgid ":pep:`343`: *The \"with\" Statement*" +#: ../../library/__future__.rst:68 +#, fuzzy +msgid ":pep:`343`: *The “with” Statement*" msgstr ":pep:`343`: *\"with\" 陳述式 (The \"with\" Statement)*" -#: ../../library/__future__.rst:58 -msgid "print_function" -msgstr "print_function" - -#: ../../library/__future__.rst:58 ../../library/__future__.rst:61 +#: ../../library/__future__.rst:70 ../../library/__future__.rst:74 msgid "2.6.0a2" msgstr "2.6.0a2" -#: ../../library/__future__.rst:58 +#: ../../library/__future__.rst:72 msgid ":pep:`3105`: *Make print a function*" msgstr ":pep:`3105`: *使 print 成為一個函式 (Make print a function)*" -#: ../../library/__future__.rst:61 -msgid "unicode_literals" -msgstr "unicode_literals" - -#: ../../library/__future__.rst:61 +#: ../../library/__future__.rst:76 msgid ":pep:`3112`: *Bytes literals in Python 3000*" msgstr "" ":pep:`3112`: *Python 3000 中的位元組字面值 (Bytes literals in Python 3000)*" -#: ../../library/__future__.rst:64 -msgid "generator_stop" -msgstr "generator_stop" - -#: ../../library/__future__.rst:64 +#: ../../library/__future__.rst:78 msgid "3.5.0b1" msgstr "3.5.0b1" -#: ../../library/__future__.rst:64 +#: ../../library/__future__.rst:79 msgid "3.7" msgstr "3.7" -#: ../../library/__future__.rst:64 +#: ../../library/__future__.rst:80 msgid ":pep:`479`: *StopIteration handling inside generators*" msgstr "" ":pep:`479`: *產生器內部的 StopIteration 處理 (StopIteration handling inside " "generators)*" -#: ../../library/__future__.rst:67 -msgid "annotations" -msgstr "annotations" - -#: ../../library/__future__.rst:67 +#: ../../library/__future__.rst:82 msgid "3.7.0b1" msgstr "3.7.0b1" -#: ../../library/__future__.rst:67 -msgid "TBD [1]_" -msgstr "TBD [1]_" +#: ../../library/__future__.rst:83 +msgid "Never [1]_" +msgstr "" -#: ../../library/__future__.rst:67 +#: ../../library/__future__.rst:84 msgid ":pep:`563`: *Postponed evaluation of annotations*" msgstr ":pep:`563`: *推遲對註釋的求值 (Postponed evaluation of annotations)*" -#: ../../library/__future__.rst:77 +#: ../../library/__future__.rst:92 msgid "Each statement in :file:`__future__.py` is of the form::" msgstr ":file:`__future__.py` 中的每個陳述式的形式如下: ::" -#: ../../library/__future__.rst:79 +#: ../../library/__future__.rst:94 msgid "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" @@ -246,7 +211,7 @@ msgstr "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" -#: ../../library/__future__.rst:82 +#: ../../library/__future__.rst:97 msgid "" "where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both " "are 5-tuples of the same form as :data:`sys.version_info`::" @@ -254,7 +219,7 @@ msgstr "" "通常,*OptionalRelease* 會小於 *MandatoryRelease*,且兩者都是與 :data:`sys." "version_info` 形式相同的 5 元組 (5-tuple): ::" -#: ../../library/__future__.rst:85 +#: ../../library/__future__.rst:100 msgid "" "(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int\n" " PY_MINOR_VERSION, # the 1; an int\n" @@ -265,13 +230,13 @@ msgid "" ")" msgstr "" -#: ../../library/__future__.rst:94 +#: ../../library/__future__.rst:109 msgid "" "*OptionalRelease* records the first release in which the feature was " "accepted." msgstr "*OptionalRelease* 記錄該功能首次發布時的 Python 版本。" -#: ../../library/__future__.rst:98 +#: ../../library/__future__.rst:113 msgid "" "In the case of a *MandatoryRelease* that has not yet occurred, " "*MandatoryRelease* predicts the release in which the feature will become " @@ -280,7 +245,7 @@ msgstr "" "如果 *MandatoryRelease* 尚未發布,*MandatoryRelease* 會預測該功能將成為該語言" "一部分的版本。" -#: ../../library/__future__.rst:102 +#: ../../library/__future__.rst:117 msgid "" "Else *MandatoryRelease* records when the feature became part of the " "language; in releases at or after that, modules no longer need a future " @@ -290,7 +255,7 @@ msgstr "" "否則 *MandatoryRelease* 會記錄該功能是何時成為語言的一部分;在該版本或之後的" "版本中,模組不再需要 future 聲明來使用相關功能,但可以繼續使用此種引入方式。" -#: ../../library/__future__.rst:106 +#: ../../library/__future__.rst:121 msgid "" "*MandatoryRelease* may also be ``None``, meaning that a planned feature got " "dropped or that it is not yet decided." @@ -298,7 +263,7 @@ msgstr "" "*MandatoryRelease* 也可能是 ``None``,這意味著計劃中的功能被丟棄或者仍未決" "定。" -#: ../../library/__future__.rst:111 +#: ../../library/__future__.rst:126 msgid "" "*CompilerFlag* is the (bitfield) flag that should be passed in the fourth " "argument to the built-in function :func:`compile` to enable the feature in " @@ -309,7 +274,7 @@ msgstr "" "式 :func:`compile` 以在動態編譯的程式碼中啟用該功能。此旗標儲存在 :class:" "`_Feature` 實例上的 :attr:`_Feature.compiler_flag` 屬性中。" -#: ../../library/__future__.rst:117 +#: ../../library/__future__.rst:132 msgid "" "``from __future__ import annotations`` was previously scheduled to become " "mandatory in Python 3.10, but the Python Steering Council twice decided to " @@ -327,18 +292,48 @@ msgstr "" "VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__)。目前還尚未做出決定。另請參閱 :pep:" "`563` 和 :pep:`649`。" -#: ../../library/__future__.rst:127 +#: ../../library/__future__.rst:142 msgid ":ref:`future`" msgstr ":ref:`future`" -#: ../../library/__future__.rst:128 +#: ../../library/__future__.rst:143 msgid "How the compiler treats future imports." msgstr "編譯器如何處理 future 引入。" -#: ../../library/__future__.rst:130 +#: ../../library/__future__.rst:145 msgid ":pep:`236` - Back to the __future__" msgstr ":pep:`236` - 回到 __future__" -#: ../../library/__future__.rst:131 +#: ../../library/__future__.rst:146 msgid "The original proposal for the __future__ mechanism." msgstr "__future__ 機制的原始提案。" + +#~ msgid "nested_scopes" +#~ msgstr "nested_scopes" + +#~ msgid "generators" +#~ msgstr "generators" + +#~ msgid "division" +#~ msgstr "division" + +#~ msgid "absolute_import" +#~ msgstr "absolute_import" + +#~ msgid "with_statement" +#~ msgstr "with_statement" + +#~ msgid "print_function" +#~ msgstr "print_function" + +#~ msgid "unicode_literals" +#~ msgstr "unicode_literals" + +#~ msgid "generator_stop" +#~ msgstr "generator_stop" + +#~ msgid "annotations" +#~ msgstr "annotations" + +#~ msgid "TBD [1]_" +#~ msgstr "TBD [1]_" From 7165835b4fecfb0a3b4f3113d20f50afb74be9ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Aug 2025 00:20:45 +0000 Subject: [PATCH 5/5] sync with cpython d29a9c55 --- library/urllib.request.po | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/urllib.request.po b/library/urllib.request.po index 93b77f5e59..fc66a11e9c 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-23 00:17+0000\n" +"POT-Creation-Date: 2025-08-04 00:19+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-" @@ -1095,7 +1095,8 @@ msgid "the three-digit code of the error, as a string," msgstr "HTTP 錯誤的三位數代號字串," #: ../../library/urllib.request.rst:792 -msgid "the user-visible explanation of the code, as as string, and" +#, fuzzy +msgid "the user-visible explanation of the code, as a string, and" msgstr "HTTP 錯誤代號的使用者可見解釋字串,以及" #: ../../library/urllib.request.rst:793