Skip to content

Commit 8994a37

Browse files
committed
transation part of library/__main__.po
msgid "By proactively following this convention ourselves, our module will have the same behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package."
1 parent cde8912 commit 8994a37

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

library/__main__.po

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,22 +217,22 @@ msgid "Note that if the module didn't encapsulate code inside the ``main`` funct
217217
msgstr "توجه داشته باشید که اگر ماژول کد را درون تابع ``main`` محصور نمی‌کرد و به جای آن مستقیماً آن را درون بلوک ``if __name__ == '__main__'`` قرار می‌داد، متغیر ``phrase`` برای کل ماژول سراسری می‌شد. این امر مستعد خطا است، زیرا ممکن است سایر توابع درون ماژول به‌طور ناخواسته از متغیر سراسری به جای یک نام محلی استفاده کنند. تابع ``main`` این مشکل را حل می‌کند."
218218

219219
msgid "Using a ``main`` function has the added benefit of the ``echo`` function itself being isolated and importable elsewhere. When ``echo.py`` is imported, the ``echo`` and ``main`` functions will be defined, but neither of them will be called, because ``__name__ != '__main__'``."
220-
msgstr ""
220+
msgstr "استفاده از تابع ``main`` این مزیت اضافی را دارد که خود تابع ``echo`` ایزوله و قابل ایمپورت در جای دیگر است. وقتی ``echo.py`` ایمپورت می‌شود، توابع ``echo`` و ``main`` تعریف می‌شوند، اما هیچ‌کدام از آن‌ها فراخوانی نمی‌شوند، زیرا ``__name__ != '__main__'`` است."
221221

222222
msgid "Packaging Considerations"
223-
msgstr ""
223+
msgstr "ملاحظات بسته‌بندی"
224224

225225
msgid "``main`` functions are often used to create command-line tools by specifying them as entry points for console scripts. When this is done, `pip <https://pip.pypa.io/>`_ inserts the function call into a template script, where the return value of ``main`` is passed into :func:`sys.exit`. For example::"
226-
msgstr ""
226+
msgstr "توابع ``main`` اغلب برای ساختن ابزارهای خط فرمان با مشخص کردن آن‌ها به‌عنوان نقاط ورودی برای اسکریپت‌های کنسولی استفاده می‌شوند. وقتی این کار انجام می‌شود، `pip <https://pip.pypa.io/>`_ فراخوانی تابع را در یک اسکریپت الگو قرار می‌دهد، جایی که مقدار بازگشتی ``main`` به :func:`sys.exit` پاس داده می‌شود. برای مثال::"
227227

228228
msgid "sys.exit(main())"
229-
msgstr ""
229+
msgstr "sys.exit(main())"
230230

231231
msgid "Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation is that your function will return some value acceptable as an input to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly returned if your function does not have a return statement)."
232-
msgstr ""
232+
msgstr "از آنجایی که فراخوانی ``main`` در :func:`sys.exit` پیچیده شده است، انتظار می‌رود که تابع شما مقداری را برگرداند که به‌عنوان ورودی برای :func:`sys.exit` قابل‌قبول باشد؛ معمولاً یک عدد صحیح یا ``None`` (که اگر تابع شما دستور return نداشته باشد، به‌صورت ضمنی برگردانده می‌شود)."
233233

234234
msgid "By proactively following this convention ourselves, our module will have the same behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package."
235-
msgstr ""
235+
msgstr "با پیروی فعالانه‌ی خودمان از این قرارداد، ماژول ما هنگام اجرای مستقیم (یعنی ``python echo.py``) همان رفتاری را خواهد داشت که در صورت بسته‌بندی بعدی آن به‌عنوان یک نقطه‌ی ورودی اسکریپت کنسول در یک بسته‌ی قابل نصب با pip خواهد داشت."
236236

237237
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."
238238
msgstr ""

0 commit comments

Comments
 (0)