@@ -2286,16 +2286,24 @@ msgid ""
2286
2286
"method is set to ``None``. If *method* is ``None`` and *force* is ``False`` "
2287
2287
"then the context is set to the default context."
2288
2288
msgstr ""
2289
+ "Define o método que deve ser usado para iniciar processos filho. O argumento "
2290
+ "*method* pode ser ``'fork'``, ``'spawn'`` ou ``'forkserver'``. Levanta :exc:"
2291
+ "`RuntimeError` se o método de início já tiver sido definido e *force* não "
2292
+ "for ``True``. Se *method* for ``None`` e *force* for ``True``, o método de "
2293
+ "início será definido como ``None``. Se *method* for ``None`` e *force* for "
2294
+ "``False``, o contexto será definido como o contexto padrão."
2289
2295
2290
2296
#: ../../library/multiprocessing.rst:1150
2291
2297
msgid ""
2292
2298
"Note that this should be called at most once, and it should be protected "
2293
2299
"inside the ``if __name__ == '__main__'`` clause of the main module."
2294
2300
msgstr ""
2301
+ "Observe que isso deve ser chamado no máximo uma vez e deve ser protegido "
2302
+ "dentro da cláusula ``if __name__ == '__main__'`` do módulo principal."
2295
2303
2296
2304
#: ../../library/multiprocessing.rst:1154
2297
2305
msgid "See :ref:`multiprocessing-start-methods`."
2298
- msgstr ""
2306
+ msgstr "Veja :ref:`multiprocessing-start-methods`. "
2299
2307
2300
2308
#: ../../library/multiprocessing.rst:1160
2301
2309
msgid ""
@@ -2304,74 +2312,100 @@ msgid ""
2304
2312
"func:`threading.setprofile`, :class:`threading.Timer`, or :class:`threading."
2305
2313
"local`."
2306
2314
msgstr ""
2315
+ ":mod:`multiprocessing` contém nenhum análogo de :func:`threading."
2316
+ "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :"
2317
+ "func:`threading.setprofile`, :class:`threading.Timer` ou :class:`threading."
2318
+ "local`."
2307
2319
2308
2320
#: ../../library/multiprocessing.rst:1167
2309
2321
msgid "Connection Objects"
2310
- msgstr ""
2322
+ msgstr "Objetos de conexão "
2311
2323
2312
2324
#: ../../library/multiprocessing.rst:1171
2313
2325
msgid ""
2314
2326
"Connection objects allow the sending and receiving of picklable objects or "
2315
2327
"strings. They can be thought of as message oriented connected sockets."
2316
2328
msgstr ""
2329
+ "Objetos de conexão permitem o envio e recebimento de strings e objetos que "
2330
+ "podem ser serializados com pickle. Eles podem ser pensados como sockets "
2331
+ "conectados orientados a mensagens."
2317
2332
2318
2333
#: ../../library/multiprocessing.rst:1174
2319
2334
msgid ""
2320
2335
"Connection objects are usually created using :func:`Pipe <multiprocessing."
2321
2336
"Pipe>` -- see also :ref:`multiprocessing-listeners-clients`."
2322
2337
msgstr ""
2338
+ "Objetos de conexão geralmente são criados usando :func:`Pipe "
2339
+ "<multiprocessing.Pipe>` -- veja também :ref:`multiprocessing-listeners-"
2340
+ "clients`."
2323
2341
2324
2342
#: ../../library/multiprocessing.rst:1182
2325
2343
msgid ""
2326
2344
"Send an object to the other end of the connection which should be read "
2327
2345
"using :meth:`recv`."
2328
2346
msgstr ""
2347
+ "Envia um objeto para a outra extremidade da conexão que deve ser lido "
2348
+ "usando :meth:`recv`."
2329
2349
2330
2350
#: ../../library/multiprocessing.rst:1185
2331
2351
msgid ""
2332
2352
"The object must be picklable. Very large pickles (approximately 32 MiB+, "
2333
2353
"though it depends on the OS) may raise a :exc:`ValueError` exception."
2334
2354
msgstr ""
2355
+ "O objeto deve poder ser serializado com pickle. Serializações muito grandes "
2356
+ "com pickles (aproximadamente 32 MiB+, embora isso dependa do sistema "
2357
+ "operacional) podem levantar uma exceção :exc:`ValueError`."
2335
2358
2336
2359
#: ../../library/multiprocessing.rst:1190
2337
2360
msgid ""
2338
2361
"Return an object sent from the other end of the connection using :meth:"
2339
2362
"`send`. Blocks until there is something to receive. Raises :exc:`EOFError` "
2340
2363
"if there is nothing left to receive and the other end was closed."
2341
2364
msgstr ""
2365
+ "Retorna um objeto enviado a partir da outra extremidade da conexão usando :"
2366
+ "meth:`send`. Bloqueia até que haja algo para receber. Levanta :exc:"
2367
+ "`EOFError` se não houver mais nada para receber e a outra extremidade tenha "
2368
+ "sido fechada."
2342
2369
2343
2370
#: ../../library/multiprocessing.rst:1197
2344
2371
msgid "Return the file descriptor or handle used by the connection."
2345
- msgstr ""
2372
+ msgstr "Retorna o descritor de arquivo ou identificador usado pela conexão. "
2346
2373
2347
2374
#: ../../library/multiprocessing.rst:1201
2348
2375
msgid "Close the connection."
2349
- msgstr ""
2376
+ msgstr "Fecha a conexão. "
2350
2377
2351
2378
#: ../../library/multiprocessing.rst:1203
2352
2379
msgid "This is called automatically when the connection is garbage collected."
2353
- msgstr ""
2380
+ msgstr "Isso é chamado automaticamente quando a conexão é coletada como lixo. "
2354
2381
2355
2382
#: ../../library/multiprocessing.rst:1207
2356
2383
msgid "Return whether there is any data available to be read."
2357
- msgstr ""
2384
+ msgstr "Retorna se há algum dado disponível para leitura. "
2358
2385
2359
2386
#: ../../library/multiprocessing.rst:1209
2360
2387
msgid ""
2361
2388
"If *timeout* is not specified then it will return immediately. If *timeout* "
2362
2389
"is a number then this specifies the maximum time in seconds to block. If "
2363
2390
"*timeout* is ``None`` then an infinite timeout is used."
2364
2391
msgstr ""
2392
+ "Se *timeout* não for especificado, ele retornará imediatamente. Se *timeout* "
2393
+ "for um número, isso especificará o tempo máximo em segundos para bloquear. "
2394
+ "Se *timeout* for ``None``, um tempo limite infinito será usado."
2365
2395
2366
2396
#: ../../library/multiprocessing.rst:1213
2367
2397
msgid ""
2368
2398
"Note that multiple connection objects may be polled at once by using :func:"
2369
2399
"`multiprocessing.connection.wait`."
2370
2400
msgstr ""
2401
+ "Observe que vários objetos de conexão podem ser pesquisados ao mesmo tempo "
2402
+ "usando :func:`multiprocessing.connection.wait`."
2371
2403
2372
2404
#: ../../library/multiprocessing.rst:1218
2373
2405
msgid "Send byte data from a :term:`bytes-like object` as a complete message."
2374
2406
msgstr ""
2407
+ "Enviar dados de bytes de um :term:`objeto byte ou similar` como uma mensagem "
2408
+ "completa."
2375
2409
2376
2410
#: ../../library/multiprocessing.rst:1220
2377
2411
msgid ""
@@ -2380,6 +2414,10 @@ msgid ""
2380
2414
"buffers (approximately 32 MiB+, though it depends on the OS) may raise a :"
2381
2415
"exc:`ValueError` exception"
2382
2416
msgstr ""
2417
+ "Se *offset* for fornecido, os dados serão lidos daquela posição em *buffer*. "
2418
+ "Se *size* for fornecido, essa quantidade de bytes será lida do buffer. "
2419
+ "Buffers muito grandes (aproximadamente 32 MiB+, embora isso dependa do "
2420
+ "sistema operacional) podem levantar uma exceção :exc:`ValueError`"
2383
2421
2384
2422
#: ../../library/multiprocessing.rst:1227
2385
2423
msgid ""
@@ -2388,18 +2426,26 @@ msgid ""
2388
2426
"exc:`EOFError` if there is nothing left to receive and the other end has "
2389
2427
"closed."
2390
2428
msgstr ""
2429
+ "Retorna uma mensagem completa de dados como bytes enviados a partir da outra "
2430
+ "extremidade da conexão como uma string. Bloqueia até que haja algo para "
2431
+ "receber. Levanta :exc:`EOFError` se não houver mais nada para receber e a "
2432
+ "outra extremidade tenha sido fechada."
2391
2433
2392
2434
#: ../../library/multiprocessing.rst:1232
2393
2435
msgid ""
2394
2436
"If *maxlength* is specified and the message is longer than *maxlength* then :"
2395
2437
"exc:`OSError` is raised and the connection will no longer be readable."
2396
2438
msgstr ""
2439
+ "Se *maxlength* for especificado e a mensagem for maior que *maxlength*, :exc:"
2440
+ "`OSError` será levantada e a conexão não será mais legível."
2397
2441
2398
2442
#: ../../library/multiprocessing.rst:1236
2399
2443
msgid ""
2400
2444
"This function used to raise :exc:`IOError`, which is now an alias of :exc:"
2401
2445
"`OSError`."
2402
2446
msgstr ""
2447
+ "Esta função costumava levantada :exc:`IOError`, que agora é um apelido de :"
2448
+ "exc:`OSError`."
2403
2449
2404
2450
#: ../../library/multiprocessing.rst:1243
2405
2451
msgid ""
@@ -2408,33 +2454,50 @@ msgid ""
2408
2454
"until there is something to receive. Raises :exc:`EOFError` if there is "
2409
2455
"nothing left to receive and the other end was closed."
2410
2456
msgstr ""
2457
+ "Lê para *buffer* uma mensagem completa de dados como bytes enviados a partir "
2458
+ "da outra extremidade da conexão e retorna o número de bytes na mensagem. "
2459
+ "Bloqueia até que haja algo para receber. Levanta :exc:`EOFError` se não "
2460
+ "houver mais nada para receber e a outra extremidade tenha sido fechada."
2411
2461
2412
2462
#: ../../library/multiprocessing.rst:1249
2413
2463
msgid ""
2414
2464
"*buffer* must be a writable :term:`bytes-like object`. If *offset* is given "
2415
2465
"then the message will be written into the buffer from that position. Offset "
2416
2466
"must be a non-negative integer less than the length of *buffer* (in bytes)."
2417
2467
msgstr ""
2468
+ "*buffer* deve ser um :term:`objeto byte ou similar` gravável. Se *offset* "
2469
+ "for fornecido, a mensagem será escrita no buffer a partir dessa posição. A "
2470
+ "posição deve ser um inteiro não negativo menor que o comprimento de *buffer* "
2471
+ "(em bytes)."
2418
2472
2419
2473
#: ../../library/multiprocessing.rst:1254
2420
2474
msgid ""
2421
2475
"If the buffer is too short then a :exc:`BufferTooShort` exception is raised "
2422
2476
"and the complete message is available as ``e.args[0]`` where ``e`` is the "
2423
2477
"exception instance."
2424
2478
msgstr ""
2479
+ "Se o buffer for muito curto, uma exceção :exc:`BufferTooShort` será "
2480
+ "levantada e a mensagem completa estará disponível como ``e.args[0]``, onde "
2481
+ "``e`` é a instância da exceção."
2425
2482
2426
2483
#: ../../library/multiprocessing.rst:1258
2427
2484
msgid ""
2428
2485
"Connection objects themselves can now be transferred between processes "
2429
2486
"using :meth:`Connection.send` and :meth:`Connection.recv`."
2430
2487
msgstr ""
2488
+ "Os próprios objetos de conexão agora podem ser transferidos entre processos "
2489
+ "usando :meth:`Connection.send` e :meth:`Connection.recv`."
2431
2490
2432
2491
#: ../../library/multiprocessing.rst:1262
2433
2492
msgid ""
2434
2493
"Connection objects also now support the context management protocol -- see :"
2435
2494
"ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the "
2436
2495
"connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`."
2437
2496
msgstr ""
2497
+ "Objetos de conexão agora também oferecem suporte ao protocolo de "
2498
+ "gerenciamento de contexto — veja :ref:`typecontextmanager`. :meth:"
2499
+ "`~contextmanager.__enter__` retorna o objeto de conexão, e :meth:"
2500
+ "`~contextmanager.__exit__` chama :meth:`close`."
2438
2501
2439
2502
#: ../../library/multiprocessing.rst:1266
2440
2503
msgid "For example:"
@@ -2459,13 +2522,32 @@ msgid ""
2459
2522
">>> arr2\n"
2460
2523
"array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])"
2461
2524
msgstr ""
2525
+ ">>> from multiprocessing import Pipe\n"
2526
+ ">>> a, b = Pipe()\n"
2527
+ ">>> a.send([1, 'hello', None])\n"
2528
+ ">>> b.recv()\n"
2529
+ "[1, 'hello', None]\n"
2530
+ ">>> b.send_bytes(b'thank you')\n"
2531
+ ">>> a.recv_bytes()\n"
2532
+ "b'thank you'\n"
2533
+ ">>> import array\n"
2534
+ ">>> arr1 = array.array('i', range(5))\n"
2535
+ ">>> arr2 = array.array('i', [0] * 10)\n"
2536
+ ">>> a.send_bytes(arr1)\n"
2537
+ ">>> count = b.recv_bytes_into(arr2)\n"
2538
+ ">>> assert count == len(arr1) * arr1.itemsize\n"
2539
+ ">>> arr2\n"
2540
+ "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])"
2462
2541
2463
2542
#: ../../library/multiprocessing.rst:1291
2464
2543
msgid ""
2465
2544
"The :meth:`Connection.recv` method automatically unpickles the data it "
2466
2545
"receives, which can be a security risk unless you can trust the process "
2467
2546
"which sent the message."
2468
2547
msgstr ""
2548
+ "O método :meth:`Connection.recv` deserializa com picke automaticamente os "
2549
+ "dados recebidos, o que pode ser um risco à segurança, a menos que você possa "
2550
+ "confiar no processo que enviou a mensagem."
2469
2551
2470
2552
#: ../../library/multiprocessing.rst:1295
2471
2553
msgid ""
@@ -2474,24 +2556,35 @@ msgid ""
2474
2556
"methods after performing some sort of authentication. See :ref:"
2475
2557
"`multiprocessing-auth-keys`."
2476
2558
msgstr ""
2559
+ "Portanto, a menos que o objeto de conexão tenha sido produzido usando :func:"
2560
+ "`Pipe`, você deve usar apenas os métodos :meth:`~Connection.recv` e :meth:"
2561
+ "`~Connection.send` após executar algum tipo de autenticação. Veja :ref:"
2562
+ "`multiprocessing-auth-keys`."
2477
2563
2478
2564
#: ../../library/multiprocessing.rst:1302
2479
2565
msgid ""
2480
2566
"If a process is killed while it is trying to read or write to a pipe then "
2481
2567
"the data in the pipe is likely to become corrupted, because it may become "
2482
2568
"impossible to be sure where the message boundaries lie."
2483
2569
msgstr ""
2570
+ "Se um processo for encerrado enquanto estiver tentando ler ou escrever em um "
2571
+ "encadeamento, os dados no encadeameto provavelmente serão corrompidos, "
2572
+ "porque pode se tornar impossível ter certeza de onde estão os limites do "
2573
+ "encadeamento da mensagem."
2484
2574
2485
2575
#: ../../library/multiprocessing.rst:1308
2486
2576
msgid "Synchronization primitives"
2487
- msgstr ""
2577
+ msgstr "Primitivas de sincronização "
2488
2578
2489
2579
#: ../../library/multiprocessing.rst:1312
2490
2580
msgid ""
2491
2581
"Generally synchronization primitives are not as necessary in a multiprocess "
2492
2582
"program as they are in a multithreaded program. See the documentation for :"
2493
2583
"mod:`threading` module."
2494
2584
msgstr ""
2585
+ "Geralmente, primitivas de sincronização não são tão necessárias em um "
2586
+ "programa multiprocesso quanto em um programa multithread. Veja a "
2587
+ "documentação do módulo :mod:`threading`."
2495
2588
2496
2589
#: ../../library/multiprocessing.rst:1316
2497
2590
msgid ""
0 commit comments