@@ -61,128 +61,131 @@ msgid ""
6161"Awaiting on a coroutine. The following snippet of code will print \" hello\" "
6262" after waiting for 1 second, and then print \" world\" after waiting for "
6363"*another* 2 seconds::"
64- msgstr ""
64+ msgstr "等待一个协程。以下代码段会在等待 1 秒后打印 \" hello \" ,然后 *再次* 等待 2 秒后打印 \" world \" :: "
6565
6666#: ../../library/asyncio-task.rst:69
6767msgid "Expected output::"
68- msgstr ""
68+ msgstr "预期的输出:: "
6969
7070#: ../../library/asyncio-task.rst:76
7171msgid ""
7272"The :func:`asyncio.create_task` function to run coroutines concurrently as "
7373"asyncio :class:`Tasks <Task>`."
7474msgstr ""
75+ ":func:`asyncio.create_task` 函数用来并发运行作为 asyncio :class:`任务 <Task>` 的多个协程。"
7576
7677#: ../../library/asyncio-task.rst:79
7778msgid ""
7879"Let's modify the above example and run two ``say_after`` coroutines "
7980"*concurrently*::"
80- msgstr ""
81+ msgstr "让我们修改以上示例,*并发* 运行两个 ``say_after`` 协程:: "
8182
8283#: ../../library/asyncio-task.rst:98
8384msgid ""
8485"Note that expected output now shows that the snippet runs 1 second faster "
8586"than before::"
86- msgstr ""
87+ msgstr "注意,预期的输出显示代码段的运行时间比之前快了 1 秒:: "
8788
8889#: ../../library/asyncio-task.rst:110
8990msgid "Awaitables"
90- msgstr ""
91+ msgstr "可等待对象 "
9192
9293#: ../../library/asyncio-task.rst:112
9394msgid ""
9495"We say that an object is an **awaitable** object if it can be used in an "
9596":keyword:`await` expression. Many asyncio APIs are designed to accept "
9697"awaitables."
9798msgstr ""
99+ "如果一个对象可以在 :keyword:`await` 语句中使用,那么它就是 **可等待** 对象。许多 asyncio API "
100+ "都被设计为接受可等待对象。"
98101
99102#: ../../library/asyncio-task.rst:116
100103msgid ""
101104"There are three main types of *awaitable* objects: **coroutines**, "
102105"**Tasks**, and **Futures**."
103- msgstr ""
106+ msgstr "*可等待* 对象有三种主要类型: **协程**, **任务** 和 **Future**. "
104107
105108#: ../../library/asyncio-task.rst:122
106109msgid ""
107110"Python coroutines are *awaitables* and therefore can be awaited from other "
108111"coroutines::"
109- msgstr ""
112+ msgstr "Python 协程属于 *可等待* 对象,因此可以在其他协程中被等待:: "
110113
111114#: ../../library/asyncio-task.rst:143
112115msgid ""
113116"In this documentation the term \" coroutine\" can be used for two closely "
114117"related concepts:"
115- msgstr ""
118+ msgstr "在本文档中 \" 协程 \" 可用来表示两个紧密关联的概念: "
116119
117120#: ../../library/asyncio-task.rst:146
118121msgid "a *coroutine function*: an :keyword:`async def` function;"
119- msgstr ""
122+ msgstr "*协程函数*: 定义形式为 :keyword:`async def` 的函数; "
120123
121124#: ../../library/asyncio-task.rst:148
122125msgid ""
123126"a *coroutine object*: an object returned by calling a *coroutine function*."
124- msgstr ""
127+ msgstr "*协程对象*: 调用 *协程函数* 所返回的对象。 "
125128
126129#: ../../library/asyncio-task.rst:151
127130msgid ""
128131"asyncio also supports legacy :ref:`generator-based "
129132"<asyncio_generator_based_coro>` coroutines."
130- msgstr ""
133+ msgstr "asyncio 也支持旧式的 :ref:`基于生成器的 <asyncio_generator_based_coro>` 协程。 "
131134
132135#: ../../library/asyncio-task.rst:156
133136msgid "Tasks"
134- msgstr "Tasks "
137+ msgstr "任务 "
135138
136139#: ../../library/asyncio-task.rst:157
137140msgid "*Tasks* are used to schedule coroutines *concurrently*."
138- msgstr ""
141+ msgstr "*任务* 被用来设置日程以便 *并发* 执行协程。 "
139142
140143#: ../../library/asyncio-task.rst:159
141144msgid ""
142145"When a coroutine is wrapped into a *Task* with functions like "
143146":func:`asyncio.create_task` the coroutine is automatically scheduled to run "
144147"soon::"
145- msgstr ""
148+ msgstr "当一个协程通过 :func:`asyncio.create_task` 等函数被打包到一个 *任务*,该协程将自动排入日程准备立即执行:: "
146149
147150#: ../../library/asyncio-task.rst:181
148151msgid "Futures"
149- msgstr "Futures "
152+ msgstr "Future 对象 "
150153
151154#: ../../library/asyncio-task.rst:182
152155msgid ""
153156"A :class:`Future` is a special **low-level** awaitable object that "
154157"represents an **eventual result** of an asynchronous operation."
155- msgstr ""
158+ msgstr ":class:`Future` 是一种特殊的 **低层级** 可等待对象,表示一个异步操作的 **最终结果**。 "
156159
157160#: ../../library/asyncio-task.rst:185
158161msgid ""
159162"When a Future object is *awaited* it means that the coroutine will wait "
160163"until the Future is resolved in some other place."
161- msgstr ""
164+ msgstr "当一个 Future 对象 *被等待*,这意味着协程将保持等待直到该 Future 对象在其他地方操作完毕。 "
162165
163166#: ../../library/asyncio-task.rst:188
164167msgid ""
165168"Future objects in asyncio are needed to allow callback-based code to be used"
166169" with async/await."
167- msgstr ""
170+ msgstr "在 asyncio 中需要 Future 对象以便允许通过 async/await 使用基于回调的代码。 "
168171
169172#: ../../library/asyncio-task.rst:191
170173msgid ""
171174"Normally **there is no need** to create Future objects at the application "
172175"level code."
173- msgstr ""
176+ msgstr "通常情况下 **没有必要** 在应用层级的代码中创建 Future 对象。 "
174177
175178#: ../../library/asyncio-task.rst:194
176179msgid ""
177180"Future objects, sometimes exposed by libraries and some asyncio APIs, can be"
178181" awaited::"
179- msgstr ""
182+ msgstr "Future 对象有时会由库和某些 asyncio API 暴露给用户,用作可等待对象:: "
180183
181184#: ../../library/asyncio-task.rst:206
182185msgid ""
183186"A good example of a low-level function that returns a Future object is "
184187":meth:`loop.run_in_executor`."
185- msgstr ""
188+ msgstr "一个很好的返回对象的低层级函数的示例是 :meth:`loop.run_in_executor`。 "
186189
187190#: ../../library/asyncio-task.rst:211
188191msgid "Running an asyncio Program"
0 commit comments