diff --git a/library/asyncio-future.po b/library/asyncio-future.po index b8eaf6e876..a46476a4ec 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -1,26 +1,26 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # -#, fuzzy +# Translators: +# Matt Wang , 2022 msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-22 09:18+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2022-01-25 01:29+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.0.1\n" #: ../../library/asyncio-future.rst:8 msgid "Futures" -msgstr "" +msgstr "Futures" #: ../../library/asyncio-future.rst:10 msgid "" @@ -35,36 +35,40 @@ msgid "" "*Future* objects are used to bridge **low-level callback-based code** with " "high-level async/await code." msgstr "" +"*Future* 物件被用來連結\\ **低階回呼式程式**\\ 和高階 async/await 程式。" #: ../../library/asyncio-future.rst:20 msgid "Future Functions" -msgstr "" +msgstr "Future 函數" #: ../../library/asyncio-future.rst:24 msgid "Return ``True`` if *obj* is either of:" -msgstr "" +msgstr "如果 *obj* 為下面任意物件,回傳 ``True``\\ :" #: ../../library/asyncio-future.rst:26 msgid "an instance of :class:`asyncio.Future`," -msgstr "" +msgstr "一個 :class:`asyncio.Future` 的實例、" #: ../../library/asyncio-future.rst:27 msgid "an instance of :class:`asyncio.Task`," -msgstr "" +msgstr "一個 :class:`asyncio.Task` 的實例、" #: ../../library/asyncio-future.rst:28 msgid "a Future-like object with a ``_asyncio_future_blocking`` attribute." msgstr "" +"帶有 ``_asyncio_future_blocking`` 屬性的類 Future 物件 (Future-like object)。" #: ../../library/asyncio-future.rst:36 msgid "Return:" -msgstr "" +msgstr "回傳:" #: ../../library/asyncio-future.rst:38 msgid "" "*obj* argument as is, if *obj* is a :class:`Future`, a :class:`Task`, or a " "Future-like object (:func:`isfuture` is used for the test.)" msgstr "" +"*obj* 引數會保持原樣,\\ *obj* 須為 :class:`Future`\\ 、\\ :class:`Task` 或" +"類 Future 物件(可以用 :func:`isfuture` 來進行檢查。)" #: ../../library/asyncio-future.rst:42 msgid "" @@ -72,60 +76,72 @@ msgid "" "`iscoroutine` is used for the test); in this case the coroutine will be " "scheduled by ``ensure_future()``." msgstr "" +"包裝 (wrap) 了 *obj* 的 :class:`Task` 物件,如果 *obj* 是一個協程 " +"(coroutine) (可以用 :func:`iscoroutine` 來進行檢查);在此情況下該協程將透過 " +"``ensure_future()`` 來排程。" #: ../../library/asyncio-future.rst:47 msgid "" "a :class:`Task` object that would await on *obj*, if *obj* is an awaitable (:" "func:`inspect.isawaitable` is used for the test.)" msgstr "" +"一個會等待 *obj* 的 :class:`Task` 物件,\\ *obj* 須為一個可等待物件(\\ :" +"func:`inspect.isawaitable` 用於測試。)" #: ../../library/asyncio-future.rst:50 msgid "If *obj* is neither of the above a :exc:`TypeError` is raised." -msgstr "" +msgstr "如果 *obj* 不是上述物件的話會引發一個 :exc:`TypeError` 例外。" #: ../../library/asyncio-future.rst:54 msgid "" "See also the :func:`create_task` function which is the preferred way for " "creating new Tasks." -msgstr "" +msgstr "請見 :func:`create_task` 函式,它是建立新 Task 的推薦方法。" #: ../../library/asyncio-future.rst:57 msgid "" "Save a reference to the result of this function, to avoid a task " "disappearing mid execution." -msgstr "" +msgstr "將參照 (reference) 儲存至此函式的結果,用以防止任務在執行中消失。" #: ../../library/asyncio-future.rst:60 msgid "The function accepts any :term:`awaitable` object." -msgstr "" +msgstr "這個函式接受任意 :term:`awaitable` 物件。" #: ../../library/asyncio-future.rst:63 msgid "" "Deprecation warning is emitted if *obj* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" +"如果 *obj* 不是類 Future 物件且 *loop* 並未被指定,同時沒有正在執行的事件迴" +"圈 (event loop),則會發出棄用警告。" #: ../../library/asyncio-future.rst:70 msgid "" "Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio." "Future` object." msgstr "" +"將一個 :class:`concurrent.futures.Future` 物件包裝到 :class:`asyncio.Future` " +"物件中。" #: ../../library/asyncio-future.rst:73 msgid "" "Deprecation warning is emitted if *future* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" +"如果 *future* 不是類 Future 物件且 *loop* 未被指定,同時沒有正在執行的事件迴" +"圈,則會發出棄用警告。" #: ../../library/asyncio-future.rst:79 msgid "Future Object" -msgstr "" +msgstr "Future 物件" #: ../../library/asyncio-future.rst:83 msgid "" "A Future represents an eventual result of an asynchronous operation. Not " "thread-safe." msgstr "" +"一個 Future 代表一個非同步運算的最終結果。並不支援執行緒安全 (thread-safe)。" #: ../../library/asyncio-future.rst:86 msgid "" @@ -133,6 +149,8 @@ msgid "" "objects until they either have a result or an exception set, or until they " "are cancelled." msgstr "" +"Future 是一個 :term:`awaitable` 物件。協程可以等待 Future 物件直到它們有結果" +"或例外被設置、或者被取消。" #: ../../library/asyncio-future.rst:90 msgid "" @@ -140,6 +158,9 @@ msgid "" "protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." msgstr "" +"Future 通常用於讓低階基於回呼的程式(例如在協定實作中使用 asyncio :ref:" +"`transports `\\ )能夠與高階 async/await 程式互" +"動。" #: ../../library/asyncio-future.rst:95 msgid "" @@ -148,91 +169,108 @@ msgid "" "create_future`. This way alternative event loop implementations can inject " "their own optimized implementations of a Future object." msgstr "" +"經驗法則為永遠不要在提供給使用者的 API 中公開 Future 物件,同時建議使用 :" +"meth:`loop.create_future` 來建立 Future 物件。如此一來,不同實作的事件迴圈可" +"以注入自己最佳化實作的 Future 物件。" #: ../../library/asyncio-future.rst:101 msgid "Added support for the :mod:`contextvars` module." -msgstr "" +msgstr "加入對 :mod:`contextvars` 模組的支援。" #: ../../library/asyncio-future.rst:104 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." -msgstr "" +msgstr "如果未指定 *loop* 並且沒有正在執行的事件迴圈則會發出棄用警告。" #: ../../library/asyncio-future.rst:110 msgid "Return the result of the Future." -msgstr "" +msgstr "回傳 Future 的結果。" #: ../../library/asyncio-future.rst:112 msgid "" "If the Future is *done* and has a result set by the :meth:`set_result` " "method, the result value is returned." msgstr "" +"如果 Future 狀態為 *done*\\ (完成),並擁有 :meth:`set_result` 方法設定的一" +"個結果,則回傳該結果之值。" #: ../../library/asyncio-future.rst:115 msgid "" "If the Future is *done* and has an exception set by the :meth:" "`set_exception` method, this method raises the exception." msgstr "" +"如果 Future 狀態為 *done*\\ ,並擁有 :meth:`set_exception` 方法設定的一個例" +"外,那麼這個方法會引發該例外。" #: ../../library/asyncio-future.rst:118 ../../library/asyncio-future.rst:206 msgid "" "If the Future has been *cancelled*, this method raises a :exc:" "`CancelledError` exception." msgstr "" +"如果 Future 已被 *cancelled*\\ (取消),此方法會引發一個 :exc:" +"`CancelledError` 例外。" #: ../../library/asyncio-future.rst:121 msgid "" "If the Future's result isn't yet available, this method raises a :exc:" "`InvalidStateError` exception." msgstr "" +"如果 Future 的結果還不可用,此方法會引發一個 :exc:`InvalidStateError` 例外。" #: ../../library/asyncio-future.rst:126 msgid "Mark the Future as *done* and set its result." -msgstr "" +msgstr "將 Future 標記為 *done* 並設定其結果。" #: ../../library/asyncio-future.rst:128 ../../library/asyncio-future.rst:135 msgid "" "Raises a :exc:`InvalidStateError` error if the Future is already *done*." -msgstr "" +msgstr "如果 Future 已經 *done* 則引發一個 :exc:`InvalidStateError` 錯誤。" #: ../../library/asyncio-future.rst:133 msgid "Mark the Future as *done* and set an exception." -msgstr "" +msgstr "將 Future 標記為 *done* 並設定一個例外。" #: ../../library/asyncio-future.rst:140 msgid "Return ``True`` if the Future is *done*." -msgstr "" +msgstr "如果 Future 已為 *done* 則回傳 ``True``\\ 。" #: ../../library/asyncio-future.rst:142 msgid "" "A Future is *done* if it was *cancelled* or if it has a result or an " "exception set with :meth:`set_result` or :meth:`set_exception` calls." msgstr "" +"如果 Future 有被 *cancelled*\\ 、\\ :meth:`set_result` 有被呼叫來為其設定結" +"果、或 :meth:`set_exception` 有被呼叫為其設定例外,那麼它就是 *done*\\ 。" #: ../../library/asyncio-future.rst:148 msgid "Return ``True`` if the Future was *cancelled*." -msgstr "" +msgstr "如果 Future 已經被 *cancelled* 則回傳 ``True``\\ 。" #: ../../library/asyncio-future.rst:150 msgid "" "The method is usually used to check if a Future is not *cancelled* before " "setting a result or an exception for it::" msgstr "" +"這個方法通常在為 Future 設定結果或例外前用來確認它還沒被 *cancelled*\\ :\n" +"\n" +"::" #: ../../library/asyncio-future.rst:158 msgid "Add a callback to be run when the Future is *done*." -msgstr "" +msgstr "新增一個在 Future 為 *done* 時執行的回呼函式。" #: ../../library/asyncio-future.rst:160 msgid "The *callback* is called with the Future object as its only argument." -msgstr "" +msgstr "呼叫 *callback* 並附帶做為唯一引數的 Future 物件。" #: ../../library/asyncio-future.rst:163 msgid "" "If the Future is already *done* when this method is called, the callback is " "scheduled with :meth:`loop.call_soon`." msgstr "" +"如果呼叫這個方法時 Future 已經為 *done*\\ ,回呼函式會被 :meth:`loop." +"call_soon` 排程。" #: ../../library/asyncio-future.rst:166 msgid "" @@ -240,32 +278,37 @@ msgid "" "class:`contextvars.Context` for the *callback* to run in. The current " "context is used when no *context* is provided." msgstr "" +"可選僅限關鍵字引數 *context* 用來指定一個讓 *callback* 執行於其中的客製化 :" +"class:`contextvars.Context` 物件。如果沒有提供 *context*\\ ,則使用當前情境。" #: ../../library/asyncio-future.rst:170 msgid "" ":func:`functools.partial` can be used to pass parameters to the callback, e." "g.::" msgstr "" +"可以用 :func:`functools.partial` 傳遞引數給回呼函式,例如:\n" +"\n" +"::" #: ../../library/asyncio-future.rst:177 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." -msgstr "" +msgstr "加入僅限關鍵字參數 *context*\\ 。更多細節請參閱 :pep:`567`\\ 。" #: ../../library/asyncio-future.rst:183 msgid "Remove *callback* from the callbacks list." -msgstr "" +msgstr "從回呼列表中移除 *callback*\\ 。" #: ../../library/asyncio-future.rst:185 msgid "" "Returns the number of callbacks removed, which is typically 1, unless a " "callback was added more than once." -msgstr "" +msgstr "回傳被移除的回呼函式數量,通常為 1,除非一個回呼函式被多次加入。" #: ../../library/asyncio-future.rst:190 msgid "Cancel the Future and schedule callbacks." -msgstr "" +msgstr "取消 Future 並為回呼函式排程。" #: ../../library/asyncio-future.rst:192 msgid "" @@ -273,6 +316,8 @@ msgid "" "change the Future's state to *cancelled*, schedule the callbacks, and return " "``True``." msgstr "" +"如果 Future 已經是 *done* 或 *cancelled*\\ ,回傳 ``False``\\ 。否則將 " +"Future 狀態改為 *cancelled* 並在為回呼函式排程後回傳 ``True``\\ 。" #: ../../library/asyncio-future.rst:196 msgid "Added the ``msg`` parameter." @@ -280,68 +325,89 @@ msgstr "新增 ``msg`` 參數。" #: ../../library/asyncio-future.rst:201 msgid "Return the exception that was set on this Future." -msgstr "" +msgstr "回傳被設定於此 Future 的例外。" #: ../../library/asyncio-future.rst:203 msgid "" "The exception (or ``None`` if no exception was set) is returned only if the " "Future is *done*." msgstr "" +"只有 Future 在 *done* 時才回傳例外(如果沒有設定例外則回傳 ``None``\\ )。" #: ../../library/asyncio-future.rst:209 msgid "" "If the Future isn't *done* yet, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" +"如果 Future 還不為 *done*\\ ,此方法會引發一個 :exc:`InvalidStateError` 例" +"外。" #: ../../library/asyncio-future.rst:214 msgid "Return the event loop the Future object is bound to." -msgstr "" +msgstr "回傳已被 Future 物件繫結 (bind) 的事件迴圈。" #: ../../library/asyncio-future.rst:221 msgid "" "This example creates a Future object, creates and schedules an asynchronous " "Task to set result for the Future, and waits until the Future has a result::" msgstr "" +"這個例子建立一個 Future 物件,建立一個非同步 Task 並為其排程以設定 Future 結" +"果,然後等待 Future 結果出現:\n" +"\n" +"::" #: ../../library/asyncio-future.rst:256 msgid "" "The Future object was designed to mimic :class:`concurrent.futures.Future`. " "Key differences include:" msgstr "" +"該 Future 物件是為了模仿 :class:`concurrent.futures.Future` 而設計。主要差異" +"包含:" #: ../../library/asyncio-future.rst:259 msgid "" "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " "be awaited." msgstr "" +"與 asyncio 的 Future 不同,\\ :class:`concurrent.futures.Future` 實例不可被等" +"待。" #: ../../library/asyncio-future.rst:262 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " "accept the *timeout* argument." msgstr "" +":meth:`asyncio.Future.result` 和 :meth:`asyncio.Future.exception` 不接受 " +"*timeout* 引數。" #: ../../library/asyncio-future.rst:265 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :" "exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" +"Future 不為 *done* 時 :meth:`asyncio.Future.result` 和 :meth:`asyncio.Future." +"exception` 會引發一個 :exc:`InvalidStateError` 例外。" #: ../../library/asyncio-future.rst:269 msgid "" "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " "called immediately. They are scheduled with :meth:`loop.call_soon` instead." msgstr "" +"使用 :meth:`asyncio.Future.add_done_callback` 註冊的回呼函式不會立即呼叫,而" +"是被 :meth:`loop.call_soon` 排程。" #: ../../library/asyncio-future.rst:273 msgid "" "asyncio Future is not compatible with the :func:`concurrent.futures.wait` " "and :func:`concurrent.futures.as_completed` functions." msgstr "" +"asyncio Future 不能與 :func:`concurrent.futures.wait` 和 :func:`concurrent." +"futures.as_completed` 函式相容。" #: ../../library/asyncio-future.rst:277 msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "func:`concurrent.futures.cancel` does not." msgstr "" +":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數,但 :func:" +"`concurrent.futures.cancel` 無此引數。"