diff --git a/bugs.po b/bugs.po index 51e466290..a7e897de7 100644 --- a/bugs.po +++ b/bugs.po @@ -16,38 +16,37 @@ msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-07-25 12:59+0330\n" -"PO-Revision-Date: 2021-06-28 00:47+0000\n" +"PO-Revision-Date: 2026-07-26 07:53+0330\n" "Last-Translator: Alireza Shabani (Revisto) , 2025\n" -"Language-Team: Persian (https://app.transifex.com/python-doc/teams/5390/" -"fa/)\n" +"Language-Team: Persian (https://app.transifex.com/python-doc/teams/5390/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" #: ../../bugs.rst:5 msgid "Dealing with Bugs" -msgstr "کنار آمدن با مشکلات" +msgstr "رفع مشکلات" #: ../../bugs.rst:7 msgid "" -"Python is a mature programming language which has established a reputation " -"for stability. In order to maintain this reputation, the developers would " -"like to know of any deficiencies you find in Python." +"Python is a mature programming language which has established a reputation for " +"stability. In order to maintain this reputation, the developers would like to " +"know of any deficiencies you find in Python." msgstr "" "پایتون زبان برنامه نویسی بالغیست که پایداریش شهرتی به هم زده. توسعه‌دهندگانش " "مایلند برای حفظ این شهرت از هر نقصی که در پایتون می‌یابید آگاه شوند." #: ../../bugs.rst:11 -#, fuzzy msgid "" "It can be sometimes faster to fix bugs yourself and contribute patches to " "Python as it streamlines the process and involves fewer people. Learn how " "to :ref:`contribute `." msgstr "" -"گاهی حل مشکل به دست خودتان و فرستادن وصله به پایتون سریع‌تر است؛ زیرا فرایند " -"را یکسره کرده و افراد کم‌تری را درگیر می‌کند. آموختن چگونگی مشارکت " +"گاهی حل مشکل به دست خودتان و فرستادن وصله به پایتون سریع‌تر است؛ زیرا فرایند را " +"یکسره کرده و افراد کمتری را درگیر می‌کند. آموختن چگونگی مشارکت " "در :ref:`contribute `." #: ../../bugs.rst:16 @@ -57,13 +56,12 @@ msgstr "مشکلات مستندات" #: ../../bugs.rst:18 msgid "" "If you find a bug in this documentation or would like to propose an " -"improvement, please submit a bug report on the :ref:`issue tracker `. If you have a suggestion on how to fix it, include that as " -"well." +"improvement, please submit a bug report on the :ref:`issue tracker `. If you have a suggestion on how to fix it, include that as well." msgstr "" -"اگر مشکلی در این مستندات یافته یا می‌خواهید بهبودی را پیشنهاد دهید، گزارش " -"مشکلی روی :ref:`issue tracker `. ثبت کنید. اگر برای حلش " -"پیشنهادی دارید، آن را هم بنویسید." +"اگر مشکلی در این مستندات یافته یا می‌خواهید بهبودی را پیشنهاد دهید، گزارش مشکلی " +"روی :ref:`issue tracker `. ثبت کنید. اگر برای حلش پیشنهادی " +"دارید، آن را هم بنویسید." #: ../../bugs.rst:24 msgid "" @@ -71,6 +69,8 @@ msgid "" "documentation, submit the report to the `translation’s repository " "`_ instead." msgstr "" +"اگر اشکال یا پیشنهاد بهبودی مربوط به ترجمهٔ این مستندات است، گزارش را به `مخزن " +"ترجمه `_ ارسال کنید." #: ../../bugs.rst:28 msgid "" @@ -82,13 +82,13 @@ msgstr "" #: ../../bugs.rst:31 msgid "" -"If you find a bug in the theme (HTML / CSS / JavaScript) of the " -"documentation, please submit a bug report on the `python-doc-theme issue " -"tracker `_." +"If you find a bug in the theme (HTML / CSS / JavaScript) of the documentation, " +"please submit a bug report on the `python-doc-theme issue tracker `_." msgstr "" -"اگر شما یک باگ در نحوه نمایش تم ها (اچ تی ام ال - سی اس اس - جاوا اسکریپت) " -"در مستندات پیدا کردید, لطفا یک گزارش باگ بر روی `آدرس `_ ثبت کنید." +"اگر شما یک باگ در نحوه نمایش تم ها (اچ تی ام ال - سی اس اس - جاوا اسکریپت) در " +"مستندات پیدا کردید, لطفا یک گزارش باگ بر روی `آدرس `_ ثبت کنید." #: ../../bugs.rst:37 msgid "`Documentation bugs`_" @@ -98,8 +98,7 @@ msgstr "`اشکالات مستندات`_" msgid "" "A list of documentation bugs that have been submitted to the Python issue " "tracker." -msgstr "" -"فهرستی از باگ‌های مستندات که به پایگاه پیگیری مشکلات پایتون ارسال شده‌اند." +msgstr "فهرستی از باگ‌های مستندات که به پایگاه پیگیری مشکلات پایتون ارسال شده‌اند." #: ../../bugs.rst:40 msgid "`Issue Tracking `_" @@ -122,8 +121,7 @@ msgstr "" msgid "" "Comprehensive guide for individuals that are interested in contributing to " "Python documentation." -msgstr "" -"راهنمای جامع برای افرادی که علاقه‌مند به مشارکت در مستندات Python هستند." +msgstr "راهنمای جامع برای افرادی که علاقه‌مند به مشارکت در مستندات Python هستند." #: ../../bugs.rst:46 msgid "" @@ -146,14 +144,14 @@ msgstr "استفاده از پایگاه پیگیری مشکلات پایتون" #: ../../bugs.rst:55 msgid "" "Issue reports for Python itself should be submitted via the GitHub issues " -"tracker (https://github.com/python/cpython/issues). The GitHub issues " -"tracker offers a web form which allows pertinent information to be entered " -"and submitted to the developers." +"tracker (https://github.com/python/cpython/issues). The GitHub issues tracker " +"offers a web form which allows pertinent information to be entered and " +"submitted to the developers." msgstr "" "گزارش‌های خطا برای پایتون باید از طریق پایگاه پیگیری مشکلات گیت‌هاب (https://" "github.com/python/cpython/issues) ارسال شوند. پایگاه پیگیری مشکلات گیت‌هاب یک " -"فرم وب ارائه می‌دهد که امکان وارد کردن اطلاعات مرتبط و ارسال آن به " -"توسعه‌دهندگان را فراهم می‌کند." +"فرم وب ارائه می‌دهد که امکان وارد کردن اطلاعات مرتبط و ارسال آن به توسعه‌دهندگان " +"را فراهم می‌کند." #: ../../bugs.rst:60 msgid "" @@ -174,14 +172,13 @@ msgstr "" #: ../../bugs.rst:67 msgid "" -"If the problem you're reporting is not already in the list, log in to " -"GitHub. If you don't already have a GitHub account, create a new account " -"using the \"Sign up\" link. It is not possible to submit a bug report " -"anonymously." +"If the problem you're reporting is not already in the list, log in to GitHub. " +"If you don't already have a GitHub account, create a new account using the " +"\"Sign up\" link. It is not possible to submit a bug report anonymously." msgstr "" -"اگر مشکلی که گزارش می‌دهید در لیست موجود نباشد، وارد GitHub شوید. اگر قبلاً " -"حساب GitHub ندارید، با استفاده از لینک \"Sign up\" یک حساب جدید ایجاد کنید. " -"ارسال گزارش باگ به صورت ناشناس امکان پذیر نیست." +"اگر مشکلی که گزارش می‌دهید در لیست موجود نباشد، وارد GitHub شوید. اگر قبلاً حساب " +"GitHub ندارید، با استفاده از لینک \"Sign up\" یک حساب جدید ایجاد کنید. ارسال " +"گزارش باگ به صورت ناشناس امکان پذیر نیست." #: ../../bugs.rst:72 msgid "" @@ -210,16 +207,16 @@ msgid "" "extension modules were involved, and what hardware and software platform you " "were using (including version information as appropriate)." msgstr "" -"در قسمت \"Comment\", مشکل را با جزئیات بیان کنید، از جمله اینکه انتظار " -"داشتید چه اتفاقی بیفتد و چه چیزی واقعاً اتفاق افتاد. حتماً اشاره کنید که آیا " -"ماژول‌های افزونه‌ای درگیر بودند یا خیر و از چه سخت افزار و پلتفرم نرم‌‌افزاری " -"استفاده می‌کردید (شامل اطلاعات نسخه در صورت لزوم)." +"در قسمت \"Comment\", مشکل را با جزئیات بیان کنید، از جمله اینکه انتظار داشتید " +"چه اتفاقی بیفتد و چه چیزی واقعاً اتفاق افتاد. حتماً اشاره کنید که آیا ماژول‌های " +"افزونه‌ای درگیر بودند یا خیر و از چه سخت افزار و پلتفرم نرم‌‌افزاری استفاده " +"می‌کردید (شامل اطلاعات نسخه در صورت لزوم)." #: ../../bugs.rst:85 msgid "" "Each issue report will be reviewed by a developer who will determine what " -"needs to be done to correct the problem. You will receive an update each " -"time an action is taken on the issue." +"needs to be done to correct the problem. You will receive an update each time " +"an action is taken on the issue." msgstr "" "هر گزارش خطا توسط یک توسعه‌دهنده بررسی خواهد شد که تصمیم می‌گیرد چه اقداماتی " "برای رفع مشکل نیاز است. هر بار که اقدامی روی گزارش انجام شود، به شما " @@ -227,11 +224,11 @@ msgstr "" #: ../../bugs.rst:92 msgid "" -"`How to Report Bugs Effectively `_" +"`How to Report Bugs Effectively `_" msgstr "" -"`نحوه گزارش اشکالات به طور موثر `_" +"`نحوه گزارش اشکالات به طور موثر `_" #: ../../bugs.rst:93 msgid "" @@ -251,26 +248,26 @@ msgstr "" #: ../../bugs.rst:97 msgid "" -"Information about writing a good bug report. Some of this is specific to " -"the Mozilla project, but describes general good practices." +"Information about writing a good bug report. Some of this is specific to the " +"Mozilla project, but describes general good practices." msgstr "" "اطلاعاتی دربارهٔ نحوهٔ نگارش یک گزارش خطای خوب. بخشی از این اطلاعات به پروژهٔ " "موزیلا اختصاص دارد، اما اصول کلی و خوبِ گزارش‌دهی را نیز توضیح می‌دهد." #: ../../bugs.rst:103 msgid "Getting started contributing to Python yourself" -msgstr "شروع مشارکت شخصی در توسعهٔ پایتون" +msgstr "شروع مشارکت در توسعهٔ پایتون" #: ../../bugs.rst:105 msgid "" "Beyond just reporting bugs that you find, you are also welcome to submit " "patches to fix them. You can find more information on how to get started " "patching Python in the `Python Developer's Guide`_. If you have questions, " -"the `core-mentorship mailing list`_ is a friendly place to get answers to " -"any and all questions pertaining to the process of fixing issues in Python." +"the `core-mentorship mailing list`_ is a friendly place to get answers to any " +"and all questions pertaining to the process of fixing issues in Python." msgstr "" "علاوه بر گزارش اشکالاتی که پیدا می‌کنید، می توانید وصله‌هایی برای رفع آن ها " -"ارسال کنید. می‌توانید اطلاعات بیشتری درباره ی نحوه ی شروع به وصله زدن Python " -"را در \"`Python Developer's Guide`_\" پیدا کنید. اگر سوالی دارید، \"`core-" -"mentorship mailing list`_\" جای دوستانه‌ای برای دریافت پاسخ به هر سوال مربوط " -"به فرآیند رفع اشکالات در Python است." +"ارسال کنید. می‌توانید اطلاعات بیشتری درباره‌ی نحوه‌ی شروع به وصله زدن Python را " +"در \"`Python Developer's Guide`_\" پیدا کنید. اگر سوالی دارید، \"`core-" +"mentorship mailing list`_\" جای دوستانه‌ای برای دریافت پاسخ به هر سوال مربوط به " +"فرآیند رفع اشکالات در Python است." diff --git a/library/functions.po b/library/functions.po index e45de5a8f..aa08bd323 100644 --- a/library/functions.po +++ b/library/functions.po @@ -17,15 +17,15 @@ msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-07-25 12:59+0330\n" -"PO-Revision-Date: 2021-06-28 01:06+0000\n" +"PO-Revision-Date: 2026-07-26 12:31+0330\n" "Last-Translator: khosro azimi, 2025\n" -"Language-Team: Persian (https://app.transifex.com/python-doc/teams/5390/" -"fa/)\n" +"Language-Team: Persian (https://app.transifex.com/python-doc/teams/5390/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" #: ../../library/functions.rst:5 ../../library/functions.rst:11 msgid "Built-in Functions" @@ -33,12 +33,11 @@ msgstr "توابع پیش ساخته" #: ../../library/functions.rst:7 msgid "" -"The Python interpreter has a number of functions and types built into it " -"that are always available. They are listed here in alphabetical order." +"The Python interpreter has a number of functions and types built into it that are always available. They are listed here " +"in alphabetical order." msgstr "" -"مفسر پایتون دارای تعدادی تابع و نوع داده (type) است که در آن بصورت توکار " -"(built-in) همیشه در دسترس می‌باشند. آن‌ها در اینجا به ترتیب حروف الفبا فهرست " -"شده‌اند." +"مفسر پایتون دارای تعدادی تابع و نوع داده (type) است که در آن بصورت توکار (built-in) همیشه در دسترس می‌باشند. آن‌ها در اینجا " +"به ترتیب حروف الفبا فهرست شده‌اند." #: ../../library/functions.rst:0 msgid "**A**" @@ -406,33 +405,24 @@ msgstr ":func:`__import__`" #: ../../library/functions.rst:59 msgid "" -"Return the absolute value of a number. The argument may be an integer, a " -"floating-point number, or an object implementing :meth:`~object.__abs__`. If " -"the argument is a complex number, its magnitude is returned." +"Return the absolute value of a number. The argument may be an integer, a floating-point number, or an object " +"implementing :meth:`~object.__abs__`. If the argument is a complex number, its magnitude is returned." msgstr "" -"مقدار قدر مطلق یک عدد را برمی‌گرداند. آرگومان می تواند یک عدد صحیح، یک عدد " -"اعشاری، یا یک شیء که :meth:`~object.__abs__` را پیاده سازی می‌کند، باشد. اگر " -"ارگومان یک عدد مختلط باشد، بزرگی آن بازگردانده می‌شود." +"مقدار قدر مطلق یک عدد را برمی‌گرداند. آرگومان می تواند یک عدد صحیح، یک عدد اعشاری، یا یک شیء که :meth:`~object.__abs__` را " +"پیاده سازی می‌کند، باشد. اگر ارگومان یک عدد مختلط باشد، بزرگی آن بازگردانده می‌شود." #: ../../library/functions.rst:67 -msgid "" -"Return an :term:`asynchronous iterator` for an :term:`asynchronous " -"iterable`. Equivalent to calling ``x.__aiter__()``." +msgid "Return an :term:`asynchronous iterator` for an :term:`asynchronous iterable`. Equivalent to calling ``x.__aiter__()``." msgstr "" -"بازگرداندن یک :term:`asynchronous iterator` برای یک :term:`asynchronous " -"iterable` معادل فراخوانی ``x.__aiter__()`` است." +"بازگرداندن یک :term:`asynchronous iterator` برای یک :term:`asynchronous iterable` معادل فراخوانی ``x.__aiter__()`` است." #: ../../library/functions.rst:70 msgid "Note: Unlike :func:`iter`, :func:`aiter` has no 2-argument variant." msgstr "توجه: برخلاف :func:`iter`، :func:`aiter` نسخه دو آرگومانی ندارد." #: ../../library/functions.rst:76 -msgid "" -"Return ``True`` if all elements of the *iterable* are true (or if the " -"iterable is empty). Equivalent to::" -msgstr "" -"در صورتی که تمام عناصر *iterable* درست باشند (یا اگر iterable خالی باشد)، " -"``True`` را برمی گرداند. معادل با::" +msgid "Return ``True`` if all elements of the *iterable* are true (or if the iterable is empty). Equivalent to::" +msgstr "در صورتی که تمام عناصر *iterable* درست باشند (یا اگر iterable خالی باشد)، ``True`` را برمی گرداند. معادل با::" #: ../../library/functions.rst:79 msgid "" @@ -450,38 +440,31 @@ msgstr "" #: ../../library/functions.rst:89 msgid "" -"When awaited, return the next item from the given :term:`asynchronous " -"iterator`, or *default* if given and the iterator is exhausted." +"When awaited, return the next item from the given :term:`asynchronous iterator`, or *default* if given and the iterator is " +"exhausted." msgstr "" -"هنگام اِنتظار (await)، عنصر بعدی را از :term:`asynchronous iterator` داده شده " -"برمی‌گرداند، یا اگر آرگومان *default* ارائه شده و تکرارکننده به پایان رسیده " -"باشد، مقدار *default* را برمی‌گرداند." +"هنگام اِنتظار (await)، عنصر بعدی را از :term:`asynchronous iterator` داده شده برمی‌گرداند، یا اگر آرگومان *default* ارائه شده " +"و تکرارکننده به پایان رسیده باشد، مقدار *default* را برمی‌گرداند." #: ../../library/functions.rst:92 -msgid "" -"This is the async variant of the :func:`next` builtin, and behaves similarly." -msgstr "" -"این، نسخه ناهمگامِ تابع داخلی :func:`next` است و به طور مشابه عمل می‌کند." +msgid "This is the async variant of the :func:`next` builtin, and behaves similarly." +msgstr "این، نسخه ناهمگامِ تابع داخلی :func:`next` است و به طور مشابه عمل می‌کند." #: ../../library/functions.rst:95 msgid "" -"This calls the :meth:`~object.__anext__` method of *async_iterator*, " -"returning an :term:`awaitable`. Awaiting this returns the next value of the " -"iterator. If *default* is given, it is returned if the iterator is " -"exhausted, otherwise :exc:`StopAsyncIteration` is raised." +"This calls the :meth:`~object.__anext__` method of *async_iterator*, returning an :term:`awaitable`. Awaiting this returns " +"the next value of the iterator. If *default* is given, it is returned if the iterator is exhausted, " +"otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"این روش(متد) :meth:`~object.__anext__` از *async_iterator* را فراخوانی می " -"کند و یک :term:`awaitable` را برمی گرداند. در انتظار این مقدار بعدی تکرار " -"کننده را برمی گرداند. اگر *default* داده شود، اگر تکرار کننده تمام شده باشد، " -"برگردانده می شود، در غیر این صورت :exc:`StopAsyncIteration` افزایش می یابد." +"این روش(متد) :meth:`~object.__anext__` از *async_iterator* را فراخوانی می کند و یک :term:`awaitable` را برمی گرداند. در " +"انتظار این مقدار بعدی تکرار کننده را برمی گرداند. اگر *default* داده شود، اگر تکرار کننده تمام شده باشد، برگردانده می شود، " +"در غیر این صورت :exc:`StopAsyncIteration` افزایش می یابد." #: ../../library/functions.rst:104 msgid "" -"Return ``True`` if any element of the *iterable* is true. If the iterable " -"is empty, return ``False``. Equivalent to::" +"Return ``True`` if any element of the *iterable* is true. If the iterable is empty, return ``False``. Equivalent to::" msgstr "" -"اگر هر عنصری از *iterable* درست باشد، ``True`` را برگردانید. اگر iterable " -"خالی باشد، ``False`` را برگردانید. معادل با::" +"اگر هر عنصری از *iterable* درست باشد، ``True`` را برگردانید. اگر iterable خالی باشد، ``False`` را برگردانید. معادل با::" #: ../../library/functions.rst:107 msgid "" @@ -499,64 +482,47 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" -"As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned " -"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " -"a string similar to that returned by :func:`repr` in Python 2." +"As :func:`repr`, return a string containing a printable representation of an object, but escape the non-ASCII characters in " +"the string returned by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string similar to that " +"returned by :func:`repr` in Python 2." msgstr "" -"مانند تابع :func:`repr`، رشته‌ای حاوی نمایش قابل چاپ یک شیء را برمی‌گرداند، " -"اما کاراکترهای غیر اَسکی (non-ASCII) را در رشته‌ی بازگردانده‌شده توسط " -"تابع :func:`repr`، با استفاده از توالی‌های گریز (escapes) ``\\x``، ``\\u`` یا " -"``\\U`` اِسکِیپ (escape) می‌کند. این عمل، رشته‌ای مشابه آنچه تابع :func:`repr` " -"در پایتون ۲ بازمی‌گرداند، تولید می‌کند." +"مانند تابع :func:`repr`، رشته‌ای حاوی نمایش قابل چاپ یک شیء را برمی‌گرداند، اما کاراکترهای غیر اَسکی (non-ASCII) را در رشته‌ی " +"بازگردانده‌شده توسط تابع :func:`repr`، با استفاده از توالی‌های گریز (escapes) ``\\x``، ``\\u`` یا ``\\U`` اِسکِیپ (escape) " +"می‌کند. این عمل، رشته‌ای مشابه آنچه تابع :func:`repr` در پایتون ۲ بازمی‌گرداند، تولید می‌کند." #: ../../library/functions.rst:124 -#, fuzzy msgid "" -"Convert an integer number to a binary string prefixed with \"0b\". The " -"result is a valid Python expression. If *integer* is not a " -"Python :class:`int` object, it has to define an :meth:`~object.__index__` " -"method that returns an integer. Some examples:" +"Convert an integer number to a binary string prefixed with \"0b\". The result is a valid Python expression. If *integer* is " +"not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. Some " +"examples:" msgstr "" -"تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک " -"عبارت معتبر پایتون خواهد بود. اگر *x* یک شیء پایتون :class:`int` نباشد، لازم " -"است یک روش(متد) :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. " -"برخی مثال ها:" +"تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک عبارت معتبر پایتون خواهد بود. اگر *integer* یک " +"شیء پایتون :class:`int` نباشد، لازم است یک روش(متد) :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. برخی مثال " +"ها:" #: ../../library/functions.rst:134 -msgid "" -"If the prefix \"0b\" is desired or not, you can use either of the following " -"ways." -msgstr "" -"چنانچه پیشوند \"0b\" مطلوب باشد یا نباشد، می‌توانید از یکی از روش‌های زیر " -"استفاده کنید." +msgid "If the prefix \"0b\" is desired or not, you can use either of the following ways." +msgstr "چنانچه پیشوند \"0b\" مطلوب باشد یا نباشد، می‌توانید از یکی از روش‌های زیر استفاده کنید." #: ../../library/functions.rst:141 -msgid "" -"See also :func:`enum.bin` to represent negative values as twos-complement." -msgstr "" +msgid "See also :func:`enum.bin` to represent negative values as twos-complement." +msgstr "همچنین برای نمایش مقادیر منفی به‌صورت مکمل دو، به :func:`enum.bin` مراجعه کنید." -#: ../../library/functions.rst:143 ../../library/functions.rst:952 -#: ../../library/functions.rst:1336 +#: ../../library/functions.rst:143 ../../library/functions.rst:952 ../../library/functions.rst:1336 msgid "See also :func:`format` for more information." msgstr "همچنین برای اطلاعات بیشتر، به تابع :func:`format` مراجعه کنید." #: ../../library/functions.rst:148 msgid "" -"Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " -"converted using the standard :ref:`truth testing procedure `. If the " -"argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` " -"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " +"Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is converted using the standard :ref:`truth " +"testing procedure `. If the argument is false or omitted, this returns ``False``; otherwise, it returns ``True``. " +"The :class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`). It cannot be subclassed further. Its only " "instances are ``False`` and ``True`` (see :ref:`typebool`)." msgstr "" -"یک مقدار بولی، یعنی یکی از ``True`` یا ``False`` را برگردانید. آرگومان با " -"استفاده از استاندارد :ref:`truth testing procedure ` تبدیل می شود. " -"اگر آرگومان نادرست یا حذف شده باشد، ``False`` را برمی گرداند. در غیر این " -"صورت، ``True`` را برمی گرداند. کلاس :class:`bool` یک زیر کلاس " -"از :class:`int` است (به :ref:`typesnumeric` مراجعه کنید). این کلاس دیگر قابل " -"زیرکلاس‌بندی نیست. تنها نمونه های آن ``False`` و ``True`` هستند " -"(به :ref:`typebool` مراجعه کنید)." +"یک مقدار بولی، یعنی یکی از ``True`` یا ``False`` را بر می‌گرداند. آرگومان با استفاده از استاندارد :ref:`truth testing " +"procedure ` تبدیل می شود. اگر آرگومان نادرست یا حذف شده باشد، ``False`` را برمی گرداند. در غیر این صورت، ``True`` را " +"برمی گرداند. کلاس :class:`bool` یک زیر کلاس از :class:`int` است (به :ref:`typesnumeric` مراجعه کنید). این کلاس دیگر قابل " +"زیرکلاس‌بندی نیست. تنها نمونه های آن ``False`` و ``True`` هستند (به :ref:`typebool` مراجعه کنید)." #: ../../library/functions.rst:158 ../../library/functions.rst:817 msgid "The parameter is now positional-only." @@ -564,109 +530,80 @@ msgstr "این آرگومان اکنون صرفاً جایگاهی (positional-o #: ../../library/functions.rst:163 msgid "" -"This function drops you into the debugger at the call site. Specifically, " -"it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight " -"through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace` " -"expecting no arguments. In this case, it is purely a convenience function " -"so you don't have to explicitly import :mod:`pdb` or type as much code to " -"enter the debugger. However, :func:`sys.breakpointhook` can be set to some " -"other function and :func:`breakpoint` will automatically call that, allowing " -"you to drop into the debugger of choice. If :func:`sys.breakpointhook` is " -"not accessible, this function will raise :exc:`RuntimeError`." -msgstr "" -"این تابع، اجرای برنامه را در محل فراخوانی متوقف کرده و شما را وارد محیط " -"اشکال‌زدا (debugger) می‌کند. به طور خاص، این تابع، :func:`sys.breakpointhook` " -"را فراخوانی کرده و مقادیر ``args`` و ``kws`` مستقیماً به آن ارسال (pass) " -"می‌کند. به طور پیش‌فرض، تابع ``sys.breakpointhook()`` بدون نیاز به هیچ " -"آرگومانی :func:`pdb.set_trace` را فراخوانی می کند. در این حالت، این صرفاً یک " -"تابع کمکی (convenience function) است تا مجبور نباشید ماژول :mod:`pdb` را به " -"صراحت ایمپورت (import) کنید یا برای ورود به اشکال‌زدا، کد زیادی بنویسید. با " -"این حال، می‌توان :func:`sys.breakpointhook` را روی تابع دیگری تنظیم کرد و در " -"این صورت، :func:`breakpoint` به طور خودکار آن را فراخوانی می کند و به شما " -"این امکان را می دهد که به اشکال‌زدای مورد نظر خود وارد شوید. " -"اگر :func:`sys.breakpointhook` قابل دسترسی نباشد، این تابع، " -"استثنای :exc:`RuntimeError` را ایجاد خواهد کرد." +"This function drops you into the debugger at the call site. Specifically, it calls :func:`sys.breakpointhook`, passing " +"``args`` and ``kws`` straight through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace` expecting no " +"arguments. In this case, it is purely a convenience function so you don't have to explicitly import :mod:`pdb` or type as " +"much code to enter the debugger. However, :func:`sys.breakpointhook` can be set to some other function " +"and :func:`breakpoint` will automatically call that, allowing you to drop into the debugger of choice. " +"If :func:`sys.breakpointhook` is not accessible, this function will raise :exc:`RuntimeError`." +msgstr "" +"این تابع، اجرای برنامه را در محل فراخوانی متوقف کرده و شما را وارد محیط اشکال‌زدا (debugger) می‌کند. به طور خاص، این " +"تابع، :func:`sys.breakpointhook` را فراخوانی کرده و مقادیر ``args`` و ``kws`` مستقیماً به آن ارسال (pass) می‌کند. به طور " +"پیش‌فرض، تابع ``sys.breakpointhook()`` بدون نیاز به هیچ آرگومانی :func:`pdb.set_trace` را فراخوانی می کند. در این حالت، این " +"صرفاً یک تابع کمکی (convenience function) است تا مجبور نباشید ماژول :mod:`pdb` را به صراحت ایمپورت (import) کنید یا برای " +"ورود به اشکال‌زدا، کد زیادی بنویسید. با این حال، می‌توان :func:`sys.breakpointhook` را روی تابع دیگری تنظیم کرد و در این " +"صورت، :func:`breakpoint` به طور خودکار آن را فراخوانی می کند و به شما این امکان را می دهد که به اشکال‌زدای مورد نظر خود وارد " +"شوید. اگر :func:`sys.breakpointhook` قابل دسترسی نباشد، این تابع، استثنای :exc:`RuntimeError` را ایجاد خواهد کرد." #: ../../library/functions.rst:175 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with " -"the :envvar:`PYTHONBREAKPOINT` environment variable. " +"By default, the behavior of :func:`breakpoint` can be changed with the :envvar:`PYTHONBREAKPOINT` environment variable. " "See :func:`sys.breakpointhook` for usage details." msgstr "" -"به طور پیش‌فرض، رفتار تابع :func:`breakpoint` را می‌توان با متغیر " -"محیطی :envvar:`PYTHONBREAKPOINT` تغییر داد. برای جزئیات استفاده، به " -"تابع :func:`sys.breakpointhook` مراجعه کنید." +"به طور پیش‌فرض، رفتار تابع :func:`breakpoint` را می‌توان با متغیر محیطی :envvar:`PYTHONBREAKPOINT` تغییر داد. برای جزئیات " +"استفاده، به تابع :func:`sys.breakpointhook` مراجعه کنید." #: ../../library/functions.rst:179 -msgid "" -"Note that this is not guaranteed if :func:`sys.breakpointhook` has been " -"replaced." -msgstr "" -"توجه داشته باشید که این امر تضمین نمی‌شود اگر تابع :func:`sys.breakpointhook` " -"جایگزین شده باشد." +msgid "Note that this is not guaranteed if :func:`sys.breakpointhook` has been replaced." +msgstr "توجه داشته باشید که این امر تضمین نمی‌شود اگر تابع :func:`sys.breakpointhook` جایگزین شده باشد." #: ../../library/functions.rst:182 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.breakpoint`` with " -"argument ``breakpointhook``." -msgstr "" -"یک :ref:`auditing event ` ``builtins.breakpoint`` با آرگومان " -"``breakpointhook`` ایجاد می کند." +msgid "Raises an :ref:`auditing event ` ``builtins.breakpoint`` with argument ``breakpointhook``." +msgstr "یک :ref:`auditing event ` ``builtins.breakpoint`` با آرگومان ``breakpointhook`` ایجاد می کند." #: ../../library/functions.rst:191 msgid "" -"Return a new array of bytes. The :class:`bytearray` class is a mutable " -"sequence of integers in the range 0 <= x < 256. It has most of the usual " -"methods of mutable sequences, described in :ref:`typesseq-mutable`, as well " -"as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." +"Return a new array of bytes. The :class:`bytearray` class is a mutable sequence of integers in the range 0 <= x < 256. It " +"has most of the usual methods of mutable sequences, described in :ref:`typesseq-mutable`, as well as most methods that " +"the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" -"یک آرایه بایتی جدید برمی گرداند. کلاس :class:`bytearray` یک دنباله قابل " -"تغییر از اعداد صحیح در محدوده 0 <= x < 256 است. این کلاس اکثر روش های معمول " -"دنباله های قابل تغییر را دارد که در :ref:`typesseq-mutable` توضیح داده شده " -"اند و همچنین بیشتر روش هایی که نوع :class:`bytes` دارد را داراست، " -"به :ref:`bytes-methods` مراجعه کنید." +"یک آرایهٔ جدید از بایت‌ها را برمی‌گرداند. کلاس :class:`bytearray` دنباله‌ای قابل‌تغییر از اعداد صحیح در بازهٔ 0 <= x < 256 " +"است. این کلاس بیشتر متدهای معمول دنباله‌های قابل‌تغییر را دارد که در :ref:`typesseq-mutable` شرح داده شده‌اند، و همچنین " +"بیشتر متدهایی را دارد که نوع :class:`bytes` دارد؛ به :ref:`bytes-methods` مراجعه کنید." #: ../../library/functions.rst:196 -msgid "" -"The optional *source* parameter can be used to initialize the array in a few " -"different ways:" -msgstr "" -"از پارامتر اختیاری *source* می‌توان برای مقداردهی اولیه آرایه به چند روش " -"مختلف استفاده کرد:" +msgid "The optional *source* parameter can be used to initialize the array in a few different ways:" +msgstr "از پارامتر اختیاری *source* می‌توان برای مقداردهی اولیه آرایه به چند روش مختلف استفاده کرد:" #: ../../library/functions.rst:199 msgid "" -"If it is a *string*, you must also give the *encoding* (and optionally, " -"*errors*) parameters; :func:`bytearray` then converts the string to bytes " -"using :meth:`str.encode`." +"If it is a *string*, you must also give the *encoding* (and optionally, *errors*) parameters; :func:`bytearray` then " +"converts the string to bytes using :meth:`str.encode`." msgstr "" -"اگر *source* یک *رشته* «*string*» باشد، باید پارامترهای *encoding* و (به‌صورت " -"اختیاری) *errors* را نیز مشخص کنید؛ سپس تابع :func:`bytearray` آن رشته را با " -"استفاده از متد :meth:`str.encode` به بایت‌ها تبدیل می‌کند." +"اگر *source* یک *رشته* «*string*» باشد، باید پارامترهای *encoding* و (به‌صورت اختیاری) *errors* را نیز مشخص کنید؛ سپس " +"تابع :func:`bytearray` آن رشته را با استفاده از متد :meth:`str.encode` به بایت‌ها تبدیل می‌کند." #: ../../library/functions.rst:203 -msgid "" -"If it is an *integer*, the array will have that size and will be initialized " -"with null bytes." +msgid "If it is an *integer*, the array will have that size and will be initialized with null bytes." msgstr "" -"اگر «*source*» یک *عدد صحیح* «integer» باشد، آرایه به اندازه همان عدد ایجاد " -"شده و با بایت‌های تهی «null byte» مقداردهی اولیه خواهد شد." +"اگر «*source*» یک *عدد صحیح* «integer» باشد، آرایه به اندازه همان عدد ایجاد شده و با بایت‌های تهی «null byte» مقداردهی اولیه " +"خواهد شد." #: ../../library/functions.rst:206 msgid "" -"If it is an object conforming to the :ref:`buffer interface " -"`, a read-only buffer of the object will be used to " -"initialize the bytes array." +"If it is an object conforming to the :ref:`buffer interface `, a read-only buffer of the object will be used " +"to initialize the bytes array." msgstr "" +"اگر آرگومان، شیئی سازگار با :ref:`رابط بافر ` باشد، از یک بافر فقط‌خواندنیِ آن شیء برای مقداردهی اولیهٔ آرایهٔ " +"بایت‌ها استفاده خواهد شد." #: ../../library/functions.rst:209 msgid "" -"If it is an *iterable*, it must be an iterable of integers in the range ``0 " -"<= x < 256``, which are used as the initial contents of the array." +"If it is an *iterable*, it must be an iterable of integers in the range ``0 <= x < 256``, which are used as the initial " +"contents of the array." msgstr "" -"اگر «*source*» یک *تکرارپذیر* «iterable» باشد، باید یک تکرارپذیر از اعداد " -"صحیح در بازه ``0 <= x < 256`` باشد، که این اعداد به عنوان محتویات اولیه " -"آرایه استفاده می‌شوند." +"اگر «*source*» یک *تکرارپذیر* «iterable» باشد، باید یک تکرارپذیر از اعداد صحیح در بازه ``0 <= x < 256`` باشد، که این اعداد " +"به عنوان محتویات اولیه آرایه استفاده می‌شوند." #: ../../library/functions.rst:212 msgid "Without an argument, an array of size 0 is created." @@ -678,64 +615,68 @@ msgstr "همچنین به :ref:`binaryseq` و :ref:`typebytearray` مراجعه #: ../../library/functions.rst:222 msgid "" -"Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " -"of :class:`bytearray` -- it has the same non-mutating methods and the same " -"indexing and slicing behavior." +"Return a new \"bytes\" object which is an immutable sequence of integers in the range ``0 <= x < 256``. :class:`bytes` is " +"an immutable version of :class:`bytearray` -- it has the same non-mutating methods and the same indexing and slicing " +"behavior." msgstr "" +"یک شیء «bytes» جدید را برمی‌گرداند که دنباله‌ای تغییرناپذیر از اعداد صحیح در بازهٔ ``0 <= x < 256`` است. :class:`bytes` " +"نسخهٔ تغییرناپذیر :class:`bytearray` است؛ همان متدهای غیرتغییردهنده و همان رفتار اندیس‌گذاری و برش (slicing) را دارد." #: ../../library/functions.rst:227 -msgid "" -"Accordingly, constructor arguments are interpreted as for :func:`bytearray`." -msgstr "" +msgid "Accordingly, constructor arguments are interpreted as for :func:`bytearray`." +msgstr "بر این اساس، آرگومان‌های سازنده همانند :func:`bytearray` تفسیر می‌شوند." #: ../../library/functions.rst:229 msgid "Bytes objects can also be created with literals, see :ref:`strings`." -msgstr "" +msgstr "اشیای bytes را می‌توان با استفاده از ثابت‌های متنی نیز ایجاد کرد؛ برای اطلاعات بیشتر، :ref:`strings` را ببینید." #: ../../library/functions.rst:231 msgid "See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`." -msgstr "" +msgstr "همچنین به :ref:`binaryseq`، :ref:`typebytes` و :ref:`bytes-methods` مراجعه کنید." #: ../../library/functions.rst:236 msgid "" -"Return :const:`True` if the *object* argument appears " -"callable, :const:`False` if not. If this returns ``True``, it is still " -"possible that a call fails, but if it is ``False``, calling *object* will " -"never succeed. Note that classes are callable (calling a class returns a new " -"instance); instances are callable if their class has " -"a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears callable, :const:`False` if not. If this returns ``True``, it is " +"still possible that a call fails, but if it is ``False``, calling *object* will never succeed. Note that classes are " +"callable (calling a class returns a new instance); instances are callable if their class has a :meth:`~object.__call__` " +"method." msgstr "" +"اگر آرگومان *object* فراخوانی‌پذیر باشد، مقدار :const:`True` و در غیر این صورت مقدار :const:`False` را برمی‌گرداند. اگر نتیجه " +"``True`` باشد، همچنان ممکن است فراخوانی با شکست مواجه شود؛ اما اگر ``False`` باشد، فراخوانی *object* هرگز موفق نخواهد شد. " +"توجه داشته باشید که کلاس‌ها فراخوانی‌پذیر هستند (فراخوانی یک کلاس یک نمونهٔ جدید برمی‌گرداند) و نمونه‌ها نیز در صورتی " +"فراخوانی‌پذیر هستند که کلاس آن‌ها متد :meth:`~object.__call__` را داشته باشد." #: ../../library/functions.rst:242 -msgid "" -"This function was first removed in Python 3.0 and then brought back in " -"Python 3.2." -msgstr "" +msgid "This function was first removed in Python 3.0 and then brought back in Python 3.2." +msgstr "این تابع ابتدا در پایتون ۳٫۰ حذف شد و سپس در پایتون ۳٫۲ دوباره بازگردانده شد." #: ../../library/functions.rst:249 msgid "" -"Return the string representing a character with the specified Unicode code " -"point. For example, ``chr(97)`` returns the string ``'a'``, while " -"``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`." +"Return the string representing a character with the specified Unicode code point. For example, ``chr(97)`` returns the " +"string ``'a'``, while ``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`." msgstr "" +"رشته‌ای را که نویسهٔ متناظر با نقطهٔ کد یونی‌کد مشخص‌شده را نمایش می‌دهد، برمی‌گرداند. برای مثال، ``chr(97)`` رشتهٔ ``'a'`` و " +"``chr(8364)`` رشتهٔ ``'€'`` را برمی‌گرداند. این تابع معکوس :func:`ord` است." #: ../../library/functions.rst:253 msgid "" -"The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in " -"base 16). :exc:`ValueError` will be raised if it is outside that range." +"The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in base 16). :exc:`ValueError` will be raised if it " +"is outside that range." msgstr "" +"بازهٔ معتبر برای این آرگومان از ۰ تا ۱٬۱۱۴٬۱۱۱ (برابر با 0x10FFFF در مبنای ۱۶) است. اگر مقدار خارج از این بازه باشد، " +"استثنای :exc:`ValueError` ایجاد خواهد شد." #: ../../library/functions.rst:259 msgid "Transform a method into a class method." -msgstr "" +msgstr "یک متد را به متد کلاسی تبدیل می‌کند." #: ../../library/functions.rst:261 msgid "" -"A class method receives the class as an implicit first argument, just like " -"an instance method receives the instance. To declare a class method, use " -"this idiom::" +"A class method receives the class as an implicit first argument, just like an instance method receives the instance. To " +"declare a class method, use this idiom::" msgstr "" +"یک متد کلاس، همان‌طور که متد نمونه، نمونه را به‌عنوان نخستین آرگومان ضمنی دریافت می‌کند، کلاس را به‌عنوان نخستین آرگومان ضمنی " +"دریافت می‌کند. برای تعریف یک متد کلاس، از الگوی زیر استفاده کنید::" #: ../../library/functions.rst:265 msgid "" @@ -743,168 +684,176 @@ msgid "" " @classmethod\n" " def f(cls, arg1, arg2): ..." msgstr "" +"class C:\n" +" @classmethod\n" +" def f(cls, arg1, arg2): ..." #: ../../library/functions.rst:269 -msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- " -"see :ref:`function` for details." -msgstr "" +msgid "The ``@classmethod`` form is a function :term:`decorator` -- see :ref:`function` for details." +msgstr "شکل ``@classmethod`` یک :term:`تزئین‌کننده ` تابع است؛ برای جزئیات به :ref:`function` مراجعه کنید." #: ../../library/functions.rst:272 msgid "" -"A class method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). The instance is ignored except for its " -"class. If a class method is called for a derived class, the derived class " -"object is passed as the implied first argument." +"A class method can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). The instance " +"is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the " +"implied first argument." msgstr "" +"یک متد کلاس را می‌توان هم روی خود کلاس (مانند ``C.f()``) و هم روی یک نمونه (مانند ``C().f()``) فراخوانی کرد. در حالت دوم، " +"نمونه نادیده گرفته می‌شود و فقط کلاس آن در نظر گرفته می‌شود. اگر متد کلاس برای یک کلاس مشتق‌شده فراخوانی شود، شیء کلاس مشتق‌شده " +"به‌عنوان نخستین آرگومان ضمنی ارسال می‌شود." #: ../../library/functions.rst:277 msgid "" -"Class methods are different than C++ or Java static methods. If you want " -"those, see :func:`staticmethod` in this section. For more information on " -"class methods, see :ref:`types`." +"Class methods are different than C++ or Java static methods. If you want those, see :func:`staticmethod` in this section. " +"For more information on class methods, see :ref:`types`." msgstr "" +"متدهای کلاس با متدهای ایستای زبان‌های ++C یا Java تفاوت دارند. اگر به آن نوع متدها نیاز دارید، به :func:`staticmethod` در " +"همین بخش مراجعه کنید. برای اطلاعات بیشتر دربارهٔ متدهای کلاس، :ref:`types` را ببینید." #: ../../library/functions.rst:281 -msgid "" -"Class methods can now wrap other :term:`descriptors ` such " -"as :func:`property`." -msgstr "" +msgid "Class methods can now wrap other :term:`descriptors ` such as :func:`property`." +msgstr "اکنون متدهای کلاس می‌توانند سایر :term:`توصیفگرها `، مانند :func:`property`، را دربر بگیرند." #: ../../library/functions.rst:285 msgid "" "Class methods now inherit the method attributes " "(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " -"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " -"attribute." +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` attribute." msgstr "" +"اکنون متدهای کلاس ویژگی‌های متد " +"(:attr:`~function.__module__`، :attr:`~function.__name__`، :attr:`~function.__qualname__`، :attr:`~function.__doc__` " +"و :attr:`~function.__annotations__`) را به ارث می‌برند و همچنین دارای ویژگی جدید ``__wrapped__`` هستند." #: ../../library/functions.rst:292 -msgid "" -"Class methods can no longer wrap other :term:`descriptors ` such " -"as :func:`property`." -msgstr "" +msgid "Class methods can no longer wrap other :term:`descriptors ` such as :func:`property`." +msgstr "دیگر متدهای کلاس نمی‌توانند سایر :term:`توصیفگرها `، مانند :func:`property`، را دربر بگیرند." #: ../../library/functions.rst:299 msgid "" -"Compile the *source* into a code or AST object. Code objects can be " -"executed by :func:`exec` or :func:`eval`. *source* can either be a normal " -"string, a byte string, or an AST object. Refer to the :mod:`ast` module " -"documentation for information on how to work with AST objects." +"Compile the *source* into a code or AST object. Code objects can be executed by :func:`exec` or :func:`eval`. *source* " +"can either be a normal string, a byte string, or an AST object. Refer to the :mod:`ast` module documentation for " +"information on how to work with AST objects." msgstr "" +"*source* را به یک شیء کد یا AST کامپایل می‌کند. اشیای کد را می‌توان با :func:`exec` یا :func:`eval` اجرا کرد. *source* " +"می‌تواند یک رشتهٔ معمولی، یک رشتهٔ بایتی یا یک شیء AST باشد. برای اطلاعات بیشتر دربارهٔ کار با اشیای AST، به مستندات " +"ماژول :mod:`ast` مراجعه کنید." #: ../../library/functions.rst:304 msgid "" -"The *filename* argument should give the file from which the code was read; " -"pass some recognizable value if it wasn't read from a file (``''`` " -"is commonly used)." +"The *filename* argument should give the file from which the code was read; pass some recognizable value if it wasn't read " +"from a file (``''`` is commonly used)." msgstr "" +"آرگومان *filename* باید نام پرونده‌ای را مشخص کند که کد از آن خوانده شده است؛ اگر کد از پرونده خوانده نشده، مقدار قابل " +"تشخیصی را ارسال کنید (معمولاً از ``''`` استفاده می‌شود)." #: ../../library/functions.rst:308 msgid "" -"The *mode* argument specifies what kind of code must be compiled; it can be " -"``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " -"it consists of a single expression, or ``'single'`` if it consists of a " -"single interactive statement (in the latter case, expression statements that " -"evaluate to something other than ``None`` will be printed)." +"The *mode* argument specifies what kind of code must be compiled; it can be ``'exec'`` if *source* consists of a sequence " +"of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single interactive " +"statement (in the latter case, expression statements that evaluate to something other than ``None`` will be printed)." msgstr "" +"آرگومان *mode* مشخص می‌کند که چه نوع کدی باید کامپایل شود؛ اگر *source* شامل دنباله‌ای از دستورها باشد، می‌تواند ``'exec'`` " +"باشد؛ اگر شامل تنها یک عبارت باشد، ``'eval'``؛ و اگر شامل تنها یک دستور تعاملی باشد، ``'single'`` (در حالت آخر، اگر عبارت " +"مقداری غیر از ``None`` تولید کند، آن مقدار چاپ خواهد شد)." #: ../../library/functions.rst:314 msgid "" -"The optional arguments *flags* and *dont_inherit* control " -"which :ref:`compiler options ` should be activated and " -"which :ref:`future features ` should be allowed. If neither is " -"present (or both are zero) the code is compiled with the same flags that " -"affect the code that is calling :func:`compile`. If the *flags* argument is " -"given and *dont_inherit* is not (or is zero) then the compiler options and " -"the future statements specified by the *flags* argument are used in addition " -"to those that would be used anyway. If *dont_inherit* is a non-zero integer " -"then the *flags* argument is it -- the flags (future features and compiler " -"options) in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control which :ref:`compiler options ` should be " +"activated and which :ref:`future features ` should be allowed. If neither is present (or both are zero) the code is " +"compiled with the same flags that affect the code that is calling :func:`compile`. If the *flags* argument is given and " +"*dont_inherit* is not (or is zero) then the compiler options and the future statements specified by the *flags* argument " +"are used in addition to those that would be used anyway. If *dont_inherit* is a non-zero integer then the *flags* argument " +"is it -- the flags (future features and compiler options) in the surrounding code are ignored." msgstr "" +"آرگومان‌های اختیاری *flags* و *dont_inherit* تعیین می‌کنند که کدام :ref:`گزینه‌های کامپایلر ` فعال شوند و " +"کدام :ref:`قابلیت‌های آینده ` مجاز باشند. اگر هیچ‌یک از آن‌ها ارائه نشوند (یا هر دو صفر باشند)، کد با همان پرچم‌هایی " +"کامپایل می‌شود که بر کدی که :func:`compile` را فراخوانی کرده است اعمال می‌شوند. اگر آرگومان *flags* ارائه شود و " +"*dont_inherit* ارائه نشود (یا صفر باشد)، گزینه‌های کامپایلر و دستورهای future مشخص‌شده توسط *flags* علاوه بر مواردی که به‌طور " +"معمول اعمال می‌شوند، استفاده خواهند شد. اگر *dont_inherit* یک عدد صحیح ناصفر باشد، تنها از *flags* استفاده می‌شود و پرچم‌های " +"(قابلیت‌های future و گزینه‌های کامپایلر) موجود در کد پیرامون نادیده گرفته می‌شوند." #: ../../library/functions.rst:325 msgid "" -"Compiler options and future statements are specified by bits which can be " -"bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as " -"the :attr:`~__future__._Feature.compiler_flag` attribute on " -"the :class:`~__future__._Feature` instance in the :mod:`__future__` " -"module. :ref:`Compiler flags ` can be found " -"in :mod:`ast` module, with ``PyCF_`` prefix." +"Compiler options and future statements are specified by bits which can be bitwise ORed together to specify multiple " +"options. The bitfield required to specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on the :class:`~__future__._Feature` instance in " +"the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` " +"prefix." msgstr "" +"گزینه‌های کامپایلر و دستورهای future با استفاده از بیت‌هایی مشخص می‌شوند که می‌توان آن‌ها را با عملگر OR بیتی با یکدیگر ترکیب " +"کرد تا چندین گزینه به‌طور هم‌زمان مشخص شوند. بیت‌فیلد لازم برای مشخص کردن هر قابلیت future را می‌توان در " +"ویژگی :attr:`~__future__._Feature.compiler_flag` از نمونهٔ :class:`~__future__._Feature` در ماژول :mod:`__future__` " +"یافت. :ref:`پرچم‌های کامپایلر ` نیز با پیشوند ``PyCF_`` در ماژول :mod:`ast` موجود هستند." #: ../../library/functions.rst:333 msgid "" -"The argument *optimize* specifies the optimization level of the compiler; " -"the default value of ``-1`` selects the optimization level of the " -"interpreter as given by :option:`-O` options. Explicit levels are ``0`` (no " -"optimization; ``__debug__`` is true), ``1`` (asserts are removed, " -"``__debug__`` is false) or ``2`` (docstrings are removed too)." +"The argument *optimize* specifies the optimization level of the compiler; the default value of ``-1`` selects the " +"optimization level of the interpreter as given by :option:`-O` options. Explicit levels are ``0`` (no optimization; " +"``__debug__`` is true), ``1`` (asserts are removed, ``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" +"آرگومان *optimize* سطح بهینه‌سازی کامپایلر را مشخص می‌کند؛ مقدار پیش‌فرض ``-1`` سطح بهینه‌سازی مفسر را مطابق گزینه‌های :option:`-" +"O` انتخاب می‌کند. سطوح صریح عبارت‌اند از: ``0`` (بدون بهینه‌سازی؛ ``__debug__`` برابر با true است)، ``1`` (دستورهای assert حذف " +"می‌شوند و ``__debug__`` برابر false است)، و ``2`` (علاوه بر آن، docstringها نیز حذف می‌شوند)." #: ../../library/functions.rst:339 -msgid "" -"This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled " -"source is invalid." -msgstr "" +msgid "This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled source is invalid." +msgstr "اگر کد منبع کامپایل‌شده نامعتبر باشد، این تابع استثنای :exc:`SyntaxError` یا :exc:`ValueError` ایجاد می‌کند." #: ../../library/functions.rst:342 -msgid "" -"If you want to parse Python code into its AST representation, " -"see :func:`ast.parse`." -msgstr "" +msgid "If you want to parse Python code into its AST representation, see :func:`ast.parse`." +msgstr "اگر می‌خواهید کد پایتون را به نمایش AST آن تجزیه کنید، به :func:`ast.parse` مراجعه کنید." #: ../../library/functions.rst:345 ../../library/functions.rst:347 msgid "" -"Raises an :ref:`auditing event ` ``compile`` with arguments " -"``source`` and ``filename``. This event may also be raised by implicit " -"compilation." +"Raises an :ref:`auditing event ` ``compile`` with arguments ``source`` and ``filename``. This event may also be " +"raised by implicit compilation." msgstr "" +"یک :ref:`رویداد ممیزی ` با نام ``compile`` و آرگومان‌های ``source`` و ``filename`` ایجاد می‌کند. این رویداد ممکن " +"است در نتیجهٔ کامپایل ضمنی نیز ایجاد شود." #: ../../library/functions.rst:353 msgid "" -"When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " -"mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in " -"the :mod:`code` module." +"When compiling a string with multi-line code in ``'single'`` or ``'eval'`` mode, input must be terminated by at least one " +"newline character. This is to facilitate detection of incomplete and complete statements in the :mod:`code` module." msgstr "" +"هنگام کامپایل یک رشته شامل کد چندخطی در حالت ``'single'`` یا ``'eval'``، ورودی باید دست‌کم با یک نویسهٔ پایان خط خاتمه یابد. " +"این کار تشخیص دستورات ناقص و کامل را در ماژول :mod:`code` تسهیل می‌کند." #: ../../library/functions.rst:360 msgid "" -"It is possible to crash the Python interpreter with a sufficiently large/" -"complex string when compiling to an AST object due to stack depth " -"limitations in Python's AST compiler." +"It is possible to crash the Python interpreter with a sufficiently large/complex string when compiling to an AST object due " +"to stack depth limitations in Python's AST compiler." msgstr "" +"به دلیل محدودیت عمق پشته (stack depth) در کامپایلر AST پایتون، کامپایل یک رشتهٔ به‌اندازهٔ کافی بزرگ یا پیچیده به یک شیء AST " +"ممکن است باعث ازکارافتادن (crash) مفسر پایتون شود." #: ../../library/functions.rst:364 msgid "" -"Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " -"does not have to end in a newline anymore. Added the *optimize* parameter." +"Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode does not have to end in a newline anymore. Added " +"the *optimize* parameter." msgstr "" +"استفاده از نویسه‌های پایان خط ویندوز و مک مجاز شد. همچنین، ورودی در حالت ``'exec'`` دیگر لازم نیست با یک نویسهٔ پایان خط " +"خاتمه یابد. پارامتر *optimize* نیز اضافه شد." #: ../../library/functions.rst:368 -msgid "" -"Previously, :exc:`TypeError` was raised when null bytes were encountered in " -"*source*." -msgstr "" +msgid "Previously, :exc:`TypeError` was raised when null bytes were encountered in *source*." +msgstr "پیش از این، هنگام برخورد با بایت‌های تهی در *source*، استثنای :exc:`TypeError` ایجاد می‌شد." #: ../../library/functions.rst:372 msgid "" -"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " -"support for top-level ``await``, ``async for``, and ``async with``." +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable support for top-level ``await``, ``async for``, and " +"``async with``." msgstr "" +"اکنون می‌توان ``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` را در پرچم‌ها ارسال کرد تا از ``await``، ``async for`` و ``async with`` در " +"سطح بالای کد (top-level) پشتیبانی شود." #: ../../library/functions.rst:381 -msgid "" -"Convert a single string or number to a complex number, or create a complex " -"number from real and imaginary parts." -msgstr "" +msgid "Convert a single string or number to a complex number, or create a complex number from real and imaginary parts." +msgstr "تبدیل یک رشته یا عدد به یک عدد مختلط، یا ایجاد یک عدد مختلط از بخش‌های حقیقی و موهومی یک عدد." -#: ../../library/functions.rst:384 ../../library/functions.rst:760 -#: ../../library/functions.rst:1008 +#: ../../library/functions.rst:384 ../../library/functions.rst:760 ../../library/functions.rst:1008 msgid "Examples:" -msgstr "" +msgstr "مثال‌ها:" #: ../../library/functions.rst:386 msgid "" @@ -925,183 +874,218 @@ msgid "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" msgstr "" +">>> complex('+1.23')\n" +"(1.23+0j)\n" +">>> complex('-4.5j')\n" +"-4.5j\n" +">>> complex('-1.23+4.5j')\n" +"(-1.23+4.5j)\n" +">>> complex('\\t( -1.23+4.5J )\\n')\n" +"(-1.23+4.5j)\n" +">>> complex('-Infinity+NaNj')\n" +"(-inf+nanj)\n" +">>> complex(1.23)\n" +"(1.23+0j)\n" +">>> complex(imag=-4.5)\n" +"-4.5j\n" +">>> complex(-1.23, 4.5)\n" +"(-1.23+4.5j)" #: ../../library/functions.rst:405 msgid "" -"If the argument is a string, it must contain either a real part (in the same " -"format as for :func:`float`) or an imaginary part (in the same format but " -"with a ``'j'`` or ``'J'`` suffix), or both real and imaginary parts (the " -"sign of the imaginary part is mandatory in this case). The string can " -"optionally be surrounded by whitespaces and the round parentheses ``'('`` " -"and ``')'``, which are ignored. The string must not contain whitespace " -"between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " -"number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to " -"the :token:`~float:complexvalue` production rule in the following grammar, " -"after parentheses and leading and trailing whitespace characters are removed:" -msgstr "" +"If the argument is a string, it must contain either a real part (in the same format as for :func:`float`) or an imaginary " +"part (in the same format but with a ``'j'`` or ``'J'`` suffix), or both real and imaginary parts (the sign of the imaginary " +"part is mandatory in this case). The string can optionally be surrounded by whitespaces and the round parentheses ``'('`` " +"and ``')'``, which are ignored. The string must not contain whitespace between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` " +"suffix, and the decimal number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " +"raises :exc:`ValueError`. More precisely, the input must conform to the :token:`~float:complexvalue` production rule in the " +"following grammar, after parentheses and leading and trailing whitespace characters are removed:" +msgstr "" +"اگر آرگومان یک رشته باشد، باید شامل بخش حقیقی (با همان قالبی که برای :func:`float` استفاده می‌شود)، یا بخش موهومی (با همان " +"قالب اما همراه با پسوند ``'j'`` یا ``'J'``)، یا هر دو بخش حقیقی و موهومی باشد (در این حالت، وجود علامت بخش موهومی الزامی " +"است). رشته می‌تواند به‌صورت اختیاری با نویسه‌های فاصلهٔ سفید و پرانتزهای گرد ``'('`` و ``')'`` احاطه شده باشد که نادیده گرفته " +"می‌شوند. همچنین، نباید بین ``'+'``، ``'-'``، پسوند ``'j'`` یا ``'J'`` و عدد ده‌دهی فاصلهٔ سفید وجود داشته باشد. برای مثال، " +"``complex('1+2j')`` معتبر است، اما ``complex('1 + 2j')`` باعث ایجاد استثنای :exc:`ValueError` می‌شود. به‌طور دقیق‌تر، پس از " +"حذف پرانتزها و نویسه‌های فاصلهٔ سفید ابتدا و انتهای رشته، ورودی باید با قاعدهٔ تولید :token:`~float:complexvalue` در دستور " +"زبان زیر مطابقت داشته باشد:" #: ../../library/functions.rst:424 msgid "" -"If the argument is a number, the constructor serves as a numeric conversion " -"like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. " -"If :meth:`~object.__complex__` is not defined then it falls back " -"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " -"falls back to :meth:`~object.__index__`." +"If the argument is a number, the constructor serves as a numeric conversion like :class:`int` and :class:`float`. For a " +"general Python object ``x``, ``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object.__complex__` is not defined " +"then it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it falls back " +"to :meth:`~object.__index__`." msgstr "" +"اگر آرگومان یک عدد باشد، سازنده مانند :class:`int` و :class:`float` به‌عنوان یک تبدیل عددی عمل می‌کند. برای یک شیء عمومی " +"پایتون به نام ``x``، تابع ``complex(x)`` فراخوانی را به ``x.__complex__()`` واگذار می‌کند. اگر :meth:`~object.__complex__` " +"تعریف نشده باشد، به :meth:`~object.__float__` بازمی‌گردد. اگر :meth:`!__float__` نیز تعریف نشده باشد، " +"به :meth:`~object.__index__` بازمی‌گردد." #: ../../library/functions.rst:433 msgid "" -"If two arguments are provided or keyword arguments are used, each argument " -"may be any numeric type (including complex). If both arguments are real " -"numbers, return a complex number with the real component *real* and the " -"imaginary component *imag*. If both arguments are complex numbers, return a " -"complex number with the real component ``real.real-imag.imag`` and the " -"imaginary component ``real.imag+imag.real``. If one of arguments is a real " -"number, only its real component is used in the above expressions." +"If two arguments are provided or keyword arguments are used, each argument may be any numeric type (including complex). If " +"both arguments are real numbers, return a complex number with the real component *real* and the imaginary component *imag*. " +"If both arguments are complex numbers, return a complex number with the real component ``real.real-imag.imag`` and the " +"imaginary component ``real.imag+imag.real``. If one of arguments is a real number, only its real component is used in the " +"above expressions." msgstr "" +"اگر دو آرگومان ارائه شوند یا از آرگومان‌های کلیدواژه‌ای استفاده شود، هر آرگومان می‌تواند از هر نوع عددی (از جمله اعداد مختلط) " +"باشد. اگر هر دو آرگومان عدد حقیقی باشند، یک عدد مختلط با بخش حقیقی *real* و بخش موهومی *imag* برگردانده می‌شود. اگر هر دو " +"آرگومان عدد مختلط باشند، عدد مختلطی با بخش حقیقی ``real.real-imag.imag`` و بخش موهومی ``real.imag+imag.real`` برگردانده " +"می‌شود. اگر یکی از آرگومان‌ها عدد حقیقی باشد، فقط بخش حقیقی آن در عبارت‌های بالا استفاده می‌شود." #: ../../library/functions.rst:443 -msgid "" -"See also :meth:`complex.from_number` which only accepts a single numeric " -"argument." -msgstr "" +msgid "See also :meth:`complex.from_number` which only accepts a single numeric argument." +msgstr "همچنین به :meth:`complex.from_number` مراجعه کنید که فقط یک آرگومان عددی را می‌پذیرد." #: ../../library/functions.rst:445 msgid "If all arguments are omitted, returns ``0j``." -msgstr "" +msgstr "اگر همهٔ آرگومان‌ها حذف شوند، مقدار ``0j`` برگردانده می‌شود." #: ../../library/functions.rst:447 msgid "The complex type is described in :ref:`typesnumeric`." -msgstr "" +msgstr "نوع مختلط در :ref:`typesnumeric` توضیح داده شده است." -#: ../../library/functions.rst:449 ../../library/functions.rst:814 -#: ../../library/functions.rst:1056 +#: ../../library/functions.rst:449 ../../library/functions.rst:814 ../../library/functions.rst:1056 msgid "Grouping digits with underscores as in code literals is allowed." -msgstr "" +msgstr "گروه‌بندی رقم‌ها با استفاده از زیرخط، همانند ثابت‌های عددی در کد، مجاز است." #: ../../library/functions.rst:452 -msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " -"and :meth:`~object.__float__` are not defined." -msgstr "" +msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :meth:`~object.__float__` are not defined." +msgstr "اگر :meth:`~object.__complex__` و :meth:`~object.__float__` تعریف نشده باشند، به :meth:`~object.__index__` بازمی‌گردد." #: ../../library/functions.rst:456 msgid "" -"Passing a complex number as the *real* or *imag* argument is now deprecated; " -"it should only be passed as a single positional argument." +"Passing a complex number as the *real* or *imag* argument is now deprecated; it should only be passed as a single " +"positional argument." msgstr "" +"ارسال یک عدد مختلط به‌عنوان آرگومان *real* یا *imag* اکنون منسوخ شده است؛ عدد مختلط باید فقط به‌صورت یک آرگومان مکانی ارسال " +"شود." #: ../../library/functions.rst:463 msgid "" -"This is a relative of :func:`setattr`. The arguments are an object and a " -"string. The string must be the name of one of the object's attributes. The " -"function deletes the named attribute, provided the object allows it. For " -"example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``. *name* " -"need not be a Python identifier (see :func:`setattr`)." +"This is a relative of :func:`setattr`. The arguments are an object and a string. The string must be the name of one of " +"the object's attributes. The function deletes the named attribute, provided the object allows it. For example, " +"``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``. *name* need not be a Python identifier (see :func:`setattr`)." msgstr "" +"این تابع همتای :func:`setattr` است. آرگومان‌های آن یک شیء و یک رشته هستند. رشته باید نام یکی از ویژگی‌های شیء باشد. در صورت " +"مجاز بودن، این تابع ویژگی نام‌برده را حذف می‌کند. برای مثال، ``delattr(x, 'foobar')`` معادل ``del x.foobar`` است. *name* " +"الزامی ندارد که یک شناسهٔ معتبر پایتون باشد (به :func:`setattr` مراجعه کنید)." #: ../../library/functions.rst:476 msgid "" -"Create a new dictionary. The :class:`dict` object is the dictionary class. " -"See :class:`dict` and :ref:`typesmapping` for documentation about this class." +"Create a new dictionary. The :class:`dict` object is the dictionary class. See :class:`dict` and :ref:`typesmapping` for " +"documentation about this class." msgstr "" +"ایجاد یک فرهنگ لغت جدید. شیء :class:`dict` کلاس فرهنگ لغت است. برای مستندات این کلاس، به :class:`dict` " +"و :ref:`typesmapping` مراجعه کنید." #: ../../library/functions.rst:479 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, " -"and :class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, and :class:`tuple` classes, as well as " +"the :mod:`collections` module." msgstr "" +"برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`list`، :class:`set` و :class:`tuple`، و همچنین ماژول :mod:`collections` " +"مراجعه کنید." #: ../../library/functions.rst:486 msgid "" -"Without arguments, return the list of names in the current local scope. " -"With an argument, attempt to return a list of valid attributes for that " -"object." +"Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of " +"valid attributes for that object." msgstr "" +"بدون آرگومان، فهرست نام‌های موجود در دامنهٔ محلیِ فعلی را بازمی‌گرداند. با ارسال یک آرگومان، تلاش می‌کند فهرستی از ویژگی‌های " +"معتبر آن شیء را بازگرداند." #: ../../library/functions.rst:489 msgid "" -"If the object has a method named :meth:`~object.__dir__`, this method will " -"be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` " -"or :func:`~object.__getattribute__` function to customize the " -"way :func:`dir` reports their attributes." +"If the object has a method named :meth:`~object.__dir__`, this method will be called and must return the list of " +"attributes. This allows objects that implement a custom :func:`~object.__getattr__` or :func:`~object.__getattribute__` " +"function to customize the way :func:`dir` reports their attributes." msgstr "" +"اگر شیء متدی با نام :meth:`~object.__dir__` داشته باشد، این متد فراخوانی می‌شود و باید فهرستی از ویژگی‌ها را برگرداند. این " +"امکان را فراهم می‌کند که اشیایی که :func:`~object.__getattr__` یا :func:`~object.__getattribute__` سفارشی را پیاده‌سازی " +"کرده‌اند، نحوهٔ گزارش ویژگی‌های خود توسط :func:`dir` را سفارشی‌سازی کنند." #: ../../library/functions.rst:496 msgid "" -"If the object does not provide :meth:`~object.__dir__`, the function tries " -"its best to gather information from the object's :attr:`~object.__dict__` " -"attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a " -"custom :func:`~object.__getattr__`." +"If the object does not provide :meth:`~object.__dir__`, the function tries its best to gather information from the " +"object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not necessarily " +"complete and may be inaccurate when the object has a custom :func:`~object.__getattr__`." msgstr "" +"اگر شیء متد :meth:`~object.__dir__` را ارائه نکند، این تابع در صورت تعریف شدن، تلاش می‌کند تا حد امکان اطلاعات را از " +"ویژگی :attr:`~object.__dict__` شیء و همچنین از شیء نوع (type object) آن جمع‌آوری کند. فهرست حاصل لزوماً کامل نیست و اگر شیء " +"دارای :func:`~object.__getattr__` سفارشی باشد، ممکن است دقیق هم نباشد." #: ../../library/functions.rst:502 msgid "" -"The default :func:`dir` mechanism behaves differently with different types " -"of objects, as it attempts to produce the most relevant, rather than " -"complete, information:" +"The default :func:`dir` mechanism behaves differently with different types of objects, as it attempts to produce the most " +"relevant, rather than complete, information:" msgstr "" +"سازوکار پیش‌فرض :func:`dir` بسته به نوع شیء رفتار متفاوتی دارد، زیرا تلاش می‌کند به‌جای ارائهٔ اطلاعات کامل، مرتبط‌ترین اطلاعات " +"را ارائه دهد:" #: ../../library/functions.rst:506 -msgid "" -"If the object is a module object, the list contains the names of the " -"module's attributes." -msgstr "" +msgid "If the object is a module object, the list contains the names of the module's attributes." +msgstr "اگر شیء یک ماژول باشد، فهرست شامل نام ویژگی‌های آن ماژول خواهد بود." #: ../../library/functions.rst:509 msgid "" -"If the object is a type or class object, the list contains the names of its " -"attributes, and recursively of the attributes of its bases." +"If the object is a type or class object, the list contains the names of its attributes, and recursively of the attributes " +"of its bases." msgstr "" +"اگر شیء یک نوع (type) یا کلاس باشد، فهرست شامل نام ویژگی‌های آن و همچنین، به‌صورت بازگشتی، نام ویژگی‌های کلاس‌های پایهٔ آن خواهد " +"بود." #: ../../library/functions.rst:512 msgid "" -"Otherwise, the list contains the object's attributes' names, the names of " -"its class's attributes, and recursively of the attributes of its class's " -"base classes." +"Otherwise, the list contains the object's attributes' names, the names of its class's attributes, and recursively of the " +"attributes of its class's base classes." msgstr "" +"در غیر این صورت، فهرست شامل نام ویژگی‌های شیء، نام ویژگی‌های کلاس آن، و همچنین به‌صورت بازگشتی، نام ویژگی‌های کلاس‌های پایهٔ آن " +"خواهد بود." #: ../../library/functions.rst:516 msgid "The resulting list is sorted alphabetically. For example:" -msgstr "" +msgstr "فهرست حاصل به‌ترتیب الفبایی مرتب می‌شود. برای مثال:" #: ../../library/functions.rst:536 msgid "" -"Because :func:`dir` is supplied primarily as a convenience for use at an " -"interactive prompt, it tries to supply an interesting set of names more than " -"it tries to supply a rigorously or consistently defined set of names, and " -"its detailed behavior may change across releases. For example, metaclass " -"attributes are not in the result list when the argument is a class." +"Because :func:`dir` is supplied primarily as a convenience for use at an interactive prompt, it tries to supply an " +"interesting set of names more than it tries to supply a rigorously or consistently defined set of names, and its detailed " +"behavior may change across releases. For example, metaclass attributes are not in the result list when the argument is a " +"class." msgstr "" +"از آنجا که :func:`dir` در درجهٔ اول برای سهولت استفاده در اعلان تعاملی طراحی شده است، بیشتر تلاش می‌کند مجموعه‌ای مفید از " +"نام‌ها را ارائه دهد تا مجموعه‌ای با تعریف دقیق و سازگار. بنابراین، رفتار دقیق آن ممکن است بین نسخه‌های مختلف تغییر کند. برای " +"مثال، اگر آرگومان یک کلاس باشد، ویژگی‌های فراداده در فهرست نتایج قرار نمی‌گیرند." #: ../../library/functions.rst:546 msgid "" -"Take two (non-complex) numbers as arguments and return a pair of numbers " -"consisting of their quotient and remainder when using integer division. " -"With mixed operand types, the rules for binary arithmetic operators apply. " -"For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually " -"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " -"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " -"*b*, and ``0 <= abs(a % b) < abs(b)``." +"Take two (non-complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when " +"using integer division. With mixed operand types, the rules for binary arithmetic operators apply. For integers, the " +"result is the same as ``(a // b, a % b)``. For floating-point numbers the result is ``(q, a % b)``, where *q* is usually " +"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` is very close to *a*, if ``a % b`` is non-" +"zero it has the same sign as *b*, and ``0 <= abs(a % b) < abs(b)``." msgstr "" +"دو عدد (غیرمختلط) را به‌عنوان آرگومان می‌گیرد و جفتی از اعداد شامل خارج‌قسمت و باقیماندهٔ تقسیم صحیح آن‌ها را برمی‌گرداند. در " +"صورت متفاوت بودن نوع عملوندها، قواعد عملگرهای حسابی دودویی اعمال می‌شود. برای اعداد صحیح، نتیجه برابر با ``(a // b, a % b)`` " +"است. برای اعداد ممیز شناور، نتیجه ``(q, a % b)`` است که در آن *q* معمولاً برابر ``math.floor(a / b)`` است، اما ممکن است یک " +"واحد کمتر از آن باشد. در هر صورت، مقدار ``q * b + a % b`` بسیار به *a* نزدیک است، و اگر ``a % b`` صفر نباشد، هم‌علامت با *b* " +"خواهد بود و همچنین ``0 <= abs(a % b) < abs(b)`` برقرار است." #: ../../library/functions.rst:558 msgid "" -"Return an enumerate object. *iterable* must be a sequence, " -"an :term:`iterator`, or some other object which supports iteration. " -"The :meth:`~iterator.__next__` method of the iterator returned " -"by :func:`enumerate` returns a tuple containing a count (from *start* which " -"defaults to 0) and the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, an :term:`iterator`, or some other object which supports " +"iteration. The :meth:`~iterator.__next__` method of the iterator returned by :func:`enumerate` returns a tuple containing a " +"count (from *start* which defaults to 0) and the values obtained from iterating over *iterable*." msgstr "" +"یک شیء enumerate را برمی‌گرداند. *iterable* باید یک دنباله، یک :term:`تکرارگر ` یا هر شیء دیگری باشد که از پیمایش " +"پشتیبانی می‌کند. متد :meth:`~iterator.__next__` تکرارگر بازگردانده‌شده توسط :func:`enumerate`، تاپلی شامل یک شمارنده (که از " +"*start* آغاز می‌شود و مقدار پیش‌فرض آن 0 است) و مقادیر به‌دست‌آمده از پیمایش *iterable* را برمی‌گرداند." #: ../../library/functions.rst:570 msgid "Equivalent to::" -msgstr "" +msgstr "مساوی است با::" #: ../../library/functions.rst:572 msgid "" @@ -1111,207 +1095,231 @@ msgid "" " yield n, elem\n" " n += 1" msgstr "" +"def enumerate(iterable, start=0):\n" +" n = start\n" +" for elem in iterable:\n" +" yield n, elem\n" +" n += 1" #: ../../library/functions.rst:0 msgid "Parameters" -msgstr "" +msgstr "پارامترها" #: ../../library/functions.rst:582 msgid "A Python expression." -msgstr "" +msgstr "یک عبارت پایتون." #: ../../library/functions.rst:586 msgid "The global namespace (default: ``None``)." -msgstr "" +msgstr "فضای نام سراسری (پیش‌فرض: ``None``)." #: ../../library/functions.rst:590 msgid "The local namespace (default: ``None``)." -msgstr "" +msgstr "فضای نام محلی (پیش‌فرض: ``None``)." #: ../../library/functions.rst:0 msgid "Returns" -msgstr "" +msgstr "بازمیگرداند" #: ../../library/functions.rst:594 msgid "The result of the evaluated expression." -msgstr "" +msgstr "نتیجهٔ عبارت ارزیابی‌شده." #: ../../library/functions.rst:0 msgid "raises" -msgstr "" +msgstr "ایجاد می‌کند" #: ../../library/functions.rst:595 msgid "Syntax errors are reported as exceptions." -msgstr "" +msgstr "خطاهای نحوی به‌صورت استثنا گزارش می‌شوند." #: ../../library/functions.rst:599 ../../library/functions.rst:661 msgid "" -"This function executes arbitrary code. Calling it with untrusted user-" -"supplied input will lead to security vulnerabilities." +"This function executes arbitrary code. Calling it with untrusted user-supplied input will lead to security vulnerabilities." msgstr "" +"این تابع کد دلخواه را اجرا می‌کند. فراخوانی آن با ورودیِ تأمین‌شده از سوی کاربر که قابل اعتماد نیست، منجر به آسیب‌پذیری‌های " +"امنیتی خواهد شد." #: ../../library/functions.rst:602 msgid "" -"The *source* argument is parsed and evaluated as a Python expression " -"(technically speaking, a condition list) using the *globals* and *locals* " -"mappings as global and local namespace. If the *globals* dictionary is " -"present and does not contain a value for the key ``__builtins__``, a " -"reference to the dictionary of the built-in module :mod:`builtins` is " -"inserted under that key before *source* is parsed. Overriding " -"``__builtins__`` can be used to restrict or change the available names, but " -"this is **not** a security mechanism: the executed code can still access all " -"builtins. If the *locals* mapping is omitted it defaults to the *globals* " -"dictionary. If both mappings are omitted, the source is executed with the " -"*globals* and *locals* in the environment where :func:`eval` is called. " -"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " -"referenced in the scope that is calling :func:`eval` (e.g. via " -"a :keyword:`nonlocal` statement)." -msgstr "" +"The *source* argument is parsed and evaluated as a Python expression (technically speaking, a condition list) using the " +"*globals* and *locals* mappings as global and local namespace. If the *globals* dictionary is present and does not contain " +"a value for the key ``__builtins__``, a reference to the dictionary of the built-in module :mod:`builtins` is inserted " +"under that key before *source* is parsed. Overriding ``__builtins__`` can be used to restrict or change the available " +"names, but this is **not** a security mechanism: the executed code can still access all builtins. If the *locals* mapping " +"is omitted it defaults to the *globals* dictionary. If both mappings are omitted, the source is executed with the " +"*globals* and *locals* in the environment where :func:`eval` is called. Note, *eval()* will only have access to " +"the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already referenced in the " +"scope that is calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." +msgstr "" +"آرگومان *source* به‌عنوان یک عبارت پایتون (از نظر فنی، یک condition list) با استفاده از نگاشت‌های *globals* و *locals* " +"به‌ترتیب به‌عنوان فضای نام سراسری و محلی، تجزیه و ارزیابی می‌شود. اگر دیکشنری *globals* وجود داشته باشد اما کلید " +"``__builtins__`` را نداشته باشد، پیش از تجزیهٔ *source*، ارجاعی به دیکشنری ماژول داخلی :mod:`builtins` تحت این کلید درج " +"می‌شود. بازنویسی ``__builtins__`` می‌تواند برای محدود کردن یا تغییر نام‌های در دسترس استفاده شود، اما این **یک سازوکار امنیتی " +"نیست**؛ زیرا کد اجراشده همچنان می‌تواند به تمام توابع و اشیای داخلی دسترسی داشته باشد. اگر نگاشت *locals* ارائه نشود، به‌طور " +"پیش‌فرض از دیکشنری *globals* استفاده می‌شود. اگر هر دو نگاشت حذف شوند، *source* با استفاده از *globals* و *locals* محیطی " +"که :func:`eval` در آن فراخوانی شده اجرا می‌شود. توجه داشته باشید که *eval()* تنها در صورتی به :term:`دامنه‌های تو‌در‌تو ` (متغیرهای nonlocal) محیط پیرامون دسترسی خواهد داشت که آن‌ها از قبل در دامنه‌ای که :func:`eval` را فراخوانی می‌کند " +"ارجاع داده شده باشند (برای مثال، از طریق دستور :keyword:`nonlocal`)." #: ../../library/functions.rst:619 msgid "Example:" -msgstr "" +msgstr "مثال:" #: ../../library/functions.rst:625 msgid "" -"This function can also be used to execute arbitrary code objects (such as " -"those created by :func:`compile`). In this case, pass a code object instead " -"of a string. If the code object has been compiled with ``'exec'`` as the " -"*mode* argument, :func:`eval`\\'s return value will be ``None``." +"This function can also be used to execute arbitrary code objects (such as those created by :func:`compile`). In this case, " +"pass a code object instead of a string. If the code object has been compiled with ``'exec'`` as the *mode* " +"argument, :func:`eval`\\'s return value will be ``None``." msgstr "" +"از این تابع همچنین می‌توان برای اجرای اشیای کد دلخواه (مانند اشیایی که توسط :func:`compile` ایجاد شده‌اند) استفاده کرد. در " +"این حالت، به‌جای رشته، یک شیء کد ارسال کنید. اگر شیء کد با آرگومان *mode* برابر ``'exec'`` کامپایل شده باشد، مقدار " +"بازگشتی :func:`eval` برابر ``None`` خواهد بود." #: ../../library/functions.rst:630 msgid "" -"Hints: dynamic execution of statements is supported by the :func:`exec` " -"function. The :func:`globals` and :func:`locals` functions return the " -"current global and local dictionary, respectively, which may be useful to " -"pass around for use by :func:`eval` or :func:`exec`." +"Hints: dynamic execution of statements is supported by the :func:`exec` function. The :func:`globals` and :func:`locals` " +"functions return the current global and local dictionary, respectively, which may be useful to pass around for use " +"by :func:`eval` or :func:`exec`." msgstr "" +"راهنمایی: اجرای پویای دستورها توسط تابع :func:`exec` پشتیبانی می‌شود. توابع :func:`globals` و :func:`locals` به‌ترتیب فرهنگ " +"لغت سراسری و محلی فعلی را برمی‌گردانند که می‌توان آن‌ها را برای استفاده در :func:`eval` یا :func:`exec` به توابع دیگر ارسال " +"کرد." #: ../../library/functions.rst:635 -msgid "" -"If the given source is a string, then leading and trailing spaces and tabs " -"are stripped." -msgstr "" +msgid "If the given source is a string, then leading and trailing spaces and tabs are stripped." +msgstr "اگر کد منبع داده‌شده یک رشته باشد، فاصله‌ها و نویسه‌های تب ابتدا و انتهای آن حذف می‌شوند." #: ../../library/functions.rst:638 -msgid "" -"See :func:`ast.literal_eval` for a function to evaluate strings with " -"expressions containing only literals." +msgid "See :func:`ast.literal_eval` for a function to evaluate strings with expressions containing only literals." msgstr "" +"برای تابعی که رشته‌های حاوی عبارت‌هایی متشکل فقط از مقادیر ثابت را ارزیابی می‌کند، به :func:`ast.literal_eval` مراجعه کنید." -#: ../../library/functions.rst:641 ../../library/functions.rst:643 -#: ../../library/functions.rst:704 ../../library/functions.rst:706 +#: ../../library/functions.rst:641 ../../library/functions.rst:643 ../../library/functions.rst:704 +#: ../../library/functions.rst:706 msgid "" -"Raises an :ref:`auditing event ` ``exec`` with the code object as " -"the argument. Code compilation events may also be raised." +"Raises an :ref:`auditing event ` ``exec`` with the code object as the argument. Code compilation events may also " +"be raised." msgstr "" +"یک :ref:`رویداد ممیزی ` با نام ``exec`` و شیء کد به‌عنوان آرگومان ایجاد می‌کند. رویدادهای مربوط به کامپایل کد نیز " +"ممکن است ایجاد شوند." #: ../../library/functions.rst:648 ../../library/functions.rst:726 msgid "The *globals* and *locals* arguments can now be passed as keywords." -msgstr "" +msgstr "آرگومان‌های *globals* و *locals* اکنون می‌توانند به‌صورت آرگومان کلیدی نیز ارسال شوند." #: ../../library/functions.rst:652 ../../library/functions.rst:730 -msgid "" -"The semantics of the default *locals* namespace have been adjusted as " -"described for the :func:`locals` builtin." -msgstr "" +msgid "The semantics of the default *locals* namespace have been adjusted as described for the :func:`locals` builtin." +msgstr "معنای فضای نام پیش‌فرض *locals* مطابق توضیحات ارائه‌شده برای تابع داخلی :func:`locals` تنظیم شده است." #: ../../library/functions.rst:664 msgid "" -"This function supports dynamic execution of Python code. *source* must be " -"either a string or a code object. If it is a string, the string is parsed " -"as a suite of Python statements which is then executed (unless a syntax " -"error occurs). [#]_ If it is a code object, it is simply executed. In all " -"cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that " -"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " -"may not be used outside of function definitions even within the context of " -"code passed to the :func:`exec` function. The return value is ``None``." +"This function supports dynamic execution of Python code. *source* must be either a string or a code object. If it is a " +"string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). [#]_ If " +"it is a code object, it is simply executed. In all cases, the code that's executed is expected to be valid as file input " +"(see the section :ref:`file-input` in the Reference Manual). Be aware that the :keyword:`nonlocal`, :keyword:`yield`, " +"and :keyword:`return` statements may not be used outside of function definitions even within the context of code passed to " +"the :func:`exec` function. The return value is ``None``." msgstr "" +"این تابع از اجرای پویای کد پایتون پشتیبانی می‌کند. *source* باید یا یک رشته باشد یا یک شیء کد. اگر رشته باشد، به‌عنوان " +"مجموعه‌ای از دستورهای پایتون تجزیه و سپس اجرا می‌شود (مگر اینکه خطای نحوی رخ دهد). [#]_ اگر یک شیء کد باشد، مستقیماً اجرا " +"می‌شود. در همهٔ موارد، انتظار می‌رود کد اجراشده به‌عنوان ورودی فایل معتبر باشد (به بخش :ref:`file-input` در راهنمای مرجع مراجعه " +"کنید). توجه داشته باشید که دستورهای :keyword:`nonlocal`، :keyword:`yield` و :keyword:`return` حتی در کدی که از " +"طریق :func:`exec` اجرا می‌شود نیز خارج از تعریف تابع قابل استفاده نیستند. مقدار بازگشتی ``None`` است." #: ../../library/functions.rst:675 msgid "" -"In all cases, if the optional parts are omitted, the code is executed in the " -"current scope. If only *globals* is provided, it must be a dictionary (and " -"not a subclass of dictionary), which will be used for both the global and " -"the local variables. If *globals* and *locals* are given, they are used for " -"the global and local variables, respectively. If provided, *locals* can be " -"any mapping object. Remember that at the module level, globals and locals " -"are the same dictionary." +"In all cases, if the optional parts are omitted, the code is executed in the current scope. If only *globals* is provided, " +"it must be a dictionary (and not a subclass of dictionary), which will be used for both the global and the local " +"variables. If *globals* and *locals* are given, they are used for the global and local variables, respectively. If " +"provided, *locals* can be any mapping object. Remember that at the module level, globals and locals are the same " +"dictionary." msgstr "" +"در همهٔ حالت‌ها، اگر بخش‌های اختیاری حذف شوند، کد در حوزهٔ فعلی اجرا می‌شود. اگر فقط *globals* ارائه شود، باید یک فرهنگ لغت باشد " +"(و نه یک زیرکلاس از فرهنگ لغت) که هم برای متغیرهای سراسری و هم برای متغیرهای محلی استفاده خواهد شد. اگر هر دو *globals* و " +"*locals* ارائه شوند، به‌ترتیب برای متغیرهای سراسری و محلی استفاده می‌شوند. در صورت ارائه، *locals* می‌تواند هر شیء نگاشتی " +"باشد. به خاطر داشته باشید که در سطح ماژول، globals و locals همان فرهنگ لغت یکسان هستند." #: ../../library/functions.rst:685 msgid "" -"When ``exec`` gets two separate objects as *globals* and *locals*, the code " -"will be executed as if it were embedded in a class definition. This means " -"functions and classes defined in the executed code will not be able to " -"access variables assigned at the top level (as the \"top level\" variables " -"are treated as class variables in a class definition)." +"When ``exec`` gets two separate objects as *globals* and *locals*, the code will be executed as if it were embedded in a " +"class definition. This means functions and classes defined in the executed code will not be able to access variables " +"assigned at the top level (as the \"top level\" variables are treated as class variables in a class definition)." msgstr "" +"وقتی ``exec`` دو شیء جداگانه را به‌عنوان *globals* و *locals* دریافت می‌کند، کد به‌گونه‌ای اجرا می‌شود که گویی درون یک تعریف " +"کلاس قرار دارد. این بدان معناست که توابع و کلاس‌های تعریف‌شده در کد اجراشده نمی‌توانند به متغیرهای اختصاص‌یافته در سطح بالا " +"دسترسی داشته باشند (زیرا متغیرهای «سطح بالا» در تعریف کلاس به‌عنوان متغیرهای کلاس در نظر گرفته می‌شوند)." #: ../../library/functions.rst:691 msgid "" -"If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in " -"module :mod:`builtins` is inserted under that key. Overriding " -"``__builtins__`` can be used to restrict or change the available names, but " -"this is **not** a security mechanism: the executed code can still access all " -"builtins." +"If the *globals* dictionary does not contain a value for the key ``__builtins__``, a reference to the dictionary of the " +"built-in module :mod:`builtins` is inserted under that key. Overriding ``__builtins__`` can be used to restrict or change " +"the available names, but this is **not** a security mechanism: the executed code can still access all builtins." msgstr "" +"اگر فرهنگ لغت *globals* مقداری برای کلید ``__builtins__`` نداشته باشد، ارجاعی به فرهنگ لغت ماژول داخلی :mod:`builtins` با " +"همان کلید در آن درج می‌شود. بازنویسی ``__builtins__`` می‌تواند برای محدود کردن یا تغییر نام‌های در دسترس استفاده شود، اما این " +"**یک سازوکار امنیتی نیست**؛ زیرا کدی که اجرا می‌شود همچنان می‌تواند به تمام اشیای داخلی دسترسی داشته باشد." #: ../../library/functions.rst:698 msgid "" -"The *closure* argument specifies a closure--a tuple of cellvars. It's only " -"valid when the *object* is a code object containing :term:`free (closure) " -"variables `. The length of the tuple must exactly match " -"the length of the code object's :attr:`~codeobject.co_freevars` attribute." +"The *closure* argument specifies a closure--a tuple of cellvars. It's only valid when the *object* is a code object " +"containing :term:`free (closure) variables `. The length of the tuple must exactly match the length of " +"the code object's :attr:`~codeobject.co_freevars` attribute." msgstr "" +"آرگومان *closure* یک closure را مشخص می‌کند؛ یعنی یک تاپل از cellvarها. این آرگومان تنها زمانی معتبر است که *object* یک شیء " +"کد باشد که شامل :term:`متغیرهای آزاد (closure) ` باشد. طول این تاپل باید دقیقاً با طول " +"ویژگی :attr:`~codeobject.co_freevars` شیء کد برابر باشد." #: ../../library/functions.rst:711 msgid "" -"The built-in functions :func:`globals` and :func:`locals` return the current " -"global and local namespace, respectively, which may be useful to pass around " -"for use as the second and third argument to :func:`exec`." +"The built-in functions :func:`globals` and :func:`locals` return the current global and local namespace, respectively, " +"which may be useful to pass around for use as the second and third argument to :func:`exec`." msgstr "" +"توابع داخلی :func:`globals` و :func:`locals` به‌ترتیب فضای نام سراسری و محلی فعلی را برمی‌گردانند که می‌توانند برای ارسال " +"به‌عنوان آرگومان دوم و سوم تابع :func:`exec` مفید باشند." #: ../../library/functions.rst:717 msgid "" -"The default *locals* act as described for function :func:`locals` below. " -"Pass an explicit *locals* dictionary if you need to see effects of the code " -"on *locals* after function :func:`exec` returns." +"The default *locals* act as described for function :func:`locals` below. Pass an explicit *locals* dictionary if you need " +"to see effects of the code on *locals* after function :func:`exec` returns." msgstr "" +"*locals* پیش‌فرض همان‌گونه عمل می‌کند که در ادامه برای تابع :func:`locals` توضیح داده شده است. اگر لازم است پس از بازگشت " +"تابع :func:`exec` تغییرات اعمال‌شده روی *locals* را مشاهده کنید، یک دیکشنری *locals* صریح ارسال کنید." #: ../../library/functions.rst:721 msgid "Added the *closure* parameter." -msgstr "" +msgstr "پارامتر *closure* اضافه شد." #: ../../library/functions.rst:736 msgid "" -"Construct an iterator from those elements of *iterable* for which *function* " -"is true. *iterable* may be either a sequence, a container which supports " -"iteration, or an iterator. If *function* is ``None``, the identity function " -"is assumed, that is, all elements of *iterable* that are false are removed." +"Construct an iterator from those elements of *iterable* for which *function* is true. *iterable* may be either a sequence, " +"a container which supports iteration, or an iterator. If *function* is ``None``, the identity function is assumed, that " +"is, all elements of *iterable* that are false are removed." msgstr "" +"از میان عناصر *iterable*، آن‌هایی را که *function* برایشان مقدار True برمی‌گرداند، انتخاب کرده و یک تکرارگر می‌سازد. " +"*iterable* می‌تواند یک دنباله، یک محفظهٔ قابل پیمایش، یا یک تکرارگر باشد. اگر *function* برابر ``None`` باشد، تابع همانی در " +"نظر گرفته می‌شود؛ یعنی تمام عناصری از *iterable* که نادرست (False) هستند، حذف می‌شوند." #: ../../library/functions.rst:742 msgid "" -"Note that ``filter(function, iterable)`` is equivalent to the generator " -"expression ``(item for item in iterable if function(item))`` if function is " -"not ``None`` and ``(item for item in iterable if item)`` if function is " -"``None``." +"Note that ``filter(function, iterable)`` is equivalent to the generator expression ``(item for item in iterable if " +"function(item))`` if function is not ``None`` and ``(item for item in iterable if item)`` if function is ``None``." msgstr "" +"توجه داشته باشید که اگر *function* برابر ``None`` نباشد، ``filter(function, iterable)`` معادل عبارت مولد ``(item for item " +"in iterable if function(item))`` است، و اگر *function* برابر ``None`` باشد، معادل ``(item for item in iterable if item)`` " +"خواهد بود." #: ../../library/functions.rst:747 msgid "" -"See :func:`itertools.filterfalse` for the complementary function that " -"returns elements of *iterable* for which *function* is false." +"See :func:`itertools.filterfalse` for the complementary function that returns elements of *iterable* for which *function* " +"is false." msgstr "" +"برای تابع مکملی که عناصر *iterable* را که *function* برای آن‌ها مقدار نادرست (false) برمی‌گرداند، بازمی‌گرداند، " +"به :func:`itertools.filterfalse` مراجعه کنید." #: ../../library/functions.rst:758 msgid "Return a floating-point number constructed from a number or a string." -msgstr "" +msgstr "یک عدد ممیز شناور که از یک عدد یا یک رشته ساخته شده است را برمی‌گرداند." #: ../../library/functions.rst:762 msgid "" @@ -1326,235 +1334,257 @@ msgid "" ">>> float('-Infinity')\n" "-inf" msgstr "" +">>> float('+1.23')\n" +"1.23\n" +">>> float(' -12345\\n')\n" +"-12345.0\n" +">>> float('1e-003')\n" +"0.001\n" +">>> float('+1E6')\n" +"1000000.0\n" +">>> float('-Infinity')\n" +"-inf" #: ../../library/functions.rst:775 msgid "" -"If the argument is a string, it should contain a decimal number, optionally " -"preceded by a sign, and optionally embedded in whitespace. The optional " -"sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value " -"produced. The argument may also be a string representing a NaN (not-a-" -"number), or positive or negative infinity. More precisely, the input must " -"conform to the :token:`~float:floatvalue` production rule in the following " -"grammar, after leading and trailing whitespace characters are removed:" +"If the argument is a string, it should contain a decimal number, optionally preceded by a sign, and optionally embedded in " +"whitespace. The optional sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value produced. The argument " +"may also be a string representing a NaN (not-a-number), or positive or negative infinity. More precisely, the input must " +"conform to the :token:`~float:floatvalue` production rule in the following grammar, after leading and trailing whitespace " +"characters are removed:" msgstr "" +"اگر آرگومان یک رشته باشد، باید شامل یک عدد ده‌دهی باشد که به‌صورت اختیاری با یک علامت و همچنین با فاصلهٔ سفید احاطه شده باشد. " +"علامت اختیاری می‌تواند ``'+'`` یا ``'-'`` باشد؛ علامت ``'+'`` تأثیری بر مقدار تولیدشده ندارد. آرگومان همچنین می‌تواند رشته‌ای " +"باشد که یک NaN (عدد نیست) یا بی‌نهایت مثبت یا منفی را نمایش می‌دهد. به‌طور دقیق‌تر، پس از حذف نویسه‌های فاصلهٔ سفید ابتدا و " +"انتهای رشته، ورودی باید با قاعدهٔ تولید :token:`~float:floatvalue` در دستور زبان زیر مطابقت داشته باشد:" #: ../../library/functions.rst:796 msgid "" -"Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " -"and \"iNfINity\" are all acceptable spellings for positive infinity." +"Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", and \"iNfINity\" are all acceptable spellings for " +"positive infinity." msgstr "" +"بزرگی و کوچکی حروف (case) اهمیتی ندارد؛ بنابراین، برای مثال، «inf»، «Inf»، «INFINITY» و «iNfINity» همگی برای نمایش بی‌نهایت " +"مثبت معتبر هستند." #: ../../library/functions.rst:799 msgid "" -"Otherwise, if the argument is an integer or a floating-point number, a " -"floating-point number with the same value (within Python's floating-point " -"precision) is returned. If the argument is outside the range of a Python " -"float, an :exc:`OverflowError` will be raised." +"Otherwise, if the argument is an integer or a floating-point number, a floating-point number with the same value (within " +"Python's floating-point precision) is returned. If the argument is outside the range of a Python float, " +"an :exc:`OverflowError` will be raised." msgstr "" +"در غیر این صورت، اگر آرگومان یک عدد صحیح یا یک عدد ممیز شناور باشد، یک عدد ممیز شناور با همان مقدار (در محدودهٔ دقت اعداد " +"ممیز شناور پایتون) برگردانده می‌شود. اگر آرگومان خارج از محدودهٔ یک عدد ممیز شناور در پایتون باشد، " +"استثنای :exc:`OverflowError` ایجاد خواهد شد." #: ../../library/functions.rst:804 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to " -"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " -"falls back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to ``x.__float__()``. If :meth:`~object.__float__` is not " +"defined then it falls back to :meth:`~object.__index__`." msgstr "" +"برای یک شیء عمومی پایتون به نام ``x``، تابع ``float(x)`` فراخوانی را به ``x.__float__()`` واگذار می‌کند. " +"اگر :meth:`~object.__float__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." #: ../../library/functions.rst:808 -msgid "" -"See also :meth:`float.from_number` which only accepts a numeric argument." -msgstr "" +msgid "See also :meth:`float.from_number` which only accepts a numeric argument." +msgstr "همچنین به :meth:`float.from_number` مراجعه کنید که فقط یک آرگومان عددی را می‌پذیرد." #: ../../library/functions.rst:810 msgid "If no argument is given, ``0.0`` is returned." -msgstr "" +msgstr "اگر هیچ آرگومانی ارائه نشود، مقدار ``0.0`` برگردانده می‌شود." #: ../../library/functions.rst:812 msgid "The float type is described in :ref:`typesnumeric`." -msgstr "" +msgstr "نوع ممیز شناور در :ref:`typesnumeric` توضیح داده شده است." #: ../../library/functions.rst:820 -msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " -"defined." -msgstr "" +msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not defined." +msgstr "اگر :meth:`~object.__float__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." #: ../../library/functions.rst:830 msgid "" -"Convert a *value* to a \"formatted\" representation, as controlled by " -"*format_spec*. The interpretation of *format_spec* will depend on the type " -"of the *value* argument; however, there is a standard formatting syntax that " -"is used by most built-in types: :ref:`formatspec`." +"Convert a *value* to a \"formatted\" representation, as controlled by *format_spec*. The interpretation of *format_spec* " +"will depend on the type of the *value* argument; however, there is a standard formatting syntax that is used by most built-" +"in types: :ref:`formatspec`." msgstr "" +"*value* را مطابق با *format_spec* به یک نمایش قالب‌بندی‌شده تبدیل می‌کند. نحوهٔ تفسیر *format_spec* به نوع آرگومان *value* " +"بستگی دارد؛ با این حال، یک نحو استاندارد برای قالب‌بندی وجود دارد که بیشتر انواع داخلی از آن استفاده " +"می‌کنند: :ref:`formatspec`." #: ../../library/functions.rst:835 -msgid "" -"The default *format_spec* is an empty string which usually gives the same " -"effect as calling :func:`str(value) `." +msgid "The default *format_spec* is an empty string which usually gives the same effect as calling :func:`str(value) `." msgstr "" +"مقدار پیش‌فرض *format_spec* یک رشتهٔ خالی است که معمولاً همان اثری را دارد که فراخوانی :func:`str(value) ` ایجاد می‌کند." #: ../../library/functions.rst:838 msgid "" -"A call to ``format(value, format_spec)`` is translated to " -"``type(value).__format__(value, format_spec)`` which bypasses the instance " -"dictionary when searching for the value's :meth:`~object.__format__` method. " -"A :exc:`TypeError` exception is raised if the method search " -"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " -"*format_spec* or the return value are not strings." +"A call to ``format(value, format_spec)`` is translated to ``type(value).__format__(value, format_spec)`` which bypasses the " +"instance dictionary when searching for the value's :meth:`~object.__format__` method. A :exc:`TypeError` exception is " +"raised if the method search reaches :mod:`object` and the *format_spec* is non-empty, or if either the *format_spec* or the " +"return value are not strings." msgstr "" +"فراخوانی ``format(value, format_spec)`` به ``type(value).__format__(value, format_spec)`` تبدیل می‌شود که هنگام جستجوی " +"متد :meth:`~object.__format__` مربوط به *value*، فرهنگ لغت نمونه را نادیده می‌گیرد. اگر جستجوی متد به :mod:`object` برسد و " +"*format_spec* خالی نباشد، یا اگر *format_spec* یا مقدار بازگشتی رشته نباشند، استثنای :exc:`TypeError` ایجاد می‌شود." #: ../../library/functions.rst:845 -msgid "" -"``object().__format__(format_spec)`` raises :exc:`TypeError` if " -"*format_spec* is not an empty string." -msgstr "" +msgid "``object().__format__(format_spec)`` raises :exc:`TypeError` if *format_spec* is not an empty string." +msgstr "اگر *format_spec* یک رشتهٔ خالی نباشد، ``object().__format__(format_spec)`` استثنای :exc:`TypeError` ایجاد می‌کند." #: ../../library/functions.rst:854 msgid "" -"Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " -"and :ref:`types-set` for documentation about this class." +"Return a new :class:`frozenset` object, optionally with elements taken from *iterable*. ``frozenset`` is a built-in " +"class. See :class:`frozenset` and :ref:`types-set` for documentation about this class." msgstr "" +"یک شیء جدید از نوع :class:`frozenset` را برمی‌گرداند که در صورت ارائه، عناصر آن از *iterable* گرفته می‌شوند. ``frozenset`` یک " +"کلاس داخلی است. برای مستندات این کلاس، به :class:`frozenset` و :ref:`types-set` مراجعه کنید." #: ../../library/functions.rst:858 msgid "" -"For other containers see the built-" -"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " -"as well as the :mod:`collections` module." +"For other containers see the built-in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, as well as " +"the :mod:`collections` module." msgstr "" +"برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`set`، :class:`list`، :class:`tuple` و :class:`dict`، و همچنین " +"ماژول :mod:`collections` مراجعه کنید." #: ../../library/functions.rst:866 msgid "" -"Return the value of the named attribute of *object*. *name* must be a " -"string. If the string is the name of one of the object's attributes, the " -"result is the value of that attribute. For example, ``getattr(x, " -"'foobar')`` is equivalent to ``x.foobar``. If the named attribute does not " -"exist, *default* is returned if provided, otherwise :exc:`AttributeError` is " +"Return the value of the named attribute of *object*. *name* must be a string. If the string is the name of one of the " +"object's attributes, the result is the value of that attribute. For example, ``getattr(x, 'foobar')`` is equivalent to " +"``x.foobar``. If the named attribute does not exist, *default* is returned if provided, otherwise :exc:`AttributeError` is " "raised. *name* need not be a Python identifier (see :func:`setattr`)." msgstr "" +"مقدار ویژگیِ نام‌گذاری‌شدهٔ *object* را برمی‌گرداند. *name* باید یک رشته باشد. اگر رشته، نام یکی از ویژگی‌های شیء باشد، نتیجه " +"مقدار آن ویژگی خواهد بود. برای مثال، ``getattr(x, 'foobar')`` معادل ``x.foobar`` است. اگر ویژگیِ نام‌گذاری‌شده وجود نداشته " +"باشد، در صورت ارائه، *default* برگردانده می‌شود؛ در غیر این صورت، استثنای :exc:`AttributeError` ایجاد می‌شود. لازم نیست " +"*name* یک شناسهٔ معتبر پایتون باشد (به :func:`setattr` مراجعه کنید)." #: ../../library/functions.rst:875 msgid "" -"Since :ref:`private name mangling ` happens at " -"compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it " -"with :func:`getattr`." +"Since :ref:`private name mangling ` happens at compilation time, one must manually mangle a private " +"attribute's (attributes with two leading underscores) name in order to retrieve it with :func:`getattr`." msgstr "" +"از آنجا که :ref:`تغییر نام خصوصی ` در زمان کامپایل انجام می‌شود، برای بازیابی یک ویژگی خصوصی " +"(ویژگی‌هایی که با دو زیرخط آغاز می‌شوند) با استفاده از :func:`getattr`، باید نام آن را به‌صورت دستی تغییر دهید." #: ../../library/functions.rst:883 msgid "" -"Return the dictionary implementing the current module namespace. For code " -"within functions, this is set when the function is defined and remains the " -"same regardless of where the function is called." +"Return the dictionary implementing the current module namespace. For code within functions, this is set when the function " +"is defined and remains the same regardless of where the function is called." msgstr "" +"فرهنگ لغتی را که فضای نام ماژول فعلی را پیاده‌سازی می‌کند، برمی‌گرداند. برای کدهای داخل توابع، این مقدار هنگام تعریف تابع " +"تنظیم می‌شود و بدون توجه به این‌که تابع از کجا فراخوانی شود، ثابت باقی می‌ماند." #: ../../library/functions.rst:890 msgid "" -"The arguments are an object and a string. The result is ``True`` if the " -"string is the name of one of the object's attributes, ``False`` if not. " -"(This is implemented by calling ``getattr(object, name)`` and seeing whether " -"it raises an :exc:`AttributeError` or not.)" +"The arguments are an object and a string. The result is ``True`` if the string is the name of one of the object's " +"attributes, ``False`` if not. (This is implemented by calling ``getattr(object, name)`` and seeing whether it raises " +"an :exc:`AttributeError` or not.)" msgstr "" +"آرگومان‌ها شامل یک شیء و یک رشته هستند. اگر رشته نام یکی از ویژگی‌های آن شیء باشد، نتیجه ``True`` و در غیر این صورت ``False`` " +"خواهد بود. (این کار با فراخوانی ``getattr(object, name)`` و بررسی اینکه آیا استثنای :exc:`AttributeError` ایجاد می‌شود یا " +"نه، پیاده‌سازی شده است.)" #: ../../library/functions.rst:898 msgid "" -"Return the hash value of the object (if it has one). Hash values are " -"integers. They are used to quickly compare dictionary keys during a " -"dictionary lookup. Numeric values that compare equal have the same hash " -"value (even if they are of different types, as is the case for 1 and 1.0)." +"Return the hash value of the object (if it has one). Hash values are integers. They are used to quickly compare " +"dictionary keys during a dictionary lookup. Numeric values that compare equal have the same hash value (even if they are " +"of different types, as is the case for 1 and 1.0)." msgstr "" +"مقدار هش شیء را (در صورتی که داشته باشد) برمی‌گرداند. مقادیر هش اعداد صحیح هستند. از آن‌ها برای مقایسهٔ سریع کلیدهای فرهنگ لغت " +"هنگام جستجو در فرهنگ لغت استفاده می‌شود. مقادیر عددی که با یکدیگر برابر مقایسه می‌شوند، مقدار هش یکسانی دارند (حتی اگر از " +"نوع‌های متفاوتی باشند، مانند 1 و 1.0)." #: ../../library/functions.rst:905 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note " -"that :func:`hash` truncates the return value based on the bit width of the " -"host machine." +"For objects with custom :meth:`~object.__hash__` methods, note that :func:`hash` truncates the return value based on the " +"bit width of the host machine." msgstr "" +"برای اشیایی که متد :meth:`~object.__hash__` سفارشی دارند، توجه داشته باشید که :func:`hash` مقدار بازگشتی را بر اساس پهنای " +"بیت ماشین میزبان کوتاه می‌کند." #: ../../library/functions.rst:912 msgid "" -"Invoke the built-in help system. (This function is intended for interactive " -"use.) If no argument is given, the interactive help system starts on the " -"interpreter console. If the argument is a string, then the string is looked " -"up as the name of a module, function, class, method, keyword, or " -"documentation topic, and a help page is printed on the console. If the " -"argument is any other kind of object, a help page on the object is generated." +"Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the " +"interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as " +"the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. " +"If the argument is any other kind of object, a help page on the object is generated." msgstr "" +"سامانهٔ راهنمای داخلی را فراخوانی می‌کند. (این تابع برای استفادهٔ تعاملی طراحی شده است.) اگر هیچ آرگومانی ارائه نشود، سامانهٔ " +"راهنمای تعاملی در کنسول مفسر آغاز می‌شود. اگر آرگومان یک رشته باشد، آن رشته به‌عنوان نام یک ماژول، تابع، کلاس، متد، کلیدواژه " +"یا موضوع مستندات جستجو می‌شود و صفحهٔ راهنمای آن در کنسول نمایش داده می‌شود. اگر آرگومان هر نوع شیء دیگری باشد، صفحهٔ راهنمای " +"مربوط به آن شیء تولید می‌شود." #: ../../library/functions.rst:919 msgid "" -"Note that if a slash(/) appears in the parameter list of a function when " -"invoking :func:`help`, it means that the parameters prior to the slash are " -"positional-only. For more info, see :ref:`the FAQ entry on positional-only " -"parameters `." +"Note that if a slash(/) appears in the parameter list of a function when invoking :func:`help`, it means that the " +"parameters prior to the slash are positional-only. For more info, see :ref:`the FAQ entry on positional-only parameters " +"`." msgstr "" +"توجه داشته باشید که اگر هنگام فراخوانی :func:`help` یک اسلش (/) در فهرست پارامترهای یک تابع ظاهر شود، به این معناست که " +"پارامترهای قبل از اسلش فقط به‌صورت مکانی قابل ارسال هستند. برای اطلاعات بیشتر، به :ref:`پرسش متداول مربوط به پارامترهای فقط " +"مکانی ` مراجعه کنید." #: ../../library/functions.rst:924 -msgid "" -"This function is added to the built-in namespace by the :mod:`site` module." -msgstr "" +msgid "This function is added to the built-in namespace by the :mod:`site` module." +msgstr "این تابع توسط ماژول :mod:`site` به فضای نام داخلی (built-in namespace) اضافه می‌شود." #: ../../library/functions.rst:926 msgid "" -"Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " -"for callables are now more comprehensive and consistent." +"Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures for callables are now more comprehensive and " +"consistent." msgstr "" +"تغییرات اعمال‌شده در :mod:`pydoc` و :mod:`inspect` باعث شده‌اند امضاهای گزارش‌شده برای اشیای فراخوانی‌پذیر اکنون کامل‌تر و " +"سازگارتر باشند." #: ../../library/functions.rst:933 -#, fuzzy msgid "" -"Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *integer* is not a Python :class:`int` object, it has to define " -"an :meth:`~object.__index__` method that returns an integer. Some examples:" +"Convert an integer number to a lowercase hexadecimal string prefixed with \"0x\". If *integer* is not a Python :class:`int` " +"object, it has to define an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" -"تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک " -"عبارت معتبر پایتون خواهد بود. اگر *x* یک شیء پایتون :class:`int` نباشد، لازم " -"است یک روش(متد) :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. " -"برخی مثال ها:" +"بدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک عبارت معتبر پایتون خواهد بود. اگر *integer* یک شیء " +"پایتون :class:`int` نباشد، لازم است یک روش(متد) :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. برخی مثال ها:" #: ../../library/functions.rst:942 msgid "" -"If you want to convert an integer number to an uppercase or lower " -"hexadecimal string with prefix or not, you can use either of the following " -"ways:" +"If you want to convert an integer number to an uppercase or lower hexadecimal string with prefix or not, you can use either " +"of the following ways:" msgstr "" +"اگر می‌خواهید یک عدد صحیح را به یک رشتهٔ شانزده‌شانزدهی با حروف بزرگ یا کوچک، با پیشوند یا بدون آن، تبدیل کنید، می‌توانید از هر " +"یک از روش‌های زیر استفاده کنید:" #: ../../library/functions.rst:954 -msgid "" -"See also :func:`int` for converting a hexadecimal string to an integer using " -"a base of 16." -msgstr "" +msgid "See also :func:`int` for converting a hexadecimal string to an integer using a base of 16." +msgstr "همچنین برای تبدیل یک رشتهٔ شانزده‌شانزدهی به یک عدد صحیح با استفاده از مبنای 16، به :func:`int` مراجعه کنید." #: ../../library/functions.rst:959 -msgid "" -"To obtain a hexadecimal string representation for a float, use " -"the :meth:`float.hex` method." -msgstr "" +msgid "To obtain a hexadecimal string representation for a float, use the :meth:`float.hex` method." +msgstr "برای به‌دست‌آوردن نمایش شانزدهی یک عدد ممیز شناور، از متد :meth:`float.hex` استفاده کنید." #: ../../library/functions.rst:965 msgid "" -"Return the \"identity\" of an object. This is an integer which is " -"guaranteed to be unique and constant for this object during its lifetime. " -"Two objects with non-overlapping lifetimes may have the same :func:`id` " -"value." +"Return the \"identity\" of an object. This is an integer which is guaranteed to be unique and constant for this object " +"during its lifetime. Two objects with non-overlapping lifetimes may have the same :func:`id` value." msgstr "" +"«شناسه» یک شیء را برمی‌گرداند. این مقدار یک عدد صحیح است که در طول عمر آن شیء، یکتا و ثابت بودنش تضمین شده است. دو شیء که " +"طول عمر آن‌ها با یکدیگر هم‌پوشانی ندارد، ممکن است مقدار یکسانی از :func:`id` داشته باشند." #: ../../library/functions.rst:970 msgid "This is the address of the object in memory." -msgstr "" +msgstr "این، آدرس شیء در حافظه است." #: ../../library/functions.rst:972 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.id`` with argument " -"``id``." -msgstr "" +msgid "Raises an :ref:`auditing event ` ``builtins.id`` with argument ``id``." +msgstr "یک :ref:`رویداد ممیزی ` با نام ``builtins.id`` و آرگومان ``id`` ایجاد می‌کند." #: ../../library/functions.rst:978 msgid "" -"If the *prompt* argument is present, it is written to standard output " -"without a trailing newline. The function then reads a line from input, " -"converts it to a string (stripping a trailing newline), and returns that. " -"When EOF is read, :exc:`EOFError` is raised. Example::" +"If the *prompt* argument is present, it is written to standard output without a trailing newline. The function then reads " +"a line from input, converts it to a string (stripping a trailing newline), and returns that. When EOF is " +"read, :exc:`EOFError` is raised. Example::" msgstr "" +"اگر آرگومان *prompt* ارائه شود، بدون افزودن نویسهٔ پایان خط در خروجی استاندارد نوشته می‌شود. سپس تابع یک خط از ورودی می‌خواند، " +"آن را به یک رشته تبدیل می‌کند (با حذف نویسهٔ پایان خط انتهایی) و همان را برمی‌گرداند. اگر به انتهای فایل (EOF) برسد، " +"استثنای :exc:`EOFError` ایجاد می‌شود. مثال::" #: ../../library/functions.rst:983 msgid "" @@ -1563,30 +1593,34 @@ msgid "" ">>> s\n" "\"Monty Python's Flying Circus\"" msgstr "" +">>> s = input('--> ')\n" +"--> Monty Python's Flying Circus\n" +">>> s\n" +"\"Monty Python's Flying Circus\"" #: ../../library/functions.rst:988 msgid "" -"If the :mod:`readline` module was loaded, then :func:`input` will use it to " -"provide elaborate line editing and history features." +"If the :mod:`readline` module was loaded, then :func:`input` will use it to provide elaborate line editing and history " +"features." msgstr "" +"اگر ماژول :mod:`readline` بارگذاری شده باشد، :func:`input` از آن برای فراهم کردن امکانات پیشرفتهٔ ویرایش خط و تاریخچهٔ ورودی " +"استفاده می‌کند." #: ../../library/functions.rst:991 ../../library/functions.rst:993 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.input`` with argument " -"``prompt`` before reading input" -msgstr "" +msgid "Raises an :ref:`auditing event ` ``builtins.input`` with argument ``prompt`` before reading input" +msgstr "پیش از خواندن ورودی، یک :ref:`رویداد ممیزی ` با نام ``builtins.input`` و آرگومان ``prompt`` ایجاد می‌کند" #: ../../library/functions.rst:996 ../../library/functions.rst:998 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.input/result`` with " -"the result after successfully reading input." +msgid "Raises an :ref:`auditing event ` ``builtins.input/result`` with the result after successfully reading input." msgstr "" +"پس از خواندن موفقیت‌آمیز ورودی، یک :ref:`رویداد ممیزی ` با نام ``builtins.input/result`` و نتیجهٔ خوانده‌شده ایجاد " +"می‌کند." #: ../../library/functions.rst:1005 -msgid "" -"Return an integer object constructed from a number or a string, or return " -"``0`` if no arguments are given." +msgid "Return an integer object constructed from a number or a string, or return ``0`` if no arguments are given." msgstr "" +"یک شیء عدد صحیح را که از یک عدد یا یک رشته ساخته شده است برمی‌گرداند، یا اگر هیچ آرگومانی داده نشده باشد، مقدار ``0`` را " +"برمی‌گرداند." #: ../../library/functions.rst:1010 msgid "" @@ -1603,129 +1637,155 @@ msgid "" ">>> int('01110011', base=2)\n" "115" msgstr "" +">>> int(123.45)\n" +"123\n" +">>> int('123')\n" +"123\n" +">>> int(' -12_345\\n')\n" +"-12345\n" +">>> int('FACE', 16)\n" +"64206\n" +">>> int('0xface', 0)\n" +"64206\n" +">>> int('01110011', base=2)\n" +"115" #: ../../library/functions.rst:1025 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " -"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " -"returns ``x.__index__()``. For floating-point numbers, this truncates " -"towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x.__int__()``. If the argument " +"defines :meth:`~object.__index__`, it returns ``x.__index__()``. For floating-point numbers, this truncates towards zero." msgstr "" +"اگر آرگومان متد :meth:`~object.__int__` را تعریف کرده باشد، ``int(x)`` مقدار ``x.__int__()`` را برمی‌گرداند. اگر آرگومان " +"متد :meth:`~object.__index__` را تعریف کرده باشد، مقدار ``x.__index__()`` برگردانده می‌شود. برای اعداد ممیز شناور، این تبدیل " +"بخش اعشاری را در جهت صفر حذف می‌کند." #: ../../library/functions.rst:1030 msgid "" -"If the argument is not a number or if *base* is given, then it must be a " -"string, :class:`bytes`, or :class:`bytearray` instance representing an " -"integer in radix *base*. Optionally, the string can be preceded by ``+`` or " -"``-`` (with no space in between), have leading zeros, be surrounded by " -"whitespace, and have single underscores interspersed between digits." +"If the argument is not a number or if *base* is given, then it must be a string, :class:`bytes`, or :class:`bytearray` " +"instance representing an integer in radix *base*. Optionally, the string can be preceded by ``+`` or ``-`` (with no space " +"in between), have leading zeros, be surrounded by whitespace, and have single underscores interspersed between digits." msgstr "" +"اگر آرگومان یک عدد نباشد یا *base* مشخص شده باشد، باید نمونه‌ای از :class:`bytes` یا :class:`bytearray` باشد " +"که یک عدد صحیح در مبنای *base* را نمایش می‌دهد. به‌صورت اختیاری، رشته می‌تواند با ``+`` یا ``-`` (بدون فاصله بین آن‌ها و عدد) " +"آغاز شود، دارای صفرهای ابتدایی باشد، با فاصلهٔ سفید احاطه شده باشد و بین رقم‌های آن زیرخط‌های تکی قرار گرفته باشند." #: ../../library/functions.rst:1036 msgid "" -"A base-n integer string contains digits, each representing a value from 0 to " -"n-1. The values 0--9 can be represented by any Unicode decimal digit. The " -"values 10--35 can be represented by ``a`` to ``z`` (or ``A`` to ``Z``). The " -"default *base* is 10. The allowed bases are 0 and 2--36. Base-2, -8, and -16 " -"strings can be optionally prefixed with ``0b``/``0B``, ``0o``/``0O``, or " -"``0x``/``0X``, as with integer literals in code. For base 0, the string is " -"interpreted in a similar way to an :ref:`integer literal in code " -"`, in that the actual base is 2, 8, 10, or 16 as determined by the " -"prefix. Base 0 also disallows leading zeros: ``int('010', 0)`` is not legal, " -"while ``int('010')`` and ``int('010', 8)`` are." -msgstr "" +"A base-n integer string contains digits, each representing a value from 0 to n-1. The values 0--9 can be represented by any " +"Unicode decimal digit. The values 10--35 can be represented by ``a`` to ``z`` (or ``A`` to ``Z``). The default *base* is " +"10. The allowed bases are 0 and 2--36. Base-2, -8, and -16 strings can be optionally prefixed with ``0b``/``0B``, ``0o``/" +"``0O``, or ``0x``/``0X``, as with integer literals in code. For base 0, the string is interpreted in a similar way to " +"an :ref:`integer literal in code `, in that the actual base is 2, 8, 10, or 16 as determined by the prefix. Base " +"0 also disallows leading zeros: ``int('010', 0)`` is not legal, while ``int('010')`` and ``int('010', 8)`` are." +msgstr "" +"یک رشتهٔ عدد صحیح در مبنای n شامل رقم‌هایی است که هر یک مقداری بین 0 تا n-1 را نمایش می‌دهند. مقادیر 0 تا 9 را می‌توان با هر " +"رقم ده‌دهی یونیکد نمایش داد. مقادیر 10 تا 35 را می‌توان با نویسه‌های ``a`` تا ``z`` (یا ``A`` تا ``Z``) نمایش داد. مقدار " +"پیش‌فرض *base* برابر 10 است. مبناهای مجاز عبارت‌اند از 0 و 2 تا 36. رشته‌های مبنای 2، 8 و 16 می‌توانند، همانند ثابت‌های عدد صحیح " +"در کد، به‌ترتیب با پیشوندهای ``0b``/``0B``، ``0o``/``0O`` یا ``0x``/``0X`` آغاز شوند. برای مبنای 0، رشته مشابه یک :ref:`ثابت " +"عدد صحیح در کد ` تفسیر می‌شود؛ یعنی مبنای واقعی بر اساس پیشوند، یکی از 2، 8، 10 یا 16 خواهد بود. همچنین در مبنای 0 " +"استفاده از صفرهای ابتدایی مجاز نیست؛ بنابراین ``int('010', 0)`` معتبر نیست، در حالی که ``int('010')`` و ``int('010', 8)`` " +"معتبر هستند." #: ../../library/functions.rst:1047 msgid "The integer type is described in :ref:`typesnumeric`." -msgstr "" +msgstr "نوع عدد صحیح (integer) در :ref:`typesnumeric` توضیح داده شده است." #: ../../library/functions.rst:1049 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has " -"a :meth:`base.__index__ ` method, that method is called to " -"obtain an integer for the base. Previous versions used :meth:`base.__int__ " -"` instead of :meth:`base.__index__ `." +"If *base* is not an instance of :class:`int` and the *base* object has a :meth:`base.__index__ ` method, " +"that method is called to obtain an integer for the base. Previous versions used :meth:`base.__int__ ` " +"instead of :meth:`base.__index__ `." msgstr "" +"اگر *base* نمونه‌ای از :class:`int` نباشد و شیء *base* متد :meth:`base.__index__ ` را تعریف کرده باشد، آن " +"متد برای به‌دست آوردن یک عدد صحیح به‌عنوان مبنا فراخوانی می‌شود. در نسخه‌های پیشین، به‌جای :meth:`base.__index__ " +"` از :meth:`base.__int__ ` استفاده می‌شد." #: ../../library/functions.rst:1059 msgid "The first parameter is now positional-only." -msgstr "" +msgstr "پارامتر اول اکنون فقط به‌صورت موقعیتی قابل ارسال است." #: ../../library/functions.rst:1062 -msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " -"defined." -msgstr "" +msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not defined." +msgstr "اگر :meth:`~object.__int__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." #: ../../library/functions.rst:1065 msgid "" -":class:`int` string inputs and string representations can be limited to help " -"avoid denial of service attacks. A :exc:`ValueError` is raised when the " -"limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See " -"the :ref:`integer string conversion length limitation ` " -"documentation." +":class:`int` string inputs and string representations can be limited to help avoid denial of service attacks. " +"A :exc:`ValueError` is raised when the limit is exceeded while converting a string to an :class:`int` or when converting " +"an :class:`int` into a string would exceed the limit. See the :ref:`integer string conversion length limitation " +"` documentation." msgstr "" +"ورودی‌های رشته‌ای :class:`int` و نمایش‌های رشته‌ای آن را می‌توان برای کمک به جلوگیری از حملات منع سرویس (Denial of Service) " +"محدود کرد. اگر هنگام تبدیل یک رشته به :class:`int` از این محدودیت فراتر رود، یا تبدیل یک :class:`int` به رشته باعث عبور از " +"این محدودیت شود، استثنای :exc:`ValueError` ایجاد می‌شود. برای اطلاعات بیشتر، مستندات :ref:`محدودیت طول تبدیل رشته‌ای اعداد " +"صحیح ` را ببینید." #: ../../library/functions.rst:1073 -msgid "" -":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." -msgstr "" +msgid ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." +msgstr ":func:`int` دیگر فراخوانی را به متد :meth:`~object.__trunc__` واگذار نمی‌کند." #: ../../library/functions.rst:1078 msgid "" -"Return ``True`` if the *object* argument is an instance of the *classinfo* " -"argument, or of a (direct, indirect, or :term:`virtual `) subclass thereof. If *object* is not an object of the given type, " -"the function always returns ``False``. If *classinfo* is a tuple of type " -"objects (or recursively, other such tuples) or a :ref:`types-union` of " -"multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, " -"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " -"for an invalid type if an earlier check succeeds." +"Return ``True`` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, " +"or :term:`virtual `) subclass thereof. If *object* is not an object of the given type, the function " +"always returns ``False``. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a :ref:`types-" +"union` of multiple types, return ``True`` if *object* is an instance of any of the types. If *classinfo* is not a type or " +"tuple of types and such tuples, a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for an invalid " +"type if an earlier check succeeds." msgstr "" +"اگر آرگومان *object* نمونه‌ای از *classinfo* یا از یکی از زیرکلاس‌های آن (مستقیم، غیرمستقیم یا :term:`مجازی `) باشد، مقدار ``True`` را برمی‌گرداند. اگر *object* از نوع داده‌شده نباشد، این تابع همیشه ``False`` برمی‌گرداند. اگر " +"*classinfo* یک تاپل از نوع‌ها (یا به‌صورت بازگشتی، تاپل‌هایی از این نوع) یا یک :ref:`types-union` از چندین نوع باشد، در صورتی " +"که *object* نمونه‌ای از هر یک از آن نوع‌ها باشد، مقدار ``True`` برگردانده می‌شود. اگر *classinfo* یک نوع، یا تاپلی از نوع‌ها و " +"تاپل‌های مشابه نباشد، استثنای :exc:`TypeError` ایجاد می‌شود. با این حال، اگر یک بررسیِ زودتر با موفقیت انجام شود، ممکن است " +"برای یک نوع نامعتبر استثنای :exc:`TypeError` ایجاد نشود." #: ../../library/functions.rst:1089 ../../library/functions.rst:1103 msgid "*classinfo* can be a :ref:`types-union`." -msgstr "" +msgstr "*classinfo* می‌تواند یک :ref:`types-union` باشد." #: ../../library/functions.rst:1095 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, " -"or :term:`virtual `) of *classinfo*. A class is " -"considered a subclass of itself. *classinfo* may be a tuple of class objects " -"(or recursively, other such tuples) or a :ref:`types-union`, in which case " -"return ``True`` if *class* is a subclass of any entry in *classinfo*. In " -"any other case, a :exc:`TypeError` exception is raised." +"Return ``True`` if *class* is a subclass (direct, indirect, or :term:`virtual `) of *classinfo*. A " +"class is considered a subclass of itself. *classinfo* may be a tuple of class objects (or recursively, other such tuples) " +"or a :ref:`types-union`, in which case return ``True`` if *class* is a subclass of any entry in *classinfo*. In any other " +"case, a :exc:`TypeError` exception is raised." msgstr "" +"اگر *class* زیرکلاس (مستقیم، غیرمستقیم یا :term:`مجازی `) *classinfo* باشد، مقدار ``True`` را " +"برمی‌گرداند. هر کلاس، زیرکلاس خودش نیز در نظر گرفته می‌شود. *classinfo* می‌تواند یک تاپل از اشیای کلاس (یا به‌صورت بازگشتی، " +"تاپل‌هایی از این نوع) یا یک :ref:`types-union` باشد؛ در این صورت، اگر *class* زیرکلاس هر یک از اعضای *classinfo* باشد، مقدار " +"``True`` برگردانده می‌شود. در هر حالت دیگر، استثنای :exc:`TypeError` ایجاد می‌شود." #: ../../library/functions.rst:1110 msgid "" -"Return an :term:`iterator` object. The first argument is interpreted very " -"differently depending on the presence of the second argument. Without a " -"second argument, the single argument must be a collection object which " -"supports the :term:`iterable` protocol (the :meth:`~object.__iter__` " -"method), or it must support the sequence protocol " -"(the :meth:`~object.__getitem__` method with integer arguments starting at " -"``0``). If it does not support either of those protocols, :exc:`TypeError` " -"is raised. If the second argument, *sentinel*, is given, then the first " -"argument must be a callable object. The iterator created in this case will " -"call *callable* with no arguments for each call to " -"its :meth:`~iterator.__next__` method; if the value returned is equal to " -"*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be " -"returned." -msgstr "" +"Return an :term:`iterator` object. The first argument is interpreted very differently depending on the presence of the " +"second argument. Without a second argument, the single argument must be a collection object which supports " +"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must support the sequence protocol " +"(the :meth:`~object.__getitem__` method with integer arguments starting at ``0``). If it does not support either of those " +"protocols, :exc:`TypeError` is raised. If the second argument, *sentinel*, is given, then the first argument must be a " +"callable object. The iterator created in this case will call *callable* with no arguments for each call to " +"its :meth:`~iterator.__next__` method; if the value returned is equal to *sentinel*, :exc:`StopIteration` will be raised, " +"otherwise the value will be returned." +msgstr "" +"یک شیء :term:`تکرارگر ` را برمی‌گرداند. تفسیر آرگومان اول به وجود یا عدم وجود آرگومان دوم بستگی دارد. اگر آرگومان " +"دومی وجود نداشته باشد، آرگومان اول باید یک شیء مجموعه باشد که از پروتکل :term:`تکرارپذیر ` " +"(متد :meth:`~object.__iter__`) پشتیبانی کند، یا از پروتکل دنباله (متد :meth:`~object.__getitem__` با آرگومان‌های صحیح که از " +"``0`` شروع می‌شوند) پشتیبانی کند. اگر از هیچ‌یک از این پروتکل‌ها پشتیبانی نکند، استثنای :exc:`TypeError` ایجاد می‌شود. اگر " +"آرگومان دوم، یعنی *sentinel*، ارائه شود، آرگومان اول باید یک شیء فراخوانی‌پذیر باشد. تکرارگر ایجادشده در این حالت، در هر " +"فراخوانی متد :meth:`~iterator.__next__`، *callable* را بدون آرگومان فراخوانی می‌کند؛ اگر مقدار بازگردانده‌شده برابر " +"*sentinel* باشد، استثنای :exc:`StopIteration` ایجاد می‌شود؛ در غیر این صورت، همان مقدار برگردانده می‌شود." #: ../../library/functions.rst:1124 msgid "See also :ref:`typeiter`." -msgstr "" +msgstr "همچنین به :ref:`typeiter` مراجعه کنید." #: ../../library/functions.rst:1126 msgid "" -"One useful application of the second form of :func:`iter` is to build a " -"block-reader. For example, reading fixed-width blocks from a binary database " -"file until the end of file is reached::" +"One useful application of the second form of :func:`iter` is to build a block-reader. For example, reading fixed-width " +"blocks from a binary database file until the end of file is reached::" msgstr "" +"یکی از کاربردهای مفید شکل دوم :func:`iter`، ساختن یک خوانندهٔ بلوکی (block reader) است. برای مثال، خواندن بلوک‌هایی با اندازهٔ " +"ثابت از یک پروندهٔ پایگاه دادهٔ دودویی تا رسیدن به انتهای پرونده::" #: ../../library/functions.rst:1130 msgid "" @@ -1734,491 +1794,536 @@ msgid "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" msgstr "" +"from functools import partial\n" +"with open('mydata.db', 'rb') as f:\n" +" for block in iter(partial(f.read, 64), b''):\n" +" process_block(block)" #: ../../library/functions.rst:1138 msgid "" -"Return the length (the number of items) of an object. The argument may be a " -"sequence (such as a string, bytes, tuple, list, or range) or a collection " -"(such as a dictionary, set, or frozen set)." +"Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, " +"list, or range) or a collection (such as a dictionary, set, or frozen set)." msgstr "" +"طول یک شیء (تعداد عناصر آن) را برمی‌گرداند. آرگومان می‌تواند یک دنباله (مانند رشته، bytes، تاپل، فهرست یا range) یا یک مجموعه " +"(مانند فرهنگ لغت، set یا frozenset) باشد." #: ../../library/functions.rst:1144 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger " -"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." msgstr "" +"``len`` برای طول‌هایی بزرگ‌تر از :data:`sys.maxsize`، مانند :class:`range(2 ** 100) `، استثنای :exc:`OverflowError` " +"ایجاد می‌کند." #: ../../library/functions.rst:1152 msgid "" -"Rather than being a function, :class:`list` is actually a mutable sequence " -"type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." +"Rather than being a function, :class:`list` is actually a mutable sequence type, as documented in :ref:`typesseq-list` " +"and :ref:`typesseq`." msgstr "" +":class:`list` در واقع یک نوع دنبالهٔ تغییرپذیر است، نه یک تابع؛ همان‌گونه که در :ref:`typesseq-list` و :ref:`typesseq` مستند " +"شده است." #: ../../library/functions.rst:1158 msgid "" -"Return a mapping object representing the current local symbol table, with " -"variable names as the keys, and their currently bound references as the " -"values." +"Return a mapping object representing the current local symbol table, with variable names as the keys, and their currently " +"bound references as the values." msgstr "" +"یک شیء نگاشتی را برمی‌گرداند که جدول نمادهای محلی فعلی را نمایش می‌دهد؛ در آن، نام متغیرها کلیدها و ارجاع‌های فعلی آن‌ها مقادیر " +"هستند." #: ../../library/functions.rst:1162 msgid "" -"At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace " -"as :func:`globals`." +"At module scope, as well as when using :func:`exec` or :func:`eval` with a single namespace, this function returns the same " +"namespace as :func:`globals`." msgstr "" +"در حوزهٔ ماژول، و همچنین هنگام استفاده از :func:`exec` یا :func:`eval` با یک فضای نام واحد، این تابع همان فضای نامی را " +"برمی‌گرداند که :func:`globals` برمی‌گرداند." #: ../../library/functions.rst:1166 -msgid "" -"At class scope, it returns the namespace that will be passed to the " -"metaclass constructor." -msgstr "" +msgid "At class scope, it returns the namespace that will be passed to the metaclass constructor." +msgstr "در حوزهٔ کلاس، این تابع فضای نامی را برمی‌گرداند که به سازندهٔ فراداده ارسال خواهد شد." #: ../../library/functions.rst:1169 msgid "" -"When using ``exec()`` or ``eval()`` with separate local and global " -"arguments, it returns the local namespace passed in to the function call." +"When using ``exec()`` or ``eval()`` with separate local and global arguments, it returns the local namespace passed in to " +"the function call." msgstr "" +"هنگام استفاده از ``exec()`` یا ``eval()`` با آرگومان‌های محلی و سراسریِ جداگانه، این تابع فضای نام محلیِ ارسال‌شده به فراخوانی " +"تابع را بازمی‌گرداند." #: ../../library/functions.rst:1172 msgid "" -"In all of the above cases, each call to ``locals()`` in a given frame of " -"execution will return the *same* mapping object. Changes made through the " -"mapping object returned from ``locals()`` will be visible as assigned, " -"reassigned, or deleted local variables, and assigning, reassigning, or " -"deleting local variables will immediately affect the contents of the " +"In all of the above cases, each call to ``locals()`` in a given frame of execution will return the *same* mapping object. " +"Changes made through the mapping object returned from ``locals()`` will be visible as assigned, reassigned, or deleted " +"local variables, and assigning, reassigning, or deleting local variables will immediately affect the contents of the " "returned mapping object." msgstr "" +"در همهٔ حالت‌های بالا، هر فراخوانی ``locals()`` در یک قاب (frame) مشخص از اجرا، *همان* شیء نگاشتی را برمی‌گرداند. تغییراتی که " +"از طریق شیء نگاشتیِ بازگردانده‌شده توسط ``locals()`` اعمال شوند، به‌صورت انتساب، انتساب مجدد یا حذف متغیرهای محلی قابل مشاهده " +"خواهند بود، و انتساب، انتساب مجدد یا حذف متغیرهای محلی نیز بلافاصله محتوای شیء نگاشتیِ بازگردانده‌شده را تغییر می‌دهد." #: ../../library/functions.rst:1179 msgid "" -"In an :term:`optimized scope` (including functions, generators, and " -"coroutines), each call to ``locals()`` instead returns a fresh dictionary " -"containing the current bindings of the function's local variables and any " -"nonlocal cell references. In this case, name binding changes made via the " -"returned dict are *not* written back to the corresponding local variables or " -"nonlocal cell references, and assigning, reassigning, or deleting local " -"variables and nonlocal cell references does *not* affect the contents of " -"previously returned dictionaries." +"In an :term:`optimized scope` (including functions, generators, and coroutines), each call to ``locals()`` instead returns " +"a fresh dictionary containing the current bindings of the function's local variables and any nonlocal cell references. In " +"this case, name binding changes made via the returned dict are *not* written back to the corresponding local variables or " +"nonlocal cell references, and assigning, reassigning, or deleting local variables and nonlocal cell references does *not* " +"affect the contents of previously returned dictionaries." msgstr "" +"در یک :term:`حوزهٔ بهینه‌شده ` (از جمله توابع، مولدها و هم‌روال‌ها)، هر فراخوانی ``locals()`` یک فرهنگ لغت " +"جدید برمی‌گرداند که شامل انتساب‌های فعلی متغیرهای محلی تابع و هرگونه ارجاع به سلول‌های غیرمحلی است. در این حالت، تغییرات " +"انتساب نام که از طریق فرهنگ لغت بازگردانده‌شده انجام شوند، به متغیرهای محلی یا ارجاع‌های سلول‌های غیرمحلی متناظر بازنویسی " +"*نمی‌شوند*، و انتساب، انتساب مجدد یا حذف متغیرهای محلی و ارجاع‌های سلول‌های غیرمحلی نیز بر محتوای فرهنگ لغت‌های بازگردانده‌شدهٔ " +"قبلی تأثیری *ندارد*." #: ../../library/functions.rst:1188 msgid "" -"Calling ``locals()`` as part of a comprehension in a function, generator, or " -"coroutine is equivalent to calling it in the containing scope, except that " -"the comprehension's initialised iteration variables will be included. In " -"other scopes, it behaves as if the comprehension were running as a nested " -"function." +"Calling ``locals()`` as part of a comprehension in a function, generator, or coroutine is equivalent to calling it in the " +"containing scope, except that the comprehension's initialised iteration variables will be included. In other scopes, it " +"behaves as if the comprehension were running as a nested function." msgstr "" +"فراخوانی ``locals()`` درون یک comprehension در یک تابع، مولد یا هم‌روال، معادل فراخوانی آن در حوزهٔ دربرگیرنده است، با این " +"تفاوت که متغیرهای پیمایشِ مقداردهی‌شدهٔ comprehension نیز در آن گنجانده می‌شوند. در سایر حوزه‌ها، رفتار آن به‌گونه‌ای است که گویی " +"comprehension به‌صورت یک تابع تو‌در‌تو اجرا می‌شود." #: ../../library/functions.rst:1194 -msgid "" -"Calling ``locals()`` as part of a generator expression is equivalent to " -"calling it in a nested generator function." -msgstr "" +msgid "Calling ``locals()`` as part of a generator expression is equivalent to calling it in a nested generator function." +msgstr "فراخوانی ``locals()`` درون یک عبارت مولد معادل فراخوانی آن در یک تابع مولد تو‌در‌تو است." #: ../../library/functions.rst:1197 -msgid "" -"The behaviour of ``locals()`` in a comprehension has been updated as " -"described in :pep:`709`." -msgstr "" +msgid "The behaviour of ``locals()`` in a comprehension has been updated as described in :pep:`709`." +msgstr "رفتار ``locals()`` در comprehensionها مطابق :pep:`709` به‌روزرسانی شده است." #: ../../library/functions.rst:1201 msgid "" -"As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior " -"in :term:`optimized scopes ` is now as described above. " -"Aside from being defined, the behaviour in other scopes remains unchanged " -"from previous versions." +"As part of :pep:`667`, the semantics of mutating the mapping objects returned from this function are now defined. The " +"behavior in :term:`optimized scopes ` is now as described above. Aside from being defined, the behaviour " +"in other scopes remains unchanged from previous versions." msgstr "" +"به‌عنوان بخشی از :pep:`667`، اکنون معناشناسی تغییر دادن اشیای نگاشتی که این تابع برمی‌گرداند، تعریف شده است. رفتار این تابع " +"در :term:`حوزه‌های بهینه‌شده ` اکنون همان‌گونه است که در بالا توضیح داده شد. به‌جز تعریف رسمی این رفتار، " +"عملکرد آن در سایر حوزه‌ها نسبت به نسخه‌های پیشین تغییری نکرده است." #: ../../library/functions.rst:1211 msgid "" -"Return an iterator that applies *function* to every item of *iterable*, " -"yielding the results. If additional *iterables* arguments are passed, " -"*function* must take that many arguments and is applied to the items from " -"all iterables in parallel. With multiple iterables, the iterator stops when " -"the shortest iterable is exhausted. If *strict* is ``True`` and one of the " -"iterables is exhausted before the others, a :exc:`ValueError` is raised. For " -"cases where the function inputs are already arranged into argument tuples, " -"see :func:`itertools.starmap`." +"Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional *iterables* " +"arguments are passed, *function* must take that many arguments and is applied to the items from all iterables in parallel. " +"With multiple iterables, the iterator stops when the shortest iterable is exhausted. If *strict* is ``True`` and one of " +"the iterables is exhausted before the others, a :exc:`ValueError` is raised. For cases where the function inputs are " +"already arranged into argument tuples, see :func:`itertools.starmap`." msgstr "" +"تکرارگری را برمی‌گرداند که *function* را روی هر عنصر *iterable* اعمال کرده و نتایج را تولید می‌کند. اگر آرگومان‌های " +"*iterables* اضافی ارائه شوند، *function* باید به همان تعداد آرگومان بپذیرد و به‌طور هم‌زمان روی عناصر همهٔ تکرارپذیرها اعمال " +"شود. در صورت وجود چند تکرارپذیر، تکرارگر زمانی متوقف می‌شود که کوتاه‌ترین تکرارپذیر به پایان برسد. اگر *strict* برابر " +"``True`` باشد و یکی از تکرارپذیرها زودتر از بقیه به پایان برسد، استثنای :exc:`ValueError` ایجاد می‌شود. در مواردی که " +"ورودی‌های تابع از پیش به‌صورت تاپل‌های آرگومان مرتب شده‌اند، به :func:`itertools.starmap` مراجعه کنید." #: ../../library/functions.rst:1220 msgid "Added the *strict* parameter." -msgstr "" +msgstr "پارامتر *strict* اضافه شد." #: ../../library/functions.rst:1228 -msgid "" -"Return the largest item in an iterable or the largest of two or more " -"arguments." -msgstr "" +msgid "Return the largest item in an iterable or the largest of two or more arguments." +msgstr "بزرگ‌ترین عنصر یک تکرارپذیر، یا بزرگ‌ترین مقدار از میان دو یا چند آرگومان را برمی‌گرداند." #: ../../library/functions.rst:1231 msgid "" -"If one positional argument is provided, it should be an :term:`iterable`. " -"The largest item in the iterable is returned. If two or more positional " -"arguments are provided, the largest of the positional arguments is returned." +"If one positional argument is provided, it should be an :term:`iterable`. The largest item in the iterable is returned. If " +"two or more positional arguments are provided, the largest of the positional arguments is returned." msgstr "" +"اگر یک آرگومان مکانی ارائه شود، باید یک :term:`تکرارپذیر ` باشد. در این صورت، بزرگ‌ترین عنصر آن تکرارپذیر " +"برگردانده می‌شود. اگر دو یا چند آرگومان مکانی ارائه شوند، بزرگ‌ترین آرگومان مکانی برگردانده می‌شود." #: ../../library/functions.rst:1236 ../../library/functions.rst:1274 msgid "" -"There are two optional keyword-only arguments. The *key* argument specifies " -"a one-argument ordering function like that used for :meth:`list.sort`. The " -"*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, " -"a :exc:`ValueError` is raised." +"There are two optional keyword-only arguments. The *key* argument specifies a one-argument ordering function like that used " +"for :meth:`list.sort`. The *default* argument specifies an object to return if the provided iterable is empty. If the " +"iterable is empty and *default* is not provided, a :exc:`ValueError` is raised." msgstr "" +"دو آرگومان اختیاریِ فقط-کلیدی (keyword-only) وجود دارد. آرگومان *key* یک تابع مرتب‌سازی تک‌آرگومانی، مشابه آنچه " +"در :meth:`list.sort` استفاده می‌شود، مشخص می‌کند. آرگومان *default* شیئی را مشخص می‌کند که در صورت خالی بودن تکرارپذیر " +"بازگردانده شود. اگر تکرارپذیر خالی باشد و *default* ارائه نشده باشد، استثنای :exc:`ValueError` ایجاد می‌شود." #: ../../library/functions.rst:1242 msgid "" -"If multiple items are maximal, the function returns the first one " -"encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " -"``heapq.nlargest(1, iterable, key=keyfunc)``." +"If multiple items are maximal, the function returns the first one encountered. This is consistent with other sort-" +"stability preserving tools such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq.nlargest(1, iterable, " +"key=keyfunc)``." msgstr "" +"اگر چندین عنصر دارای بیشترین مقدار باشند، تابع نخستین موردی را که با آن برخورد کند برمی‌گرداند. این رفتار با سایر ابزارهایی " +"که پایداری مرتب‌سازی را حفظ می‌کنند، مانند ``sorted(iterable, key=keyfunc, reverse=True)[0]`` و ``heapq.nlargest(1, iterable, " +"key=keyfunc)``، سازگار است." #: ../../library/functions.rst:1247 ../../library/functions.rst:1285 msgid "Added the *default* keyword-only parameter." -msgstr "" +msgstr "پارامتر فقط-کلیدواژهٔ *default* اضافه شد." #: ../../library/functions.rst:1250 ../../library/functions.rst:1288 msgid "The *key* can be ``None``." -msgstr "" +msgstr "*key* می‌تواند ``None`` باشد." #: ../../library/functions.rst:1258 -msgid "" -"Return a \"memory view\" object created from the given argument. " -"See :ref:`typememoryview` for more information." +msgid "Return a \"memory view\" object created from the given argument. See :ref:`typememoryview` for more information." msgstr "" +"یک شیء «memory view» ایجادشده از آرگومان داده‌شده را برمی‌گرداند. برای اطلاعات بیشتر، به :ref:`typememoryview` مراجعه کنید." #: ../../library/functions.rst:1266 -msgid "" -"Return the smallest item in an iterable or the smallest of two or more " -"arguments." -msgstr "" +msgid "Return the smallest item in an iterable or the smallest of two or more arguments." +msgstr "کوچک‌ترین عنصر یک تکرارپذیر، یا کوچک‌ترین مقدار از میان دو یا چند آرگومان را برمی‌گرداند." #: ../../library/functions.rst:1269 msgid "" -"If one positional argument is provided, it should be an :term:`iterable`. " -"The smallest item in the iterable is returned. If two or more positional " -"arguments are provided, the smallest of the positional arguments is returned." +"If one positional argument is provided, it should be an :term:`iterable`. The smallest item in the iterable is returned. " +"If two or more positional arguments are provided, the smallest of the positional arguments is returned." msgstr "" +"اگر یک آرگومان مکانی ارائه شود، باید یک :term:`تکرارپذیر ` باشد. در این صورت، کوچک‌ترین عنصر آن تکرارپذیر " +"برگردانده می‌شود. اگر دو یا چند آرگومان مکانی ارائه شوند، کوچک‌ترین آرگومان مکانی برگردانده می‌شود." #: ../../library/functions.rst:1280 msgid "" -"If multiple items are minimal, the function returns the first one " -"encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1, " -"iterable, key=keyfunc)``." +"If multiple items are minimal, the function returns the first one encountered. This is consistent with other sort-" +"stability preserving tools such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1, iterable, key=keyfunc)``." msgstr "" +"اگر چندین عنصر دارای کمترین مقدار باشند، تابع نخستین موردی را که با آن برخورد کند برمی‌گرداند. این رفتار با سایر ابزارهایی " +"که پایداری مرتب‌سازی را حفظ می‌کنند، مانند ``sorted(iterable, key=keyfunc)[0]`` و ``heapq.nsmallest(1, iterable, " +"key=keyfunc)``، سازگار است." #: ../../library/functions.rst:1295 msgid "" -"Retrieve the next item from the :term:`iterator` by calling " -"its :meth:`~iterator.__next__` method. If *default* is given, it is " -"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " -"raised." +"Retrieve the next item from the :term:`iterator` by calling its :meth:`~iterator.__next__` method. If *default* is given, " +"it is returned if the iterator is exhausted, otherwise :exc:`StopIteration` is raised." msgstr "" +"با فراخوانی متد :meth:`~iterator.__next__`، عنصر بعدی را از :term:`تکرارگر ` دریافت می‌کند. اگر *default* مشخص شده " +"باشد، در صورت پایان یافتن تکرارگر همان مقدار برگردانده می‌شود؛ در غیر این صورت، استثنای :exc:`StopIteration` ایجاد می‌شود." #: ../../library/functions.rst:1302 msgid "" -"This is the ultimate base class of all other classes. It has methods that " -"are common to all instances of Python classes. When the constructor is " -"called, it returns a new featureless object. The constructor does not accept " -"any arguments." +"This is the ultimate base class of all other classes. It has methods that are common to all instances of Python classes. " +"When the constructor is called, it returns a new featureless object. The constructor does not accept any arguments." msgstr "" +"این، کلاس پایهٔ نهایی همهٔ کلاس‌های دیگر است. این کلاس متدهایی را در اختیار دارد که میان تمام نمونه‌های کلاس‌های پایتون مشترک " +"هستند. هنگام فراخوانی سازندهٔ آن، یک شیء جدید و بدون ویژگی ایجاد می‌شود. این سازنده هیچ آرگومانی را نمی‌پذیرد." #: ../../library/functions.rst:1309 msgid "" -":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " -"so you can't assign arbitrary attributes to an instance of :class:`object`." +":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, so you can't assign arbitrary attributes to an " +"instance of :class:`object`." msgstr "" +"نمونه‌های :class:`object` دارای ویژگی :attr:`~object.__dict__` *نیستند*؛ بنابراین نمی‌توانید ویژگی‌های دلخواهی را به یک نمونه " +"از :class:`object` اختصاص دهید." #: ../../library/functions.rst:1316 -#, fuzzy msgid "" -"Convert an integer number to an octal string prefixed with \"0o\". The " -"result is a valid Python expression. If *integer* is not a " -"Python :class:`int` object, it has to define an :meth:`~object.__index__` " -"method that returns an integer. For example:" +"Convert an integer number to an octal string prefixed with \"0o\". The result is a valid Python expression. If *integer* " +"is not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. For " +"example:" msgstr "" -"تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک " -"عبارت معتبر پایتون خواهد بود. اگر *x* یک شیء پایتون :class:`int` نباشد، لازم " -"است یک روش(متد) :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. " -"برخی مثال ها:" +"تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک عبارت معتبر پایتون خواهد بود. اگر *integer* یک " +"شیء پایتون :class:`int` نباشد، لازم است یک روش(متد) :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. برخی مثال " +"ها:" #: ../../library/functions.rst:1326 msgid "" -"If you want to convert an integer number to an octal string either with the " -"prefix \"0o\" or not, you can use either of the following ways." +"If you want to convert an integer number to an octal string either with the prefix \"0o\" or not, you can use either of the " +"following ways." msgstr "" +"اگر می‌خواهید یک عدد صحیح را به یک رشتهٔ هشت‌هشتی، با پیشوند «0o» یا بدون آن، تبدیل کنید، می‌توانید از هر یک از روش‌های زیر " +"استفاده کنید." #: ../../library/functions.rst:1343 msgid "" -"Open *file* and return a corresponding :term:`file object`. If the file " -"cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " -"examples of how to use this function." +"Open *file* and return a corresponding :term:`file object`. If the file cannot be opened, an :exc:`OSError` is raised. " +"See :ref:`tut-files` for more examples of how to use this function." msgstr "" +"*file* را باز کرده و :term:`شیء پرونده ` متناظر با آن را برمی‌گرداند. اگر پرونده قابل باز شدن نباشد، " +"استثنای :exc:`OSError` ایجاد می‌شود. برای مثال‌های بیشتر دربارهٔ نحوهٔ استفاده از این تابع، به :ref:`tut-files` مراجعه کنید." #: ../../library/functions.rst:1347 msgid "" -"*file* is a :term:`path-like object` giving the pathname (absolute or " -"relative to the current working directory) of the file to be opened or an " -"integer file descriptor of the file to be wrapped. (If a file descriptor is " -"given, it is closed when the returned I/O object is closed unless *closefd* " -"is set to ``False``.)" +"*file* is a :term:`path-like object` giving the pathname (absolute or relative to the current working directory) of the " +"file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed " +"when the returned I/O object is closed unless *closefd* is set to ``False``.)" msgstr "" +"*file* یک :term:`شیء مسیرمانند ` است که مسیر پرونده (مطلق یا نسبی نسبت به پوشهٔ کاری فعلی) را برای باز شدن " +"مشخص می‌کند، یا یک توصیفگر عددی پرونده مربوط به پرونده‌ای است که باید در یک شیء ورودی/خروجی بسته‌بندی شود. (اگر یک توصیفگر " +"پرونده ارائه شود، هنگام بسته شدن شیء ورودی/خروجیِ بازگشتی نیز بسته خواهد شد، مگر اینکه *closefd* برابر ``False`` تنظیم شده " +"باشد.)" #: ../../library/functions.rst:1353 msgid "" -"*mode* is an optional string that specifies the mode in which the file is " -"opened. It defaults to ``'r'`` which means open for reading in text mode. " -"Other common values are ``'w'`` for writing (truncating the file if it " -"already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " -"(which on *some* Unix systems, means that *all* writes append to the end of " -"the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-" -"dependent: :func:`locale.getencoding` is called to get the current locale " -"encoding. (For reading and writing raw bytes use binary mode and leave " -"*encoding* unspecified.) The available modes are:" -msgstr "" +"*mode* is an optional string that specifies the mode in which the file is opened. It defaults to ``'r'`` which means open " +"for reading in text mode. Other common values are ``'w'`` for writing (truncating the file if it already exists), ``'x'`` " +"for exclusive creation, and ``'a'`` for appending (which on *some* Unix systems, means that *all* writes append to the end " +"of the file regardless of the current seek position). In text mode, if *encoding* is not specified the encoding used is " +"platform-dependent: :func:`locale.getencoding` is called to get the current locale encoding. (For reading and writing raw " +"bytes use binary mode and leave *encoding* unspecified.) The available modes are:" +msgstr "" +"*mode* یک رشتهٔ اختیاری است که حالت باز شدن پرونده را مشخص می‌کند. مقدار پیش‌فرض آن ``'r'`` است که به معنای باز کردن پرونده " +"برای خواندن در حالت متنی است. مقادیر رایج دیگر عبارت‌اند از ``'w'`` برای نوشتن (که اگر پرونده از قبل وجود داشته باشد، محتوای " +"آن را حذف می‌کند)، ``'x'`` برای ایجاد انحصاری، و ``'a'`` برای افزودن به انتهای پرونده (که در *برخی* از سیستم‌های یونیکس به " +"این معناست که *تمام* عملیات نوشتن، صرف‌نظر از موقعیت فعلی نشانگر، به انتهای پرونده افزوده می‌شوند). در حالت متنی، اگر " +"*encoding* مشخص نشده باشد، رمزگذاری مورد استفاده به سکو بستگی دارد؛ در این حالت، :func:`locale.getencoding` برای دریافت " +"رمزگذاری محلی (locale) فعلی فراخوانی می‌شود. (برای خواندن و نوشتن بایت‌های خام، از حالت دودویی استفاده کنید و *encoding* را " +"مشخص نکنید.) حالت‌های موجود عبارت‌اند از:" #: ../../library/functions.rst:1370 msgid "Character" -msgstr "" +msgstr "کاراکتر" #: ../../library/functions.rst:1370 msgid "Meaning" -msgstr "" +msgstr "به معنی" #: ../../library/functions.rst:1372 msgid "``'r'``" -msgstr "" +msgstr "``'r'``" #: ../../library/functions.rst:1372 msgid "open for reading (default)" -msgstr "" +msgstr "باز کردن برای خواندن (پیش‌فرض)" #: ../../library/functions.rst:1373 msgid "``'w'``" -msgstr "" +msgstr "``'w'``" #: ../../library/functions.rst:1373 msgid "open for writing, truncating the file first" -msgstr "" +msgstr "باز کردن برای نوشتن؛ ابتدا محتوای پرونده حذف می‌شود." #: ../../library/functions.rst:1374 msgid "``'x'``" -msgstr "" +msgstr "``'x'``" #: ../../library/functions.rst:1374 msgid "open for exclusive creation, failing if the file already exists" -msgstr "" +msgstr "باز کردن برای ایجاد انحصاری؛ در صورتی که پرونده از قبل وجود داشته باشد، عملیات شکست می‌خورد" #: ../../library/functions.rst:1375 msgid "``'a'``" -msgstr "" +msgstr "``'a'``" #: ../../library/functions.rst:1375 msgid "open for writing, appending to the end of file if it exists" -msgstr "" +msgstr "باز کردن برای نوشتن؛ اگر پرونده وجود داشته باشد، داده‌ها به انتهای آن افزوده می‌شوند" #: ../../library/functions.rst:1376 msgid "``'b'``" -msgstr "" +msgstr "``'b'``" #: ../../library/functions.rst:1376 ../../library/functions.rst:1520 msgid "binary mode" -msgstr "" +msgstr "حالت دودویی" #: ../../library/functions.rst:1377 msgid "``'t'``" -msgstr "" +msgstr "``'t'``" #: ../../library/functions.rst:1377 msgid "text mode (default)" -msgstr "" +msgstr "حالت متن (پیشفرض)" #: ../../library/functions.rst:1378 msgid "``'+'``" -msgstr "" +msgstr "``'+'``" #: ../../library/functions.rst:1378 msgid "open for updating (reading and writing)" -msgstr "" +msgstr "باز کردن برای به‌روزرسانی (خواندن و نوشتن)" #: ../../library/functions.rst:1381 msgid "" -"The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " -"Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " -"``'r+b'`` open the file with no truncation." +"The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). Modes ``'w+'`` and ``'w+b'`` open and truncate " +"the file. Modes ``'r+'`` and ``'r+b'`` open the file with no truncation." msgstr "" +"حالت پیش‌فرض ``'r'`` است (باز کردن پرونده برای خواندن متن، که معادل ``'rt'`` است). حالت‌های ``'w+'`` و ``'w+b'`` پرونده را " +"باز کرده و محتوای آن را حذف می‌کنند. حالت‌های ``'r+'`` و ``'r+b'`` پرونده را بدون حذف محتوا باز می‌کنند." #: ../../library/functions.rst:1385 msgid "" -"As mentioned in the :ref:`io-overview`, Python distinguishes between binary " -"and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " -"argument) return contents as :class:`bytes` objects without any decoding. " -"In text mode (the default, or when ``'t'`` is included in the *mode* " -"argument), the contents of the file are returned as :class:`str`, the bytes " -"having been first decoded using a platform-dependent encoding or using the " -"specified *encoding* if given." +"As mentioned in the :ref:`io-overview`, Python distinguishes between binary and text I/O. Files opened in binary mode " +"(including ``'b'`` in the *mode* argument) return contents as :class:`bytes` objects without any decoding. In text mode " +"(the default, or when ``'t'`` is included in the *mode* argument), the contents of the file are returned as :class:`str`, " +"the bytes having been first decoded using a platform-dependent encoding or using the specified *encoding* if given." msgstr "" +"همان‌طور که در :ref:`io-overview` اشاره شد، پایتون بین ورودی/خروجی دودویی و متنی تفاوت قائل می‌شود. پرونده‌هایی که در حالت " +"دودویی باز می‌شوند (یعنی *mode* شامل ``'b'`` باشد)، محتوا را بدون هیچ رمزگشایی به‌صورت اشیای :class:`bytes` برمی‌گردانند. در " +"حالت متنی (حالت پیش‌فرض، یا زمانی که *mode* شامل ``'t'`` باشد)، محتوای پرونده به‌صورت :class:`str` برگردانده می‌شود؛ در این " +"حالت، بایت‌ها ابتدا با استفاده از رمزگذاری وابسته به سکو یا، در صورت مشخص شدن، با استفاده از *encoding* داده‌شده رمزگشایی " +"می‌شوند." #: ../../library/functions.rst:1395 msgid "" -"Python doesn't depend on the underlying operating system's notion of text " -"files; all the processing is done by Python itself, and is therefore " -"platform-independent." +"Python doesn't depend on the underlying operating system's notion of text files; all the processing is done by Python " +"itself, and is therefore platform-independent." msgstr "" +"پایتون به مفهوم پروندهٔ متنی در سیستم‌عامل زیربنایی وابسته نیست؛ تمام پردازش‌ها توسط خود پایتون انجام می‌شوند و بنابراین مستقل " +"از سکو هستند." #: ../../library/functions.rst:1399 msgid "" -"*buffering* is an optional integer used to set the buffering policy. Pass 0 " -"to switch buffering off (only allowed in binary mode), 1 to select line " -"buffering (only usable when writing in text mode), and an integer > 1 to " -"indicate the size in bytes of a fixed-size chunk buffer. Note that " -"specifying a buffer size this way applies for binary buffered I/O, but " -"``TextIOWrapper`` (i.e., files opened with ``mode='r+'``) would have another " -"buffering. To disable buffering in ``TextIOWrapper``, consider using the " -"``write_through`` flag for :func:`io.TextIOWrapper.reconfigure`. When no " -"*buffering* argument is given, the default buffering policy works as follows:" -msgstr "" +"*buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in " +"binary mode), 1 to select line buffering (only usable when writing in text mode), and an integer > 1 to indicate the size " +"in bytes of a fixed-size chunk buffer. Note that specifying a buffer size this way applies for binary buffered I/O, but " +"``TextIOWrapper`` (i.e., files opened with ``mode='r+'``) would have another buffering. To disable buffering in " +"``TextIOWrapper``, consider using the ``write_through`` flag for :func:`io.TextIOWrapper.reconfigure`. When no *buffering* " +"argument is given, the default buffering policy works as follows:" +msgstr "" +"آرگومان *buffering* یک عدد صحیح اختیاری است که برای تعیین سیاست بافرگذاری استفاده می‌شود. برای غیرفعال کردن بافرگذاری مقدار " +"0 را وارد کنید (که فقط در حالت دودویی مجاز است)، برای انتخاب بافرگذاری خطی مقدار 1 را وارد کنید (که فقط هنگام نوشتن در حالت " +"متنی قابل استفاده است)، و یک عدد صحیح بزرگ‌تر از 1 را برای تعیین اندازهٔ یک بافر با اندازهٔ ثابت (بر حسب بایت) مشخص کنید. توجه " +"داشته باشید که تعیین اندازهٔ بافر به این روش فقط برای ورودی/خروجی دودوییِ بافرشده اعمال می‌شود، اما ``TextIOWrapper`` (یعنی " +"پرونده‌هایی که با ``mode='r+'`` باز می‌شوند) از بافرگذاری دیگری استفاده می‌کند. برای غیرفعال کردن بافرگذاری در " +"``TextIOWrapper``، استفاده از پرچم ``write_through`` برای :func:`io.TextIOWrapper.reconfigure` را در نظر بگیرید. اگر " +"آرگومان *buffering* مشخص نشود، سیاست پیش‌فرض بافرگذاری به صورت زیر عمل می‌کند:" #: ../../library/functions.rst:1409 msgid "" -"Binary files are buffered in fixed-size chunks; the size of the buffer is " -"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` when the device block " -"size is available. On most systems, the buffer will typically be 128 " -"kilobytes long." +"Binary files are buffered in fixed-size chunks; the size of the buffer is ``max(min(blocksize, 8 MiB), " +"DEFAULT_BUFFER_SIZE)`` when the device block size is available. On most systems, the buffer will typically be 128 kilobytes " +"long." msgstr "" +"پرونده‌های دودویی در قطعه‌هایی با اندازهٔ ثابت بافر می‌شوند؛ اگر اندازهٔ بلوک دستگاه در دسترس باشد، اندازهٔ بافر برابر با " +"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` خواهد بود. در بیشتر سیستم‌ها، اندازهٔ بافر معمولاً ۱۲۸ کیلوبایت است." #: ../../library/functions.rst:1414 msgid "" -"\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " -"returns ``True``) use line buffering. Other text files use the policy " -"described above for binary files." +"\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` returns ``True``) use line buffering. Other text " +"files use the policy described above for binary files." msgstr "" +"پرونده‌های متنی «تعاملی» (پرونده‌هایی که :meth:`~io.IOBase.isatty` برای آن‌ها مقدار ``True`` برمی‌گرداند) از بافرگذاری خطی " +"استفاده می‌کنند. سایر پرونده‌های متنی از سیاستی که در بالا برای پرونده‌های دودویی توضیح داده شده است، پیروی می‌کنند." #: ../../library/functions.rst:1418 msgid "" -"*encoding* is the name of the encoding used to decode or encode the file. " -"This should only be used in text mode. The default encoding is platform " -"dependent (whatever :func:`locale.getencoding` returns), but any :term:`text " -"encoding` supported by Python can be used. See the :mod:`codecs` module for " -"the list of supported encodings." +"*encoding* is the name of the encoding used to decode or encode the file. This should only be used in text mode. The " +"default encoding is platform dependent (whatever :func:`locale.getencoding` returns), but any :term:`text encoding` " +"supported by Python can be used. See the :mod:`codecs` module for the list of supported encodings." msgstr "" +"*encoding* نام رمزگذاری مورد استفاده برای رمزگشایی یا رمزگذاری پرونده است. این گزینه فقط باید در حالت متنی استفاده شود. " +"رمزگذاری پیش‌فرض به سکو بستگی دارد (هر مقداری که :func:`locale.getencoding` برگرداند)، اما می‌توان از هر :term:`رمزگذاری متنی " +"` که توسط پایتون پشتیبانی می‌شود استفاده کرد. برای مشاهدهٔ فهرست رمزگذاری‌های پشتیبانی‌شده، به " +"ماژول :mod:`codecs` مراجعه کنید." #: ../../library/functions.rst:1424 msgid "" -"*errors* is an optional string that specifies how encoding and decoding " -"errors are to be handled—this cannot be used in binary mode. A variety of " -"standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered " -"with :func:`codecs.register_error` is also valid. The standard names " -"include:" +"*errors* is an optional string that specifies how encoding and decoding errors are to be handled—this cannot be used in " +"binary mode. A variety of standard error handlers are available (listed under :ref:`error-handlers`), though any error " +"handling name that has been registered with :func:`codecs.register_error` is also valid. The standard names include:" msgstr "" +"*errors* یک رشتهٔ اختیاری است که مشخص می‌کند خطاهای رمزگذاری و رمزگشایی چگونه مدیریت شوند؛ این گزینه در حالت دودویی قابل " +"استفاده نیست. مجموعه‌ای از مدیریت‌کننده‌های استاندارد خطا (که در :ref:`error-handlers` فهرست شده‌اند) در دسترس هستند، با این " +"حال هر نام مدیریت خطایی که با :func:`codecs.register_error` ثبت شده باشد نیز معتبر است. نام‌های استاندارد شامل موارد زیر " +"هستند:" #: ../../library/functions.rst:1432 msgid "" -"``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " -"error. The default value of ``None`` has the same effect." +"``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding error. The default value of ``None`` has the " +"same effect." msgstr "" +"``'strict'`` در صورت بروز خطای رمزگذاری، استثنای :exc:`ValueError` ایجاد می‌کند. مقدار پیش‌فرض ``None`` نیز همین رفتار را " +"دارد." #: ../../library/functions.rst:1436 -msgid "" -"``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " -"data loss." +msgid "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to data loss." msgstr "" +"``'ignore'`` خطاها را نادیده می‌گیرد. توجه داشته باشید که نادیده گرفتن خطاهای رمزگذاری ممکن است به از دست رفتن داده‌ها منجر " +"شود." #: ../../library/functions.rst:1439 -msgid "" -"``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " -"where there is malformed data." -msgstr "" +msgid "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted where there is malformed data." +msgstr "``'replace'`` باعث می‌شود در محل داده‌های نادرست، یک نویسهٔ جایگزین (مانند ``'?'``) درج شود." #: ../../library/functions.rst:1442 msgid "" -"``'surrogateescape'`` will represent any incorrect bytes as low surrogate " -"code units ranging from U+DC80 to U+DCFF. These surrogate code units will " -"then be turned back into the same bytes when the ``surrogateescape`` error " -"handler is used when writing data. This is useful for processing files in " -"an unknown encoding." +"``'surrogateescape'`` will represent any incorrect bytes as low surrogate code units ranging from U+DC80 to U+DCFF. These " +"surrogate code units will then be turned back into the same bytes when the ``surrogateescape`` error handler is used when " +"writing data. This is useful for processing files in an unknown encoding." msgstr "" +"``'surrogateescape'`` هر بایت نادرست را به‌صورت واحدهای کد جانشین پایینی در بازهٔ U+DC80 تا U+DCFF نمایش می‌دهد. سپس، هنگام " +"نوشتن داده‌ها و استفاده از مدیریت‌کنندهٔ خطای ``surrogateescape``، این واحدهای کد جانشین دوباره به همان بایت‌ها تبدیل می‌شوند. " +"این قابلیت برای پردازش پرونده‌هایی با رمزگذاری نامشخص مفید است." #: ../../library/functions.rst:1449 msgid "" -"``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " -"not supported by the encoding are replaced with the appropriate XML " -"character reference :samp:`&#{nnn};`." +"``'xmlcharrefreplace'`` is only supported when writing to a file. Characters not supported by the encoding are replaced " +"with the appropriate XML character reference :samp:`&#{nnn};`." msgstr "" +"``'xmlcharrefreplace'`` فقط هنگام نوشتن در یک پرونده پشتیبانی می‌شود. نویسه‌هایی که توسط رمزگذاری پشتیبانی نمی‌شوند، با ارجاع " +"نویسهٔ XML متناظر آن‌ها به صورت :samp:`&#{nnn};` جایگزین می‌شوند." #: ../../library/functions.rst:1453 -msgid "" -"``'backslashreplace'`` replaces malformed data by Python's backslashed " -"escape sequences." -msgstr "" +msgid "``'backslashreplace'`` replaces malformed data by Python's backslashed escape sequences." +msgstr "``'backslashreplace'`` داده‌های نادرست را با توالی‌های گریز دارای بک‌اسلش در پایتون جایگزین می‌کند." #: ../../library/functions.rst:1456 msgid "" -"``'namereplace'`` (also only supported when writing) replaces unsupported " -"characters with ``\\N{...}`` escape sequences." +"``'namereplace'`` (also only supported when writing) replaces unsupported characters with ``\\N{...}`` escape sequences." msgstr "" +"``'namereplace'`` (که آن هم فقط هنگام نوشتن پشتیبانی می‌شود) نویسه‌های پشتیبانی‌نشده را با توالی‌های گریز ``\\N{...}`` جایگزین " +"می‌کند." #: ../../library/functions.rst:1464 msgid "" -"*newline* determines how to parse newline characters from the stream. It can " -"be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " -"follows:" +"*newline* determines how to parse newline characters from the stream. It can be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and " +"``'\\r\\n'``. It works as follows:" msgstr "" +"*newline* مشخص می‌کند که نویسه‌های پایان خط در جریان داده چگونه تجزیه شوند. این مقدار می‌تواند ``None``، ``''``، ``'\\n'``، " +"``'\\r'`` یا ``'\\r\\n'`` باشد. عملکرد آن به صورت زیر است:" #: ../../library/functions.rst:1468 msgid "" -"When reading input from the stream, if *newline* is ``None``, universal " -"newlines mode is enabled. Lines in the input can end in ``'\\n'``, " -"``'\\r'``, or ``'\\r\\n'``, and these are translated into ``'\\n'`` before " -"being returned to the caller. If it is ``''``, universal newlines mode is " -"enabled, but line endings are returned to the caller untranslated. If it " -"has any of the other legal values, input lines are only terminated by the " -"given string, and the line ending is returned to the caller untranslated." +"When reading input from the stream, if *newline* is ``None``, universal newlines mode is enabled. Lines in the input can " +"end in ``'\\n'``, ``'\\r'``, or ``'\\r\\n'``, and these are translated into ``'\\n'`` before being returned to the caller. " +"If it is ``''``, universal newlines mode is enabled, but line endings are returned to the caller untranslated. If it has " +"any of the other legal values, input lines are only terminated by the given string, and the line ending is returned to the " +"caller untranslated." msgstr "" +"هنگام خواندن ورودی از جریان، اگر *newline* برابر ``None`` باشد، حالت پایان‌خط‌های همگانی فعال می‌شود. در این حالت، خطوط ورودی " +"می‌توانند با ``'\\n'``، ``'\\r'`` یا ``'\\r\\n'`` پایان یابند و پیش از بازگردانده شدن به فراخواننده، همگی به ``'\\n'`` تبدیل " +"می‌شوند. اگر مقدار آن ``''`` باشد، حالت پایان‌خط‌های همگانی همچنان فعال است، اما نویسه‌های پایان خط بدون تبدیل به فراخواننده " +"بازگردانده می‌شوند. اگر *newline* یکی از مقادیر مجاز دیگر را داشته باشد، خطوط ورودی فقط با همان رشته خاتمه می‌یابند و نویسهٔ " +"پایان خط بدون تبدیل بازگردانده می‌شود." #: ../../library/functions.rst:1476 msgid "" -"When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line " -"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " -"translation takes place. If *newline* is any of the other legal values, any " -"``'\\n'`` characters written are translated to the given string." +"When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` characters written are translated to the system " +"default line separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation takes place. If *newline* " +"is any of the other legal values, any ``'\\n'`` characters written are translated to the given string." msgstr "" +"هنگام نوشتن خروجی در جریان، اگر *newline* برابر ``None`` باشد، هر نویسهٔ ``'\\n'`` نوشته‌شده به جداکنندهٔ پیش‌فرض پایان خط " +"سیستم، یعنی :data:`os.linesep`، تبدیل می‌شود. اگر *newline* برابر ``''`` یا ``'\\n'`` باشد، هیچ تبدیلی انجام نمی‌شود. اگر " +"*newline* یکی از مقادیر مجاز دیگر را داشته باشد، هر ``'\\n'`` نوشته‌شده به همان رشتهٔ مشخص‌شده تبدیل خواهد شد." #: ../../library/functions.rst:1482 msgid "" -"If *closefd* is ``False`` and a file descriptor rather than a filename was " -"given, the underlying file descriptor will be kept open when the file is " -"closed. If a filename is given *closefd* must be ``True`` (the default); " -"otherwise, an error will be raised." +"If *closefd* is ``False`` and a file descriptor rather than a filename was given, the underlying file descriptor will be " +"kept open when the file is closed. If a filename is given *closefd* must be ``True`` (the default); otherwise, an error " +"will be raised." msgstr "" +"اگر *closefd* برابر ``False`` باشد و به‌جای نام پرونده یک توصیفگر پرونده ارائه شده باشد، هنگام بسته شدن پرونده، توصیفگر " +"پروندهٔ زیربنایی باز خواهد ماند. اگر نام پرونده ارائه شود، *closefd* باید برابر ``True`` (مقدار پیش‌فرض) باشد؛ در غیر این " +"صورت، خطا ایجاد خواهد شد." #: ../../library/functions.rst:1487 msgid "" -"A custom opener can be used by passing a callable as *opener*. The " -"underlying file descriptor for the file object is then obtained by calling " -"*opener* with (*file*, *flags*). *opener* must return an open file " -"descriptor (passing :mod:`os.open` as *opener* results in functionality " -"similar to passing ``None``)." +"A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is then " +"obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor (passing :mod:`os.open` " +"as *opener* results in functionality similar to passing ``None``)." msgstr "" +"با ارسال یک شیء فراخوانی‌پذیر به‌عنوان *opener* می‌توان از یک بازکنندهٔ سفارشی استفاده کرد. در این صورت، توصیفگر پروندهٔ " +"زیربناییِ شیء پرونده با فراخوانی *opener* و ارسال (*file*, *flags*) به آن به‌دست می‌آید. *opener* باید یک توصیفگر پروندهٔ باز " +"برگرداند (ارسال :mod:`os.open` به‌عنوان *opener* رفتاری مشابه ارسال ``None`` خواهد داشت)." #: ../../library/functions.rst:1493 msgid "The newly created file is :ref:`non-inheritable `." -msgstr "" +msgstr "پروندهٔ تازه ایجادشده :ref:`غیرقابل‌وراثت ` است." #: ../../library/functions.rst:1495 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of " -"the :func:`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of the :func:`os.open` function to open a file relative to " +"a given directory::" msgstr "" +"مثال زیر از پارامتر :ref:`dir_fd ` تابع :func:`os.open` برای باز کردن پرونده‌ای نسبت به یک دایرکتوری مشخص استفاده " +"می‌کند::" #: ../../library/functions.rst:1498 msgid "" @@ -2232,142 +2337,157 @@ msgid "" "...\n" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" +">>> import os\n" +">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" +">>> def opener(path, flags):\n" +"... return os.open(path, flags, dir_fd=dir_fd)\n" +"...\n" +">>> with open('spamspam.txt', 'w', opener=opener) as f:\n" +"... print('This will be written to somedir/spamspam.txt', file=f)\n" +"...\n" +">>> os.close(dir_fd) # don't leak a file descriptor" #: ../../library/functions.rst:1508 msgid "" -"The type of :term:`file object` returned by the :func:`open` function " -"depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " -"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " -"used to open a file in a binary mode with buffering, the returned class is a " -"subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " -"binary mode, it returns an :class:`io.BufferedReader`; in write binary and " -"append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" -"write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass " +"The type of :term:`file object` returned by the :func:`open` function depends on the mode. When :func:`open` is used to " +"open a file in a text mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :class:`io.TextIOBase` " +"(specifically :class:`io.TextIOWrapper`). When used to open a file in a binary mode with buffering, the returned class is " +"a subclass of :class:`io.BufferedIOBase`. The exact class varies: in read binary mode, it returns " +"an :class:`io.BufferedReader`; in write binary and append binary modes, it returns an :class:`io.BufferedWriter`, and in " +"read/write mode, it returns an :class:`io.BufferedRandom`. When buffering is disabled, the raw stream, a subclass " "of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." msgstr "" +"نوع :term:`شیء فایل ` بازگردانده‌شده توسط تابع :func:`open` به حالت (mode) بستگی دارد. هنگامی که :func:`open` " +"برای باز کردن پرونده در حالت متنی (مانند ``'w'``، ``'r'``، ``'wt'``، ``'rt'`` و غیره) استفاده شود، زیرکلاسی " +"از :class:`io.TextIOBase` (به‌طور مشخص :class:`io.TextIOWrapper`) را بازمی‌گرداند. هنگام باز کردن پرونده در حالت دودویی همراه " +"با بافر، کلاس بازگردانده‌شده زیرکلاسی از :class:`io.BufferedIOBase` خواهد بود. کلاس دقیق بسته به حالت متفاوت است: در حالت " +"خواندن دودویی، :class:`io.BufferedReader`؛ در حالت‌های نوشتن دودویی و افزودن به انتهای پرونده، :class:`io.BufferedWriter`؛ و " +"در حالت خواندن/نوشتن، :class:`io.BufferedRandom` بازگردانده می‌شود. اگر بافر غیرفعال باشد، جریان خام (raw stream)، " +"یعنی :class:`io.FileIO` که زیرکلاسی از :class:`io.RawIOBase` است، بازگردانده می‌شود." #: ../../library/functions.rst:1529 msgid "" -"See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is " +"See also the file handling modules, such as :mod:`fileinput`, :mod:`io` (where :func:`open` is " "declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" +"همچنین به ماژول‌های مربوط به کار با پرونده‌ها، مانند :mod:`fileinput`، :mod:`io` (که :func:`open` در آن تعریف شده " +"است)، :mod:`os`، :mod:`os.path`، :mod:`tempfile` و :mod:`shutil` مراجعه کنید." #: ../../library/functions.rst:1533 -msgid "" -"Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " -"``mode``, ``flags``." -msgstr "" +msgid "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, ``mode``, ``flags``." +msgstr "یک :ref:`رویداد ممیزی ` با نام ``open`` و آرگومان‌های ``path``، ``mode`` و ``flags`` ایجاد می‌کند." #: ../../library/functions.rst:1535 -msgid "" -"The ``mode`` and ``flags`` arguments may have been modified or inferred from " -"the original call." -msgstr "" +msgid "The ``mode`` and ``flags`` arguments may have been modified or inferred from the original call." +msgstr "آرگومان‌های ``mode`` و ``flags`` ممکن است بر اساس فراخوانی اولیه تغییر داده شده یا مقدار آن‌ها استنباط شده باشند." #: ../../library/functions.rst:1540 msgid "The *opener* parameter was added." -msgstr "" +msgstr "پارامتر *opener* اضافه شده است." #: ../../library/functions.rst:1541 msgid "The ``'x'`` mode was added." -msgstr "" +msgstr "حالت ``'x'`` اضافه شده است." #: ../../library/functions.rst:1542 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "" +msgstr "در گذشته استثنای :exc:`IOError` ایجاد می‌شد؛ اکنون این استثنا نام مستعاری برای :exc:`OSError` است." #: ../../library/functions.rst:1543 -msgid "" -":exc:`FileExistsError` is now raised if the file opened in exclusive " -"creation mode (``'x'``) already exists." +msgid ":exc:`FileExistsError` is now raised if the file opened in exclusive creation mode (``'x'``) already exists." msgstr "" +"اگر فایلی که در حالت ایجاد انحصاری (``'x'``) باز می‌شود از قبل وجود داشته باشد، اکنون استثنای :exc:`FileExistsError` ایجاد " +"می‌شود." #: ../../library/functions.rst:1548 msgid "The file is now non-inheritable." -msgstr "" +msgstr "اکنون این پرونده غیرقابل‌وراثت است." #: ../../library/functions.rst:1552 msgid "" -"If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising " -"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"If the system call is interrupted and the signal handler does not raise an exception, the function now retries the system " +"call instead of raising an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" +"اگر فراخوانی سیستمی متوقف شود و مدیریت‌کنندهٔ سیگنال استثنایی ایجاد نکند، اکنون این تابع به‌جای ایجاد " +"استثنای :exc:`InterruptedError`، فراخوانی سیستمی را دوباره امتحان می‌کند (برای دلیل این تغییر، :pep:`475` را ببینید)." #: ../../library/functions.rst:1555 msgid "The ``'namereplace'`` error handler was added." -msgstr "" +msgstr "مدیر خطای ``'namereplace'`` اضافه شده است." #: ../../library/functions.rst:1559 msgid "Support added to accept objects implementing :class:`os.PathLike`." -msgstr "" +msgstr "پشتیبانی از پذیرش اشیایی که :class:`os.PathLike` را پیاده‌سازی می‌کنند، اضافه شده است." #: ../../library/functions.rst:1560 -msgid "" -"On Windows, opening a console buffer may return a subclass " -"of :class:`io.RawIOBase` other than :class:`io.FileIO`." -msgstr "" +msgid "On Windows, opening a console buffer may return a subclass of :class:`io.RawIOBase` other than :class:`io.FileIO`." +msgstr "در ویندوز، باز کردن یک بافر کنسول ممکن است زیرکلاسی از :class:`io.RawIOBase` غیر از :class:`io.FileIO` را برگرداند." #: ../../library/functions.rst:1563 msgid "The ``'U'`` mode has been removed." -msgstr "" +msgstr "حالت ``'U'`` حذف شده است." #: ../../library/functions.rst:1568 msgid "Return the ordinal value of a character." -msgstr "" +msgstr "مقدار ترتیبی (ordinal) یک نویسه را برمی‌گرداند." #: ../../library/functions.rst:1570 msgid "" -"If the argument is a one-character string, return the Unicode code point of " -"that character. For example, ``ord('a')`` returns the integer ``97`` and " -"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse " -"of :func:`chr`." +"If the argument is a one-character string, return the Unicode code point of that character. For example, ``ord('a')`` " +"returns the integer ``97`` and ``ord('€')`` (Euro sign) returns ``8364``. This is the inverse of :func:`chr`." msgstr "" +"اگر آرگومان یک رشتهٔ تک‌نویسه‌ای باشد، نقطهٔ کد یونیکد آن نویسه برگردانده می‌شود. برای مثال، ``ord('a')`` عدد صحیح ``97`` و " +"``ord('€')`` (نماد یورو) عدد ``8364`` را برمی‌گرداند. این تابع معکوس :func:`chr` است." #: ../../library/functions.rst:1575 msgid "" -"If the argument is a :class:`bytes` or :class:`bytearray` object of length " -"1, return its single byte value. For example, ``ord(b'a')`` returns the " -"integer ``97``." +"If the argument is a :class:`bytes` or :class:`bytearray` object of length 1, return its single byte value. For example, " +"``ord(b'a')`` returns the integer ``97``." msgstr "" +"اگر آرگومان یک شیء :class:`bytes` یا :class:`bytearray` با طول ۱ باشد، مقدار تنها بایت آن برگردانده می‌شود. برای مثال، " +"``ord(b'a')`` عدد صحیح ``97`` را برمی‌گرداند." #: ../../library/functions.rst:1582 msgid "" -"Return *base* to the power *exp*; if *mod* is present, return *base* to the " -"power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " -"mod``). The two-argument form ``pow(base, exp)`` is equivalent to using the " -"power operator: ``base**exp``." +"Return *base* to the power *exp*; if *mod* is present, return *base* to the power *exp*, modulo *mod* (computed more " +"efficiently than ``pow(base, exp) % mod``). The two-argument form ``pow(base, exp)`` is equivalent to using the power " +"operator: ``base**exp``." msgstr "" +"*base* را به توان *exp* می‌رساند؛ اگر *mod* مشخص شده باشد، مقدار *base* به توان *exp* را به پیمانهٔ *mod* برمی‌گرداند (که " +"کارآمدتر از ``pow(base, exp) % mod`` محاسبه می‌شود). شکل دوآرگومانی ``pow(base, exp)`` معادل استفاده از عملگر توان، یعنی " +"``base**exp``، است." #: ../../library/functions.rst:1587 msgid "" -"When arguments are builtin numeric types with mixed operand types, the " -"coercion rules for binary arithmetic operators apply. For :class:`int` " -"operands, the result has the same type as the operands (after coercion) " -"unless the second argument is negative; in that case, all arguments are " -"converted to float and a float result is delivered. For example, ``pow(10, " -"2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " -"base of type :class:`int` or :class:`float` and a non-integral exponent, a " -"complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` " -"or :class:`float` with an integral exponent, a float result is delivered. " +"When arguments are builtin numeric types with mixed operand types, the coercion rules for binary arithmetic operators " +"apply. For :class:`int` operands, the result has the same type as the operands (after coercion) unless the second argument " +"is negative; in that case, all arguments are converted to float and a float result is delivered. For example, ``pow(10, " +"2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative base of type :class:`int` or :class:`float` and " +"a non-integral exponent, a complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value close to ``3j``. " +"Whereas, for a negative base of type :class:`int` or :class:`float` with an integral exponent, a float result is delivered. " "For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" +"وقتی آرگومان‌ها از انواع عددی داخلی با انواع عملوند متفاوت باشند، قواعد تبدیل (coercion) عملگرهای حسابی دودویی اعمال می‌شود. " +"برای عملوندهای :class:`int`، نتیجه پس از اعمال تبدیل، همان نوع عملوندها را خواهد داشت؛ مگر اینکه آرگومان دوم منفی باشد که " +"در این صورت همهٔ آرگومان‌ها به float تبدیل شده و نتیجه نیز از نوع float خواهد بود. برای مثال، ``pow(10, 2)`` مقدار ``100`` را " +"برمی‌گرداند، اما ``pow(10, -2)`` مقدار ``0.01`` را بازمی‌گرداند. اگر پایهٔ منفی از نوع :class:`int` یا :class:`float` باشد و " +"توان عددی غیرصحیح باشد، نتیجه از نوع مختلط خواهد بود. برای مثال، ``pow(-9, 0.5)`` مقداری نزدیک به ``3j`` را برمی‌گرداند. در " +"مقابل، اگر پایهٔ منفی از نوع :class:`int` یا :class:`float` باشد و توان عددی صحیح باشد، نتیجه از نوع float خواهد بود. برای " +"مثال، ``pow(-9, 2.0)`` مقدار ``81.0`` را برمی‌گرداند." #: ../../library/functions.rst:1599 msgid "" -"For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " -"also be of integer type and *mod* must be nonzero. If *mod* is present and " -"*exp* is negative, *base* must be relatively prime to *mod*. In that case, " -"``pow(inv_base, -exp, mod)`` is returned, where *inv_base* is an inverse to " -"*base* modulo *mod*." +"For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must also be of integer type and *mod* must be " +"nonzero. If *mod* is present and *exp* is negative, *base* must be relatively prime to *mod*. In that case, ``pow(inv_base, " +"-exp, mod)`` is returned, where *inv_base* is an inverse to *base* modulo *mod*." msgstr "" +"برای عملوندهای :class:`int` یعنی *base* و *exp*، اگر *mod* ارائه شود، باید از نوع عدد صحیح باشد و مقدار آن نیز نباید صفر " +"باشد. اگر *mod* ارائه شده باشد و *exp* منفی باشد، *base* و *mod* باید نسبت به هم اول باشند. در این حالت، ``pow(inv_base, " +"-exp, mod)`` برگردانده می‌شود که در آن *inv_base* وارونِ *base* به پیمانهٔ *mod* است." #: ../../library/functions.rst:1605 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" -msgstr "" +msgstr "در اینجا مثالی از محاسبهٔ وارون پیمانه‌ایِ ``38`` به پیمانهٔ ``97`` آورده شده است::" #: ../../library/functions.rst:1607 msgid "" @@ -2376,66 +2496,75 @@ msgid "" ">>> 23 * 38 % 97 == 1\n" "True" msgstr "" +">>> pow(38, -1, mod=97)\n" +"23\n" +">>> 23 * 38 % 97 == 1\n" +"True" #: ../../library/functions.rst:1612 msgid "" -"For :class:`int` operands, the three-argument form of ``pow`` now allows the " -"second argument to be negative, permitting computation of modular inverses." +"For :class:`int` operands, the three-argument form of ``pow`` now allows the second argument to be negative, permitting " +"computation of modular inverses." msgstr "" +"برای عملوندهای :class:`int`، شکل سه‌آرگومانی ``pow`` اکنون اجازه می‌دهد آرگومان دوم منفی باشد و در نتیجه امکان محاسبهٔ وارون " +"پیمانه‌ای را فراهم می‌کند." #: ../../library/functions.rst:1617 -msgid "" -"Allow keyword arguments. Formerly, only positional arguments were supported." -msgstr "" +msgid "Allow keyword arguments. Formerly, only positional arguments were supported." +msgstr "امکان استفاده از آرگومان‌های کلیدواژه‌ای اضافه شد. پیش از این، فقط آرگومان‌های مکانی پشتیبانی می‌شدند." #: ../../library/functions.rst:1624 msgid "" -"Print *objects* to the text stream *file*, separated by *sep* and followed " -"by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " -"keyword arguments." +"Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and *flush*, if " +"present, must be given as keyword arguments." msgstr "" +"*objects* را با جداکنندهٔ *sep* و در انتها با *end* در جریان متنی *file* چاپ می‌کند. اگر *sep*، *end*، *file* یا *flush* مشخص " +"شوند، باید به‌صورت آرگومان‌های کلیدواژه‌ای ارائه شوند." #: ../../library/functions.rst:1628 msgid "" -"All non-keyword arguments are converted to strings like :func:`str` does and " -"written to the stream, separated by *sep* and followed by *end*. Both *sep* " -"and *end* must be strings; they can also be ``None``, which means to use the " -"default values. If no *objects* are given, :func:`print` will just write " -"*end*." +"All non-keyword arguments are converted to strings like :func:`str` does and written to the stream, separated by *sep* and " +"followed by *end*. Both *sep* and *end* must be strings; they can also be ``None``, which means to use the default " +"values. If no *objects* are given, :func:`print` will just write *end*." msgstr "" +"همهٔ آرگومان‌های غیرکلیدواژه‌ای، همانند :func:`str`، به رشته تبدیل شده و با جداکنندهٔ *sep* از یکدیگر جدا شده و سپس همراه با " +"*end* در جریان (stream) نوشته می‌شوند. هر دو مقدار *sep* و *end* باید رشته باشند؛ همچنین می‌توانند ``None`` باشند که در این " +"صورت از مقادیر پیش‌فرض استفاده می‌شود. اگر هیچ *objects*ی ارائه نشود، :func:`print` فقط مقدار *end* را خواهد نوشت." #: ../../library/functions.rst:1634 msgid "" -"The *file* argument must be an object with a ``write(string)`` method; if it " -"is not present or ``None``, :data:`sys.stdout` will be used. Since printed " -"arguments are converted to text strings, :func:`print` cannot be used with " -"binary mode file objects. For these, use ``file.write(...)`` instead." +"The *file* argument must be an object with a ``write(string)`` method; if it is not present or ``None``, :data:`sys.stdout` " +"will be used. Since printed arguments are converted to text strings, :func:`print` cannot be used with binary mode file " +"objects. For these, use ``file.write(...)`` instead." msgstr "" +"آرگومان *file* باید شیئی باشد که متد ``write(string)`` را داشته باشد؛ اگر این آرگومان ارائه نشود یا ``None`` باشد، " +"از :data:`sys.stdout` استفاده خواهد شد. از آنجا که آرگومان‌های چاپ‌شده به رشتهٔ متنی تبدیل می‌شوند، :func:`print` را نمی‌توان با " +"اشیای فایل در حالت دودویی استفاده کرد. برای چنین مواردی، به‌جای آن از ``file.write(...)`` استفاده کنید." #: ../../library/functions.rst:1639 -msgid "" -"Output buffering is usually determined by *file*. However, if *flush* is " -"true, the stream is forcibly flushed." +msgid "Output buffering is usually determined by *file*. However, if *flush* is true, the stream is forcibly flushed." msgstr "" +"بافرگذاری خروجی معمولاً توسط *file* تعیین می‌شود. با این حال، اگر *flush* برابر True باشد، جریان داده به‌اجبار تخلیه می‌شود." #: ../../library/functions.rst:1643 msgid "Added the *flush* keyword argument." -msgstr "" +msgstr "آرگومان کلیدواژه‌ای *flush* اضافه شد." #: ../../library/functions.rst:1649 msgid "Return a property attribute." -msgstr "" +msgstr "یک ویژگی از نوع property را برمی‌گرداند." #: ../../library/functions.rst:1651 msgid "" -"*fget* is a function for getting an attribute value. *fset* is a function " -"for setting an attribute value. *fdel* is a function for deleting an " -"attribute value. And *doc* creates a docstring for the attribute." +"*fget* is a function for getting an attribute value. *fset* is a function for setting an attribute value. *fdel* is a " +"function for deleting an attribute value. And *doc* creates a docstring for the attribute." msgstr "" +"*fget* تابعی برای دریافت مقدار یک ویژگی است. *fset* تابعی برای تنظیم مقدار یک ویژگی است. *fdel* تابعی برای حذف مقدار یک " +"ویژگی است. همچنین *doc* یک رشتهٔ مستندات برای آن ویژگی ایجاد می‌کند." #: ../../library/functions.rst:1655 msgid "A typical use is to define a managed attribute ``x``::" -msgstr "" +msgstr "یک کاربرد رایج، تعریف ویژگی مدیریت‌شدهٔ ``x`` به‌صورت زیر است::" #: ../../library/functions.rst:1657 msgid "" @@ -2454,20 +2583,37 @@ msgid "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" msgstr "" +"class C:\n" +" def __init__(self):\n" +" self._x = None\n" +"\n" +" def getx(self):\n" +" return self._x\n" +"\n" +" def setx(self, value):\n" +" self._x = value\n" +"\n" +" def delx(self):\n" +" del self._x\n" +"\n" +" x = property(getx, setx, delx, \"I'm the 'x' property.\")" #: ../../library/functions.rst:1672 msgid "" -"If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " -"value`` will invoke the setter, and ``del c.x`` the deleter." +"If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = value`` will invoke the setter, and ``del c.x`` the " +"deleter." msgstr "" +"اگر *c* نمونه‌ای از *C* باشد، عبارت ``c.x`` فراخوانی‌کنندهٔ getter، عبارت ``c.x = value`` فراخوانی‌کنندهٔ setter، و عبارت ``del " +"c.x`` فراخوانی‌کنندهٔ deleter خواهد بود." #: ../../library/functions.rst:1675 msgid "" -"If given, *doc* will be the docstring of the property attribute. Otherwise, " -"the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as " -"a :term:`decorator`::" +"If given, *doc* will be the docstring of the property attribute. Otherwise, the property will copy *fget*'s docstring (if " +"it exists). This makes it possible to create read-only properties easily using :func:`property` as a :term:`decorator`::" msgstr "" +"اگر *doc* مشخص شده باشد، به‌عنوان docstring ویژگی property استفاده خواهد شد. در غیر این صورت، property، docstring مربوط به " +"*fget* را (در صورت وجود) کپی می‌کند. این امکان را فراهم می‌کند که با استفاده از :func:`property` به‌عنوان یک :term:`دکوراتور " +"`، به‌سادگی ویژگی‌های فقط‌خواندنی ایجاد شوند::" #: ../../library/functions.rst:1679 msgid "" @@ -2480,21 +2626,31 @@ msgid "" " \"\"\"Get the current voltage.\"\"\"\n" " return self._voltage" msgstr "" +"class Parrot:\n" +" def __init__(self):\n" +" self._voltage = 100000\n" +"\n" +" @property\n" +" def voltage(self):\n" +" \"\"\"Get the current voltage.\"\"\"\n" +" return self._voltage" #: ../../library/functions.rst:1688 msgid "" -"The ``@property`` decorator turns the :meth:`!voltage` method into a " -"\"getter\" for a read-only attribute with the same name, and it sets the " -"docstring for *voltage* to \"Get the current voltage.\"" +"The ``@property`` decorator turns the :meth:`!voltage` method into a \"getter\" for a read-only attribute with the same " +"name, and it sets the docstring for *voltage* to \"Get the current voltage.\"" msgstr "" +"تزئین‌کنندهٔ ``@property`` متد :meth:`!voltage` را به یک «getter» برای ویژگی فقط‌خواندنی‌ای با همان نام تبدیل می‌کند و docstring " +"ویژگی *voltage* را روی «Get the current voltage.» تنظیم می‌کند." #: ../../library/functions.rst:1696 msgid "" -"A property object has ``getter``, ``setter``, and ``deleter`` methods usable " -"as decorators that create a copy of the property with the corresponding " -"accessor function set to the decorated function. This is best explained " -"with an example:" +"A property object has ``getter``, ``setter``, and ``deleter`` methods usable as decorators that create a copy of the " +"property with the corresponding accessor function set to the decorated function. This is best explained with an example:" msgstr "" +"یک شیء property دارای متدهای ``getter``، ``setter`` و ``deleter`` است که می‌توان از آن‌ها به‌عنوان دکوراتور استفاده کرد. این " +"متدها نسخه‌ای از property را ایجاد می‌کنند که تابع دسترسی متناظر آن با تابع دکوراتورشده جایگزین شده است. این موضوع با یک مثال " +"بهتر توضیح داده می‌شود:" #: ../../library/functions.rst:1701 msgid "" @@ -2515,52 +2671,70 @@ msgid "" " def x(self):\n" " del self._x" msgstr "" +"class C:\n" +" def __init__(self):\n" +" self._x = None\n" +"\n" +" @property\n" +" def x(self):\n" +" \"\"\"I'm the 'x' property.\"\"\"\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x" #: ../../library/functions.rst:1720 msgid "" -"This code is exactly equivalent to the first example. Be sure to give the " -"additional functions the same name as the original property (``x`` in this " -"case.)" +"This code is exactly equivalent to the first example. Be sure to give the additional functions the same name as the " +"original property (``x`` in this case.)" msgstr "" +"این کد دقیقاً معادل مثال اول است. دقت کنید که توابع اضافی نیز همان نام property اصلی (در این مثال ``x``) را داشته باشند." #: ../../library/functions.rst:1724 msgid "" -"The returned property object also has the attributes ``fget``, ``fset``, and " -"``fdel`` corresponding to the constructor arguments." -msgstr "" +"The returned property object also has the attributes ``fget``, ``fset``, and ``fdel`` corresponding to the constructor " +"arguments." +msgstr "شیء property بازگردانده‌شده همچنین دارای ویژگی‌های ``fget``، ``fset`` و ``fdel`` متناظر با آرگومان‌های سازنده است." #: ../../library/functions.rst:1727 msgid "The docstrings of property objects are now writeable." -msgstr "" +msgstr "اکنون docstring اشیای property قابل‌ویرایش است." #: ../../library/functions.rst:1732 -msgid "" -"Attribute holding the name of the property. The name of the property can be " -"changed at runtime." -msgstr "" +msgid "Attribute holding the name of the property. The name of the property can be changed at runtime." +msgstr "ویژگی‌ای که نام property را نگه می‌دارد. نام property را می‌توان در زمان اجرا تغییر داد." #: ../../library/functions.rst:1743 msgid "" -"Rather than being a function, :class:`range` is actually an immutable " -"sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." +"Rather than being a function, :class:`range` is actually an immutable sequence type, as documented in :ref:`typesseq-range` " +"and :ref:`typesseq`." msgstr "" +":class:`range` در واقع یک نوع دنبالهٔ تغییرناپذیر است، نه یک تابع؛ همان‌گونه که در :ref:`typesseq-range` و :ref:`typesseq` " +"مستند شده است." #: ../../library/functions.rst:1749 msgid "" -"Return a string containing a printable representation of an object. For " -"many types, this function makes an attempt to return a string that would " -"yield an object with the same value when passed to :func:`eval`; otherwise, " -"the representation is a string enclosed in angle brackets that contains the " -"name of the type of the object together with additional information often " -"including the name and address of the object. A class can control what this " -"function returns for its instances by defining a :meth:`~object.__repr__` " -"method. If :func:`sys.displayhook` is not accessible, this function will " +"Return a string containing a printable representation of an object. For many types, this function makes an attempt to " +"return a string that would yield an object with the same value when passed to :func:`eval`; otherwise, the representation " +"is a string enclosed in angle brackets that contains the name of the type of the object together with additional " +"information often including the name and address of the object. A class can control what this function returns for its " +"instances by defining a :meth:`~object.__repr__` method. If :func:`sys.displayhook` is not accessible, this function will " "raise :exc:`RuntimeError`." msgstr "" +"رشته‌ای را برمی‌گرداند که نمایش قابل چاپی از یک شیء را در بر دارد. برای بسیاری از نوع‌ها، این تابع تلاش می‌کند رشته‌ای برگرداند " +"که اگر به :func:`eval` داده شود، شیئی با همان مقدار تولید کند؛ در غیر این صورت، نمایش به‌صورت رشته‌ای درون کروشه‌های زاویه‌دار " +"خواهد بود که نام نوع شیء و اطلاعات اضافی، که معمولاً شامل نام و نشانی شیء است، در آن قرار دارد. یک کلاس می‌تواند با تعریف " +"متد :meth:`~object.__repr__` مشخص کند که این تابع برای نمونه‌های آن چه مقداری برگرداند. اگر :func:`sys.displayhook` در دسترس " +"نباشد، این تابع استثنای :exc:`RuntimeError` ایجاد می‌کند." #: ../../library/functions.rst:1760 msgid "This class has a custom representation that can be evaluated::" -msgstr "" +msgstr "این کلاس یک نمایش (representation) سفارشی دارد که قابل ارزیابی است::" #: ../../library/functions.rst:1762 msgid "" @@ -2572,183 +2746,202 @@ msgid "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" msgstr "" +"class Person:\n" +" def __init__(self, name, age):\n" +" self.name = name\n" +" self.age = age\n" +"\n" +" def __repr__(self):\n" +" return f\"Person('{self.name}', {self.age})\"" #: ../../library/functions.rst:1773 msgid "" -"Return a reverse :term:`iterator`. The argument must be an object which has " -"a :meth:`~object.__reversed__` method or supports the sequence protocol " -"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " -"method with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. The argument must be an object which has a :meth:`~object.__reversed__` method or " +"supports the sequence protocol (the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` method with integer " +"arguments starting at ``0``)." msgstr "" +"یک :term:`تکرارگر ` معکوس را برمی‌گرداند. آرگومان باید شیئی باشد که متد :meth:`~object.__reversed__` را داشته باشد " +"یا از پروتکل دنباله (متد :meth:`~object.__len__` و متد :meth:`~object.__getitem__` با آرگومان‌های صحیح که از ``0`` شروع " +"می‌شوند) پشتیبانی کند." #: ../../library/functions.rst:1781 msgid "" -"Return *number* rounded to *ndigits* precision after the decimal point. If " -"*ndigits* is omitted or is ``None``, it returns the nearest integer to its " -"input." +"Return *number* rounded to *ndigits* precision after the decimal point. If *ndigits* is omitted or is ``None``, it returns " +"the nearest integer to its input." msgstr "" +"*number* را با دقت *ndigits* رقم پس از ممیز گرد می‌کند. اگر *ndigits* حذف شده باشد یا برابر ``None`` باشد، نزدیک‌ترین عدد " +"صحیح به ورودی را برمی‌گرداند." #: ../../library/functions.rst:1785 msgid "" -"For the built-in types supporting :func:`round`, values are rounded to the " -"closest multiple of 10 to the power minus *ndigits*; if two multiples are " -"equally close, rounding is done toward the even choice (so, for example, " -"both ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is " -"``2``). Any integer value is valid for *ndigits* (positive, zero, or " -"negative). The return value is an integer if *ndigits* is omitted or " -"``None``. Otherwise, the return value has the same type as *number*." +"For the built-in types supporting :func:`round`, values are rounded to the closest multiple of 10 to the power minus " +"*ndigits*; if two multiples are equally close, rounding is done toward the even choice (so, for example, both " +"``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is ``2``). Any integer value is valid for *ndigits* " +"(positive, zero, or negative). The return value is an integer if *ndigits* is omitted or ``None``. Otherwise, the return " +"value has the same type as *number*." msgstr "" +"برای انواع داخلی‌ای که از :func:`round` پشتیبانی می‌کنند، مقادیر به نزدیک‌ترین مضرب 10 به توان منفی *ndigits* گرد می‌شوند. اگر " +"دو مضرب به یک اندازه نزدیک باشند، گرد کردن به سمت مقدار زوج انجام می‌شود (برای مثال، هر دو عبارت ``round(0.5)`` و " +"``round(-0.5)`` برابر ``0`` هستند و ``round(1.5)`` برابر ``2`` است). هر مقدار صحیحی (مثبت، صفر یا منفی) برای *ndigits* " +"معتبر است. اگر *ndigits* حذف شود یا ``None`` باشد، مقدار بازگشتی یک عدد صحیح خواهد بود. در غیر این صورت، مقدار بازگشتی همان " +"نوع *number* را خواهد داشت." #: ../../library/functions.rst:1794 -msgid "" -"For a general Python object ``number``, ``round`` delegates to " -"``number.__round__``." -msgstr "" +msgid "For a general Python object ``number``, ``round`` delegates to ``number.__round__``." +msgstr "برای یک شیء عمومی پایتون به نام ``number``، تابع ``round`` فراخوانی را به ``number.__round__`` واگذار می‌کند." #: ../../library/functions.rst:1799 msgid "" -"The behavior of :func:`round` for floats can be surprising: for example, " -"``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " -"not a bug: it's a result of the fact that most decimal fractions can't be " -"represented exactly as a float. See :ref:`tut-fp-issues` for more " -"information." +"The behavior of :func:`round` for floats can be surprising: for example, ``round(2.675, 2)`` gives ``2.67`` instead of the " +"expected ``2.68``. This is not a bug: it's a result of the fact that most decimal fractions can't be represented exactly as " +"a float. See :ref:`tut-fp-issues` for more information." msgstr "" +"رفتار :func:`round` برای اعداد ممیز شناور ممکن است غافلگیرکننده باشد؛ برای مثال، ``round(2.675, 2)`` به‌جای ``2.68`` مقدار " +"``2.67`` را برمی‌گرداند. این یک باگ نیست؛ بلکه نتیجهٔ این واقعیت است که بیشتر کسرهای ده‌دهی را نمی‌توان به‌طور دقیق به‌صورت عدد " +"ممیز شناور نمایش داد. برای اطلاعات بیشتر به :ref:`tut-fp-issues` مراجعه کنید." #: ../../library/functions.rst:1810 msgid "" -"Return a new :class:`set` object, optionally with elements taken from " -"*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" -"set` for documentation about this class." +"Return a new :class:`set` object, optionally with elements taken from *iterable*. ``set`` is a built-in class. " +"See :class:`set` and :ref:`types-set` for documentation about this class." msgstr "" +"یک شیء جدید از نوع :class:`set` را برمی‌گرداند که در صورت ارائه، عناصر آن از *iterable* گرفته می‌شوند. ``set`` یک کلاس داخلی " +"است. برای مستندات این کلاس، به :class:`set` و :ref:`types-set` مراجعه کنید." #: ../../library/functions.rst:1814 msgid "" -"For other containers see the built-" -"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " -"classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` classes, as well " +"as the :mod:`collections` module." msgstr "" +"برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`frozenset`، :class:`list`، :class:`tuple` و :class:`dict`، و همچنین " +"ماژول :mod:`collections` مراجعه کنید." #: ../../library/functions.rst:1821 msgid "" -"This is the counterpart of :func:`getattr`. The arguments are an object, a " -"string, and an arbitrary value. The string may name an existing attribute " -"or a new attribute. The function assigns the value to the attribute, " -"provided the object allows it. For example, ``setattr(x, 'foobar', 123)`` " -"is equivalent to ``x.foobar = 123``." +"This is the counterpart of :func:`getattr`. The arguments are an object, a string, and an arbitrary value. The string may " +"name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows " +"it. For example, ``setattr(x, 'foobar', 123)`` is equivalent to ``x.foobar = 123``." msgstr "" +"این تابع همتای :func:`getattr` است. آرگومان‌های آن یک شیء، یک رشته و یک مقدار دلخواه هستند. رشته می‌تواند نام یک ویژگی موجود " +"یا یک ویژگی جدید باشد. در صورت مجاز بودن، تابع مقدار را به آن ویژگی اختصاص می‌دهد. برای مثال، ``setattr(x, 'foobar', 123)`` " +"معادل ``x.foobar = 123`` است." #: ../../library/functions.rst:1827 msgid "" -"*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a " -"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " -"attribute whose name is not an identifier will not be accessible using the " -"dot notation, but is accessible through :func:`getattr` etc.." +"*name* need not be a Python identifier as defined in :ref:`identifiers` unless the object chooses to enforce that, for " +"example in a custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute whose name is not an " +"identifier will not be accessible using the dot notation, but is accessible through :func:`getattr` etc.." msgstr "" +"*name* لازم نیست یک شناسهٔ پایتون، مطابق تعریف :ref:`identifiers`، باشد؛ مگر اینکه خود شیء این موضوع را اعمال کند، برای مثال " +"در یک :meth:`~object.__getattribute__` سفارشی یا از طریق :attr:`~object.__slots__`. ویژگی‌ای که نام آن یک شناسه نباشد، با " +"استفاده از نماد نقطه قابل دسترسی نیست، اما از طریق :func:`getattr` و توابع مشابه قابل دسترسی خواهد بود." #: ../../library/functions.rst:1835 msgid "" -"Since :ref:`private name mangling ` happens at " -"compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to set it with :func:`setattr`." +"Since :ref:`private name mangling ` happens at compilation time, one must manually mangle a private " +"attribute's (attributes with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" +"از آنجا که :ref:`تغییر نام خصوصی ` در زمان کامپایل انجام می‌شود، برای تنظیم مقدار یک ویژگی خصوصی " +"(ویژگی‌هایی که با دو زیرخط آغاز می‌شوند) با استفاده از :func:`setattr`، باید نام آن را به‌صورت دستی تغییر دهید." #: ../../library/functions.rst:1844 msgid "" -"Return a :term:`slice` object representing the set of indices specified by " -"``range(start, stop, step)``. The *start* and *step* arguments default to " -"``None``." +"Return a :term:`slice` object representing the set of indices specified by ``range(start, stop, step)``. The *start* and " +"*step* arguments default to ``None``." msgstr "" +"یک شیء :term:`slice` را برمی‌گرداند که مجموعهٔ اندیس‌های مشخص‌شده توسط ``range(start, stop, step)`` را نمایش می‌دهد. آرگومان‌های " +"*start* و *step* به‌طور پیش‌فرض برابر ``None`` هستند." #: ../../library/functions.rst:1848 msgid "" -"Slice objects are also generated when :ref:`slicing syntax ` is " -"used. For example: ``a[start:stop:step]`` or ``a[start:stop, i]``." +"Slice objects are also generated when :ref:`slicing syntax ` is used. For example: ``a[start:stop:step]`` or " +"``a[start:stop, i]``." msgstr "" +"اشیای slice هنگام استفاده از :ref:`نحو برش ` نیز ایجاد می‌شوند. برای مثال: ``a[start:stop:step]`` یا " +"``a[start:stop, i]``." #: ../../library/functions.rst:1851 -msgid "" -"See :func:`itertools.islice` for an alternate version that returns " -"an :term:`iterator`." -msgstr "" +msgid "See :func:`itertools.islice` for an alternate version that returns an :term:`iterator`." +msgstr "برای نسخهٔ جایگزینی که یک :term:`تکرارگر ` برمی‌گرداند، به :func:`itertools.islice` مراجعه کنید." #: ../../library/functions.rst:1858 msgid "" -"These read-only attributes are set to the argument values (or their " -"default). They have no other explicit functionality; however, they are used " -"by NumPy and other third-party packages." +"These read-only attributes are set to the argument values (or their default). They have no other explicit functionality; " +"however, they are used by NumPy and other third-party packages." msgstr "" +"این ویژگی‌های فقط‌خواندنی بر اساس مقادیر آرگومان‌ها (یا مقادیر پیش‌فرض آن‌ها) تنظیم می‌شوند. خود آن‌ها قابلیت صریح دیگری ندارند؛ " +"بااین‌حال، توسط NumPy و سایر بسته‌های شخص ثالث استفاده می‌شوند." #: ../../library/functions.rst:1862 msgid "" -"Slice objects are now :term:`hashable` " -"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " -"are hashable)." +"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` are " +"hashable)." msgstr "" +"اشیای slice اکنون :term:`هش‌پذیر ` هستند (به شرطی که :attr:`~slice.start`، :attr:`~slice.stop` " +"و :attr:`~slice.step` نیز هش‌پذیر باشند)." #: ../../library/functions.rst:1868 msgid "Return a new sorted list from the items in *iterable*." -msgstr "" +msgstr "یک فهرست مرتب‌شدهٔ جدید از عناصر *iterable* را برمی‌گرداند." #: ../../library/functions.rst:1870 -msgid "" -"Has two optional arguments which must be specified as keyword arguments." -msgstr "" +msgid "Has two optional arguments which must be specified as keyword arguments." +msgstr "دارای دو آرگومان اختیاری است که باید به‌صورت آرگومان‌های کلیدواژه‌ای مشخص شوند." #: ../../library/functions.rst:1872 msgid "" -"*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, " -"``key=str.lower``). The default value is ``None`` (compare the elements " -"directly)." +"*key* specifies a function of one argument that is used to extract a comparison key from each element in *iterable* (for " +"example, ``key=str.lower``). The default value is ``None`` (compare the elements directly)." msgstr "" +"*key* تابعی با یک آرگومان را مشخص می‌کند که برای استخراج یک کلید مقایسه از هر عنصر در *iterable* استفاده می‌شود (برای مثال، " +"``key=str.lower``). مقدار پیش‌فرض آن ``None`` است (در این حالت، عناصر مستقیماً با یکدیگر مقایسه می‌شوند)." #: ../../library/functions.rst:1876 msgid "" -"*reverse* is a boolean value. If set to ``True``, then the list elements " -"are sorted as if each comparison were reversed." +"*reverse* is a boolean value. If set to ``True``, then the list elements are sorted as if each comparison were reversed." msgstr "" +"*reverse* یک مقدار بولی است. اگر برابر ``True`` باشد، عناصر فهرست به گونه‌ای مرتب می‌شوند که گویی نتیجهٔ هر مقایسه معکوس شده " +"است." #: ../../library/functions.rst:1879 -msgid "" -"Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " -"*key* function." -msgstr "" +msgid "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a *key* function." +msgstr "برای تبدیل یک تابع *cmp* به سبک قدیمی به یک تابع *key*، از :func:`functools.cmp_to_key` استفاده کنید." #: ../../library/functions.rst:1882 msgid "" -"The built-in :func:`sorted` function is guaranteed to be stable. A sort is " -"stable if it guarantees not to change the relative order of elements that " -"compare equal --- this is helpful for sorting in multiple passes (for " -"example, sort by department, then by salary grade)." +"The built-in :func:`sorted` function is guaranteed to be stable. A sort is stable if it guarantees not to change the " +"relative order of elements that compare equal --- this is helpful for sorting in multiple passes (for example, sort by " +"department, then by salary grade)." msgstr "" +"تابع داخلی :func:`sorted` تضمین می‌کند که مرتب‌سازی پایدار باشد. مرتب‌سازی پایدار به این معناست که ترتیب نسبی عناصری که با هم " +"برابر مقایسه می‌شوند تغییر نمی‌کند؛ این ویژگی برای مرتب‌سازی چندمرحله‌ای (برای مثال، ابتدا بر اساس دپارتمان و سپس بر اساس ردهٔ " +"حقوق) مفید است." #: ../../library/functions.rst:1887 msgid "" -"The sort algorithm uses only ``<`` comparisons between items. While " -"defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " -"recommends that all six :ref:`rich comparisons ` be " -"implemented. This will help avoid bugs when using the same data with other " -"ordering tools such as :func:`max` that rely on a different underlying " -"method. Implementing all six comparisons also helps avoid confusion for " -"mixed type comparisons which can call the reflected :meth:`~object.__gt__` " -"method." +"The sort algorithm uses only ``<`` comparisons between items. While defining an :meth:`~object.__lt__` method will suffice " +"for sorting, :PEP:`8` recommends that all six :ref:`rich comparisons ` be implemented. This will help avoid " +"bugs when using the same data with other ordering tools such as :func:`max` that rely on a different underlying method. " +"Implementing all six comparisons also helps avoid confusion for mixed type comparisons which can call the " +"reflected :meth:`~object.__gt__` method." msgstr "" +"الگوریتم مرتب‌سازی تنها از مقایسه‌های ``<`` بین عناصر استفاده می‌کند. هرچند تعریف متد :meth:`~object.__lt__` برای مرتب‌سازی " +"کافی است، :PEP:`8` توصیه می‌کند که هر شش عملگر :ref:`مقایسهٔ غنی ` پیاده‌سازی شوند. این کار به جلوگیری از بروز " +"خطا هنگام استفاده از همان داده‌ها با ابزارهای مرتب‌سازی دیگری مانند :func:`max` که به متد زیربنایی متفاوتی متکی هستند کمک " +"می‌کند. همچنین، پیاده‌سازی هر شش مقایسه از سردرگمی در مقایسهٔ انواع مختلف که ممکن است متد بازتابی :meth:`~object.__gt__` را " +"فراخوانی کنند جلوگیری می‌کند." #: ../../library/functions.rst:1896 -msgid "" -"For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." -msgstr "" +msgid "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." +msgstr "برای مثال‌هایی از مرتب‌سازی و یک آموزش کوتاه دربارهٔ آن، به :ref:`sortinghowto` مراجعه کنید." #: ../../library/functions.rst:1900 msgid "Transform a method into a static method." -msgstr "" +msgstr "یک متد را به متد ایستا تبدیل می‌کند." #: ../../library/functions.rst:1902 -msgid "" -"A static method does not receive an implicit first argument. To declare a " -"static method, use this idiom::" -msgstr "" +msgid "A static method does not receive an implicit first argument. To declare a static method, use this idiom::" +msgstr "یک متد ایستا نخستین آرگومان ضمنی دریافت نمی‌کند. برای تعریف یک متد ایستا، از الگوی زیر استفاده کنید::" #: ../../library/functions.rst:1905 msgid "" @@ -2756,36 +2949,40 @@ msgid "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." msgstr "" +"class C:\n" +" @staticmethod\n" +" def f(arg1, arg2, argN): ..." #: ../../library/functions.rst:1909 -msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- " -"see :ref:`function` for details." -msgstr "" +msgid "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:`function` for details." +msgstr "شکل ``@staticmethod`` یک :term:`تزئین‌کننده ` تابع است؛ برای جزئیات به :ref:`function` مراجعه کنید." #: ../../library/functions.rst:1912 msgid "" -"A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static " -"method :term:`descriptor` is also callable, so it can be used in the class " -"definition (such as ``f()``)." +"A static method can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). Moreover, " +"the static method :term:`descriptor` is also callable, so it can be used in the class definition (such as ``f()``)." msgstr "" +"یک متد ایستا را می‌توان هم روی خود کلاس (مانند ``C.f()``) و هم روی یک نمونه (مانند ``C().f()``) فراخوانی کرد. علاوه بر " +"این، :term:`توصیفگر ` متد ایستا نیز فراخوانی‌پذیر است؛ بنابراین می‌توان از آن در تعریف کلاس (مانند ``f()``) " +"استفاده کرد." #: ../../library/functions.rst:1917 msgid "" -"Static methods in Python are similar to those found in Java or C++. Also, " -"see :func:`classmethod` for a variant that is useful for creating alternate " -"class constructors." +"Static methods in Python are similar to those found in Java or C++. Also, see :func:`classmethod` for a variant that is " +"useful for creating alternate class constructors." msgstr "" +"متدهای ایستا در پایتون مشابه متدهای ایستای موجود در جاوا یا ++C هستند. همچنین، برای گونه‌ای که در ایجاد سازنده‌های جایگزین " +"برای کلاس مفید است، به :func:`classmethod` مراجعه کنید." #: ../../library/functions.rst:1921 msgid "" -"Like all decorators, it is also possible to call ``staticmethod`` as a " -"regular function and do something with its result. This is needed in some " -"cases where you need a reference to a function from a class body and you " -"want to avoid the automatic transformation to instance method. For these " -"cases, use this idiom::" +"Like all decorators, it is also possible to call ``staticmethod`` as a regular function and do something with its result. " +"This is needed in some cases where you need a reference to a function from a class body and you want to avoid the automatic " +"transformation to instance method. For these cases, use this idiom::" msgstr "" +"مانند همهٔ دکوراتورها، می‌توان ``staticmethod`` را نیز به‌صورت یک تابع معمولی فراخوانی کرد و از نتیجهٔ آن استفاده نمود. این کار " +"در برخی موارد که به ارجاعی به یک تابع از درون بدنهٔ کلاس نیاز دارید و می‌خواهید از تبدیل خودکار آن به متد نمونه جلوگیری کنید، " +"ضروری است. در چنین مواردی، از الگوی زیر استفاده کنید::" #: ../../library/functions.rst:1927 msgid "" @@ -2795,132 +2992,151 @@ msgid "" "class C:\n" " method = staticmethod(regular_function)" msgstr "" +"def regular_function():\n" +" ...\n" +"\n" +"class C:\n" +" method = staticmethod(regular_function)" #: ../../library/functions.rst:1933 msgid "For more information on static methods, see :ref:`types`." -msgstr "" +msgstr "برای اطلاعات بیشتر دربارهٔ متدهای ایستا، به :ref:`types` مراجعه کنید." #: ../../library/functions.rst:1935 msgid "" "Static methods now inherit the method attributes " "(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " -"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " -"attribute, and are now callable as regular functions." +"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" +"متدهای ایستا اکنون ویژگی‌های متد " +"(:attr:`~function.__module__`، :attr:`~function.__name__`، :attr:`~function.__qualname__`، :attr:`~function.__doc__` " +"و :attr:`~function.__annotations__`) را به ارث می‌برند، دارای ویژگی جدید ``__wrapped__`` هستند و همچنین اکنون مانند توابع " +"معمولی قابل فراخوانی‌اند." #: ../../library/functions.rst:1953 -msgid "" -"Return a :class:`str` version of *object*. See :func:`str` for details." -msgstr "" +msgid "Return a :class:`str` version of *object*. See :func:`str` for details." +msgstr "نسخه‌ای از *object* از نوع :class:`str` را برمی‌گرداند. برای جزئیات بیشتر، به :func:`str` مراجعه کنید." #: ../../library/functions.rst:1955 -msgid "" -"``str`` is the built-in string :term:`class`. For general information about " -"strings, see :ref:`textseq`." -msgstr "" +msgid "``str`` is the built-in string :term:`class`. For general information about strings, see :ref:`textseq`." +msgstr "``str`` :term:`کلاس ` رشتهٔ داخلی پایتون است. برای اطلاعات کلی دربارهٔ رشته‌ها، :ref:`textseq` را ببینید." #: ../../library/functions.rst:1961 msgid "" -"Sums *start* and the items of an *iterable* from left to right and returns " -"the total. The *iterable*'s items are normally numbers, and the start value " -"is not allowed to be a string." +"Sums *start* and the items of an *iterable* from left to right and returns the total. The *iterable*'s items are normally " +"numbers, and the start value is not allowed to be a string." msgstr "" +"*start* و عناصر *iterable* را از چپ به راست با هم جمع می‌کند و مجموع را برمی‌گرداند. عناصر *iterable* معمولاً عدد هستند و " +"مقدار *start* مجاز نیست رشته باشد." #: ../../library/functions.rst:1965 msgid "" -"For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling " -"``''.join(sequence)``. To add floating-point values with extended " -"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " -"consider using :func:`itertools.chain`." +"For some use cases, there are good alternatives to :func:`sum`. The preferred, fast way to concatenate a sequence of " +"strings is by calling ``''.join(sequence)``. To add floating-point values with extended precision, " +"see :func:`math.fsum`\\. To concatenate a series of iterables, consider using :func:`itertools.chain`." msgstr "" +"برای برخی کاربردها، جایگزین‌های مناسبی برای :func:`sum` وجود دارد. روش ترجیحی و سریع برای به‌هم‌چسباندن یک دنباله از رشته‌ها، " +"فراخوانی ``''.join(sequence)`` است. برای جمع کردن اعداد ممیز شناور با دقت بیشتر، به :func:`math.fsum` مراجعه کنید. همچنین " +"برای به‌هم‌پیوستن مجموعه‌ای از تکرارپذیرها، استفاده از :func:`itertools.chain` را در نظر بگیرید." #: ../../library/functions.rst:1971 msgid "The *start* parameter can be specified as a keyword argument." -msgstr "" +msgstr "پارامتر *start* را می‌توان به‌صورت آرگومان کلیدی مشخص کرد." #: ../../library/functions.rst:1974 -msgid "" -"Summation of floats switched to an algorithm that gives higher accuracy and " -"better commutativity on most builds." +msgid "Summation of floats switched to an algorithm that gives higher accuracy and better commutativity on most builds." msgstr "" +"الگوریتم جمع اعداد ممیز شناور به الگوریتمی تغییر یافته است که در بیشتر نسخه‌های ساخت (buildها)، دقت بیشتر و جابجاپذیری بهتری " +"فراهم می‌کند." #: ../../library/functions.rst:1977 -msgid "" -"Added specialization for summation of complexes, using same algorithm as for " -"summation of floats." -msgstr "" +msgid "Added specialization for summation of complexes, using same algorithm as for summation of floats." +msgstr "بهینه‌سازی ویژه‌ای برای جمع اعداد مختلط، با استفاده از همان الگوریتم جمع اعداد اعشاری، اضافه شد." #: ../../library/functions.rst:1985 msgid "" -"Return a proxy object that delegates method calls to a parent or sibling " -"class of *type*. This is useful for accessing inherited methods that have " -"been overridden in a class." +"Return a proxy object that delegates method calls to a parent or sibling class of *type*. This is useful for accessing " +"inherited methods that have been overridden in a class." msgstr "" +"یک شیء واسط را برمی‌گرداند که فراخوانی متدها را به یک کلاس والد یا هم‌ردهٔ *type* واگذار می‌کند. این قابلیت برای دسترسی به " +"متدهای به‌ارث‌رسیده‌ای که در یک کلاس بازنویسی شده‌اند، مفید است." #: ../../library/functions.rst:1989 msgid "" -"The *object_or_type* determines the :term:`method resolution order` to be " -"searched. The search starts from the class right after the *type*." +"The *object_or_type* determines the :term:`method resolution order` to be searched. The search starts from the class right " +"after the *type*." msgstr "" +"*object_or_type* ترتیب :term:`حل متد ` را که باید جستجو شود تعیین می‌کند. جستجو از کلاسی که بلافاصله " +"پس از *type* قرار دارد آغاز می‌شود." #: ../../library/functions.rst:1993 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " -"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " -"searches ``C -> A -> object``." +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -> A -> object`` and the value of *type* is " +"``B``, then :func:`super` searches ``C -> A -> object``." msgstr "" +"برای مثال، اگر :attr:`~type.__mro__` مربوط به *object_or_type* برابر با ``D -> B -> C -> A -> object`` باشد و مقدار *type* " +"برابر ``B`` باشد، در این صورت :func:`super` در مسیر ``C -> A -> object`` جستجو می‌کند." #: ../../library/functions.rst:1997 msgid "" -"The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by " -"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " -"change whenever the inheritance hierarchy is updated." +"The :attr:`~type.__mro__` attribute of the class corresponding to *object_or_type* lists the method resolution search order " +"used by both :func:`getattr` and :func:`super`. The attribute is dynamic and can change whenever the inheritance hierarchy " +"is updated." msgstr "" +"ویژگی :attr:`~type.__mro__` کلاس متناظر با *object_or_type* ترتیب جستجوی حل متد را که هم توسط :func:`getattr` و هم " +"توسط :func:`super` استفاده می‌شود، فهرست می‌کند. این ویژگی پویا است و هر زمان که سلسله‌مراتب وراثت تغییر کند، ممکن است تغییر " +"یابد." #: ../../library/functions.rst:2002 msgid "" -"If the second argument is omitted, the super object returned is unbound. If " -"the second argument is an object, ``isinstance(obj, type)`` must be true. " -"If the second argument is a type, ``issubclass(type2, type)`` must be true " -"(this is useful for classmethods)." +"If the second argument is omitted, the super object returned is unbound. If the second argument is an object, " +"``isinstance(obj, type)`` must be true. If the second argument is a type, ``issubclass(type2, type)`` must be true (this " +"is useful for classmethods)." msgstr "" +"اگر آرگومان دوم حذف شود، شیء super بازگردانده‌شده بدون اتصال (unbound) خواهد بود. اگر آرگومان دوم یک شیء باشد، باید " +"``isinstance(obj, type)`` برقرار باشد. اگر آرگومان دوم یک نوع (type) باشد، باید ``issubclass(type2, type)`` برقرار باشد " +"(این مورد برای متدهای کلاس مفید است)." #: ../../library/functions.rst:2007 msgid "" -"When called directly within an ordinary method of a class, both arguments " -"may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " -"be the enclosing class, and *obj* will be the first argument of the " -"immediately enclosing function (typically ``self``). (This means that zero-" -"argument :func:`!super` will not work as expected within nested functions, " -"including generator expressions, which implicitly create nested functions.)" +"When called directly within an ordinary method of a class, both arguments may be omitted (\"zero-argument :func:`!" +"super`\"). In this case, *type* will be the enclosing class, and *obj* will be the first argument of the immediately " +"enclosing function (typically ``self``). (This means that zero-argument :func:`!super` will not work as expected within " +"nested functions, including generator expressions, which implicitly create nested functions.)" msgstr "" +"هنگامی که این تابع مستقیماً درون یک متد معمولیِ یک کلاس فراخوانی شود، هر دو آرگومان را می‌توان حذف کرد («:func:`!super` بدون " +"آرگومان»). در این حالت، *type* همان کلاسِ محصورکننده خواهد بود و *obj* اولین آرگومانِ تابعِ بلافاصله محصورکننده (معمولاً " +"``self``) خواهد بود. (این بدان معناست که :func:`!super` بدون آرگومان در توابع تو‌در‌تو، از جمله عبارت‌های مولد که به‌طور ضمنی " +"توابع تو‌در‌تو ایجاد می‌کنند، مطابق انتظار عمل نخواهد کرد.)" #: ../../library/functions.rst:2014 msgid "" -"There are two typical use cases for *super*. In a class hierarchy with " -"single inheritance, *super* can be used to refer to parent classes without " -"naming them explicitly, thus making the code more maintainable. This use " -"closely parallels the use of *super* in other programming languages." +"There are two typical use cases for *super*. In a class hierarchy with single inheritance, *super* can be used to refer to " +"parent classes without naming them explicitly, thus making the code more maintainable. This use closely parallels the use " +"of *super* in other programming languages." msgstr "" +"دو کاربرد متداول برای *super* وجود دارد. در سلسله‌مراتب کلاسی با وراثت تکی، می‌توان از *super* برای ارجاع به کلاس‌های والد " +"بدون نام بردن صریح از آن‌ها استفاده کرد و در نتیجه نگهداری کد را آسان‌تر ساخت. این کاربرد بسیار مشابه استفاده از *super* در " +"سایر زبان‌های برنامه‌نویسی است." #: ../../library/functions.rst:2019 msgid "" -"The second use case is to support cooperative multiple inheritance in a " -"dynamic execution environment. This use case is unique to Python and is not " -"found in statically compiled languages or languages that only support single " -"inheritance. This makes it possible to implement \"diamond diagrams\" where " -"multiple base classes implement the same method. Good design dictates that " -"such implementations have the same calling signature in every case (because " -"the order of calls is determined at runtime, because that order adapts to " -"changes in the class hierarchy, and because that order can include sibling " -"classes that are unknown prior to runtime)." +"The second use case is to support cooperative multiple inheritance in a dynamic execution environment. This use case is " +"unique to Python and is not found in statically compiled languages or languages that only support single inheritance. This " +"makes it possible to implement \"diamond diagrams\" where multiple base classes implement the same method. Good design " +"dictates that such implementations have the same calling signature in every case (because the order of calls is determined " +"at runtime, because that order adapts to changes in the class hierarchy, and because that order can include sibling classes " +"that are unknown prior to runtime)." msgstr "" +"کاربرد متداول دوم، پشتیبانی از وراثت چندگانهٔ مشارکتی در یک محیط اجرای پویا است. این کاربرد مختص پایتون است و در زبان‌های " +"کامپایل‌شوندهٔ ایستا یا زبان‌هایی که فقط از وراثت تکی پشتیبانی می‌کنند وجود ندارد. این قابلیت امکان پیاده‌سازی «الگوهای الماسی» " +"را فراهم می‌کند؛ جایی که چندین کلاس پایه یک متد یکسان را پیاده‌سازی می‌کنند. طراحی مناسب ایجاب می‌کند که چنین پیاده‌سازی‌هایی در " +"همهٔ موارد امضای فراخوانی یکسانی داشته باشند (زیرا ترتیب فراخوانی‌ها در زمان اجرا تعیین می‌شود، با تغییرات سلسله‌مراتب کلاس " +"تطبیق می‌یابد و ممکن است شامل کلاس‌های هم‌سطحی باشد که پیش از زمان اجرا ناشناخته هستند)." #: ../../library/functions.rst:2029 msgid "For both use cases, a typical superclass call looks like this::" -msgstr "" +msgstr "در هر دو مورد استفاده، یک فراخوانی معمول به ابرکلاس به صورت زیر است::" #: ../../library/functions.rst:2031 msgid "" @@ -2929,152 +3145,164 @@ msgid "" " super().method(arg) # This does the same thing as:\n" " # super(C, self).method(arg)" msgstr "" +"class C(B):\n" +" def method(self, arg):\n" +" super().method(arg) # This does the same thing as:\n" +" # super(C, self).method(arg)" #: ../../library/functions.rst:2036 msgid "" -"In addition to method lookups, :func:`super` also works for attribute " -"lookups. One possible use case for this is calling :term:`descriptors " -"` in a parent or sibling class." +"In addition to method lookups, :func:`super` also works for attribute lookups. One possible use case for this is " +"calling :term:`descriptors ` in a parent or sibling class." msgstr "" +"علاوه بر جستجوی متدها، :func:`super` برای جستجوی ویژگی‌ها نیز عمل می‌کند. یکی از کاربردهای ممکن آن، فراخوانی :term:`توصیفگرها " +"` در یک کلاس والد یا هم‌رده است." #: ../../library/functions.rst:2040 msgid "" -"Note that :func:`super` is implemented as part of the binding process for " -"explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " -"does so by implementing its own :meth:`~object.__getattribute__` method for " -"searching classes in a predictable order that supports cooperative multiple " -"inheritance. Accordingly, :func:`super` is undefined for implicit lookups " -"using statements or operators such as ``super()[name]``." +"Note that :func:`super` is implemented as part of the binding process for explicit dotted attribute lookups such as " +"``super().__getitem__(name)``. It does so by implementing its own :meth:`~object.__getattribute__` method for searching " +"classes in a predictable order that supports cooperative multiple inheritance. Accordingly, :func:`super` is undefined for " +"implicit lookups using statements or operators such as ``super()[name]``." msgstr "" +"توجه داشته باشید که :func:`super` به‌عنوان بخشی از فرایند اتصال برای جستجوی صریح ویژگی‌ها با نماد نقطه، مانند " +"``super().__getitem__(name)``, پیاده‌سازی شده است. این کار از طریق پیاده‌سازی متد :meth:`~object.__getattribute__` خودش انجام " +"می‌شود تا کلاس‌ها را با ترتیبی قابل پیش‌بینی جستجو کند؛ ترتیبی که از وراثت چندگانهٔ مشارکتی (cooperative multiple inheritance) " +"پشتیبانی می‌کند. بر این اساس، رفتار :func:`super` برای جستجوهای ضمنی که با دستورها یا عملگرهایی مانند ``super()[name]`` " +"انجام می‌شوند، تعریف نشده است." #: ../../library/functions.rst:2048 msgid "" -"Also note that, aside from the zero argument form, :func:`super` is not " -"limited to use inside methods. The two argument form specifies the " -"arguments exactly and makes the appropriate references. The zero argument " -"form only works inside a class definition, as the compiler fills in the " -"necessary details to correctly retrieve the class being defined, as well as " +"Also note that, aside from the zero argument form, :func:`super` is not limited to use inside methods. The two argument " +"form specifies the arguments exactly and makes the appropriate references. The zero argument form only works inside a " +"class definition, as the compiler fills in the necessary details to correctly retrieve the class being defined, as well as " "accessing the current instance for ordinary methods." msgstr "" +"همچنین توجه داشته باشید که، به‌جز حالت بدون آرگومان، :func:`super` محدود به استفاده درون متدها نیست. شکل دوآرگومانی، " +"آرگومان‌ها را دقیقاً همان‌گونه که داده شده‌اند استفاده کرده و ارجاعات مناسب را ایجاد می‌کند. شکل بدون آرگومان فقط درون تعریف یک " +"کلاس کار می‌کند، زیرا کامپایلر جزئیات لازم را برای بازیابی صحیح کلاس در حال تعریف و همچنین دسترسی به نمونهٔ فعلی در متدهای " +"معمولی به‌طور خودکار فراهم می‌کند." #: ../../library/functions.rst:2055 msgid "" -"For practical suggestions on how to design cooperative classes " -"using :func:`super`, see `guide to using super() `_." msgstr "" +"برای پیشنهادهای کاربردی دربارهٔ طراحی کلاس‌های مشارکتی با استفاده از :func:`super`، به `راهنمای استفاده از super() `_ مراجعه کنید." #: ../../library/functions.rst:2059 -msgid "" -":class:`super` objects are now :mod:`pickleable ` " -"and :mod:`copyable `." -msgstr "" +msgid ":class:`super` objects are now :mod:`pickleable ` and :mod:`copyable `." +msgstr "اکنون اشیای :class:`super` از :mod:`سریال‌سازی با pickle ` و :mod:`کپی شدن ` پشتیبانی می‌کنند." #: ../../library/functions.rst:2068 msgid "" -"Rather than being a function, :class:`tuple` is actually an immutable " -"sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." +"Rather than being a function, :class:`tuple` is actually an immutable sequence type, as documented in :ref:`typesseq-tuple` " +"and :ref:`typesseq`." msgstr "" +":class:`tuple` در واقع یک نوع دنبالهٔ تغییرناپذیر است، نه یک تابع؛ همان‌گونه که در :ref:`typesseq-tuple` و :ref:`typesseq` " +"مستند شده است." #: ../../library/functions.rst:2077 msgid "" -"With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned " -"by :attr:`object.__class__`." +"With one argument, return the type of an *object*. The return value is a type object and generally the same object as " +"returned by :attr:`object.__class__`." msgstr "" +"در صورت ارسال یک آرگومان، نوعِ یک *object* را بازمی‌گرداند. مقدار بازگشتی یک شیء از نوع type است و معمولاً همان شیئی است که " +"توسط :attr:`object.__class__` بازگردانده می‌شود." #: ../../library/functions.rst:2081 msgid "" -"The :func:`isinstance` built-in function is recommended for testing the type " -"of an object, because it takes subclasses into account." -msgstr "" +"The :func:`isinstance` built-in function is recommended for testing the type of an object, because it takes subclasses into " +"account." +msgstr "برای بررسی نوع یک شیء، استفاده از تابع داخلی :func:`isinstance` توصیه می‌شود، زیرا زیرکلاس‌ها را نیز در نظر می‌گیرد." #: ../../library/functions.rst:2084 msgid "" -"With three arguments, return a new type object. This is essentially a " -"dynamic form of the :keyword:`class` statement. The *name* string is the " -"class name and becomes the :attr:`~type.__name__` attribute. The *bases* " -"tuple contains the base classes and becomes the :attr:`~type.__bases__` " -"attribute; if empty, :class:`object`, the ultimate base of all classes, is " -"added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming " -"the :attr:`~type.__dict__` attribute. The following two statements create " -"identical :class:`!type` objects:" +"With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` statement. The " +"*name* string is the class name and becomes the :attr:`~type.__name__` attribute. The *bases* tuple contains the base " +"classes and becomes the :attr:`~type.__bases__` attribute; if empty, :class:`object`, the ultimate base of all classes, is " +"added. The *dict* dictionary contains attribute and method definitions for the class body; it may be copied or wrapped " +"before becoming the :attr:`~type.__dict__` attribute. The following two statements create identical :class:`!type` objects:" msgstr "" +"در صورت ارسال سه آرگومان، یک شیء type جدید بازمی‌گرداند. این در واقع شکل پویای دستور :keyword:`class` است. رشتهٔ *name* نام " +"کلاس را مشخص می‌کند و به ویژگی :attr:`~type.__name__` تبدیل می‌شود. تاپل *bases* کلاس‌های پایه را در خود نگه می‌دارد و به " +"ویژگی :attr:`~type.__bases__` تبدیل می‌شود؛ اگر خالی باشد، :class:`object`، که کلاس پایهٔ نهایی همهٔ کلاس‌ها است، به آن افزوده " +"می‌شود. دیکشنری *dict* شامل تعریف ویژگی‌ها و متدهای بدنهٔ کلاس است؛ این دیکشنری ممکن است پیش از تبدیل شدن به " +"ویژگی :attr:`~type.__dict__` کپی یا در یک wrapper قرار داده شود. دو دستور زیر اشیای :class:`!type` یکسانی ایجاد می‌کنند:" #: ../../library/functions.rst:2099 msgid "See also:" -msgstr "" +msgstr "همچنین ببینید:" #: ../../library/functions.rst:2101 -msgid "" -":ref:`Documentation on attributes and methods on classes `." -msgstr "" +msgid ":ref:`Documentation on attributes and methods on classes `." +msgstr ":ref:`مستندات ویژگی‌ها و متدهای کلاس‌ها `." #: ../../library/functions.rst:2102 msgid ":ref:`bltin-type-objects`" -msgstr "" +msgstr ":ref:`bltin-type-objects`" #: ../../library/functions.rst:2104 msgid "" -"Keyword arguments provided to the three argument form are passed to the " -"appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " -"in the same way that keywords in a class definition (besides *metaclass*) " -"would." +"Keyword arguments provided to the three argument form are passed to the appropriate metaclass machinery " +"(usually :meth:`~object.__init_subclass__`) in the same way that keywords in a class definition (besides *metaclass*) would." msgstr "" +"آرگومان‌های کلیدواژه‌ای که به شکل سه‌آرگومانی ارسال می‌شوند، همانند کلیدواژه‌های موجود در تعریف یک کلاس (به‌جز *فرا‌داده*) به " +"سازوکار مناسب فراداده (معمولاً :meth:`~object.__init_subclass__`) ارسال می‌شوند." #: ../../library/functions.rst:2109 msgid "See also :ref:`class-customization`." -msgstr "" +msgstr "همچنین به :ref:`class-customization` مراجعه کنید." #: ../../library/functions.rst:2111 msgid "" -"Subclasses of :class:`!type` which don't override ``type.__new__`` may no " -"longer use the one-argument form to get the type of an object." +"Subclasses of :class:`!type` which don't override ``type.__new__`` may no longer use the one-argument form to get the type " +"of an object." msgstr "" +"زیرکلاس‌های :class:`!type` که ``type.__new__`` را بازنویسی نمی‌کنند، دیگر نمی‌توانند از شکل تک‌آرگومانی برای دریافت نوع یک شیء " +"استفاده کنند." #: ../../library/functions.rst:2118 msgid "" -"Return the :attr:`~object.__dict__` attribute for a module, class, instance, " -"or any other object with a :attr:`!__dict__` attribute." +"Return the :attr:`~object.__dict__` attribute for a module, class, instance, or any other object with a :attr:`!__dict__` " +"attribute." msgstr "" +"ویژگی :attr:`~object.__dict__` یک ماژول، کلاس، نمونه یا هر شیء دیگری که دارای ویژگی :attr:`!__dict__` باشد را برمی‌گرداند." #: ../../library/functions.rst:2121 msgid "" -"Objects such as modules and instances have an " -"updateable :attr:`~object.__dict__` attribute; however, other objects may " -"have write restrictions on their :attr:`!__dict__` attributes (for example, " -"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " -"updates)." +"Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may " +"have write restrictions on their :attr:`!__dict__` attributes (for example, classes use a :class:`types.MappingProxyType` " +"to prevent direct dictionary updates)." msgstr "" +"اشیایی مانند ماژول‌ها و نمونه‌ها دارای ویژگی :attr:`~object.__dict__` قابل‌به‌روزرسانی هستند؛ با این حال، برخی اشیای دیگر ممکن " +"است محدودیت‌هایی برای نوشتن در ویژگی :attr:`!__dict__` خود داشته باشند (برای مثال، کلاس‌ها از :class:`types.MappingProxyType` " +"برای جلوگیری از به‌روزرسانی مستقیم فرهنگ لغت استفاده می‌کنند)." #: ../../library/functions.rst:2126 msgid "Without an argument, :func:`vars` acts like :func:`locals`." -msgstr "" +msgstr "در صورت نداشتن آرگومان، :func:`vars` همانند :func:`locals` عمل می‌کند." #: ../../library/functions.rst:2128 msgid "" -"A :exc:`TypeError` exception is raised if an object is specified but it " -"doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " -"defines the :attr:`~object.__slots__` attribute)." +"A :exc:`TypeError` exception is raised if an object is specified but it doesn't have a :attr:`~object.__dict__` attribute " +"(for example, if its class defines the :attr:`~object.__slots__` attribute)." msgstr "" +"اگر شیئی مشخص شود اما دارای ویژگی :attr:`~object.__dict__` نباشد (برای مثال، اگر کلاس آن ویژگی :attr:`~object.__slots__` را " +"تعریف کرده باشد)، استثنای :exc:`TypeError` ایجاد می‌شود." #: ../../library/functions.rst:2134 -msgid "" -"The result of calling this function without an argument has been updated as " -"described for the :func:`locals` builtin." -msgstr "" +msgid "The result of calling this function without an argument has been updated as described for the :func:`locals` builtin." +msgstr "نتیجهٔ فراخوانی این تابع بدون آرگومان، مطابق توضیحات ارائه‌شده برای تابع داخلی :func:`locals` به‌روزرسانی شده است." #: ../../library/functions.rst:2140 -msgid "" -"Iterate over several iterables in parallel, producing tuples with an item " -"from each one." -msgstr "" +msgid "Iterate over several iterables in parallel, producing tuples with an item from each one." +msgstr "روی چندین تکرارپذیر به‌طور هم‌زمان پیمایش می‌کند و تاپل‌هایی تولید می‌کند که هر یک شامل یک عنصر از هر تکرارپذیر هستند." #: ../../library/functions.rst:2143 msgid "Example::" -msgstr "" +msgstr "مثال::" #: ../../library/functions.rst:2145 msgid "" @@ -3085,105 +3313,125 @@ msgid "" "(2, 'spice')\n" "(3, 'everything nice')" msgstr "" +">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" +"... print(item)\n" +"...\n" +"(1, 'sugar')\n" +"(2, 'spice')\n" +"(3, 'everything nice')" #: ../../library/functions.rst:2152 msgid "" -"More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " -"tuple contains the *i*-th element from each of the argument iterables." +"More formally: :func:`zip` returns an iterator of tuples, where the *i*-th tuple contains the *i*-th element from each of " +"the argument iterables." msgstr "" +"به‌طور دقیق‌تر، :func:`zip` یک تکرارگر از تاپل‌ها برمی‌گرداند که در آن، تاپل *i*ام شامل عنصر *i*ام از هر یک از تکرارپذیرهای " +"آرگومان‌ها است." #: ../../library/functions.rst:2155 msgid "" -"Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"Another way to think of :func:`zip` is that it turns rows into columns, and columns into rows. This is similar to " +"`transposing a matrix `_." msgstr "" +"راه دیگری برای درک :func:`zip` این است که سطرها را به ستون‌ها و ستون‌ها را به سطرها تبدیل می‌کند. این کار مشابه `ترانهادهٔ یک " +"ماتریس `_ است." #: ../../library/functions.rst:2159 msgid "" -":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " -"a :class:`list`." +":func:`zip` is lazy: The elements won't be processed until the iterable is iterated on, e.g. by a :keyword:`!for` loop or " +"by wrapping in a :class:`list`." msgstr "" +":func:`zip` تنبل است؛ عناصر تا زمانی که روی تکرارپذیر پیمایش انجام نشود، پردازش نمی‌شوند؛ برای مثال، با یک حلقهٔ :keyword:`!" +"for` یا با قرار دادن آن در :class:`list`." #: ../../library/functions.rst:2163 msgid "" -"One thing to consider is that the iterables passed to :func:`zip` could have " -"different lengths; sometimes by design, and sometimes because of a bug in " -"the code that prepared these iterables. Python offers three different " -"approaches to dealing with this issue:" +"One thing to consider is that the iterables passed to :func:`zip` could have different lengths; sometimes by design, and " +"sometimes because of a bug in the code that prepared these iterables. Python offers three different approaches to dealing " +"with this issue:" msgstr "" +"یکی از نکاتی که باید در نظر داشت این است که تکرارپذیرهای ارسال‌شده به :func:`zip` ممکن است طول‌های متفاوتی داشته باشند؛ گاهی " +"این موضوع عمدی است و گاهی به دلیل وجود یک باگ در کدی است که این تکرارپذیرها را آماده کرده است. پایتون سه روش مختلف برای " +"برخورد با این مسئله ارائه می‌دهد:" #: ../../library/functions.rst:2168 msgid "" -"By default, :func:`zip` stops when the shortest iterable is exhausted. It " -"will ignore the remaining items in the longer iterables, cutting off the " -"result to the length of the shortest iterable::" +"By default, :func:`zip` stops when the shortest iterable is exhausted. It will ignore the remaining items in the longer " +"iterables, cutting off the result to the length of the shortest iterable::" msgstr "" +"به‌طور پیش‌فرض، :func:`zip` زمانی متوقف می‌شود که کوتاه‌ترین تکرارپذیر به پایان برسد. در این حالت، عناصر باقی‌مانده در " +"تکرارپذیرهای بلندتر نادیده گرفته می‌شوند و طول نتیجه برابر با طول کوتاه‌ترین تکرارپذیر خواهد بود::" #: ../../library/functions.rst:2172 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" msgstr "" +">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" +"[(0, 'fee'), (1, 'fi'), (2, 'fo')]" #: ../../library/functions.rst:2175 msgid "" -":func:`zip` is often used in cases where the iterables are assumed to be of " -"equal length. In such cases, it's recommended to use the ``strict=True`` " -"option. Its output is the same as regular :func:`zip`::" +":func:`zip` is often used in cases where the iterables are assumed to be of equal length. In such cases, it's recommended " +"to use the ``strict=True`` option. Its output is the same as regular :func:`zip`::" msgstr "" +"از :func:`zip` اغلب در مواردی استفاده می‌شود که فرض بر این است تکرارپذیرها طول یکسانی دارند. در چنین مواردی، توصیه می‌شود از " +"گزینهٔ ``strict=True`` استفاده کنید. خروجی آن با :func:`zip` معمولی یکسان است::" #: ../../library/functions.rst:2179 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" msgstr "" +">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" +"[('a', 1), ('b', 2), ('c', 3)]" #: ../../library/functions.rst:2182 -msgid "" -"Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " -"is exhausted before the others:" -msgstr "" +msgid "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable is exhausted before the others:" +msgstr "برخلاف رفتار پیش‌فرض، اگر یکی از تکرارپذیرها پیش از بقیه به پایان برسد، استثنای :exc:`ValueError` ایجاد می‌کند:" #: ../../library/functions.rst:2200 msgid "" -"Without the ``strict=True`` argument, any bug that results in iterables of " -"different lengths will be silenced, possibly manifesting as a hard-to-find " -"bug in another part of the program." +"Without the ``strict=True`` argument, any bug that results in iterables of different lengths will be silenced, possibly " +"manifesting as a hard-to-find bug in another part of the program." msgstr "" +"بدون آرگومان ``strict=True``، هر اشکالی که باعث شود تکرارشونده‌ها طول‌های متفاوتی داشته باشند، بی‌صدا نادیده گرفته می‌شود و " +"ممکن است در بخش دیگری از برنامه به‌صورت یک باگ دشوار برای یافتن ظاهر شود." #: ../../library/functions.rst:2204 msgid "" -"Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done " +"Shorter iterables can be padded with a constant value to make all the iterables have the same length. This is done " "by :func:`itertools.zip_longest`." msgstr "" +"می‌توان تکرارپذیرهای کوتاه‌تر را با یک مقدار ثابت پُر کرد تا همهٔ تکرارپذیرها طول یکسانی داشته باشند. این کار " +"توسط :func:`itertools.zip_longest` انجام می‌شود." #: ../../library/functions.rst:2208 msgid "" -"Edge cases: With a single iterable argument, :func:`zip` returns an iterator " -"of 1-tuples. With no arguments, it returns an empty iterator." +"Edge cases: With a single iterable argument, :func:`zip` returns an iterator of 1-tuples. With no arguments, it returns an " +"empty iterator." msgstr "" +"حالت‌های خاص: اگر فقط یک آرگومان تکرارپذیر به :func:`zip` داده شود، یک تکرارگر از تاپل‌های تک‌عضوی برمی‌گرداند. اگر هیچ " +"آرگومانی داده نشود، یک تکرارگر خالی برمی‌گرداند." #: ../../library/functions.rst:2211 msgid "Tips and tricks:" -msgstr "" +msgstr "نکته‌ها و ترفندها:" #: ../../library/functions.rst:2213 msgid "" -"The left-to-right evaluation order of the iterables is guaranteed. This " -"makes possible an idiom for clustering a data series into n-length groups " -"using ``zip(*[iter(s)]*n, strict=True)``. This repeats the *same* iterator " -"``n`` times so that each output tuple has the result of ``n`` calls to the " -"iterator. This has the effect of dividing the input into n-length chunks." +"The left-to-right evaluation order of the iterables is guaranteed. This makes possible an idiom for clustering a data " +"series into n-length groups using ``zip(*[iter(s)]*n, strict=True)``. This repeats the *same* iterator ``n`` times so that " +"each output tuple has the result of ``n`` calls to the iterator. This has the effect of dividing the input into n-length " +"chunks." msgstr "" +"ترتیب ارزیابی تکرارپذیرها از چپ به راست تضمین شده است. این موضوع امکان استفاده از الگوی ``zip(*[iter(s)]*n, strict=True)`` " +"را برای گروه‌بندی یک دنبالهٔ داده به گروه‌هایی با طول n فراهم می‌کند. در این روش، *همان* تکرارگر ``n`` بار تکرار می‌شود تا " +"هر تاپل خروجی حاصل ``n`` فراخوانی از همان تکرارگر باشد. نتیجهٔ این کار تقسیم ورودی به قطعاتی با طول n است." #: ../../library/functions.rst:2219 -msgid "" -":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " -"list::" -msgstr "" +msgid ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a list::" +msgstr "می‌توان از :func:`zip` همراه با عملگر ``*`` برای بازکردن یک فهرست استفاده کرد::" #: ../../library/functions.rst:2222 msgid "" @@ -3195,85 +3443,98 @@ msgid "" ">>> x == list(x2) and y == list(y2)\n" "True" msgstr "" +">>> x = [1, 2, 3]\n" +">>> y = [4, 5, 6]\n" +">>> list(zip(x, y))\n" +"[(1, 4), (2, 5), (3, 6)]\n" +">>> x2, y2 = zip(*zip(x, y))\n" +">>> x == list(x2) and y == list(y2)\n" +"True" #: ../../library/functions.rst:2230 msgid "Added the ``strict`` argument." -msgstr "" +msgstr "آرگومان ``strict`` اضافه شد." #: ../../library/functions.rst:2242 msgid "" -"This is an advanced function that is not needed in everyday Python " -"programming, unlike :func:`importlib.import_module`." +"This is an advanced function that is not needed in everyday Python programming, unlike :func:`importlib.import_module`." msgstr "" +"این تابع پیشرفته‌ای است که برخلاف :func:`importlib.import_module` در برنامه‌نویسی روزمرهٔ پایتون معمولاً به آن نیازی نخواهید " +"داشت." #: ../../library/functions.rst:2245 msgid "" -"This function is invoked by the :keyword:`import` statement. It can be " -"replaced (by importing the :mod:`builtins` module and assigning to " -"``builtins.__import__``) in order to change semantics of the :keyword:`!" -"import` statement, but doing so is **strongly** discouraged as it is usually " -"simpler to use import hooks (see :pep:`302`) to attain the same goals and " -"does not cause issues with code which assumes the default import " -"implementation is in use. Direct use of :func:`__import__` is also " -"discouraged in favor of :func:`importlib.import_module`." +"This function is invoked by the :keyword:`import` statement. It can be replaced (by importing the :mod:`builtins` module " +"and assigning to ``builtins.__import__``) in order to change semantics of the :keyword:`!import` statement, but doing so is " +"**strongly** discouraged as it is usually simpler to use import hooks (see :pep:`302`) to attain the same goals and does " +"not cause issues with code which assumes the default import implementation is in use. Direct use of :func:`__import__` is " +"also discouraged in favor of :func:`importlib.import_module`." msgstr "" +"این تابع توسط دستور :keyword:`import` فراخوانی می‌شود. برای تغییر معنای دستور :keyword:`!import` می‌توان آن را (با وارد کردن " +"ماژول :mod:`builtins` و انتساب به ``builtins.__import__``) جایگزین کرد، اما انجام این کار **اکیداً توصیه نمی‌شود**، زیرا " +"معمولاً استفاده از import hookها (به :pep:`302` مراجعه کنید) برای دستیابی به همان هدف ساده‌تر است و با کدی که فرض می‌کند " +"پیاده‌سازی پیش‌فرض import در حال استفاده است نیز مشکلی ایجاد نمی‌کند. همچنین استفادهٔ مستقیم از :func:`__import__` به " +"نفع :func:`importlib.import_module` توصیه نمی‌شود." #: ../../library/functions.rst:2254 msgid "" -"The function imports the module *name*, potentially using the given " -"*globals* and *locals* to determine how to interpret the name in a package " -"context. The *fromlist* gives the names of objects or submodules that should " -"be imported from the module given by *name*. The standard implementation " -"does not use its *locals* argument at all and uses its *globals* only to " -"determine the package context of the :keyword:`import` statement." +"The function imports the module *name*, potentially using the given *globals* and *locals* to determine how to interpret " +"the name in a package context. The *fromlist* gives the names of objects or submodules that should be imported from the " +"module given by *name*. The standard implementation does not use its *locals* argument at all and uses its *globals* only " +"to determine the package context of the :keyword:`import` statement." msgstr "" +"این تابع ماژول *name* را درون‌ریزی می‌کند و در صورت نیاز از *globals* و *locals* داده‌شده برای تعیین نحوهٔ تفسیر نام در زمینهٔ " +"یک بسته استفاده می‌کند. آرگومان *fromlist* نام اشیا یا زیرماژول‌هایی را مشخص می‌کند که باید از ماژول مشخص‌شده توسط *name* وارد " +"شوند. پیاده‌سازی استاندارد اصلاً از آرگومان *locals* استفاده نمی‌کند و از *globals* تنها برای تعیین زمینهٔ بسته در " +"دستور :keyword:`import` بهره می‌برد." #: ../../library/functions.rst:2261 msgid "" -"*level* specifies whether to use absolute or relative imports. ``0`` (the " -"default) means only perform absolute imports. Positive values for *level* " -"indicate the number of parent directories to search relative to the " -"directory of the module calling :func:`__import__` (see :pep:`328` for the " -"details)." +"*level* specifies whether to use absolute or relative imports. ``0`` (the default) means only perform absolute imports. " +"Positive values for *level* indicate the number of parent directories to search relative to the directory of the module " +"calling :func:`__import__` (see :pep:`328` for the details)." msgstr "" +"*level* مشخص می‌کند که از درون‌ریزی مطلق استفاده شود یا نسبی. مقدار ``0`` (که مقدار پیش‌فرض است) به این معناست که فقط درون‌ریزی " +"مطلق انجام شود. مقادیر مثبت برای *level* تعداد پوشه‌های والد را مشخص می‌کنند که باید نسبت به پوشهٔ ماژولی " +"که :func:`__import__` را فراخوانی کرده است جستجو شوند (برای جزئیات، :pep:`328` را ببینید)." #: ../../library/functions.rst:2267 msgid "" -"When the *name* variable is of the form ``package.module``, normally, the " -"top-level package (the name up till the first dot) is returned, *not* the " -"module named by *name*. However, when a non-empty *fromlist* argument is " -"given, the module named by *name* is returned." +"When the *name* variable is of the form ``package.module``, normally, the top-level package (the name up till the first " +"dot) is returned, *not* the module named by *name*. However, when a non-empty *fromlist* argument is given, the module " +"named by *name* is returned." msgstr "" +"وقتی متغیر *name* به شکل ``package.module`` باشد، به‌طور معمول بستهٔ سطح بالا (بخشی از نام تا اولین نقطه) بازگردانده می‌شود، " +"نه ماژولی که *name* به آن اشاره می‌کند. با این حال، اگر آرگومان *fromlist* ناتهی باشد، ماژول مشخص‌شده توسط *name* بازگردانده " +"می‌شود." #: ../../library/functions.rst:2272 -msgid "" -"For example, the statement ``import spam`` results in bytecode resembling " -"the following code::" -msgstr "" +msgid "For example, the statement ``import spam`` results in bytecode resembling the following code::" +msgstr "برای مثال، دستور ``import spam`` به بایت‌کدی مشابه کد زیر تبدیل می‌شود::" #: ../../library/functions.rst:2275 msgid "spam = __import__('spam', globals(), locals(), [], 0)" -msgstr "" +msgstr "spam = __import__('spam', globals(), locals(), [], 0)" #: ../../library/functions.rst:2277 msgid "The statement ``import spam.ham`` results in this call::" -msgstr "" +msgstr "دستور ``import spam.ham`` منجر به این فراخوانی می‌شود::" #: ../../library/functions.rst:2279 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" -msgstr "" +msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" #: ../../library/functions.rst:2281 msgid "" -"Note how :func:`__import__` returns the toplevel module here because this is " -"the object that is bound to a name by the :keyword:`import` statement." +"Note how :func:`__import__` returns the toplevel module here because this is the object that is bound to a name by " +"the :keyword:`import` statement." msgstr "" +"توجه داشته باشید که :func:`__import__` در اینجا ماژول سطح بالا را برمی‌گرداند، زیرا این همان شیئی است که توسط " +"دستور :keyword:`import` به یک نام منتسب می‌شود." #: ../../library/functions.rst:2284 -msgid "" -"On the other hand, the statement ``from spam.ham import eggs, sausage as " -"saus`` results in ::" -msgstr "" +msgid "On the other hand, the statement ``from spam.ham import eggs, sausage as saus`` results in ::" +msgstr "از سوی دیگر، دستور ``from spam.ham import eggs, sausage as saus`` به نتیجهٔ زیر منجر می‌شود::" #: ../../library/functions.rst:2287 msgid "" @@ -3281,147 +3542,152 @@ msgid "" "eggs = _temp.eggs\n" "saus = _temp.sausage" msgstr "" +"_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" +"eggs = _temp.eggs\n" +"saus = _temp.sausage" #: ../../library/functions.rst:2291 msgid "" -"Here, the ``spam.ham`` module is returned from :func:`__import__`. From " -"this object, the names to import are retrieved and assigned to their " -"respective names." +"Here, the ``spam.ham`` module is returned from :func:`__import__`. From this object, the names to import are retrieved and " +"assigned to their respective names." msgstr "" +"در اینجا، ماژول ``spam.ham`` از :func:`__import__` بازگردانده می‌شود. سپس، نام‌هایی که باید درون‌ریزی شوند از این شیء استخراج " +"شده و به نام‌های متناظر خود اختصاص داده می‌شوند." #: ../../library/functions.rst:2295 -msgid "" -"If you simply want to import a module (potentially within a package) by " -"name, use :func:`importlib.import_module`." +msgid "If you simply want to import a module (potentially within a package) by name, use :func:`importlib.import_module`." msgstr "" +"اگر فقط می‌خواهید یک ماژول (احتمالاً درون یک بسته) را بر اساس نام آن درون‌ریزی کنید، از :func:`importlib.import_module` " +"استفاده کنید." #: ../../library/functions.rst:2298 -msgid "" -"Negative values for *level* are no longer supported (which also changes the " -"default value to 0)." -msgstr "" +msgid "Negative values for *level* are no longer supported (which also changes the default value to 0)." +msgstr "مقادیر منفی برای *level* دیگر پشتیبانی نمی‌شوند (در نتیجه، مقدار پیش‌فرض آن نیز به 0 تغییر کرده است)." #: ../../library/functions.rst:2302 msgid "" -"When the command line options :option:`-E` or :option:`-I` are being used, " -"the environment variable :envvar:`PYTHONCASEOK` is now ignored." +"When the command line options :option:`-E` or :option:`-I` are being used, the environment variable :envvar:`PYTHONCASEOK` " +"is now ignored." msgstr "" +"هنگامی که گزینه‌های خط فرمان :option:`-E` یا :option:`-I` استفاده شوند، متغیر محیطی :envvar:`PYTHONCASEOK` نادیده گرفته " +"می‌شود." #: ../../library/functions.rst:2307 msgid "Footnotes" -msgstr "" +msgstr "پاورقی‌ها" #: ../../library/functions.rst:2308 msgid "" -"Note that the parser only accepts the Unix-style end of line convention. If " -"you are reading the code from a file, make sure to use newline conversion " -"mode to convert Windows or Mac-style newlines." +"Note that the parser only accepts the Unix-style end of line convention. If you are reading the code from a file, make sure " +"to use newline conversion mode to convert Windows or Mac-style newlines." msgstr "" +"توجه داشته باشید که تجزیه‌کننده (parser) فقط قرارداد پایان خط به سبک یونیکس را می‌پذیرد. اگر کد را از یک پرونده می‌خوانید، " +"مطمئن شوید که از حالت تبدیل نویسهٔ پایان خط برای تبدیل پایان خط‌های ویندوز یا مک استفاده می‌کنید." #: ../../library/functions.rst:156 msgid "Boolean" -msgstr "" +msgstr "بولی" #: ../../library/functions.rst:156 ../../library/functions.rst:2075 msgid "type" -msgstr "" +msgstr "نوع" #: ../../library/functions.rst:655 msgid "built-in function" -msgstr "" +msgstr "تابع پیش ساخته" #: ../../library/functions.rst:655 msgid "exec" -msgstr "" +msgstr "exec" #: ../../library/functions.rst:754 msgid "NaN" -msgstr "" +msgstr "NaN" #: ../../library/functions.rst:754 msgid "Infinity" -msgstr "" +msgstr "بی‌نهایت" #: ../../library/functions.rst:824 msgid "__format__" -msgstr "" +msgstr "__format__" #: ../../library/functions.rst:824 ../../library/functions.rst:1943 msgid "string" -msgstr "" +msgstr "رشته" #: ../../library/functions.rst:824 msgid "format() (built-in function)" -msgstr "" +msgstr "format() (تابع پیش ساخته)" #: ../../library/functions.rst:1338 msgid "file object" -msgstr "" +msgstr "شیء پرونده" #: ../../library/functions.rst:1338 ../../library/functions.rst:1459 msgid "open() built-in function" -msgstr "" +msgstr "تابع داخلی open()" #: ../../library/functions.rst:1366 msgid "file" -msgstr "" +msgstr "پرونده" #: ../../library/functions.rst:1366 msgid "modes" -msgstr "" +msgstr "حالات" #: ../../library/functions.rst:1459 msgid "universal newlines" -msgstr "" +msgstr "پایان‌خط‌های همگانی" #: ../../library/functions.rst:1520 msgid "line-buffered I/O" -msgstr "" +msgstr "ورودی/خروجی با بافرگذاری خطی" #: ../../library/functions.rst:1520 msgid "unbuffered I/O" -msgstr "" +msgstr "ورودی/خروجی بافرگذاری‌نشده" #: ../../library/functions.rst:1520 msgid "buffer size, I/O" -msgstr "" +msgstr "اندازهٔ بافر، ورودی/خروجی" #: ../../library/functions.rst:1520 msgid "I/O control" -msgstr "" +msgstr "کنترل ورودی/خروجی" #: ../../library/functions.rst:1520 msgid "buffering" -msgstr "" +msgstr "بافرگذاری" #: ../../library/functions.rst:1520 msgid "text mode" -msgstr "" +msgstr "حالت متن" #: ../../library/functions.rst:1520 ../../library/functions.rst:2236 msgid "module" -msgstr "" +msgstr "ماژول" #: ../../library/functions.rst:1520 msgid "sys" -msgstr "" +msgstr "sys" #: ../../library/functions.rst:1943 msgid "str() (built-in function)" -msgstr "" +msgstr "str() (تابع داخلی)" #: ../../library/functions.rst:2075 msgid "object" -msgstr "" +msgstr "شیء" #: ../../library/functions.rst:2236 msgid "statement" -msgstr "" +msgstr "دستور" #: ../../library/functions.rst:2236 msgid "import" -msgstr "" +msgstr "درون‌ریزی" #: ../../library/functions.rst:2236 msgid "builtins" -msgstr "" +msgstr "پیش ساخته‌ها" diff --git a/scripts/check_markup.py b/scripts/check_markup.py index 743badcdc..922a7e72b 100644 --- a/scripts/check_markup.py +++ b/scripts/check_markup.py @@ -2,13 +2,12 @@ """ scripts/check_markup.py -Verify that Sphinx roles, inline literals, and format placeholders match -exactly between the English msgid and the Persian msgstr — nothing missing, -and nothing extra. Catches both the common review slip (translating or -dropping `:class:`int``-style markup, ``code`` spans, %s/{0} placeholders, -|substitution| refs) and the subtler mistake of adding a reference that -doesn't exist in the original (which Sphinx's own build treats as a hard -error under -W, e.g. "inconsistent term references in translated message"). +Verify Sphinx markup consistency between msgid and msgstr: + - Roles like :term:`text ` — the *target* (or the whole role, if + it has no explicit target) must match; the display text is expected to + be translated, matching Sphinx's own translation convention. + - Literal/code spans (``...``), substitution refs (|...|), and %s/{name} + placeholders — these must match verbatim, since they're not prose. Requires: pip install polib @@ -24,8 +23,10 @@ import polib -PATTERNS = [ - ("sphinx role", re.compile(r":(?:\w+:)?[\w.-]+:`.*?`")), +ROLE_PATTERN = re.compile(r":(?:\w+:)?[\w.-]+:`([^`]+)`") +TARGET_PATTERN = re.compile(r"^(.*)\s<([^<>]+)>$") + +LITERAL_PATTERNS = [ ("literal/code span", re.compile(r"``.*?``")), ("substitution ref", re.compile(r"\|[\w.-]+\|")), ("percent placeholder", re.compile(r"%\(\w+\)[a-zA-Z]|%[a-zA-Z]")), @@ -33,29 +34,52 @@ ] +def extract_role_targets(text: str): + """For each Sphinx role, return its target: the anchor if + present, otherwise the role's full display text (which IS the target + when there's no explicit anchor).""" + targets = [] + for body in ROLE_PATTERN.findall(text): + m = TARGET_PATTERN.match(body) + targets.append(m.group(2).strip() if m else body.strip()) + return targets + + def check_file(path: Path) -> int: problems = 0 po = polib.pofile(str(path)) for entry in po: if entry.obsolete or not entry.msgid or not entry.msgstr: continue # obsolete entry, header, or still untranslated - for label, pattern in PATTERNS: + + findings = [] + + expected_targets = Counter(extract_role_targets(entry.msgid)) + found_targets = Counter(extract_role_targets(entry.msgstr)) + if expected_targets != found_targets: + missing = list((expected_targets - found_targets).elements()) + extra = list((found_targets - expected_targets).elements()) + if missing: + findings.append(f"missing role target(s): {missing}") + if extra: + findings.append(f"role target(s) not in source: {extra}") + + for label, pattern in LITERAL_PATTERNS: expected = Counter(pattern.findall(entry.msgid)) found = Counter(pattern.findall(entry.msgstr)) - if expected == found: - continue + if expected != found: + missing = list((expected - found).elements()) + extra = list((found - expected).elements()) + if missing: + findings.append(f"missing {label}: {missing}") + if extra: + findings.append(f"extra {label} not in source: {extra}") - missing = list((expected - found).elements()) - extra = list((found - expected).elements()) + if findings: problems += 1 loc = f" ({entry.occurrences[0][0]}:{entry.occurrences[0][1]})" if entry.occurrences else "" tag = " [fuzzy]" if entry.fuzzy else "" - parts = [] - if missing: - parts.append(f"missing {label}: {missing}") - if extra: - parts.append(f"extra {label} not in source: {extra}") - print(f"{path}{loc}{tag}: {'; '.join(parts)}") + print(f"{path}{loc}{tag}: {'; '.join(findings)}") print(f" msgid : {entry.msgid[:100]}") print(f" msgstr: {entry.msgstr[:100]}") return problems