-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathasyncio-dev.po
More file actions
499 lines (445 loc) · 17.5 KB
/
asyncio-dev.po
File metadata and controls
499 lines (445 loc) · 17.5 KB
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
# Rainer Terroso, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-31 14:15+0000\n"
"PO-Revision-Date: 2025-09-16 00:00+0000\n"
"Last-Translator: Rainer Terroso, 2025\n"
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/python-doc/"
"teams/5390/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % "
"1000000 == 0 ? 1 : 2;\n"
#: ../../library/asyncio-dev.rst:7
msgid "Developing with asyncio"
msgstr "Desenvolvendo com asyncio"
#: ../../library/asyncio-dev.rst:9
msgid ""
"Asynchronous programming is different from classic \"sequential\" "
"programming."
msgstr ""
"A programação assíncrona é diferente da programação “sequencial” clássica."
#: ../../library/asyncio-dev.rst:12
msgid ""
"This page lists common mistakes and traps and explains how to avoid them."
msgstr "Esta página lista erros e armadilhas comuns e explica como evitá-los."
#: ../../library/asyncio-dev.rst:19
msgid "Debug Mode"
msgstr "Modo de Depuração"
#: ../../library/asyncio-dev.rst:21
msgid ""
"By default asyncio runs in production mode. In order to ease the "
"development asyncio has a *debug mode*."
msgstr ""
"Por padrão, o asyncio é executado em modo de produção. Para facilitar o "
"desenvolvimento, o asyncio fornece um modo de depuração."
#: ../../library/asyncio-dev.rst:24
msgid "There are several ways to enable asyncio debug mode:"
msgstr "Há várias maneiras de habilitar o modo de depuração do asyncio:"
#: ../../library/asyncio-dev.rst:26
msgid "Setting the :envvar:`PYTHONASYNCIODEBUG` environment variable to ``1``."
msgstr ""
"Definindo a variável de ambiente :envvar:`PYTHONASYNCIODEBUG` como ``1``."
#: ../../library/asyncio-dev.rst:28
msgid "Using the :ref:`Python Development Mode <devmode>`."
msgstr "Usando o :ref:`Modo de Desenvolvimento do Python <devmode>`."
#: ../../library/asyncio-dev.rst:30
msgid "Passing ``debug=True`` to :func:`asyncio.run`."
msgstr "Passando ``debug=True`` para :func:`asyncio.run`."
#: ../../library/asyncio-dev.rst:32
msgid "Calling :meth:`loop.set_debug`."
msgstr "Chamando :meth:`loop.set_debug`."
#: ../../library/asyncio-dev.rst:34
msgid "In addition to enabling the debug mode, consider also:"
msgstr "Além de habilitar o modo de depuração, considere também:"
#: ../../library/asyncio-dev.rst:36
msgid ""
"setting the log level of the :ref:`asyncio logger <asyncio-logger>` to :py:"
"const:`logging.DEBUG`, for example the following snippet of code can be run "
"at startup of the application::"
msgstr ""
#: ../../library/asyncio-dev.rst:40
msgid "logging.basicConfig(level=logging.DEBUG)"
msgstr "logging.basicConfig(level=logging.DEBUG)"
#: ../../library/asyncio-dev.rst:42
msgid ""
"configuring the :mod:`warnings` module to display :exc:`ResourceWarning` "
"warnings. One way of doing that is by using the :option:`-W` ``default`` "
"command line option."
msgstr ""
"configurando o módulo :mod:`warnings` para exibir avisos :exc:"
"`ResourceWarning`. Uma forma de fazer isso é usando a opção de linha de "
"comando: :option:`-W` ``default``."
#: ../../library/asyncio-dev.rst:47
msgid "When the debug mode is enabled:"
msgstr "Quando o modo de depuração está habilitado:"
#: ../../library/asyncio-dev.rst:49
msgid ""
"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:"
"`loop.call_at` methods) raise an exception if they are called from a wrong "
"thread."
msgstr ""
"Muitas APIs do asyncio que não são thread-safe (como os métodos :meth:`loop."
"call_soon` e :meth:`loop.call_at`) levantam uma exceção se forem chamadas a "
"partir de uma thread incorreta."
#: ../../library/asyncio-dev.rst:53
msgid ""
"The execution time of the I/O selector is logged if it takes too long to "
"perform an I/O operation."
msgstr ""
"O tempo de execução de um seletor de E/S é registrado se demorar muito para "
"executar a operação E/S."
#: ../../library/asyncio-dev.rst:56
msgid ""
"Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop."
"slow_callback_duration` attribute can be used to set the minimum execution "
"duration in seconds that is considered \"slow\"."
msgstr ""
"Funções de retorno demorando mais do que 100 milissegundos são registradas. "
"O atributo :attr:`loop.slow_callback_duration` pode ser usado para definir a "
"duração de execução mínima em segundos para se considerada \"devagar\"."
#: ../../library/asyncio-dev.rst:64
msgid "Concurrency and Multithreading"
msgstr "Concorrência e Múltiplas Threads"
#: ../../library/asyncio-dev.rst:66
msgid ""
"An event loop runs in a thread (typically the main thread) and executes all "
"callbacks and Tasks in its thread. While a Task is running in the event "
"loop, no other Tasks can run in the same thread. When a Task executes an "
"``await`` expression, the running Task gets suspended, and the event loop "
"executes the next Task."
msgstr ""
"Um laço de eventos é executado em uma thread (geralmente a thread principal) "
"e executa todos as funções de retorno e Tasks nessa mesma thread. Enquanto "
"uma Task está em execução no laço de eventos, nenhuma outra Task pode ser "
"executada na mesma thread. Quando uma Task executa uma expressão ``await``, "
"a Task em execução é suspensa, e o laço de eventos passa a executar a "
"próxima Task."
#: ../../library/asyncio-dev.rst:72
msgid ""
"To schedule a :term:`callback` from another OS thread, the :meth:`loop."
"call_soon_threadsafe` method should be used. Example::"
msgstr ""
"Para agendar uma :term:`callback` de outra thread do SO, o método :meth:"
"`loop.call_soon_threadsafe` deve ser usado. Exemplo::"
#: ../../library/asyncio-dev.rst:75
msgid "loop.call_soon_threadsafe(callback, *args)"
msgstr "loop.call_soon_threadsafe(callback, *args)"
#: ../../library/asyncio-dev.rst:77
msgid ""
"Almost all asyncio objects are not thread safe, which is typically not a "
"problem unless there is code that works with them from outside of a Task or "
"a callback. If there's a need for such code to call a low-level asyncio "
"API, the :meth:`loop.call_soon_threadsafe` method should be used, e.g.::"
msgstr ""
"Quase todos os objetos do asyncio não são seguros para threads, o que "
"normalmente não é um problema, a menos que exista código que funcione com "
"eles fora de uma Task ou de um callback. Se houver a necessidade de esse "
"tipo de código chamar uma API de baixo nível do asyncio, o método :meth:"
"`loop.call_soon_threadsafe` deve ser usado, por exemplo::"
#: ../../library/asyncio-dev.rst:83
msgid "loop.call_soon_threadsafe(fut.cancel)"
msgstr "loop.call_soon_threadsafe(fut.cancel)"
#: ../../library/asyncio-dev.rst:85
msgid ""
"To schedule a coroutine object from a different OS thread, the :func:"
"`run_coroutine_threadsafe` function should be used. It returns a :class:"
"`concurrent.futures.Future` to access the result::"
msgstr ""
"Para agendar um objeto corrotina a partir de uma thread diferente do sistema "
"operacional, a função :func:`run_coroutine_threadsafe` deve ser usada. Ela "
"retorna um :class:`concurrent.futures.Future`. para acessar o resultado::"
#: ../../library/asyncio-dev.rst:89
msgid ""
"async def coro_func():\n"
" return await asyncio.sleep(1, 42)\n"
"\n"
"# Later in another OS thread:\n"
"\n"
"future = asyncio.run_coroutine_threadsafe(coro_func(), loop)\n"
"# Wait for the result:\n"
"result = future.result()"
msgstr ""
"async def coro_func():\n"
" return await asyncio.sleep(1, 42)\n"
"\n"
"# Later in another OS thread:\n"
"\n"
"future = asyncio.run_coroutine_threadsafe(coro_func(), loop)\n"
"# Wait for the result:\n"
"result = future.result()"
#: ../../library/asyncio-dev.rst:98
msgid "To handle signals the event loop must be run in the main thread."
msgstr ""
"Para manipular sinais, o laço de eventos deve ser executado na thread "
"principal."
#: ../../library/asyncio-dev.rst:101
msgid ""
"The :meth:`loop.run_in_executor` method can be used with a :class:"
"`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures."
"InterpreterPoolExecutor` to execute blocking code in a different OS thread "
"without blocking the OS thread that the event loop runs in."
msgstr ""
"O método :meth:`loop.run_in_executor` pode ser usado com um :class:"
"`concurrent.futures.ThreadPoolExecutor` ou :class:`~concurrent.futures."
"InterpreterPoolExecutor` para executar o código de bloqueio em uma thread de "
"sistema operacional diferente, sem bloquear a thread de sistema operacional "
"na qual o laço de eventos é executado."
#: ../../library/asyncio-dev.rst:107
msgid ""
"There is currently no way to schedule coroutines or callbacks directly from "
"a different process (such as one started with :mod:`multiprocessing`). The :"
"ref:`asyncio-event-loop-methods` section lists APIs that can read from pipes "
"and watch file descriptors without blocking the event loop. In addition, "
"asyncio's :ref:`Subprocess <asyncio-subprocess>` APIs provide a way to start "
"a process and communicate with it from the event loop. Lastly, the "
"aforementioned :meth:`loop.run_in_executor` method can also be used with a :"
"class:`concurrent.futures.ProcessPoolExecutor` to execute code in a "
"different process."
msgstr ""
#: ../../library/asyncio-dev.rst:121
msgid "Running Blocking Code"
msgstr "Executando código bloqueante"
#: ../../library/asyncio-dev.rst:123
msgid ""
"Blocking (CPU-bound) code should not be called directly. For example, if a "
"function performs a CPU-intensive calculation for 1 second, all concurrent "
"asyncio Tasks and IO operations would be delayed by 1 second."
msgstr ""
"O código bloqueante (vinculada à CPU) não deve ser chamado diretamente. Por "
"exemplo, se uma função executa um cálculo pesado de CPU durante 1 segundo, "
"todas as Tasks concorrentes do asyncio e as operações de E/S serão atrasadas "
"por 1 segundo."
#: ../../library/asyncio-dev.rst:128
msgid ""
"An executor can be used to run a task in a different thread, including in a "
"different interpreter, or even in a different process to avoid blocking the "
"OS thread with the event loop. See the :meth:`loop.run_in_executor` method "
"for more details."
msgstr ""
"Um executor pode ser usado para executar uma tarefa em uma thread diferente, "
"incluindo em um interpretador diferente, ou até mesmo em um processo "
"diferente, para evitar bloquear a thread do sistema operacional onde o laço "
"de eventos está sendo executado. Consulte o método :meth:`loop."
"run_in_executor` para mais detalhes."
#: ../../library/asyncio-dev.rst:138
msgid "Logging"
msgstr "Gerando logs"
#: ../../library/asyncio-dev.rst:140
msgid ""
"asyncio uses the :mod:`logging` module and all logging is performed via the "
"``\"asyncio\"`` logger."
msgstr ""
"asyncio usa o módulo :mod:`logging` e todo registro é feito via o "
"registrador ``\"asyncio\"``."
#: ../../library/asyncio-dev.rst:143
msgid ""
"The default log level is :py:const:`logging.INFO`, which can be easily "
"adjusted::"
msgstr ""
"O nível padrão de log é :py:const:`logging.INFO`, que pode ser facilmente "
"ajustado::"
#: ../../library/asyncio-dev.rst:146
msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)"
msgstr "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)"
#: ../../library/asyncio-dev.rst:149
msgid ""
"Network logging can block the event loop. It is recommended to use a "
"separate thread for handling logs or use non-blocking IO. For example, see :"
"ref:`blocking-handlers`."
msgstr ""
"Logging de rede pode bloquear o laço de eventos. Recomenda-se usar uma "
"thread separada para lidar com os logs ou usar E/S não bloqueante. Por "
"exemplo, veja :ref:`blocking-handlers`."
#: ../../library/asyncio-dev.rst:157
msgid "Detect never-awaited coroutines"
msgstr "Detectar corrotinas nunca aguardadas"
#: ../../library/asyncio-dev.rst:159
msgid ""
"When a coroutine function is called, but not awaited (e.g. ``coro()`` "
"instead of ``await coro()``) or the coroutine is not scheduled with :meth:"
"`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::"
msgstr ""
"Quando uma função de corrotina é chamada, mas não é aguardada (por exemplo, "
"``coro()`` em vez de ``await coro()``) ou a corrotina não é agendada com :"
"meth:`asyncio.create_task`, o asyncio emitirá um :exc:`RuntimeWarning`::"
#: ../../library/asyncio-dev.rst:164
msgid ""
"import asyncio\n"
"\n"
"async def test():\n"
" print(\"never scheduled\")\n"
"\n"
"async def main():\n"
" test()\n"
"\n"
"asyncio.run(main())"
msgstr ""
"import asyncio\n"
"\n"
"async def test():\n"
" print(\"never scheduled\")\n"
"\n"
"async def main():\n"
" test()\n"
"\n"
"asyncio.run(main())"
#: ../../library/asyncio-dev.rst:174 ../../library/asyncio-dev.rst:219
msgid "Output::"
msgstr "Saída::"
#: ../../library/asyncio-dev.rst:176
msgid ""
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
" test()"
msgstr ""
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
" test()"
#: ../../library/asyncio-dev.rst:179 ../../library/asyncio-dev.rst:235
msgid "Output in debug mode::"
msgstr "Saída no modo de depuração::"
#: ../../library/asyncio-dev.rst:181
msgid ""
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
"Coroutine created at (most recent call last)\n"
" File \"../t.py\", line 9, in <module>\n"
" asyncio.run(main(), debug=True)\n"
"\n"
" < .. >\n"
"\n"
" File \"../t.py\", line 7, in main\n"
" test()\n"
" test()"
msgstr ""
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
"Coroutine created at (most recent call last)\n"
" File \"../t.py\", line 9, in <module>\n"
" asyncio.run(main(), debug=True)\n"
"\n"
" < .. >\n"
"\n"
" File \"../t.py\", line 7, in main\n"
" test()\n"
" test()"
#: ../../library/asyncio-dev.rst:192
msgid ""
"The usual fix is to either await the coroutine or call the :meth:`asyncio."
"create_task` function::"
msgstr ""
"A correção usual é aguardar a corrotina ou chamar a função :meth:`asyncio."
"create_task`::"
#: ../../library/asyncio-dev.rst:195
msgid ""
"async def main():\n"
" await test()"
msgstr ""
"async def main():\n"
" await test()"
#: ../../library/asyncio-dev.rst:200
msgid "Detect never-retrieved exceptions"
msgstr "Detectar exceções nunca recuperadas"
#: ../../library/asyncio-dev.rst:202
msgid ""
"If a :meth:`Future.set_exception` is called but the Future object is never "
"awaited on, the exception would never be propagated to the user code. In "
"this case, asyncio would emit a log message when the Future object is "
"garbage collected."
msgstr ""
"Se um :meth:`Future.set_exception` é chamado, mas o objeto Future nunca é "
"aguardado, a exceção nunca será propagada para o código do usuário. Nesse "
"caso, o asyncio emitirá uma mensagem de log quando o objeto Future for "
"coletado pela coleta de lixo."
#: ../../library/asyncio-dev.rst:207
msgid "Example of an unhandled exception::"
msgstr "Exemplo de uma exceção não tratada::"
#: ../../library/asyncio-dev.rst:209
msgid ""
"import asyncio\n"
"\n"
"async def bug():\n"
" raise Exception(\"not consumed\")\n"
"\n"
"async def main():\n"
" asyncio.create_task(bug())\n"
"\n"
"asyncio.run(main())"
msgstr ""
"import asyncio\n"
"\n"
"async def bug():\n"
" raise Exception(\"not consumed\")\n"
"\n"
"async def main():\n"
" asyncio.create_task(bug())\n"
"\n"
"asyncio.run(main())"
#: ../../library/asyncio-dev.rst:221
msgid ""
"Task exception was never retrieved\n"
"future: <Task finished coro=<bug() done, defined at test.py:3>\n"
" exception=Exception('not consumed')>\n"
"\n"
"Traceback (most recent call last):\n"
" File \"test.py\", line 4, in bug\n"
" raise Exception(\"not consumed\")\n"
"Exception: not consumed"
msgstr ""
"Task exception was never retrieved\n"
"future: <Task finished coro=<bug() done, defined at test.py:3>\n"
" exception=Exception('not consumed')>\n"
"\n"
"Traceback (most recent call last):\n"
" File \"test.py\", line 4, in bug\n"
" raise Exception(\"not consumed\")\n"
"Exception: not consumed"
#: ../../library/asyncio-dev.rst:230
msgid ""
":ref:`Enable the debug mode <asyncio-debug-mode>` to get the traceback where "
"the task was created::"
msgstr ""
#: ../../library/asyncio-dev.rst:233
msgid "asyncio.run(main(), debug=True)"
msgstr "asyncio.run(main(), debug=True)"
#: ../../library/asyncio-dev.rst:237
msgid ""
"Task exception was never retrieved\n"
"future: <Task finished coro=<bug() done, defined at test.py:3>\n"
" exception=Exception('not consumed') created at asyncio/tasks.py:321>\n"
"\n"
"source_traceback: Object created at (most recent call last):\n"
" File \"../t.py\", line 9, in <module>\n"
" asyncio.run(main(), debug=True)\n"
"\n"
"< .. >\n"
"\n"
"Traceback (most recent call last):\n"
" File \"../t.py\", line 4, in bug\n"
" raise Exception(\"not consumed\")\n"
"Exception: not consumed"
msgstr ""
"Task exception was never retrieved\n"
"future: <Task finished coro=<bug() done, defined at test.py:3>\n"
" exception=Exception('not consumed') created at asyncio/tasks.py:321>\n"
"\n"
"source_traceback: Object created at (most recent call last):\n"
" File \"../t.py\", line 9, in <module>\n"
" asyncio.run(main(), debug=True)\n"
"\n"
"< .. >\n"
"\n"
"Traceback (most recent call last):\n"
" File \"../t.py\", line 4, in bug\n"
" raise Exception(\"not consumed\")\n"
"Exception: not consumed"