-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathlibrary.po
More file actions
1111 lines (969 loc) · 47 KB
/
library.po
File metadata and controls
1111 lines (969 loc) · 47 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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Hildeberto Abreu Magalhães <hildeberto@gmail.com>, 2020
# Claudio Rogerio Carvalho Filho <excriptbrasil@gmail.com>, 2020
# Adson Rodrigues <adson.develop@gmail.com>, 2020
# Alexandre B A Villares, 2020
# Mariana Costa <mrncstt@gmail.com>, 2020
# a76d6fb6142d7607ab0526dcbddb02d7_7bf0da0 <3b5fb0f281c8dfb4c0170f2ee2a6cfcf_843623>, 2020
# Rafael Fontenelle <rffontenelle@gmail.com>, 2024
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-06 22:14+0000\n"
"PO-Revision-Date: 2020-05-30 11:53+0000\n"
"Last-Translator: Rafael Fontenelle <rffontenelle@gmail.com>, 2024\n"
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/python-doc/"
"teams/5390/pt_BR/)\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % "
"1000000 == 0 ? 1 : 2;\n"
#: ../../faq/library.rst:5
msgid "Library and Extension FAQ"
msgstr "FAQ de Bibliotecas e Extensões"
#: ../../faq/library.rst:8
msgid "Contents"
msgstr "Conteúdo"
#: ../../faq/library.rst:12
msgid "General Library Questions"
msgstr "Questões gerais sobre bibliotecas"
#: ../../faq/library.rst:15
msgid "How do I find a module or application to perform task X?"
msgstr "Como encontrar um módulo ou aplicação para realizar uma tarefa X?"
#: ../../faq/library.rst:17
msgid ""
"Check :ref:`the Library Reference <library-index>` to see if there's a "
"relevant standard library module. (Eventually you'll learn what's in the "
"standard library and will be able to skip this step.)"
msgstr ""
"Verifique :ref:`a Referência de Bibliotecas <library-index>` para ver se há "
"um módulo relevante da biblioteca padrão. (Eventualmente, você aprenderá o "
"que está na biblioteca padrão e poderá pular esta etapa.)"
#: ../../faq/library.rst:21
msgid ""
"For third-party packages, search the `Python Package Index <https://"
"pypi.org>`_ or try `Google <https://www.google.com>`_ or another Web search "
"engine. Searching for \"Python\" plus a keyword or two for your topic of "
"interest will usually find something helpful."
msgstr ""
"Para pacotes de terceiros, pesquise no `Python Package Index <https://"
"pypi.org>`_ ou tente no `Google <https://www.google.com>`_ ou outro buscador "
"na Web. Pesquisando por \"Python\" mais uma ou dois argumentos nomeados do "
"seu tópico de interesse geralmente encontrará algo útil."
#: ../../faq/library.rst:28
msgid "Where is the math.py (socket.py, regex.py, etc.) source file?"
msgstr "Onde está o código-fonte do math.py (socket.py, regex.py, etc.)?"
#: ../../faq/library.rst:30
msgid ""
"If you can't find a source file for a module it may be a built-in or "
"dynamically loaded module implemented in C, C++ or other compiled language. "
"In this case you may not have the source file or it may be something "
"like :file:`mathmodule.c`, somewhere in a C source directory (not on the "
"Python Path)."
msgstr ""
"Se você não conseguir encontrar um arquivo de origem para um módulo, ele "
"pode ser um módulo embutido ou carregado dinamicamente, implementado em C, C+"
"+ ou outra linguagem compilada. Nesse caso, você pode não ter o arquivo de "
"origem ou pode ser algo como :file:`mathmodule.c`, em algum lugar do "
"diretório de origem C (não no caminho do Python)."
#: ../../faq/library.rst:35
msgid "There are (at least) three kinds of modules in Python:"
msgstr "Existem (pelo menos) três tipos de módulos no Python:"
#: ../../faq/library.rst:37
msgid "modules written in Python (.py);"
msgstr "módulos escritos em Python (.py)"
#: ../../faq/library.rst:38
msgid ""
"modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc);"
msgstr ""
"módulos escritos em C e carregados dinamicamente (.dll, .pyd, .so, .sl, "
"etc.);"
#: ../../faq/library.rst:39
msgid ""
"modules written in C and linked with the interpreter; to get a list of "
"these, type::"
msgstr ""
"módulos escritos em C e vinculados ao interpretador; para obter uma dessas "
"listas, digite::"
#: ../../faq/library.rst:47
msgid "How do I make a Python script executable on Unix?"
msgstr "Como tornar um script Python executável no Unix?"
#: ../../faq/library.rst:49
msgid ""
"You need to do two things: the script file's mode must be executable and the "
"first line must begin with ``#!`` followed by the path of the Python "
"interpreter."
msgstr ""
"Você precisa fazer duas coisas: o arquivo do script deve ser executável e a "
"primeira linha deve começar com ``#!`` seguido do caminho do interpretador "
"Python."
#: ../../faq/library.rst:53
msgid ""
"The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod "
"755 scriptfile``."
msgstr ""
"Inicialmente, execute o ``chmod +x scriptfile`` ou, talvez, o ``chmod 755 "
"scriptfile``."
#: ../../faq/library.rst:56
msgid ""
"The second can be done in a number of ways. The most straightforward way is "
"to write ::"
msgstr ""
"A segunda coisa pode ser feita de várias maneiras. A maneira mais direta é "
"escrever ::"
#: ../../faq/library.rst:61
msgid ""
"as the very first line of your file, using the pathname for where the Python "
"interpreter is installed on your platform."
msgstr ""
"como a primeira linha do seu arquivo, usando o endereço do caminho onde o "
"interpretador Python está instalado."
#: ../../faq/library.rst:64
msgid ""
"If you would like the script to be independent of where the Python "
"interpreter lives, you can use the :program:`env` program. Almost all Unix "
"variants support the following, assuming the Python interpreter is in a "
"directory on the user's :envvar:`PATH`::"
msgstr ""
"Se você deseja que o script seja independente de onde o interpretador Python "
"mora, você pode usar o programa :program:`env`. Quase todas as variantes do "
"Unix suportam o seguinte, presumindo que o interpretador Python esteja em um "
"diretório no :envvar:`PATH` do usuário::"
#: ../../faq/library.rst:71
msgid ""
"*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI "
"scripts is often very minimal, so you need to use the actual absolute "
"pathname of the interpreter."
msgstr ""
"Não faça isso para CGI scripts. A variável :envvar:`PATH` para CGI scripts é "
"normalmente muito pequena, portanto, você precisa usar o caminho completo do "
"interpretador."
#: ../../faq/library.rst:75
msgid ""
"Occasionally, a user's environment is so full that the :program:`/usr/bin/"
"env` program fails; or there's no env program at all. In that case, you can "
"try the following hack (due to Alex Rezinsky):"
msgstr ""
"Ocasionalmente, o ambiente de um usuário está tão cheio que o "
"programa :program:`/usr/bin/env` falha; ou não há nenhum programa env. Nesse "
"caso, você pode tentar o seguinte hack (graças a Alex Rezinsky):"
#: ../../faq/library.rst:86
msgid ""
"The minor disadvantage is that this defines the script's __doc__ string. "
"However, you can fix that by adding ::"
msgstr ""
"Uma pequena desvantagem é que isso define o script's __doc__ string. "
"Entretanto, você pode corrigir isso adicionando ::"
#: ../../faq/library.rst:94
msgid "Is there a curses/termcap package for Python?"
msgstr "Existe um pacote de curses/termcap para Python?"
#: ../../faq/library.rst:98
msgid ""
"For Unix variants: The standard Python source distribution comes with a "
"curses module in the :source:`Modules` subdirectory, though it's not "
"compiled by default. (Note that this is not available in the Windows "
"distribution -- there is no curses module for Windows.)"
msgstr ""
"Para variantes Unix: A distribuição fonte padrão do Python vem com um módulo "
"do curses no subdiretório :source:`Modules`, embora não seja compilado por "
"padrão. (Observe que isso não está disponível na distribuição do Windows -- "
"não há módulo curses para o Windows.)"
#: ../../faq/library.rst:103
msgid ""
"The :mod:`curses` module supports basic curses features as well as many "
"additional functions from ncurses and SYSV curses such as colour, "
"alternative character set support, pads, and mouse support. This means the "
"module isn't compatible with operating systems that only have BSD curses, "
"but there don't seem to be any currently maintained OSes that fall into this "
"category."
msgstr ""
"O módulo :mod:`curses` provê recursos básicos de curses, bem como muitas "
"funções adicionais de ncurses e curses SYSV, como cor, suporte a conjuntos "
"de caracteres alternativos, pads e suporte a mouse. Isso significa que o "
"módulo não é compatível com sistemas operacionais que possuem apenas "
"maldições BSD, mas não parece haver nenhum sistema operacional mantido "
"atualmente que se enquadre nesta categoria."
#: ../../faq/library.rst:109
msgid ""
"For Windows: use `the consolelib module <http://effbot.org/zone/console-"
"index.htm>`_."
msgstr ""
"Para Windows: use `o módulo consolelib <http://effbot.org/zone/console-"
"index.htm>`_."
#: ../../faq/library.rst:114
msgid "Is there an equivalent to C's onexit() in Python?"
msgstr "Existe a função onexit() equivalente ao C no Python?"
#: ../../faq/library.rst:116
msgid ""
"The :mod:`atexit` module provides a register function that is similar to "
"C's :c:func:`onexit`."
msgstr ""
"O módulo :mod:`atexit` fornece uma função de registro similar "
"ao :c:func:`onexit` do C."
#: ../../faq/library.rst:121
msgid "Why don't my signal handlers work?"
msgstr "Por que o meu manipulador de sinal não funciona?"
#: ../../faq/library.rst:123
msgid ""
"The most common problem is that the signal handler is declared with the "
"wrong argument list. It is called as ::"
msgstr ""
"O maior problema é que o manipulador de sinal é declarado com uma lista de "
"argumentos incorretos. Isso é chamado como ::"
#: ../../faq/library.rst:128
msgid "so it should be declared with two arguments::"
msgstr "portanto, isso deve ser declarado com dois argumentos::"
#: ../../faq/library.rst:135
msgid "Common tasks"
msgstr "Tarefas comuns"
#: ../../faq/library.rst:138
msgid "How do I test a Python program or component?"
msgstr "Como testar um programa ou componente Python?"
#: ../../faq/library.rst:140
msgid ""
"Python comes with two testing frameworks. The :mod:`doctest` module finds "
"examples in the docstrings for a module and runs them, comparing the output "
"with the expected output given in the docstring."
msgstr ""
"A Python vem com dois frameworks de teste. O módulo :mod:`doctest` busca por "
"exemplos nas docstrings de um módulo e os executa, comparando o resultado "
"com a saída esperada informada na docstring."
#: ../../faq/library.rst:144
msgid ""
"The :mod:`unittest` module is a fancier testing framework modelled on Java "
"and Smalltalk testing frameworks."
msgstr ""
"O módulo :mod:`unittest` é uma estrutura de teste mais sofisticada, modelada "
"nas estruturas de teste do Java e do Smalltalk."
#: ../../faq/library.rst:147
msgid ""
"To make testing easier, you should use good modular design in your program. "
"Your program should have almost all functionality encapsulated in either "
"functions or class methods -- and this sometimes has the surprising and "
"delightful effect of making the program run faster (because local variable "
"accesses are faster than global accesses). Furthermore the program should "
"avoid depending on mutating global variables, since this makes testing much "
"more difficult to do."
msgstr ""
"Para facilitar os testes, você deve usar um bom design modular em seu "
"programa. Seu programa deve ter quase todas as funcionalidades encapsuladas "
"em funções ou métodos de classe -- e isso às vezes tem o efeito "
"surpreendente e agradável de fazer o programa executar mais rápido (porque "
"os acessos às variáveis locais são mais rápidos que os acessos globais). "
"Além disso, o programa deve evitar depender de variáveis globais mutantes, "
"pois isso torna os testes muito mais difíceis de serem realizados."
#: ../../faq/library.rst:155
msgid "The \"global main logic\" of your program may be as simple as ::"
msgstr "A lógica principal do seu programa pode tão simples quanto ::"
#: ../../faq/library.rst:160
msgid "at the bottom of the main module of your program."
msgstr "no botão do módulo principal do seus programa."
#: ../../faq/library.rst:162
msgid ""
"Once your program is organized as a tractable collection of functions and "
"class behaviours you should write test functions that exercise the "
"behaviours. A test suite that automates a sequence of tests can be "
"associated with each module. This sounds like a lot of work, but since "
"Python is so terse and flexible it's surprisingly easy. You can make coding "
"much more pleasant and fun by writing your test functions in parallel with "
"the \"production code\", since this makes it easy to find bugs and even "
"design flaws earlier."
msgstr ""
#: ../../faq/library.rst:170
msgid ""
"\"Support modules\" that are not intended to be the main module of a program "
"may include a self-test of the module. ::"
msgstr ""
"Os \"módulos de suporte\" que não se destinam a ser o módulo principal de um "
"programa podem incluir um autoteste do módulo. ::"
#: ../../faq/library.rst:176
msgid ""
"Even programs that interact with complex external interfaces may be tested "
"when the external interfaces are unavailable by using \"fake\" interfaces "
"implemented in Python."
msgstr ""
"Mesmo quando as interfaces externas não estiverem disponíveis, os programas "
"que interagem com interfaces externas complexas podem ser testados usando as "
"interfaces \"falsas\" implementadas no Python."
#: ../../faq/library.rst:182
msgid "How do I create documentation from doc strings?"
msgstr "Como faço para criar uma documentação de doc strings?"
#: ../../faq/library.rst:184
msgid ""
"The :mod:`pydoc` module can create HTML from the doc strings in your Python "
"source code. An alternative for creating API documentation purely from "
"docstrings is `epydoc <http://epydoc.sourceforge.net/>`_. `Sphinx <http://"
"sphinx-doc.org>`_ can also include docstring content."
msgstr ""
#: ../../faq/library.rst:191
msgid "How do I get a single keypress at a time?"
msgstr "Como faço para pressionar uma tecla de cada vez?"
#: ../../faq/library.rst:193
msgid ""
"For Unix variants there are several solutions. It's straightforward to do "
"this using curses, but curses is a fairly large module to learn."
msgstr ""
"Para variantes do Unix existem várias soluções. Apesar de ser um módulo "
"grande para aprender, é simples fazer isso usando o módulo curses."
#: ../../faq/library.rst:237
msgid "Threads"
msgstr "Threads"
#: ../../faq/library.rst:240
msgid "How do I program using threads?"
msgstr "Como faço para programar usando threads?"
#: ../../faq/library.rst:242
msgid ""
"Be sure to use the :mod:`threading` module and not the :mod:`_thread` "
"module. The :mod:`threading` module builds convenient abstractions on top of "
"the low-level primitives provided by the :mod:`_thread` module."
msgstr ""
"Certifique-se de usar o módulo :mod:`threading` e não o "
"módulo :mod:`_thread`. O módulo :mod:`threading` constrói abstrações "
"convenientes sobre as primitivas de baixo nível fornecidas pelo "
"módulo :mod:`_thread`."
#: ../../faq/library.rst:246
msgid ""
"Aahz has a set of slides from his threading tutorial that are helpful; see "
"http://www.pythoncraft.com/OSCON2001/."
msgstr ""
"Aahz tem um conjunto de tutoriais threading que são úteis; veja em: http://"
"www.pythoncraft.com/OSCON2001/."
#: ../../faq/library.rst:251
msgid "None of my threads seem to run: why?"
msgstr "Nenhuma de minhas threads parece funcionar, por que?"
#: ../../faq/library.rst:253
msgid ""
"As soon as the main thread exits, all threads are killed. Your main thread "
"is running too quickly, giving the threads no time to do any work."
msgstr ""
"Assim que a thread principal acaba, todas as threads são eliminadas. Sua "
"thread principal está sendo executada tão rápida que não está dando tempo "
"para realizar qualquer trabalho."
#: ../../faq/library.rst:256
msgid ""
"A simple fix is to add a sleep to the end of the program that's long enough "
"for all the threads to finish::"
msgstr ""
"Uma solução simples é adicionar um tempo de espera no final do programa até "
"que todos os threads sejam concluídos::"
#: ../../faq/library.rst:271
msgid ""
"But now (on many platforms) the threads don't run in parallel, but appear to "
"run sequentially, one at a time! The reason is that the OS thread scheduler "
"doesn't start a new thread until the previous thread is blocked."
msgstr ""
"Mas agora (em muitas plataformas) as threads não funcionam em paralelo, mas "
"parecem funcionar sequencialmente, um de cada vez! O motivo é que o "
"agendador de threads do sistema operacional não inicia uma nova thread até "
"que a thread anterior seja bloqueada."
#: ../../faq/library.rst:275
msgid "A simple fix is to add a tiny sleep to the start of the run function::"
msgstr ""
"Uma solução simples é adicionar um pequeno tempo de espera no início da "
"função::"
#: ../../faq/library.rst:288
msgid ""
"Instead of trying to guess a good delay value for :func:`time.sleep`, it's "
"better to use some kind of semaphore mechanism. One idea is to use "
"the :mod:`queue` module to create a queue object, let each thread append a "
"token to the queue when it finishes, and let the main thread read as many "
"tokens from the queue as there are threads."
msgstr ""
"Em vez de tentar adivinhar um bom valor de atraso para :func:`time.sleep`, é "
"melhor usar algum tipo de mecanismo de semáforo. Uma ideia é usar o "
"módulo :mod:`queue` para criar um objeto fila, deixar cada thread anexar um "
"token à fila quando terminar e deixar a thread principal ler tantos tokens "
"da fila quantos threads houver."
#: ../../faq/library.rst:296
msgid "How do I parcel out work among a bunch of worker threads?"
msgstr "Como distribuo o trabalho entre várias threads de trabalho?"
#: ../../faq/library.rst:298
msgid ""
"The easiest way is to use the new :mod:`concurrent.futures` module, "
"especially the :mod:`~concurrent.futures.ThreadPoolExecutor` class."
msgstr ""
#: ../../faq/library.rst:301
msgid ""
"Or, if you want fine control over the dispatching algorithm, you can write "
"your own logic manually. Use the :mod:`queue` module to create a queue "
"containing a list of jobs. The :class:`~queue.Queue` class maintains a list "
"of objects and has a ``.put(obj)`` method that adds items to the queue and a "
"``.get()`` method to return them. The class will take care of the locking "
"necessary to ensure that each job is handed out exactly once."
msgstr ""
"Ou, se quiser um controle preciso sobre o algoritmo de despacho, você pode "
"escrever sua própria lógica manualmente. Use o módulo :mod:`queue` para "
"criar uma fila contendo uma lista de tarefas. A classe :class:`~queue.Queue` "
"mantém uma lista de objetos e possui um método ``.put(obj)`` que adiciona "
"itens à fila e um método ``.get()`` para retorná-los. A classe cuidará da "
"trava necessário para garantir que cada trabalho seja entregue exatamente "
"uma vez."
#: ../../faq/library.rst:308
msgid "Here's a trivial example::"
msgstr "Aqui está um exemplo simples::"
#: ../../faq/library.rst:346
msgid "When run, this will produce the following output:"
msgstr "Quando executado, isso produzirá a seguinte saída:"
#: ../../faq/library.rst:364
msgid ""
"Consult the module's documentation for more details; "
"the :class:`~queue.Queue` class provides a featureful interface."
msgstr ""
"Consulte a documentação do módulo para mais detalhes; a "
"classe :class:`~queue.Queue` fornece uma interface com recursos."
#: ../../faq/library.rst:369
msgid "What kinds of global value mutation are thread-safe?"
msgstr "Que tipos de variáveis globais mutáveis são seguras para thread?"
#: ../../faq/library.rst:371
msgid ""
"A :term:`global interpreter lock` (GIL) is used internally to ensure that "
"only one thread runs in the Python VM at a time. In general, Python offers "
"to switch among threads only between bytecode instructions; how frequently "
"it switches can be set via :func:`sys.setswitchinterval`. Each bytecode "
"instruction and therefore all the C implementation code reached from each "
"instruction is therefore atomic from the point of view of a Python program."
msgstr ""
"Uma :term:`trava global do interpretador` (GIL) é usada internamente para "
"garantir que apenas um thread seja executado na VM Python por vez. Em geral, "
"Python oferece alternar entre threads apenas entre instruções de bytecode; a "
"frequência com que ele muda pode ser definida "
"via :func:`sys.setswitchinterval`. Cada instrução de bytecode e, portanto, "
"todo o código de implementação C alcançado por cada instrução é, portanto, "
"atômico do ponto de vista de um programa Python."
#: ../../faq/library.rst:378
msgid ""
"In theory, this means an exact accounting requires an exact understanding of "
"the PVM bytecode implementation. In practice, it means that operations on "
"shared variables of built-in data types (ints, lists, dicts, etc) that "
"\"look atomic\" really are."
msgstr ""
"Em teoria, isso significa que uma contabilidade exata requer um entendimento "
"exato da implementação do bytecode PVM. Na prática, isso significa que as "
"operações em variáveis compartilhadas de tipos de dados integrados "
"(inteiros, listas, dicionarios, etc.) que \"parecem atômicas\" realmente são."
#: ../../faq/library.rst:383
msgid ""
"For example, the following operations are all atomic (L, L1, L2 are lists, "
"D, D1, D2 are dicts, x, y are objects, i, j are ints)::"
msgstr ""
"Por exemplo, as seguintes operações são todas atômicas (L, L1, L2 são "
"listas, D, D1, D2 são dicionários, x, y são objetos, i, j são inteiros)::"
#: ../../faq/library.rst:398
msgid "These aren't::"
msgstr "Esses não são::"
#: ../../faq/library.rst:405
msgid ""
"Operations that replace other objects may invoke those other "
"objects' :meth:`__del__` method when their reference count reaches zero, and "
"that can affect things. This is especially true for the mass updates to "
"dictionaries and lists. When in doubt, use a mutex!"
msgstr ""
#: ../../faq/library.rst:412
msgid "Can't we get rid of the Global Interpreter Lock?"
msgstr "Não podemos remover a Trava Global do interpretador?"
#: ../../faq/library.rst:416
msgid ""
"The :term:`global interpreter lock` (GIL) is often seen as a hindrance to "
"Python's deployment on high-end multiprocessor server machines, because a "
"multi-threaded Python program effectively only uses one CPU, due to the "
"insistence that (almost) all Python code can only run while the GIL is held."
msgstr ""
"A :term:`trava global do interpretador` (GIL) é frequentemente vista como um "
"obstáculo para a implantação do Python em máquinas servidoras "
"multiprocessadas de ponta, porque um programa Python multi-threaded "
"efetivamente usa apenas uma CPU, devido à insistência de que (quase) todo "
"código Python só pode ser executado enquanto a GIL é mantida."
#: ../../faq/library.rst:421
msgid ""
"Back in the days of Python 1.5, Greg Stein actually implemented a "
"comprehensive patch set (the \"free threading\" patches) that removed the "
"GIL and replaced it with fine-grained locking. Adam Olsen recently did a "
"similar experiment in his `python-safethread <https://code.google.com/"
"archive/p/python-safethread>`_ project. Unfortunately, both experiments "
"exhibited a sharp drop in single-thread performance (at least 30% slower), "
"due to the amount of fine-grained locking necessary to compensate for the "
"removal of the GIL."
msgstr ""
"Na época do Python 1.5, Greg Stein implementou um conjunto abrangente de "
"patches (os patches de \"threading livre\") que removeu o GIL e o substituiu "
"por bloqueio refinado. Adam Olsen recentemente fez um experimento semelhante "
"em seu projeto `python-safethread <https://code.google.com/archive/p/python-"
"safethread>`_. Infelizmente, ambos os experimentos exibiram uma queda "
"acentuada no desempenho de thread único (pelo menos 30% mais lento), devido "
"à quantidade de bloqueio de granulação fina necessária para compensar a "
"remoção do GIL."
#: ../../faq/library.rst:429
msgid ""
"This doesn't mean that you can't make good use of Python on multi-CPU "
"machines! You just have to be creative with dividing the work up between "
"multiple *processes* rather than multiple *threads*. "
"The :class:`~concurrent.futures.ProcessPoolExecutor` class in the "
"new :mod:`concurrent.futures` module provides an easy way of doing so; "
"the :mod:`multiprocessing` module provides a lower-level API in case you "
"want more control over dispatching of tasks."
msgstr ""
"Isso não significa que você não possa fazer bom uso do Python em máquinas "
"com várias CPUs! Você só precisa ser criativo ao dividir o trabalho entre "
"vários *processos* em vez de vários *threads*. A "
"classe :class:`~concurrent.futures.ProcessPoolExecutor` no novo "
"módulo :mod:`concurrent.futures` fornece uma maneira fácil de fazer isso; o "
"módulo :mod:`multiprocessing` fornece uma API de nível inferior caso você "
"queira mais controle sobre o envio de tarefas."
#: ../../faq/library.rst:437
msgid ""
"Judicious use of C extensions will also help; if you use a C extension to "
"perform a time-consuming task, the extension can release the GIL while the "
"thread of execution is in the C code and allow other threads to get some "
"work done. Some standard library modules such as :mod:`zlib` "
"and :mod:`hashlib` already do this."
msgstr ""
"O uso criterioso de extensões C também ajudará; se você usar uma extensão C "
"para executar uma tarefa demorada, a extensão poderá liberar a GIL enquanto "
"o thread de execução estiver no código C e permitir que outros threads "
"realizem algum trabalho. Alguns módulos de biblioteca padrão "
"como :mod:`zlib` e :mod:`hashlib` já fazem isso."
#: ../../faq/library.rst:443
msgid ""
"It has been suggested that the GIL should be a per-interpreter-state lock "
"rather than truly global; interpreters then wouldn't be able to share "
"objects. Unfortunately, this isn't likely to happen either. It would be a "
"tremendous amount of work, because many object implementations currently "
"have global state. For example, small integers and short strings are cached; "
"these caches would have to be moved to the interpreter state. Other object "
"types have their own free list; these free lists would have to be moved to "
"the interpreter state. And so on."
msgstr ""
"Foi sugerido que o GIL deveria ser um bloqueio por estado por interpretador, "
"em vez de verdadeiramente global; os interpretadores não seriam capazes de "
"compartilhar objetos. Infelizmente, isso também não é provável que aconteça. "
"Seria uma quantidade enorme de trabalho, porque muitas implementações de "
"objetos atualmente possuem estado global. Por exemplo, inteiros pequenos e "
"strings curtas são armazenados em cache; esses caches teriam que ser movidos "
"para o estado de interpretador. Outros tipos de objetos possuem sua própria "
"lista livre; essas listas livres teriam que ser movidas para o estado de "
"interpretador. E assim por diante."
#: ../../faq/library.rst:452
msgid ""
"And I doubt that it can even be done in finite time, because the same "
"problem exists for 3rd party extensions. It is likely that 3rd party "
"extensions are being written at a faster rate than you can convert them to "
"store all their global state in the interpreter state."
msgstr ""
"E duvido que isso possa ser feito em tempo finito, porque o mesmo problema "
"existe para extensões de terceiros. É provável que extensões de terceiros "
"estejam sendo gravadas em uma taxa mais rápida do que você pode convertê-las "
"para armazenar todo o seu estado global no estado do interpretador."
#: ../../faq/library.rst:457
msgid ""
"And finally, once you have multiple interpreters not sharing any state, what "
"have you gained over running each interpreter in a separate process?"
msgstr ""
"E finalmente, uma vez que você tem vários interpretadores que não "
"compartilham seu estado, o que você ganhou ao executar processos separados "
"em cada interpretador?"
#: ../../faq/library.rst:462
msgid "Input and Output"
msgstr "Entrada e Saída"
#: ../../faq/library.rst:465
msgid "How do I delete a file? (And other file questions...)"
msgstr "Como faço para excluir um arquivo? (E outras perguntas sobre arquivos)"
#: ../../faq/library.rst:467
msgid ""
"Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, "
"see the :mod:`os` module. The two functions are "
"identical; :func:`~os.unlink` is simply the name of the Unix system call for "
"this function."
msgstr ""
"Use ``os.remove(arquivo)`` ou ``os.unlink(arquivo)``; para documentação, "
"veja o módulo :mod:`os`. As duas funções são idênticas; :func:`~os.unlink` é "
"simplesmente o nome da chamada do sistema para esta função no Unix."
#: ../../faq/library.rst:471
msgid ""
"To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create "
"one. ``os.makedirs(path)`` will create any intermediate directories in "
"``path`` that don't exist. ``os.removedirs(path)`` will remove intermediate "
"directories as long as they're empty; if you want to delete an entire "
"directory tree and its contents, use :func:`shutil.rmtree`."
msgstr ""
"Para remover um diretório, use :func:`os.rmdir`; use :func:`os.mkdir` para "
"criar um. ``os.makedirs(caminho)`` criará quaisquer diretórios "
"intermediários em ``path`` que não existam. ``os.removedirs(caminho)`` "
"removerá diretórios intermediários, desde que estejam vazios; se quiser "
"excluir toda uma árvore de diretórios e seu conteúdo, "
"use :func:`shutil.rmtree`."
#: ../../faq/library.rst:477
msgid "To rename a file, use ``os.rename(old_path, new_path)``."
msgstr ""
"Para renomear um arquivos, use ``os.rename(caminho_antigo, caminho_novo)``."
#: ../../faq/library.rst:479
msgid ""
"To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use "
"``f.truncate(offset)``; offset defaults to the current seek position. "
"There's also ``os.ftruncate(fd, offset)`` for files opened "
"with :func:`os.open`, where *fd* is the file descriptor (a small integer)."
msgstr ""
"Para truncar um arquivo, abra-o usando ``f = open(arquivo, \"rb+\")``, e use "
"``f.truncate(posição)``; a posição tem como padrão a posição atual de busca. "
"Há também ``os.ftruncate(fd, posição)`` para arquivos abertos "
"com :func:`os.open`, onde *fd* é o descritor de arquivo (um pequeno inteiro)."
#: ../../faq/library.rst:484
msgid ""
"The :mod:`shutil` module also contains a number of functions to work on "
"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, "
"and :func:`~shutil.rmtree`."
msgstr ""
"O módulo :mod:`shutil` também contém uma série de funções para trabalhar em "
"arquivos, incluindo :func:`~shutil.copyfile`, :func:`~shutil.copytree` "
"e :func:`~shutil.rmtree`."
#: ../../faq/library.rst:490
msgid "How do I copy a file?"
msgstr "Como eu copio um arquivo?"
#: ../../faq/library.rst:492
msgid ""
"The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note "
"that on MacOS 9 it doesn't copy the resource fork and Finder info."
msgstr ""
#: ../../faq/library.rst:497
msgid "How do I read (or write) binary data?"
msgstr "Como leio (ou escrevo) dados binários?"
#: ../../faq/library.rst:499
msgid ""
"To read or write complex binary data formats, it's best to use "
"the :mod:`struct` module. It allows you to take a string containing binary "
"data (usually numbers) and convert it to Python objects; and vice versa."
msgstr ""
"Para ler ou escrever formatos de dados binários complexos, é melhor usar o "
"módulo :mod:`struct`. Ele permite que você pegue uma string contendo dados "
"binários (geralmente números) e a converta em objetos Python; e vice-versa."
#: ../../faq/library.rst:503
msgid ""
"For example, the following code reads two 2-byte integers and one 4-byte "
"integer in big-endian format from a file::"
msgstr ""
"Por exemplo, o código a seguir lê dois inteiros de 2 bytes e um inteiro de 4 "
"bytes no formato big-endian de um arquivo:"
#: ../../faq/library.rst:512
msgid ""
"The '>' in the format string forces big-endian data; the letter 'h' reads "
"one \"short integer\" (2 bytes), and 'l' reads one \"long integer\" (4 "
"bytes) from the string."
msgstr ""
"O '>' na string de formato força dados big-endian; a letra 'h' lê um "
"\"inteiro curto\" (2 bytes) e 'l' lê um \"inteiro longo\" (4 bytes) da "
"string."
#: ../../faq/library.rst:516
msgid ""
"For data that is more regular (e.g. a homogeneous list of ints or floats), "
"you can also use the :mod:`array` module."
msgstr ""
"Para dados mais regulares (por exemplo, uma lista homogênea de ints ou "
"floats), você também pode usar o módulo :mod:`array`."
#: ../../faq/library.rst:521
msgid ""
"To read and write binary data, it is mandatory to open the file in binary "
"mode (here, passing ``\"rb\"`` to :func:`open`). If you use ``\"r\"`` "
"instead (the default), the file will be open in text mode and ``f.read()`` "
"will return :class:`str` objects rather than :class:`bytes` objects."
msgstr ""
"Para ler e escrever dados binários, é obrigatório abrir o arquivo no modo "
"binário (aqui, passando ``\"rb\"`` para :func:`open`). Se você usar "
"``\"r\"`` em vez disso (o padrão), o arquivo será aberto no modo texto e "
"``f.read()`` retornará objetos :class:`str` em vez de objetos :class:`bytes`."
#: ../../faq/library.rst:529
msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?"
msgstr "Por que não consigo usar os.read() em um encadeamento com os.popen()?"
#: ../../faq/library.rst:531
msgid ""
":func:`os.read` is a low-level function which takes a file descriptor, a "
"small integer representing the opened file. :func:`os.popen` creates a high-"
"level file object, the same type returned by the built-in :func:`open` "
"function. Thus, to read *n* bytes from a pipe *p* created "
"with :func:`os.popen`, you need to use ``p.read(n)``."
msgstr ""
":func:`os.read` é uma função de baixo nível que pega um descritor de "
"arquivo, um pequeno inteiro representando o arquivo aberto. :func:`os.popen` "
"cria um objeto arquivo de alto nível, o mesmo tipo retornado pela função "
"embutida :func:`open`. Assim, para ler *n* bytes de um pipe *p* criado "
"com :func:`os.popen`, você precisa usar ``p.read(n)``."
#: ../../faq/library.rst:618
msgid "How do I access the serial (RS232) port?"
msgstr "Como acesso a porta serial (RS232)?"
#: ../../faq/library.rst:620
msgid "For Win32, POSIX (Linux, BSD, etc.), Jython:"
msgstr "Para Win32, POSIX (Linux, BSD, etc.), Jython:"
#: ../../faq/library.rst:622
msgid "http://pyserial.sourceforge.net"
msgstr "http://pyserial.sourceforge.net"
#: ../../faq/library.rst:624
msgid "For Unix, see a Usenet post by Mitch Chapman:"
msgstr "Para Unix, veja uma postagem da Usenet de Mitch Chapman:"
#: ../../faq/library.rst:626
msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com"
msgstr "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com"
#: ../../faq/library.rst:630
msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?"
msgstr "Por que o sys.stdout (stdin, stderr) não fecha?"
#: ../../faq/library.rst:632
msgid ""
"Python :term:`file objects <file object>` are a high-level layer of "
"abstraction on low-level C file descriptors."
msgstr ""
"Os :term:`objetos arquivos <file object>` do Python são uma camada de alto "
"nível de abstração em descritores de arquivo C de baixo nível."
#: ../../faq/library.rst:635
msgid ""
"For most file objects you create in Python via the built-in :func:`open` "
"function, ``f.close()`` marks the Python file object as being closed from "
"Python's point of view, and also arranges to close the underlying C file "
"descriptor. This also happens automatically in ``f``'s destructor, when "
"``f`` becomes garbage."
msgstr ""
"Para a maioria dos objetos arquivo que você cria em Python por meio da "
"função embutida :func:`open`, ``f.close()`` marca o objeto arquivo Python "
"como fechado do ponto de vista do Python e também organiza o fechamento do "
"descritor de arquivo C subjacente. Isso também acontece automaticamente no "
"destrutor de ``f``, quando ``f`` se torna lixo."
#: ../../faq/library.rst:641
msgid ""
"But stdin, stdout and stderr are treated specially by Python, because of the "
"special status also given to them by C. Running ``sys.stdout.close()`` "
"marks the Python-level file object as being closed, but does *not* close the "
"associated C file descriptor."
msgstr ""
"Mas stdin, stdout e stderr são tratados de forma especial pelo Python, "
"devido ao status especial que também lhes é dado pelo C. Executar "
"``sys.stdout.close()`` marca o objeto arquivo de nível Python como fechado, "
"mas *não* fecha o descritor de arquivo C associado."
#: ../../faq/library.rst:646
msgid ""
"To close the underlying C file descriptor for one of these three, you should "
"first be sure that's what you really want to do (e.g., you may confuse "
"extension modules trying to do I/O). If it is, use :func:`os.close`::"
msgstr ""
"Para fechar o descritor de arquivo C subjacente para um desses três, você "
"deve primeiro ter certeza de que é isso que você realmente quer fazer (por "
"exemplo, você pode confundir módulos de extensão tentando fazer E/S). Se "
"for, use :func:`os.close`::"
#: ../../faq/library.rst:654
msgid "Or you can use the numeric constants 0, 1 and 2, respectively."
msgstr "Ou você pode usar as constantes numéricas 0, 1 e 2, respectivamente."
#: ../../faq/library.rst:658
msgid "Network/Internet Programming"
msgstr "Programação Rede / Internet"
#: ../../faq/library.rst:661
msgid "What WWW tools are there for Python?"
msgstr "Quais ferramentas para WWW existem no Python?"
#: ../../faq/library.rst:663
msgid ""
"See the chapters titled :ref:`internet` and :ref:`netdata` in the Library "
"Reference Manual. Python has many modules that will help you build server-"
"side and client-side web systems."
msgstr ""
"Veja os capítulos intitulados :ref:`internet` e :ref:`netdata` no Manual de "
"Referência da Biblioteca. Python tem muitos módulos que ajudarão você a "
"construir sistemas web do lado do servidor e do lado do cliente."
#: ../../faq/library.rst:669
msgid ""
"A summary of available frameworks is maintained by Paul Boddie at https://"
"wiki.python.org/moin/WebProgramming\\ ."
msgstr ""
"Um resumo dos frameworks disponíveis é disponibilizado por Paul Boddie em "
"https://wiki.python.org/moin/WebProgramming\\ ."
#: ../../faq/library.rst:672
msgid ""
"Cameron Laird maintains a useful set of pages about Python web technologies "
"at http://phaseit.net/claird/comp.lang.python/web_python."
msgstr ""
#: ../../faq/library.rst:677
msgid "How can I mimic CGI form submission (METHOD=POST)?"
msgstr "Como faço para imitar a submissão de formulário CGI (METHOD=POST)?"
#: ../../faq/library.rst:679
msgid ""
"I would like to retrieve web pages that are the result of POSTing a form. Is "
"there existing code that would let me do this easily?"
msgstr ""
"Gostaria de recuperar páginas da WEB resultantes de um formulário POST. "
"Existe algum código que consigo fazer isso facilmente?"
#: ../../faq/library.rst:682
msgid "Yes. Here's a simple example that uses urllib.request::"
msgstr "Sim. Aqui está um exemplo simples que usa urllib.request::"
#: ../../faq/library.rst:697
msgid ""
"Note that in general for percent-encoded POST operations, query strings must "
"be quoted using :func:`urllib.parse.urlencode`. For example, to send "
"``name=Guy Steele, Jr.``::"
msgstr ""
#: ../../faq/library.rst:705
msgid ":ref:`urllib-howto` for extensive examples."
msgstr ":ref:`urllib-howto` para mais exemplos."
#: ../../faq/library.rst:709
msgid "What module should I use to help with generating HTML?"
msgstr "Qual módulo devo usar para ajudar na geração do HTML?"
#: ../../faq/library.rst:713
msgid ""
"You can find a collection of useful links on the `Web Programming wiki page "
"<https://wiki.python.org/moin/WebProgramming>`_."
msgstr ""
"Você pode encontrar uma coleção de links úteis na `página wiki "
"WebProgramming <https://wiki.python.org/moin/WebProgramming>`_."
#: ../../faq/library.rst:718
msgid "How do I send mail from a Python script?"
msgstr "Como envio um e-mail de um script Python?"
#: ../../faq/library.rst:720
msgid "Use the standard library module :mod:`smtplib`."
msgstr "Use a biblioteca padrão do módulo :mod:`smtplib`."
#: ../../faq/library.rst:722
msgid ""
"Here's a very simple interactive mail sender that uses it. This method will "
"work on any host that supports an SMTP listener. ::"
msgstr ""
"Aqui está um remetente de e-mail interativo muito simples. Este método "
"funcionará em qualquer host que suporte o protocolo SMTP. ::"
#: ../../faq/library.rst:742
msgid ""
"A Unix-only alternative uses sendmail. The location of the sendmail program "
"varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/"
"usr/sbin/sendmail``. The sendmail manual page will help you out. Here's "
"some sample code::"
msgstr ""
"Uma alternativa somente para Unix usa o sendmail. A localização do programa "
"sendmail varia entre os sistemas; às vezes é ``/usr/lib/sendmail``, às vezes "
"``/usr/sbin/sendmail``. A página de manual do sendmail vai ajudar você. Aqui "
"está um código de exemplo::"
#: ../../faq/library.rst:762
msgid "How do I avoid blocking in the connect() method of a socket?"
msgstr "Como evito um bloqueio no método connect() de um soquete?"
#: ../../faq/library.rst:764
msgid ""
"The :mod:`select` module is commonly used to help with asynchronous I/O on "
"sockets."
msgstr ""
"O módulo :mod:`select` é normalmente usado para ajudar com E/S assíncrona "
"nos soquetes."
#: ../../faq/library.rst:767
msgid ""
"To prevent the TCP connect from blocking, you can set the socket to non-"
"blocking mode. Then when you do the ``connect()``, you will either connect "
"immediately (unlikely) or get an exception that contains the error number as "
"``.errno``. ``errno.EINPROGRESS`` indicates that the connection is in "
"progress, but hasn't finished yet. Different OSes will return different "
"values, so you're going to have to check what's returned on your system."
msgstr ""
#: ../../faq/library.rst:774
msgid ""
"You can use the ``connect_ex()`` method to avoid creating an exception. It "
"will just return the errno value. To poll, you can call ``connect_ex()`` "
"again later -- ``0`` or ``errno.EISCONN`` indicate that you're connected -- "
"or you can pass this socket to select to check if it's writable."
msgstr ""
#: ../../faq/library.rst:780
msgid ""
"The :mod:`asyncore` module presents a framework-like approach to the problem "
"of writing non-blocking networking code. The third-party `Twisted <https://"
"twistedmatrix.com/trac/>`_ library is a popular and feature-rich alternative."
msgstr ""
#: ../../faq/library.rst:787
msgid "Databases"