You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: library/__main__.po
+19-8Lines changed: 19 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -235,32 +235,36 @@ msgid "By proactively following this convention ourselves, our module will have
235
235
msgstr"با پیروی فعالانهی خودمان از این قرارداد، ماژول ما هنگام اجرای مستقیم (یعنی ``python echo.py``) همان رفتاری را خواهد داشت که در صورت بستهبندی بعدی آن بهعنوان یک نقطهی ورودی اسکریپت کنسول در یک بستهی قابل نصب با pip خواهد داشت."
236
236
237
237
msgid"In particular, be careful about returning strings from your ``main`` function. :func:`sys.exit` will interpret a string argument as a failure message, so your program will have an exit code of ``1``, indicating failure, and the string will be written to :data:`sys.stderr`. The ``echo.py`` example from earlier exemplifies using the ``sys.exit(main())`` convention."
238
-
msgstr""
238
+
msgstr"بهویژه، در مورد بازگرداندن رشتهها از تابع ``main`` خود دقت کنید. :func:`sys.exit` یک آرگومان رشتهای را بهعنوان پیام شکست تفسیر میکند، بنابراین برنامهی شما کد خروجی ``1`` را خواهد داشت که نشاندهندهی شکست است و رشته به :data:`sys.stderr` نوشته میشود. مثال ``echo.py`` از قبل، استفاده از قرارداد ``sys.exit(main())`` را بهخوبی نشان میدهد."
239
239
240
240
msgid"`Python Packaging User Guide <https://packaging.python.org/>`_ contains a collection of tutorials and references on how to distribute and install Python packages with modern tools."
241
-
msgstr""
241
+
msgstr"`Python Packaging User Guide <https://packaging.python.org/>`_ شامل مجموعهای از آموزشها و مراجع دربارهی نحوهی توزیع و نصب بستههای پایتون با ابزارهای مدرن است."
242
242
243
243
msgid"``__main__.py`` in Python Packages"
244
-
msgstr""
244
+
msgstr"``__main__.py`` در بستههای پایتون"
245
245
246
246
msgid"If you are not familiar with Python packages, see section :ref:`tut-packages` of the tutorial. Most commonly, the ``__main__.py`` file is used to provide a command-line interface for a package. Consider the following hypothetical package, \"bandclass\":"
247
-
msgstr""
247
+
msgstr"اگر با بستههای پایتون آشنایی ندارید، به بخش :ref:`tut-packages` از آموزش مراجعه کنید. معمولاً، از فایل ``__main__.py`` برای ارائهی یک رابط خط فرمان برای یک بسته استفاده میشود. بستهی فرضی زیر را در نظر بگیرید، \"bandclass\":"
248
248
249
249
msgid""
250
250
"bandclass\n"
251
251
" ├── __init__.py\n"
252
252
" ├── __main__.py\n"
253
253
" └── student.py"
254
254
msgstr""
255
+
"bandclass\n"
256
+
" ├── __init__.py\n"
257
+
" ├── __main__.py\n"
258
+
" └── student.py"
255
259
256
260
msgid"``__main__.py`` will be executed when the package itself is invoked directly from the command line using the :option:`-m` flag. For example:"
257
-
msgstr""
261
+
msgstr"``__main__.py`` زمانی اجرا میشود که خود بسته مستقیماً از خط فرمان با استفاده از پرچم :option:`-m` فراخوانی شود. برای مثال:"
258
262
259
263
msgid"$ python -m bandclass"
260
-
msgstr""
264
+
msgstr"$ python -m bandclass"
261
265
262
266
msgid"This command will cause ``__main__.py`` to run. How you utilize this mechanism will depend on the nature of the package you are writing, but in this hypothetical case, it might make sense to allow the teacher to search for students::"
263
-
msgstr""
267
+
msgstr"این دستور باعث اجرای ``__main__.py`` میشود. نحوهی استفادهی شما از این مکانیزم به ماهیت بستهای که مینویسید بستگی دارد، اما در این حالت فرضی، ممکن است منطقی باشد که به معلم اجازه دهید دانشآموزان را جستجو کند::"
264
268
265
269
msgid""
266
270
"# bandclass/__main__.py\n"
@@ -271,9 +275,16 @@ msgid ""
271
275
"student_name = sys.argv[1] if len(sys.argv) >= 2 else ''\n"
msgid"Note that ``from .student import search_students`` is an example of a relative import. This import style can be used when referencing modules within a package. For more details, see :ref:`intra-package-references` in the :ref:`tut-modules` section of the tutorial."
276
-
msgstr""
287
+
msgstr"توجه داشته باشید که ``from .student import search_students`` مثالی از یک ایمپورت نسبی است. این سبک ایمپورت را میتوان هنگام ارجاع به ماژولهای درون یک بسته استفاده کرد. برای اطلاعات بیشتر، به :ref:`intra-package-references` در بخش :ref:`tut-modules` از آموزش مراجعه کنید."
277
288
278
289
msgid"The content of ``__main__.py`` typically isn't fenced with an ``if __name__ == '__main__'`` block. Instead, those files are kept short and import functions to execute from other modules. Those other modules can then be easily unit-tested and are properly reusable."
0 commit comments