-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathimport.po
More file actions
751 lines (549 loc) · 113 KB
/
Copy pathimport.po
File metadata and controls
751 lines (549 loc) · 113 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
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Alireza Shabani (Revisto) <theRevisto@gmail.com>, 2025
# Danial Behzadi <dani.behzi@ubuntu.com>, 2025
# Rafael Fontenelle <rffontenelle@gmail.com>, 2025
# Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-17 13:34+0330\n"
"PO-Revision-Date: 2026-09-13 14:37+0330\n"
"Last-Translator: Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026\n"
"Language-Team: Persian (https://github.com/python/python-docs-fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.6\n"
msgid "The import system"
msgstr "سیستم ایمپورت"
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 "کد پایتون در یک :term:`ماژول <module>`، با فرآیند :term:`ایمپورت <importing>` کردن ماژول دیگر، به کد آن دسترسی پیدا میکند. دستور :keyword:`import` رایجترین روش برای فراخوانی سازوکار ایمپورت است، اما تنها روش نیست. همچنین میتوان از توابعی مانند :func:`importlib.import_module` و تابع توکار :func:`__import__` برای فراخوانی سازوکار ایمپورت استفاده کرد."
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 "دستور :keyword:`import` دو عملیات را ترکیب میکند؛ این دستور به دنبال ماژول نامبرده جستوجو میکند، سپس نتایج آن جستوجو را به یک نام در محدوده محلی مقید میکند. عملیات جستوجوی دستور :keyword:`!import` بهعنوان فراخوانی تابع :func:`__import__`، با آرگومانهای مناسب تعریف شده است. مقدار بازگشتی :func:`__import__` برای انجام عملیات مقیدسازی نامِ دستور :keyword:`!import` استفاده میشود. برای جزئیات دقیق آن عملیات اتصال نام، دستور :keyword:`!import` را ببینید."
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 "فراخوانی مستقیمِ :func:`__import__` فقط جستوجوی ماژول و در صورت پیدا شدن، عملیات ایجاد ماژول را انجام میدهد. اگرچه ممکن است عوارض جانبی خاصی، مانند ایمپورت شدن بستههای والد و بهروزرسانی نهانگاههای مختلف (از جمله :data:`sys.modules`)، رخ دهد، تنها دستور :keyword:`import` عملیات پیوند نام را انجام میدهد."
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 "هنگامی که یک دستور :keyword:`import` اجرا میشود، تابع توکار استاندارد :func:`__import__` فراخوانی میشود. سایر سازوکارهای فراخوانی سیستم ایمپورت (مانند :func:`importlib.import_module`) ممکن است انتخاب کنند که :func:`__import__` را دور بزنند و از راهحلهای خود برای پیادهسازی معناشناسی ایمپورت استفاده کنند."
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 "هنگامی که یک ماژول برای نخستین بار ایمپورت میشود، پایتون به جستوجوی آن ماژول میپردازد و در صورت یافت شدن، یک شیء ماژول ایجاد میکند [#fnmo]_ و آن را مقداردهی اولیه میکند. اگر ماژول نامبردهشده یافت نشود، یک :exc:`ModuleNotFoundError` پرتاب میشود. پایتون هنگامی که سازوکار ایمپورت فراخوانی میشود، راهبردهای مختلفی را برای جستوجوی ماژول نامبردهشده پیادهسازی میکند. این راهبردها را میتوان با استفاده از قلابهای مختلفی که در بخشهای زیر توضیح داده شدهاند، تغییر داد و گسترش داد."
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 "سامانهی ایمپورت برای پیادهسازی کامل فاز دوم :pep:`302` بهروزرسانی شده است. دیگر هیچ سازوکار ایمپورت ضمنی وجود ندارد؛ سامانهی کامل ایمپورت از طریق :data:`sys.meta_path` در معرض قرار گرفته است. علاوه بر این، پشتیبانی از بستههای فضای نام بومی پیادهسازی شده است (به :pep:`420` مراجعه کنید)."
msgid ":mod:`importlib`"
msgstr ":mod:`importlib`"
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 "ماژول :mod:`importlib` یک API غنی برای تعامل با سامانهی ایمپورت فراهم میکند. برای مثال، :func:`importlib.import_module` در مقایسه با :func:`__import__` توکار، API سادهتر و توصیهشدهای برای فراخوانی سازوکار ایمپورت ارائه میدهد. برای جزئیات بیشتر به مستندات کتابخانهی :mod:`importlib` مراجعه کنید."
msgid "Packages"
msgstr "بستهها"
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 "پایتون تنها یک نوع شیء ماژول دارد و همهی ماژولها از این نوع هستند، صرفنظر از اینکه ماژول با پایتون، C یا چیز دیگری پیادهسازی شده باشد. برای کمک به سازماندهی ماژولها و ایجاد سلسلهمراتب نامگذاری، پایتون دارای مفهوم :term:`بستهها <package>` است."
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 "میتوانید بستهها را پوشههایی در یک سامانه فایلبندی و ماژولها را پروندههایی درون پوشهها در نظر بگیرید، اما این تشبیه را بیش از حد واقعی تلقی نکنید، زیرا بستهها و ماژولها لزوماً از سامانه فایلبندی منشأ نمیگیرند. برای اهداف این مستندات، از این تشبیه مناسب میان پوشهها و پروندهها استفاده خواهیم کرد. مانند پوشههای سامانه فایلبندی، بستهها بهصورت سلسلهمراتبی سازماندهی شدهاند و بستهها ممکن است خود شامل زیربستهها و همچنین ماژولهای معمولی باشند."
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 "مهم است بهخاطر داشته باشید که همهی بستهها ماژول هستند، اما همهی ماژولها بسته نیستند. یا به بیان دیگر، بستهها تنها نوع ویژهای از ماژول هستند. بهطور مشخص، هر ماژولی که دارای ویژگی ``__path__`` باشد، بسته محسوب میشود."
msgid "All modules have a name. Subpackage names are separated from their parent package name by a dot, akin to Python's standard attribute access syntax. Thus you might have 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 "تمام ماژولها نام دارند. نام زیربستهها با یک نقطه از نام بسته والد آنها جدا میشود، شبیه به سینتکس استاندارد دسترسی به ویژگی در پایتون. بنابراین ممکن است بستهای به نام :mod:`email` داشته باشید که به نوبهی خود، زیربستهای به نام :mod:`email.mime` و ماژولی درون آن زیربسته به نام :mod:`email.mime.text` دارد."
msgid "Regular packages"
msgstr "بستههای معمولی"
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 "پایتون دو نوع بسته را تعریف میکند: :term:`بستههای معمولی <regular package>` و :term:`بستههای فضای نام <namespace package>`. بستههای معمولی همان بستههای سنتی هستند که در پایتون 3.2 و نسخههای پیشین وجود داشتند. یک بسته معمولی معمولاً بهصورت پوشهای حاوی یک پرونده ``__init__.py`` پیادهسازی میشود. هنگامی که یک بسته معمولی ایمپورت میشود، این پرونده ``__init__.py`` بهطور ضمنی اجرا میشود و شیءهایی که تعریف میکند به نامهایی در فضای نام بسته مقید میشوند. پرونده ``__init__.py`` میتواند حاوی همان کد پایتونی باشد که هر ماژول دیگری میتواند حاوی آن باشد، و پایتون هنگام ایمپورت شدن ماژول، چند ویژگی اضافی به آن اضافه میکند."
msgid "For example, the following file system layout defines a top level ``parent`` package with three subpackages::"
msgstr "برای مثال، چیدمان سامانه فایلبندی زیر یک بسته ``parent`` در سطح بالا را با سه زیربسته تعریف میکند::"
msgid ""
"parent/\n"
" __init__.py\n"
" one/\n"
" __init__.py\n"
" two/\n"
" __init__.py\n"
" three/\n"
" __init__.py"
msgstr ""
"parent/\n"
" __init__.py\n"
" one/\n"
" __init__.py\n"
" two/\n"
" __init__.py\n"
" three/\n"
" __init__.py"
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 "ایمپورت کردن ``parent.one`` بهطور ضمنی ``parent/__init__.py`` و ``parent/one/__init__.py`` را اجرا میکند. ایمپورتهای بعدی ``parent.two`` یا ``parent.three`` بهترتیب ``parent/two/__init__.py`` و ``parent/three/__init__.py`` را اجرا میکنند."
msgid "A subdirectory inside a regular package that does not contain an ``__init__.py`` file is treated as an implicit :ref:`namespace package <reference-namespace-package>` (a \"namespace subpackage\") rooted in that parent. See :pep:`420` for the underlying specification."
msgstr "یک زیرپوشهی فاقد پرونده ``__init__.py`` درون یک بستهی معمولی، بهعنوان یک :ref:`بستهی فضای نام ضمنی <reference-namespace-package>` (یک «زیربستهی فضای نام») که ریشه در آن والد دارد در نظر گرفته میشود. برای مشخصات زیربنایی، :pep:`420` را ببینید."
msgid "Namespace packages"
msgstr "بستههای فضای نام"
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 "یک بسته فضای نام ترکیبی از :term:`بخشها <portion>` مختلف است، که هر بخش یک زیربسته را به بسته والد اضافه میکند. بخشها ممکن است در مکانهای مختلفی در سامانه فایلبندی قرار داشته باشند. بخشها همچنین ممکن است در پروندههای zip، روی شبکه، یا هر جای دیگری که پایتون در حین ایمپورت جستجو میکند، یافت شوند. بستههای فضای نام ممکن است مستقیماً با اشیای روی سامانه فایلبندی متناظر باشند یا نباشند؛ آنها ممکن است ماژولهای مجازی باشند که هیچ بازنمایی عینی ندارند."
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 "بستههای فضای نام برای ویژگی ``__path__`` خود از یک فهرست معمولی استفاده نمیکنند. در عوض، از یک نوع پیمایشپذیر سفارشی استفاده میکنند که اگر مسیر بسته والد آنها (یا :data:`sys.path` برای یک بسته سطح بالا) تغییر کند، در تلاش بعدی برای ایمپورت درون آن بسته، بهطور خودکار جستوجوی جدیدی برای بخشهای بسته انجام میدهد."
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 "در بستههای فضای نام، هیچ پرونده ``parent/__init__.py`` وجود ندارد. در واقع، ممکن است در حین جستوجوی ایمپورت، چندین پوشه ``parent`` پیدا شوند که هر یک از بخش متفاوتی فراهم شده است. بنابراین ممکن است ``parent/one`` از نظر فیزیکی در کنار ``parent/two`` قرار نداشته باشد. در این حالت، پایتون برای بسته سطح بالای ``parent``، هر زمان که آن بسته یا یکی از زیربستههای آن ایمپورت شود، یک بسته فضای نام ایجاد میکند."
msgid "Namespace packages may also be nested inside a regular package. When the import system searches a regular package's ``__path__`` and encounters a subdirectory that does not contain an ``__init__.py`` file, that subdirectory becomes a :term:`portion` contributing to a namespace subpackage of the enclosing regular package."
msgstr "بستههای فضای نام همچنین ممکن است درون یک بسته معمولی تودرتو شوند. هنگامی که سامانهی ایمپورت ``__path__`` یک بسته معمولی را جستوجو میکند و با زیرپوشهای مواجه میشود که حاوی پرونده ``__init__.py`` نیست، آن زیرپوشه به یک :term:`بخش <portion>` تبدیل میشود که در زیربستهی فضای نام بستهی معمولی دربرگیرنده سهم دارد."
msgid "See also :pep:`420` for the namespace package specification."
msgstr "همچنین :pep:`420` را برای مشخصات بستهی فضای نام ببینید."
msgid "Searching"
msgstr "جستجو"
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 "برای آغاز جستوجو، پایتون به نام :term:`کامل <qualified name>` ماژول (یا بسته، اما برای اهداف این بحث، تفاوت میان آنها بیاهمیت است) که ایمپورت میشود نیاز دارد. این نام ممکن است از آرگومانهای مختلف دستور :keyword:`import` یا از پارامترهای توابع :func:`importlib.import_module` یا :func:`__import__` آمده باشد."
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 "این نام در مراحل مختلف جستجوی ایمپورت استفاده خواهد شد و ممکن است مسیر نقطهدار به یک زیرماژول باشد، مثلاً ``foo.bar.baz``. در این حالت، پایتون ابتدا تلاش میکند ``foo`` را ایمپورت کند، سپس ``foo.bar`` و در نهایت ``foo.bar.baz`` را. اگر هر یک از ایمپورتهای میانی ناموفق باشند، یک :exc:`ModuleNotFoundError` پرتاب میشود."
msgid "The module cache"
msgstr "نهانگاه ماژول"
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 "نخستین مکانی که در جستجوی ایمپورت بررسی میشود، :data:`sys.modules` است. این نگاشت بهعنوان نهانگاهی برای همه ماژولهایی که پیشتر ایمپورت شدهاند، از جمله مسیرهای میانی، عمل میکند. بنابراین اگر ``foo.bar.baz`` پیشتر ایمپورت شده باشد، :data:`sys.modules` شامل ورودیهایی برای ``foo``، ``foo.bar`` و ``foo.bar.baz`` خواهد بود. هر کلید بهعنوان مقدار خود، شیء ماژول متناظر را خواهد داشت."
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 "هنگام ایمپورت، نام ماژول در :data:`sys.modules` جستجو میشود و در صورت وجود، مقدار مرتبط، ماژولی است که ایمپورت را برآورده میکند و فرآیند تکمیل میشود. با این حال، اگر مقدار ``None`` باشد، استثنای :exc:`ModuleNotFoundError` پرتاب میشود. اگر نام ماژول وجود نداشته باشد، پایتون به جستجو برای ماژول ادامه میدهد."
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 ":data:`sys.modules` قابل نوشتن است. حذف یک کلید ممکن است ماژول مرتبط را از بین نبرد (زیرا ماژولهای دیگر ممکن است ارجاعاتی به آن داشته باشند)، اما ورودی نهانگاه برای ماژول نامبرده را نامعتبر میکند و باعث میشود پایتون در ایمپورت بعدی، دوباره برای ماژول نامبرده جستجو کند. همچنین میتوان این کلید را به ``None`` انتساب داد، بهطوری که ایمپورت بعدی ماژول منجر به :exc:`ModuleNotFoundError` شود."
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 "اما توجه داشته باشید، زیرا اگر ارجاعی به شیء ماژول نگه دارید، ورودی نهانگاه آن را در :data:`sys.modules` نامعتبر کنید و سپس ماژول نامبردهشده را دوباره ایمپورت کنید، دو شیء ماژول با هم یکسان *نخواهند بود*. در مقابل، :func:`importlib.reload` از *همان* شیء ماژول استفاده مجدد خواهد کرد و بهسادگی با اجرای دوباره کد ماژول، محتویات ماژول را دوباره مقداردهی اولیه میکند."
msgid "Finders and loaders"
msgstr "یابندهها و بارگذارها"
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 "اگر ماژول نامبردهشده در :data:`sys.modules` پیدا نشود، آنگاه پروتکل ایمپورت پایتون برای یافتن و بارگذاری ماژول فراخوانی میشود. این پروتکل از دو شیء مفهومی تشکیل شده است: :term:`یابندهها <finder>` و :term:`بارگذارها <loader>`. وظیفهی یک یافتنده این است که تعیین کند آیا میتواند ماژول نامبردهشده را با استفاده از هر راهبردی که میشناسد پیدا کند. اشیایی که هر دوی این رابطها را پیادهسازی میکنند، :term:`ایمپورتکنندهها <importer>` نامیده میشوند — آنها وقتی دریابند که میتوانند ماژول درخواستشده را بارگذاری کنند، خودشان را برمیگردانند."
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 "پایتون شامل تعدادی یابنده و ایمپورتکنندهی پیشفرض است. اولی میداند چگونه ماژولهای توکار را مکانیابی کند، و دومی میداند چگونه ماژولهای فریزشده (frozen modules) را مکانیابی کند. سومین یابندهی پیشفرض، یک :term:`import path` را برای یافتن ماژولها جستجو میکند. :term:`import path` فهرستی از مکانهاست که ممکن است مسیرهای سامانه فایلبندی یا پروندههای zip را مشخص کنند. همچنین میتوان آن را گسترش داد تا برای هر منبع قابلمکانیابی، مانند منابعی که با URLها شناسایی میشوند، جستجو کند."
msgid "The import machinery is extensible, so new finders can be added to extend the range and scope of module searching."
msgstr "سازوکار ایمپورت قابل گسترش است، بنابراین میتوان با افزودن یابندههای جدید، گستره و محدودهی جستجوی ماژول را گسترش داد."
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 "یابندهها در واقع ماژولها را بارگذاری نمیکنند. اگر بتوانند ماژول نامبردهشده را بیابند، یک :dfn:`module spec` برمیگردانند، یعنی دربرگیرندهای از اطلاعات مرتبط با ایمپورت ماژول، که سپس سازوکار ایمپورت هنگام بارگذاری ماژول از آن استفاده میکند."
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 "بخشهای زیر پروتکل مربوط به یابندهها و بارگذارها را با جزئیات بیشتر شرح میدهند، از جمله اینکه چگونه میتوانید یابندهها و بارگذارهای جدیدی را ایجاد و ثبت کنید تا سازوکار ایمپورت را گسترش دهید."
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 "در نسخههای پیشین پایتون، یابندهها :term:`بارگذارها <loader>` را مستقیماً برمیگرداندند، در حالی که اکنون مشخصات ماژولها را برمیگردانند که *شامل* بارگذارها هستند. بارگذارها هنوز در هنگام ایمپورت استفاده میشوند، اما مسئولیتهای کمتری دارند."
msgid "Import hooks"
msgstr "قلابهای ایمپورت"
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 "سازوکار ایمپورت بهگونهای طراحی شده است که گسترشپذیر باشد؛ سازوکار اصلی برای این منظور، *قلابهای ایمپورت* است. دو نوع قلاب ایمپورت وجود دارد: *فراقلابها* و *قلابهای مسیر ایمپورت (import path hooks)*."
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 "فراقلابها در آغاز پردازش ایمپورت فراخوانی میشوند، پیش از آنکه هرگونه پردازش ایمپورت دیگری، بهجز جستوجو در نهانگاه :data:`sys.modules` رخ داده باشد. این امر به فراقلابها امکان میدهد که بر پردازش :data:`sys.path`، ماژولهای فریزشده، یا حتی ماژولهای توکار تقدم داشته باشند. فراقلابها با افزودن اشیای یابندهی جدید (finder objects) به :data:`sys.meta_path` ثبت میشوند، همانطور که در ادامه توضیح داده شده است."
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 "قلابهای مسیر ایمپورت بهعنوان بخشی از پردازش :data:`sys.path` (یا ``package.__path__``) فراخوانی میشوند، در نقطهای که آیتم مسیر مرتبط با آنها مشاهده میشود. قلابهای مسیر ایمپورت با افزودن فراخوانیپذیرهای جدید به :data:`sys.path_hooks` همانطور که در زیر توضیح داده شده است، ثبت میشوند."
msgid "The meta path"
msgstr "فرامسیر"
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 "هنگامی که ماژول نامبردهشده در :data:`sys.modules` یافت نشود، پایتون سپس :data:`sys.meta_path` را جستجو میکند، که شامل فهرستی از اشیاء یابندهی مسیر متا (meta path finder) است. این یابندهها بهترتیب مورد پرسوجو قرار میگیرند تا مشخص شود که آیا میدانند چگونه ماژول نامبردهشده را مدیریت کنند یا خیر. یابندههای فرامسیر باید متدی به نام :meth:`~importlib.abc.MetaPathFinder.find_spec` را پیادهسازی کنند که سه آرگومان دریافت میکند: یک نام، یک مسیر ایمپورت، و (بهصورت اختیاری) یک ماژول هدف. یابندهی فرامسیر میتواند برای تعیین اینکه آیا میتواند ماژول نامبردهشده را مدیریت کند یا خیر، از هر راهبردی که بخواهد استفاده کند."
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 "اگر یابندهی فرامسیر (meta path finder) بداند چگونه ماژول نامبرده را مدیریت کند، یک شیء مشخصات برمیگرداند. اگر نتواند ماژول نامبرده را مدیریت کند، ``None`` برمیگرداند. اگر پردازش :data:`sys.meta_path` بدون برگرداندن یک spec به انتهای فهرست خود برسد، آنگاه یک :exc:`ModuleNotFoundError` پرتاب میشود. هر استثنای دیگری که پرتاب شود، صرفاً به بالا منتشر میشود و فرآیند ایمپورت را متوقف میکند."
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 "متد :meth:`~importlib.abc.MetaPathFinder.find_spec` مربوط به فرایابندههای مسیربا دو یا سه آرگومان فراخوانی میشود. اولین آرگومان، نام کامل ماژولی است که ایمپورت میشود، برای مثال ``foo.bar.baz``. دومین آرگومان، ورودیهای مسیر مورد استفاده برای جستوجوی ماژول است. برای ماژولهای سطح بالا، دومین آرگومان ``None`` است، اما برای زیرماژولها یا زیربستهها، دومین آرگومان مقدار ویژگی ``__path__`` بسته والد است. اگر ویژگی ``__path__`` مربوطه قابل دسترسی نباشد، استثنای :exc:`ModuleNotFoundError` پرتاب میشود. سومین آرگومان، یک شیء ماژول موجود است که بعداً هدف بارگذاری خواهد بود. سیستم ایمپورت تنها در هنگام بارگذاری مجدد، یک ماژول هدف را ارسال میکند."
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 "فرامسیرممکن است برای یک درخواست ایمپورت واحد چندین بار پیمایش شود. برای مثال، با فرض اینکه هیچکدام از ماژولهای دخیل از قبل در نهانگاه ذخیرهنشده باشند، ایمپورت کردن ``foo.bar.baz`` ابتدا یک ایمپورت سطحبالا انجام میدهد و ``mpf.find_spec(\"foo\", None, None)`` را روی هر یابنده مسیر متا (``mpf``) فراخوانی میکند. پس از اینکه ``foo`` ایمپورت شد، ``foo.bar`` با پیمایش فرامسیر برای بار دوم ایمپورت میشود و ``mpf.find_spec(\"foo.bar\", foo.__path__, None)`` فراخوانی میشود. هنگامی که ``foo.bar`` ایمپورت شد، پیمایش نهایی ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)`` را فراخوانی میکند."
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 "برخی از یابنده های فرامسیر فقط از ایمپورتهای سطح بالا پشتیبانی میکنند. این ایمپورتکنندهها هرگاه هر چیزی غیر از ``None`` بهعنوان آرگومان دوم ارسال شود، همیشه ``None`` را برمیگردانند."
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 ":data:`sys.meta_path` پیشفرض پایتون دارای سه فرایابندهی مسیر (meta path finders) است: یکی که میداند چگونه ماژولهای توکار را ایمپورت کند، یکی که میداند چگونه ماژولهای فریزشده (frozen modules) را ایمپورت کند، و یکی که میداند چگونه ماژولها را از یک :term:`import path` ایمپورت کند (یعنی :term:`یابندهی مبتنی بر مسیر <path based finder>`)."
msgid "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path finders replaced :meth:`!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 :meth:`~importlib.abc.MetaPathFinder.find_spec`."
msgstr "متد :meth:`~importlib.abc.MetaPathFinder.find_spec` در یابندههای فرا مسیر جایگزین :meth:`!find_module` شد که اکنون منسوخ است. اگرچه این متد همچنان بدون تغییر به کار خود ادامه خواهد داد، سازوکار ایمپورت تنها در صورتی آن را امتحان میکند که یابنده، :meth:`~importlib.abc.MetaPathFinder.find_spec` را پیادهسازی نکرده باشد."
msgid "Use of :meth:`!find_module` by the import system now raises :exc:`ImportWarning`."
msgstr "استفاده از :meth:`!find_module` توسط سامانهی ایمپورت اکنون :exc:`ImportWarning` را پرتاب میکند."
msgid ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc.MetaPathFinder.find_spec` instead."
msgstr ":meth:`!find_module` حذف شده است. بهجای آن از :meth:`~importlib.abc.MetaPathFinder.find_spec` استفاده کنید."
msgid "Loading"
msgstr "بارگذاری"
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 "اگر و زمانی که مشخصات ماژول یافت شود، سازوکار ایمپورت از آن (و بارگذار درون آن) هنگام بارگذاری ماژول استفاده میکند. در ادامه تقریبی از آنچه در بخش بارگذاری ایمپورت رخ میدهد آمده است::"
msgid ""
"module = None\n"
"if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n"
" # It is assumed 'exec_module' will also be defined on the loader.\n"
" module = spec.loader.create_module(spec)\n"
"if module is None:\n"
" module = ModuleType(spec.name)\n"
"# The import-related module attributes get set here:\n"
"_init_module_attrs(spec, module)\n"
"\n"
"if spec.loader is None:\n"
" # unsupported\n"
" raise ImportError\n"
"if spec.origin is None and spec.submodule_search_locations is not None:\n"
" # namespace package\n"
" sys.modules[spec.name] = module\n"
"elif not hasattr(spec.loader, 'exec_module'):\n"
" module = spec.loader.load_module(spec.name)\n"
"else:\n"
" sys.modules[spec.name] = module\n"
" try:\n"
" spec.loader.exec_module(module)\n"
" except BaseException:\n"
" try:\n"
" del sys.modules[spec.name]\n"
" except KeyError:\n"
" pass\n"
" raise\n"
"return sys.modules[spec.name]"
msgstr ""
"module = None\n"
"if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n"
" # It is assumed 'exec_module' will also be defined on the loader.\n"
" module = spec.loader.create_module(spec)\n"
"if module is None:\n"
" module = ModuleType(spec.name)\n"
"# The import-related module attributes get set here:\n"
"_init_module_attrs(spec, module)\n"
"\n"
"if spec.loader is None:\n"
" # unsupported\n"
" raise ImportError\n"
"if spec.origin is None and spec.submodule_search_locations is not None:\n"
" # namespace package\n"
" sys.modules[spec.name] = module\n"
"elif not hasattr(spec.loader, 'exec_module'):\n"
" module = spec.loader.load_module(spec.name)\n"
"else:\n"
" sys.modules[spec.name] = module\n"
" try:\n"
" spec.loader.exec_module(module)\n"
" except BaseException:\n"
" try:\n"
" del sys.modules[spec.name]\n"
" except KeyError:\n"
" pass\n"
" raise\n"
"return sys.modules[spec.name]"
msgid "Note the following details:"
msgstr "به جزئیات زیر توجه کنید:"
msgid "If there is an existing module object with the given name in :data:`sys.modules`, import will have already returned it."
msgstr "اگر یک شیء ماژول موجود با نام دادهشده در :data:`sys.modules` وجود داشته باشد، ایمپورت آن را از قبل برگردانده است."
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 "ماژول پیش از آنکه بارگذار کد ماژول را اجرا کند، در :data:`sys.modules` وجود خواهد داشت. این موضوع حیاتی است، زیرا کد ماژول ممکن است (بهصورت مستقیم یا غیرمستقیم) خودش را ایمپورت کند؛ افزودن آن از پیش به :data:`sys.modules`، در بدترین حالت از بازگشت نامحدود و در بهترین حالت از بارگذاری چندباره جلوگیری میکند."
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 "اگر بارگذاری ناموفق باشد، ماژول ناموفق — و فقط ماژول ناموفق — از :data:`sys.modules` حذف میشود. هر ماژولی که از قبل در نهانگاه :data:`sys.modules` وجود دارد، و هر ماژولی که بهعنوان اثر جانبی با موفقیت بارگذاری شده باشد، باید در نهانگاه باقی بماند. این برخلاف بارگذاری مجدد است، که در آن حتی ماژول ناموفق نیز در :data:`sys.modules` باقی میماند."
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 "پس از ایجاد ماژول اما پیش از اجرا، سازوکار ایمپورت ویژگیهای ماژول مرتبط با ایمپورت را تنظیم میکند (\"_init_module_attrs\" در مثال شبهکد بالا)، همانطور که در :ref:`بخش بعدی <import-mod-attrs>` خلاصه شده است."
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 "اجرای ماژول، لحظه کلیدی بارگذاری است که در آن فضای نام ماژول پر میشود. اجرا بهطور کامل به بارگذار واگذار میشود، که تصمیم میگیرد چه چیزی و چگونه پر شود."
msgid "The module created during loading and passed to exec_module() may not be the one returned at the end of import [#fnlo]_."
msgstr "ممکن است ماژولی که در حین بارگذاری ایجاد میشود و به exec_module() پاس داده میشود، همان ماژولی نباشد که در پایان ایمپورت برگردانده میشود [#fnlo]_."
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 "سیستم ایمپورت مسئولیتهای قالبی بارگذارها را بر عهده گرفته است. این مسئولیتها پیشتر توسط متد :meth:`importlib.abc.Loader.load_module` انجام میشدند."
msgid "Loaders"
msgstr "بارگذارها"
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 "بارگذارهای ماژول، تابع حیاتی بارگذاری را فراهم میکنند: اجرای ماژول. سازوکار ایمپورت، متد :meth:`importlib.abc.Loader.exec_module` را با یک آرگومان فراخوانی میکند: شیء ماژول برای اجرا. هر مقدار بازگرداندهشده از :meth:`~importlib.abc.Loader.exec_module` نادیده گرفته میشود."
msgid "Loaders must satisfy the following requirements:"
msgstr "بارگذارها باید الزامات زیر را برآورده کنند:"
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 "اگر ماژول یک ماژول پایتون باشد (در مقابل ماژول توکار یا افزونهای که بهصورت پویا بارگذاری میشود)، بارگذار باید کد ماژول را در فضای نام سراسری ماژول (``module.__dict__``) اجرا کند."
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 "اگر بارگذار نتواند ماژول را اجرا کند، باید یک :exc:`ImportError` پرتاب کند، اگرچه هر استثنای دیگری که در حین :meth:`~importlib.abc.Loader.exec_module` پرتاب شود، منتشر خواهد شد."
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 "در بسیاری از موارد، یابنده و بارگذار میتوانند یک شیء باشند؛ در چنین مواردی متد :meth:`~importlib.abc.MetaPathFinder.find_spec` فقط یک مشخصه با بارگذار تنظیمشده روی ``self`` برمیگرداند."
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 "بارگذارهای ماژول میتوانند با پیادهسازی متد :meth:`~importlib.abc.Loader.create_module`، ایجاد شیء ماژول در حین بارگذاری را انتخاب کنند. این متد یک آرگومان، یعنی مشخصات ماژول، را میگیرد و شیء ماژول جدیدی را برای استفاده در حین بارگذاری برمیگرداند. ``create_module()`` نیازی ندارد هیچ ویژگیای را روی شیء ماژول تنظیم کند. اگر این متد ``None`` برگرداند، سازوکار ایمپورت، خودش ماژول جدید را ایجاد خواهد کرد."
msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders."
msgstr "متد :meth:`~importlib.abc.Loader.create_module` بارگذارها."
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 "متد :meth:`~importlib.abc.Loader.load_module` با :meth:`~importlib.abc.Loader.exec_module` جایگزین شد و سازوکار ایمپورت تمام مسئولیتهای قالبی بارگذاری را بر عهده گرفت."
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 "برای سازگاری با بارگذارهای موجود، سازوکار ایمپورت در صورتی از متد ``load_module()`` بارگذارها استفاده میکند که این متد وجود داشته باشد و بارگذار ``exec_module()`` را نیز پیادهسازی نکرده باشد. با این حال، ``load_module()`` منسوخ شده است و بارگذارها باید بهجای آن ``exec_module()`` را پیادهسازی کنند."
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 "متد ``load_module()`` باید علاوه بر اجرای ماژول، تمام عملکرد بارگذاری پیشساخته توصیفشده در بالا را پیادهسازی کند. همهی همان محدودیتها اعمال میشوند، بههمراه چند توضیح تکمیلی:"
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 "اگر یک شیء ماژول موجود با نام دادهشده در :data:`sys.modules` وجود داشته باشد، بارگذار باید از همان ماژول موجود استفاده کند. (در غیر این صورت، :func:`importlib.reload` بهدرستی کار نخواهد کرد.) اگر ماژول نامبردهشده در :data:`sys.modules` وجود نداشته باشد، بارگذار باید یک شیء ماژول جدید ایجاد کند و آن را به :data:`sys.modules` اضافه کند."
msgid "The module *must* exist in :data:`sys.modules` before the loader executes the module code, to prevent unbounded recursion or multiple loading."
msgstr "ماژول *باید* پیش از اجرای کد ماژول توسط بارگذار، در :data:`sys.modules` وجود داشته باشد تا از بازگشت بیحد یا بارگذاری چندگانه جلوگیری شود."
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 "اگر بارگذاری ناموفق باشد، بارگذار باید هر ماژولی را که در :data:`sys.modules` درج کرده است حذف کند، اما باید **فقط** ماژول(های) ناموفق را حذف کند، و فقط در صورتی که خود بارگذار آن ماژول(ها) را بهصراحت بارگذاری کرده باشد."
msgid "A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but ``create_module()`` is not."
msgstr "هنگامی که ``exec_module()`` تعریف شده باشد اما ``create_module()`` تعریف نشده باشد، یک :exc:`DeprecationWarning` پرتاب میشود."
msgid "An :exc:`ImportError` is raised when ``exec_module()`` is defined but ``create_module()`` is not."
msgstr "هنگامی که ``exec_module()`` تعریف شده باشد اما ``create_module()`` تعریف نشده باشد، یک :exc:`ImportError` پرتاب میشود."
msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`."
msgstr "استفاده از ``load_module()`` منجر به پرتاب :exc:`ImportWarning` میشود."
msgid "Submodules"
msgstr "زیرماژولها"
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 "هنگامی که یک زیرماژول با استفاده از هر مکانیزمی بارگذاری میشود (مثلاً APIهای ``importlib``، دستورهای ``import`` یا ``import-from``، یا ``__import__()`` توکار)، یک اتصال به شیء زیرماژول در فضای نام ماژول والد قرار میگیرد. برای مثال، اگر بسته ``spam`` یک زیرماژول ``foo`` داشته باشد، پس از ایمپورت کردن ``spam.foo``، ``spam`` دارای ویژگی ``foo`` خواهد بود که به زیرماژول متصل است. فرض کنید ساختار پوشهی زیر را دارید::"
msgid ""
"spam/\n"
" __init__.py\n"
" foo.py"
msgstr ""
"spam/\n"
" __init__.py\n"
" foo.py"
msgid "and ``spam/__init__.py`` has the following line in it::"
msgstr "و ``spam/__init__.py`` شامل خط زیر است::"
msgid "from .foo import Foo"
msgstr "from .foo import Foo"
msgid "then executing the following puts name bindings for ``foo`` and ``Foo`` in the ``spam`` module::"
msgstr "سپس اجرای دستور زیر، پیوندهای نام برای ``foo`` و ``Foo`` را در ماژول ``spam`` قرار میدهد::"
msgid ""
">>> import spam\n"
">>> spam.foo\n"
"<module 'spam.foo' from '/tmp/imports/spam/foo.py'>\n"
">>> spam.Foo\n"
"<class 'spam.foo.Foo'>"
msgstr ""
">>> import spam\n"
">>> spam.foo\n"
"<module 'spam.foo' from '/tmp/imports/spam/foo.py'>\n"
">>> spam.Foo\n"
"<class 'spam.foo.Foo'>"
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 "با توجه به قوانین آشنای انتساب نام در پایتون، ممکن است این موضوع عجیب به نظر برسد، اما در واقع ویژگی بنیادین سیستم ایمپورت است. ناوردا این است که اگر ``sys.modules['spam']`` و ``sys.modules['spam.foo']`` را داشته باشید (همانطور که پس از ایمپورت بالا خواهید داشت)، دومی باید بهعنوان ویژگی ``foo`` در اولی وجود داشته باشد."
msgid "Module specs"
msgstr "مشخصات ماژول"
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 "سازوکار ایمپورت از اطلاعات گوناگونی درباره هر ماژول در فرآیند ایمپورت، بهویژه پیش از بارگذاری، استفاده میکند. بیشتر این اطلاعات برای همه ماژولها مشترک است. هدف از مشخصات یک ماژول، دربرگرفتن این اطلاعات مرتبط با ایمپورت به ازای هر ماژول است."
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 "استفاده از مشخصات در حین ایمپورت اجازه میدهد وضعیت بین کامپوننتهای سیستم ایمپورت منتقل شود، برای مثال بین یابندهای که مشخصات ماژول را ایجاد میکند و بارگذاری که آن را اجرا میکند. مهمتر از همه، این امر به سازوکار ایمپورت اجازه میدهد عملیات تکراری بارگذاری را انجام دهد، در حالی که بدون مشخصات ماژول، بارگذار آن مسئولیت را بر عهده داشت."
msgid "The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!__spec__` appropriately applies equally to :ref:`modules initialized during interpreter startup <programs>`. The one exception is ``__main__``, where :attr:`!__spec__` is :ref:`set to None in some cases <main_spec>`."
msgstr "مشخصات ماژول بهصورت :attr:`module.__spec__` در دسترس قرار میگیرد. تنظیم مناسب :attr:`!__spec__` بهطور یکسان در مورد :ref:`ماژولهایی که در حین راهاندازی مفسر مقداردهی اولیه میشوند <programs>` اعمال میشود. تنها استثنا ``__main__`` است، که در آن :attr:`!__spec__` :ref:`در برخی موارد روی None تنظیم میشود <main_spec>`."
msgid "See :class:`~importlib.machinery.ModuleSpec` for details on the contents of the module spec."
msgstr "برای جزئیات دربارهی محتوای مشخصات ماژول، :class:`~importlib.machinery.ModuleSpec` را ببینید."
msgid "__path__ attributes on modules"
msgstr "ویژگیهای __path__ در ماژولها"
msgid "The :attr:`~module.__path__` attribute should be a (possibly empty) :term:`sequence` of strings enumerating the locations where the package's submodules will be found. By definition, if a module has a :attr:`!__path__` attribute, it is a :term:`package`."
msgstr "ویژگی :attr:`~module.__path__` باید یک :term:`دنباله <sequence>` (احتمالاً خالی) از رشتهها باشد که محلهایی را که زیرماژولهای بسته در آنها یافت میشوند، فهرست میکند. طبق تعریف، اگر یک ماژول ویژگی :attr:`!__path__` داشته باشد، یک :term:`بسته <package>` است."
msgid "A package's :attr:`~module.__path__` attribute is used during imports of its subpackages. Within the import machinery, it functions much the same as :data:`sys.path`, i.e. providing a list of locations to search for modules during import. However, :attr:`!__path__` is typically much more constrained than :data:`!sys.path`."
msgstr "ویژگی :attr:`~module.__path__` یک بسته در هنگام ایمپورت زیربستههای آن استفاده میشود. در سازوکار ایمپورت، این ویژگی بسیار مشابه :data:`sys.path` عمل میکند، یعنی فهرستی از محلها را برای جستجوی ماژولها در هنگام ایمپورت فراهم میکند. با این حال، :attr:`!__path__` معمولاً بسیار محدودتر از :data:`!sys.path` است."
msgid "The same rules used for :data:`sys.path` also apply to a package's :attr:`!__path__`. :data:`sys.path_hooks` (described below) are consulted when traversing a package's :attr:`!__path__`."
msgstr "همان قواعدی که برای :data:`sys.path` بهکار میروند، برای :attr:`!__path__` یک بسته نیز اعمال میشوند. هنگام پیمایش :attr:`!__path__` یک بسته، به :data:`sys.path_hooks` (که در ادامه توضیح داده شدهاند) مراجعه میشود."
msgid "A package's ``__init__.py`` file may set or alter the package's :attr:`~module.__path__` attribute, and this was typically the way namespace packages were implemented prior to :pep:`420`. With the adoption of :pep:`420`, namespace packages no longer need to supply ``__init__.py`` files containing only :attr:`!__path__` manipulation code; the import machinery automatically sets :attr:`!__path__` correctly for the namespace package."
msgstr "پرونده ``__init__.py`` یک بسته میتواند ویژگی :attr:`~module.__path__` بسته را تنظیم یا تغییر دهد، و این معمولاً روشی بود که بستههای فضای نام پیش از :pep:`420` پیادهسازی میشدند. با تصویب :pep:`420`، بستههای فضای نام دیگر نیازی به ارائه پروندههای ``__init__.py`` که فقط حاوی کد دستکاری :attr:`!__path__` هستند ندارند؛ سازوکار ایمپورت بهطور خودکار :attr:`!__path__` را بهدرستی برای بسته فضای نام تنظیم میکند."
msgid "Module reprs"
msgstr "reprهای ماژول"
msgid "By default, all modules have a usable repr, however depending on the attributes set above, and in the module's spec, you can more explicitly control the repr of module objects."
msgstr "بهطور پیشفرض، همهی ماژولها یک بازنمایی (repr) قابلاستفاده دارند؛ با این حال، بسته به ویژگیهای تنظیمشده در بالا و در مشخصات ماژول، میتوانید بازنمایی (repr) اشیای ماژول را بهطور صریحتری کنترل کنید."
msgid "If the module has a spec (``__spec__``), the import machinery will try to generate a repr from it. If that fails or there is no spec, the import system will craft a default repr using whatever information is available on the module. It will try to use the ``module.__name__``, ``module.__file__``, and ``module.__loader__`` as input into the repr, with defaults for whatever information is missing."
msgstr "اگر ماژول دارای مشخصات یعنی ``__spec__`` باشد، سازوکار ایمپورت تلاش میکند یک بازنمایی (repr) از آن تولید کند. اگر این کار ناموفق باشد یا مشخصات وجود نداشته باشد، سیستم ایمپورت یک بازنمایی پیشفرض را با استفاده از هر اطلاعاتی که درباره ماژول موجود است ایجاد میکند. این سیستم تلاش میکند از ``module.__name__``، ``module.__file__`` و ``module.__loader__`` بهعنوان ورودی بازنمایی استفاده کند و برای هر اطلاعاتی که موجود نیست، مقادیر پیشفرض قرار دهد."
msgid "Here are the exact rules used:"
msgstr "در اینجا قواعد دقیق استفادهشده آمده است:"
msgid "If the module has a ``__spec__`` attribute, the information in the spec is used to generate the repr. The \"name\", \"loader\", \"origin\", and \"has_location\" attributes are consulted."
msgstr "اگر ماژول دارای ویژگی ``__spec__`` باشد، از اطلاعات موجود در مشخصات برای تولید repr استفاده میشود. ویژگیهای \"name\"، \"loader\"، \"origin\" و \"has_location\" بررسی میشوند."
msgid "If the module has a ``__file__`` attribute, this is used as part of the module's repr."
msgstr "اگر ماژول دارای ویژگی ``__file__`` باشد، از آن بهعنوان بخشی از repr ماژول استفاده میشود."
msgid "If the module has no ``__file__`` but does have a ``__loader__`` that is not ``None``, then the loader's repr is used as part of the module's repr."
msgstr "اگر ماژول ``__file__`` نداشته باشد اما دارای ``__loader__`` باشد که ``None`` نباشد، آنگاه بازنمایی (repr) بارگذار بهعنوان بخشی از بازنمایی (repr) ماژول استفاده میشود."
msgid "Otherwise, just use the module's ``__name__`` in the repr."
msgstr "در غیر این صورت، فقط از ``__name__`` ماژول در repr استفاده کنید."
msgid "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was removed in Python 3.12 and is no longer called during the resolution of a module's repr."
msgstr "استفاده از :meth:`!module_repr`، که از پایتون 3.4 منسوخ شده بود، در پایتون 3.12 حذف شد و دیگر در جریان تعیین repr یک ماژول فراخوانی نمیشود."
msgid "Cached bytecode invalidation"
msgstr "بیاعتبارسازی بایتکد نهانشده"
msgid "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether the cache is up-to-date with the source ``.py`` file. By default, Python does this by storing the source's last-modified timestamp and size in the cache file when writing it. At runtime, the import system then validates the cache file by checking the stored metadata in the cache file against the source's metadata."
msgstr "پیش از آنکه پایتون بایتکد نهانشده را از یک پرونده ``.pyc`` بارگذاری کند، بررسی میکند که نهانگاه نسبت به پرونده منبع ``.py`` بهروز باشد. بهطور پیشفرض، پایتون این کار را با ذخیرهی برچسب زمانی آخرین تغییر و اندازهی پرونده منبع در پرونده نهانگاه، در زمان نوشتن آن انجام میدهد. در رانتایم، سامانهی ایمپورت سپس پرونده نهانگاه را با مقایسهی فرادادهی ذخیرهشده در پرونده نهانگاه با فرادادهی منبع اعتبارسنجی میکند."
msgid "Python also supports \"hash-based\" cache files, which store a hash of the source file's contents rather than its metadata. There are two variants of hash-based ``.pyc`` files: checked and unchecked. For checked hash-based ``.pyc`` files, Python validates the cache file by hashing the source file and comparing the resulting hash with the hash in the cache file. If a checked hash-based cache file is found to be invalid, Python regenerates it and writes a new checked hash-based cache file. For unchecked hash-based ``.pyc`` files, Python simply assumes the cache file is valid if it exists. Hash-based ``.pyc`` files validation behavior may be overridden with the :option:`--check-hash-based-pycs` flag."
msgstr "پایتون همچنین از پروندههای نهانگاه «مبتنی بر هش» پشتیبانی میکند، که بهجای فرادادههای پرونده منبع، یک هش از محتوای آن را ذخیره میکنند. دو گونه از پروندههای ``.pyc`` مبتنی بر هش وجود دارد: بررسیشده و بررسینشده. برای پروندههای ``.pyc`` مبتنی بر هش بررسیشده، پایتون با محاسبهی هش پرونده منبع و مقایسهی هش بهدستآمده با هش موجود در پرونده نهانگاه، پرونده نهانگاه را اعتبارسنجی میکند. اگر یک پرونده نهانگاه مبتنی بر هش بررسیشده نامعتبر تشخیص داده شود، پایتون آن را بازتولید میکند و یک پرونده نهانگاه مبتنی بر هش بررسیشدهی جدید مینویسد. برای پروندههای ``.pyc`` مبتنی بر هش بررسینشده، پایتون صرفاً فرض میکند که پرونده نهانگاه در صورت وجود معتبر است. میتوان رفتار اعتبارسنجی پروندههای ``.pyc`` مبتنی بر هش را با پرچم :option:`--check-hash-based-pycs` تغییر داد."
msgid "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-based invalidation of bytecode caches."
msgstr "پروندههای ``.pyc`` مبتنی بر هش افزوده شدند. پیش از این، پایتون تنها از ابطال مبتنی بر برچسب زمانی نهانگاههای بایتکد پشتیبانی میکرد."
msgid "The Path Based Finder"
msgstr "یابندهی مبتنی بر مسیر"
msgid "As mentioned previously, Python comes with several default meta path finders. One of these, called the :term:`path based finder` (:class:`~importlib.machinery.PathFinder`), searches an :term:`import path`, which contains a list of :term:`path entries <path entry>`. Each path entry names a location to search for modules."
msgstr "همانطور که پیشتر ذکر شد، پایتون دارای چندین فرایابندهی مسیر پیشفرض است. یکی از اینها، که :term:`یابندهی مبتنی بر مسیر <path based finder>` (:class:`~importlib.machinery.PathFinder`) نامیده میشود، یک :term:`import path` را جستجو میکند، که شامل فهرستی از :term:`مدخلهای مسیر <path entry>` است. هر مدخل مسیر، مکانی را برای جستجوی ماژولها مشخص میکند."
msgid "The path based finder itself doesn't know how to import anything. Instead, it traverses the individual path entries, associating each of them with a path entry finder that knows how to handle that particular kind of path."
msgstr "خودِ یابنده مبتنی بر مسیر نمیداند چگونه چیزی را ایمپورت کند. در عوض، تکتک ورودیهای مسیر را پیمایش میکند و هر یک را به یک یابنده ورودی مسیر مرتبط میکند که میداند چگونه آن نوع خاص از مسیر را مدیریت کند."
msgid "The default set of path entry finders implement all the semantics for finding modules on the file system, handling special file types such as Python source code (``.py`` files), Python byte code (``.pyc`` files) and shared libraries (e.g. ``.so`` files). When supported by the :mod:`zipimport` module in the standard library, the default path entry finders also handle loading all of these file types (other than shared libraries) from zipfiles."
msgstr "مجموعهی پیشفرضی از یابندههای ورودی مسیر، تمام رفتارهای معنایی لازم برای یافتن ماژولها در سامانه فایلبندی را پیادهسازی میکنند و از انواع خاص پرونده مانند کد منبع پایتون (پروندههای ``.py``)، بایتکد پایتون (پروندههای ``.pyc``) و کتابخانههای اشتراکی (برای مثال پروندههای ``.so``) پشتیبانی میکنند. در صورتی که ماژول :mod:`zipimport` در کتابخانهی استاندارد پشتیبانی شود، یابندههای ورودی مسیر پیشفرض، بارگذاری همهی این انواع پرونده (بهجز کتابخانههای اشتراکی) از پروندههای zip را نیز مدیریت میکنند."
msgid "Path entries need not be limited to file system locations. They can refer to URLs, database queries, or any other location that can be specified as a string."
msgstr "ورودیهای مسیر لازم نیست به مکانهای سامانه فایلبندی محدود شوند. آنها میتوانند به URLها، پرسوجوهای پایگاه داده، یا هر مکان دیگری که بتوان آن را بهصورت یک رشته مشخص کرد، اشاره کنند."
msgid "The path based finder provides additional hooks and protocols so that you can extend and customize the types of searchable path entries. For example, if you wanted to support path entries as network URLs, you could write a hook that implements HTTP semantics to find modules on the web. This hook (a callable) would return a :term:`path entry finder` supporting the protocol described below, which was then used to get a loader for the module from the web."
msgstr "یابندهی مبتنی بر مسیر، قلابها و پروتکلهای اضافی را فراهم میکند تا بتوانید انواع ورودیهای مسیر قابلجستجو را گسترش دهید و سفارشیسازی کنید. برای مثال، اگر بخواهید از ورودیهای مسیر بهعنوان URLهای شبکه پشتیبانی کنید، میتوانید قلابی بنویسید که معناشناسی HTTP را برای یافتن ماژولها در وب پیادهسازی کند. این قلاب (یک شیء فراخوانیپذیر) یک :term:`path entry finder` برمیگرداند که از پروتکل توصیفشده در زیر پشتیبانی میکند و سپس از آن برای دریافت بارگذار ماژول از وب استفاده میشود."
msgid "A word of warning: this section and the previous both use the term *finder*, distinguishing between them by using the terms :term:`meta path finder` and :term:`path entry finder`. These two types of finders are very similar, support similar protocols, and function in similar ways during the import process, but it's important to keep in mind that they are subtly different. In particular, meta path finders operate at the beginning of the import process, as keyed off the :data:`sys.meta_path` traversal."
msgstr "یک هشدار: این بخش و بخش پیشین هر دو اصطلاح *finder* (یابنده) را به کار میبرند و برای تمایز میان این دو، از اصطلاحات :term:`meta path finder` و :term:`path entry finder` استفاده میکنند. این دو نوع از یابندهها بسیار شبیه هم هستند، از پروتکلهای مشابهی پشتیبانی میکنند و در طول فرآیند ایمپورت به روشهای مشابهی عمل میکنند، اما مهم است که به خاطر داشته باشید آنها تفاوتهای ظریفی دارند. بهویژه، یابندههای meta path در آغاز فرآیند ایمپورت بر پایهی پیمایش :data:`sys.meta_path` عمل میکنند."
msgid "By contrast, path entry finders are in a sense an implementation detail of the path based finder, and in fact, if the path based finder were to be removed from :data:`sys.meta_path`, none of the path entry finder semantics would be invoked."
msgstr "در مقابل، یابندههای ورودی مسیر بهنوعی جزئیاتی از پیادهسازی یابندهی مبتنی بر مسیر هستند، و در واقع، اگر یابندهی مبتنی بر مسیر از :data:`sys.meta_path` حذف شود، هیچیک از رفتارهای معنایی یابندهی ورودی مسیر فراخوانی نمیشود."
msgid "Path entry finders"
msgstr "یابندههای ورودی مسیر"
msgid "The :term:`path based finder` is responsible for finding and loading Python modules and packages whose location is specified with a string :term:`path entry`. Most path entries name locations in the file system, but they need not be limited to this."
msgstr ":term:`یابندهی مبتنی بر مسیر <path based finder>` مسئول یافتن و بارگذاری ماژولها و بستههای پایتون است که مکان آنها با یک :term:`ورودی مسیر <path entry>` رشتهای تعیین شده است. بیشتر ورودیهای مسیر، مکانهایی را در سیستم پرونده مشخص میکنند، اما لازم نیست به این محدود شوند."
msgid "As a meta path finder, the :term:`path based finder` implements the :meth:`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, however it exposes additional hooks that can be used to customize how modules are found and loaded from the :term:`import path`."
msgstr "بهعنوان یک meta path finder، :term:`یابندهی مبتنی بر مسیر <path based finder>` پروتکل :meth:`~importlib.abc.MetaPathFinder.find_spec` را که پیشتر توصیف شد پیادهسازی میکند؛ با این حال، قلابهای اضافی را در معرض قرار میدهد که میتوان از آنها برای سفارشیسازی چگونگی یافتن و بارگذاری ماژولها از :term:`import path` استفاده کرد."
msgid "Three variables are used by the :term:`path based finder`, :data:`sys.path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The ``__path__`` attributes on package objects are also used. These provide additional ways that the import machinery can be customized."
msgstr "سه متغیر توسط :term:`یابندهی مبتنی بر مسیر <path based finder>` به کار میروند: :data:`sys.path`، :data:`sys.path_hooks` و :data:`sys.path_importer_cache`. ویژگیهای ``__path__`` در اشیای بسته نیز به کار میروند. اینها روشهای بیشتری برای سفارشیسازی سازوکار ایمپورت فراهم میکنند."
msgid ":data:`sys.path` contains a list of strings providing search locations for modules and packages. It is initialized from the :envvar:`PYTHONPATH` environment variable and various other installation- and implementation-specific defaults. Entries in :data:`sys.path` can name directories on the file system, zip files, and potentially other \"locations\" (see the :mod:`site` module) that should be searched for modules, such as URLs, or database queries. Only strings should be present on :data:`sys.path`; all other data types are ignored."
msgstr ":data:`sys.path` شامل فهرستی از رشتهها است که مکانهای جستجو برای ماژولها و بستهها را فراهم میکنند. این فهرست از متغیر محیطی :envvar:`PYTHONPATH` و چندین پیشفرض دیگرِ خاص نصب و پیادهسازی مقداردهی اولیه میشود. ورودیهای :data:`sys.path` میتوانند پوشههایی روی سامانه فایلبندی، پروندههای zip و بهطور بالقوه «مکانهای» دیگری را نام ببرند (به ماژول :mod:`site` مراجعه کنید) که باید برای ماژولها جستجو شوند، مانند URLها یا پرسمانهای پایگاه داده. فقط رشتهها باید در :data:`sys.path` وجود داشته باشند؛ تمام انواع دادهی دیگر نادیده گرفته میشوند."
msgid "The :term:`path based finder` is a :term:`meta path finder`, so the import machinery begins the :term:`import path` search by calling the path based finder's :meth:`~importlib.machinery.PathFinder.find_spec` method as described previously. When the ``path`` argument to :meth:`~importlib.machinery.PathFinder.find_spec` is given, it will be a list of string paths to traverse - typically a package's ``__path__`` attribute for an import within that package. If the ``path`` argument is ``None``, this indicates a top level import and :data:`sys.path` is used."
msgstr ":term:`یابندهی مبتنی بر مسیر <path based finder>` یک :term:`meta path finder` است، بنابراین سازوکار ایمپورت، جستجوی :term:`import path` را با فراخوانی متد :meth:`~importlib.machinery.PathFinder.find_spec` یابندهی مبتنی بر مسیر، همانطور که پیشتر شرح داده شد، آغاز میکند. هنگامی که آرگومان ``path`` برای :meth:`~importlib.machinery.PathFinder.find_spec` داده شود، این آرگومان فهرستی از مسیرهای رشتهای برای پیمایش خواهد بود — معمولاً ویژگی ``__path__`` یک بسته برای یک ایمپورت درون آن بسته. اگر آرگومان ``path`` برابر ``None`` باشد، این نشاندهندهی یک ایمپورت سطح بالا است و از :data:`sys.path` استفاده میشود."
msgid "The path based finder iterates over every entry in the search path, and for each of these, looks for an appropriate :term:`path entry finder` (:class:`~importlib.abc.PathEntryFinder`) for the path entry. Because this can be an expensive operation (e.g. there may be ``stat()`` call overheads for this search), the path based finder maintains a cache mapping path entries to path entry finders. This cache is maintained in :data:`sys.path_importer_cache` (despite the name, this cache actually stores finder objects rather than being limited to :term:`importer` objects). In this way, the expensive search for a particular :term:`path entry` location's :term:`path entry finder` need only be done once. User code is free to remove cache entries from :data:`sys.path_importer_cache` forcing the path based finder to perform the path entry search again."
msgstr "یابندهی مبتنی بر مسیر همهی ورودیهای مسیر جستجو را پیمایش میکند، و برای هر یک از اینها، به دنبال یک :term:`path entry finder` مناسب (:class:`~importlib.abc.PathEntryFinder`) برای آن ورودی مسیر میگردد. از آنجا که این کار میتواند عملیاتی پرهزینه باشد (برای نمونه، ممکن است سربارهای فراخوانی ``stat()`` برای این جستجو وجود داشته باشد)، یابندهی مبتنی بر مسیر نهانگاهی را نگهداری میکند که ورودیهای مسیر را به یابندههای ورودی مسیر نگاشت میکند. این نهانگاه در :data:`sys.path_importer_cache` نگهداری میشود (با وجود این نام، این نهانگاه در واقع اشیای یابنده را ذخیره میکند، نه اینکه به اشیای :term:`importer` محدود باشد). بدین ترتیب، جستجوی پرهزینه برای :term:`path entry finder` مربوط به مکان یک :term:`path entry` خاص، تنها یک بار لازم است انجام شود. کد کاربر آزاد است ورودیهای نهانگاه را از :data:`sys.path_importer_cache` حذف کند و یابندهی مبتنی بر مسیر را وادار کند که جستجوی ورودی مسیر را دوباره انجام دهد."
msgid "If the path entry is not present in the cache, the path based finder iterates over every callable in :data:`sys.path_hooks`. Each of the :term:`path entry hooks <path entry hook>` in this list is called with a single argument, the path entry to be searched. This callable may either return a :term:`path entry finder` that can handle the path entry, or it may raise :exc:`ImportError`. An :exc:`ImportError` is used by the path based finder to signal that the hook cannot find a :term:`path entry finder` for that :term:`path entry`. The exception is ignored and :term:`import path` iteration continues. The hook should expect either a string or bytes object; the encoding of bytes objects is up to the hook (e.g. it may be a file system encoding, UTF-8, or something else), and if the hook cannot decode the argument, it should raise :exc:`ImportError`."
msgstr "اگر ورودی مسیر در نهانگاه وجود نداشته باشد، یابندهی مبتنی بر مسیر هر شیء فراخوانیپذیر در :data:`sys.path_hooks` را پیمایش میکند. هر یک از :term:`قلابهای ورودی مسیر <path entry hook>` در این فهرست با یک آرگومان فراخوانی میشود: ورودی مسیری که باید جستجو شود. این شیء فراخوانیپذیر ممکن است یک :term:`path entry finder` را که میتواند ورودی مسیر را مدیریت کند برگرداند، یا ممکن است :exc:`ImportError` را پرتاب کند. یابندهی مبتنی بر مسیر از :exc:`ImportError` استفاده میکند تا نشان دهد که قلاب نمیتواند یک :term:`path entry finder` برای آن :term:`path entry` پیدا کند. این استثنا نادیده گرفته میشود و پیمایش :term:`import path` ادامه مییابد. قلاب باید انتظار یک شیء رشته یا بایت را داشته باشد؛ کدگذاری اشیاء بایت بر عهدهی قلاب است (برای مثال، ممکن است کدگذاری سامانه فایلبندی، UTF-8 یا چیز دیگری باشد)، و اگر قلاب نتواند آرگومان را کدگشایی کند، باید :exc:`ImportError` را پرتاب کند."
msgid "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` being returned, then the path based finder's :meth:`~importlib.machinery.PathFinder.find_spec` method will store ``None`` in :data:`sys.path_importer_cache` (to indicate that there is no finder for this path entry) and return ``None``, indicating that this :term:`meta path finder` could not find the module."
msgstr "اگر پیمایش :data:`sys.path_hooks` بدون این که هیچ :term:`path entry finder` بازگردانده شود به پایان برسد، متد :meth:`~importlib.machinery.PathFinder.find_spec` در یابنده مبتنی بر مسیر، ``None`` را در :data:`sys.path_importer_cache` ذخیره میکند (تا نشان دهد که هیچ یابندهای برای این ورودی مسیر وجود ندارد) و ``None`` را برمیگرداند، که نشان میدهد این :term:`meta path finder` نتوانسته است ماژول را پیدا کند."
msgid "If a :term:`path entry finder` *is* returned by one of the :term:`path entry hook` callables on :data:`sys.path_hooks`, then the following protocol is used to ask the finder for a module spec, which is then used when loading the module."
msgstr "اگر یکی از فراخوانیپذیرهای :term:`path entry hook` در :data:`sys.path_hooks` یک :term:`path entry finder` را برگرداند، از پروتکل زیر برای درخواست یک مشخصهی ماژول از یابنده استفاده میشود؛ سپس هنگام بارگذاری ماژول از آن مشخصه استفاده میشود."
msgid "The current working directory -- denoted by an empty string -- is handled slightly differently from other entries on :data:`sys.path`. First, if the current working directory cannot be determined or is found not to exist, no value is stored in :data:`sys.path_importer_cache`. Second, the value for the current working directory is looked up fresh for each module lookup. Third, the path used for :data:`sys.path_importer_cache` and returned by :meth:`importlib.machinery.PathFinder.find_spec` will be the actual current working directory and not the empty string."
msgstr "با پوشه کاری جاری — که با یک رشته خالی نشان داده میشود — کمی متفاوتتر از دیگر ورودیهای :data:`sys.path` رفتار میشود. نخست، اگر پوشه کاری جاری قابل تعیین نباشد یا مشخص شود که وجود ندارد، هیچ مقداری در :data:`sys.path_importer_cache` ذخیره نمیشود. دوم، مقدار مربوط به پوشه کاری جاری برای هر جستجوی ماژول، از نو جستجو میشود. سوم، مسیری که برای :data:`sys.path_importer_cache` استفاده میشود و توسط :meth:`importlib.machinery.PathFinder.find_spec` برگردانده میشود، پوشه کاری جاری واقعی خواهد بود، نه رشته خالی."
msgid "Path entry finder protocol"
msgstr "پروتکل یابندهی ورودی مسیر"
msgid "In order to support imports of modules and initialized packages and also to contribute portions to namespace packages, path entry finders must implement the :meth:`~importlib.abc.PathEntryFinder.find_spec` method."
msgstr "برای پشتیبانی از ایمپورت ماژولها و بستههای مقداردهی اولیهشده و همچنین برای افزودن بخشهایی به بستههای فضای نام، یابندههای ورودی مسیر (path entry finders) باید متد :meth:`~importlib.abc.PathEntryFinder.find_spec` را پیادهسازی کنند."
msgid ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the fully qualified name of the module being imported, and the (optional) target module. ``find_spec()`` returns a fully populated spec for the module. This spec will always have \"loader\" set (with one exception)."
msgstr ":meth:`~importlib.abc.PathEntryFinder.find_spec` دو آرگومان میگیرد: نام کامل ماژولی که ایمپورت میشود، و ماژول هدف (اختیاری). ``find_spec()`` مشخصات کاملاً مقداردهیشدهای برای ماژول برمیگرداند. این مشخصات همیشه \"loader\" را تنظیمشده خواهد داشت (با یک استثنا)."
msgid "To indicate to the import machinery that the spec represents a namespace :term:`portion`, the path entry finder sets ``submodule_search_locations`` to a list containing the portion."
msgstr "برای آنکه به سازوکار ایمپورت نشان داده شود که مشخصه نشاندهندهی یک :term:`بخش <portion>` از فضای نام است، یابندهی ورودی مسیر ``submodule_search_locations`` را برابر با فهرستی حاوی همان بخش قرار میدهد."
msgid ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!find_loader` and :meth:`!find_module`, both of which are now deprecated, but will be used if ``find_spec()`` is not defined."
msgstr ":meth:`~importlib.abc.PathEntryFinder.find_spec` جایگزین :meth:`!find_loader` و :meth:`!find_module` شد؛ هر دوی آنها اکنون منسوخ شدهاند، اما در صورتی که ``find_spec()`` تعریف نشده باشد، از آنها استفاده خواهد شد."
msgid "Older path entry finders may implement one of these two deprecated methods instead of ``find_spec()``. The methods are still respected for the sake of backward compatibility. However, if ``find_spec()`` is implemented on the path entry finder, the legacy methods are ignored."
msgstr "یابندههای قدیمیتر ورودی مسیر ممکن است بهجای ``find_spec()`` یکی از این دو متد منسوخ را پیادهسازی کنند. این متدها همچنان بهخاطر سازگاری با عقبگرد بهرسمیت شناخته میشوند. با این حال، اگر ``find_spec()`` در یابندهی ورودی مسیر پیادهسازی شده باشد، متدهای قدیمی نادیده گرفته میشوند."
msgid ":meth:`!find_loader` takes one argument, the fully qualified name of the module being imported. ``find_loader()`` returns a 2-tuple where the first item is the loader and the second item is a namespace :term:`portion`."
msgstr ":meth:`!find_loader` یک آرگومان میگیرد، نام کامل ماژولی که ایمپورت میشود. ``find_loader()`` یک تاپل دوتایی برمیگرداند که اولین آیتم آن بارگذار و دومین آیتم آن یک :term:`بخش <portion>` از فضای نام است."
msgid "For backwards compatibility with other implementations of the import protocol, many path entry finders also support the same, traditional ``find_module()`` method that meta path finders support. However path entry finder ``find_module()`` methods are never called with a ``path`` argument (they are expected to record the appropriate path information from the initial call to the path hook)."
msgstr "برای حفظ سازگاری با نسخههای قبلی سایر پیادهسازیهای پروتکل ایمپورت، بسیاری از یابندههای ورودی مسیر نیز از همان متد سنتی ``find_module()`` که یابندههای فرامسیر (meta path finder) از آن پشتیبانی میکنند، پشتیبانی میکنند. با این حال، متدهای ``find_module()`` یابندههای ورودی مسیر هرگز با آرگومان ``path`` فراخوانی نمیشوند (انتظار میرود اطلاعات مناسب مسیر از فراخوانی اولیهی قلاب مسیرثبت شود)."
msgid "The ``find_module()`` method on path entry finders is deprecated, as it does not allow the path entry finder to contribute portions to namespace packages. If both ``find_loader()`` and ``find_module()`` exist on a path entry finder, the import system will always call ``find_loader()`` in preference to ``find_module()``."
msgstr "متد ``find_module()`` در یابندههای ورودی مسیر منسوخ شده است، زیرا به یابندهی ورودی مسیر اجازه نمیدهد بخشهایی را به بستههای فضای نام اضافه کند. اگر هر دو ``find_loader()`` و ``find_module()`` در یک یابندهی ورودی مسیر وجود داشته باشند، سیستم ایمپورت همیشه ``find_loader()`` را با اولویت نسبت به ``find_module()`` فراخوانی میکند."
msgid "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system will raise :exc:`ImportWarning`."
msgstr "فراخوانیهای :meth:`!find_module` و :meth:`!find_loader` توسط سیستم ایمپورت، باعث پرتاب :exc:`ImportWarning` میشوند."
msgid "``find_module()`` and ``find_loader()`` have been removed."
msgstr "``find_module()`` و ``find_loader()`` حذف شدهاند."
msgid "Replacing the standard import system"
msgstr "جایگزینی سامانهی ایمپورت استاندارد"
msgid "The most reliable mechanism for replacing the entire import system is to delete the default contents of :data:`sys.meta_path`, replacing them entirely with a custom meta path hook."
msgstr "مطمئنترین سازوکار برای جایگزینی کل سامانهی ایمپورت، حذف محتوای پیشفرض :data:`sys.meta_path` و جایگزینی کامل آنها با یک قلاب سفارشی فرامسیر (meta path hook) است."
msgid "If it is acceptable to only alter the behaviour of import statements without affecting other APIs that access the import system, then replacing the builtin :func:`__import__` function may be sufficient."
msgstr "اگر تنها تغییر رفتار دستورهای ایمپورت، بدون تأثیرگذاری بر سایر APIهایی که به سیستم ایمپورت دسترسی دارند، قابل قبول باشد، ممکن است جایگزینی تابع توکار :func:`__import__` کافی باشد."
msgid "To selectively prevent the import of some modules from a hook early on the meta path (rather than disabling the standard import system entirely), it is sufficient to raise :exc:`ModuleNotFoundError` directly from :meth:`~importlib.abc.MetaPathFinder.find_spec` instead of returning ``None``. The latter indicates that the meta path search should continue, while raising an exception terminates it immediately."
msgstr "برای جلوگیری انتخابی از ایمپورت برخی ماژولها از طریق یک قلاب در اوایل فرا مسیر (بهجای غیرفعال کردن کامل سیستم ایمپورت استاندارد)، کافی است :exc:`ModuleNotFoundError` را مستقیماً از :meth:`~importlib.abc.MetaPathFinder.find_spec` پرتاب کنید، نه اینکه ``None`` را برگردانید. مورد اخیر نشان میدهد که جستجوی فرامسیر باید ادامه یابد، در حالی که پرتاب یک استثنا آن را بلافاصله متوقف میکند."
msgid "Package Relative Imports"
msgstr "ایمپورتهای نسبی بسته"
msgid "Relative imports use leading dots. A single leading dot indicates a relative import, starting with the current package. Two or more leading dots indicate a relative import to the parent(s) of the current package, one level per dot after the first. For example, given the following package layout::"
msgstr "ایمپورتهای نسبی از نقطههای ابتدایی استفاده میکنند. یک نقطه ابتدایی نشاندهنده یک ایمپورت نسبی است که از بسته جاری شروع میشود. دو یا چند نقطه ابتدایی نشاندهنده ایمپورت نسبی به بسته(های) والد بسته جاری است؛ هر نقطه پس از نقطه اول، یک سطح را مشخص میکند. برای مثال، با فرض چیدمان بسته زیر::"
msgid ""
"package/\n"
" __init__.py\n"
" subpackage1/\n"
" __init__.py\n"
" moduleX.py\n"
" moduleY.py\n"
" subpackage2/\n"
" __init__.py\n"
" moduleZ.py\n"
" moduleA.py"
msgstr ""
"package/\n"
" __init__.py\n"
" subpackage1/\n"
" __init__.py\n"
" moduleX.py\n"
" moduleY.py\n"
" subpackage2/\n"
" __init__.py\n"
" moduleZ.py\n"
" moduleA.py"
msgid "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the following are valid relative imports::"
msgstr "در هر یک از ``subpackage1/moduleX.py`` یا ``subpackage1/__init__.py``، ایمپورتهای نسبی زیر معتبر هستند::"
msgid ""
"from .moduleY import spam\n"
"from .moduleY import spam as ham\n"
"from . import moduleY\n"
"from ..subpackage1 import moduleY\n"
"from ..subpackage2.moduleZ import eggs\n"
"from ..moduleA import foo"
msgstr ""
"from .moduleY import spam\n"
"from .moduleY import spam as ham\n"
"from . import moduleY\n"
"from ..subpackage1 import moduleY\n"
"from ..subpackage2.moduleZ import eggs\n"
"from ..moduleA import foo"
msgid "Absolute imports may use either the ``import <>`` or ``from <> import <>`` syntax, but relative imports may only use the second form; the reason for this is that::"
msgstr "ایمپورتهای مطلق میتوانند از سینتکس ``import <>`` یا ``from <> import <>`` استفاده کنند، اما ایمپورتهای نسبی تنها میتوانند از شکل دوم استفاده کنند؛ دلیل این موضوع این است که::"
msgid "import XXX.YYY.ZZZ"
msgstr "import XXX.YYY.ZZZ"
msgid "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a valid expression."
msgstr "باید ``XXX.YYY.ZZZ`` را بهعنوان یک عبارت قابلاستفاده در دسترس قرار دهد، اما .moduleY یک عبارت معتبر نیست."
msgid "Special considerations for __main__"
msgstr "ملاحظات ویژه برای __main__"
msgid "The :mod:`__main__` module is a special case relative to Python's import system. As noted :ref:`elsewhere <programs>`, the ``__main__`` module is directly initialized at interpreter startup, much like :mod:`sys` and :mod:`builtins`. However, unlike those two, it doesn't strictly qualify as a built-in module. This is because the manner in which ``__main__`` is initialized depends on the flags and other options with which the interpreter is invoked."
msgstr "ماژول :mod:`__main__` یک مورد خاص نسبت به سیستم ایمپورت پایتون است. همانطور که در :ref:`جای دیگر <programs>` اشاره شد، ماژول ``__main__`` بهطور مستقیم در آغاز به کار مفسر مقداردهی اولیه میشود، بسیار شبیه به :mod:`sys` و :mod:`builtins`. با این حال، برخلاف آن دو، بهطور دقیق بهعنوان یک ماژول توکار محسوب نمیشود. این به این دلیل است که نحوهی مقداردهی اولیه ``__main__`` به پرچمها و سایر گزینههایی بستگی دارد که مفسر با آنها فراخوانی میشود."
msgid "__main__.__spec__"
msgstr "__main__.__spec__"
msgid "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets set appropriately or to ``None``."
msgstr "بسته به اینکه :mod:`__main__` چگونه راهاندازی شود، ``__main__.__spec__`` بهطور مناسب یا روی ``None`` تنظیم میشود."
msgid "When Python is started with the :option:`-m` option, ``__spec__`` is set to the module spec of the corresponding module or package. ``__spec__`` is also populated when the ``__main__`` module is loaded as part of executing a directory, zipfile or other :data:`sys.path` entry."
msgstr "هنگامی که پایتون با گزینهی :option:`-m` راهاندازی میشود، ``__spec__`` به مشخصات ماژول آن ماژول یا بسته تنظیم میشود. ``__spec__`` همچنین هنگامی که ماژول ``__main__`` بهعنوان بخشی از اجرای یک پوشه، پرونده فشرده (zipfile) یا ورودی دیگری از :data:`sys.path` بارگذاری میشود، پر میشود."
msgid "In :ref:`the remaining cases <using-on-interface-options>` ``__main__.__spec__`` is set to ``None``, as the code used to populate the :mod:`__main__` does not correspond directly with an importable module:"
msgstr "در :ref:`موارد باقیمانده <using-on-interface-options>`، ``__main__.__spec__`` روی ``None`` تنظیم میشود، زیرا کدی که برای پر کردن :mod:`__main__` استفاده میشود، مستقیماً با یک ماژول قابل ایمپورت مطابقت ندارد:"
msgid "interactive prompt"
msgstr "اعلان تعاملی"
msgid ":option:`-c` option"
msgstr "گزینهی :option:`-c`"
msgid "running from stdin"
msgstr "اجرا از stdin"
msgid "running directly from a source or bytecode file"
msgstr "اجرای مستقیم از یک پرونده منبع یا پرونده بایتکد"
msgid "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even if* the file could technically be imported directly as a module instead. Use the :option:`-m` switch if valid module metadata is desired in :mod:`__main__`."
msgstr "توجه داشته باشید که ``__main__.__spec__`` در حالت آخر همیشه ``None`` است، *حتی اگر* از نظر فنی بتوان پرونده را بهجای آن بهصورت مستقیم بهعنوان یک ماژول ایمپورت کرد. اگر فرادادهی معتبر ماژول در :mod:`__main__` مطلوب باشد، از سوئیچ :option:`-m` استفاده کنید."
msgid "Note also that even when ``__main__`` corresponds with an importable module and ``__main__.__spec__`` is set accordingly, they're still considered *distinct* modules. This is due to the fact that blocks guarded by ``if __name__ == \"__main__\":`` checks only execute when the module is used to populate the ``__main__`` namespace, and not during normal import."
msgstr "همچنین توجه داشته باشید که حتی وقتی ``__main__`` با یک ماژول قابل ایمپورت متناظر باشد و ``__main__.__spec__`` متناسب با آن تنظیم شده باشد، آنها همچنان ماژولهای *متمایز* در نظر گرفته میشوند. این به این دلیل است که بلوکهای محافظتشده با بررسیهای ``if __name__ == \"__main__\":`` فقط زمانی اجرا میشوند که از ماژول برای پر کردن فضای نام ``__main__`` استفاده شود، نه در حین ایمپورت معمولی."
msgid "References"
msgstr "ارجاعات"
msgid "The import machinery has evolved considerably since Python's early days. The original `specification for packages <https://www.python.org/doc/essays/packages/>`_ is still available to read, although some details have changed since the writing of that document."
msgstr "سازوکار ایمپورت از روزهای نخست پایتون بهطور قابلتوجهی تکامل پیدا کرده است. `مشخصات اصلی بستهها <https://www.python.org/doc/essays/packages/>`_ هنوز برای خواندن در دسترس است، اگرچه برخی جزئیات از زمان نگارش آن سند تغییر کردهاند."
msgid "The original specification for :data:`sys.meta_path` was :pep:`302`, with subsequent extension in :pep:`420`."
msgstr "مشخصه اولیه برای :data:`sys.meta_path` در :pep:`302` ارائه شد، با گسترش بعدی در :pep:`420`."
msgid ":pep:`420` introduced :term:`namespace packages <namespace package>` for Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as an alternative to :meth:`!find_module`."
msgstr ":pep:`420` :term:`بستههای فضای نام <namespace package>` را برای پایتون 3.3 معرفی کرد. :pep:`420` همچنین پروتکل :meth:`!find_loader` را بهعنوان جایگزینی برای :meth:`!find_module` معرفی کرد."
msgid ":pep:`366` describes the addition of the ``__package__`` attribute for explicit relative imports in main modules."
msgstr ":pep:`366` افزودن ویژگی ``__package__`` برای ایمپورتهای نسبی صریح در ماژولهای اصلی را توصیف میکند."
msgid ":pep:`328` introduced absolute and explicit relative imports and initially proposed ``__name__`` for semantics :pep:`366` would eventually specify for ``__package__``."
msgstr ":pep:`328` ایمپورتهای مطلق و نسبی صریح را معرفی کرد و در ابتدا ``__name__`` را برای معناشناسیای پیشنهاد داد که در نهایت :pep:`366` آن را برای ``__package__`` مشخص کرد."
msgid ":pep:`338` defines executing modules as scripts."
msgstr ":pep:`338` اجرای ماژولها بهعنوان اسکریپت را تعریف میکند."
msgid ":pep:`451` adds the encapsulation of per-module import state in spec objects. It also off-loads most of the boilerplate responsibilities of loaders back onto the import machinery. These changes allow the deprecation of several APIs in the import system and also addition of new methods to finders and loaders."
msgstr ":pep:`451` کپسولهسازی وضعیت ایمپورت بهازای هر ماژول در اشیاء مشخصات را اضافه میکند. همچنین بیشتر مسئولیتهای تکراری بارگذارها را از دوش آنها برداشته و دوباره به سازوکار ایمپورت منتقل میکند. این تغییرات امکان منسوخ کردن چندین API در سیستم ایمپورت و همچنین افزودن متدهای جدید به یابندهها و بارگذارها را فراهم میکنند."
msgid "Footnotes"
msgstr "پانویسها"
msgid "See :class:`types.ModuleType`."
msgstr ":class:`types.ModuleType` را ببینید."
msgid "The importlib implementation avoids using the return value directly. Instead, it gets the module object by looking the module name up in :data:`sys.modules`. The indirect effect of this is that an imported module may replace itself in :data:`sys.modules`. This is implementation-specific behavior that is not guaranteed to work in other Python implementations."
msgstr "پیادهسازی importlib از استفادهی مستقیم از مقدار برگشتی اجتناب میکند. در عوض، شیء ماژول را با جستوجوی نام ماژول در :data:`sys.modules` دریافت میکند. اثر غیرمستقیم این کار آن است که یک ماژول ایمپورتشده ممکن است خود را در :data:`sys.modules` جایگزین کند. این رفتاری وابسته به پیادهسازی است که تضمینی برای کار کردن آن در سایر پیادهسازیهای پایتون وجود ندارد."
msgid "import machinery"
msgstr "سازوکار ایمپورت"
msgid "package"
msgstr "بسته"
msgid "regular"
msgstr "معمولی"
msgid "namespace"
msgstr "فضای نام"
msgid "portion"
msgstr "بخش"
msgid "sys.modules"
msgstr "sys.modules"
msgid "finder"
msgstr "یابنده"
msgid "loader"
msgstr "بارگذار"
msgid "module spec"
msgstr "مشخصات ماژول"
msgid "import hooks"
msgstr "قلابهای ایمپورت"
msgid "meta hooks"
msgstr "فراقلابها"
msgid "path hooks"
msgstr "قلابهای مسیر"
msgid "hooks"
msgstr "قلابها"
msgid "import"
msgstr "ایمپورت"
msgid "meta"
msgstr "فرا"
msgid "path"
msgstr "مسیر"
msgid "sys.meta_path"
msgstr "sys.meta_path"
msgid "find_spec"
msgstr "find_spec"
msgid "path based finder"
msgstr "یابندهی مبتنی بر مسیر"
msgid "sys.path"
msgstr "sys.path"
msgid "sys.path_hooks"
msgstr "sys.path_hooks"
msgid "sys.path_importer_cache"
msgstr "sys.path_importer_cache"
msgid "PYTHONPATH"
msgstr "PYTHONPATH"