-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathasyncio-future.po
361 lines (303 loc) · 14.5 KB
/
asyncio-future.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2022, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# MuSheng Chen <sheng.2179@gmail.com>, 2019
# Woko <banbooliu@gmail.com>, 2019
# Freesand Leo <yuqinju@163.com>, 2022
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.9\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-04 14:34+0000\n"
"PO-Revision-Date: 2018-09-18 00:23+0000\n"
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2022\n"
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../library/asyncio-future.rst:8
msgid "Futures"
msgstr "Futures"
#: ../../library/asyncio-future.rst:10
msgid ""
"**Source code:** :source:`Lib/asyncio/futures.py`, "
":source:`Lib/asyncio/base_futures.py`"
msgstr ""
"**源代码:** :source:`Lib/asyncio/futures.py`, "
":source:`Lib/asyncio/base_futures.py`"
#: ../../library/asyncio-future.rst:15
msgid ""
"*Future* objects are used to bridge **low-level callback-based code** with "
"high-level async/await code."
msgstr "*Future* 对象用来链接 **底层回调式代码** 和高层异步/等待式代码。"
#: ../../library/asyncio-future.rst:20
msgid "Future Functions"
msgstr "Future 函数"
#: ../../library/asyncio-future.rst:24
msgid "Return ``True`` if *obj* is either of:"
msgstr "如果 *obj* 为下面任意对象,返回 ``True``:"
#: ../../library/asyncio-future.rst:26
msgid "an instance of :class:`asyncio.Future`,"
msgstr "一个 :class:`asyncio.Future` 类的实例,"
#: ../../library/asyncio-future.rst:27
msgid "an instance of :class:`asyncio.Task`,"
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 的对象。"
#: ../../library/asyncio-future.rst:36
msgid "Return:"
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 ""
"a :class:`Task` object wrapping *obj*, if *obj* is a coroutine "
"(:func:`iscoroutine` is used for the test); in this case the coroutine will "
"be scheduled by ``ensure_future()``."
msgstr ""
"封装了 *obj* 的 :class:`Task` 对象,如果 *obj* 是一个协程 (使用 :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 "如果 *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 "查看 :func:`create_task` 函数,它是创建新任务的首选途径。"
#: ../../library/asyncio-future.rst:57
msgid ""
"Save a reference to the result of this function, to avoid a task "
"disappearing mid execution."
msgstr "保存一个指向此函数的结果的引用,以避免任务在执行期间消失。"
#: ../../library/asyncio-future.rst:60
msgid "The function accepts any :term:`awaitable` object."
msgstr "这个函数接受任意 :term:`awaitable` 对象。"
#: ../../library/asyncio-future.rst:66
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:71
msgid "Future Object"
msgstr "Future 对象"
#: ../../library/asyncio-future.rst:75
msgid ""
"A Future represents an eventual result of an asynchronous operation. Not "
"thread-safe."
msgstr "一个 Future 代表一个异步运算的最终结果。线程不安全。"
#: ../../library/asyncio-future.rst:78
msgid ""
"Future is an :term:`awaitable` object. Coroutines can await on Future "
"objects until they either have a result or an exception set, or until they "
"are cancelled."
msgstr "Future 是一个 :term:`awaitable` 对象。协程可以等待 Future 对象直到它们有结果或异常集合或被取消。"
#: ../../library/asyncio-future.rst:82
msgid ""
"Typically Futures are used to enable low-level callback-based code (e.g. in "
"protocols implemented using asyncio :ref:`transports <asyncio-transports-"
"protocols>`) to interoperate with high-level async/await code."
msgstr ""
"通常 Future 用于支持底层回调式代码(例如在协议实现中使用asyncio :ref:`transports<asyncio-transports-"
"protocols>`) 与高层异步/等待式代码交互。"
#: ../../library/asyncio-future.rst:87
msgid ""
"The rule of thumb is to never expose Future objects in user-facing APIs, and"
" the recommended way to create a Future object is to call "
":meth:`loop.create_future`. This way alternative event loop implementations"
" can inject their own optimized implementations of a Future object."
msgstr ""
"经验告诉我们永远不要面向用户的接口暴露 Future 对象,同时建议使用 :meth:`loop.create_future` 来创建 Future "
"对象。这种方法可以让 Future 对象使用其它的事件循环实现,它可以注入自己的优化实现。"
#: ../../library/asyncio-future.rst:93
msgid "Added support for the :mod:`contextvars` module."
msgstr "加入对 :mod:`contextvars` 模块的支持。"
#: ../../library/asyncio-future.rst:98
msgid "Return the result of the Future."
msgstr "返回 Future 的结果。"
#: ../../library/asyncio-future.rst:100
msgid ""
"If the Future is *done* and has a result set by the :meth:`set_result` "
"method, the result value is returned."
msgstr "如果 Future 状态为 *完成* ,并由 :meth:`set_result` 方法设置一个结果,则返回这个结果。"
#: ../../library/asyncio-future.rst:103
msgid ""
"If the Future is *done* and has an exception set by the "
":meth:`set_exception` method, this method raises the exception."
msgstr "如果 Future 状态为 *完成* ,并由 :meth:`set_exception` 方法设置一个异常,那么这个方法会引发异常。"
#: ../../library/asyncio-future.rst:106 ../../library/asyncio-future.rst:194
msgid ""
"If the Future has been *cancelled*, this method raises a "
":exc:`CancelledError` exception."
msgstr "如果 Future 已 *取消*,方法会引发一个 :exc:`CancelledError` 异常。"
#: ../../library/asyncio-future.rst:109
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:114
msgid "Mark the Future as *done* and set its result."
msgstr "将 Future 标记为 *完成* 并设置结果。"
#: ../../library/asyncio-future.rst:116 ../../library/asyncio-future.rst:123
msgid ""
"Raises a :exc:`InvalidStateError` error if the Future is already *done*."
msgstr "如果 Future 已经 *完成* 则抛出一个 :exc:`InvalidStateError` 错误。"
#: ../../library/asyncio-future.rst:121
msgid "Mark the Future as *done* and set an exception."
msgstr "将 Future 标记为 *完成* 并设置一个异常。"
#: ../../library/asyncio-future.rst:128
msgid "Return ``True`` if the Future is *done*."
msgstr "如果 Future 为已 *完成* 则返回 ``True`` 。"
#: ../../library/asyncio-future.rst:130
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 为 *取消* 或调用 :meth:`set_result` 设置了结果或调用 :meth:`set_exception` "
"设置了异常,那么它就是 *完成* 。"
#: ../../library/asyncio-future.rst:136
msgid "Return ``True`` if the Future was *cancelled*."
msgstr "如果 Future 已 *取消* 则返回 ``True`` "
#: ../../library/asyncio-future.rst:138
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 是否已 *取消* 。"
#: ../../library/asyncio-future.rst:146
msgid "Add a callback to be run when the Future is *done*."
msgstr "添加一个在 Future *完成* 时运行的回调函数。"
#: ../../library/asyncio-future.rst:148
msgid "The *callback* is called with the Future object as its only argument."
msgstr "调用 *callback* 时,Future 对象是它的唯一参数。"
#: ../../library/asyncio-future.rst:151
msgid ""
"If the Future is already *done* when this method is called, the callback is "
"scheduled with :meth:`loop.call_soon`."
msgstr "如果调用这个方法时 Future 已经 *完成*,回调函数会被 :meth:`loop.call_soon` 调度。"
#: ../../library/asyncio-future.rst:154
msgid ""
"An optional keyword-only *context* argument allows specifying a custom "
":class:`contextvars.Context` for the *callback* to run in. The current "
"context is used when no *context* is provided."
msgstr ""
"可选键值类的参数 *context* 允许 *callback* 运行在一个指定的自定义 :class:`contextvars.Context` "
"对象中。如果没有提供 *context* ,则使用当前上下文。"
#: ../../library/asyncio-future.rst:158
msgid ""
":func:`functools.partial` can be used to pass parameters to the callback, "
"e.g.::"
msgstr "可以用 :func:`functools.partial` 给回调函数传递参数,例如::"
#: ../../library/asyncio-future.rst:165
msgid ""
"The *context* keyword-only parameter was added. See :pep:`567` for more "
"details."
msgstr "加入键值类形参 *context*。请参阅 :pep:`567` 查看更多细节。"
#: ../../library/asyncio-future.rst:171
msgid "Remove *callback* from the callbacks list."
msgstr "从回调列表中移除 *callback* 。"
#: ../../library/asyncio-future.rst:173
msgid ""
"Returns the number of callbacks removed, which is typically 1, unless a "
"callback was added more than once."
msgstr "返回被移除的回调函数的数量,通常为1,除非一个回调函数被添加多次。"
#: ../../library/asyncio-future.rst:178
msgid "Cancel the Future and schedule callbacks."
msgstr "取消 Future 并调度回调函数。"
#: ../../library/asyncio-future.rst:180
msgid ""
"If the Future is already *done* or *cancelled*, return ``False``. Otherwise,"
" change the Future's state to *cancelled*, schedule the callbacks, and "
"return ``True``."
msgstr ""
"如果 Future 已经 *完成* 或 *取消* ,返回 ``False`` 。否则将 Future 状态改为 *取消* 并在调度回调函数后返回 "
"``True`` 。"
#: ../../library/asyncio-future.rst:184
msgid "Added the ``msg`` parameter."
msgstr "增加了 ``msg`` 形参。"
#: ../../library/asyncio-future.rst:189
msgid "Return the exception that was set on this Future."
msgstr "返回 Future 已设置的异常。"
#: ../../library/asyncio-future.rst:191
msgid ""
"The exception (or ``None`` if no exception was set) is returned only if the "
"Future is *done*."
msgstr "只有 Future 在 *完成* 时才返回异常(或者 ``None`` ,如果没有设置异常)。"
#: ../../library/asyncio-future.rst:197
msgid ""
"If the Future isn't *done* yet, this method raises an "
":exc:`InvalidStateError` exception."
msgstr "如果 Future 还没 *完成* ,这个方法会引发一个 :exc:`InvalidStateError` 异常。"
#: ../../library/asyncio-future.rst:202
msgid "Return the event loop the Future object is bound to."
msgstr "返回 Future 对象已绑定的事件循环。"
#: ../../library/asyncio-future.rst:209
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 对象,创建和调度一个异步任务去设置 Future 结果,然后等待其结果::"
#: ../../library/asyncio-future.rst:244
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:247
msgid ""
"unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot "
"be awaited."
msgstr "与 asyncio 的 Future 不同,:class:`concurrent.futures.Future` 实例不是可等待对象。"
#: ../../library/asyncio-future.rst:250
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:253
msgid ""
":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an "
":exc:`InvalidStateError` exception when the Future is not *done*."
msgstr ""
"Future 没有 *完成* 时 :meth:`asyncio.Future.result` 和 "
":meth:`asyncio.Future.exception` 抛出一个 :exc:`InvalidStateError` 异常。"
#: ../../library/asyncio-future.rst:257
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:261
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:265
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` 无此参数。"