-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathimport.po
More file actions
2010 lines (1824 loc) · 97 KB
/
import.po
File metadata and controls
2010 lines (1824 loc) · 97 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:
# Raphael Mendonça, 2020
# Marco Rougeth <marco@rougeth.com>, 2020
# Claudio Rogerio Carvalho Filho <excriptbrasil@gmail.com>, 2020
# Adorilson Bezerra <adorilson@gmail.com>, 2020
# Hildeberto Abreu Magalhães <hildeberto@gmail.com>, 2023
# Vinicius Gubiani Ferreira <vini.g.fer@gmail.com>, 2023
# 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-08-23 17:20+0000\n"
"PO-Revision-Date: 2020-05-30 12:15+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"
#: ../../reference/import.rst:6
msgid "The import system"
msgstr "O sistema de importação"
#: ../../reference/import.rst:10
msgid ""
"Python code in one :term:`module` gains access to the code in another module "
"by the process of :term:`importing` it. The :keyword:`import` statement is "
"the most common way of invoking the import machinery, but it is not the only "
"way. Functions such as :func:`importlib.import_module` and built-"
"in :func:`__import__` can also be used to invoke the import machinery."
msgstr ""
"O código Python em um :term:`módulo` obtém acesso ao código em outro módulo "
"pelo processo de :term:`importação` dele. A instrução :keyword:`import` é a "
"maneira mais comum de invocar o mecanismo de importação, mas não é a única "
"maneira. Funções como :func:`importlib.import_module` e a função "
"embutida :func:`__import__` também podem ser usadas para chamar o mecanismo "
"de importação."
#: ../../reference/import.rst:16
msgid ""
"The :keyword:`import` statement combines two operations; it searches for the "
"named module, then it binds the results of that search to a name in the "
"local scope. The search operation of the :keyword:`!import` statement is "
"defined as a call to the :func:`__import__` function, with the appropriate "
"arguments. The return value of :func:`__import__` is used to perform the "
"name binding operation of the :keyword:`!import` statement. See "
"the :keyword:`!import` statement for the exact details of that name binding "
"operation."
msgstr ""
"A instrução :keyword:`import` combina duas operações; ela procura o módulo "
"nomeado e vincula os resultados dessa pesquisa a um nome no escopo local. A "
"operação de busca da instrução :keyword:`!import` é definida como uma "
"chamada para a função :func:`__import__`, com os argumentos apropriados. O "
"valor de retorno de :func:`__import__` é usado para executar a operação de "
"ligação de nome da instrução :keyword:`!import`. Veja a instrução :keyword:`!"
"import` para os detalhes exatos da operação de ligação desse nome."
#: ../../reference/import.rst:25
msgid ""
"A direct call to :func:`__import__` performs only the module search and, if "
"found, the module creation operation. While certain side-effects may occur, "
"such as the importing of parent packages, and the updating of various caches "
"(including :data:`sys.modules`), only the :keyword:`import` statement "
"performs a name binding operation."
msgstr ""
"Uma chamada direta para :func:`__import__` realiza apenas a pesquisa do "
"módulo e, se encontrada, a operação de criação do módulo. Embora certos "
"efeitos colaterais possam ocorrer, como a importação de pacotes pai e a "
"atualização de vários caches (incluindo :data:`sys.modules`), apenas a "
"instrução :keyword:`import` realiza uma operação de ligação de nome."
#: ../../reference/import.rst:31
msgid ""
"When an :keyword:`import` statement is executed, the standard "
"builtin :func:`__import__` function is called. Other mechanisms for invoking "
"the import system (such as :func:`importlib.import_module`) may choose to "
"bypass :func:`__import__` and use their own solutions to implement import "
"semantics."
msgstr ""
"Quando uma instrução :keyword:`import` é executada, a função embutida "
"padrão :func:`__import__` é chamada. Outros mecanismos para chamar o sistema "
"de importação (como :func:`importlib.import_module`) podem optar por "
"ignorar :func:`__import__` e usar suas próprias soluções para implementar a "
"semântica de importação."
#: ../../reference/import.rst:36
msgid ""
"When a module is first imported, Python searches for the module and if "
"found, it creates a module object [#fnmo]_, initializing it. If the named "
"module cannot be found, a :exc:`ModuleNotFoundError` is raised. Python "
"implements various strategies to search for the named module when the import "
"machinery is invoked. These strategies can be modified and extended by "
"using various hooks described in the sections below."
msgstr ""
"Quando um módulo é importado pela primeira vez, o Python procura pelo módulo "
"e, se encontrado, cria um objeto de módulo [#fnmo]_, inicializando-o. Se o "
"módulo nomeado não puder ser encontrado, uma :exc:`ModuleNotFoundError` será "
"levantada. O Python implementa várias estratégias para procurar o módulo "
"nomeado quando o mecanismo de importação é chamado. Essas estratégias podem "
"ser modificadas e estendidas usando vários ganchos descritos nas seções "
"abaixo."
#: ../../reference/import.rst:43
msgid ""
"The import system has been updated to fully implement the second phase "
"of :pep:`302`. There is no longer any implicit import machinery - the full "
"import system is exposed through :data:`sys.meta_path`. In addition, native "
"namespace package support has been implemented (see :pep:`420`)."
msgstr ""
"O sistema de importação foi atualizado para implementar completamente a "
"segunda fase da :pep:`302`. Não há mais um mecanismo de importação implícito "
"-- o sistema completo de importação é exposto através "
"de :data:`sys.meta_path`. Além disso, o suporte nativo a pacote de espaço de "
"nomes foi implementado (consulte :pep:`420`)."
#: ../../reference/import.rst:51
msgid ":mod:`importlib`"
msgstr ":mod:`importlib`"
#: ../../reference/import.rst:53
msgid ""
"The :mod:`importlib` module provides a rich API for interacting with the "
"import system. For example :func:`importlib.import_module` provides a "
"recommended, simpler API than built-in :func:`__import__` for invoking the "
"import machinery. Refer to the :mod:`importlib` library documentation for "
"additional detail."
msgstr ""
"O módulo :mod:`importlib` fornece uma API rica para interagir com o sistema "
"de importação. Por exemplo, :func:`importlib.import_module` fornece uma API "
"mais simples e recomendada do que a função embutida :func:`__import__` para "
"chamar o mecanismo de importação. Consulte a documentação da "
"biblioteca :mod:`importlib` para obter detalhes adicionais."
#: ../../reference/import.rst:62
msgid "Packages"
msgstr "Pacotes"
#: ../../reference/import.rst:67
msgid ""
"Python has only one type of module object, and all modules are of this type, "
"regardless of whether the module is implemented in Python, C, or something "
"else. To help organize modules and provide a naming hierarchy, Python has a "
"concept of :term:`packages <package>`."
msgstr ""
"O Python possui apenas um tipo de objeto de módulo e todos os módulos são "
"desse tipo, independentemente de o módulo estar implementado em Python, C ou "
"qualquer outra coisa. Para ajudar a organizar os módulos e fornecer uma "
"hierarquia de nomes, o Python tem o conceito de :term:`pacotes <pacote>`."
#: ../../reference/import.rst:72
msgid ""
"You can think of packages as the directories on a file system and modules as "
"files within directories, but don't take this analogy too literally since "
"packages and modules need not originate from the file system. For the "
"purposes of this documentation, we'll use this convenient analogy of "
"directories and files. Like file system directories, packages are organized "
"hierarchically, and packages may themselves contain subpackages, as well as "
"regular modules."
msgstr ""
"Você pode pensar em pacotes como os diretórios em um sistema de arquivos e "
"os módulos como arquivos nos diretórios, mas não tome essa analogia muito "
"literalmente, já que pacotes e módulos não precisam se originar do sistema "
"de arquivos. Para os fins desta documentação, usaremos essa analogia "
"conveniente de diretórios e arquivos. Como os diretórios do sistema de "
"arquivos, os pacotes são organizados hierarquicamente e os próprios pacotes "
"podem conter subpacotes e módulos regulares."
#: ../../reference/import.rst:80
msgid ""
"It's important to keep in mind that all packages are modules, but not all "
"modules are packages. Or put another way, packages are just a special kind "
"of module. Specifically, any module that contains a ``__path__`` attribute "
"is considered a package."
msgstr ""
"É importante ter em mente que todos os pacotes são módulos, mas nem todos os "
"módulos são pacotes. Ou, dito de outra forma, os pacotes são apenas um tipo "
"especial de módulo. Especificamente, qualquer módulo que contenha um "
"atributo ``__path__`` é considerado um pacote."
#: ../../reference/import.rst:85
msgid ""
"All modules have a name. Subpackage names are separated from their parent "
"package name by dots, akin to Python's standard attribute access syntax. "
"Thus you might have a module called :mod:`sys` and a package "
"called :mod:`email`, which in turn has a subpackage called :mod:`email.mime` "
"and a module within that subpackage called :mod:`email.mime.text`."
msgstr ""
"Todos os módulos têm um nome. Os nomes dos subpacotes são separados do nome "
"do pacote pai por pontos, semelhante à sintaxe de acesso aos atributos "
"padrão do Python. Assim, você pode ter um módulo chamado :mod:`sys` e um "
"pacote chamado :mod:`email`, que por sua vez possui um subpacote "
"chamado :mod:`email.mime` e um módulo dentro desse subpacote "
"chamado :mod:`email.mime.text`."
#: ../../reference/import.rst:93
msgid "Regular packages"
msgstr "Pacotes regulares"
#: ../../reference/import.rst:98
msgid ""
"Python defines two types of packages, :term:`regular packages <regular "
"package>` and :term:`namespace packages <namespace package>`. Regular "
"packages are traditional packages as they existed in Python 3.2 and earlier. "
"A regular package is typically implemented as a directory containing an "
"``__init__.py`` file. When a regular package is imported, this "
"``__init__.py`` file is implicitly executed, and the objects it defines are "
"bound to names in the package's namespace. The ``__init__.py`` file can "
"contain the same Python code that any other module can contain, and Python "
"will add some additional attributes to the module when it is imported."
msgstr ""
"O Python define dois tipos de pacotes, :term:`pacotes regulares <regular "
"package>` e :term:`pacotes de espaço de nomes <namespace package>`. Pacotes "
"regulares são pacotes tradicionais, como existiam no Python 3.2 e versões "
"anteriores. Um pacote regular é normalmente implementado como um diretório "
"que contém um arquivo ``__init__.py``. Quando um pacote regular é importado, "
"esse arquivo ``__init__.py`` é executado implicitamente, e os objetos que "
"ele define são vinculados aos nomes no espaço de nomes do pacote. O arquivo "
"``__init__.py`` pode conter o mesmo código Python que qualquer outro módulo "
"pode conter, e o Python adicionará alguns atributos adicionais ao módulo "
"quando ele for importado."
#: ../../reference/import.rst:108
msgid ""
"For example, the following file system layout defines a top level ``parent`` "
"package with three subpackages::"
msgstr ""
"Por exemplo, o layout do sistema de arquivos a seguir define um pacote "
"``parent`` de nível superior com três subpacotes::"
#: ../../reference/import.rst:120
msgid ""
"Importing ``parent.one`` will implicitly execute ``parent/__init__.py`` and "
"``parent/one/__init__.py``. Subsequent imports of ``parent.two`` or "
"``parent.three`` will execute ``parent/two/__init__.py`` and ``parent/three/"
"__init__.py`` respectively."
msgstr ""
"A importação de ``parent.one`` vai executar implicitamente ``parent/"
"__init__.py`` e ``parent/one/__init__.py``. Importações subsequentes de "
"``parent.two`` ou ``parent.three`` vão executar ``parent/two/__init__.py`` e "
"``parent/three/__init__.py``, respectivamente."
#: ../../reference/import.rst:127
msgid "Namespace packages"
msgstr "Pacotes de espaço de nomes"
#: ../../reference/import.rst:133
msgid ""
"A namespace package is a composite of various :term:`portions <portion>`, "
"where each portion contributes a subpackage to the parent package. Portions "
"may reside in different locations on the file system. Portions may also be "
"found in zip files, on the network, or anywhere else that Python searches "
"during import. Namespace packages may or may not correspond directly to "
"objects on the file system; they may be virtual modules that have no "
"concrete representation."
msgstr ""
"Um pacote de espaço de nomes é um composto de várias :term:`porções "
"<portion>`, em que cada parte contribui com um subpacote para o pacote pai. "
"Partes podem residir em locais diferentes no sistema de arquivos. Partes "
"também podem ser encontradas em arquivos zip, na rede ou em qualquer outro "
"lugar que o Python pesquisar durante a importação. Os pacotes de espaço de "
"nomes podem ou não corresponder diretamente aos objetos no sistema de "
"arquivos; eles podem ser módulos virtuais que não têm representação concreta."
#: ../../reference/import.rst:141
msgid ""
"Namespace packages do not use an ordinary list for their ``__path__`` "
"attribute. They instead use a custom iterable type which will automatically "
"perform a new search for package portions on the next import attempt within "
"that package if the path of their parent package (or :data:`sys.path` for a "
"top level package) changes."
msgstr ""
"Os pacotes de espaço de nomes não usam uma lista comum para o atributo "
"``__path__``. Em vez disso, eles usam um tipo iterável personalizado que "
"executará automaticamente uma nova pesquisa por partes do pacote na próxima "
"tentativa de importação dentro desse pacote, se o caminho do pacote pai "
"(ou :data:`sys.path` para um pacote de nível superior) for alterado."
#: ../../reference/import.rst:147
msgid ""
"With namespace packages, there is no ``parent/__init__.py`` file. In fact, "
"there may be multiple ``parent`` directories found during import search, "
"where each one is provided by a different portion. Thus ``parent/one`` may "
"not be physically located next to ``parent/two``. In this case, Python will "
"create a namespace package for the top-level ``parent`` package whenever it "
"or one of its subpackages is imported."
msgstr ""
"Com pacotes de espaço de nomes, não há arquivo ``pai/__init__.py``. De fato, "
"pode haver vários diretórios ``pai`` encontrados durante a pesquisa de "
"importação, onde cada um é fornecido por uma parte diferente. Portanto, "
"``pai/um`` pode não estar fisicamente localizado próximo a ``pai/dois``. "
"Nesse caso, o Python criará um pacote de espaço de nomes para o pacote "
"``pai`` de nível superior sempre que ele ou um de seus subpacotes for "
"importado."
#: ../../reference/import.rst:154
msgid "See also :pep:`420` for the namespace package specification."
msgstr ""
"Veja também :pep:`420` para a especificação de pacotes de espaço de nomes."
#: ../../reference/import.rst:158
msgid "Searching"
msgstr "Caminho de busca"
#: ../../reference/import.rst:160
msgid ""
"To begin the search, Python needs the :term:`fully qualified <qualified "
"name>` name of the module (or package, but for the purposes of this "
"discussion, the difference is immaterial) being imported. This name may "
"come from various arguments to the :keyword:`import` statement, or from the "
"parameters to the :func:`importlib.import_module` or :func:`__import__` "
"functions."
msgstr ""
"Para iniciar a busca, o Python precisa do nome :term:`completo <qualified "
"name>` do módulo (ou pacote, mas para o propósito dessa exposição, não há "
"diferença) que se quer importar. Esse nome vem de vários argumentos passados "
"para a instrução :keyword:`import`, ou dos parâmetros das "
"funções :func:`importlib.import_module` ou :func:`__import__`."
#: ../../reference/import.rst:166
msgid ""
"This name will be used in various phases of the import search, and it may be "
"the dotted path to a submodule, e.g. ``foo.bar.baz``. In this case, Python "
"first tries to import ``foo``, then ``foo.bar``, and finally "
"``foo.bar.baz``. If any of the intermediate imports fail, "
"a :exc:`ModuleNotFoundError` is raised."
msgstr ""
"Esse nome será usado em várias fases da busca da importação, e pode ser um "
"nome com pontos para um submódulo como, por exemplo, ``foo.bar.baz``. Nesse "
"caso, Python primeiro tenta importar ``foo``, depois ``foo.bar`` e, "
"finalmente, ``foo.bar.baz``. Se alguma das importações intermediárias "
"falharem, uma exceção :exc:`ModuleNotFoundError` é levantada."
#: ../../reference/import.rst:173
msgid "The module cache"
msgstr "O cache de módulos"
#: ../../reference/import.rst:178
msgid ""
"The first place checked during import search is :data:`sys.modules`. This "
"mapping serves as a cache of all modules that have been previously imported, "
"including the intermediate paths. So if ``foo.bar.baz`` was previously "
"imported, :data:`sys.modules` will contain entries for ``foo``, ``foo.bar``, "
"and ``foo.bar.baz``. Each key will have as its value the corresponding "
"module object."
msgstr ""
"A primeira verificação durante a busca da importação é feita "
"no :data:`sys.modules`. Esse mapeamento serve como um cache de todos os "
"módulos que já foram importados previamente, incluindo os caminhos "
"intermediários. Se ``foo.bar.baz`` foi previamente "
"importado, :data:`sys.modules` conterá entradas para ``foo``, ``foo.bar`` e "
"``foo.bar.baz``. Cada chave terá como valor um objeto módulo correspondente."
#: ../../reference/import.rst:185
msgid ""
"During import, the module name is looked up in :data:`sys.modules` and if "
"present, the associated value is the module satisfying the import, and the "
"process completes. However, if the value is ``None``, then "
"a :exc:`ModuleNotFoundError` is raised. If the module name is missing, "
"Python will continue searching for the module."
msgstr ""
"Durante a importação, o nome do módulo é procurado em :data:`sys.modules` e, "
"se estiver presente, o valor associado é o módulo que satisfaz a importação, "
"e o processo termina. Entretanto, se o valor é ``None``, uma "
"exceção :exc:`ModuleNotFoundError` é levantada. Se o nome do módulo não foi "
"encontrado, Python continuará a busca pelo módulo."
#: ../../reference/import.rst:191
msgid ""
":data:`sys.modules` is writable. Deleting a key may not destroy the "
"associated module (as other modules may hold references to it), but it will "
"invalidate the cache entry for the named module, causing Python to search "
"anew for the named module upon its next import. The key can also be assigned "
"to ``None``, forcing the next import of the module to result in "
"a :exc:`ModuleNotFoundError`."
msgstr ""
"É possível alterar :data:`sys.modules`. Apagar uma chave pode não destruir o "
"objeto módulo associado (outros módulos podem manter referências para ele), "
"mas a entrada do cache será invalidada para o nome daquele módulo, fazendo "
"Python executar nova busca na próxima importação. Pode ser atribuído "
"``None`` para a chave, forçando que a próxima importação do módulo resulte "
"numa exceção :exc:`ModuleNotFoundError`."
#: ../../reference/import.rst:198
msgid ""
"Beware though, as if you keep a reference to the module object, invalidate "
"its cache entry in :data:`sys.modules`, and then re-import the named module, "
"the two module objects will *not* be the same. By "
"contrast, :func:`importlib.reload` will reuse the *same* module object, and "
"simply reinitialise the module contents by rerunning the module's code."
msgstr ""
"No entanto, tenha cuidado, pois se você mantiver uma referência para o "
"objeto módulo, invalidar sua entrada de cache em :data:`sys.modules` e, em "
"seguida, reimportar do módulo nomeado, os dois módulo objetos *não* serão os "
"mesmos. Por outro lado, o :func:`importlib.reload` reutilizará o *mesmo* "
"objeto módulo e simplesmente reinicializará o conteúdo do módulo executando "
"novamente o código do módulo."
#: ../../reference/import.rst:208
msgid "Finders and loaders"
msgstr "Localizadores e carregadores"
#: ../../reference/import.rst:215
msgid ""
"If the named module is not found in :data:`sys.modules`, then Python's "
"import protocol is invoked to find and load the module. This protocol "
"consists of two conceptual objects, :term:`finders <finder>` "
"and :term:`loaders <loader>`. A finder's job is to determine whether it can "
"find the named module using whatever strategy it knows about. Objects that "
"implement both of these interfaces are referred to as :term:`importers "
"<importer>` - they return themselves when they find that they can load the "
"requested module."
msgstr ""
"Se o módulo nomeado não for encontrado em :data:`sys.modules`, então o "
"protocolo de importação do Python é invocado para localizar e carregar o "
"módulo. Este protocolo consiste em dois objetos "
"conceituais, :term:`localizadores <finder>` e :term:`carregadores <loader>`. "
"O trabalho de um localizador é determinar se ele pode localizar o módulo "
"nomeado usando qualquer estratégia que ele conheça. Objetos que implementam "
"ambas essas interfaces são referenciadas como :term:`importadores "
"<importer>` -- eles retornam a si mesmos, quando eles descobrem que eles "
"podem carregar o módulo requisitado."
#: ../../reference/import.rst:223
msgid ""
"Python includes a number of default finders and importers. The first one "
"knows how to locate built-in modules, and the second knows how to locate "
"frozen modules. A third default finder searches an :term:`import path` for "
"modules. The :term:`import path` is a list of locations that may name file "
"system paths or zip files. It can also be extended to search for any "
"locatable resource, such as those identified by URLs."
msgstr ""
"Python inclui um número de localizadores e carregadores padrões. O primeiro "
"sabe como localizar módulos embutidos, e o segundo sabe como localizar "
"módulos congelados. Um terceiro localizador padrão procura em "
"um :term:`caminho de importação` por módulos. O :term:`caminho de "
"importação` é uma lista de localizações que podem nomear caminhos de sistema "
"de arquivo ou arquivos zip. Ele também pode ser estendido para buscar por "
"qualquer recurso localizável, tais como aqueles identificados por URLs."
#: ../../reference/import.rst:230
msgid ""
"The import machinery is extensible, so new finders can be added to extend "
"the range and scope of module searching."
msgstr ""
"O mecanismo de importação é extensível, então novos localizadores podem ser "
"adicionados para estender o alcance e o escopo de buscar módulos."
#: ../../reference/import.rst:233
msgid ""
"Finders do not actually load modules. If they can find the named module, "
"they return a :dfn:`module spec`, an encapsulation of the module's import-"
"related information, which the import machinery then uses when loading the "
"module."
msgstr ""
"Localizadores na verdade não carregam módulos. Se eles conseguirem encontrar "
"o módulo nomeado, eles retornam um :dfn:`spec de módulo`, um encapsulamento "
"da informação relacionada a importação do módulo, a qual o mecanismo de "
"importação então usa quando o módulo é carregado."
#: ../../reference/import.rst:237
msgid ""
"The following sections describe the protocol for finders and loaders in more "
"detail, including how you can create and register new ones to extend the "
"import machinery."
msgstr ""
"As seguintes seções descrevem o protocolo para localizadores e carregadores "
"em mais detalhes, incluindo como você pode criar e registrar novos para "
"estender o mecanismo de importação."
#: ../../reference/import.rst:241
msgid ""
"In previous versions of Python, finders returned :term:`loaders <loader>` "
"directly, whereas now they return module specs which *contain* loaders. "
"Loaders are still used during import but have fewer responsibilities."
msgstr ""
"Em versões anteriores do Python, localizadores "
"retornavam :term:`carregadores <loader>` diretamente, enquanto agora eles "
"retornam especificações de módulo, as qual *contêm* carregadores. "
"Carregadores ainda são usados durante a importação, mas possuem menos "
"responsabilidades."
#: ../../reference/import.rst:247
msgid "Import hooks"
msgstr "Ganchos de importação"
#: ../../reference/import.rst:257
msgid ""
"The import machinery is designed to be extensible; the primary mechanism for "
"this are the *import hooks*. There are two types of import hooks: *meta "
"hooks* and *import path hooks*."
msgstr ""
"O mecanismo de importação é desenhado para ser extensível; o mecanismo "
"primário para isso são os *ganchos de importação*. Existem dois tipos de "
"ganchos de importação: *metaganchos* e *ganchos de importação de caminho*."
#: ../../reference/import.rst:261
msgid ""
"Meta hooks are called at the start of import processing, before any other "
"import processing has occurred, other than :data:`sys.modules` cache look "
"up. This allows meta hooks to override :data:`sys.path` processing, frozen "
"modules, or even built-in modules. Meta hooks are registered by adding new "
"finder objects to :data:`sys.meta_path`, as described below."
msgstr ""
"Metaganchos são chamados no início do processo de importação, antes que "
"qualquer outro processo de importação tenha ocorrido, que não seja busca de "
"cache de :data:`sys.modules`. Isso permite aos metaganchos substituir "
"processamento de :data:`sys.path`, módulos congelados ou mesmo módulos "
"embutidos. Metaganchos são registrados adicionando novos objetos "
"localizadores a :data:`sys.meta_path`, conforme descrito abaixo."
#: ../../reference/import.rst:267
msgid ""
"Import path hooks are called as part of :data:`sys.path` (or "
"``package.__path__``) processing, at the point where their associated path "
"item is encountered. Import path hooks are registered by adding new "
"callables to :data:`sys.path_hooks` as described below."
msgstr ""
"Ganchos de caminho de importação são chamados como parte do processamento "
"de :data:`sys.path` (ou ``package.__path__``), no ponto onde é encontrado o "
"item do caminho associado. Ganchos de caminho de importação são registrados "
"adicionando novos chamáveis para :data:`sys.path_hooks`, conforme descrito "
"abaixo."
#: ../../reference/import.rst:274
msgid "The meta path"
msgstr "O metacaminho"
#: ../../reference/import.rst:280
msgid ""
"When the named module is not found in :data:`sys.modules`, Python next "
"searches :data:`sys.meta_path`, which contains a list of meta path finder "
"objects. These finders are queried in order to see if they know how to "
"handle the named module. Meta path finders must implement a method "
"called :meth:`~importlib.abc.MetaPathFinder.find_spec()` which takes three "
"arguments: a name, an import path, and (optionally) a target module. The "
"meta path finder can use any strategy it wants to determine whether it can "
"handle the named module or not."
msgstr ""
"Quando o módulo nomeado não é encontrado em :data:`sys.modules`, Python em "
"seguida busca :data:`sys.meta_path`, o qual contém uma lista de objetos "
"localizador de metacaminho. Esses buscadores são consultados a fim de "
"verificar se eles sabem como manipular o módulo nomeado. Os localizadores de "
"metacaminho devem implementar um método "
"chamado :meth:`~importlib.abc.MetaPathFinder.find_spec()`, o qual recebe "
"três argumentos: um nome, um caminho de importação, e (opcionalmente) um "
"módulo alvo. O localizador de metacaminho pode usar qualquer estratégia que "
"ele quiser para determinar se ele pode manipular o módulo nomeado ou não."
#: ../../reference/import.rst:289
msgid ""
"If the meta path finder knows how to handle the named module, it returns a "
"spec object. If it cannot handle the named module, it returns ``None``. "
"If :data:`sys.meta_path` processing reaches the end of its list without "
"returning a spec, then a :exc:`ModuleNotFoundError` is raised. Any other "
"exceptions raised are simply propagated up, aborting the import process."
msgstr ""
"Se o localizador de metacaminho souber como tratar o módulo nomeado, ele "
"retorna um objeto spec. Se ele não puder tratar o módulo nomeado, ele "
"retorna ``None``. Se o processamento de :data:`sys.meta_path` alcançar o fim "
"da sua lista sem retornar um spec, então :exc:`ModuleNotFoundError` é "
"levantada. Quaisquer outras exceções levantadas são simplesmente propagadas "
"para cima, abortando o processo de importação."
#: ../../reference/import.rst:295
msgid ""
"The :meth:`~importlib.abc.MetaPathFinder.find_spec()` method of meta path "
"finders is called with two or three arguments. The first is the fully "
"qualified name of the module being imported, for example ``foo.bar.baz``. "
"The second argument is the path entries to use for the module search. For "
"top-level modules, the second argument is ``None``, but for submodules or "
"subpackages, the second argument is the value of the parent package's "
"``__path__`` attribute. If the appropriate ``__path__`` attribute cannot be "
"accessed, a :exc:`ModuleNotFoundError` is raised. The third argument is an "
"existing module object that will be the target of loading later. The import "
"system passes in a target module only during reload."
msgstr ""
"O método :meth:`~importlib.abc.MetaPathFinder.find_spec()` dos localizadores "
"de metacaminhos é chamado com dois ou três argumentos. O primeiro é o nome "
"totalmente qualificado do módulo sendo importado, por exemplo "
"``foo.bar.baz``. O segundo argumento é o caminho de entradas para usar para "
"a busca do módulo. Para módulos de alto nível, o segundo argumento é "
"``None``, mas para submódulos ou subpacotes, o segundo argumento é o valor "
"do atributo ``__path__`` do pacote pai. Se o atributo ``__path__`` "
"apropriado não puder ser acessado, uma exceção :exc:`ModuleNotFoundError` é "
"levantada. O terceiro argumento é um objeto módulo existente que será o alvo "
"do carregamento posteriormente. O sistema de importação passa um módulo alvo "
"apenas durante o recarregamento."
#: ../../reference/import.rst:306
msgid ""
"The meta path may be traversed multiple times for a single import request. "
"For example, assuming none of the modules involved has already been cached, "
"importing ``foo.bar.baz`` will first perform a top level import, calling "
"``mpf.find_spec(\"foo\", None, None)`` on each meta path finder (``mpf``). "
"After ``foo`` has been imported, ``foo.bar`` will be imported by traversing "
"the meta path a second time, calling ``mpf.find_spec(\"foo.bar\", "
"foo.__path__, None)``. Once ``foo.bar`` has been imported, the final "
"traversal will call ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, "
"None)``."
msgstr ""
"O metacaminho pode ser percorrido múltiplas vezes para uma requisição de "
"importação individual. Por exemplo, presumindo que nenhum dos módulos "
"envolvidos já tenha sido cacheado, importar ``foo.bar.baz`` irá primeiro "
"executar uma importação de alto nível, chamando ``mpf.find_spec(\"foo\", "
"None, None)`` em cada localizador de metacaminho (``mpf``). Depois que "
"``foo`` foi importado, ``foo.bar`` será importado percorrendo o metacaminho "
"uma segunda vez, chamando ``mpf.find_spec(\"foo.bar\", foo.__path__, "
"None)``. Uma vez que ``foo.bar`` tenha sido importado, a travessia final irá "
"chamar ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)``."
#: ../../reference/import.rst:316
msgid ""
"Some meta path finders only support top level imports. These importers will "
"always return ``None`` when anything other than ``None`` is passed as the "
"second argument."
msgstr ""
"Alguns localizadores de metacaminho apenas dão suporte a importações de alto "
"nível. Estes importadores vão sempre retornar ``None`` quando qualquer coisa "
"diferente de ``None`` for passada como o segundo argumento."
#: ../../reference/import.rst:320
msgid ""
"Python's default :data:`sys.meta_path` has three meta path finders, one that "
"knows how to import built-in modules, one that knows how to import frozen "
"modules, and one that knows how to import modules from an :term:`import "
"path` (i.e. the :term:`path based finder`)."
msgstr ""
"O :data:`sys.meta_path` padrão do Python possui três localizador de "
"metacaminho, um que sabe como importar módulos embutidos, um que sabe como "
"importar módulos congelados, e outro que sabe como importar módulos de "
"um :term:`caminho de importação` (isto é, o :term:`localizador baseado no "
"caminho`)."
#: ../../reference/import.rst:325
msgid ""
"The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path "
"finders replaced :meth:`~importlib.abc.MetaPathFinder.find_module`, which is "
"now deprecated. While it will continue to work without change, the import "
"machinery will try it only if the finder does not implement ``find_spec()``."
msgstr ""
#: ../../reference/import.rst:334
msgid "Loading"
msgstr "Carregando"
#: ../../reference/import.rst:336
msgid ""
"If and when a module spec is found, the import machinery will use it (and "
"the loader it contains) when loading the module. Here is an approximation "
"of what happens during the loading portion of import::"
msgstr ""
"Se e quando uma spec de módulo é encontrada, o mecanismo de importação vai "
"usá-la (e o carregador que ela contém) durante o carregamento do módulo. "
"Esta é uma aproximação do que acontece durante a etapa de carregamento de "
"uma importação::"
#: ../../reference/import.rst:370
msgid "Note the following details:"
msgstr "Perceba os seguintes detalhes:"
#: ../../reference/import.rst:372
msgid ""
"If there is an existing module object with the given name "
"in :data:`sys.modules`, import will have already returned it."
msgstr ""
"Se houver um objeto módulo existente com o nome fornecido "
"em :data:`sys.modules`, a importação já tera retornado ele."
#: ../../reference/import.rst:375
msgid ""
"The module will exist in :data:`sys.modules` before the loader executes the "
"module code. This is crucial because the module code may (directly or "
"indirectly) import itself; adding it to :data:`sys.modules` beforehand "
"prevents unbounded recursion in the worst case and multiple loading in the "
"best."
msgstr ""
"O módulo irá existir em :data:`sys.modules` antes do carregador executar o "
"código do módulo. Isso é crucial porque o código do módulo pode (direta ou "
"indiretamente) importar a si mesmo; adicioná-lo a :data:`sys.modules` "
"antecipadamente previne recursão infinita no pior caso e múltiplos "
"carregamentos no melhor caso."
#: ../../reference/import.rst:381
msgid ""
"If loading fails, the failing module -- and only the failing module -- gets "
"removed from :data:`sys.modules`. Any module already in "
"the :data:`sys.modules` cache, and any module that was successfully loaded "
"as a side-effect, must remain in the cache. This contrasts with reloading "
"where even the failing module is left in :data:`sys.modules`."
msgstr ""
"Se o carregamento falhar, o módulo com falha -- e apenas o módulo com falha "
"-- é removido de :data:`sys.modules`. Qualquer módulo já presente no cache "
"de :data:`sys.modules`, e qualquer módulo que tenha sido carregado com "
"sucesso como um efeito colateral, deve permanecer no cache. Isso contrasta "
"com recarregamento, onde mesmo o módulo com falha é mantido "
"em :data:`sys.modules`."
#: ../../reference/import.rst:387
msgid ""
"After the module is created but before execution, the import machinery sets "
"the import-related module attributes (\"_init_module_attrs\" in the pseudo-"
"code example above), as summarized in a :ref:`later section <import-mod-"
"attrs>`."
msgstr ""
"Depois que o módulo é criado, mas antes da execução, o mecanismo de "
"importação define os atributos de módulo relacionados a importação "
"(\"_init_module_attrs\" no exemplo de pseudocódigo acima), assim como foi "
"resumido em :ref:`uma seção posterior <import-mod-attrs>`."
#: ../../reference/import.rst:392
msgid ""
"Module execution is the key moment of loading in which the module's "
"namespace gets populated. Execution is entirely delegated to the loader, "
"which gets to decide what gets populated and how."
msgstr ""
"Execução de módulo é o momento chave do carregamento, no qual o espaço de "
"nomes do módulo é populado. Execução é inteiramente delegada para o "
"carregador, o qual pode decidir o que será populado e como."
#: ../../reference/import.rst:396
msgid ""
"The module created during loading and passed to exec_module() may not be the "
"one returned at the end of import [#fnlo]_."
msgstr ""
"O módulo criado durante o carregamento e passado para exec_module() pode não "
"ser aquele retornado ao final da importação [#fnlo]_."
#: ../../reference/import.rst:399
msgid ""
"The import system has taken over the boilerplate responsibilities of "
"loaders. These were previously performed by "
"the :meth:`importlib.abc.Loader.load_module` method."
msgstr ""
"O sistema de importação tem tomado conta das responsabilidades inerentes dos "
"carregadores. Essas responsabilidades eram anteriormente executadas pelo "
"método :meth:`importlib.abc.Loader.load_module`."
#: ../../reference/import.rst:405
msgid "Loaders"
msgstr "Carregadores"
#: ../../reference/import.rst:407
msgid ""
"Module loaders provide the critical function of loading: module execution. "
"The import machinery calls the :meth:`importlib.abc.Loader.exec_module` "
"method with a single argument, the module object to execute. Any value "
"returned from :meth:`~importlib.abc.Loader.exec_module` is ignored."
msgstr ""
"Os carregadores de módulo fornecem a função crítica de carregamento: "
"execução do módulo. O mecanismo de importação chama o "
"método :meth:`importlib.abc.Loader.exec_module` com um único argumento, o "
"objeto do módulo a ser executado. Qualquer valor retornado "
"de :meth:`~importlib.abc.Loader.exec_module` é ignorado."
#: ../../reference/import.rst:412
msgid "Loaders must satisfy the following requirements:"
msgstr "Os carregadores devem atender aos seguintes requisitos:"
#: ../../reference/import.rst:414
msgid ""
"If the module is a Python module (as opposed to a built-in module or a "
"dynamically loaded extension), the loader should execute the module's code "
"in the module's global name space (``module.__dict__``)."
msgstr ""
"Se o módulo for um módulo Python (em oposição a um módulo embutido ou uma "
"extensão carregada dinamicamente), o carregador deve executar o código do "
"módulo no espaço de nomes global do módulo (``module.__dict__``)."
#: ../../reference/import.rst:418
msgid ""
"If the loader cannot execute the module, it should raise "
"an :exc:`ImportError`, although any other exception raised "
"during :meth:`~importlib.abc.Loader.exec_module` will be propagated."
msgstr ""
"Se o carregador não puder executar o módulo, ele deve levantar uma "
"execção :exc:`ImportError`, embora qualquer outra exceção levantada "
"durante :meth:`~importlib.abc.Loader.exec_module` será propagada."
#: ../../reference/import.rst:422
msgid ""
"In many cases, the finder and loader can be the same object; in such cases "
"the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return "
"a spec with the loader set to ``self``."
msgstr ""
"Em muitos casos, o localizador e o carregador podem ser o mesmo objeto; "
"nesses casos o método :meth:`~importlib.abc.MetaPathFinder.find_spec` apenas "
"retornaria um spec com o carregador definido como ``self``."
#: ../../reference/import.rst:426
msgid ""
"Module loaders may opt in to creating the module object during loading by "
"implementing a :meth:`~importlib.abc.Loader.create_module` method. It takes "
"one argument, the module spec, and returns the new module object to use "
"during loading. ``create_module()`` does not need to set any attributes on "
"the module object. If the method returns ``None``, the import machinery "
"will create the new module itself."
msgstr ""
"Os carregadores de módulo podem optar por criar o objeto do módulo durante o "
"carregamento, implementando um "
"método :meth:`~importlib.abc.Loader.create_module`. Leva um argumento, o "
"spec de módulo e retorna o novo objeto do módulo para usar durante o "
"carregamento. ``create_module()`` não precisa definir nenhum atributo no "
"objeto do módulo. Se o método retornar ``None``, o mecanismo de importação "
"criará ele mesmo o novo módulo."
#: ../../reference/import.rst:433
msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders."
msgstr "O método :meth:`~importlib.abc.Loader.create_module` de carregadores."
#: ../../reference/import.rst:436
msgid ""
"The :meth:`~importlib.abc.Loader.load_module` method was replaced "
"by :meth:`~importlib.abc.Loader.exec_module` and the import machinery "
"assumed all the boilerplate responsibilities of loading."
msgstr ""
"O método :meth:`~importlib.abc.Loader.load_module` foi substituído "
"por :meth:`~importlib.abc.Loader.exec_module` e o mecanismo de importação "
"assumiu todas as responsabilidades inerentes de carregamento."
#: ../../reference/import.rst:441
msgid ""
"For compatibility with existing loaders, the import machinery will use the "
"``load_module()`` method of loaders if it exists and the loader does not "
"also implement ``exec_module()``. However, ``load_module()`` has been "
"deprecated and loaders should implement ``exec_module()`` instead."
msgstr ""
"Para compatibilidade com carregadores existentes, o mecanismo de importação "
"usará o método ``load_module()`` de carregadores se ele existir e o "
"carregador também não implementar ``exec_module()``. No entanto, "
"``load_module()`` foi descontinuado e os carregadores devem implementar "
"``exec_module()`` em seu lugar."
#: ../../reference/import.rst:446
msgid ""
"The ``load_module()`` method must implement all the boilerplate loading "
"functionality described above in addition to executing the module. All the "
"same constraints apply, with some additional clarification:"
msgstr ""
"O método ``load_module()`` deve implementar toda a funcionalidade inerente "
"de carregamento descrita acima, além de executar o módulo. Todas as mesmas "
"restrições se aplicam, com alguns esclarecimentos adicionais:"
#: ../../reference/import.rst:450
msgid ""
"If there is an existing module object with the given name "
"in :data:`sys.modules`, the loader must use that existing module. "
"(Otherwise, :func:`importlib.reload` will not work correctly.) If the named "
"module does not exist in :data:`sys.modules`, the loader must create a new "
"module object and add it to :data:`sys.modules`."
msgstr ""
"Se houver um objeto de módulo existente com o nome fornecido "
"em :data:`sys.modules`, o carregador deverá usar esse módulo existente. "
"(Caso contrário, :func:`importlib.reload` não funcionará corretamente.) Se o "
"módulo nomeado não existir em :data:`sys.modules`, o carregador deverá criar "
"um novo objeto de módulo e adicioná-lo a :data:`sys.modules`."
#: ../../reference/import.rst:456
msgid ""
"The module *must* exist in :data:`sys.modules` before the loader executes "
"the module code, to prevent unbounded recursion or multiple loading."
msgstr ""
"O módulo *deve* existir em :data:`sys.modules` antes que o carregador "
"execute o código do módulo, para evitar recursão ilimitada ou carregamento "
"múltiplo."
#: ../../reference/import.rst:460
msgid ""
"If loading fails, the loader must remove any modules it has inserted "
"into :data:`sys.modules`, but it must remove **only** the failing module(s), "
"and only if the loader itself has loaded the module(s) explicitly."
msgstr ""
"Se o carregamento falhar, o carregador deverá remover quaisquer módulos "
"inseridos em :data:`sys.modules`, mas deverá remover **apenas** o(s) "
"módulo(s) com falha, e somente se o próprio carregador tiver carregado o(s) "
"módulo(s) explicitamente."
#: ../../reference/import.rst:465
msgid ""
"A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but "
"``create_module()`` is not."
msgstr ""
"Uma exceção :exc:`DeprecationWarning` é levantada quando ``exec_module()`` "
"está definido, mas ``create_module()`` não."
#: ../../reference/import.rst:469
msgid ""
"An :exc:`ImportError` is raised when ``exec_module()`` is defined but "
"``create_module()`` is not."
msgstr ""
"Uma exceção :exc:`ImportError` é levantada quando ``exec_module()`` está "
"definido, mas ``create_module()`` não."
#: ../../reference/import.rst:474
msgid "Submodules"
msgstr "Submódulos"
#: ../../reference/import.rst:476
msgid ""
"When a submodule is loaded using any mechanism (e.g. ``importlib`` APIs, the "
"``import`` or ``import-from`` statements, or built-in ``__import__()``) a "
"binding is placed in the parent module's namespace to the submodule object. "
"For example, if package ``spam`` has a submodule ``foo``, after importing "
"``spam.foo``, ``spam`` will have an attribute ``foo`` which is bound to the "
"submodule. Let's say you have the following directory structure::"
msgstr ""
"Quando um submódulo é carregado usando qualquer mecanismo (por exemplo, APIs "
"``importlib``, as instruções ``import`` ou ``import-from``, ou a função "
"``__import__()`` embutida) uma ligação é colocada no espaço de nomes do "
"módulo pai para o objeto submódulo. Por exemplo, se o pacote ``spam`` tiver "
"um submódulo ``foo``, após importar ``spam.foo``, ``spam`` terá um atributo "
"``foo`` que está vinculado ao submódulo. Digamos que você tenha a seguinte "
"estrutura de diretórios::"
#: ../../reference/import.rst:488
msgid "and ``spam/__init__.py`` has the following lines in it::"
msgstr ""
#: ../../reference/import.rst:493
msgid ""
"then executing the following puts a name binding to ``foo`` and ``bar`` in "
"the ``spam`` module::"
msgstr ""
#: ../../reference/import.rst:502
msgid ""
"Given Python's familiar name binding rules this might seem surprising, but "
"it's actually a fundamental feature of the import system. The invariant "
"holding is that if you have ``sys.modules['spam']`` and "
"``sys.modules['spam.foo']`` (as you would after the above import), the "
"latter must appear as the ``foo`` attribute of the former."
msgstr ""
"Dadas as conhecidas regras de ligação de nomes do Python, isso pode parecer "
"surpreendente, mas na verdade é um recurso fundamental do sistema de "
"importação. A propriedade invariante é que se você tiver "
"``sys.modules['spam']`` e ``sys.modules['spam.foo']`` (como faria após a "
"importação acima), o último deve aparecer como o atributo ``foo`` do "
"primeiro."
#: ../../reference/import.rst:509
msgid "Module spec"
msgstr "Especificação do módulo"
#: ../../reference/import.rst:511
msgid ""
"The import machinery uses a variety of information about each module during "
"import, especially before loading. Most of the information is common to all "
"modules. The purpose of a module's spec is to encapsulate this import-"
"related information on a per-module basis."
msgstr ""
"O mecanismo de importação utiliza diversas informações sobre cada módulo "
"durante a importação, principalmente antes do carregamento. A maior parte "
"das informações é comum a todos os módulos. O propósito da spec do módulo é "
"encapsular essas informações relacionadas à importação por módulo."
#: ../../reference/import.rst:516
msgid ""
"Using a spec during import allows state to be transferred between import "
"system components, e.g. between the finder that creates the module spec and "
"the loader that executes it. Most importantly, it allows the import "
"machinery to perform the boilerplate operations of loading, whereas without "
"a module spec the loader had that responsibility."
msgstr ""
"Usar um spec durante a importação permite que o estado seja transferido "
"entre componentes do sistema de importação, por exemplo entre o localizador "
"que cria o spec de módulo e o carregador que o executa. Mais importante "
"ainda, permite que o mecanismo de importação execute as operações inerentes "
"de carregamento, enquanto que sem um spec de módulo o carregador tinha essa "
"responsabilidade."
#: ../../reference/import.rst:522
msgid ""
"The module's spec is exposed as the ``__spec__`` attribute on a module "
"object. See :class:`~importlib.machinery.ModuleSpec` for details on the "
"contents of the module spec."
msgstr ""
"A especificação do módulo é exposta como o atributo ``__spec__`` em um "
"objeto módulo. Veja :class:`~importlib.machinery.ModuleSpec` para detalhes "
"sobre o conteúdo da especificação do módulo."
#: ../../reference/import.rst:531
msgid "Import-related module attributes"
msgstr "Atributos de módulo relacionados à importação"
#: ../../reference/import.rst:533
msgid ""
"The import machinery fills in these attributes on each module object during "
"loading, based on the module's spec, before the loader executes the module."
msgstr ""